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 'rubygems' | |
require 'mechanize' | |
FIRST_NAME = 'FIRST_NAME' | |
LAST_NAME = 'LAST_NAME' | |
PHONE = 'PHONE' | |
EMAIL = 'EMAIL@provider.com' | |
PARTY_SIZE = 2 | |
SCHEDULE_RANGE = { :start_time => '19:00', :end_time => '20:30' } |
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
binary_search(){ | |
TARGET=$1 | |
TO_SEARCH=(${@:2}) | |
LENGTH=${#TO_SEARCH[@]} | |
START=0 | |
END=$((LENGTH - 1)) | |
while [[ $START -le $END ]]; do | |
MIDDLE=$((START + ((END - START)/2))) | |
ITEM_AT_MIDDLE=${TO_SEARCH[MIDDLE]} |
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
#!/usr/bin/env ruby | |
# Remove all gems EXCEPT defaults :) | |
`gem list -d`.split(/\n\n^(?=\w)/).each do |data| | |
match = data.match(/(?<name>([^\s]+)) \((?<versions>.*)\)/) | |
name = match[:name] | |
versions = match[:versions].split(', ') | |
if match = data.match(/^.*\(([\d\.]*),? ?default\): .*$/) | |
next if match[1].empty? # it's the only version if this match is empty |
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
r53 = AWS::Route53.new( | |
:access_key_id => 'aws-key-id', | |
:secret_access_key => 'aws-secret-key') | |
response = r53.client.list_resource_record_sets( | |
:hosted_zone_id => "zone-id", | |
:start_record_name => 'xxx.example.com', | |
:start_record_type => 'CNAME' | |
) | |
puts response[:resource_record_sets].map{|r| r[:name]} |
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/bash | |
lastCommit="" | |
editorCmd="sed -i ''" | |
for commit in $@; do | |
lastCommit=${commit:0:7} | |
editorCmd="$editorCmd -e 's/pick ${lastCommit}/fixup ${lastCommit}/'" | |
done | |
GIT_SEQUENCE_EDITOR=$editorCmd git rebase -i ${lastCommit}~2 |
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
;; Big thanks to Christophe Grand - https://groups.google.com/d/msg/clojure/L1GiqSyQVVg/m-WJogaqU8sJ | |
(defn scaffold [iface] | |
(doseq [[iface methods] (->> iface .getMethods | |
(map #(vector (.getName (.getDeclaringClass %)) | |
(symbol (.getName %)) | |
(count (.getParameterTypes %)))) | |
(group-by first))] | |
(println (str " " iface)) | |
(doseq [[_ name argcount] methods] | |
(println |
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
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
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
TODO: | |
- edit /opt/statsd/local.js | |
- correct the graphite host to localhost | |
- if desired, put 'debug: true' in there | |
- make the box accessible via the hostname 'graphite' | |
- update conf/storage-schemas.conf, see example for these retention rules: | |
6 hours of 10 second data | |
1 week of 1 minute data | |
5 years of 10 minute data |
NewerOlder