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 / .bashrc
Last active September 7, 2016 08:26
Bash and Zsh dot.rc files
#
# shared history: http://unix.stackexchange.com/questions/1288/preserve-bash-history-in-multiple-terminal-windows#3055135
#
HISTCONTROL=ignoredups:erasedups # no duplicate entries
HISTSIZE=100000 # big big history
HISTFILESIZE=100000 # big big history
shopt -s histappend # append to history, don't overwrite it
#st should be a function to pass args
st(){ sublime-text $*
@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 / object_define_property.js
Created June 24, 2015 17:00
Object.defineProperty and debugger
// 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 / makepr.sh
Last active September 26, 2016 15:14
"Make" a PR on the current branch for another branch (github only)
#
# https://gist.github.com/mping/29e779669071baa88c4c
# make a url like this, for PRs:
# https://github.com/Company/repo/compare/master...BRANCH?expand=1
# https://repo.gitlab.com/Company/repomerge_requests/new?utf8=%E2%9C%93&merge_request%5Bsource_project_id%5D=25&merge_request%5Bsource_branch%5D=BRANCh&merge_request%5Btarget_project_id%5D=25&merge_request%5Btarget_branch%5D=master
#
# > makepr master
# will generate the url for a PR from the current branch to master
@mping
mping / project.clj
Last active February 23, 2016 10:44
server.clj
(defproject jetty-async "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.7.0"]
[com.ninjudd/ring-async "0.2.0"]])
(def ^:dynamic *indent* 0)
(alter-var-root
#'clojure.core/load
(fn [orig]
(fn [& paths]
(let [t (System/nanoTime)
r (binding [*indent* (inc *indent*)]
(apply orig paths))]
(binding [*out* *err*]
(println (apply str (repeat *indent* " ")) (/ (- (System/nanoTime) t) 1000000.0) paths)
(ns skynet.main
(:require
[co.paralleluniverse.pulsar
[core :refer :all]
[actors :refer :all]])
(:refer-clojure :exclude [promise await])
(:gen-class))
(declare skynet)