Skip to content

Instantly share code, notes, and snippets.

View bianchimro's full-sized avatar
🤡

Mauro Bianchi bianchimro

🤡
View GitHub Profile
@bianchimro
bianchimro / POSTGRES DB SIZE
Created July 16, 2010 11:37
Query PostgreSQL db for table sizes
SELECT pg_database.datname,
pg_size_pretty(pg_database_size(pg_database.datname)) AS size
FROM pg_database;
@bianchimro
bianchimro / inplace text replacement
Created October 6, 2010 10:24
inplace text replacement using per
find . -name "*" | xargs perl -pi -e 's/loadDataFromCanonicalDB/loadFromDB/g'
@bianchimro
bianchimro / admin_all_models.py
Created October 19, 2011 12:20
Register all models for admin in a Django application
from django.contrib import admin
import app.models
for x in dir(app.models):
m = getattr(app.models,x)
try:
admin.site.register(m)
except:
pass
"""
This fabric file makes setting up and deploying a django application much
easier, but it does make a few assumptions. Namely that you're using Git,
Apache and mod_wsgi and your using Debian or Ubuntu. Also you should have
Django installed on your local machine and SSH installed on both the local
machine and any servers you want to deploy to.
_note that I've used the name project_name throughout this example. Replace
this with whatever your project is called._
<!DOCTYPE html>
<meta charset="utf-8">
<style>
#example{
background:#ccc;
}
</style>
<body>
<!DOCTYPE html>
<meta charset="utf-8">
<style>
html, body{
height:100%;
margin:0;
padding:0;
}
<!DOCTYPE html>
<meta charset="utf-8">
<style>
html, body{
height:100%;
margin:0;
padding:0;
}
# Installing OpenCV python libs on mac to work with virtualenv
# OpenCV 2.4.3
# Python 2.7.3 installed with brew
# assuming you have virtualenv, pip, and python installed via brew
# assuming $WORKON_HOME is set to something like ~/.virtualenvs
# using homebrew - make sure we're current
brew update
@bianchimro
bianchimro / gist:11396501
Created April 29, 2014 10:38
Restangular tastypie configuration with cross origin
(function () {
'use strict';
var angularApp = angular.module("angularApp", ['restangular']);
angularApp.config(['$httpProvider', function($httpProvider){
$httpProvider.defaults.useXDomain = true;
$httpProvider.defaults.withCredentials = true;
delete $httpProvider.defaults.headers.common['X-Requested-With'];