Skip to content

Instantly share code, notes, and snippets.

View nabucosound's full-sized avatar

Hector N. Garcia nabucosound

View GitHub Profile
@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.

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 / 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 / nabucolaptop_conf.rst
Last active February 4, 2017 22:49
This is a personal HOW-TO I have been using lately to install and setup my Macbook Pro laptop with OS X, to be used as a developer machine for Python, Django, MySQL and other tools I use daily for my projects.

Mac OS X for a Python developer

This is a personal HOW-TO I have been using lately to install and setup my Macbook Pro laptop with OS X, to be used as a developer machine for Python, Django, MySQL and other tools I use daily for my projects. To get most of the software Homebrew is been used.

Terminal

@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 + (
    # ...
@nabucosound
nabucosound / vim_cheatsheet.rst
Last active March 4, 2021 08:42
Vim basic commands cheatsheet. Nothing advanced here, just basic stuff to help my lazy mind remember.

Nabuco's Vim cheatsheet

Normal mode (a.k.a command mode)

i -> insert left of cursor
@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 / 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
@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']