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
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch MailerLite test",
@miohtama
miohtama / main.js
Last active September 25, 2019 13:53
Ledger topping up the gas for stuck Ethereum nonce/transaction
//
// 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 August 28, 2018 14:26
Python client for Civic sign in and proof of identity
import base64
import datetime
import hashlib
import hmac
import json
import uuid
import logging
import time
from requests import Session
import binascii
@miohtama
miohtama / gist:93b87a963dcc7c944b5d5e6142815347
Created November 23, 2017 18:00
report of web3 sign failures
============================= 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 August 25, 2017 14:20
Parity Ansibe playbook
- 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
### 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:
try {
$(document).ready(function() {
// ...
});
window.javascriptReady = true;
} catch(e) {
if (window.Raven) {
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 February 6, 2017 10:38
SQLAlchemy + PostgreSQL + deadlock on TransactionRollbackError retryable
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 January 27, 2017 10:04
Remove old logs from Quassel SQLite database
#!/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() {