Skip to content

Instantly share code, notes, and snippets.

View nabucosound's full-sized avatar

Hector N. Garcia nabucosound

View GitHub Profile
@nabucosound
nabucosound / django_mexico_clabe_form_field.py
Created April 12, 2016 15:55
Django form field for the Mexican CLABE (Clave Bancaria Estandarizada)
import re
from django import forms
from django.core.exceptions import ValidationError
class CLABEField(forms.Field):
"""
Django form field for the mexican CLABE (Clave Bancaria Estandarizada,
Spanish for "standardized banking cipher"), a banking standard for the
@nabucosound
nabucosound / sentry_raven_django.rst
Last active February 5, 2021 08:45
Sentry and raven in Django

Create new organization, team and project in https://getsentry.com/

Install raven, do not forget to add to requirements.txt:

pip install raven

Add raven to the list of installed apps:

INSTALLED_APPS = INSTALLED_APPS + (
    # ...

Upgrade PostgreSQL

After a "brew upgrade", I had to solve the incompatible data format between versions.

Command history

cd /usr/local/var/postgres/ cat PG_VERSION

@nabucosound
nabucosound / gist:1569c076b5ef152dc1dd
Created May 2, 2014 21:11
Parse google chrome bookmarks json file
import json
with open ("/Users/nabuco/Library/Application Support/Google/Chrome/Default/Bookmarks") as f:
caca = json.load(f)
bookmarks = caca['roots']['other']['children'][0]['children'][1]['children']
for obj in dookmarks:
print obj['url']
@nabucosound
nabucosound / heroku_env_copy.sh
Created December 30, 2013 12:40
Script to copy environment variables from an existing heroku app to another one
#!/bin/bash
# Source: http://blog.nonuby.com/blog/2012/07/05/copying-env-vars-from-one-heroku-app-to-another/
set -e
sourceApp="$1"
targetApp="$2"
while read key value; do

PostgreSQL Cheatsheet

Made by Nabuco (http://nomadblue.com/).

Note: Substitute [params] with the proper values.

Start server installed from Homebrew:

Heroku Cheatsheet

Made by Nabuco (http://nomadblue.com/).

Note: Substitute [params] with the proper values.

Start server installed from Homebrew:

@nabucosound
nabucosound / heroku_restore.sh
Last active December 25, 2015 05:39
Heroku pgbackups restored to local databases
# -*- mode: shell-script -*-
#
# Made by Nabuco (http://www.nomadblue.com/).
# This script destroys and re-creates the postgresql project database
# with a new backup generated and downloaded from Heroku project app.
#
# WARNING: You need to be collaborator of the Heroku app. Also please
# note that this script downloads a backup file which is not removed
# afterwards, so be careful not to commit it into your repo by mistake.
@nabucosound
nabucosound / heroku_django_deploy.rst
Last active July 12, 2022 10:54
Heroku mini how-to for deployment of Django projects

Deploy a Django app on Heroku

In this example we will deploy a test environment of the app "myproject".

Prerequisites

Heroku toolbelt for deployment:

@nabucosound
nabucosound / mysql_cheatsheet.rst
Created August 15, 2013 00:42
MySQL dirty notes

MySQL

Install MySQL in Mac OS X with Brew

# Install brew install mysql