This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import uuid | |
import base64 | |
def uuid_url64(): | |
"""Returns a unique, 16 byte, URL safe ID by combining UUID and Base64 | |
""" | |
rv = base64.b64encode(uuid.uuid4().bytes).decode('utf-8') | |
return re.sub(r'[\=\+\/]', lambda m: {'+': '-', '/': '_', '=': ''}[m.group(0)], rv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
from flask_mail import Message | |
class FlaskMailLogHandler(logging.Handler): | |
def __init__(self, mail, sender, recipients, subject, *args, **kwargs): | |
super(FlaskMailLogHandler, self).__init__(*args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare module 'humio' { | |
interface Options { | |
ssl?: boolean; | |
host: string; | |
port: number; | |
basePath?: string; | |
dataspaceId?: string; | |
sessionId?: string; | |
includeClientMetadata?: boolean; | |
includeSessionId?: boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, Blueprint | |
from flask.views import MethodView | |
class ApiResource(MethodView): | |
endpoint = None | |
url_prefix = None | |
url_rules = {} | |
@classmethod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Supervisord auto-start | |
# | |
# description: Auto-starts supervisord | |
# processname: supervisord | |
# pidfile: /var/run/supervisord.pid | |
PATH=/sbin:/usr/sbin:/bin:/usr/bin | |
NAME=supervisord | |
DESC="supervisod is a system for controlling process state" | |
SUPERVISORD=/usr/local/bin/supervisord |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<snippet> | |
<tabTrigger>module</tabTrigger> | |
<scope>source.python</scope> | |
<description>Module</description> | |
<content><![CDATA[# -*- coding: utf-8 -*- | |
""" | |
${1:name} | |
${1/./~/g} |