Skip to content

Instantly share code, notes, and snippets.

@mping
mping / nginx.conf
Last active August 29, 2015 14:02
changing the maximum num of connections
worker_processes 4;
worker_rlimit_nofile 1024768;
events {
worker_connections 20480;
use epoll;
}
@mping
mping / nginx.conf
Created June 27, 2014 21:35
Nginx fastl TLS & SPDY
http {
# usual config stuff...
server {
listen 173.230.151.99:80;
server_name istlsfastyet.com www.istlsfastyet.com;
# redirect to naked domain avoiding http://www -> https://www -> https:// chain.
rewrite ^ https://istlsfastyet.com$request_uri? permanent;
@mping
mping / colmux.sh
Created March 25, 2015 14:57
Collectl + Colmux for quick remote monitoring
# on colmux host:
> colmux -addr 'node[01-12],othernode[1-5].linode.com' -command "-sncm" -debug 5
#run on every node:
> sudo /usr/bin/collectl -scn -oT -A10.135.5.143 --debug 1
# with parallel-ssh, hosts.txt:
> parallel-ssh -h hosts.txt sudo /usr/bin/collectl -sncm -oT -A10.135.5.143 --debug 1
@mping
mping / gist:eaba0d73c9902763b6cc
Last active August 29, 2015 14:20 — forked from debasishg/gist:8172796
Probabilistic Data Structures
  1. General Background and Overview
@mping
mping / cors-nginx.conf
Created June 9, 2012 12:01 — forked from michiel/cors-nginx.conf
Wide-open CORS config for nginx
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' 'http://10.140.10.40';
#
@mping
mping / print.html
Created July 12, 2012 10:42
Using XHTMLRenderer for printing PDFs
<!-- check https://github.com/flyingsaucerproject/flyingsaucer -->
<div style="-fs-page-sequence: start; page-break-before: always">
<!-- header for each page -->
<div style="position: running(current);">
<div id="page-header" class="small">
<span style="text-align: left; float:left;">
<!-- header will appear on all pages -->
@mping
mping / deploy.sh
Created October 25, 2012 14:26
Minimal Race-free Deployment
#!/bin/sh
# deploy.sh
N="`readlink \"$1\"`"
mv -T "$1.stage" "$1"
ln -s "$N" "$1.stage"
rm -rf "$N"
cp -aH "$1" "$N"
@mping
mping / redir.sh
Created October 30, 2012 17:36
Redirect all traffic from one port to another, simulating slow connections
# will listen on 4444, redir to 4567, speed is 1024*32 = 32kbytes/sec (slow!)
redir --lport=4444 --cport=4567 --max_bandwidth $((1024*32))
@mping
mping / .bashrc
Created May 22, 2013 16:59
.bashrc git aliases
#
# aliases
#
alias pserv='python -m SimpleHTTPServer $*'
alias wget='wget --trust-server-names --no-check-certificate'
alias ls='LC_COLLATE=C ls -lFha --group-directories-first --color '
alias grep='grep --color=always'
alias less='less -R'
@mping
mping / latency.txt
Created November 8, 2013 12:00 — forked from jboner/latency.txt
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