View gopro.sh
# unwarp, rescale & rename GoPro pics using 4 CPUs
find /Volumes/NO\ NAME/DCIM/ -type f -regex '.*/G[0-9]+.JPG' |
sort |
perl -MPOSIX=strftime -lne 'printf qq(convert "%s" -filter Lanczos -distort barrel "0.06335 -0.18432 -0.13009" -resize 1440x1080 -font Courier -pointsize 32 -draw "gravity southeast fill white text 0,0 \\\"%s\\\"" -quality 100 tl%05d.jpg\0), $_, strftime("%Y-%m-%d %H:%M", localtime [stat($_)]->[9]), ++$i' |
xargs -0 -n1 -P4 sh -c
# build timelapse at 60 fps
ffmpeg -f image2 -framerate 60 -i tl%05d.jpg -s 1440x1080 -pix_fmt yuv420p timelapse.mp4
View display-weather.sh
#!/bin/sh
wifienable() {
lipc-set-prop com.lab126.wifid enable 1
}
wifidisable() {
lipc-set-prop com.lab126.wifid enable 0
}
View euler012.cpp
#include <iostream>
#include <set>
#include <math.h>
int n_divisors(int n) {
int l = sqrt(n);
std::set<int> f;
f.insert(n);
for (int i = 1; i <= l; i++)
if (n % i == 0) {
View euler004.cpp
#include <iostream>
#include <math.h>
int main() {
int w = 6;
int l = pow(10, w - 1);
int t = pow(10, w);
int h = t - 1;
for (long i = h; i > l; i--) {
View gist:1aca91c7e3a1b5d0449d62656c7ae7eb
bash-3.2$ cd rainbarf/
bash-3.2$ prove -v
t/00-compile.t ..................
ok 1 - compiles
1..1
ok
t/01-tmux.t .....................
ok 1 - pipe 1
ok 2 - pattern 1
ok 3 - pipe 2
View spacemacs.el
; EmacsMac.app
(setq-default dotspacemacs-configuration-layers '(osx
git
version-control))
; Setup font & colors
;(setq-default dotspacemacs-default-font '("Source Code Pro"
; :size 13
; :weight normal
; :width normal
View wifi_rebooter.sh
#!/bin/bash
# The IP for the server you wish to ping (8.8.8.8 is a public Google DNS server)
SERVER=8.8.8.8
# Only send two pings, sending output to /dev/null
ping -c2 ${SERVER} > /dev/null
# If the return code from ping ($?) is not 0 (meaning there was an error)
if [ $? != 0 ]
View jetlag.pl
#!/usr/bin/env perl
use strict;
use warnings qw(all);
use DateTime;
my $year = $ARGV[0] || DateTime->now->year;
for (
my ($here, $there) = map {
View mysqldump2csv.pl
#!/usr/bin/env perl
use 5.010;
use strict;
use warnings;
my $schema;
my $table;
while (my $line = <>) {
my @csv = ();
if ($line =~ m{^ CREATE \s+ TABLE \s+ `(?<table> \w+)`}ox) {
View gpsd-wrapper.pl
#!/usr/bin/env perl
use strict;
use warnings qw(all);
use Data::Dumper;
use IPC::Run qw(start pump);
use JSON::XS;
use Net::GPSD3;
my $gpsd_host = '127.0.0.1';