- Fast Test, Slow Test PyCon 2012
- Those Who Forget The Past MountainWest RubyConf 2012
- The Unix Chainsaw Cascadia Ruby 2011
- The Prejudgement of Programming Languages PyCodeConf 2011
- A Brief History of BitBacker, A Startup Northwest Python Day 2010
- Python vs. Ruby: A battle to The Death Northwest Python Day 2010
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 | |
for i in *.*; do mv "$f" "${f,,}"; done |
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
class NotSupportedArraySize < StandardError; end | |
class SpiralPrinter | |
def print(array) | |
finalResult = [] | |
size = array.length | |
modulo = Math.sqrt(size).to_i | |
raise NotSupportedArraySize if modulo**2 != size |
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
#!/usr/bin/env ruby --disable-gems | |
# vim: set ft=ruby: | |
require 'net/ftp' | |
require 'benchmark' | |
#Consts | |
IMDB_FTP_HOST = 'ftp.fu-berlin.de' | |
IMDB_FTP_DATA_PATH = '/pub/misc/movies/database' | |
README = <<-README | |
This is a simple Ruby script that downloads the entire IMDB Plain Text DB into a specified folder. |
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 | |
#import_db.sh: a bash script that imports from your heroku app the latest postgres db schema dump and imports it to | |
#the specified db schema name | |
RED="\x1b[31m" | |
GREEN="\x1b[32m" | |
COLOR_RESET="\x1b[0m" | |
DUMP_FILENAME="latest.dump" | |
usage() { | |
echo "Usage: $0 postgres_db_name" |
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 jewish_weekend?(date=Time.now) | |
#Time.now.end_of_week will return sunday, so friday is -1 & saturday is -2 | |
end_of_week = date.end_of_week | |
friday = end_of_week - 2.day | |
saturday = end_of_week - 1.day | |
(date.day == friday.day) || (date.day == saturday.day) | |
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
#!/bin/bash | |
set -e | |
usage() { | |
echo "Runs nslookup on a list of domains given by a text file, each domain separated by a newline." | |
echo "Usage: path_to_textfile.txt" | |
exit 1 | |
} |
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
require 'active_support/core_ext/object/try' | |
class ScreenResolution | |
#ONLY FOR MAC | |
#Has a dependency on the screenresolution plugin. Install with it with `brew install screenresolution` | |
def self.get | |
#The screenresolution script output is going to STDERR (uses NSLog), so we redirect to STDOUT | |
raw_output = %x(screenresolution get 2>&1) | |
output = raw_output.split("\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
//three.js: https://github.com/mrdoob/three.js/ | |
//poly2tri.js: https://code.google.com/p/poly2tri/ | |
//Copied from: https://github.com/jahting/three.js/commit/b9774b00ca6a4f65deab2100d13a788802275a32 - triangulate2 function | |
THREE.Shape.Utils.triangulatePoly2Tri = function( pts, holes ) { | |
// For use with Poly2Tri.js | |
var allpts = pts.concat(); | |
var shape = []; | |
for (var p in pts) { |
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 | |
set -e | |
#NOTE: Tested on cassandra 2.1 only, please leave a comment if this breaks on other versions. | |
#This script prints to stdout the big partitions cassandra is warning about during compaction. | |
#It goes over all the cassandra logs (all of the ones found on the server), and prints in ascending | |
#order the big partitions that were found during compaction. | |
#Usage example: | |
#ssh user@server.hostname 'bash -s' < big-partitions.sh |
OlderNewer