Goal: Connect to MSSQL using FreeTDS / ODBC in Python.
Host: Ubuntu 11.10 x86_64
Install:
sudo apt-get install freetds-dev freetds-bin unixodbc-dev tdsodbc
pip install pyodbc sqlalchemy
In /etc/odbcinst.ini:
DATABASE_URL=postgres://USERNAME:[email protected]/DATABASE | |
MEMCACHE_SERVERS=127.0.0.1:11211 | |
DJANGO_SETTINGS_MODULE=settings.development.local |
class DynamicFieldsMixin(object): | |
""" | |
A serializer mixin that takes an additional `fields` argument that controls | |
which fields should be displayed. | |
Usage:: | |
class MySerializer(serializers.HyperlinkedModelSerializer, DynamicFieldsMixin): | |
class Meta: | |
model = MyModel |
from uuid import UUID | |
def validate_uuid4(uuid_string): | |
""" | |
Validate that a UUID string is in | |
fact a valid uuid4. | |
Happily, the uuid module does the actual | |
checking for us. |
Goal: Connect to MSSQL using FreeTDS / ODBC in Python.
Host: Ubuntu 11.10 x86_64
Install:
sudo apt-get install freetds-dev freetds-bin unixodbc-dev tdsodbc
pip install pyodbc sqlalchemy
In /etc/odbcinst.ini:
A quick overview of the node.js streams interface with basic examples.
This is based on @brycebaril's presentation, Node.js Streams2 Demystified
Streams are a first-class construct in Node.js for handling data.
Think of them as as lazy evaluation applied to data.
//To run Q.js examples: | |
// 1. Open a new browser tab in Chrome and turn on developer toolbar. | |
// 2. Copy/Paste this gist in the console (opened from any http site) and hit enter to run the snippets. | |
// Based on the inspiration from samples @ https://github.com/kriskowal/q | |
//////////////////////////////////////////////////////////////////// | |
//////////////////////////////////////////////////////////////////// |
# First: | |
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done | |
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.* | |
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following: | |
#go to /usr/local/lib and delete any node and node_modules | |
cd /usr/local/lib | |
sudo rm -rf node* |
#!/bin/bash | |
TODAY=`date +%Y-%m-%d` | |
LIST=$(cat lunch.txt | perl -MURI::Escape -ne 'print uri_escape($_)') | |
curl -s \ | |
-d "list=$LIST" \ | |
-d "format=plain" \ | |
-d "rnd=date.$TODAY" \ | |
"https://www.random.org/lists/?mode=advanced" |
var Artist = Backbone.Model.extend(); | |
var Artists = Backbone.Collection.extend({ | |
model : Artist, | |
url : "http://api.discogs.com/database/search?type=artist", | |
sync : function(method, collection, options) { | |
// By setting the dataType to "jsonp", jQuery creates a function | |
// and adds it as a callback parameter to the request, e.g.: | |
// [url]&callback=jQuery19104472605645155031_1373700330157&q=bananarama | |
// If you want another name for the callback, also specify the |
from django.conf import settings | |
from tastypie.throttle import CacheDBThrottle | |
class SmartCacheDBThrottle(CacheDBThrottle): | |
""" | |
Custom throttling class to address bug in Tastypie that manifests | |
when trying to run tests or do any kind of development with a Resource | |
that has some kind of throttling configured. Tastypie is not smart |