Skip to content

Instantly share code, notes, and snippets.

View es's full-sized avatar
🐢
waiting for the cache to expire

Emil Stolarsky es

🐢
waiting for the cache to expire
View GitHub Profile

Keybase proof

I hereby claim:

  • I am es on github.
  • I am stolarsky (https://keybase.io/stolarsky) on keybase.
  • I have a public key ASC64tyi610WHFxcSo217uABsKWed77Pvhrpr9PB3vVrIgo

To claim this, I am signing this object:

@es
es / nginx.conf
Last active February 2, 2017 22:04
Example Nginx (built with OpenResty’s Lua module) config adding a header with the time since epoch to responses
events {
worker_connections 42;
}
http {
server {
listen 8080;
header_filter_by_lua_block {
ngx.header['X-Epoch'] = ngx.time()
@es
es / Vagrantfile
Last active August 21, 2016 06:20
Openresty Development Environment
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = 'bento/ubuntu-14.04'
config.ssh.forward_agent = true
config.vm.provision 'shell', path: 'provision.sh', privileged: false, keep_color: true
config.vm.provider 'vmware_fusion' do |v|
@es
es / gdb_ruby_backtrace.py
Created December 28, 2015 00:56 — forked from csfrancis/gdb_ruby_backtrace.py
Dump an MRI call stack from gdb
def get_rstring(addr):
s = addr.cast(string_t.pointer())
if s['basic']['flags'] & (1 << 13):
return s['as']['heap']['ptr'].string()
else:
return s['as']['ary'].string()
def get_lineno(iseq, pos):
if pos != 0:
pos -= 1
@es
es / latency.txt
Created November 23, 2015 15:28 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
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
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms
@es
es / docker-compose.yml
Last active October 19, 2016 20:50
Setup Telegraf with InfluxDB & Grafana
telegraf:
image: emil/telegraf
volumes:
- telegraf.conf:/etc/opt/influxdb/telegraf.conf:ro
links:
- influxdb
influxdb:
image: tutum/influxdb
ports:
@es
es / Equity.md
Last active August 29, 2015 14:17 — forked from isaacsanders/Equity.md

This is a post by Joel Spolsky. The original post is linked at the bottom.

This is such a common question here and elsewhere that I will attempt to write the world's most canonical answer to this question. Hopefully in the future when someone on answers.onstartups asks how to split up the ownership of their new company, you can simply point to this answer.

The most important principle: Fairness, and the perception of fairness, is much more valuable than owning a large stake. Almost everything that can go wrong in a startup will go wrong, and one of the biggest things that can go wrong is huge, angry, shouting matches between the founders as to who worked harder, who owns more, whose idea was it anyway, etc. That is why I would always rather split a new company 50-50 with a friend than insist on owning 60% because "it was my idea," or because "I was more experienced" or anything else. Why? Because if I split the company 60-40, the company is going to fail when we argue ourselves to death. And if you ju

@es
es / ps.rb
Created February 21, 2015 23:16
Get running processes in Ruby
# Ps.all to get an array of hashes
# Example hash:
# {
# :user=>"Username",
# :pid=>5321.0,
# :cpu=>6.2,
# :mem=>0.7,
# :vsz=>3438156.0,
# :rss=>56568.0,
# :tt=>"??",

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns                     on recent CPU
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 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs 4X memory

@es
es / Cheffile
Last active October 13, 2021 20:35
Rails Cheffile + Vagrantfile
# encoding: utf-8
site 'http://community.opscode.com/api/v1'
cookbook "apt"
cookbook "ruby_build", {:github=>"fnichol/chef-ruby_build", :ref=>"v0.7.2"}
cookbook "rbenv", {:github=>"fnichol/chef-rbenv"}
cookbook "git", {}
cookbook "redis", {:github=>"ctrabold/chef-redis"}
cookbook "postgresql", {:github => 'phlipper/chef-postgresql'}