tb-scripts: add ,optipng and ,zipdir utility scripts
Add two new shell utility scripts to the custom script packages: ,optipng - Parallel PNG optimization wrapper - Detects available CPU cores and runs optipng in parallel using xargs - Accepts optional file arguments, defaults to all *.png in current dir - Uses maximum compression level (-o7) for best results - Added to tb-dev-scripts package with optipng as runtime dependency ,zipdir - Quick directory archiving helper - Creates a zip archive of the current directory - Names the archive after the directory and places it in parent folder - Uses maximum compression (-9) with extra attributes excluded (-X) - Added to tb-scripts package with zip as runtime dependency 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,5 +20,11 @@ pkgs.symlinkJoin {
|
|||||||
"--prefix PATH : ${lib.makeBinPath [ pkgs.ffmpeg ]}"
|
"--prefix PATH : ${lib.makeBinPath [ pkgs.ffmpeg ]}"
|
||||||
];
|
];
|
||||||
} (builtins.readFile ./video_loop_extractor.py))
|
} (builtins.readFile ./video_loop_extractor.py))
|
||||||
|
|
||||||
|
(pkgs.writeShellApplication {
|
||||||
|
name = ",optipng";
|
||||||
|
runtimeInputs = [ pkgs.optipng ];
|
||||||
|
text = builtins.readFile ./optipng;
|
||||||
|
})
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
13
pkgs/tb-dev-scripts/optipng
Executable file
13
pkgs/tb-dev-scripts/optipng
Executable file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh -x
|
||||||
|
|
||||||
|
PROCS=$(grep -c ^processor /proc/cpuinfo)
|
||||||
|
|
||||||
|
if [ -z "$@" ]; then
|
||||||
|
(for f in *.png; do
|
||||||
|
echo "$f";
|
||||||
|
done) | xargs -P$PROCS -d'\n' -n1 optipng -o7
|
||||||
|
else
|
||||||
|
(for f in "$@"; do
|
||||||
|
echo "$f";
|
||||||
|
done) | xargs -P$PROCS -d'\n' -n1 optipng -o7
|
||||||
|
fi
|
||||||
@@ -15,5 +15,10 @@ pkgs.symlinkJoin {
|
|||||||
(pkgs.writers.writePython3Bin ",rename_lower" {
|
(pkgs.writers.writePython3Bin ",rename_lower" {
|
||||||
libraries = [ ];
|
libraries = [ ];
|
||||||
} (builtins.readFile ./rename_lower.py))
|
} (builtins.readFile ./rename_lower.py))
|
||||||
|
(pkgs.writeShellApplication {
|
||||||
|
name = ",zipdir";
|
||||||
|
runtimeInputs = [ pkgs.zip ];
|
||||||
|
text = builtins.readFile ./zipdir;
|
||||||
|
})
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
3
pkgs/tb-scripts/zipdir
Executable file
3
pkgs/tb-scripts/zipdir
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
zip -9rX "../$(basename "$PWD").zip" .
|
||||||
Reference in New Issue
Block a user