Snippets

recode

Recode all files ending in .tmpl to use html entities

find . -name '*.tmpl' | xargs recode ..html -d

editing plain text in vim

automagic 80cols useful when editing prose

:setl tw=80`

reflow paragraph

gqip

rebase --exec

Run tests for each commit and stop when they fail

git rebase -i origin/master --exec 'npm test'

re-execute

Substitute in last command and execute

echo "foo"
!!:s/foo/bar/

udisksctl

Mounting my external drive with udisksctl.

$ udisksctl unlock -b /dev/sdb
Passphrase:
Unlocked /dev/sdb as /dev/dm-4.
$ udisksctl mount -b /dev/bucket/buck1
Mounted /dev/dm-5 at /run/media/keis/buck1

.. and un-mounting

$ udisksctl unmount -b /dev/bucket/buck1
$ sudo vgchange -a n bucket
  0 logical volume(s) in volume group "bucket" now active
$ udisksctl lock -b /dev/sdb
Locked /dev/sdb.

webcam picture

Capture a single frame from a webcam as png

gst-launch v4l2src num-buffers=1 ! pngenc ! filesink location=capture.png

vim macro

record to register a

qa

stop recording

q

apply macro

@a