Skip to content

Instantly share code, notes, and snippets.

View hadrien's full-sized avatar

Hadrien David hadrien

View GitHub Profile
@hadrien
hadrien / main.py
Last active November 4, 2019 22:39
Pyramid: Quick traversal example
from pyramid.httpexceptions import HTTPCreated, HTTPBadRequest
from pyramid.views import view_config
def includeme(config):
config.set_root_factory(Root)
config.scan()
class Root(object):
@hadrien
hadrien / crossdomain.py
Last active August 29, 2015 13:57
/crossdomain.xml with pyramid
from pyramid.path import AssetResolver
from pyramid.response import Response
from pyramid.view import view_config
@view_config(name="crossdomain.xml")
def crossdomain_view(request):
"""View for the crossdomain.xml file.
Its sole purpose is to serve static/crossdomain.xml as
@hadrien
hadrien / doc.rst
Last active September 16, 2016 17:58
Pyramid ACLs + traversal = NICE
@hadrien
hadrien / copy_table.py
Created May 9, 2014 19:37
Naively copy a table from a database to another with SQLSoup.
"""
usage: copy_table.py [-h] source target tablename
Copy a table from one database to another.
positional arguments:
source URL of source database. i.e.: mysql://root@localhost/example
target URL of target database. i.e.: sqlite:///:memory:
tablename Name of table to copy
@hadrien
hadrien / keybase.md
Created September 30, 2014 11:44
keybase.io verification

Keybase proof

I hereby claim:

  • I am hadrien on github.
  • I am hadrien (https://keybase.io/hadrien) on keybase.
  • I have a public key whose fingerprint is E050 BE98 1903 CF78 56AD 40EC B4BB C898 A629 1E1F

To claim this, I am signing this object:

@hadrien
hadrien / README.md
Last active January 10, 2017 19:44
Dev setup for OSX
@hadrien
hadrien / .bash_prompt.sh
Last active January 23, 2017 16:46
Bash prompt + completion
# From http://stackoverflow.com/questions/23399183/bash-command-prompt-with-virtualenv-and-git-branch
# bash_prompt
# The various escape codes that we can use to color our prompt.
RED="\[\033[0;31m\]"
YELLOW="\[\033[1;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[1;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"