Skip to content

Instantly share code, notes, and snippets.

View dirn's full-sized avatar
🤔

Andy Dirnberger dirn

🤔
View GitHub Profile
@dirn
dirn / default.nix
Last active June 21, 2017 16:12
PyGotham nix
with import <nixpkgs> {};
let rubyenv = bundlerEnv {
name = "pygotham-2017-ruby-env";
inherit ruby;
gemfile = ./Gemfile;
lockfile = ./Gemfile.lock;
# This can be generated using $(nix-build '<nixpkgs>' -A bundix)/bin/bundix
gemset = ./gemset.nix;
{
packageOverrides = pkgs_: with pkgs_;{
vim = pkgs.vim_configurable.override {
python = python3;
pythonSupport = true;
rubySupport = true;
};
all = with pkgs; buildEnv {
name = "all";
@dirn
dirn / .pylintrc
Created September 25, 2013 13:19
[MASTER]
# Specify a configuration file.
#rcfile=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# Profiled execution.
⋊> ~/s/i/Henson-MongoDB on initial-functionality ⨯ (Henson-MongoDB) python -m sphinx.ext.intersphinx "https://motor.readthedocs.io/en/stable/objects.inv"
py:attribute
motor.motor_tornado.MotorClient.document_class api/motor_client.html#motor.motor_tornado.MotorClient.document_class
motor.motor_tornado.MotorClient.host api/motor_client.html#motor.motor_tornado.MotorClient.host
motor.motor_tornado.MotorClient.is_mongos api/motor_client.html#motor.motor_tornado.MotorClient.is_mongos
motor.motor_tornado.MotorClient.is_primary api/motor_client.html#motor.motor_tornado.MotorClient.is_primary
motor.motor_tornado.MotorClient.max_bson_size api/motor_client.html#motor.motor_tornado.MotorClient.max_bson_size
motor.motor_tornado.MotorClient.max_message_size api/motor_client.html#motor.motor_tornado.MotorClient.max_message_size
motor.motor_tornado.MotorClient.max_pool_size api/motor_client.html#motor.motor_tornado.MotorClient.max_pool_size
motor.motor_tor
"""Create a schedule from a spreadsheet."""
import datetime
import os
import sqlalchemy
from sqlalchemy import (
Column, Date, Enum, ForeignKey, Integer, String, Table, Text, Time,
)
from sqlalchemy.ext.declarative import declarative_base
@dirn
dirn / cli.py
Last active March 15, 2016 17:57
def _split_args(f):
@wraps(f)
def dispatch(parsed_args, *args, **kwargs):
parsed_args = vars(parsed_args)
parsed_args.pop('_functions_stack', None)
return f(**parsed_args)
return dispatch
def register_commands(functions, namespace=None, namespace_kwargs=None,
@dirn
dirn / validators.py
Last active January 28, 2016 21:00
Validator for a range of values using Voluptuous
class Range:
"""A validator to check if a value is within a range."""
def __init__(self, start, stop=None, step=1):
# Do our best to match range's signature.
if stop is None:
# If there is no value for stop, use start as stop instead.
self.range = range(start)
else:
self.range = range(start, stop, step)
@dirn
dirn / dtt.py
Created January 29, 2014 02:14
Direct to Template
def direct_to_template(blueprint, rule, template, **kwargs):
"""Return a view rendered directly from a template."""
def f(template, **kwargs):
return render_template(template, **kwargs)
endpoint = kwargs.pop('endpoint', None)
if not endpoint:
endpoint = os.path.basename(template).split('.')[0]
blueprint.add_url_rule(
#!/usr/bin/env python
import os
import re
import subprocess
import sys
modified = re.compile('^(?:M|A)(\s+)(?P<name>.*)')
CHECKS = [
@dirn
dirn / app.py
Created January 14, 2014 21:11
from flask import Flask, url_for
app = Flask(__name__)
@app.route('/')
def index():
return url_for('view', id=5)