Skip to content

Instantly share code, notes, and snippets.

@w-shackleton
w-shackleton / easyjet-unclutter.sh
Created July 16, 2016 23:06
Unclutter easyJet e-tickets
# First, crop the pages down.
pdfcrop --margins '0 -30 0 -500' in.pdf 1.pdf
# Rotate all pages
pdftk 1.pdf cat 1-endeast output 2.pdf
# Finally, 2-up the pages, ignoring the blank pages inserted in the PDF (this PDF had 8 e-tickets)
pdfnup 2.pdf 1,3,5,7,9,11,13,15 -o out.pdf
@w-shackleton
w-shackleton / switch.sh
Created June 21, 2016 00:10
Scripts to enable and disable swapping caps lock and escape on Linux, and to disable during a program's execution.
#!/bin/bash
if [[ $# == 0 ]]
then
echo "Usage: $0 [normal|swapped]"
fi
case "$1" in
normal) gsettings set org.gnome.desktop.input-sources xkb-options "[]" ;;
swapped) gsettings set org.gnome.desktop.input-sources xkb-options "['caps:swapescape']" ;;
@w-shackleton
w-shackleton / futoshiki.pl
Created March 30, 2016 14:54
Prolog Futoshiki solver
?- use_module(library(clpfd)).
valid5(L) :- L ins 1..5, all_different(L).
futo([
[X11, X12, X13, X14, X15],
[X21, X22, X23, X24, X25],
[X31, X32, X33, X34, X35],
[X41, X42, X43, X44, X45],
[X51, X52, X53, X54, X55]]) :-
@w-shackleton
w-shackleton / aptdeps.py
Created November 1, 2015 14:37
Install a set of debian packages as a metapackage that depends on them.
#!/usr/bin/env python
"""
Creates a debian package with no content and a set of dependencies. Useful for
keeping track of large numbers of installed packages (eg. for building a piece
of software) in Debian by installing a metapackage. This allows easy cleanup
using apt-get autoremove.
https://www.shackleton.io
"""
@w-shackleton
w-shackleton / keybase.md
Created June 6, 2014 20:02
Keybase identity prove

Keybase proof

I hereby claim:

  • I am w-shackleton on github.
  • I am shackleton (https://keybase.io/shackleton) on keybase.
  • I have a public key whose fingerprint is 6049 DD7B E978 37D7 4FA0 3467 16C1 BD8C DFDC E340

To claim this, I am signing this object: