1
0
Fork 0
dotfiles/fish/conf.d/functions.fish

49 lines
1.1 KiB
Fish

function cleanpycs
find . -name '.git' -o -name __pycache__ -delete
find . -name '.git' -o -name '*.py[co]' -delete
end
function envsource
if not set -q argv[1]
set argv[1] ".env"
end
echo "Using $argv[1] as input file"
for line in (grep -v '^\s*\(#\|$\)' $argv[1] | grep -E '^[A-Za-z_]+=[^#\n]+')
set item (string split -m 1 '=' $line)
set -gx $item[1] $item[2]
echo "Exported key $item[1]"
end
end
function gen-secret
if not set -q argv[1]
set argv[1] 64
end
openssl rand -hex $argv[1]
end
function ffmerge
set input_videos
for arg in $argv
if test (string sub -l 4 $arg) = ".mp4"
set input_videos $input_videos -i $arg
else
set output $arg
end
end
ffmpeg $input_videos -filter_complex (printf "[%s] " $input_videos | sed 's/ -i / concat=n=%d:v=1:a=1 [v] [a]/') -map "[v]" -map "[a]" $output
end
function fish_right_prompt
set -l k8s_color (set_color blue)
set -l k8s_context (kubectl config current-context)
echo -e -n -s $k8s_color "($k8s_context)"
end