Skip to content

Instantly share code, notes, and snippets.

Mikko Ohtamaa miohtama

Block or report user

Report or block miohtama

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@miohtama
miohtama / main.js
Last active Sep 25, 2019
Ledger topping up the gas for stuck Ethereum nonce/transaction
View main.js
//
// Based on https://gist.github.com/miguelmota/62559d02a1b99cb291635de4b224349c
//
const Transport = require('@ledgerhq/hw-transport-node-hid').default
// https://github.com/LedgerHQ/ledgerjs/
// https://www.npmjs.com/package/@ledgerhq/hw-app-eth
const AppEth = require('@ledgerhq/hw-app-eth').default
@miohtama
miohtama / civic-sip-client.py
Created Aug 28, 2018
Python client for Civic sign in and proof of identity
View civic-sip-client.py
import base64
import datetime
import hashlib
import hmac
import json
import uuid
import logging
import time
from requests import Session
import binascii
View gist:93b87a963dcc7c944b5d5e6142815347
============================= test session starts ==============================
platform darwin -- Python 3.6.3, pytest-3.2.5, py-1.5.2, pluggy-0.4.0
rootdir: /Users/mikkoohtamaa/code/tm/trading.smartcontracts, inifile: setup.cfg
plugins: populus-1.11.2
collected 3 items
trading/smartcontracts/tests/test_order.py Failed signature is, number: 1 data: {'hash': '0x672e1c3f1f05f9958404b1dab1bf456af28316948a1fb08d11160b3cc2aa2eaa', 'hash_bytes': b'g.\x1c?\x1f\x05\xf9\x95\x84\x04\xb1\xda\xb1\xbfEj\xf2\x83\x16\x94\x8a\x1f\xb0\x8d\x11\x16\x0b<\xc2\xaa.\xaa', 'v': 27, 'r': HexBytes('0xa8dfdf50446708ccbca3ca72bf9d91de80510b80425e9f6b0b8a63abafad7ebb'), 's': HexBytes('0x89d58c596550d1855f361c4c294d869d3849d6e55fb1a29909d0debb599b64')}
Failed signature is, number: 14 data: {'hash': '0x7cd030aaa0481365a76e22a9a08b284f837f892adbeac43ddb4cda81550204a5', 'hash_bytes': b'|\xd00\xaa\xa0H\x13e\xa7n"\xa9\xa0\x8b(O\x83\x7f\x89*\xdb\xea\xc4=\xdbL\xda\x81U\x02\x04\xa5', 'v': 27, 'r': HexBytes('0x9b053ffcd13e05dd03b81f1094d43f8621
@miohtama
miohtama / parity.yaml
Created Aug 25, 2017
Parity Ansibe playbook
View parity.yaml
- name: Install dependencies
apt: name={{item}} update_cache=yes
with_items:
- software-properties-common
become: yes
- name: Install Ethereum repositories
apt_repository: repo='ppa:ethereum/ethereum'
become: yes
View gist:37d8741062dbc75ff42b812e3a8a3a18
### Keybase proof
I hereby claim:
* I am miohtama on github.
* I am miohtama (https://keybase.io/miohtama) on keybase.
* I have a public key ASDwaisR2H0nqRfKMZtmDm_TeYoL490VnTKFIISsi_jCAwo
To claim this, I am signing this object:
View Raven in JavaScript
try {
$(document).ready(function() {
// ...
});
window.javascriptReady = true;
} catch(e) {
if (window.Raven) {
View gist:1714c950ee69cb49aa99f977c8849233
def translator(term):
return get_localizer(get_current_request()).translate(term)
deform_template_dir = resource_filename('deform', 'templates/')
deformdemo_template_dir = resource_filename('deformdemo', 'custom_widgets/')
zpt_renderer = deform.ZPTRendererFactory(
(deformdemo_template_dir, deform_template_dir,), translator=translator)
@miohtama
miohtama / gist:6f87ca494df96a8d8894812106cadbbc
Created Feb 6, 2017
SQLAlchemy + PostgreSQL + deadlock on TransactionRollbackError retryable
View gist:6f87ca494df96a8d8894812106cadbbc
Celery task raised an exception (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely) (psycopg2.extensions.TransactionRollbackError) deadlock detected
DETAIL: Process 18932 waits for ShareLock on transaction 166111; blocked by process 18933.
Process 18933 waits for ShareLock on transaction 166110; blocked by process 18932.
HINT: See server log for query details.
CONTEXT: while updating tuple (15,4) in relation "asset_content"
[SQL: 'UPDATE asset_content SET updated_at=%(updated_at)s, published_at=%(published_at)s, other_data=%(other_data)s WHERE asset_content.id = %(asset_content_id)s'] [parameters: {'published_at': datetime.datetime(2017, 2, 6, 10, 35, 42, 637436, tzinfo=datetime.timezone.utc), 'updated_at': datetime.datetime(2017, 2, 6, 10, 35, 42, 637430, tzinfo=datetime.timezone.utc), 'asset_content_id': UUID('3377ace2-0010-482d-a337-1703de763760'), 'other_data': '{"tags": [{"term": "Bitcoin", "label": null, "scheme": null},
@miohtama
miohtama / purge_logs.sh
Created Jan 27, 2017
Remove old logs from Quassel SQLite database
View purge_logs.sh
#!/bin/sh
BAK_PATH="${HOME}/.config/quassel-irc.org/quassel-storage.sqlite.bak"
CURRENT_PATH="${HOME}/.config/quassel-irc.org/quassel-storage.sqlite"
# first day of data that will be maintained
# -15 day means that *every* chatline stored before 16 days ago and so on are going to be eliminated.
# only the last 15 days are keeped.
DATE_TO_PRUNE='-15 day'
die() {
@miohtama
miohtama / install-postgresql-client-9.5-on-ubuntu-14.04.bash
Created Jan 25, 2017
Upgrade PostgreSQL client to 9.5 on Ubuntu 14.04
View install-postgresql-client-9.5-on-ubuntu-14.04.bash
# Ubuntu 14.04 repo
# For more repos see https://www.ubuntuupdates.org/ppa/postgresql?dist=trusty-pgdg
# Install key
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
# 14.04 repo
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" >> /etc/apt/sources.list.d/postgresql.list'
apt update
You can’t perform that action at this time.