Skip to content

Instantly share code, notes, and snippets.

@nicolalamacchia
nicolalamacchia / qidi_thumbnail.py
Last active September 1, 2024 00:46
Post-processing script to fix thumbnail not showing up in QIDI 3D printers
#!/usr/bin/env python3
import re
import sys
def move_thumbnail_to_bottom(input_file, output_file):
with open(input_file, 'r') as file:
lines = file.readlines()
thumbnail_start = None
@nicolalamacchia
nicolalamacchia / aoc-22-7-pt1.fth
Last active January 24, 2024 16:43
Advent of Code 2022, day 7 (part 1) - Gforth solution
#! /usr/bin/gforth
\ for debugging (e.g. 'a' reg)
: reg ( c -- )
." reg " emit ." >>> " .s cr ;
\ \ \
\ file stuff
32 Constant BUF-LEN
@nicolalamacchia
nicolalamacchia / getdns.sh
Created January 18, 2024 11:23
Get all the available DNS entries for a domain name
#!/bin/sh -e
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <domain>"
exit 1
fi
priority_rrs="A AAAA CNAME MX NS TXT SOA"
rrs="AFSDB APL CAA CDNSKEY CDS CERT CSYNC DHCID DLV DNAME DNSKEY DS EUI48 EUI64 HINFO HIP HTTPS IPSECKEY KEY KX LOC NAPTR NSEC NSEC3 NSEC3PARAM OPENPGPKEY PTR RRSIG RP SIG SMIMEA SRV SSHFP SVCB TA TKEY TLSA TSIG URI ZONEMD"
pseudo_rrs="ANY AXFR IXFR OPT"
@nicolalamacchia
nicolalamacchia / reset.css
Created November 14, 2023 11:19
Sensible CSS Reset
/*
* CSS reset with sensible default.
* Based on https://andy-bell.co.uk/a-more-modern-css-reset/
*/
/* Box sizing rules */
*,
*::before,
*::after {
box-sizing: border-box;
@nicolalamacchia
nicolalamacchia / wake_on_lan.py
Created November 18, 2020 23:27
Wake-on-LAN in Python
#!/usr/bin/python
import socket
import struct
import sys
BROADCAST_IP = "192.168.0.255"
MAC_ADDRESS = "00:00:00:00:00:00"
WOL_PORT = 9 # 0, 7 or 9
@nicolalamacchia
nicolalamacchia / img2loop.sh
Created October 18, 2020 10:27
Creates loop devices from a disk image file. Those loop devices have to be mounted manually.
#!/bin/bash
# Usage: img2loop /path/to/disk.img
# Outputs created loop devices.
set -eu
if [[ $(id -u) -ne 0 ]]; then
echo "Error, run this program as root" >&2
exit 1

Keybase proof

I hereby claim:

  • I am nicolalamacchia on github.
  • I am nicolalamacchia (https://keybase.io/nicolalamacchia) on keybase.
  • I have a public key ASDH46kkAKuVRxrJLP7OPveiy3XbNLDbhOW0XshUs_KojQo

To claim this, I am signing this object:

@nicolalamacchia
nicolalamacchia / clean-roms.py
Last active March 13, 2023 22:20
A script to clean up ROM files from ROM collections
#!/usr/bin/python
# based on https://github.com/grayaii/rom_cleaner
# NOTE: I am in the process of rewriting this to make it more readable,
# testable, optimized. Right now I just added features and tuned
# existing ones mostly on top of the old code.
import re
import os