Skip to content

Instantly share code, notes, and snippets.

Avatar
💭

mbarkhau

💭
  • Cyberspace
View GitHub Profile
@mbarkhau
mbarkhau / gen_wallet_seed.py
Last active May 5, 2022
Snippet to create electrum seed from rolls of a six sided dice and a secret passphrase.
View gen_wallet_seed.py
#!/usr/bin/env python
"""Electrum Wallet Seed Generator (use at own risk).
Usage:
-h --help
-s --seed-bits=<bits> Size of the wallet seed in bits
[default: 256]
-i --iterations=<iterations> Number of pbkdf2 iterations
[default: 500000]
@mbarkhau
mbarkhau / wordlist_256.txt
Last active May 5, 2022
wordlist_256.txt
View wordlist_256.txt
# The goal behind this wordlist is to make
# a 1:1 encoding between words/symbols and bytes. It should
# be possible to memorize data encoded with these words.
#
# - Each word has a unique two letter prefix.
# - Each word has high number of syllables, to enable
# reliable verbal communication (like nato code words).
# - Each word has a levenshtein distance >= 3 to any other word
# in the wordlist.
View do_nothing_script.py
#!/usr/bin/env python3
# Based on this https://news.ycombinator.com/item?id=20495739
# I created this boilerplate which I think is a bit nicer to use.
import sys
class AttrDict(dict):
@mbarkhau
mbarkhau / getarg.py
Last active Apr 1, 2022
mimimal arg parsing
View getarg.py
import sys
def getarg(argname, args=sys.argv[1:]):
long_arg = '--' + argname
short_arg = '-' + argname[:1]
for idx, arg in enumerate(args):
if arg.startswith(long_arg):
if arg == long_arg:
# check for parameter
@mbarkhau
mbarkhau / placepaintbot4.js
Last active Nov 12, 2021
placepaintbot4.js
View placepaintbot4.js
// ==UserScript==
// @name PlacePaintBot
// @namespace http://tampermonkey.net/
// @version 0.4
// @description Domination of Place!
// @author mbarkhau
// @match https://www.reddit.com/place?webview=true
// @grant none
// ==/UserScript==
@mbarkhau
mbarkhau / picodash_export_url_download.py
Last active Sep 7, 2021 — forked from krisrak/picodash_export_url_download.py
Python script to download urls in a csv file
View picodash_export_url_download.py
#!/usr/bin/python
import os
import sys
import csv
import urllib
try:
filename = sys.argv[1]
url_name = sys.argv[2]
View mad_bitcoin_energy_savings.md

MAD Bitcoin Energy Savings

Imagine you're a bitcoin miner. You have a huge power bill, you have your capital that is depreciating like a glass of milk in the sunshine, but as long as the price per bitcoin is high and the local government isn't driving you out of the country, things are pretty good. I mean, figuratively speaking, you're printing money.

But think about this for a minute. It's not as if the bitcoin network would work any worse if you and 99% of the mining capacity would turn

View gnote_export.sh
#!/bin/bash
# sudo apt-get install xml-twig-tools
_source="$HOME/.local/share/gnote"
_dest="$HOME/gnote_export/"
rm -rf "$_dest"
mkdir -p "$_dest"
#_file="simple_desktop_creator.desktop"
#_focus=$_dest$_file
@mbarkhau
mbarkhau / sublime_devbuild.py
Last active Jun 22, 2021
sublime_devbuild.py
View sublime_devbuild.py
#!/usr/bin/env python3
"""A sublime-text build script, to do the right thing?.
This script takes the currently open file as a
reference point and uses it to determine which commands
to run. This means that you don't have to select a build
commands when switching between projects, the fact that
you have a different file open is enough to indicate
which build you want to run.
@mbarkhau
mbarkhau / .bashrc
Last active Apr 15, 2021
sublime helpers
View .bashrc
alias tiga='tig --all'
alias gs='git status --untracked-files=no'
alias gss='git status --short'
alias gsss='git status'
alias gls="git for-each-ref --count=15 --sort=-committerdate --format='%(objectname:short) %(committerdate:iso) %(authorname) %(refname:short)' refs/heads/"
alias gd="git diff --color-words"
alias gds="git diff --stat"
alias gap="git add --patch"
alias gaf="git add" # add file