Skip to content

Instantly share code, notes, and snippets.

@fcurella
fcurella / bootstrap_python_django.py
Created September 9, 2011 20:01
django_bootstrap installation script
#!/usr/bin/env python
import os
import urllib
URL = 'https://raw.github.com/gist/1207150'
INSTALL_DIR = '/usr/local/bin/'
COMMAND_NAME = 'django_bootstrap'
command_path = "%s%s" % (INSTALL_DIR, COMMAND_NAME)
fh = urllib.urlopen(URL)
@fcurella
fcurella / django_postgis_on_os_x.md
Created July 27, 2012 15:22
Django and Postgis on OS X

Django and Postgis on OS X

Install Homebrew

Install a few things with homebrew:

Notice that some packages give you information at the end, read it carefully. To recall that info use brew info like this: $ brew info postgresql

$ brew install python --universal
@fcurella
fcurella / psql.txt
Created August 9, 2012 20:56
postgis 2.0 index benchmark
$ createdb indextest -T template_postgis
$ psql indextest
psql (9.1.3)
Type "help" for help.
indextest=# create table random_points (
indextest(# id integer primary key,
indextest(# pt geometry
indextest(# );
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "random_points_pkey" for table "random_points"
@fcurella
fcurella / psql.py
Created August 27, 2012 16:22
postgres PubSub vs Redis
#!/usr/bin/env python
import select
import time
import psycopg2
import psycopg2.extensions
import sys
def get_cursor():
conn = psycopg2.connect("dbname=pgpubsub")
@fcurella
fcurella / authentication.py
Created November 8, 2012 20:58 — forked from vmihailenco/authentication.py
Tastypie OAuth
import logging
from tastypie.authentication import Authentication
import oauth2
from oauth_provider.consts import OAUTH_PARAMETERS_NAMES
from oauth_provider.store import store
from oauth_provider.store import Error as OAuthError
from oauth_provider.utils import get_oauth_request
from oauth_provider.utils import get_oauth_server
@fcurella
fcurella / echo
Created January 8, 2013 15:35
subcommand wrapper
#!/bin/sh
SUBCOMMAND=$0-$1;
ORIGINAL_COMMAND=/bin/echo
command -v $SUBCOMMAND >/dev/null 2>&1 || {
exec $ORIGINAL_COMMAND $*;
exit 1;
}

Tradotto da: http://www.quora.com/Studies-and-Studying/What-is-a-good-strategy-for-absorbing-and-retaining-information-from-a-giant-textbook-you-are-self-studying-for-a-test/answer/Robert-Frost-1

Autore originale: Robert Frost

Studio e Studiare: Qual è una buona strategia per assorbire e ritenere informazione da un libro gigante che stai studiando per un esame?

  1. La prima cosa è accettare i limiti del funzionamento della mente. Non provare ad assorbire troppa informazione in una volta sola. Segui la regola del tre. Impara tre idee e fermati. Ritorna più tardi per impararne altre tre. Non sovraccaricare. Diverse ricerche dimostrano che non funziona per la ritenzione (la ritenzione è la misura del ricordo a 72 ore o più dall'esposizione all'informazione).
// ==UserScript==
// @name Django Docs Banner removal
// @namespace http://use.i.E.your.homepage/
// @version 0.0.2
// @description Removes the annoying "dev-warning" at the top of the website.
// @include https://docs.djangoproject.com/*/dev/
// @copyright 2013+, Jeff Triplett
// ==/UserScript==
@fcurella
fcurella / vpnc-script
Last active March 15, 2016 18:49
vpnc-script for el-capitain
#!/bin/sh
#
# Originally part of vpnc source code:
# © 2005-2012 Maurice Massar, Jörg Mayer, Antonio Borneo et al.
# © 2009-2012 David Woodhouse <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.