Skip to content

Instantly share code, notes, and snippets.

View jameslzhu's full-sized avatar

James Zhu jameslzhu

View GitHub Profile
@jameslzhu
jameslzhu / favicon.sh
Created June 2, 2020 07:06
Converts a favicon SVG to PNG and ICO.
#!/usr/bin/env bash
# Convert svg to png with inkscape
inkscape --export-type=png -o assets/images/favicon.png -w 64 -h 64 \
--export-background-opacity=0 \
./assets/images/favicon.svg
# Convert png to ico with imagemagick
convert ./assets/images/favicon.png \
\( -clone 0 -resize 16x16 \) \
@jameslzhu
jameslzhu / .editorconfig
Created December 5, 2019 20:24
editorconfig
# .editorconfig
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
@jameslzhu
jameslzhu / coursechart.js
Created February 4, 2019 19:15
HKN course chart
var OPACITY_DURATION = 500;
var DEFAULT_HEIGHT = 700;
var generateChart = function(info, loc, department_id) {
var nodes = [];
var prereqs = [];
var classHash = {};
var type_ids = []
var types = {}
var max_depth = 0;
# .gitconfig - jameslzhu
[user]
name = James Zhu
email = jameszhu@berkeley.edu
[core]
editor = vim
autocrlf = input
filemode = false
#include<math.h>
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define LED_PIN 0
#define NUM_LEDS 60
#define BRIGHTNESS 127

Keybase proof

I hereby claim:

  • I am jameslzhu on github.
  • I am jzhu (https://keybase.io/jzhu) on keybase.
  • I have a public key ASDr_JqMh89-_K9jO02VgOoA5wiYf1zZQcFAQ5VJugCVIAo

To claim this, I am signing this object:

@jameslzhu
jameslzhu / recrop16-9.sh
Created June 1, 2016 16:25
Recrops images to 16:9 resolution, either in 1080p (1920 x 1080), 1440p (2560 x 1440) or 4K (3840 x 2160).
/#!/usr/bin/bash
# Recrops images in working directory to 16:9 resolution.
# Picks the smallest resolution which fits the image with minimal cropping.
OUTPUT_DIR="recropped"
EXT="jpg"
mkdir -p "$OUTPUT_DIR"
@jameslzhu
jameslzhu / Fractran.py
Last active August 29, 2015 14:12
The FRACTRAN program, as described in HSCTF 2014.
# FRACTRAN - jzhu98
# See bottom for license.
from fractions import Fraction
# Input FRACTRAN code here
code = "455/33,11/13,1/11,3/7,11/2,1/3"
def parse_input(string):
"""Return a list of fractions from the code."""
@jameslzhu
jameslzhu / chaos.py
Last active December 6, 2016 20:57
Brownian motion simulator, written with VPython.
#!/usr/bin/env python2
#
# chaos - jzhu98
# See bottom for license.
#
from __future__ import division
from enum import Enum