Skip to content

Instantly share code, notes, and snippets.

View ulfurinn's full-sized avatar

Valeri Sokolov ulfurinn

View GitHub Profile
@lewisd32
lewisd32 / iptableflip.sh
Created April 15, 2015 18:20
Snippet of Unbounce script for restarting HAProxy with zero downtime
echo "Flipping tables! (╯°□°)╯︵ ┻━┻"
num_rules=3
real=3 # exposed to the ELB as port 443
test=4 # used to install test certs for domain verification
health=5 # used by the ELB healthcheck
blue_prefix=855
green_prefix=866
@ryancdotorg
ryancdotorg / exim-rebuild.sh
Last active August 17, 2023 00:28
produce debian exim packages linked against OpenSSL instead of GnuTLS
#!/bin/sh
set -ex
sudo apt-get update
sudo apt-get upgrade
sudo apt-get build-dep exim4
sudo apt-get install --no-install-recommends devscripts fakeroot
apt-get source exim4
perl -i -pe 's/^\s*#\s*OPENSSL\s*:=\s*1/OPENSSL:=1/' exim4-*/debian/rules
cd exim4-*
dch -l +openssl 'rebuild with openssl'
@meineerde
meineerde / nginx.conf
Created March 13, 2013 10:11
Check the Accept-Language Header to emulate part of Apache's content negotiation features. This is based on http://stackoverflow.com/questions/3657614/how-to-rewrite-location-in-nginx-depending-on-the-client-browsers-language
map $http_accept_language $lang {
default en;
~de de;
~en en;
}
location /foo/bar/baz/lang.js {
try_files $uri.$lang $uri;
}
@ged
ged / copyfrom.rb
Created September 28, 2010 15:45
Example of how to use COPY FROM from Ruby with the 'pg' library. The last two edits are demonstrating the error case and the successful case.
#!/usr/bin/env ruby
require 'pg'
require 'stringio'
$stderr.puts "Opening database connection ..."
conn = PGconn.connect( :dbname => 'test' )
conn.exec( <<END_SQL )
DROP TABLE IF EXISTS logs;