Skip to content

Instantly share code, notes, and snippets.

View leegao's full-sized avatar
💭
Backpacking the 🌍

Lee Gao leegao

💭
Backpacking the 🌍
  • Google
  • Jersey City, NJ
View GitHub Profile
@leegao
leegao / winlator.diff
Created June 12, 2025 12:01
Diff of recent Winlator Bionic changes
diff --git a/app/build.gradle b/app/build.gradle
index f0f10e9..0abcde4 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -21,18 +21,18 @@ plugins {
tasks.register("prepareKotlinBuildScriptModel"){}
android {
- namespace 'com.winlator'
+ namespace 'com.winlator.cmod'
#include <string.h>
#include <jni.h>
#include <vulkan/vulkan.h>
#include <dlfcn.h>
#include <android/log.h>
#include <stdio.h>
#include <__algorithm/find_if.h>
#include <assert.h>
#include <android/log.h>
#include <iostream>
@leegao
leegao / CMakeLists.txt
Last active June 3, 2025 21:49
Workaround to enable Vulkan validation layer in Vortek on Winlator
add_library(${CMAKE_PROJECT_NAME} SHARED
# List C/C++ source files with relative paths to this CMakeLists.txt.
dummyvk.cpp)
# Specifies libraries CMake should link to your target library. You
# can link libraries from various origins, such as libraries defined in this
# build script, prebuilt third-party libraries, or Android system libraries.
target_link_libraries(${CMAKE_PROJECT_NAME}
# List libraries link to the target library
android
@leegao
leegao / ai.sh
Created April 16, 2025 22:42
Pair Bashing with Gemini
#!/bin/bash
PPID1=$(ps -o ppid= "$$" | tr -d ' ')
PPID2=$(ps -o ppid= "$PPID1" | tr -d ' ')
PARENT=$(ps -p "$PPID2" -o comm=)
if [ -z "$1" ]; then
if [ "$PARENT" != "script" ] ; then
export HISTORY_FILE=$(mktemp)
echo "Run with history ($HISTORY_FILE), don't forget to ctrl+D"
@leegao
leegao / RPNJit.py
Created November 10, 2016 23:31
Ahead-of-time RPN compiler.
import ctypes, mmap, struct
DEBUG = True
try:
VirtualAlloc = ctypes.windll.kernel32.VirtualAlloc
raise Exception("Windows not supported.")
except(AttributeError):
libc = ctypes.CDLL("libc.so.6")
libc.valloc.restype = ctypes.c_void_p
def valloc(size):
addr = libc.valloc(size)
@leegao
leegao / RPNJit.py
Created November 10, 2016 23:05
Ahead-of-time compiled RPN for /r/DailyProgrammer
import ctypes, mmap, struct
DEBUG = True
try:
VirtualAlloc = ctypes.windll.kernel32.VirtualAlloc
raise Exception("Windows not supported.")
except(AttributeError):
libc = ctypes.CDLL("libc.so.6")
libc.valloc.restype = ctypes.c_void_p
def valloc(size):
addr = libc.valloc(size)
import re
from itertools import permutations
class Instance(object):
def __init__(self, groups):
self.groups = (tuple(groups[0]), tuple(groups[1]))
self.level = len([0 for group in groups for _ in group]) // 3
reserved = ''.join([x for group in groups for triplet in group for x in triplet if x is not 'x'])
self.residuals = ''.join([str(i) for i in range(1, 10) for _ in range(self.level - reserved.count(str(i)))])
def getAllNeighbors(origin, steps = 1):
seen = {origin}
worklist = [origin]
while steps:
new_worklist = []
for next in worklist:
seen.add(next)
for neighbor in next.get_all_neighbors(15):
if neighbor not in seen: new_worklist.append(neighbor)
worklist = new_worklist
\documentclass[11pt,a4paper,svgnames]{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb,amsthm}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{algorithm}
\usepackage{algorithmicx}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.