Skip to content

Instantly share code, notes, and snippets.

View miohtama's full-sized avatar
🏠
https://tradingstrategy.ai

Mikko Ohtamaa miohtama

🏠
https://tradingstrategy.ai
View GitHub Profile
@miohtama
miohtama / gist:9388845
Created March 6, 2014 12:50
Setting Python 2.7 target to SublimeLinter in Sublime Text 3
// Put this to your PROJECT file, not global settings or SublimeLinter settings
// SublimeLinter-flake8
"SublimeLinter":
{
"@python": 2.7
},
// SublimePythonIDE
@miohtama
miohtama / gist:10189584
Created April 8, 2014 20:48
Varnish + UWSGI Python without additional stack
[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 April 11, 2014 14:41
Extract receiving addresses from a Bitcoin transaction.
"""
Utils for extracting information about bitcoin transactions.
"""
import json
from django_bitcoin.utils import bitcoind
@miohtama
miohtama / gist:0202e0454786baf72012
Created June 19, 2014 10:13
Phishing site reporting links
========================
Phishing site reporting
========================
Google
* http://www.google.com/safebrowsing/report_phish/
Google ads
@miohtama
miohtama / gist:4dd11778960e3e8118c7
Last active August 29, 2015 14:05
Creating proper virtualenvs with Ansible
# 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 August 26, 2014 19:12
Disable password autocomplete for Chome and Safari
{% 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 %}
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 April 27, 2015 18:06
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
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 19:24
Safely embed JSON data in Jinja / HTML for reading in JavaScript
<script>
window.deliveryLocations = JSON.parse("{{delivery_locations|escape_js}}");
</script>