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
$ curl -u 'hc5duke:password' -d "status=going to flash my android phone just for fun" http://twitter.com/statuses/update.xml |
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
// ==UserScript== | |
// @name chris chase sucks | |
// @namespace com.choibean.monkey.yahoo | |
// @description remove chris chase articles from yahoo college basketball | |
// @include http://rivals.yahoo.com/ncaa/basketball | |
// ==/UserScript== | |
var debug = (typeof(console) == 'object' && console.log); | |
var i = 0; |
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
iptables -A INPUT -p tcp -d 0/0 -s 0/0 --dport 5900 -j ACCEPT |
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
# from Yahoo sports http://g.sports.yahoo.com/soccer/world-cup/schedule/ | |
# assuming DEU-ESP ends in a 0-0 tie and disregarding PK | |
scores = ["1,1", "0,0", "2,0", "1,0", "1,1", "0,1", "0,1", "4,0", "2,0", "1,0", "1,1", "1,1", "0,0", "2,1", "0,1", "0,1", "0,3", "4,1", "2,1", "0,2", "0,1", "2,2", "0,0", "1,0", "1,1", "1,2", "0,2", "1,1", "3,1", "7,0", "1,0", "2,0", "0,1", "1,2", "2,2", "0,2", "0,1", "1,0", "0,1", "2,1", "3,2", "0,0", "1,3", "1,2", "0,0", "0,3", "0,0", "1,2", "2,1", "1,2", "4,1", "3,1", "2,1", "3,0", "0,0", "1,0", "2,1", "1,1", "0,4", "0,1", "2,3", "0,0", "2,1", "1,2", "4,1", "3,1", "2,1", "3,0", "0,0", "1,0", "2,1", "1,1", "0,4", "0,1", "2,3", "0,0"] | |
# from Ruby Cookbook pp. 55-56 | |
def mean(array); array.inject(0) { |sum, x| sum += x } / array.size.to_f; end | |
def median(array); return array.size % 2 == 1 ? array.sort[array.size/2] : mean(array.sort[(array.size/2-1)..(array.size/2)]); end | |
winners = [] |
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
// based on http://github.com/christkv/node-mongodb-native demo | |
var mongodb = require('mongodb'), | |
express = require('express'), | |
sys = require('sys'), | |
app = express.createServer(), | |
client = new mongodb.Db('integration_tests_20', new mongodb.Server("127.0.0.1", 27017, {})); | |
app.get('/', function(req, res){ |
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
$ brew info git | |
git 1.7.3.2 | |
http://git-scm.com | |
/usr/local/Cellar/git/1.7.1.1 (916 files, 18M) | |
http://github.com/mxcl/homebrew/commits/master/Library/Formula/git.rb | |
$ brew install -v git | |
Warning: It appears you have MacPorts or Fink installed. | |
Software installed with MacPorts and Fink are known to cause problems. | |
If you experience issues try uninstalling these tools. |
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
n = 1_000_000 | |
time = Benchmark.bm(8) do |r| | |
r.report("str") do | |
n.times do | |
str = "foo.jpg" | |
str.gsub(".jpg", '.png') | |
end | |
end | |
r.report("compile") do |
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
# using rvm with ruby-1.8.7-p249 | |
# latest version 2.7.7 2010-06-17 | |
brew install libxml2 | |
# installing libxslt from source code | |
wget ftp://xmlsoft.org/libxml2/libxslt-1.1.26.tar.gz | |
tar xvfz libxslt-1.1.26.tar.gz | |
cd libxslt-1.1.26 | |
./configure --prefix=/usr/local/Cellar/libxslt/1.1.26 --with-libxml-prefix=/usr/local/Cellar/libxml2/2.7.7 |
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 | |
files=$(git diff-index --name-status --cached HEAD | grep -v ^D | cut -c3-) | |
if [ "$files" != "" ] | |
then | |
for f in $files | |
do | |
# Only examine known text files | |
if [[ "$f" =~ [.](conf|css|erb|html|haml|scss|css|js|json|log|properties|rb|ru|txt|xml|yml)$ ]] | |
then |
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
git_info() { | |
# colors | |
local RESET="\033[0m" | |
local GRAY="\033[1;30m" | |
local RED="\033[1;31m" | |
local GREEN="\033[1;32m" | |
local BLUE="\033[1;34m" | |
local PINK="\033[1;35m" | |
local CYAN="\033[1;36m" |