Skip to content

Instantly share code, notes, and snippets.

View Ry4an's full-sized avatar

Ry4an Brase Ry4an

View GitHub Profile
@Ry4an
Ry4an / gist:8736298
Last active October 20, 2015 19:04
Detecting referenced unset variables. based on https://excess.org/article/2012/04/paranoid-django-templates/
class ParanoidContextProxy(object):
"""
This is a poor-man's proxy for a context instance.
Make sure template rendering stops immediately on a KeyError.
"""
def __init__(self, context):
self.context = context
def __getitem__(self, key):
@Ry4an
Ry4an / .pythonrc
Created February 12, 2013 18:31
For getting history in python REPL. Mostly cribbed from stackoverflow answers
import atexit
import os
import re
import readline
import rlcompleter
import socket
import _socket
import sys
import time
try:
@Ry4an
Ry4an / gist:4960647
Created February 15, 2013 14:20
dyanamodb to redshift
copy table_redshift from 'dynamodb:// table_dynamodb'
credentials 'aws_access_key_id=xxx;aws_secret_access_key=xxx'
readratio 50;
Name Qty. No. Description Price
Darrel 1. Kid's Burger
One extra slice of cheese
Lettuce; Tomatoes; Pickles
Side Salad
Blue Cheese 6.88
Delete
Tim 2. The Elevation Burger
One slice of cheese
@Ry4an
Ry4an / irc-rant
Created May 10, 2013 14:12
My cranky-day rant about people /msg-ing in work IRC
People keep /MSG-ing me non-secret things in IRC, so I assume everyone's doing it w/ one another too. Everytime someone /msg-s me I ask them to bring it up in the main channel instead, but that's not getting the message across, so: STOP IT.
The whole point of IRC is that there's huge benefit in everyone overhearing things that they're not currently working on. This is why IRC is 1000x better for a tech group than IM. There's incredible value in making things like "Oh, I did that at my last job, consider looking at X" or "Didn't I see you did something with Y last month?" possible, and all of that gets flushed down the drain when you /msg.
Don't worry about the channel getting too chatty. I'm in some channels w/ 200+ members and it works just fine. Your IRC client will figure it out.
There might be no immediate need for [Alice] to hear [Bob] and I discussing the finer points of dynamo throughput settings, but there's no harm in it and if at the end of the month the bill knocks her socks off she's goin
@Ry4an
Ry4an / ircsay.sh
Created May 30, 2013 01:55
Write to a named pipe (for ii) but don't block forever doing it
#!/bin/bash
# adapted from http://stackoverflow.com/questions/422530/write-to-fifo-pipe-from-shell-with-timeout
case $# in
0) echo "Usage: `basename $0` message..." 1>&2 ;;
esac
{
echo "$@" > /persistent/dramafever/phenny/irc/irc.freenode.net/#dramafever/in
@Ry4an
Ry4an / cors-nginx.conf
Last active November 5, 2020 07:33 — forked from alexjs/cors-nginx.conf
Here' the minimal Access-Control-Allow-Origin header insertion necessary to allow any whitelisted sites to access resources via CORS headers.
#
# Minimal CORS config for nginx
#
# A modification of https://gist.github.com/alexjs/4165271
#
# NB: This relies on the use of the 'Origin' HTTP Header.
location /static {
if ($http_origin ~* (whitelist\.address\.one|whitelist\.address\.two)$) {