Krzysztof Jablonski jablkopp

View gist:5700562
1 2 3 4 5 6 7 8 9 10
# Tweaked from http://tomislavsantek.iz.hr/2011/03/moving-mysql-databases-to-ramdisk-in-ubuntu-linux
 
# Log in as root
# Mount ramdisk folder in RAM
mkdir /tmp/ramdisk
mount -t tmpfs -o size=128M tmpfs /tmp/ramdisk/
 
# Move MySQL data
mv /var/lib/mysql /tmp/ramdisk/mysql
ln -s /tmp/ramdisk/mysql/ /var/lib/mysql
View bootstrap-chef-solo.sh
1 2 3 4 5 6 7 8 9 10
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev git-core
cd /tmp
wget http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz
tar -xvzf ruby-2.0.0-p247.tar.gz
cd ruby-2.0.0-p247/
./configure --prefix=/usr/local
make
make install
View gist:3904887
1 2 3 4 5 6 7 8 9 10
{
"AD" => ["Catalan"],
"AE" => ["Arabic"],
"AF" => ["Dari", "Pashto"],
"AG" => ["English"],
"AI" => ["English"],
"AL" => ["Albaniana"],
"AM" => ["Armenian"],
"AN" => ["Dutch", "Papiamento"],
"AR" => ["Spanish"],
View gist:3059230

Stunnel installation (OSX)

brew install stunnel

Certificate

openssl req -new -x509 -days 9999 -nodes -out /usr/local/etc/stunnel/stunnel.pem -keyout /usr/local/etc/stunnel/stunnel.pem
View timeline.css
1 2
.vmm-timeline{}.vmm-timeline div *{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;}
.vmm-timeline h1,.vmm-timeline h2,.vmm-timeline h3,.vmm-timeline h4,.vmm-timeline h5,.vmm-timeline h6,.vmm-timeline p,.vmm-timeline blockquote,.vmm-timeline pre,.vmm-timeline a,.vmm-timeline abbr,.vmm-timeline acronym,.vmm-timeline address,.vmm-timeline cite,.vmm-timeline code,.vmm-timeline del,.vmm-timeline dfn,.vmm-timeline em,.vmm-timeline img,.vmm-timeline q,.vmm-timeline s,.vmm-timeline samp,.vmm-timeline small,.vmm-timeline strike,.vmm-timeline strong,.vmm-timeline sub,.vmm-timeline sup,.vmm-timeline tt,.vmm-timeline var,.vmm-timeline dd,.vmm-timeline dl,.vmm-timeline dt,.vmm-timeline li,.vmm-timeline ol,.vmm-timeline ul,.vmm-timeline fieldset,.vmm-timeline form,.vmm-timeline label,.vmm-timeline legend,.vmm-timeline button,.vmm-timeline table,.vmm-timeline caption,.vmm-timeline tbody,.vmm-timeline tfoot,.vmm-timeline thead,.vmm-timeline tr,.vmm-timeline th,.vmm-timeline td,.vmm-timeline
View gist:2982592
1 2 3 4 5 6 7 8 9 10
* B-drzewo
- ilość rekordów * rozmiar rekordu
- 100 000 000 * 10B = 1 GB
 
* index bitmapa
- krotnosc * (ilość / 8) = x B
 
* tabela faktów
- dodajemy rozmiary wszystkich atrybutów
- mnozymy przez ilosc wszystkich rekordow w innych tabelach
View run.sh
1 2 3 4 5 6 7 8 9 10
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev git-core
cd /tmp
wget http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p0.tar.gz
tar -xvzf ruby-2.0.0-p0.tar.gz
cd ruby-2.0.0-p0/
./configure --prefix=/usr/local
make
make install
View gist:2500660
1 2 3 4 5 6 7 8 9 10
class ActionDispatch::Routing::Mapper
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
end
end
 
BCX::Application.routes.draw do
draw :api
draw :account
draw :session
View gbrt
1 2 3 4 5 6 7 8 9 10
#!/usr/bin/env ruby
 
def format_commit_info timestamp, time_desc, commit_id, message, ref_name
[
"#{timestamp.strftime("%y %b %d")}, #{timestamp.strftime("%l:%M%p").downcase}",
"(#{time_desc})",
commit_id,
message,
ref_name
]
View regex.irb
1 2 3 4 5 6 7 8 9
# By default ReGex will match the bigest occurrence:
 
ruby-1.9.2-p180 > "_one_ two _three_".scan(/_(.+)_/)
=> [["one_ two _three"]]
 
# But we can tell it to match all the smallest ones:
 
ruby-1.9.2-p180 > "_one_ two _three_".scan(/_(.+?)_/)
=> [["one"], ["three"]]
Something went wrong with that request. Please try again.