Skip to content

Instantly share code, notes, and snippets.

View mbarkhau's full-sized avatar
💭

mbarkhau

💭
  • Cyberspace
View GitHub Profile
@mbarkhau
mbarkhau / do_nothing_script.py
Created July 22, 2019 19:54
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 / gen_wallet_seed.py
Last active May 5, 2022 23:35
Snippet to create electrum seed from rolls of a six sided dice and a secret passphrase.
#!/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 23:35
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.
@mbarkhau
mbarkhau / getarg.py
Last active April 1, 2022 14:24
mimimal arg parsing
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 November 12, 2021 02:54
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 September 7, 2021 17:47 — forked from krisrak/picodash_export_url_download.py
Python script to download urls in a csv file
#!/usr/bin/python
import os
import sys
import csv
import urllib
try:
filename = sys.argv[1]
url_name = sys.argv[2]
@mbarkhau
mbarkhau / mad_bitcoin_energy_savings.md
Created September 5, 2021 19:50
MAD Bitcoin Energy Savings

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

@mbarkhau
mbarkhau / gnote_export.sh
Created July 15, 2021 11:39
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 June 22, 2021 22:34
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 April 15, 2021 00:07
sublime helpers
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