Skip to content

Instantly share code, notes, and snippets.

View dirn's full-sized avatar
🤔

Andy Dirnberger dirn

🤔
View GitHub Profile
- hosts: localhost
remote_user: dirn
vars:
ansible: ~/.ansible
dotfiles: "{{ ansible }}/dotfiles"
rc_file: ~/.extra
pyenv: /Users/{{ ansible_ssh_user }}/.pyenv
python_version: 3.4.3
python_versions: [2.6.9, 2.7.9, 3.3.6, 3.4.3, pypy-2.5.0, pypy3-2.4.0]
class AliasedDict(dict):
def __init__(self, mapping):
self.mapping = mapping
def __getitem__(self, key):
if key in self.mapping:
key = self.mapping[key]
return super().__getitem__(key)
def __setitem__(self, key, value):
"""The PyGotham home page."""
from flask import Blueprint, render_template
from pygotham.news import get_active
from pygotham.sponsors import get_accepted
__all__ = ('blueprint',)
blueprint = Blueprint(
- name: PyGotham
docker:
name: web
image: python:3.4.3
pull: always
state: reloaded
env:
PYTHONUNBUFFERED: 1
link:
- "db:db"
FROM ubuntu:14.04
ENV DEBIAN_FRONTEND noninteractive
VOLUME ["/data/devpi"]
EXPOSE 3141
RUN apt-get update -q && apt-get install -y netbase python
ADD https://bootstrap.pypa.io/get-pip.py /get-pip.py
RUN python /get-pip.py
@dirn
dirn / nyr.py
Last active September 11, 2015 18:57
import csv
from bs4 import BeautifulSoup
import requests
in_url = 'http://rangers.nhl.com/club/schedule.htm'
# in_filename = 'schedule.html'
out_filename = 'schedule.csv'
resp = requests.get(in_url)
@dirn
dirn / example.py
Created June 11, 2012 05:25
Switches example
"""Build a script with Switches"""
from switches import command, commandline
@command
def spam(eggs):
"""This function prints the value of eggs"""
print eggs
@dirn
dirn / enableconfig.sh
Created September 17, 2012 22:04
Enable environment settings for collectstatic on Heroku
# https://devcenter.heroku.com/articles/django-assets
heroku labs:enable user-env-compile -a [app_name]
@dirn
dirn / gist:3943102
Last active October 12, 2015 00:27
Sublime Text 2 Settings
{
"color_scheme": "Packages/Tomorrow-Night-Bright.tmTheme",
"detect_indentation": false,
"ensure_newline_at_eof_on_save": true,
"find_selected_text": true,
"fold_buttons": false,
"folder_exclude_patterns":
[
"_build",
"__pycache__",
@dirn
dirn / anagrams.py
Last active December 15, 2015 02:49
PyCon Anagrams
#!/usr/bin/env python
"""Checks for anagrams in stdin.
Example: $ curl -sL http://thumb.tk/8Qdr | python anagrams.py
"""
import itertools
import sys