BSODs Notebook

Linux admin stuff and other shenanigans

Some Random Snippets

This area contains just some short snippets / one-liners or configuration tricks I wrote down for later...

Git Tricks

disable Proxy for single repository

When everything needs to go over a proxy server except that one internal repository

git config http.proxy ""

ten minutes ago this was still working

git checkout master@{"10 minutes ago"}

One Line Python Webserver

Python 2.x:

python -m SimpleHTTPServer $PORT

Python 3.x:

python -m http.server $PORT

RAW File Cleanup Scripts

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.

read -p "please enter file suffix for raw format (e.g ORF, NEF, CR2): " suffix

find . -type f -iname "*.${suffix}" | \
while read line
  lowercase=$(echo "$line" | sed "s/${suffix}/jpg/gi")
  uppercase=$(echo "$line" | sed "s/${suffix}/JPG/gi")

  if [ -f "${lowercase}" ]
    rm -v "${lowercase}"
  elif [ -f "${uppercase}" ]
    rm -v "${uppercase}"
    echo "${line}: no jpg present"

Transcode FLAC Files

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.

find . -iname "*.flac" -print0 | xargs -0 -P ${cpu_cores} -I % sh -c 'oggenc -q 5 "%" && rm -vf "%"'

or with ffmpeg:

find . -iname "*.flac" -print0 | xargs -0 -P ${cpu_cores} -I % sh -c 'ffmpeg -i "%" -c:a libmp3lame -q:a 2 "%.mp3" && rm -v "%"'