Skip to content

Instantly share code, notes, and snippets.

View hjr3's full-sized avatar

Herman J. Radtke III hjr3

View GitHub Profile
anonymous
anonymous / gist:161265
Created August 4, 2009 14:09
== Rules ==
On Infrastructure
-----------------
There is one system, not a collection of systems.
The desired state of the system should be a known quantity.
The "known quantity" must be machine parseable.
The actual state of the system must self-correct to the desired state.
The only authoritative source for the actual state of the system is the system.
The entire system must be deployable using source media and text files.
@jperras
jperras / programmer_prayer.txt
Created April 18, 2011 20:41
The programmer's prayer.
Our root,
who art in Unix,
hallowed be thy shell.
Thy kernel come.
Thy commands be run
@localhost as they are in iNet.
Give us this day our daily updates,
And forgive us for our four-oh-threes,
as we forgive those who 403 against us.
And lead us not into segfaults,
@karthick18
karthick18 / brk_cow.c
Created June 17, 2011 23:08
Just an example to remind that its futile to free memory in the child to avoid taking a break COW perf. hit. Check the header comments for more details.
/*
* Just an example to remind that its futile to free memory in the child
* allocated by the parent to avoid taking a break COW perf. hit.
* Makes sense only to free large chunk sizes in the child. Smaller chunk sizes
* aren't really trimmed by malloc and only end up causing perf hits with
* break COW pages (copy on write) when freeing in the child.
* A break COW is when free results in malloc lib. touching the freed chunk
* of memory resulting in a write protection page fault for the child that ends up
* unmapping the shared page table entry and then maps a writable page copy to the child.
* The net effect for RSS(resident set size) is the same as in the parent but
@gyndav
gyndav / .travis.yml
Created April 10, 2012 12:57
Simple Mongo PHP Driver extension installer for Travis CI. Works like a charm for other PECL extensions too.
before_script:
- ./path/to/mongo-php-driver-installer.sh
Mail = Ember.Application.create();
// Let's pretend that Javascript can handle mutliline strings nicely:
Mail.ApplicationView = Ember.View.extend({
template: Ember.Handlebars.compile('
<!-- this gets replaced with content based on state when
connectOutlet is called on ApplicationController -->
{{outlet}}
')
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@baldurrensch
baldurrensch / feistel.php
Created September 12, 2012 22:58
Feistel Hash
<?php
/**
* This function computes a hash of an integer. This can be used to not expose values to a customer, such as
* not giving them the id value for passing them to URLs. This algorithm is a bidirectional encryption (Feistel cipher) that maps
* the integer space onto itself.
*
* @link http://wiki.postgresql.org/wiki/Pseudo_encrypt Algorithm used
* @link http://en.wikipedia.org/wiki/Feistel_cipher Wikipedia page about Feistel ciphers
* @param int $value
@dergachev
dergachev / README.md
Created October 10, 2012 16:49
Vagrant tutorial

Vagrant Setup

This tutorial guides you through creating your first Vagrant project.

We start with a generic Ubuntu VM, and use the Chef provisioning tool to:

  • install packages for vim, git
  • create user accounts, as specified in included JSON config files
  • install specified user dotfiles (.bashrc, .vimrc, etc) from a git repository

Afterwards, we'll see how easy it is to package our newly provisioned VM

@scoates
scoates / timeline
Last active December 10, 2015 09:29
Times each line of stdin
#!/usr/bin/env python
import time
from sys import stdin, stdout, argv, exit
try:
if argv[1] == 'help' or argv[1] == '--help' or argv[1] == '-h':
print "%s: times each line of stdin.\n Optional parameter is a float of a threshold. (defaults to 2.0)" % argv[0]
exit(255);
else: