Skip to content

Instantly share code, notes, and snippets.

View frasertweedale's full-sized avatar

Fraser Tweedale frasertweedale

View GitHub Profile
@frasertweedale
frasertweedale / gist:5219551
Last active September 21, 2020 00:19
gstreamer record screencast pipeline
gst-launch \
ximagesrc startx=0 starty=0 endx=1600 endy=1200 \
! ffmpegcolorspace \
! queue \
! vp8enc max-latency=25 threads=4 \
! mux. \
pulsesrc device=alsa_input.usb-045e_Microsoft_LifeChat_LX-3000-00-LX3000.analog-mono \
! audio/x-raw-int \
! queue \
! audioconvert \
@frasertweedale
frasertweedale / fonts.conf
Created April 19, 2013 04:47
~/.fonts.conf to reject all bitmap fonts
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<selectfont>
<rejectfont>
<pattern>
<patelt name="scalable">
<bool>false</bool>
</patelt>
</pattern>
@frasertweedale
frasertweedale / .gitconfig
Last active December 18, 2015 11:59
git alias to draft/publish to Gerrit, optionally specifying reviewers. Usage: % git <"draft"|"publish"> <target-branch> [reviewer, ...]
[alias]
gerrit = "!f() { \n\
ACTION=$1 \n\
BRANCH=$2 \n\
shift 2 \n\
RECEIVEPACK=\"\" \n\
for REVIEWER in \"$@\"; do RECEIVEPACK=\"$RECEIVEPACK --reviewer '$REVIEWER'\"; done \n\
if [ -n \"$RECEIVEPACK\" ] \n\
then \n\
git push \"--receive-pack=git receive-pack $RECEIVEPACK\" gerrit HEAD:refs/$ACTION/$BRANCH \n\
@frasertweedale
frasertweedale / gist:5925978
Created July 4, 2013 08:37
rename all tags in git repo from "foo-0.1.2" to "v0.1.2"
for TAG in $(git tag); do git tag "v$(echo "$TAG" | cut -d - -f 2)" "$TAG"; git tag -d "$TAG"; done
@frasertweedale
frasertweedale / gist:6047541
Created July 21, 2013 05:00
gstreamer VOB to ogv pipeline
cat $VOBFILES | gst-launch \
filesrc location=/dev/fd/0 \
! dvddemux name=demux \
demux.current_audio \
! queue \
! a52dec \
! audioconvert \
! audioresample \
! vorbisenc \
! mux. \
@frasertweedale
frasertweedale / .vimrc
Created January 5, 2014 08:35
vimrc-fu to bootstrap vundle This code will bootstrap vundle and run BundleInstall when vundle is missing. It is non-interactive thanks to a healthy sprinkling of :silent, and assumes that Git is installed.
filetype off
set rtp+=~/.vim/bundle/vundle/
let s:bootstrap = 0
try
call vundle#rc()
catch /E117:/
let s:bootstrap = 1
silent !mkdir -p ~/.vim/bundle
silent !git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
redraw!
@frasertweedale
frasertweedale / hotp.py
Last active August 19, 2018 22:45
HOTP implementation; Python
import hashlib
import hmac
import struct
def dt(mac):
hdig = mac.hexdigest()
offset = int(hdig[-1], 16)
p = hdig[offset * 2 : offset * 2 + 8]
return int(p, 16) & 0x7fffffff
@frasertweedale
frasertweedale / Percolation.hs
Last active August 29, 2015 14:06
Percolation solution in Haskell
module Percolation where
import Control.Monad (join)
import Data.Maybe (mapMaybe)
import qualified Data.Map.Lazy as M
import qualified Data.Set as S
-- | Percolation algorithm.
--
-- Important assumptions or implementation details:
### Keybase proof
I hereby claim:
* I am frasertweedale on github.
* I am frasertweedale (https://keybase.io/frasertweedale) on keybase.
* I have a public key whose fingerprint is 5848 CE28 186B B469 C295 15E1 4B53 9052 4111 E1E2
To claim this, I am signing this object:
@frasertweedale
frasertweedale / frase.id.au.pem
Created October 21, 2014 01:59
custom pkg repo public key
-----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAopt0Lubb0ur+L+VzsP9k
i4QrvQb/4gVlmr/d59lUsTr9cz5B5OtNLi+WMVcNh4EmmNIiWoVuQY4Wqjm2d1IA
VCXw+OqeAuj9nUW4jSvI/lDLyErFBXezNM5yggeesiV2ii+uO41zOjUxnSkupFzh
zOWr+Oj4kJI/iNU++3RpzyrBSmSGK9TN9k3afhyDMNlJi5SqK/wOrSjqAMfaufHE
MkJqBibDL/+xx48SbtInhtD4LIneHoOGxVtkLIcTSS5EpnIsDWZgXX6jBatv9LJe
u2UeQsKLKcCgrhT3VX+pc/aDsUFS4ZqOonLRt9mcFVxC4NDNMKsfXTCd760HQXYU
enVLydNavvGtGYQpbUWx5IT3IphaNxWANACpWrcvTawgPyGkGTPd347Nqhm5YV2c
YRf4rVX/S7U0QOzMPxHKN4siZVCspiedY+O4P6qe2R2cTyxntjLVGZcTBlXAdQJ8
UfQuuX97FX47xghxR6wyWfkXGCes2kVdVo0fF0vkYe1652SGJsfWjc5ojR9KFKkD