Note
Obligatory disclaimer: this is for educational purposes only. I am not responsible for any damages caused by following this guide, or using any of the script(s) herein.
This guide prioritizes arm64 macOS, but may also work for other platforms.
Note
Obligatory disclaimer: this is for educational purposes only. I am not responsible for any damages caused by following this guide, or using any of the script(s) herein.
This guide prioritizes arm64 macOS, but may also work for other platforms.
Tested in Macbook Pro M3 Pro with macOS Sonoma(14.4.1)
hdiutil create -size 30g -fs 'Case-sensitive HFS+' -type SPARSEBUNDLE -nospotlight -volname OpenWRTBuilder ~/OpenWRTBuilder
hdiutil attach -notremovable -nobrowse -mountpoint ~/OpenWRTBuilder ~/OpenWRTBuilder.sparsebundle
import sys | |
import wave | |
import struct | |
# bit0 is a single period sine wave at 1024Hz with a given amplitude | |
# bit1 is the same but with ~2.7 times the amplitude | |
bits = [[0x00, 0x09, 0x12, 0x1A, 0x21, 0x27, 0x2C, 0x2F, 0x30, 0x2F, 0x2C, 0x27, 0x21, 0x1A, 0x12, 0x09, 0x00, 0xF6, 0xED, 0xE5, 0xDE, 0xD8, 0xD3, 0xD0, 0xD0, 0xD0, 0xD3, 0xD8, 0xDE, 0xE5, 0xED, 0xF6], [0x00, 0x18, 0x30, 0x46, 0x59, 0x69, 0x75, 0x7C, 0x7F, 0x7C, 0x75, 0x69, 0x59, 0x46, 0x30, 0x18, 0x00, 0xE7, 0xCF, 0xB9, 0xA6, 0x96, 0x8A, 0x83, 0x81, 0x83, 0x8A, 0x96, 0xA6, 0xB9, 0xCF, 0xE7]] | |
bits[0] = [b^0x80 for b in bits[0]] | |
bits[1] = [b^0x80 for b in bits[1]] | |
bits[0] = struct.pack('%sB' % len(bits[0]), *bits[0]) |
import struct | |
import math | |
import os | |
import sys | |
if sys.version > '3': | |
buffer = memoryview | |
def getWord(b, k, n=4): | |
return sum(list(map(lambda c: b[k+c]<<(c*8),range(n)))) |