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
@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
#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 / 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
1 x ASRock Z68 PROFESSIONAL GEN3 LGA 1155 Intel Z68 HDMI SATA 6Gb/s USB 3.0 ATX Intel Motherboard
1 x Crucial M4 CT128M4SSD2 2.5" 128GB SATA III MLC Internal Solid State Drive (SSD)
1 x Intel Core i7-2600K Sandy Bridge 3.4GHz (3.8GHz Turbo Boost) LGA 1155 95W Quad-Core Desktop Processor BX80623I72600K
1 x G.SKILL Ripjaws Series 16GB (4 x 4GB) 240-Pin DDR3 SDRAM DDR3 1600 (PC3 12800) Desktop Memory Model F3-12800CL9Q-16GBRL
00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
@mikeyhill
mikeyhill / sql query
Created August 27, 2011 20:41
slow query
SELECT p.name as procedure_name, addr.zip as zip,
s.procedure_id as proc, s.id
FROM slots AS s, procedures AS p, organizations AS o, addresses_organizations as au, addresses as addr
WHERE s.provider_id = o.id
AND s.procedure_id = p.id
AND au.organization_id = o.id
AND addr.id = au.address_id
AND addr.zip LIKE '".$zipcode."%'
ORDER BY random()
LIMIT 5
@mikeyhill
mikeyhill / php.ini
Created August 27, 2011 04:02
php.ini
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; This file controls many aspects of PHP's behavior. In order for PHP to
; read it, it must be named 'php.ini'. PHP looks for it in the current
; working directory, in the path designated by the environment variable
; PHPRC, and in the path that was defined in compile time (in that order).
; Under Windows, the compile-time path is the Windows directory. The