Skip to content

Instantly share code, notes, and snippets.

View fernandogrd's full-sized avatar

Fernando Grunevald fernandogrd

View GitHub Profile
#!/usr/bin/env python
#
# Converts any integer into a base [BASE] number. I have chosen 62
# as it is meant to represent the integers using all the alphanumeric
# characters, [no special characters] = {0..9}, {A..Z}, {a..z}
#
# I plan on using this to shorten the representation of possibly long ids,
# a la url shortenters
#
@zyegfryed
zyegfryed / pdf.py
Created April 13, 2011 21:00
Outputting PDFs with Django and FDFgen
# -*- coding: utf-8 -*-
import codecs
import subprocess
from fdfgen import forge_fdf
from django.template import Template, loader
from django.template.loader import find_template, LoaderOrigin
class PdfTemplateError(Exception):
@jacobian
jacobian / pip-cache-install.py
Created May 1, 2012 05:22
Install a package from your local pip download cache without touching the 'net.
#!/usr/bin/env python
"""
Install a package from your local pip download cache without having to touch
the 'net at all.
You'll need to be using a pip download cache; that is, you'll need the
following in your ~/.pip/pip.cfg:
[install]
@fernandogrd
fernandogrd / svg-path-to-json.py
Created August 15, 2012 14:54 — forked from robflaherty/svg-path-to-json.py
Extract SVG paths and convert to JSON for use with Raphael.js
import sys
import json
from xml.dom import minidom
config = {
'js_var' : 'map',
}
class UbuntuServer(Role):
def provision(self):
self.log('Starting provisioning for Cumbuca Chic...')
self._check_user()
self._setup_postgres()
self._install_deb_packages()
self._install_python_packages()
self.log('Finished provisioning for Cumbuca Chic')
def _check_user(self):
@blueyed
blueyed / test_django_data_migration.py
Last active December 9, 2020 16:20
Test Django data migrations
"""
Test (data) migrations in Django.
This uses py.test/pytest-django (the `transactional_db` fixture comes from there),
but could be easily adopted for Django's testrunner:
from django.test.testcases import TransactionTestCase
class FooTestcase(TransactionTestCase):
def test_with_django(self):