Skip to content

Instantly share code, notes, and snippets.


Mikko Ohtamaa miohtama

View GitHub Profile
miohtama / gist:9388845
Created Mar 6, 2014
Setting Python 2.7 target to SublimeLinter in Sublime Text 3
View gist:9388845
// Put this to your PROJECT file, not global settings or SublimeLinter settings
// SublimeLinter-flake8
"@python": 2.7
// SublimePythonIDE
miohtama / gist:10189584
Created Apr 8, 2014
Varnish + UWSGI Python without additional stack
View gist:10189584
chdir = /srv/django/x
pythonpath = /srv/django/x/venv/bin/python
module = django.core.handlers.wsgi:WSGIHandler()
processes = 4
threads = 2
virtualenv = /srv/django/x/venv
http =
static-map = /static=/srv/django/x/y/static
miohtama / gist:10474410
Created Apr 11, 2014
Extract receiving addresses from a Bitcoin transaction.
View gist:10474410
Utils for extracting information about bitcoin transactions.
import json
from django_bitcoin.utils import bitcoind
miohtama / gist:0202e0454786baf72012
Created Jun 19, 2014
Phishing site reporting links
View gist:0202e0454786baf72012
Phishing site reporting
Google ads
miohtama / gist:4dd11778960e3e8118c7
Last active Aug 29, 2015
Creating proper virtualenvs with Ansible
View gist:4dd11778960e3e8118c7
# Explicitly give Distribute version 0.7.3 to bootstrap the automatic
# download of the latest setuptools, as one provided with the operating
# system is too old to run requirements.txt
- name: Create virtualenv
sudo: yes
pip: name=distribute version=0.7.3 virtualenv=/srv/django/yourproject/venv
miohtama / gist:d3fae1eddad9d5ea65e1
Created Aug 26, 2014
Disable password autocomplete for Chome and Safari
View gist:d3fae1eddad9d5ea65e1
{% comment %}
Fix broken autocomplete on Chrome.
Chrome tries to guess that username is before the password field on the form,
wrongly autocompleting the username to the amount field.
{% endcomment %}
<input type="foobar" name="autocomplete_trap" id="autocomplete_trap" autocomplete="off" style="display: none;">
{% if form.password %}
View gist:73c82fe7dd503c64a968
pip install helium
Downloading/unpacking helium
Downloading (13.2MB): 13.2MB downloaded
Running (path:/Users/mikko/code/trees/venv/build/helium/ egg_info for package helium
Downloading/unpacking selenium==2.43.0 (from helium)
Downloading selenium-2.43.0.tar.gz (2.6MB): 2.6MB downloaded
Running (path:/Users/mikko/code/trees/venv/build/selenium/ egg_info for package selenium
miohtama /
Created Apr 27, 2015
JSOB field decoratore: Create SQLAlchemy model properties which are stored inside JSONB data
"""JSONB data utilities."""
import datetime
from decimal import Decimal
import copy
import json
import iso8601
from sqlalchemy import inspect
from sqlalchemy.orm.attributes import flag_modified
View Release process
Give a new release version number by fair dice roll
Update with the new version number
Update CHANGES.txt with the version number and the release date
Commit changes to trunk
3. Release
Tag the release in the version control system
Checkout the tag into a clean folder
miohtama / gist:ce6d0a417b4fff1558ad
Created May 29, 2015
Safely embed JSON data in Jinja / HTML for reading in JavaScript
View gist:ce6d0a417b4fff1558ad
window.deliveryLocations = JSON.parse("{{delivery_locations|escape_js}}");