Skip to content

Instantly share code, notes, and snippets.

@amacgillivray
amacgillivray / fast-perfect-solving-haskell.md
Last active January 12, 2025 05:50
Fast Perfect Number Solving with Euclid-Euler and Miller-Rabin

Solving Perfect Numbers Quickly with Haskell

Walking through the stages of optimizing a perfect-number algorithm; starting with a naive approach, rewriting to use the Euclid-Euler theorem, and then leveraging the Miller-Rabin primality test.

A Frustratingly Naive Solution

On a dark and stormy night in Kansas, many years ago, I sat in front of my laptop - face lit only by the screen.

A homework assignment had tasked us with writing a basic haskell function to find every perfect number between 1 and 9000. We weren't studying numbers, nor did we discuss perfect numbers in class. The number "9000" was chosen as the upper limit due to the complexity associated with finding perfects using typical methods.

@storopoli
storopoli / lazygit.yml
Last active August 16, 2025 17:01
Zed Configs
quitOnTopLevelReturn: true
os:
edit: "zed {{filename}}"
editAtLine: "zed {{filename}}:{{line}}"
git:
autoFetch: false
paging:
colorArg: always
#pager: delta --dark --paging=never
pager: delta --dark --paging=never --line-numbers --hyperlinks --hyperlinks-file-link-format="lazygit-edit://{path}:{line}"
@ziqiq
ziqiq / com.sparrowwallet.Sparrow.md
Last active November 18, 2024 19:03
Sparrow wallet flatpak manifest

Installation for End User

  1. Install flatpak builder
flatpak install --user org.flatpak.Builder
  1. Build and install the Sparrow manifest
@storopoli
storopoli / object_safety.rs
Created July 8, 2024 12:38
Rust: Object Safe Traits
// In general there are two properties for traits to satisfy
// in order them to be object-safe:
//
// 1. The return type isn’t Self.
// 2. There are no generic type parameters.
// Here's an example of a non-object-safe Trait
trait MyTrait {
fn f(&self) -> Self;

Crippling Facebook

Facebook works with advertisers to target you. These instructions are one of the many ways to begin crippling that relationship. When AI targeting is crippled, your psychosecurity improves :)

  1. On your desktop machine, goto https://accountscenter.facebook.com/ads/audience_based_advertising
  2. Maximize the browser window
  3. Press F12 and click on the Console tab
  4. Select the code below, copy it, paste it upon the Console line (The area next to the > character in the Console window), and press enter:
@nikolovlazar
nikolovlazar / keybindings.json
Last active December 15, 2025 02:51
VSCode key bindings to navigate like Neovim
[
// Navigation
{
"key": "ctrl-h",
"command": "workbench.action.navigateLeft"
},
{
"key": "ctrl-l",
"command": "workbench.action.navigateRight"
},
@lavafroth
lavafroth / config.toml
Created March 27, 2024 03:10
Helix config for lazygit integration
[keys.normal]
C-g = [":new", ":insert-output lazygit", ":buffer-close!", ":redraw"]
@storopoli
storopoli / init.lua
Last active September 16, 2025 08:26
Minimal Neovim config
-------------------------------------------------------------------------------
-- DEPENDENCIES
-- neovim >=0.12 ripgrep fd fzf
-------------------------------------------------------------------------------
-- Options
-- Set highlight on search
vim.o.hlsearch = false
vim.o.incsearch = true
vim.o.nu = true
@storopoli
storopoli / alpine.json
Last active November 16, 2024 11:34
Devcontainers Configs
{
"name": "Alpine",
"image": "mcr.microsoft.com/devcontainers/base:alpine",
"postCreateCommand": "sudo apk update && sudo apk add <PKGS>"
}
@RobinLinus
RobinLinus / covenants_cat_ecdsa.md
Last active January 30, 2025 12:44
Emulate covenants using only OP_CAT and ECDSA signatures

Covenants with CAT and ECDSA

In his article, CAT and Schnorr Tricks I, Andrew Poelstra showed how to emulate OP_CHECKSIGFROMSTACK-like covenants using only OP_CATand Schnorr signatures.

Here, we show that a similar trick is possible to emulate covenants using only OP_CAT and ECDSA signatures.

The High-Level Idea

Recall the ECDSA Signature Equation