This Gist is inspired by Neo4j 2.0 is coming blog post by Max De Marzi
#!/bin/bash | |
# | |
# Bash script to setup headless Selenium (uses Xvfb and Chrome) | |
# (Tested on Ubuntu 12.04) | |
# Add Google Chrome's repo to sources.list | |
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee -a /etc/apt/sources.list | |
# Install Google's public key used for signing packages (e.g. Chrome) | |
# (Source: http://www.google.com/linuxrepositories/) |
#!/bin/bash | |
## | |
## Simple logging mechanism for Bash | |
## | |
## Author: Michael Wayne Goodman <goodman.m.w@gmail.com> | |
## Thanks: Jul for the idea to add a datestring. See: | |
## http://www.goodmami.org/2011/07/simple-logging-in-bash-scripts/#comment-5854 | |
## Thanks: @gffhcks for noting that inf() and debug() should be swapped, | |
## and that critical() used $2 instead of $1 |
dog.legs.walk! if dog.normal? | |
dog.hover_craft.hover! if dog.robot? |
import struct | |
import sys | |
def getBytes(fs, pos, numBytes): | |
fs.seek(pos) | |
byte = fs.read(numBytes) | |
if (numBytes == 2): | |
formatString = "H" | |
elif (numBytes == 1): | |
formatString = "B" |
- Your class can be no longer than 100 lines of code.
- Your methods can be no longer than five lines of code.
- You can pass no more than four parameters and you can’t just make it one big hash.
- When a call comes into your Rails controller, you can only instantiate one object to do whatever it is that needs to be done. And your view can only know about one instance variable.
You can break these rules if you can talk your pair into agreeing with you.
// No commas | |
def a = 'tim' | |
def nocom = match( a ) { | |
when 'dave' 'Hi Dave' | |
when 'tim' 'Hi Tim' | |
otherwise 'none of the above' | |
} | |
assert nocom == 'Hi Tim' | |
// Commas |
#!/bin/bash -ex | |
# Paste this into ssh | |
# curl -sL https://gist.github.com/andsens/2913223/raw/bootstrap_homeshick.sh | tar -xzO | /bin/bash -ex | |
# When forking, you can get the URL from the raw (<>) button. | |
### Set some command variables depending on whether we are root or not ### | |
# This assumes you use a debian derivate, replace with yum, pacman etc. | |
aptget='sudo apt-get' | |
chsh='sudo chsh' |
Until last night I lived in fear of tildes, carats, resets and reverts in Git. I cargo culted, I destroyed, I laid waste the tidy indicies, branches and trees Git so diligently tried to maintain. Then Zach Holman gave a talk at Paperless Post. It was about Git secrets. He didn't directly cover these topics but he gave an example that made me realize it was time to learn.
Generally, when I push out bad code, I panic, hit git reset --hard HEAD^
, push and clean up the pieces later. I don't even really know what most of that means. Notational Velocity seems to be fond of it ... in that I just keep copying it from Notational Velocity and pasting it. Turns out, this is dumb. I've irreversibly lost the faulty changes I made. I'll probably even make the same mistakes again. It's like torching your house to get rid of some mice.
Enter Holman. He suggests a better default undo. git reset --soft HEAD^
. Says it stag
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'nokogiri' | |
require 'net/http' | |
# check_aws_status.rb | |
# A nagios plugin for fetching RSS feeds from http://status.aws.amazon.com. | |
# Source: https://gist.github.com/1604786 | |
# Written by Aaron Suggs: https://github.com/ktheory |