Skip to content

Instantly share code, notes, and snippets.

@oakwhiz
oakwhiz / dumptxoutset_to_sqlite.py
Created February 22, 2024 02:11
port of utxo_to_sqlite.go from utxo_dump_tools
#!/usr/bin/env python3
import sqlite3
import struct
from pathlib import Path
import argparse
from hashlib import sha256
from time import time
# Install these packages via pip if not already installed
from ecdsa.numbertheory import square_root_mod_prime
@oakwhiz
oakwhiz / README.md
Last active February 12, 2024 02:15
How to set up a bitcoin node on Debian using the official "hardened" systemd unit file, with external storage + testnet

How to set up a bitcoin node on Debian using the official "hardened" systemd unit file, with external storage + testnet

Disclaimer of liability & warnings

It's your responsibility to handle Bitcoin correctly, failure to do so could cause cybersecurity breaches or financial losses, which you are solely responsible for. You should change all passwords, ensure you have a good firewall configuration, keep up-to-date, only use trusted sources for software and configuration, maintain your hardware, ensure working backups and redundancies, etc. You must also double check that these documents are not outdated, malicious or tampered with. The author(s) of these documents cannot be held responsible for losses or damages arising from use or misuse of the information within.

If you are using a bitcoin node in a commercial setting, you need to think about things like redundancy, uptime and recovery. What would happen if you were relying on a single bitcoin node and it went down? How long will it last if you "set it

@oakwhiz
oakwhiz / gigabyte-via-usb-linux-iommu.md
Created May 20, 2014 05:17
Problem with VIA USB controller in Linux on Gigabyte motherboards

Gigabyte GA-990FXA-UD3 revision 4.0

IOMMU enabled

Linux 3.13

Problem:

VIA USB 3.0 controller doesn't work in Linux. The AMD IOMMU is enabled in the BIOS. Checking kernel messages (dmesg) shows that the USB controller is shut down due to an error, and there are also many error messages pertaining to AMD-Vi and access to a certain memory address through the IOMMU. Some USB ports do not work.

@oakwhiz
oakwhiz / configure-crond-journal.md
Last active November 9, 2023 06:47
How to configure crond to send cron job output to the system journal

How to configure crond to send cron job output to the system journal

Keywords: fedora 20, systemd, cron, crond, output, stdout, journal

Problem: You want to capture and read the output of your cron jobs, but the output isn't being logged anywhere.

Solution: Add an argument to crond.

# START
from mpmath import mp
import numpy as np
import matplotlib.pyplot as plt
import cmath
# Set the desired precision
mp.dps = 50
# Define the angles of the fundamental domain
@oakwhiz
oakwhiz / router.cfg
Last active January 10, 2023 11:14 — forked from marfillaster/router.cfg
[For reference only] MikroTik RouterOS v7 dual DHCP WAN recursive failover w/ PCC load-balancing; and recursive ECMP
# jul/28/2022 00:34:21 by RouterOS 7.4rc2
# incomplete config, do not use directly
/ip firewall address-list
add address=192.168.88.0/24 list=local
add address=192.168.88.0/24 list=preferprimary
add address=1.2.3.0/24 list=localnet-primary
add address=4.5.6.0/24 list=localnet-backup
add address=9.9.9.10 list=reserved-main
add address=9.9.9.11 list=reserved-isp1
@oakwhiz
oakwhiz / pyglet-test
Created March 23, 2013 08:54
Renders triangles in increasing number until fps drops too much
from __future__ import division
from random import uniform
from pyglet import clock, font, image, window
from pyglet.gl import *
class glBeginEnd:
def __init__(self, gl_enum):
self.gl_enum = gl_enum
def __enter__(self):
@oakwhiz
oakwhiz / gist:ec1ef551f889c4db2708
Last active August 29, 2015 14:17
A failed attempt to hide the console in Windows.
#![feature(thread_sleep, std_misc)]
extern crate winapi;
extern crate "kernel32-sys" as kernel32;
extern crate "user32-sys" as user32;
fn main() {
println!("About to hide the console.");
sleep(1);
unsafe {
@oakwhiz
oakwhiz / disk_cache_script.bat
Last active August 29, 2015 14:10
read folder into windows disk cache (simple one-liner)
REM precache files into windows disk cache
REM first argument should be the name of a folder
REM all the files will be recursively copied to nul in order to put them in the disk cache
FOR /R %1 %%F IN (*) DO copy /b "%%F" nul
@oakwhiz
oakwhiz / layer2-ssh-tun.sh
Last active August 29, 2015 14:06
Tunnel SSH over Layer 2 Ethernet (rough sketch)
#!/bin/sh
# Tunnel SSH over Layer 2 Ethernet (rough sketch)
# requires FIFOs, netcat, linkcat
testfun () {
read line
nc "${@}" < <(echo $line ; cat)
}