Skip to content

Instantly share code, notes, and snippets.

View ekzhang's full-sized avatar

Eric Zhang ekzhang

View GitHub Profile
@ekzhang
ekzhang / gened.ipynb
Created July 20, 2023 22:41
Manually adding a bunch of GENED data to the AY 2023 classes.wtf dataset
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
echo '* soft nofile 1048576' | sudo tee -a /etc/security/limits.conf
echo '* hard nofile 1048576' | sudo tee -a /etc/security/limits.conf
echo 'root soft nofile 1048576' | sudo tee -a /etc/security/limits.conf
echo 'root hard nofile 1048576' | sudo tee -a /etc/security/limits.conf
echo 'session required pam_limits.so' | sudo tee -a /etc/pam.d/common-session
echo 'DefaultLimitNOFILE=1048576:1048576' | sudo tee -a /etc/systemd/system.conf
@ekzhang
ekzhang / Scanner.ipynb
Created January 31, 2023 23:21
Scanning sheet music for fun and profit
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Notes on Forma

Recently @dragostis at Google released an experimental vector graphics renderer called Forma.

The renderer has a pretty cool set of goals: portability, performance, simplicity, and size. Graphics and GPU computation models are a topic that I'm pretty interested in learning more about personally, and this project seems like an especially accessible / well-written codebase to learn from.

I'm very happy to see this work! The era of rendering vector graphics in GPU compute shaders is upon us, and I have no doubt it we'll start seeing these in production soon, as there's just such a performance advantage over CPU rendering, and I believe trying to run vector 2D graphics through the GPU rasterization pipeline doesn't quite work.

_This code is simpler than Vello (the new name for piet-gpu), focused on vector path rendering. It's also a strong demo of the power of WebGPU, while also having a performant software-only pipe

@ekzhang
ekzhang / aeadchat.py
Last active November 27, 2022 20:58
A chat application using authenticated encryption. (for reading group!) https://ekzhang.mmm.page/hsrg
"""A chat application using authenticated encryption.
Client usage:
pip3 install pynacl redis rich textual typer
python3 aeadchat.py <HOST> <PORT>
This connects to a Redis server as the underlying message broker / transport.
---
@ekzhang
ekzhang / cross-compile.sh
Last active July 21, 2022 05:21
Rust cross-compilation cheatsheet (M1 Mac)
# Cross-compilation commands for Rust on M1 (arm64) macOS.
brew tap messense/macos-cross-toolchains
# -> macOS arm64
cargo build --release
# -> macOS x86-64
SDKROOT=$(xcrun -sdk macosx12.3 --show-sdk-path) \
MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx12.3 --show-sdk-platform-version) \
@ekzhang
ekzhang / master_commands.js
Last active March 3, 2022 01:37
This is the code for hacking in commands in the AoPS Classroom. (e.g. ~~mute fz0718)
ROOM_ID = '971';
USERS = '15Pandabears 18d0m1n4t3 24iam24 2isMyFavoritePrime 2kev111 2_confirm_ \
a1267ab A2082 ABCDE abean077 abhi1664 abishek99 aboveaverage abvenkgoo \
acegikmoqsuwy2000 ac_math ada211 adamov1 adamz Addicted2math adik7 agray42 \
airborne238 ajayd ajeya_jr AK3141592 AKAL3 AkashD AkiBanana AkshajK akshaygowrish \
alanchung Alanshenkerman Alan_Zhu albertczhang alex7 alexanderc alexlee89912000 \
alphacapture Am9298 AMA2000 Amad271 AMathJedi amburger66 AmericanPi AMN300 \
amplreneo anandiyer12 ANB andrewj2002 anduril anicool AnishS Anonymous_Wombat \
Ant-on-knee antoncow Aopser101 aravindsidd archer4 Arithmophobia asdf333 \
AstrapiGnosis atran246 aty1998 averyw17113532 awe-sum awesomeclaw AWu007 \
@ekzhang
ekzhang / Workshop.ipynb
Last active December 1, 2021 15:54
HCS Workshop 1: Data Science
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ekzhang
ekzhang / vector.jl
Last active October 7, 2021 13:24
A very short solution to Problem N (https://judge.icpc.global/problems/vector) from ICPC Moscow WF in Oct. 2021
### A Pluto.jl notebook ###
# v0.16.1
using Markdown
using InteractiveUtils
# ╔═╡ 4149ed32-773a-48e8-a871-879d36d441f1
using LinearAlgebra
# ╔═╡ 5c627248-2663-11ec-0f78-a773b4888ba6
@ekzhang
ekzhang / .vimrc
Last active August 4, 2021 00:48
" Begin vim-plug
set nocompatible
call plug#begin('~/.vim/plugged')
Plug 'VundleVim/Vundle.vim' " Vundle
Plug 'rstacruz/sparkup', {'rtp': 'vim/'} " Emmet-like HTML expansion
Plug 'w0ng/vim-hybrid' " Hybrid theme
Plug 'sheerun/vim-polyglot' " Enhanced language support
Plug 'scrooloose/nerdtree' " Tree explorer
Plug 'vim-scripts/delimitMate.vim' " Auto-close parens/quotes
Plug 'tpope/vim-sleuth' " Auto-detect indentation