Skip to content

Instantly share code, notes, and snippets.

View mostlygeek's full-sized avatar

Benson Wong mostlygeek

View GitHub Profile
@mostlygeek
mostlygeek / cron splice
Created July 18, 2015 18:25
splice hacks
# cron changes
# Puppet Name: tiles_monitor_splice_tiles_index_crawl
SPLICE_SETTINGS=splice_config.SpliceConfig
* * * * * /usr/local/bin/splice_tiles_index_crawl.sh 2>&1 | logger -t splice_tiles_index_crawl
# due a bug in splice_tiles_index_crawl.sh failing sometimes, (greenlets, ew)
* * * * * /usr/local/bin/splice_tiles_watchdog.sh 180 | logger -t splice_tiles_index_crawl
@mostlygeek
mostlygeek / rds-restore-tests.md
Created July 3, 2015 20:22
RDS Point in time Restore tests

Point RDS time TESTING INFORMATION (1hr, 6hr, 12hr, 24hr)

1 HOUR TEST

Summary Info:
--------------------------------------
Snapshot create time: 2015-06-21T16:01:28+00:00
Restore delta       : +60 minutes
Restored to : 2015-06-21T17:01:28+00:00
@mostlygeek
mostlygeek / gist:578d16b3bd4a0515aa92
Created April 27, 2015 22:36
override x-forwarded-for for openresty
# NGINX
location / {
set $forwarded_for $proxy_add_x_forwarded_for;
if ($http_x_verify_ip) {
set $forwarded_for $http_x_verify_ip;
}
@mostlygeek
mostlygeek / gist:390bdd6fdf1e688ec336
Created April 15, 2015 17:24
Bash function to make validating cfn templates easier
function cfnvalidate {
aws cloudformation validate-template --template-body file://$1
}
@mostlygeek
mostlygeek / setup.sh
Last active August 29, 2015 14:06
setup-systemd-test-shutdown.sh
#!/bin/sh
rm /tmp/process-log-shutdown.txt
rm /tmp/last-shutdown.txt
cat > "//usr/local/bin/fake-daemon.sh" << 'EOF'
#!/bin/sh
OUTFILE=/tmp/process-log-shutdown.txt
SLEEP_PID=
@mostlygeek
mostlygeek / gist:196fa15c2216029b8168
Created September 8, 2014 03:15
realtor.ca grease monkey script
// ==UserScript==
// @name realtor-ca-tweaks
// @namespace mostlygeek.com
// @description realtor.ca tweaks
// @version 1
// @grant none
// @requiref https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js
// ==/UserScript==
var el = $('#m_property_dtl_address')
var address = el.text()
@mostlygeek
mostlygeek / max.sh
Last active August 29, 2015 14:05
ec2 tcp max it out!
#!/bin/sh
sysctl -w net.ipv4.ip_local_port_range='2000 65000'
sysctl -w net.ipv4.tcp_window_scaling='1';
sysctl -w net.ipv4.tcp_max_syn_backlog='3240000';
sysctl -w net.core.somaxconn='65535';
sysctl -w net.ipv4.tcp_max_tw_buckets='1440000';
sysctl -w net.core.rmem_default='8388608';
sysctl -w net.core.rmem_max='16777216';
sysctl -w net.core.wmem_max='16777216';
#!/usr/bin/env python
import boto.sqs
from boto.sqs.message import RawMessage
conn = boto.sqs.connect_to_region('us-east-1')
q = conn.get_queue('tiles-data-processing-queue-stage')
q.set_message_class(RawMessage)
m = q.read()
@mostlygeek
mostlygeek / gist:d01fe931a69eb868c4f5
Created August 9, 2014 08:20
EdgeRouter LIte QoS configuration
#
# Settings for EdgeRouter Lite Traffic Shaping for a Shaw 25/2.5mbit connection
#
set traffic-policy shaper shaw25mbit
set traffic-policy shaper shaw25mbit description "QoS policy for home network"
set traffic-policy shaper shaw25mbit bandwidth 25mbit
# give priority to DNS / SSH because lag sucks here
set traffic-policy shaper shaw25mbit class 10 description "top"
set traffic-policy shaper shaw25mbit class 10 bandwidth 25%
@mostlygeek
mostlygeek / dhcp-event
Last active August 29, 2015 14:04
dhcp-event script for
#!/bin/sh
# == ABOUT ==
# this script is run when the WAN IP address changes from the
# asuswrt (https://github.com/RMerl/asuswrt-merlin) project
# It updates the ddns name from freedns.afraid.org
# the base64 key part from the update url you get from freedns.afraid.org
# don't forget to copy/paste the "=" if it exists at the end.