Skip to content

Instantly share code, notes, and snippets.

@kdmukai
kdmukai / raspbian-python3.7.md
Last active August 22, 2024 14:01 — forked from dschep/raspbian-python3.6.rst
Installing Python 3.7 on Raspbian

Installing Python 3.7 on Raspbian

As of January 2018, Raspbian does not yet include the latest Python release, Python 3.6. This means we will have to build it ourselves, and here is how to do it. There is also an ansible role attached that automates it all for you.

  1. Install the required build-tools (some might already be installed on your system).
$ sudo apt-get update
$ sudo apt-get install build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev

Keybase proof

I hereby claim:

  • I am kdmukai on github.
  • I am keithmukai (https://keybase.io/keithmukai) on keybase.
  • I have a public key ASDUOmPehgibQKBnA-5CT2A-e-p8sIXkzj4tA38l71FVSwo

To claim this, I am signing this object:

@kdmukai
kdmukai / bitcoin_diff.py
Last active April 30, 2020 00:25
Bitcoin price diff calculator based on YYYY-MM-dd purchased
"""
Usage: python3 bitcoin_diff.py 2017-06-28
outputs:
Price on 2017-06-28: $2584.56
Price on 2020-04-29: $8783.59
Difference: 239.85%
"""
import datetime
import json
@kdmukai
kdmukai / install_bitcoind_raspi.md
Last active November 14, 2021 20:31
Install Bitcoin Core v22+ bitcoind binary on a Raspberry Pi

Install Bitcoin Core v22+ bitcoind on a Raspberry Pi

Procedure has changed, starting with v22!

Download binary and verification hashes

wget https://bitcoin.org/bin/bitcoin-core-22.0/bitcoin-22.0-arm-linux-gnueabihf.tar.gz
wget https://bitcoin.org/bin/bitcoin-core-22.0/SHA256SUMS.asc
wget https://bitcoin.org/bin/bitcoin-core-22.0/SHA256SUMS
@kdmukai
kdmukai / install_bitcoind_macos.md
Last active November 17, 2021 19:54
Install Bitcoin Core v22+ bitcoind on macOS

Install Bitcoin Core v22+ bitcoind on macOS

If you don't have wget installed:

brew install wget

Download binary and verification hashes

wget https://bitcoin.org/bin/bitcoin-core-22.0/bitcoin-22.0-osx64.tar.gz
@kdmukai
kdmukai / README.md
Last active June 17, 2022 13:24
SeedSigner vs a compromised coordinator sending a change-stealing single sig psbt

Single sig change-stealing attack from a compromised coordinator

See the full video walkthrough on twitter.

The CORRECT psbt

Spending uxto from regtest: 3641312fc3e418804f1a0a88098b6bf8e3bdca13afd2f0633ca3166fc8533f17

Signing mnemonic: "smoke chimney announce candy glory tongue refuse fatigue cricket once consider beef treat urge wing deny gym robot tobacco adult problem priority wheat diagram"

@kdmukai
kdmukai / test.py
Created July 4, 2022 14:56
MicroPython + embit timing test
help('modules')
# import machine
# print(f"Initial freq: {int(machine.freq() / 1e6)}MHz")
# machine.freq(int(240*1e6))
# print(f"Current freq: {int(machine.freq() / 1e6)}MHz")
# pin = machine.Pin(13, machine.Pin.OUT)
# pin.value(1)
import time
@kdmukai
kdmukai / test_compact_seedqr.py
Created August 14, 2022 01:56
Generating byte data for Compact SeedQR test vectors
import os
from embit import bip39
from embit.wordlists.bip39 import WORDLIST
from seedsigner.models.decode_qr import DecodeQR
from seedsigner.models.encode_qr import EncodeQR
from seedsigner.models.qr_type import QRType
from seedsigner.helpers.qr import QR
seed_bytes = b''
@kdmukai
kdmukai / op_return.py
Last active June 13, 2023 00:24
Adding an OP_RETURN output to a psbt using `embit`
"""
dependency: pip install embit
"""
from embit import compact
from embit.psbt import PSBT, OutputScope
from embit.script import Script
class OPCODES:
OP_RETURN = 106
OP_PUSHDATA1 = 76
@kdmukai
kdmukai / generate_mnemonic_and_addr.py
Last active November 4, 2022 17:45
Generate a 12-word mnemonic and first receive addr
from embit import bip32, bip39, script
from embit.slip39 import secure_randint
from embit.wordlists.bip39 import WORDLIST
for i in range(0, 100):
mnemonic = []
for j in range(0, 11):
# note: `secure_randint` is inclusive of the end of the range
mnemonic.append(WORDLIST[secure_randint(0, 2047)])
mnemonic.append(WORDLIST[0])