Skip to content

Instantly share code, notes, and snippets.

View ekzhang's full-sized avatar

Eric Zhang ekzhang

View GitHub Profile
@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 / 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 / Workshop.ipynb
Last active December 1, 2021 15:54
HCS Workshop 1: Data Science
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ekzhang
ekzhang / .gitconfig
Last active June 19, 2020 01:52
Git configuration file for MacOS
[user]
email = [email protected]
name = Eric Zhang
[push]
default = upstream
[merge]
conflictstyle = diff3
[color]
ui = auto
[alias]
@ekzhang
ekzhang / Training.ipynb
Created June 10, 2020 20:38
Char-RNN in PyTorch
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ekzhang
ekzhang / .tmux.conf
Last active April 12, 2020 21:24
Tmux configuration file
# Set default terminal
set -g default-terminal "screen-256color"
# Tell Tmux that outside terminal supports true color
set -ga terminal-overrides ",xterm-256color*:Tc"
# Enable mouse
set -g mouse on
# Allow xterm titles in terminal window, terminal scrolling with scrollbar, and setting overrides of C-Up, C-Down, C-Left, C-Right
@ekzhang
ekzhang / crontab
Last active February 4, 2024 11:37
Minecraft server tmux/cron scripts
0 8 * * * $HOME/scripts/restart.sh
15 8 * * * $HOME/scripts/fullrender.sh
@ekzhang
ekzhang / install_dotfiles.sh
Last active April 12, 2020 21:24
Install dotfiles for vim, bash, and tmux
#!/bin/bash
# Check for dependencies
if [ -z $(which git) ]; then
>&2 echo "Could not find Git."
exit 1
fi
if [ -z $(which wget) ]; then
>&2 echo "Could not find wget."
exit 1
@ekzhang
ekzhang / fd1.cpp
Created March 9, 2020 04:40
File descriptor copying tests with fork() and dup2()
#include <cstdio>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/wait.h>
using namespace std;
int main() {
int fd = open("fd.txt", O_CREAT | O_WRONLY | O_TRUNC, 644);