Skip to content

Instantly share code, notes, and snippets.

View Jerrylum's full-sized avatar
👀
Given enough eyeballs, all bugs are shallow.

Jerry Lum Jerrylum

👀
Given enough eyeballs, all bugs are shallow.
  • Hong Kong Joint School Technology Education Association
  • Hong Kong
  • 18:11 (UTC +08:00)
  • X @jerrylum10
View GitHub Profile
@mr-linch
mr-linch / capture_darwin.py
Last active May 26, 2025 14:12
Make fast screenshot of Mac OS window from Python (using native api bindings, 30 fps on Air M2)
import Quartz as QZ
import Quartz.CoreGraphics as CG
import AppKit as AK
import numpy as np
import numpy.typing as npt
import typing as t
Matcher = t.Callable[[dict[str, t.Any]], bool]
@wireboy5
wireboy5 / v5bt.py
Last active September 13, 2023 17:35
"""
Super basic code to scan for and connect to v5 devices using the python bleak library. Prints out all data read over the user port.
"""
import argparse
import asyncio
from bleak import BleakScanner, BleakClient
SERVICE_UUID = "08590f7e-db05-467e-8757-72f6faeb13d5"
@gabrielhamel
gabrielhamel / GDB-VSCode
Last active December 14, 2024 15:08
VSCode configuration for GDB debugging with cmake
Put all files into .vscode
- Build: Ctrl+Shift+B
- Launch: Ctrl+F5
@enepomnyaschih
enepomnyaschih / base64.js
Last active April 25, 2025 08:01
https://www.npmjs.com/package/byte-base64 - Encode JS Uint8Array, simple array of bytes or native JS string to base64 and back
/*
MIT License
Copyright (c) 2020 Egor Nepomnyaschih
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@brianguertin
brianguertin / Version.java
Created July 8, 2016 16:09
Simple SemVer version parsing and comparison in Java
public class Version implements Comparable<Version> {
@NonNull
public final int[] numbers;
public Version(@NonNull String version) {
final String split[] = version.split("\\-")[0].split("\\.");
numbers = new int[split.length];
for (int i = 0; i < split.length; i++) {
numbers[i] = Integer.valueOf(split[i]);
}
@joepie91
joepie91 / vpn.md
Last active June 2, 2025 02:33
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.
@rdb
rdb / js_winmm.py
Last active August 11, 2024 00:21
Access game controllers from Python on Windows via the WinMM API. See https://discourse.panda3d.org/t/game-controllers-on-windows-without-pygame/14129
# Released by rdb under the Unlicense (unlicense.org)
# Further reading about the WinMM Joystick API:
# http://msdn.microsoft.com/en-us/library/windows/desktop/dd757116(v=vs.85).aspx
from math import floor, ceil
import time
import ctypes
import _winreg as winreg
from ctypes.wintypes import WORD, UINT, DWORD
from ctypes.wintypes import WCHAR as TCHAR
@darkf
darkf / event.cpp
Created February 8, 2014 11:57
Simple event system in C++
#include <functional>
#include <map>
#include <typeinfo>
#include <iostream>
struct Event {
virtual ~Event() {}
};
struct TestEvent : Event {
std::string msg;
@MrOrz
MrOrz / fish.js
Created December 4, 2013 06:56
Mineflayer fishing bot.
var mineflayer = require('mineflayer'),
repl = require("repl");
var FISHING_ROD = 346, RAW_FISH = 349;
var FISHING_INTERVAL = 200;
var bot = mineflayer.createBot({
host: "<server>",
username: "<username>"
@wteuber
wteuber / fmod.js
Last active February 6, 2024 14:47
fmod for Javascript, will work with any ECMA-262 implementation.If you need a precision higher than 8, please use another implementaion of fmod.
/*
fmod for Javascript, will work with any ECMA-262 implementation.
If you need a precision higher than 8, please use another implementation of fmod.
1.05 % 0.05
=> 0.04999999999999999
Math.fmod(1.05, 0.05)
=> 0