Skip to content

Instantly share code, notes, and snippets.

@overplumbum
overplumbum / video-from-frames.sh
Last active September 27, 2015 04:08
Video clip from frames generation
## Windows: http://en.cze.cz/Images-to-video
## MacOSX & Linux below
clipdir=/tmp/clip/
rm -fr $clipdir && mkdir $clipdir
# crop&resize 3x4 frames to 16x9 1280x720
for i in *.JPG ; do convert -verbose $i -strip -resample 72x72 -crop x1386+0+100 -resize 1280x $clipdir/$i ; done
#:> cmds.lst && for i in *.JPG ; do echo convert -verbose $i -strip -resample 72x72 -crop x1386+0+100 -resize 1280x $clipdir/$i >> cmds.lst ; done
@overplumbum
overplumbum / lxc-shm-fix.sh
Created November 16, 2012 15:23
Permament fix for /run/shm creation in Ubuntu LXC guest systems (oneiric..precise)
#!/bin/bash
# https://bugs.launchpad.net/launchpad/+bug/974584
# common oneiric-lxc-guest bug
grep --silent "/run/shm" /lib/init/fstab || echo "none /run/shm tmpfs nosuid,nodev 0 0" >> /lib/init/fstab
mkdir -p /run/shm
mount /run/shm
# required for systems after manual dirty fixing
test -L /dev/shm || ( umount /dev/shm ; rm -fr /dev/shm && ln -s /run/shm /dev/ )
@rcrowley
rcrowley / bad-side-effects-on-mac-osx.sh
Last active August 29, 2015 13:56
A protip for authors of shell programs. I use this pattern *all the time* for working in a temporary directory and cleaning it up after I'm done but a quirk in how shells interpret failures in command substitution caused a program like these to remove my coworker's home directory when he ran said program on Mac OS X, which doesn't have `mktemp -d`.
set -e
# Looks clever, is short, but removes your working directory on Mac OS X
# where `mktemp -d` fails.
cd "$(mktemp -d)"
trap "rm -rf \"$PWD\"" EXIT INT QUIT TERM
# ...