Skip to content

Instantly share code, notes, and snippets.

View ekzhang's full-sized avatar

Eric Zhang ekzhang

View GitHub Profile
@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);
@ekzhang
ekzhang / bipartite_match.cpp
Created February 14, 2020 03:46
Harvard-MIT matching algorithm for Datamatch
#include <bits/stdc++.h>
using namespace std;
#define MAX_STUDENTS 10000
/* Minimum-Cost, Maximum-Flow solver using Successive Shortest Paths with Dijkstra and SPFA-SLF.
* Requirements:
* - Duplicate or antiparallel edges with different costs are allowed.
* - No negative cycles.
* Time Complexity: O(Ef lg V) average-case, O(VE + Ef lg V) worst-case with negative costs.
@ekzhang
ekzhang / ekzhang.sty
Last active May 8, 2024 20:40
LaTeX template and useful macros
\ProvidesPackage{ekzhang}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{asymptote}
\usepackage{cancel}
\usepackage{color}
\usepackage[dvipsnames]{xcolor}
\usepackage{enumerate}
\usepackage[margin=1in]{geometry}
\usepackage{graphicx}