Skip to content

Instantly share code, notes, and snippets.

//x86_64-w64-mingw32-gcc -o disable-two-finger-click -mwindows -O99 disable-two-finger-click.cpp
#include <Windows.h>
#include <hidsdi.h>
#include <time.h>
#include <stdio.h>
NTSTATUS HidP_GetCaps(PHIDP_PREPARSED_DATA preparsed_data, HIDP_CAPS *caps);
HHOOK miHook;
//x86_64-w64-mingw32-gcc -o disable-two-finger-click -mwindows -O99 disable-two-finger-click.cpp
#include <thread>
#include <Windows.h>
#include <stdio.h>
#include <time.h>
HHOOK miHook;
const bool ALLOW_DOUBLE_TAP_RIGHT_CLICK = true;
@arpruss
arpruss / disable-two-finger-click.py
Last active February 16, 2024 19:53
Remap precision touchpad two-finger right click to a left click
#!/usr/bin/env python
import ctypes as cts
import ctypes.wintypes as wts
from ctypes import *
from ctypes.wintypes import *
import sys
import time
import threading
import ctypes_wrappers as cws
@arpruss
arpruss / homebutton.py
Last active February 3, 2024 04:55
relay menu button from FireTV remote to ChromeCast home button
#!/usr/bin/python3
import time
import os
import subprocess
import sys
import shlex
TV_IP = "XXX.XXX.XXX.XXX"
CC_IP = "XXX.XXX.XXX.XXX"
@arpruss
arpruss / lagtest.c
Last active January 22, 2024 03:20
Measure screen lag on rpi
/*
instructions: hook up one oscilloscope channel to a photodiode circuit and the other to GPIO 21; trigger on GPIO 21
*/
#include <stdio.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <string.h>
#include <sys/mman.h>
@arpruss
arpruss / taito-extract.py
Created January 11, 2024 01:34
Extract files from PS2 Taito Legends
import os
import zlib
try:
os.mkdir('taito/extract')
except:
pass
with open('taito/FILES.HDR', 'rb') as hdr:
with open('taito/FILES.DAT', 'rb') as dat:
@arpruss
arpruss / protectedmark.py
Created July 31, 2023 18:28
protectedmark.py
import os
import sys
import stat
import subprocess
rating = None
label = None
delete = False
base = "."
import os
import sys
import math
import subprocess
maxSize = 999999999
overlapSeconds = 6
def getDuration(filename):
pipe = subprocess.Popen(["ffprobe", filename], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
@arpruss
arpruss / stretchvideo.js
Last active July 11, 2023 18:05
Bookmarklet to change aspect ratio of html5 video
document.dispatchEvent(new Event('mobi.omegacentauri.killStretchVideoEvent'));
var vid = document.getElementsByTagName('video');
if (vid.length == 0) {
alert("No video elements found in this page.");
}
else {
var mode = prompt("Enter one of these:\n"+
"(a) horizontal,vertical : a pair of scale ratios\n"+
"(b) horizontal:vertical : the correct aspect ratio for a badly encoded video\n", "1,1");
import math
BIKE_WEIGHT = 17 # lbs
FRONTAL_AREA = 5.4788 # sq ft
DRIVETRAIN_LOSS = 2 # percent
DRAG = 0.63
ROLLING_RESISTANCE = 0.005
AIR_DENSITY = 1.22601 # kg/m^3
GRAVITY = 9.8067 # m/s^2