Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
https://tradingstrategy.ai

Mikko Ohtamaa miohtama

🏠
https://tradingstrategy.ai
View GitHub Profile
@miohtama
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
"SublimeLinter":
{
"@python": 2.7
},
// SublimePythonIDE
@miohtama
miohtama / gist:10189584
Created Apr 8, 2014
Varnish + UWSGI Python without additional stack
View gist:10189584
[uwsgi]
chdir = /srv/django/x
pythonpath = /srv/django/x/venv/bin/python
env = DJANGO_SETTINGS_MODULE=x.settings
module = django.core.handlers.wsgi:WSGIHandler()
processes = 4
threads = 2
virtualenv = /srv/django/x/venv
http = 0.0.0.0:8877
static-map = /static=/srv/django/x/y/static
@miohtama
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
miohtama / gist:0202e0454786baf72012
Created Jun 19, 2014
Phishing site reporting links
View gist:0202e0454786baf72012
========================
Phishing site reporting
========================
Google
* http://www.google.com/safebrowsing/report_phish/
Google ads
@miohtama
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
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.
http://stackoverflow.com/questions/10938891/disable-autofill-in-chrome-without-disabling-autocomplete
{% 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 helium-1.8.1.zip (13.2MB): 13.2MB downloaded
Running setup.py (path:/Users/mikko/code/trees/venv/build/helium/setup.py) 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 setup.py (path:/Users/mikko/code/trees/venv/build/selenium/setup.py) egg_info for package selenium
@miohtama
miohtama / jsonb.py
Created Apr 27, 2015
JSOB field decoratore: Create SQLAlchemy model properties which are stored inside JSONB data
View jsonb.py
"""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 setup.py 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
miohtama / gist:ce6d0a417b4fff1558ad
Created May 29, 2015
Safely embed JSON data in Jinja / HTML for reading in JavaScript
View gist:ce6d0a417b4fff1558ad
<script>
window.deliveryLocations = JSON.parse("{{delivery_locations|escape_js}}");
</script>