This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void NotifyThreadPoolOfPendingWork() { | |
ThreadPool.UnsafeQueueUserWorkItem(_ => { | |
/* lots of code here that distributes work to Threads */ | |
}, null); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import sqlalchemy | |
from hisc.common.config import Config | |
script = sys.argv[1] | |
sql_url = Config().read()['sql_url'] | |
with open(script, "r") as schema: | |
create_statement = schema.read().replace('\n', '') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#where the json content is a trello board that has been sucked into jsoncontent | |
def lists_in(jsoncontent) | |
lists = jsoncontent['lists'] | |
[Hash[ lists.collect { |list| [ list['id'], list['name'] ] } ], lists.map { |list| list['id'] if list['closed'] }.to_set] | |
end | |
def id_for(card) | |
card['idList'] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.noradltd.golagain; | |
import static com.noradltd.golagain.CellState.ALIVE; | |
import static com.noradltd.golagain.CellState.DEAD; | |
public class ArrayLookupRules implements GameOfLifeRules { | |
private static final CellState[][] RULES = new CellState[2][9]; | |
static { | |
RULES[ALIVE.ordinal()][0] = DEAD; | |
RULES[ALIVE.ordinal()][1] = DEAD; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias shit="echo Sorry about that" | |
alias fuck="echo Terribly sorry about that" | |
alias fucker="echo Please, why would you blame me?" | |
alias fucking="echo Well, thats not very polite." | |
alias piss="echo Is it really that bad?" | |
alias damn="echo Thats the way the ball bounces" | |
alias hell="echo Yup, thats where you are" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blah $FOO | |
foo $BAR | |
smack $HEAD | |
for $USER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -f "$1" ] | |
then | |
cat << END_OF_RESULTS | |
<testsuite> | |
$( | |
cat $1 | grep -Ee "^ *(IGNORE_)?TEST" | while read line; do | |
command=$(echo $line | \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#get your system ready to chroot | |
#sudo apt-get install dchroot debootstrap | |
#lsb_release -cs << default your UBUNTU_BASE_CODE_NAME with this | |
if [ $# -ne 4 ] | |
then | |
echo "Wrong Arg Count! 4 are required" | |
echo "$0 <chroot_name> <chroot_folder> <chroot_ubuntu_base_code_name> <target_user>" | |
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#update .gitconfig from github gist | |
mv ~/.gitconfig ~/.gitconfig.`date +%Y%m%d%H%M%S` && \ | |
wget --quiet https://gist.github.com/raw/1886998/a197c56ab30d8ae7716583dd3177f6a85001b36e/.gitconfig -O ~/.gitconfig && \ | |
cat ~/.gitconfig | perl -p -i -e 's/Your Name Here/Rich Dammkoehler/g'| perl -p -i -e 's/your\@email.net/mah@email.org/g' | perl -p -i -e 's/home\/you/home\/rich/g' > /tmp/.gitconfig && \ | |
mv /tmp/.gitconfig ~/.gitconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def nil::strip | |
raise "I am not a string!" | |
end | |
nil.strip | |
#RuntimeError: I am not a string! | |
# from (irb):6:in `strip' | |
# from (irb):8 | |
# from /Users/rich/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>' |