Skip to content

Instantly share code, notes, and snippets.

@mping
mping / nginx.conf
Last active Aug 29, 2015
changing the maximum num of connections
View nginx.conf
worker_processes 4;
worker_rlimit_nofile 1024768;
events {
worker_connections 20480;
use epoll;
}
@mping
mping / nginx.conf
Created Jun 27, 2014
Nginx fastl TLS & SPDY
View nginx.conf
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 Mar 25, 2015
Collectl + Colmux for quick remote monitoring
View colmux.sh
# 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 Aug 29, 2015 — forked from debasishg/gist:8172796
Probabilistic Data Structures
View gist:eaba0d73c9902763b6cc
  1. General Background and Overview
@mping
mping / cors-nginx.conf
Created Jun 9, 2012 — forked from michiel/cors-nginx.conf
Wide-open CORS config for nginx
View cors-nginx.conf
#
# 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 Jul 12, 2012
Using XHTMLRenderer for printing PDFs
View print.html
<!-- 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 Oct 25, 2012 — forked from datagrok/deploy.sh
Minimal Race-free Deployment
View deploy.sh
#!/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 Oct 30, 2012
Redirect all traffic from one port to another, simulating slow connections
View redir.sh
# 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 / object_define_property.js
Created Jun 24, 2015
Object.defineProperty and debugger
View object_define_property.js
// Nice trick when you don't know where a change comes from
// rewrites a property, and sets a debugger when the property changes
console = console || {}; // just in case
console.watch = function(oObj, sProp) {
var sPrivateProp = "$_"+sProp+"_$"; // to minimize the name clash risk
oObj[sPrivateProp] = oObj[sProp];
// overwrite with accessor
@mping
mping / .bashrc
Created May 22, 2013
.bashrc git aliases
View .bashrc
#
# 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'