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]
@dirn
dirn / playbook.yml
Last active August 29, 2015 14:16
Ansible roles
- host: localhost
remote_user: dirn
roles:
- osx
tags: osx, configuration
- role: vim
dotfiles: "{{ dotfiles }}"
tags: vim
@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 / DOCKER.rst
Last active August 29, 2015 14:05

Installing Docker on OS X

  1. boot2docker

    $ brew install boot2docker
@dirn
dirn / schedule.sql
Created August 17, 2014 15:35
PyGotham room schedule
SELECT
TO_CHAR(s.start, 'HH12:MIAM') AS start,
TO_CHAR(s.end, 'HH12:MIAM') AS end,
u.name,
t.name
FROM
rooms r
JOIN rooms_slots rs ON r.id = rs.room_id
JOIN slots s ON rs.slot_id = s.id
JOIN presentations p ON s.id = p.slot_id
@dirn
dirn / example.swift
Created July 18, 2014 16:26
Mutating a Swift struct
struct Foo {}
struct Bar {
var data: [Foo]
init() {
data = [Foo](count: 5, repeatedValue: Foo())
}
mutating func test() {
@dirn
dirn / discountcodes.py
Created July 16, 2014 04:17
PyGotham discount code generator
import random
import string
characters = string.ascii_letters + string.digits
s = set()
while len(s) < 200:
s.add(''.join(random.choice(characters) for _ in range(6)))
class Base(object):
def name(self):
return 'Base'
class Subclass(Base):
def name(self):
return 'Subclass'
def parent_name(self):
return super(Subclass, self).name()
@dirn
dirn / base.py
Created April 9, 2014 04:29
My Django settings
import os
from django.core.exceptions import ImproperlyConfigured
# Shortcuts courtesy of @kennethlove
here = lambda *x: os.path.join(os.path.abspath(os.path.dirname(__file__)), *x)
PROJECT_ROOT = here('..')
root = lambda *x: os.path.join(os.path.abspath(PROJECT_ROOT), *x)
#!/usr/bin/env bash
cd ./$(git rev-parse --show-cdup)
find . -name '*.pyc' - delete