Skip to content

Instantly share code, notes, and snippets.

@psqnt
psqnt / hd_wallet.py
Created November 15, 2020 23:59
Bitcoin HD Wallet BIP32 BIP39 Key Generation
from mnemonic import Mnemonic
from pycoin.symbols.btc import network
from pycoin.symbols.xtn import network as testnetwork
# Parameters
language = 'english'
length = 24 # Can also be 24
passphrase = "" # Can leave blank
mainnet = True
@psqnt
psqnt / convert.py
Created April 9, 2018 21:39
Convert a markdown file to html. Output is html file in same directory as given markdown file.
#!/usr/bin/env python3
"""Convert a markdown file to html."""
import os
import sys
import mistune # pip install mistune
# Usage: python convert.py [filename]
if __name__ == "__main__":
markdown_text = ""
if os.path.isfile(sys.argv[1]):
@psqnt
psqnt / request.py
Created February 3, 2018 00:03
Make a request to coinmarketcap api example using python and requests library
"""
Get Bitcoin price from CoinMarketCap API using python requests
"""
import requests
if __name__ == "__main__":
url = "https://api.coinmarketcap.com/v1/ticker/bitcoin/"
response = requests.get(url)
print " ID: {}".format(response.json()[0]["id"])
print "Price: {}".format(response.json()[0]["price_usd"])
@psqnt
psqnt / move.py
Last active February 2, 2018 23:51
Code example of how to move a character around using arrow keys within a curses terminal window. Use case: making terminal based 2d games.
"""
Move a character around a curses window
"""
import curses
from curses import KEY_RIGHT, KEY_LEFT, KEY_UP, KEY_DOWN
if __name__ == "__main__":
# Draw the curses window
curses.initscr()