- Component Overview
- Technologies (DB, Languages, Frameworks)
Functionalities
# IPv6 Configuration | |
# -> note that I have disabled ip6 for our internet-connection (wan/eth0) because | |
# -> my upstream/ISP (still) does not do IPv6. The rest, even localhost, does ip6 stuff. | |
net.ipv6.conf.all.disable_ipv6 = 0 | |
net.ipv6.conf.default.disable_ipv6 = 0 | |
net.ipv6.conf.lo.disable_ipv6 = 0 | |
net.ipv6.conf.eth0.disable_ipv6 = 1 | |
net.ipv6.conf.wan.disable_ipv6 = 1 | |
# Packet Forwarding |
acl from_cf src -f /etc/haproxy/cf-ips | |
http-request set-src req.hdr(CF-Connecting-IP) if from_cf | |
option forwardfor if-none |
The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.
In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.
This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.
frontend www-http | |
bind :80 | |
bind *:443 ssl crt /etc/haproxy/certs no-sslv3 | |
capture request header X-Forwarded-For len 50 | |
acl is_cf req.hdr(cf-connecting-ip) -m found | |
http-request set-header X-Client-IP %[src] if !is_cf | |
http-request set-header X-Client-IP %[hdr(cf-connecting-ip)] if is_cf |
module.exports = function (grunt) { | |
require('load-grunt-tasks')(grunt); | |
grunt.initConfig({ | |
express: { | |
options: { | |
// Override defaults here | |
}, | |
web: { | |
options: { |
(Also see [remarkable][], the markdown parser created by the author of this cheatsheet)
#!/bin/bash | |
# ssh-multi | |
# D.Kovalov | |
# Based on http://linuxpixies.blogspot.jp/2011/06/tmux-copy-mode-and-how-to-control.html | |
# a script to ssh multiple servers over multiple tmux panes | |
starttmux() { | |
if [ -z "$HOSTS" ]; then |
var playSingleChime = function() | |
{ | |
var context = new webkitAudioContext(), | |
gain = context.createGainNode(), | |
osc = context.createOscillator(); | |
osc.connect(gain); | |
gain.connect(context.destination); | |
osc.frequency.value = 1000.0; |
var context = new webkitAudioContext(), | |
oscillator = context.createOscillator(); | |
oscillator.type = oscillator.SQUARE; | |
oscillator.frequency.value = 1000; | |
oscillator.connect(context.destination); | |
oscillator.noteOn && oscillator.noteOn(0); | |
setTimeout('oscillator.disconnect()', 500); |