Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am n8foo on github.
  • I am n8foo (https://keybase.io/n8foo) on keybase.
  • I have a public key whose fingerprint is 3855 194E 906B EA29 5F2E 030F CB01 D733 1ACF 1E3A

To claim this, I am signing this object:

View base 58 functions
alphabet = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'
base = len(alphabet)
def b58enc(div, s=''):
if div >= base:
div, mod = divmod(div, base)
return b58enc(div, alphabet[mod] + s)
return alphabet[div] + s
def b58dec(s):
View pre-commit
#!/bin/bash
# pre-commit git hook to check the validity of a puppet manifest
#
# Prerequisites:
# gem install puppet-lint puppet
#
# Install:
# /path/to/repo/.git/hooks/pre-comit
# Source RVM if needed
View barter-across-time.md

Coming from the 21st Century

Peanut butter cups

Chocolate + sugar + peanut butter. A winning combination throughout the ages. Even people who can't understand your language can immediately determine the value of a peanut butter cup. It's Prime Directive friendly (difficult to reproduce and unlikely to affect the course of other recipes), consumable (fewer twonky problems), cheap enough (for the traveler) to give to a child for a quick bit of information, and valuable enough (to the local) to barter for items of immense value.

350-Farad capacitors

(idea from @wikkit on Twitter) A 350-Farad capacitor is small enough to fit in the hand and available for $11. An electrical engineer from the mid-1800s to mid 20th C would easily be able to verify it and would value it highly.

View eirikmagick.sh
tmpdir=tmp
if [ -d "$tmpdir" ]; then
rm -rf $tmpdir
fi
mkdir $tmpdir
height=2592
width=10
n=0
for f in *.jpg
do
@n8foo
n8foo / class.pp
Created Nov 14, 2012
puppet user.pp example
View class.pp
define add_user ( $email, $uid, $name, $key) {
$username = $title
user { $username:
comment => "$name,$email",
home => "/home/$username",
shell => "/bin/bash",
uid => $uid
}
View install-graphite-ubuntu-10.04.sh
####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Last tested & updated 10/13/2011
####################################
sudo apt-get update
sudo apt-get upgrade
View ec2-metadata.sh
#!/bin/bash
#
#########################################################################
#This software code is made available "AS IS" without warranties of any #
#kind. You may copy, display, modify and redistribute the software #
#code either by itself or as incorporated into your code; provided that #
#you do not remove any proprietary notices. Your use of this software #
#code is at your own risk and you waive any claim against Amazon #
#Digital Services, Inc. or its affiliates with respect to your use of #
#this software code. (c) 2006-2007 Amazon Digital Services, Inc. or its #
@n8foo
n8foo / es.sh
Created Apr 25, 2012 — forked from kajic/es.sh
Install ElasticSearch on Ubuntu 10.04/11.04
View es.sh
cd ~
sudo apt-get update
sudo apt-get install curl python-software-properties -y
sudo apt-get install openjdk-6-jre-headless
curl -L https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.18.7.tar.gz | tar -xz
sudo mv elasticsearch-* /usr/local/share/elasticsearch
curl -L http://github.com/elasticsearch/elasticsearch-servicewrapper/tarball/master | tar -xz
sudo mv *servicewrapper*/service /usr/local/share/elasticsearch/bin/
rm -Rf *servicewrapper*
@n8foo
n8foo / gist:2439647
Created Apr 21, 2012
nashvl.org GA code
View gist:2439647
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-31087507-1']);
_gaq.push(['_setDomainName', 'nashvl.org']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';