Skip to content

Instantly share code, notes, and snippets.

View douglasmiranda's full-sized avatar
👽

Douglas Miranda douglasmiranda

👽
  • Earth, Brazil
View GitHub Profile
@douglasmiranda
douglasmiranda / gist:5486668
Created April 30, 2013 05:02
Virtualenv Error: After upgrading ubuntu (in my case 12.* to 13.*)
The solution is:
Update your virtualenv and re-create your virtualenvs, by passing the path of an existing virtualenv dir.
http://www.guyrutenberg.com/2012/05/30/fixing-virtualenv-after-upgrading-your-distributionpython/
@douglasmiranda
douglasmiranda / gist:5408278
Created April 17, 2013 22:26
Leading zeros in django templates
{{ variable|stringformat:"02d" }}
import random
import unittest
import HTMLTestRunner
class TestSequenceFunctions(unittest.TestCase):
def setUp(self):
self.seq = range(10)
# This is a really old post, in the comments (and stackoverflow too) you'll find better solutions.
def find(key, dictionary):
for k, v in dictionary.iteritems():
if k == key:
yield v
elif isinstance(v, dict):
for result in find(key, v):
yield result
elif isinstance(v, list):
@douglasmiranda
douglasmiranda / gist:4488794
Last active December 10, 2015 20:28
Gnome Extensions I use. (just a reminder)
https://extensions.gnome.org/extension/37/quicklaunch/
https://extensions.gnome.org/extension/354/maximus/
https://extensions.gnome.org/extension/307/dash-to-dock/
https://extensions.gnome.org/extension/2/move-clock/
@douglasmiranda
douglasmiranda / gist:4338849
Created December 19, 2012 18:01
Installing the latest stable version of VLC on ubuntu
sudo add-apt-repository ppa:videolan/stable-daily
sudo apt-get update
sudo apt-get install vlc
@douglasmiranda
douglasmiranda / gist:4264363
Created December 12, 2012 02:32
hello new gist :)
hello new gist :)
@douglasmiranda
douglasmiranda / popup_example.py
Created November 29, 2012 04:02
working with pop-up (adapted)
from splinter.browser import Browser
browser = Browser()
browser.visit('http://media.douglasmiranda.com/labs/exemplos/splinter_pop-up/')
parent_window = browser.current_window # Save the parent window
browser.find_by_id('open-popup').first.click()
for window in browser.windows:
# Switch to a different window (the pop-up)
sudo apt-get build-dep python-numpy python-scipy python-libsvm python-matplotlib
pip install numpy
pip install scipy
pip install python-libsvm
pip install matplotlib
from fabric.api import *
# current_git_branch = local('git symbolic-ref HEAD', capture=True).split('/')[-1]
# === Environments ===
def development():
env.env = 'development'
env.settings = '{{ project_name }}.settings.development'