Skip to content

Instantly share code, notes, and snippets.

@bobuss
bobuss / Numbers.txt
Last active December 22, 2015 18:49
Numbers Everyone Should Know
- L1 cache reference 0.5 ns
- Branch mispredict 5 ns
- L2 cache reference 7 ns
- Mutex lock/unlock 25 ns
- Main memory reference 100 ns
- Compress 1K bytes with Zippy 3,000 ns
- Send 2K bytes over 1 Gbps network 20,000 ns
- Read 1 MB sequentially from memory 250,000 ns
- Round trip within same datacenter 500,000 ns
- Disk seek 10,000,000 ns
@bobuss
bobuss / gist:6515517
Last active October 13, 2023 06:12
Tuning the Linux Kernel for many tcp connections

(from http://www.metabrew.com/article/a-million-user-comet-application-with-mochiweb-part-1)

Save yourself some time and tune the kernel tcp settings before testing with lots of connections, or your test will fail and you’ll see lots of Out of socket memory messages (and if you are masquerading, nf_conntrack: table full, dropping packet.)

Here are the sysctl settings I ended up with - YMMV, but these will probably do:

$ cat /etc/sysctl.conf
# General gigabit tuning:
net.core.rmem_max = 16777216
@bobuss
bobuss / .gitignore
Last active December 13, 2015 22:49
Stamina recovery mecanism inside Redis TTLs
env
@bobuss
bobuss / Makefile
Created November 5, 2012 15:37
Make jshint to work with jenkins
SRC=src
$(JSHINT):
npm install jshint
JS_FILES=$(shell find $(SRC) -type f -name '*.js')
jslint: $(JSHINT)
-$(JSHINT) --jslint-reporter --config config/jshint.json > jshint.xml $(JS_FILES) || :
sed -E 's?<file name="(.*)\?">?<file name="'`pwd`'/\1">?' jshint.xml > jshint-proper.xml
@bobuss
bobuss / sitemap.py
Created July 18, 2012 13:16
Sitemap generator in python with a mustache template
import sys
import codecs
import pystache
import os
import fnmatch
import string
import datetime
webroot = 'http://www.example.com/
path = '/var/www/'
@bobuss
bobuss / commits-by-hour
Created July 2, 2012 14:47
Git commits funstats
#!/usr/bin/env bash
for i in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23; do echo $( echo -e "$i\t"; git shortlog -n --format='%ad %s' | grep " $i:" | wc -l); done
@bobuss
bobuss / README.md
Created June 21, 2012 11:05
Horizontal scroll in the background

Scrollable.js

Just add a "scrollable" class name to your background element, then it will scroll from left to right, according to your scroll event.

@bobuss
bobuss / index.html
Created June 20, 2012 10:34
CSS3 Sign
<!DOCTYPE html>
<html>
<head>
<title>CSS3 Sign</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="container">
@bobuss
bobuss / index.html
Created March 6, 2012 10:59
d3 great arcs over polymaps
<!DOCTYPE html>
<html>
<head>
<title>D3 over Polymap example</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="map.css" />
</head>
<body onload="init();">
<div id="map_container"></div>