Skip to content

Instantly share code, notes, and snippets.

@trevor403
trevor403 / patch.py
Created January 18, 2023 03:40
A small patcher to bypass protected Lua functions in World of Warcraft 3.3.5a client `Wow.exe`
import pefile
import binascii
with open('Wow.exe', 'rb') as f:
name = f.name
b = bytearray(f.read())
def apply_patch(name, offset, patch, expected):
print("PATCHING", name)
@trevor403
trevor403 / patch.py
Last active January 4, 2023 03:23
A small patcher to bypass protected Lua functions in World of Warcraft 1.12.1 client `WoW.exe`
with open('WoW.exe', 'rb') as f:
b = bytearray(f.read())
def apply_patch(name, search, patch):
print("PATCHING", name)
size = len(patch)
orig = search[:size]
if b.count(search) != 1:
print("not a good patch", b.count(search))
@trevor403
trevor403 / Makefile
Created January 4, 2023 03:22
GNU Makefile for arduino-cli
.PHONY: build upload
PROJECT := blemon
SOURCE := $(PROJECT).ino
SKETCH_ID := $(shell pwd | tr -d '\n' | md5sum | awk '{print toupper($$1)}')
SKETCH_BUILD_PATH := /tmp/arduino-sketch-$(SKETCH_ID)
OUTPUT := $(SKETCH_BUILD_PATH)/$(SOURCE).bin
@trevor403
trevor403 / webcam.sh
Created July 29, 2020 16:25
Virtual webcam for wayland screensharing
sudo modprobe v4l2loopback video_nr=4 card_label="virtual webcam" exclusive_caps=1
sudo ffmpeg -use_wallclock_as_timestamps 1 -fflags nobuffer -framerate 60 -device /dev/dri/card0 -f kmsgrab -format bgr0 -i - -vsync drop -init_hw_device vaapi=v:/dev/dri/renderD128 -filter_hw_device v -vf 'hwmap,hwdownload,format=yuv420p' -c:v rawvideo -f v4l2 /dev/video4
// This example adapted from Matt Gallagher's "Minimalist Cocoa Programming"
// blog article:
// http://cocoawithlove.com/2010/09/minimalist-cocoa-programming.html
var $ = require('NodObjC')
$.import('Cocoa')
var pool = $.NSAutoreleasePool('alloc')('init')
, app = $.NSApplication('sharedApplication')