Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am pfig on github.
  • I am pfig (https://keybase.io/pfig) on keybase.
  • I have a public key whose fingerprint is 4A46 D391 411F EB63 1797 119B 66A4 7DA9 0F9F C14A

To claim this, I am signing this object:

@pfig
pfig / gist:0508a1c735e1b0bf6219
Created April 5, 2015 01:33
5-star album reviews from The Guardian
# cf http://www.theguardian.com/info/developer-blog/2015/feb/10/what-to-listen-to-next-jq-to-the-rescue
URL='http://content.guardianapis.com/search?api-key=test&page-size=100&show-fields=starRating&tag=tone/albumreview,tone/reviews&from-date=2015-01-03'
curl -s $URL | jq \
'[.response.results[] | select((.fields.starRating | tonumber) == 5) | {webTitle, webUrl}]'
@pfig
pfig / add_usernames.pl
Created August 26, 2009 10:16
Fills in "FirstName LastName" for users who don't have it set on /etc/passwd
my ( $name, @u );
while ( @u = getpwent() ) {
if ( $u[0] =~ /^\w+\.\w+$/ && $u[6] eq '' ) {
( $name = $u[0] ) =~ s/(\w+)\.(\w+)/ucfirst($1).' '.ucfirst($2)/e;
system( '/usr/sbin/usermod', '-c', $name, $u[0] );
}
}
@pfig
pfig / hexdump.pl
Created March 23, 2010 12:24
Convert a decimal integer to hex without using pack().
my @HEX_CHARS = qw( 0 1 2 3 4 5 6 7 8 9 A B C D E F );
my $hex = $HEX_CHARS[($value >> 4) & 0xF] . $HEX_CHARS[($value) & 0xF];
@pfig
pfig / Vuvuzela in SuperCollider.sc
Created June 19, 2010 16:34
Vuvuzela sound in SuperCollider
{
[
( Blip.ar( XLine.kr( 233, 200, 6 ), 100, 2.5 ) ),
( Blip.ar( 466, Line.kr( 1, 100, 1 ), 2.5 ) ),
( Blip.ar( 932, Line.kr( 1, 100, 1 ), 2.5 ) ),
( Blip.ar( 1864, Line.kr( 1, 100, 1 ), 2.5 ) )
]
}.play;
@pfig
pfig / be.pfig.notebooks.plist
Created September 17, 2015 21:03
iPython notebooks managed by launchctl
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>be.pfig.notebooks</string>
<key>ProgramArguments</key>
<array>
<string>ipython</string>
<string>notebook</string>
@pfig
pfig / gist:1400027
Created November 28, 2011 11:13
The Alternative Christmas Party Escape Protocol
Alternative Christmas Part Working Group
Request for Comments: TBC
Category: Entertainment
November 2011
Alternative Christmas Party Escape Protocol
Status of this Memo
@pfig
pfig / gist:1639577
Created January 19, 2012 11:53
Just testing the creation of gists from Sublime Text 2
event_name
@pfig
pfig / compile-nginx.sh
Created April 9, 2012 07:48
Compile nginx
#!/bin/bash
set -e
./configure \
--prefix=/usr/local \
--conf-path=/usr/local/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
<!-- For Retina display iPads -->
<link href="/assets/images/apple-touch-icon-xlarge.png" rel="apple-touch-icon" sizes="144x144" type="image/png"/>
<!-- For Retina display iPhones with iOS 7-->
<link href="/assets/images/apple-touch-icon-large7.png" rel="apple-touch-icon" sizes="120x120" type="image/png"/>
<!-- For Retina display iPhones -->
<link href="/assets/images/apple-touch-icon-large.png" rel="apple-touch-icon" sizes="114x114" type="image/png"/>
<!-- For iPad 1 -->
<link href="/assets/images/apple-touch-icon-medium.png" rel="apple-touch-icon" sizes="72x72" type="image/png"/>
<!-- For iPhone 3G, iPod Touch, and Android -->
<link href="/assets/images/apple-touch-icon-small.png" rel="apple-touch-icon" type="image/png"/>