Skip to content

Instantly share code, notes, and snippets.

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"
@johnf
johnf / apple.com
Created May 23, 2015 07:19
Telstra Cable Packet Loss
Start: Sat May 23 17:06:51 2015
HOST: kermit Loss% Snt Last Avg Best Wrst StDev
1.|-- router 0.0% 20 19.3 11.3 0.5 53.5 16.9
2.|-- 10.209.0.1 0.0% 20 14.6 25.8 6.6 110.8 30.1
3.|-- 58.160.15.8 0.0% 20 18.9 18.0 7.4 50.4 15.2
4.|-- 58.160.15.238 0.0% 20 17.8 21.7 8.3 76.6 20.5
5.|-- bundle-ether4.chw-edge902.sydney.telstra.net 0.0% 20 14.7 21.9 7.2 114.9 25.9
6.|-- bundle-ether14.chw-core10.sydney.telstra.net 0.0% 20 9.1 19.6 8.3 73.6 17.7
7.|-- bundle-ether17.oxf-gw2.sydney.telstra.net 0.0% 20 10.2 23.2 8.9 75.0 18.8
8.|-- bundle-ether1.sydo-core01.sydney.reach.com 0.0% 20 9.0 22.6 9.0 80.7 18.4
set -ex
# Classic ruby deps
sudo DEBIAN_FRONTEND=noninteractive apt-get --option Dpkg::Options::='--force-confnew' --quiet --force-yes --yes install build-essential libxslt1-dev libxml2-dev zlib1g-dev
# We use brightbox ppa to get ruby 2.2
sudo apt-add-repository --yes ppa:brightbox/ruby-ng
sudo apt-get --quiet --yes update
sudo DEBIAN_FRONTEND=noninteractive apt-get --option Dpkg::Options::='--force-confnew' --quiet --force-yes --yes install ruby2.2 ruby2.2-dev
<VirtualHost *:80>
ServerName mail.inodes.org
RewriteEngine On
RewriteRule ^/(.*) https://mail.inodes.org/
</VirtualHost>
<VirtualHost 192.168.223.31:443>
ServerName mail.inodes.org
[user]
name = John Ferlito
email = johnf@inodes.org
[color]
branch = auto
diff = auto
interactive = auto
ui = true
pager = true
// A
enum _foo_type {
FOO
};
typedef enum _foo_type foo_type;
// B
typedef enum {
BAR
@johnf
johnf / gist:1363386
Created November 14, 2011 06:32
Pass argc to exec
#include <unistd.h>
int main(int argc, char *argv[]) {
execv("/bin/ls", argv);
}
@johnf
johnf / gist:1496171
Created December 19, 2011 08:57
php-fastcgi
# php-fastcgi - Manages php5-cgi in FastCGI mode
description "Manage a PHP FastCGI process"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [016]
env PHP_FCGI_CHILDREN=8