Wednesday, January 29, 2014

git log -p splitting

At work we have two related code bases.  Recently one of them received a lot of loving, and the other needed the same treatment to work better with new Perl and modules. The one ha gotten several hundred patches, and browsing that many and cherrypicking them got tiresome.  It was better for me to split the whole log into separate patches and review and apply one by one and then moving the "done" patches to a different directory.

Here, the small hack to split "git log -p" into one patch pr. file:


awk 'BEGIN { FN=0; }
     /^commit / { FN++; }
     { print $0 >> FN }' $1

Saturday, January 18, 2014

Sorting videos

Some time ago I posted my picture sorting script. Everything can record videos these days (e.g. the camera, the phone, and the resolution isn't even a joke any more, it's full HD at good frame rates) so sorting images is far from enough. I have been suffering with manual sorting, but the time for that is over.

There is a cool program called "mediainfo" that can decode the media information on everything I have tested it on. This made it quite easy to adapt the earlier program into a video sorter.  This one will sort the files arriving from all our different camera devices. If yours make files with a different name than .mp3 or .mov then change the "find" expression on the 10th line.



cd $ROOT/nye || exit $?
echo "*** Working on"

declare -a DATE

find . -iname '*.mp4' -o -iname '*.mov' | while read f; do
    # Adjust time of the file.
    # This date is in UTC, but touch understands that.
    UTCDATE="$( mediainfo --inform='Video;%Encoded_Date%' $f )"
    touch --date="$UTCDATE" $f

    # Depending on your location in the world the UTC time can be many
    # hours away from the local time and put the video surprisingly
    # into the wrong month.  But "ls" shows the local time.

    DATE=( $(ls --full-time $f | cut -d' ' -f 6 | tr '-' ' ' ) )

    mkdir -p $folder || exit $?
    mv -v "$f" $folder || exit $?

Thursday, January 16, 2014

4G internett

Telefonen min viser "4G" med en (av fire) styrke stolper hjemme. Så for å teste hvor bra 4G jeg kan få hjemme skrudde jeg på tethering og tok fram web-browseren min.

7.7Mbps ned og 0.8-1.4Mbps opp ser det ut til.  Litt som litt rask DSL. Jeg (dvs. arbeidsgiver) har Ventelo, og med min datapakke skal en få 8Mbps sier de.

Det passet jo ganske bra.

Skrur jeg av LTE får jeg mer som 4Mbps ned og faktisk 1.9Mbps opp.

Akkurat nå. Akkurat her. Med en Samsung Galaxy S4 mini.