Skip to content

Instantly share code, notes, and snippets.

global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
#RewriteCond %{HTTP_HOST} !^www\.
#RewriteRule ^(.*)$ http://www.%{HTTP_HOST}$1 [R=301,L]
#
## rewrite non www -> www
#
server {
listen 80;
server_name domain.com;
server {
listen 80;
server_name domain.com;
rewrite ^(.*)$ $scheme://www.domain.com$1;
}
server {
listen 80 default_server;
server {
listen 80;
server_name domain.com;
rewrite ^(.*)$ $scheme://www.domain.com$1;
}
server {
listen 80 default_server;
@mikeyhill
mikeyhill / slack.conf
Created December 22, 2015 05:44 — forked from Nihisil/jail.local
Send notifications to the Slack from fail2ban
[Definition]
actioncheck=
actionstart =
actionstop =
actionban = /bin/bash /etc/fail2ban/slack_notify.sh "Banned _country_ <ip> in the jail <name> after <failures> attempts" "<ip>" > /dev/null 2>&1
actionunban = /bin/bash /etc/fail2ban/slack_notify.sh "Unbanned _country_ <ip> in the jail <name>" "<ip>" > /dev/null 2>&1
@mikeyhill
mikeyhill / gist:0e046ab9a3a5216944c9
Created December 10, 2015 08:11
Javascript, PHP and .htaccess redirect for mobile users
This is a simple way to redirect based on screen size. This redirect would go at the bottom of your template for the landing page.
<br />
&lt;script&gt;// &lt;![CDATA[<br />
if (screen.width &lt;= 800) {<br />
document.location = &quot;http://subdomain.domain.com&quot;;<br />
}<br />
// ]]&gt;&lt;/script&gt;<br />
OR
@mikeyhill
mikeyhill / arch-linux-install
Created October 2, 2015 22:37 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap
@mikeyhill
mikeyhill / cent6hvm.ks
Created August 15, 2015 02:01
cent6.6.hvm.ks
skipx
text
install
url --url=http://mirror.centos.org/centos/6/os/x86_64
# Firewall configuration
firewall --enabled --service=ssh
repo --name="repo0" --baseurl=http://mirror.centos.org/centos/6/os/x86_64
repo --name="repo1" --baseurl=http://mirror.centos.org/centos/6/updates/x86_64
repo --name="repo2" --baseurl=http://mirror.oss.ou.edu/epel/6/x86_64/
@mikeyhill
mikeyhill / osx-for-hackers.sh
Last active August 29, 2015 14:25 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: Yosemite Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned. Also, please don't email me about this script, my poor inbox...
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
Refreshing Terraform state prior to plan...
module.bq-vpn.aws_eip.vpn-1-eip: Refreshing state... (ID: eipalloc-9c64cff9)
module.bq-vpn.aws_iam_role_policy.vpn-server-role-policy: Refreshing state... (ID: preprod-vpn-server-role:preprod-vpn-server-role-policy)
module.bq-jenkins.aws_iam_role.jenkins-server-role: Refreshing state... (ID: preprod-jenkins-server-role)
module.bq-elasticache.aws_route53_record.ec-memcached-dns.0: Refreshing state... (ID: ZX6WEG2UUXNTU_memcached_CNAME)
module.bq-app.aws_iam_role.app-server-role: Refreshing state... (ID: dev-app-server-role)
module.bq-elasticache.aws_route53_record.ec-memcached-dns.1: Refreshing state... (ID: ZX6WEG2UUXNTU_memcached_CNAME)
module.bq-ops-vpc.aws_vpc.ops-vpc: Refreshing state... (ID: vpc-4a0e9a2f)
module.bq-utility.aws_iam_role.utility-role: Refreshing state... (ID: preprod-utility-role)