Skip to content

Instantly share code, notes, and snippets.

@heisvoid
heisvoid / heater.c
Created September 18, 2024 04:33
Arduino code for a nighttime electricity heater at home
//#define NO_MONITOR
#ifndef NO_MONITOR
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#endif
#include <DS18B20.h>
@heisvoid
heisvoid / chkrpl.py
Last active August 9, 2024 11:03
Check a .rpl file
# -*- coding: utf-8 -*-
import argparse
import struct
import os
parser = argparse.ArgumentParser(description='Check .rpl file.')
parser.add_argument('-f', required=True, help='rpl file', dest='file')
args = parser.parse_args()
@heisvoid
heisvoid / extract_sprite_3-1.py
Created August 9, 2024 03:53
Extract sprite type 3-1 in TWG
# -*- coding: utf-8 -*-
# Extract sprites
import argparse
import struct
import os
# mode 13h resolution
MONITOR_WIDTH = 320
@heisvoid
heisvoid / extract_sprite_6.py
Created August 8, 2024 10:06
Extract sprites type 6 in TWG
# -*- coding: utf-8 -*-
# Extract sprites
import argparse
import struct
import os
# mode 13h resolution
MONITOR_WIDTH = 320
@heisvoid
heisvoid / extract_sprite_1.py
Created August 8, 2024 05:06
Extract sprite type 1 in TWG
# -*- coding: utf-8 -*-
# Extract sprites
import argparse
import struct
import os
# mode 13h resolution
MONITOR_WIDTH = 320
@heisvoid
heisvoid / chkspr6.py
Created August 7, 2024 13:22
Verify sprite type 6 in TWG(The War of Genesis 2)
# -*- coding: utf-8 -*-
import argparse
import struct
import os
parser = argparse.ArgumentParser(description='Check sprite file.')
parser.add_argument('-f', required=True, help='sprite file', dest='spr')
args = parser.parse_args()
@heisvoid
heisvoid / chkspr5.py
Created August 7, 2024 13:21
Verify sprite type 5 in TWG(The War of Genesis 2).
# -*- coding: utf-8 -*-
import argparse
import struct
import os
parser = argparse.ArgumentParser(description='Verify sprites.')
parser.add_argument('-f', required=True, help='sprites file', dest='spr')
args = parser.parse_args()
#!/bin/sh
OPTS=""
OPTS="$OPTS -nodefaults"
OPTS="$OPTS -enable-kvm"
OPTS="$OPTS -cpu host,hv_relaxed,hv_spinlocks=0x1fff,hv_vapic,hv_time"
OPTS="$OPTS -smp 4"
OPTS="$OPTS -m 4G"
OPTS="$OPTS -usb -device usb-tablet"
@heisvoid
heisvoid / qemu_win10.sh
Last active April 27, 2022 07:55
QEMU Windows 10 guest start shell script
#!/bin/sh
SPICE_SOCK="/tmp/qemu_win10_spice.socket"
OPTS=""
OPTS="$OPTS -nodefaults"
OPTS="$OPTS -enable-kvm"
OPTS="$OPTS -cpu host,hv_relaxed,hv_spinlocks=0x1fff,hv_vapic,hv_time"
OPTS="$OPTS -smp sockets=1,cores=2,threads=2"
@heisvoid
heisvoid / googlephotos.sh
Created October 31, 2019 10:16
Edit the metadata 'Create Date' of Google photos Takeout files
#!/bin/sh
# Edit the metadata 'Create Date'
files=$(mktemp)
find "$1" -type f -iname "*.jpg" > $files
while IFS= read -r f
do
create_date=$(exiftool -CreateDate "$f" | cut -d ":" -f 2)
if [ ! -z "$create_date" ] && [ " 0000" != "$create_date" ]; then