Skip to content

Instantly share code, notes, and snippets.

Taking care of my kid

Matt Wright mattupstate

Taking care of my kid
View GitHub Profile
View humio.d.ts
declare module 'humio' {
interface Options {
ssl?: boolean;
host: string;
port: number;
basePath?: string;
dataspaceId?: string;
sessionId?: string;
includeClientMetadata?: boolean;
includeSessionId?: boolean;
mattupstate / Scale to Fit.jsx
Created Aug 22, 2012
Photoshop script to scale an image to fill a specified rectangle and preserve aspect ratio. Save this in <Photoshop Install Folder>/Presets/Scripts and restart Photoshop.
View Scale to Fit.jsx
#target photoshop
main ();
function cloneRectangle(rect) {
return { x:rect.x, y:rect.y, width:rect.width, height:rect.height };
function rectangle(x, y, width, height) {
return { x:x, y:y, width:width, height:height };
mattupstate /
Last active Aug 27, 2019
An `as_blueprint` method for Flask MethodView classes
from flask import Flask, Blueprint
from flask.views import MethodView
class ApiResource(MethodView):
endpoint = None
url_prefix = None
url_rules = {}
mattupstate /
Created Dec 10, 2014
python url62 implementation
import string
import uuid
alphabet = string.digits + string.ascii_letters
def base62_encode(n):
ret = ''
while n > 0:
ret = alphabet[n % 62] + ret
n /= 62
mattupstate /
Created Apr 19, 2012
Super simple supervisor init.d script
# Supervisord auto-start
# description: Auto-starts supervisord
# processname: supervisord
# pidfile: /var/run/
DESC="supervisod is a system for controlling process state"
mattupstate /
Created Jan 22, 2014
Odd behavior regarding ordering_list and association_proxy with SQLAlchemy
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.ext.orderinglist import ordering_list
app = Flask(__name__)
app.debug = True
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite://'
db = SQLAlchemy(app)
mattupstate /
Last active Jan 4, 2016
A helper function for grabbing pseudo-namespaced configuration options from a Flask application
def namespaced_config_options(app, prefix):
"""Returns a dictionary of configuration options built from
the specified Flask application and string prefix. Keys in the
resulting dictionary will be lowercase.
:param app: a Flask application
:param prefix: a configuration namespace prefix. e.g. `IMAGE_STORE`
rv = {}
for key, value in app.config.iteritems():
mattupstate / module.sublime-snippet
Created Jul 19, 2013
A simple Python module header snippet for Sublime Text
View module.sublime-snippet
<content><![CDATA[# -*- coding: utf-8 -*-
mattupstate /
Created Dec 4, 2013
A generic window resize directive to which you can add to any element to call a function on your controller
.directive 'windowResize', ($window, $parse) ->
restrict: 'A'
link: (scope, element, attrs) ->
w = angular.element($window)
fn = $parse(attrs['windowResize'])
handler = (event) ->
mattupstate / virtualbox.json
Created Sep 3, 2013
Ubuntu 12.04 VirtualBox Packer example
View virtualbox.json
"provisioners": [
"type": "shell",
"scripts": [
You can’t perform that action at this time.