Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am fcurella on github.
  • I am fcurella (https://keybase.io/fcurella) on keybase.
  • I have a public key ASDgkzAb5h2laxl5MptKT1k5o8b1uUhoBwYyEH6GJEaxHQo

To claim this, I am signing this object:

@fcurella
fcurella / Readme.md
Last active December 14, 2017 02:01
pip downstream private packages

Using Private Packages in Python

With companies moving to microservices, it's becoming common to have a system scattered across multiple repositories. It's frequent to abstract common patterns and code into private repositories that are then included in each service.

But using packages from private repos with Python can be tricky. This guide will guide you through the necessary steps to correctly use private package with pip or pipenv. We have also built a little app that will generate the right incantations for you to copy and paste.

Figuring out the URL

First you need to choose which format you want to use: tarball (ie: .zip) or vcs (most likely git). I prefer just downloading the tarball because it doesn't require any additional vcs software. But if use pipenv, you'll have to use vcs (see below).

@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.
// ==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==

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).
@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;
}
@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 / 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 / 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"