Skip to content

Instantly share code, notes, and snippets.

View cshoe's full-sized avatar
🚵

Chris Schomaker cshoe

🚵
View GitHub Profile
FROM ubuntu:12.04
MAINTAINER Chris Schomaker <schomaker.c@gmail.com>
# add salt repository
RUN sudo apt-get update
RUN sudo apt-get install -y python-software-properties
RUN sudo add-apt-repository -y ppa:saltstack/salt
RUN sudo apt-get update
@cshoe
cshoe / gist:83696dd39f12f3447ef5
Created May 14, 2014 18:51
Cleanup interviews for Mo.
import sys
from xml.etree import ElementTree
from jinja2 import Template
template_string = """{\\rtf1\\ansi\\ansicpg1252\cocoartf1265\cocoasubrtf190
{\\fonttbl\\f0\fswiss\\fcharset0 ArialMT;\\f1\\froman\\fcharset0 Times-Roman;}
{\colortbl;\\red255\green255\\blue255;}

Keybase proof

I hereby claim:

  • I am cshoe on github.
  • I am cshoe (https://keybase.io/cshoe) on keybase.
  • I have a public key whose fingerprint is C6FD 526A 4254 CC42 2427 0747 0862 C043 DAD3 9ACC

To claim this, I am signing this object:

# As mentioned, this is a bit verbose but I like the separation of concerns.
# Basically, you have two functions -- one that does meaningful work and
# another that just serves as the "glue" to connect the Django signal
# infrastructure to your function.
from django.dispatch import receiver
@receiver
def glue_funtion(sender, **kwargs):
"""
importer = ImpImporter('full/path/to/module/dir/')
loader = importer.find_module(<module name without .py>)
m = loader.load_module(<module name without .py>)

Keybase proof

I hereby claim:

  • I am cshoe on github.
  • I am cshoe (https://keybase.io/cshoe) on keybase.
  • I have a public key whose fingerprint is 2DB5 0FC0 C3FF F9EF D3A9 76A2 1E0B 7699 6E4C 5D94

To claim this, I am signing this object:

@cshoe
cshoe / untracked.py
Created January 9, 2013 21:12
untracked.py
from .local import *
DEBUG = True
TEMPLATE_DEBUG = False
DJANGO_DEBUG_TOOLBAR = False
if DJANGO_DEBUG_TOOLBAR:
def extend_tuple(tuple_to_modify, *args):
# Use this function to simply add elements to an existing tuple
return tuple([item for item in tuple_to_modify] + [arg for arg in args])
@cshoe
cshoe / tag_delete_test.py
Last active December 10, 2015 23:59
Delete Tag Test
import json
import oauth2
# FILL THESE OUT
CONSUMER_KEY = ''
CONSUMER_SECRET = ''
# has to be an access token, not a request token
TOKEN = ''
@cshoe
cshoe / or_experiment.py
Created January 14, 2013 16:49
Proving that Python only evaluates to the first `True` value in an or statement.
def first_function(return_value):
"""Returns `return_value`.
"""
print 'Running FIRST function'
return return_value
def second_function(return_value):
"""Returns `return_value`.
def main():
# this is the dict that we want to trim down.
# basically we want to collapse `foo` into a list for a common `id`
bloated_map = [{'foo': 2, 'id': 160},
{'foo': 314, 'id': 160},
{'foo': 314, 'id': 161},
{'foo': 2, 'id': 161}]
# this gives us a list of unique ids
id_list = set([x['id'] for x in bloated_map])