Skip to content

Instantly share code, notes, and snippets.

#!/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.
@mostlygeek
mostlygeek / setup.sh
Last active August 29, 2015 14:02
setup-moz-puppet-env
#!/bin/sh
cd ~
DIST=$(/usr/lib/rpm/redhat/dist.sh --el)
if [ "$DIST" -eq "6" ]; then
sudo yum install -y vim-svcops
echo "alias vi=/opt/vim/bin/vim" >> ~/.bash_profile
echo "alias vim=/opt/vim/bin/vim" >> ~/.bash_profile
source ~/.bash_profile
@mostlygeek
mostlygeek / install-vim73-centos
Last active August 29, 2015 13:58
install-vim73-centos
#!/bin/sh
# credit: http://sudoers-d.com/blog/2013/01/18/installing-vim-on-centos-6-dot-3/
#
# Install (for the brave/trusting):
# > curl -L http://j.mp/vim73centos | sh
#
# This will install vim 73 into $HOME/bin so update your path to
# be: PATH=$HOME/bin:$PATH to make sure the right version of
# vim is used each time!
@mostlygeek
mostlygeek / gist:7131906
Last active November 29, 2016 13:31 — forked from cemre/gist:4402564
An easy (ha!) way to resize and png optimize screenshots in OSX. This is good for resampling and then optimizing retina screenshots when sending to people. It dumps things into Dropbox/public/Screenshots, and copies the public URL to the clipboard. Bind it to a hot key to to make it easy to use. Check out the output: https://dl.dropboxuserconten…
#!/bin/bash
# *******************************
# Instructions on turning this into an OSX service:
# http://blog.lanceli.com/2012/08/downscale-screenshot-at-hight-resolution-on-retina-mackbook-pro.html
# *******************************
# the path where screenshots to save
DROPBOX_ID= ENTER YOUR DROPBOX ID HERE
@mostlygeek
mostlygeek / test-emit-context.js
Created August 16, 2013 19:58
A little test to see what context an event listener is bound to when run.
const events = require('events'),
util = require('util');
function Test() {
this.created = Date.now();
}
util.inherits(Test, events.EventEmitter);
Test.prototype.sendEmit = function() {
this.emit("BOOM", Date.now(), this);
}
@mostlygeek
mostlygeek / fireworks.js
Last active December 21, 2015 00:09
Fireforks
/*
* http://jsfiddle.net/mostlygeek/etz43/
*
* much credit goes to: http://thecodeplayer.com/walkthrough/canvas-fireworks-tutorial
* tweaked a few things out for performance:
*
* - revised the animation loop to stop animating when no more particles/fireworks
* - use `|0` to round off to nearest pixel
* - use a clock algorithm for trails, instead of pop() and unshift() on the array
*/
#!/bin/bash
# update the system
sudo apt-get --yes update
sudo apt-get --yes upgrade
# node.js using PPA (for statsd)
sudo apt-get install --yes python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update --yes
#!/usr/bin/env python
#
# s3-download.py - a quick-and-dirty download script to download from S3
# implemented using Boto, which automatically applies AWS IAM role credentials
#
# This code is distributed under the MIT license from
# http://opensource.org/licenses/MIT:
#
# Copyright (c) 2013 Martijn Koster
#