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
coffee> i*i for i in [1..9] when i % 2 == 0 | |
[ 4, 16, 36, 64 ] | |
# https://github.com/jashkenas/coffee-script/issues/2030 | |
# http://brehaut.net/blog/2011/coffeescript_comprehensions | |
coffee> [i,j] for j in [1..3] for i in [1..3] | |
[ [ [ 1, 1 ], | |
[ 1, 2 ], | |
[ 1, 3 ] ], | |
[ [ 2, 1 ], |
We can make this file beautiful and searchable if this error is corrected: No tabs found in this TSV file in line 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
aaaa bbb | |
ccc ddd |
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 String | |
def to_bin | |
bytes = self.size/2 | |
self.unpack('a2'*bytes).map{|x| x.hex}.pack('C'*bytes) | |
end | |
end | |
"20814804c1767293b99f1d9cab3bc3e7".to_bin #=> " \x81H\x04\xC1vr\x93\xB9\x9F\x1D\x9C\xAB;\xC3\xE7" |
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 subprocess import Popen, PIPE | |
p = Popen(["cat"], stdin=PIPE, stdout=PIPE) | |
print "stdin.write" | |
p.stdin.write("aaa") | |
p.stdin.flush() | |
print "stdout.read" | |
print p.stdout.readlines() | |
p.stdin.close() | |
p.wait() |
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 "anypow" | |
extend Anypow | |
run_pow "erb ./conf/nginx.conf.erb > ./conf/nginx.conf && ./sbin/nginx" |
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 Array | |
def cross(array) | |
product(array).map { |e| e.flatten } | |
end | |
end | |
p [1,2].cross([3,4]) | |
#=> [[1, 3], [1, 4], [2, 3], [2, 4]] | |
p [1,2].cross([3,4]).cross([5,6]) | |
#=> [[1, 3, 5], [1, 3, 6], [1, 4, 5], [1, 4, 6], [2, 3, 5], [2, 3, 6], [2, 4, 5], [2, 4, 6]] |
We can make this file beautiful and searchable if this error is corrected: No tabs found in this TSV file in line 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
2013-07-03 10000 | |
2013-07-02 9000 | |
2013-07-01 4000 | |
2013-06-30 300 | |
2013-06-29 100 |
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/packer -v | |
Packer v0.1.0 | |
$ ./bin/packer build test.json | |
virtualbox output will be in this color. | |
==> virtualbox: Downloading VirtualBox guest additions. Progress will be shown periodically. | |
==> virtualbox: Copying or downloading ISO. Progress will be reported periodically. | |
panic: EOF | |
goroutine 41 [running]: |
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
{ | |
"builders": [{ | |
"type": "virtualbox", | |
"guest_os_type": "Ubuntu_64", | |
"iso_url": "http://releases.ubuntu.com/12.04/ubuntu-12.04.2-server-amd64.iso", | |
"iso_md5": "af5f788aee1b32c4b2634734309cc9e9", | |
"ssh_username": "packer", | |
"ssh_wait_timeout": "60s", | |
"boot_wait": "30s", | |
"boot_command": [ |
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
MAKE_OPTS="-j 4" RUBY_CONFIGURE_OPTS="--enable-load-relative --with-readline-dir=`brew --prefix readline`" rbenv install -k -v 2.0.0-p247 |