Skip to content

Instantly share code, notes, and snippets.

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:

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):
@n8foo
n8foo / pre-commit
Created December 5, 2013 21:48 — forked from fluxrad/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

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.

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 November 14, 2012 20:32
puppet user.pp example
define add_user ( $email, $uid, $name, $key) {
$username = $title
user { $username:
comment => "$name,$email",
home => "/home/$username",
shell => "/bin/bash",
uid => $uid
}
####################################
# 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
@n8foo
n8foo / ec2-metadata.sh
Created May 29, 2012 21:45
ec2-metadata
#!/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 April 25, 2012 22:32 — forked from kajic/es.sh
Install ElasticSearch on Ubuntu 10.04/11.04
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 April 21, 2012 21:18
nashvl.org GA code
<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';