Skip to content

Instantly share code, notes, and snippets.

View alexnj's full-sized avatar

Alex N. Jose alexnj

View GitHub Profile
@alexnj
alexnj / php-fpm
Created February 16, 2014 02:11
php-fpm init.d script
#!/bin/sh
#
# php-fpm - this script starts and stops the php-fpm daemon
#
# chkconfig: - 85 15
# description: PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI \
# implementation with some additional features useful for sites of \
# any size, especially busier sites.
# processname: php-fpm
@alexnj
alexnj / nginx
Created February 16, 2014 02:34
nginx init.d script
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
@alexnj
alexnj / nginx.conf
Created February 16, 2014 03:07
nginx configuration
user nobody;
worker_processes 1;
error_log logs/error.log;
pid /opt/nginx/var/run/nginx;
events {
worker_connections 1024;
}
@alexnj
alexnj / stud
Created February 17, 2014 07:32
stud init.d script
#!/bin/sh
#
# stud - this script starts and stops the stud daemon
#
# chkconfig: - 85 15
# description: stud is Scalable TLS Unwrapping Demon
# processname: stud
# Source function library.
. /etc/rc.d/init.d/functions
@alexnj
alexnj / tmux-compile-prefix-opt.sh
Created March 5, 2014 17:20
Compile tmux from source with /opt prefix
#!/bin/bash
# tmux will be installed in /opt/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=1.9
@alexnj
alexnj / user.js
Created March 8, 2014 20:43
Unit test
var db = require('../lib/db');
exports = module.exports = {};
exports.findAll = function(req, res) {
db.query('select * from users', function(err,rows){
res.send({'users':rows});
});
};
@alexnj
alexnj / gist:7e7f663dcc8a4962afed
Created April 3, 2015 10:10
Limit bandwidth of a guest network using dd-wrt
tc qdisc del dev br1 root
tc qdisc add dev br1 root handle 1: cbq avpkt 1000 bandwidth 2mbit
tc class add dev br1 parent 1: classid 1:1 cbq rate 256kbit allot 1500 prio 5 bounded isolated
tc filter add dev br1 parent 1: protocol ip prio 16 u32 match ip dst 192.168.99.1/24 flowid 1:1
tc filter add dev br1 parent 1: protocol ip prio 16 u32 match ip src 192.168.99.1/24 flowid 1:1
@alexnj
alexnj / hitch
Created April 16, 2016 02:01
Hitch init.d
#!/bin/sh
#
# hitch - this script starts and stops the hitch daemon
#
# chkconfig: - 85 15
# description: hitch is Scalable TLS Unwrapping Demon
# processname: hitch
# Source function library.
. /etc/rc.d/init.d/functions
{
"control": {
"url": "https://ab-test-origin-server.herokuapp.com/",
"cache": {
}
},
"variants": [
{
"weight": 0.5,
"url": "https://ab-test-origin-server.herokuapp.com/?feature=bluelinks",
@alexnj
alexnj / ab-configurations
Last active November 9, 2022 15:45
A/B test configurations origin
# ab-configurations
transformations follow the structure
[
[bitField of flags, CSS selector to modify, operation, ...payloads]
]
Available bit flags are:
0x1 - PRE_UA - Changes are applied prior to User Agent
0x2 - ON_UA - Changes are applied on UA