Linux admin stuff and other shenanigans
When everything needs to go over a proxy server except that one internal repository
git config http.proxy ""
git checkout master@{"10 minutes ago"}
Python 2.x:
python -m SimpleHTTPServer $PORT
Python 3.x:
python -m http.server $PORT
This is a Bash Script to remove JPEG Files when the corresponding RAW is present. Useful when shooting RAW+JPEG and needing the Space afterwards.
#!/bin/bash
read -p "please enter file suffix for raw format (e.g ORF, NEF, CR2): " suffix
find . -type f -iname "*.${suffix}" | \
while read line
do
lowercase=$(echo "$line" | sed "s/${suffix}/jpg/gi")
uppercase=$(echo "$line" | sed "s/${suffix}/JPG/gi")
if [ -f "${lowercase}" ]
then
rm -v "${lowercase}"
elif [ -f "${uppercase}" ]
then
rm -v "${uppercase}"
else
echo "${line}: no jpg present"
fi
done
A small script I wrote to transcode my flac
files to mp3
or ogg
files for my portable audio player.
Don’t do this to your primary FLAC archive because it removes the FLAC files after conversion and you will probably not like that.
cpu_cores=4
find . -iname "*.flac" -print0 | xargs -0 -P ${cpu_cores} -I % sh -c 'oggenc -q 5 "%" && rm -vf "%"'
or with ffmpeg:
cpu_cores=4
find . -iname "*.flac" -print0 | xargs -0 -P ${cpu_cores} -I % sh -c 'ffmpeg -i "%" -c:a libmp3lame -q:a 2 "%.mp3" && rm -v "%"'