Skip to content

Instantly share code, notes, and snippets.

@miketery
miketery / w_s_bitcoin_ctf.py
Last active April 28, 2023 17:52
100K sats Capture the Flag based on 256 bits
# https://twitter.com/w_s_bitcoin/status/1651779628619509765
# Target pubkey: bc1q0navdwrt7jry46a0zzpekaf5ey8u9hzlfdtgtk
# Path: m/84'/0'/0'/0/0
import hashlib
import bech32
import numpy as np
from bip32 import BIP32, HARDENED_INDEX
from mnemonic import Mnemonic
TARGET = "bc1q0navdwrt7jry46a0zzpekaf5ey8u9hzlfdtgtk"

Top of Mind BIPs

Keybase proof

I hereby claim:

  • I am miketery on github.
  • I am miketery (https://keybase.io/miketery) on keybase.
  • I have a public key ASA-nW7tdKl8yYz_QJWJDQqiAhDe4hxBXeQqDIFoTrBf6Ao

To claim this, I am signing this object:

@miketery
miketery / whiteboardCleaner.md
Created October 2, 2019 20:38 — forked from lelandbatey/whiteboardCleaner.md
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

<!DOCTYPE html>
<html>
<head>
<title>I code stuff with my bare hands</title>
<meta charset="utf-8">
</head>
<body>
Hi there
</body>
</html>
convert input.png -resize 100x100 -background white -gravity center -extent 100x100 -format png output.png
// -quality 75 //optional?
# http://30secondsofpythoncode.ml/#count_by
def count_by(arr, fn=lambda x: x):
key = {}
for el in map(fn, arr):
key[el] = 0 if el not in key else key[el]
key[el] += 1
return key
from math import floor
count_by([6.1, 4.2, 6.3], floor) # {4: 1, 6: 2}
.horizontal-and-vertical-centering {
display: flex;
justify-content: center;
align-items: center;
}
.truncate-text {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
// Source https://bradenmacdonald.com/blog/2015/uwsgi-emperor-multiple-python
Building a uWSGI Emperor for multiple python versisons
September 5, 2015
This is a quick update to my tutorial on hosting Django Apps on Ubuntu with Nginx and uWSGI. I recently wanted to move to a mix of Python 3.4 and Python 2.7 web apps on one of my servers that was set up as described in that tutorial. Here's how to do that.
Normally, I just install uWSGI using pip. The big downside of that approach is that it only builds uWSGI for the version of Python with which you install it. So to get one emperor that can run apps (vassals) with different versions of Python, we need to compile uWSGI. Luckily it's really easy.
Here is an example of the required steps. Just run the following commands as root.
@miketery
miketery / commands
Last active June 18, 2021 18:48
Commands that are forgettable for me
# collapse multi line file
# e.g.
# col 1
# col 2
# col 3
# col 1...
# OUTPUT: col1, col2, col3
sed 'N;N;s/\n/ /g' file
# show pots used by sys (source: https://unix.stackexchange.com/questions/62247/how-do-i-know-what-service-is-running-on-a-particular-port-in-linux)