Skip to content

Instantly share code, notes, and snippets.

@gvangool
gvangool / 00-README.rst
Last active October 2, 2015 13:28
Endian fix on 64bit OS X

Fixing Endian VPN Client on OSX

Note

assumes Endian VPN and Tunnelblick are installed

  1. Download the file fix-endian-vpn.sh into ~/bin
  2. Mark it as executable chmod +x ~/bin/fix-endian-vpn.sh
  3. Every time you reboot, you must run the script: sudo ~/bin/fix-endian-vpn.sh

    Alternatively, you could add it to the crontab of the root user:

@gvangool
gvangool / test.py
Created December 12, 2011 09:07
Updated Mobile Vikings msisdn_list API
import requests
r = requests.get('http://localhost:8000/api/2.0/basic/msisdn_list.json?alias=1', auth=('test', 'test'))
print r.content
## OUT
#[
# {
# "msisdn": "+32470046092",
# "alias": "Test Jumbo"
# },
# {
.PHONY: me him her yourself a sandwich all
me:
@echo -n '';
him:
@echo -n '';
her:
@echo -n '';
@gvangool
gvangool / admin_autoregister.py
Created August 1, 2010 08:20
Django-admin autoregister -- automatic model registration
""" Django-admin autoregister -- automatic model registration
Original: http://djangosnippets.org/snippets/2066/
## sample admin.py ##
from yourproject.autoregister import autoregister
# register all models defined on each app
autoregister('app1', 'app2', 'app3', ...)
# In-memory Cassandra-ish thingy... useful for unit tests. Maybe useful for other
# stuff too? No support for SuperColumns, but that should be easy enough to add.
import bisect
import copy
from cassandra.ttypes import NotFoundException, Column, ColumnPath, ColumnOrSuperColumn
class SSTable(object):
@gvangool
gvangool / vipy.sh
Created March 3, 2010 06:53 — forked from mmalone/vipy.sh
Simple shell script that locates a Python module and opens it in vi.
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: vipy <python module>"
exit 1
fi
MODULE_LOCATION=`python -c "import $1; print $1.__file__.rstrip('c')"`
if [ -z $MODULE_LOCATION ]; then
@gvangool
gvangool / daterange.py
Created August 11, 2009 13:17 — forked from zacharyvoase/daterange.py
Like xrange() for datetime objects.
# -*- coding: utf-8 -*-
"""
Example Usage
=============
>>> import datetime
>>> start = datetime.date(2009, 6, 21)
>>> g1 = daterange(start)
@gvangool
gvangool / daemonextension.py
Created July 13, 2009 13:51 — forked from screeley/daemonextension.py
Django Management Command for starting a daemon.
"""
Copyright (c) 2009, Sean Creeley
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
@gvangool
gvangool / export_related_as_json.py
Created July 2, 2009 07:09
export_related_as_json gathers all instances related by foreign keys to what is being exported and exports them as well in a serialization bonanza.
@gvangool
gvangool / storage.py
Created June 15, 2009 06:27 — forked from leah/storage.py
An S3 storage backend
from mimetypes import guess_type
from django.core.exceptions import ImproperlyConfigured
from django.core.files.storage import Storage
from django.utils.encoding import iri_to_uri
import re
try:
import S3
except ImportError:
raise ImproperlyConfigured, "Could not load amazon's S3 bindings.\