This file contains hidden or 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 | |
base_url="https://github.com" | |
while read name | |
do | |
wget "${base_url}/${name}.keys" | |
done |
This file contains hidden or 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 | |
srcdir="${HOME}/svn/pjproject" | |
devpath="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer" | |
arch="i386" | |
cflags="-O2 -m32 -miphoneos-version-min=4.0" | |
ldflags="-O2 -m32 -miphoneos-version-min=4.0" | |
cd ${srcdir} |
This file contains hidden or 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
puts 'Hello! May I help you?' | |
$stdin.lazy.reduce(Array.new 3) do |history, message| | |
history = ([message.strip!] + history).take 3 | |
break if history.all? {|msg| msg == 'BYE' } | |
reply = | |
case message | |
when 'BYE' | |
nil |
This file contains hidden or 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
for file in `ls rubyists/*.jpg` | |
do | |
bname=`basename $file .jpg` | |
convert $file -sepia-tone '80%' sepiatones/$bname.jpg | |
done |
This file contains hidden or 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 | |
require 'fileutils' | |
require 'net/https' | |
require 'yaml' | |
datadir = ARGV.shift | |
filenames = Dir.entries(datadir).select {|name| name =~ /\.(yml|yaml)$/} | |
rubyists = filenames.map {|filename| YAML.load_file(File.join(datadir, filename)).merge('filename' => filename) } |
This file contains hidden or 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
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8"> | |
<title>Raphael</title> | |
<style type="text/css"> | |
</style> | |
</head> | |
<body> | |
<div id="holder"> | |
</div> |
This file contains hidden or 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
r = Random.new(19930224); (1..22).sort_by { r.rand } | |
# => [4, 10, 13, 18, 7, 16, 20, 15, 22, 2, 19, 5, 17, 14, 8, 6, 9, 1, 11, 3, 21, 12] |
This file contains hidden or 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 | |
mysql_libdir='/usr/local/mysql/lib' | |
dylib_name='libmysqlclient.18.dylib' | |
dylib_path="${mysql_libdir}/${dylib_name}" | |
install_name_tool -change ${dylib_name} ${dylib_path} $1 |
This file contains hidden or 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 Directory | |
include Enumerable | |
def initialize(dirname) | |
@dirname = dirname | |
@files = Dir.open(dirname) {|dir| | |
dir.reject {|name| name == "." || name == ".." } | |
} | |
end | |
This file contains hidden or 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 Data.List | |
data Suit = Spade | Diamond | Club | Heart | |
deriving (Eq, Show, Ord) | |
data Card = Card Suit Int | |
deriving (Eq, Show, Ord) | |
suit (Card s _) = s | |
rank (Card _ r) = r |