Skip to content

Instantly share code, notes, and snippets.

View drcongo's full-sized avatar
🏠
Working from home

Andy Beaumont drcongo

🏠
Working from home
View GitHub Profile
@fratajczak
fratajczak / README.md
Created November 16, 2022 23:36
Fish-like word boundaries in ipython shortcuts

putting this file in ~/.ipython/profile_default/startup/shortcuts.py will change bindings for ctrl-w and shift+left/right arrow to match fish's behaviour regarding word boundaries.

# the following is a basically functional but probably broken for some cases (just tested for basic login ATM) implementation of a flask-security UserDataStore for RethinkDB.
#
# This is released as open source under the MIT license and comes with no warranty, yada yada. TODO: actual license header
from flask_security import UserMixin, RoleMixin
from flask_security.datastore import UserDatastore
import rethinkdb as r
class Bunch(object):
def __init__(self, obj, **kws):
self.__dict__.update(obj)
@shazow
shazow / meta.py
Created March 6, 2013 23:20
My latest SQLAlchemy model base class.
"""SQLAlchemy Metadata and Session object"""
import datetime
import json
import time
from sqlalchemy import MetaData
from sqlalchemy.orm import scoped_session, sessionmaker
__all__ = ['Session', 'metadata', 'Model', 'SchemaEncoder']
Setup apache status
- sudo a2enmod status
- sudo nano /etc/apache2/conf.d/extendedstatus
- - Paste in 'ExtendedStatus On'
- sudo nano /etc/apache2/sites-available/xxx.com
Paste in...
<VirtualHost *:80>
ServerName status.ws1.xxx.com
ServerAlias status.ws1.xxx.com
@dansimau
dansimau / .gitignore
Created May 20, 2012 23:52 — forked from urschrei/mkflask.sh
Bootstrap a Flask project on Ubuntu Precise, with Puppet, Vagrant and Fabric. (For latest version, see https://github.com/dansimau/flask-bootstrap)
*~
*.pyc
.vagrant
venv
@bradwright
bradwright / mkflask.sh
Created May 13, 2012 19:41 — forked from urschrei/mkflask.sh
Bootstrap a Flask project
#!/bin/bash -e
# opinionated Flask bootstrap script
# assumes you'll be using MySQL, Fabric, and Blueprints
# creates a virtualenv and an Alembic migrations system
# The script will halt on any error, and remove the project dir if it created one
# accepts a single argument: a new directory name under which to create the project
# check that Python is installed
type python >/dev/null 2>&1 || { echo >&2 "Python doesn't appear to be installed. Aborting."; exit 1; }
@urschrei
urschrei / mkflask.sh
Created May 12, 2012 14:46
Bootstrap a Flask project
#!/bin/bash -e
# opinionated Flask bootstrap script
# assumes you'll be using MySQL/PG, Fabric, Webassets, WTForms and Blueprints
# creates a virtualenv and an Alembic migrations system
# The script will halt on any error, and remove the project dir, if it created one
# accepts a single argument: a new directory name under which to create the project
# check that Python is installed
type python >/dev/null 2>&1 || { echo >&2 "Python doesn't appear to be installed. Aborting."; exit 1; }
@bradwright
bradwright / init.pp
Created April 1, 2012 12:26
Install PIL with Puppet on Ubuntu 11.10
# installs PIL. PIL is rubbish to install because of broken
# dependencies on libjpeg etc, so we need to do some symlinking
class pil {
# libpng is already installed, and I don't care about libfreetype etc.
package { [ 'libjpeg-dev', 'zlib1g' ]:
ensure => 'installed'
}
file { '/usr/lib/libjpeg.so':
@becker990
becker990 / example_image_utils.py
Created December 11, 2011 00:00 — forked from turicas/example_image_utils.py
Layer on top of Python Imaging Library (PIL) to write text in images easily
#!/usr/bin/env python
# coding: utf-8
# You need PIL <http://www.pythonware.com/products/pil/> to run this script
# Download unifont.ttf from <http://unifoundry.com/unifont.html> (or use
# any TTF you have)
# Copyright 2011 Álvaro Justen [alvarojusten at gmail dot com]
# License: GPL <http://www.gnu.org/copyleft/gpl.html>
from image_utils import ImageText
@turicas
turicas / example_image_utils.py
Created December 10, 2011 19:04
Layer on top of Python Imaging Library (PIL) to write text in images easily
#!/usr/bin/env python
# coding: utf-8
# You need PIL <http://www.pythonware.com/products/pil/> to run this script
# Download unifont.ttf from <http://unifoundry.com/unifont.html> (or use
# any TTF you have)
# Copyright 2011 Álvaro Justen [alvarojusten at gmail dot com]
# License: GPL <http://www.gnu.org/copyleft/gpl.html>
from image_utils import ImageText