Skip to content

Instantly share code, notes, and snippets.

View kennyng's full-sized avatar

Kenny Ng kennyng

View GitHub Profile
@kennyng
kennyng / vim_reference.md
Last active January 7, 2016 05:42
Vim Commands Reference
@kennyng
kennyng / tmux_reference.md
Last active February 21, 2024 14:25
tmux Commands Reference
@kennyng
kennyng / mac_osx_defaults
Last active January 29, 2017 04:48
Mac OSX Defaults
echo "START SETTING CONFIGURATION DEFAULTS..."
###########################################################
# General UI/UX
###########################################################
echo -e "\nDisable window animations ("new window" scale effect)."
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false
echo -e "\nExpanding the save panel by default."
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
@kennyng
kennyng / convert_wma.sh
Created December 1, 2015 08:36
Convert Audio Tracks to .wma
#!/usr/bin/env bash
which ffmpeg > /dev/null || { echo "REQUIRED: sudo apt-get install ffmpeg" >&2; exit 1; }
which ffprobe > /dev/null || { echo "REQUIRED: sudo apt-get install ffmpeg" >&2; exit 1; }
format=mp3
find . -type f | grep -i wma$ > tracklist.txt
#readarray -t files < tracklist.txt
declare -a tracklist
@kennyng
kennyng / ffmpeg_convert_audio
Created December 1, 2015 08:38
ffmpeg Audio Conversion Notes
for f in *.flac ; do
# Regex for whitespaces in filenames.
# Specify input and output filetypes.
out="${f[@]/%flac/mp3}"
# Use -qscale or -vbr for VBR [0-9].
# 0: slowest & best possible algo
# 1: slow and not as high quality
# 2: recommended (same as -h)
# 5: default; good speed, reasonable quality
@kennyng
kennyng / VimTerm.applescript
Last active January 29, 2017 10:25
Open files with Vim (command-line) in default OSX Terminal (VimTerminal) and iTerm (VimTerm).
on run {input, parameters}
if (count of input) > 0 then
tell application "iTerm"
if (count of terminals) = 0 then
activate
end if
tell (current terminal)
tell (launch session "Default")
@kennyng
kennyng / README.md
Last active February 16, 2016 01:25
Data Narrative

This is a data narrative created using C3.js for CME151: Introduction to Data Visualization (Stanford University, Winter 2016).

@kennyng
kennyng / README.md
Last active February 15, 2016 02:13
3D Particles Simulation

This is a 3D particles simulation created using three.js for CME151: Introduction to Data Visualization (Stanford University, Winter 2016).

@kennyng
kennyng / README.CanvasRenderer.js
Last active October 23, 2023 17:27
3D Boids Simulation
/**
* @author mrdoob / http://mrdoob.com/
*/
THREE.SpriteCanvasMaterial = function ( parameters ) {
THREE.Material.call( this );
this.type = 'SpriteCanvasMaterial';
@kennyng
kennyng / port_forward.sh
Last active January 29, 2017 04:52
Enable port forwarding for Transmission
#! /bin/bash
######################################################################
# port_forward.sh
# ----------------
# Enable port forwarding for Transmission.
#
# Requirements:
# Private Internet Access user and password as arguments
#
# Usage: