add helperfunction to crop slides

This commit is contained in:
2025-10-13 11:27:30 +08:00
parent 43cdbb5112
commit d94ecba13d
2 changed files with 21 additions and 0 deletions

View File

@@ -60,6 +60,7 @@ in
cat = "bat --theme=\"$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo 'gruvbox-dark' || echo 'gruvbox-light')\""; cat = "bat --theme=\"$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo 'gruvbox-dark' || echo 'gruvbox-light')\"";
diff = "delta"; diff = "delta";
}; };
profileExtra = builtins.readFile ./functions.zsh;
}; };
fzf = { fzf = {
enable = true; enable = true;
@@ -84,6 +85,10 @@ in
python.disabled = true; python.disabled = true;
}; };
}; };
nix-your-shell = {
enable = true;
enableZshIntegration = true;
};
}; };
}; };

View File

@@ -0,0 +1,16 @@
# helper function to crop cs3223 slides
crop_slides() {
input="$1"
if [ -z "$input" ]; then
echo "Usage: crop_slides <inputfile>"
return 1
fi
# Get base name (without extension)
base="${input%.*}"
output="${base}-slides.mp4"
# Crop left 2/3 of a 1280x640 video (≈853 px wide)
nix run "nixpkgs#ffmpeg" -- -i "$input" -filter:v "crop=853:640:0:0" -c:a copy "$output"
}