Skip to content

Instantly share code, notes, and snippets.

bundled_commands="cap capify guard rackup rake rspec ruby irb"
## Functions
_bundler-installed() {
which bundle > /dev/null 2>&1
}
_within-bundled-project() {
local check_dir=$PWD
@johnf
johnf / A
Created September 4, 2012 08:38
snmp:extend { 'nslookup remotely':
oid => '1.1.1.1',
package => 'nslookup'
}
def moo
puts blah if foo
end
bp@bp-dvmh-mail-01:/tmp/linux-2.6.32/debian.master/config/amd64$ diff -u config.flavour.generic config.flavour.server
--- config.flavour.generic 2013-03-14 16:31:58.000000000 +1100
+++ config.flavour.server 2013-03-14 16:31:58.000000000 +1100
@@ -1,21 +1,21 @@
#
-# Config options for config.flavour.generic automatically generated by splitconfig.pl
+# Config options for config.flavour.server automatically generated by splitconfig.pl
#
-CONFIG_DEFAULT_CFQ=y
-# CONFIG_DEFAULT_DEADLINE is not set
@johnf
johnf / gist:5301582
Created April 3, 2013 14:15
Withdraw all LinkedIn Invitations
#!/usr/bin/env ruby
# Go through linked in invitations and withdraw them all
#
# Usage
#
# First collect the inviites
# ./uninvite collect [email protected] password > data.csv
#
# Then clean up the CSV in your favourite editor
require 'thin/version'
module Thin
def self.win? # Are we runing windows
true
end
end
@johnf
johnf / gist:7228007
Created October 30, 2013 06:31
Simple jabber server
// Based on code at https://github.com/astro/node-xmpp/blob/master/examples/c2s.js
var xmpp = require('node-xmpp');
var c2s = new xmpp.C2SServer({
port: 5222,
domain: 'localhost'
});
var sessions = {};

Keybase proof

I hereby claim:

  • I am johnf on github.
  • I am johnf (https://keybase.io/johnf) on keybase.
  • I have a public key whose fingerprint is A946 8EB3 45CB 92B7 670D BAD0 4FFB 060C 9EC7 0B95

To claim this, I am signing this object:

# Perform charset encoding detection as per http://tools.ietf.org/html/draft-abarth-mime-sniff-05
encoding = 'UTF-8'
if c.header_str =~ /Content-Type: (.*?)$/m
content_type = $1
if content_type =~/ISO-8859-1/i
encoding = 'ISO-8859-1'
elsif content_type =~ /UTF-8/i
encoding = 'UTF-8'
elsif content_type =~ /application\/vnd\.google\.gdata\.error\+xml/
#!/usr/bin/env bash
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=10000
HISTFILESIZE=100000
HISTTIMEFORMAT='%F %T: '
PROMPT_DIRTRIM=3
# Default editor
export EDITOR="vim"