Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
# Verify Git is installed:
if [ ! $(which git) ]; then
echo "Git is not installed, can't continue."
exit 1
fi
if [ -z "${RBENV_ROOT}" ]; then
RBENV_ROOT="$HOME/.rbenv"
@flaneur2020
flaneur2020 / 2.1.0
Created March 27, 2014 05:54
ruby-build
install_package "yaml-0.1.5" "http://pyyaml.org/download/libyaml/yaml-0.1.5.tar.gz#24f6093c1e840ca5df2eb09291a1dbf1" --if needs_yaml
install_package "openssl-1.0.1e" "https://www.openssl.org/source/openssl-1.0.1e.tar.gz#66bf6f10f060d561929de96f9dfe5b8c" mac_openssl --if has_broken_mac_openssl
install_package "ruby-2.1.0" "http://ruby.taobao.org/mirrors/ruby/ruby-2.1.0.tar.gz" ldflags_dirs standard verify_openssl
#!/usr/bin/env bash
# Verify Git is installed:
if [ ! $(which git) ]; then
echo "Git is not installed, can't continue."
exit 1
fi
if [ -z "${RBENV_ROOT}" ]; then
RBENV_ROOT="$HOME/.rbenv"
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\
> /etc/apt/sources.list.d/docker.list"
sudo apt-get update
# install the backported kernel
sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring
sudo apt-get install lxc-docker
>>> from collections import defaultdict
>>> d = defaultdict(lambda: [])
>>> d
defaultdict(<function <lambda> at 0x1004999b0>, {})
>>> d['a'].append(1)
>>> d
defaultdict(<function <lambda> at 0x1004999b0>, {'a': [1]})
>>> d['b']
[]
>>> d
2.0.0-p247 :001 > h = Hash.new([])
=> {}
2.0.0-p247 :002 > h[:a] << 1
=> [1]
2.0.0-p247 :003 > h
=> {}
2.0.0-p247 :004 > h[:a]
=> [1]
2.0.0-p247 :005 > h
=> {}
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 3.11.10-100.fc18.x86_64 Kernel Configuration
#
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"
<domain type='kvm'>
<name>test_ubuntu</name>
<memory>1048576</memory>
<vcpu>8</vcpu>
<os>
<type arch='x86_64' machine='pc'>hvm</type>
<boot dev='cdrom'/>
</os>
<features>
<acpi/>
puts GC.generational_mode
LEVEL1 = 1000
LEVEL2 = 1000
LEVEL3 = 100
root = [[3, 4], [1, 2]]
1.upto(LEVEL1) do |i|
level1 = [1] * 3
1.upto(LEVEL2) do |j|
def tokenize(text)
text.scan /\(|\)|\w+|\d+|\S+|\+/
end
def parse_step(e)
sexp = []
stack = [sexp]
while ")" != (tk = e.next)
tk = parse_step(e) if tk == '('
sexp.push tk