Skip to content

Instantly share code, notes, and snippets.

View npodonnell's full-sized avatar
🎯
Focusing

npodonnell npodonnell

🎯
Focusing
View GitHub Profile
# N. P. O'Donnell, 2024
from typing import Iterator
def generate_combinations(elements: list[any], count: int) -> Iterator[list[int]]:
"""
Non-recursive generation of combinations.
:param elements: Elements from which to make combinations.
@npodonnell
npodonnell / uniswap_v3_formulae.tex.md
Last active February 7, 2023 16:02
Uniswap v3 Formulae

Uniswap Formulae

Notes:

  • Lower-case x and y denote virtual or v1 reserves, upper-case X and Y denote v3 real reserves.
  • The v3 formulae have been adapted from those in the whitepaper to be in terms of price, not square-root-price.

v1/v2 Formulae

Constant Product Formula

@npodonnell
npodonnell / special_characters.md
Last active January 17, 2024 07:35
Special Characters

Special Characters

N. P. O'Donnell, 2023

Typing These Characters

On Linux, Hold ctrl + shift + u at the same time, release all 3, then type the 4 hex characters of the character you'd like.

Codes

@npodonnell
npodonnell / uniswapv3_notes.md
Last active November 15, 2022 08:48
UniswapV3 Notes
@npodonnell
npodonnell / wg-switcher.sh
Created July 18, 2022 03:30
Wireguard switcher
#!/usr/bin/env bash
#
# Switch between Wireguard tunnels located in /etc/wireguard/
# Each tunnel should be defined with a config file, eg. wg0.conf
#
# N. P. O'Donnell, 2022
if [[ $# -ne 1 ]]; then
echo "Usage: $0 [OPTIONS] [<new tunnel>]"
echo
@npodonnell
npodonnell / run-in-parallel.sh
Last active January 20, 2022 20:08
Run in parallel
#!/usr/bin/env bash
NTOK=3
do_cmd() {
echo "Command start $1"
sleep 5
echo "Command end $1"
return 1
}
@npodonnell
npodonnell / luks_encryption_cheatsheet.md
Last active March 13, 2023 16:26
LUKS Encryption Cheatsheet

LUKS Encryption Cheatsheet

N. P. O'Donnell, 2021

Before you do anything, ensure you have cryptsetup installed:

sudo apt-get install -y cryptsetup
@npodonnell
npodonnell / xen_cheatsheet.md
Last active December 27, 2021 16:05
Xen Cheatsheet

Xen Cheatsheet

N. P. O'Donnell, 2021

Run without sudo

There may be other ways to do this, but I use the following alias:

alias xen="sudo xen $@"
@npodonnell
npodonnell / virtualization_notes.md
Last active January 13, 2023 11:25
Virtualization Notes

Virtualization Notes

N. P. O'Donnell, 2021

Find out if your x86 CPU supports KVM Virtualization

egrep -c '(vmx|svm)' /proc/cpuinfo