Skip to content

Instantly share code, notes, and snippets.

View WeakKnight's full-sized avatar

Tianyu Li WeakKnight

View GitHub Profile
@ifree
ifree / windows_live_captions_recorder.py
Last active March 14, 2024 16:07
Windows live captions recorder
from pywinauto.application import Application
import time
import math
import re
from collections import Counter
WORD = re.compile(r"\w+")
# cosine similarity https://stackoverflow.com/a/15174569/309846
def get_cosine(vec1, vec2):
@gcatlin
gcatlin / glfw-metal-example.m
Last active March 23, 2024 18:13
Minimal C GLFW Metal example
//
// cc glfw-metal-example.m `pkg-config --cflags --libs glfw3` -framework AppKit -framework Metal -framework QuartzCore
//
#define GLFW_INCLUDE_NONE
#define GLFW_EXPOSE_NATIVE_COCOA
#include <GLFW/glfw3.h>
#include <GLFW/glfw3native.h>
#import <Metal/Metal.h>
#import <QuartzCore/CAMetalLayer.h>
@bkaradzic
bkaradzic / orthodoxc++.md
Last active May 24, 2024 00:10
Orthodox C++

Orthodox C++

What is Orthodox C++?

Orthodox C++ (sometimes referred as C+) is minimal subset of C++ that improves C, but avoids all unnecessary things from so called Modern C++. It's exactly opposite of what Modern C++ suppose to be.

Why not Modern C++?

solution "SDL2_Test"
configurations { "debug", "release" }
location("make/" .. os.get() .. "/")
targetdir("bin/" .. os.get() .. "/%{cfg.buildcfg}/")
objdir("obj/" .. os.get() .. "/%{cfg.buildcfg}/")
project "sdl2_test"
kind "WindowedApp"
language "C"
// smallgdpt: a simple implementation of gradient domain path tracing
// https://mediatech.aalto.fi/publications/graphics/GPT/
// adapted from smallpt by Kevin Beason http://www.kevinbeason.com/smallpt/
// and a screened poisson solver by Pravin Bhat http://grail.cs.washington.edu/projects/screenedPoissonEq/
// to build, type: g++ -o smallgdpt -fopenmp -O3 smallgdpt.cpp -L/usr/local/lib -lm -lfftw3
// you will need fftw3 http://www.fftw.org/ to compile
// usage: ./smallgdpt [number of samples per pixel]
#include <fftw3.h>
#include <math.h>
#include <stdlib.h>
@allanmac
allanmac / assert_cuda.c
Last active April 16, 2023 18:42
A tiny example of CUDA + OpenGL interop with write-only surfaces and CUDA kernels. Uses GLFW+GLAD.
//
//
//
#include <stdlib.h>
#include <stdio.h>
//
//
//
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.