Skip to content

Instantly share code, notes, and snippets.

View spangenberg's full-sized avatar

Daniel Spangenberg spangenberg

View GitHub Profile
set -g status-left-length 32
set -g status-right-length 150
set -g status-fg white
set -g status-bg colour234
set -g window-status-activity-attr bold
set -g pane-border-fg colour245
set -g pane-active-border-fg colour39
set -g message-fg colour16
set -g message-bg colour221
require 'benchmark'
texts, marshaled_texts = [], []
n = 1_000_000
puts "Write:"
Benchmark.bm(17) do |x|
x.report('without marshal:') { for i in 1..n; texts << (0...8).map{(65+rand(26)).chr}.join end }
x.report('with marshal:') { for i in 1..n; marshaled_texts << Marshal.dump((0...8).map{(65+rand(26)).chr}.join) end }
end
@spangenberg
spangenberg / cpuinfo
Last active December 16, 2015 10:28
OMFG!!! hs1.8xlarge
[ec2-user@ip-10-139-147-122 ~]$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 45
model name : Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz
stepping : 7
microcode : 0x70b
cpu MHz : 2000.003
cache size : 20480 KB
@spangenberg
spangenberg / README
Last active December 15, 2015 19:59
Funny ruby kata with @stevenklar
rspec string_calculator_spec.rb
let NERDTreeIgnore=['\.pyc$', '\.pyo$', '\.rbc$', '\.rbo$', '\.class$', '\.o$', '\~$']
augroup AuNERDTreeCmd
autocmd AuNERDTreeCmd VimEnter * call s:CdIfDirectory(expand("<amatch>"))
autocmd AuNERDTreeCmd FocusGained * call s:UpdateNERDTree()
" If the parameter is a directory, cd into it
function s:CdIfDirectory(directory)
let explicitDirectory = isdirectory(a:directory)
let directory = explicitDirectory || empty(a:directory)
@spangenberg
spangenberg / gist:3207885
Created July 30, 2012 15:38
RANDOM BRAIN!FUCK
times = ARGV[0].to_i
tries = ARGV[1].to_i
times.times do
sum = 0
tries.times do
sum = sum + rand(1..6)
end
avg = sum / tries
puts avg
server {
listen 80; # Listen on port 80 for IPv4 requests
server_name jenkins.example.com;
access_log /var/log/nginx/hudson_access.log;
error_log /var/log/nginx/hudson_error.log;
location ~ ^/static/[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]\/(.*)$ {
#rewrite all static files into requests to the root
# Setting the prefix from C-b to C-a
# START:prefix
set -g prefix C-a
# END:prefix
# Free the original Ctrl-b prefix keybinding
# START:unbind
unbind C-b
# END:unbind
#setting the delay between prefix and command
# START:delay
set -g status-left-length 32
set -g status-right-length 150
set -g status-fg white
set -g status-bg colour234
set -g window-status-activity-attr bold
set -g pane-border-fg colour245
set -g pane-active-border-fg colour39
set -g message-fg colour16
set -g message-bg colour221
FB.init({ appId: "1234", nativeInterface: CDV.FB, useCachedDialogs: false });
FB.login(function(response) {
if (response.session) {
alert('logged in');
} else {
alert('not logged in');
}
}, { scope: "publish_stream" });
FB.api('/me/feed', 'post', {message: "FooBar!});