Skip to content

Instantly share code, notes, and snippets.



So HAProxy is primalery a load balancer an proxy for TCP and HTTP. But it may act as a traffic regulator. It may also be used as a protection against DDoS and service abuse, by maintening a wide variety of statistics (IP, URL, cookie) and when abuse is happening, action as denying, redirecting to other backend may undertaken ([haproxy ddos config], [haproxy ddos])

usergenic / npm_import.bash
Last active Dec 27, 2019
npm link sucks because symlinks and node_modules, so i use this instead
View npm_import.bash
# Given a single argument, being the folder to a local copy of the npm package to "install"
# copy it to the local node_modules folder, then make sure it has no node_modules of its own.
# This way you can npm install locally afterwards to cover remaining dependencies and
# everything will work right.
function npm_import {
export pkgname=`basename $1`
export pkgdir="node_modules/$pkgname"
if [ -d "$pkgdir" ]; then
rm -rf "$pkgdir"
View record-screen.applescript
-- ref
on replace_chars(this_text, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars
pyhedgehog / child.js
Last active Sep 30, 2015
Child pipe proof-of-concept
View child.js
if(!process.send) {
console.log("Not started with accessible parent IPC.");
process.on('message', function(json) {
console.log('parent->child message passed', json);
process.send({type:'got', payload:json});
if(json.type === 'exit') process.exit(0);
Marak /
Last active May 23, 2017
docker cheat sheet

Things I wish I knew before I started using Docker


Init docker on mac os

boot2docker init

Restart docker vm on mac os

boot2docker up
xdamman /
Created Jul 2, 2014
Install latest ffmpeg on ubuntu 12.04 or 14.04
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
creationix / formatStackTrace.js
Created Sep 21, 2011
Beginning of an event-source hook for system-wide stack handling hooks.
View formatStackTrace.js
// Copyright 2006-2008 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
substack / virus.js
Created Sep 15, 2011
nodejitsu virus
View virus.js
var generation = 0;
var wait = 5;
var parents = [];
var hostname = '---';
var http = require('http');
var fs = require('fs');
var source = fs.readFileSync(__filename, 'utf8');
var words = [
tj / event-proxy.js
Created Aug 30, 2011
proxy API for node event emitters (prototype)
View event-proxy.js
var EventEmitter = require('events').EventEmitter;
var request = new EventEmitter;
function Proxy(emitter, callbacks) {
if (!(this instanceof Proxy)) return new Proxy(emitter, callbacks);
var self = this;
// callbacks...