Skip to content

Instantly share code, notes, and snippets.

View yangsu's full-sized avatar

Yang Su yangsu

  • San Francisco, CA
  • X @ys65
View GitHub Profile
@yangsu
yangsu / CurveFollow.pde
Created April 6, 2012 18:47
Curve Following demo for Processing
/*
Simple Curve following code
Use mouse to draw a curve, then an ellipse will animate by following the curve
Controls
= to increase the speed
- to decrease the speed
s to show points
*/
@yangsu
yangsu / pre-commit.sh
Created August 2, 2012 18:20
pre-commit git hook for crushing images
#!/bin/sh
# to use, save this file as .git/hooks/pre-commit in your git repo
# make sure to add execute permissions using: chmod +x .git/hooks/pre-commit
command -v pngcrush >/dev/null 2>&1 || {
echo "\033[1mPlease install pngcrush to reduce images size before commit\033[0m"
echo "Install pngcrush with the following:"
echo "\t \033[1mbrew install pngcrush\033[0m"
echo "OR"
echo "\t Site: \033[1m\033[4mhttp://pmt.sourceforge.net/pngcrush/\033[0m"
echo "\t Download: \033[1m\033[4mhttp://sourceforge.net/projects/pmt/files/\033[0m"
@yangsu
yangsu / repositories.json
Created September 13, 2012 16:46
Repositories.json for sublime-vhdl
{
"schema_version": "1.2",
"repositories": [
"http://sublime.wbond.net/packages.json",
"https://github.com/yangsu/sublime-vhdl",
"https://github.com/SublimeText"
],
"package_name_map": {
"sublime-vhdl": "VHDL"
},
@yangsu
yangsu / installldap.sh
Created November 27, 2012 08:03
Script for installing openldap on linux machines locally without sudo permissions
#!/bin/sh
BASHRC='~/.bashrc'
BINDIR='~/local/bin'
mkdir -p $BINDIR
cd $BINDIR
# Install db4
DBVERSION='db-4.8.30.NC'
DBBINPATH="$BINDIR/db4"
@yangsu
yangsu / Handwriting.pde
Created December 7, 2012 04:51
Simple Processing Sketch to demo using handwriting input to create circles
ArrayList<ArrayList<PVector>> shapes = new ArrayList<ArrayList<PVector>>();
ArrayList<ArrayList<PVector>> paths = new ArrayList<ArrayList<PVector>>();
ArrayList<PVector> current = new ArrayList<PVector>();
ArrayList<Circle> circles = new ArrayList<Circle>();
void setup() {
size(800, 800);
strokeWeight(2);
ellipseMode(RADIUS);
smooth();
@yangsu
yangsu / gist:4254608
Last active July 24, 2017 15:16 — forked from lucasfais/gist:1207002
Sublime Text 3 - Useful Shortcuts

Sublime Text 3 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
F12 go to definition
⌘KB toggle side bar
@yangsu
yangsu / Duke-PL-Course-MacOSX-Install.sh
Last active October 12, 2020 01:48
Install script Duke PL Course packages. http://duke-pl-course.github.com/about/
#!/bin/sh
################################################################################
#
# Install Script for
# * Build Tools
# * Homebrew
# * Ruby, Io, Prolog, Scala, Erlang, Clojure, and Haskell using homebrew
#
# Author: Yang Su
# GitHub: https://github.com/yangsu
@yangsu
yangsu / io-example.io
Created January 28, 2013 02:48
Io Tutorial
# Io Tutorial
# Math
1+1 # ==> 2
2 sin # ==> 0.909297
2 sqrt # ==> 1.414214
# Variables
a := 1 # ==> 1
a # ==> 1
b := 2 * 3 # ==> 6
@yangsu
yangsu / ruby-code-example.rb
Created January 28, 2013 02:53
Ruby Code Example
properties = ['object oriented', 'duck typed', 'productive', 'fun']
# => ["object oriented", "duck typed", "productive", "fun"]
properties.each {|property| puts "Ruby is #{property}."}
Ruby is object oriented.
Ruby is duck typed.
Ruby is productive.
Ruby is fun.
# => ["object oriented", "duck typed", "productive", "fun"]
@yangsu
yangsu / ruby-oo.rb
Created January 28, 2013 03:04
Ruby is Purely Object Oriented
42.class # => Fixnum
42.0.class # => Float
"foo".class # => String
[1,2,3].class # => Array
42.methods # shows the methods available on the object