I hereby claim:
- I am corbinbs on github.
- I am corbinbs (https://keybase.io/corbinbs) on keybase.
- I have a public key whose fingerprint is A16F FFC6 0789 FCBA ABA8 CB51 9128 64D8 41D1 4FD9
To claim this, I am signing this object:
import re | |
import os | |
def count_rules(dir, exts=['.drl', '.dslr']): | |
rulecount = 0 | |
for root, dirs, files in os.walk(dir): | |
for file in files: | |
if len([file for ext in exts if file.endswith(ext)]) > 0: | |
filename = os.path.join(root, file) | |
f = open(filename, "r") |
#!/usr/bin/env python | |
""" | |
A script to query the Amazon Web Services usage reports programmatically. | |
Ideally this wouldn't exist, and Amazon would provide an API we can use | |
instead, but hey - that's life. | |
Basically takes your AWS account username and password, logs into the | |
website as you, and grabs the data out. Always gets the 'All Usage Types' |
import objc | |
from AppKit import * | |
from Foundation import * | |
class Alert(object): | |
def __init__(self, messageText): | |
super(Alert, self).__init__() | |
self.messageText = messageText | |
self.informativeText = "" |
from xml.sax.saxutils import XMLGenerator | |
import xml | |
def mask_field(field): | |
return 'X'*len(field) | |
class ScrubHandler(XMLGenerator, object): | |
def __init__(self, scrub_map={}, out=None): | |
super(ScrubHandler, self).__init__(out=out) |
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
""" | |
Demo of json_required decorator for API input validation/error handling | |
""" | |
import inspect | |
import functools | |
import json | |
from traceback import format_exception | |
from flask import jsonify, request | |
import sys |
{ | |
"date_of_birth": "01/01/1970", | |
"email": "corbinbs@example.com", | |
"first_name": "Brian", | |
"last_name": "Corbin" | |
} |
@app.route("/do/something", methods=['POST']) | |
@json_required( | |
required_fields={ | |
'first_name':"Please enter your first name.", | |
'last_name':"Please enter your last name.", | |
'email':'Please specify a valid email address', | |
'date_of_birth':'Please enter your date of birth' | |
}, | |
validations=[ | |
('email', 'Please specify a valid email address', lambda email: email is not None and EMAIL_REGEX.match(email)), |
#!/usr/bin/env bash | |
# | |
# superpack.sh: | |
# | |
# Define components you need to do work. | |
# Quickly. | |
# Superpack downloads/installs stuff so you don't have to. | |
# Blast new developers into productivity on their first day. | |
# | |
# Usage: |
I hereby claim:
To claim this, I am signing this object: