Skip to content

Instantly share code, notes, and snippets.

View yangchenyun's full-sized avatar

Steven Yang yangchenyun

View GitHub Profile
@rielz
rielz / dom4.webidl
Last active December 6, 2016 05:56
DOM4 WebIDL
// Extracted from http://www.w3.org/TR/dom/
// Copyright © 2015 W3C® (MIT, ERCIM, Keio, Beihang).
// Some Rights Reserved: this document is dual-licensed, CC-BY and W3C Document License.
// W3C liability, trademark and document use rules apply.
exception DOMException {
const unsigned short INDEX_SIZE_ERR = 1;
const unsigned short DOMSTRING_SIZE_ERR = 2; // historical
const unsigned short HIERARCHY_REQUEST_ERR = 3;
const unsigned short WRONG_DOCUMENT_ERR = 4;
@oubiwann
oubiwann / 01-setup.sh
Last active November 11, 2018 13:56 — forked from digego/keynote.scm
Instructions for Running Andrew Sorensen's OSCON 2014 Keynote Performance
$ git clone https://gist.github.com/8b4404e538e61c7996a5.git
$ cd 8b4404e538e61c7996a5
$ mkdir salamander && cd salamander
$ curl -L -O https://archive.org/download/SalamanderDrumkit/salamanderDrumkit.tar.bz2
$ curl -L -O https://github.com/johnsen/drumsandpercussion/blob/master/SalamanderKick/salamanderdrum-kick-r1.tar.gz
$ curl -L -O http://freepats.zenvoid.org/Piano/SalamanderGrandPianoV3_44.1khz16bit.tar.bz2
$ tar xvfz salamanderDrumkit.tar.bz2
$ tar xvfz salamanderdrum-kick-r1.tar.gz
$ mv Kick/kick* OH/
$ tar xvfz SalamanderGrandPianoV3_44.1khz16bit.tar.bz2
@soarez
soarez / ca.md
Last active April 22, 2024 03:01
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@kujohn
kujohn / portforwarding.md
Last active January 21, 2022 02:36
Port forwarding in Mavericks

Port Forwarding in Mavericks


Since Mavericks stopped using the deprecated ipfw (as of Mountain Lion), we'll be using pf to allow port forwarding.

####1. anchor file Create an anchor file under /etc/pf.anchors/<anchor file> with your redirection rule like:

@dergachev
dergachev / GIF-Screencast-OSX.md
Last active April 19, 2024 11:00
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@jehiah
jehiah / dailyphoto.sh
Last active January 15, 2016 20:08
A script to use isightcapture to take photos via crontab on OSX. crontab: `*/10 * * * * sh bin/take_dailyphoto.sh`
#!/bin/sh
# This script takes a photo if the computer has not been idle for longer than a period of time
# it uses isightcapture from https://www.macupdate.com/app/mac/18598/isightcapture
[ -z "$USER" ] && echo "missing variable \$USER " && exit 1
if [ ! -d /Users/$USER/daily_photo ]; then
mkdir -p $/Users/$USER/daily_photo
fi
IDLE=$((`/usr/sbin/ioreg -c IOHIDSystem | sed -e '/HIDIdleTime/!{ d' -e 't' -e '}' -e 's/.* = //g' -e 'q'` / 1000000000 ))
export SUDO_ASKPASS=/Users/$USER/bin/get_pass.sh
@creationix
creationix / about.md
Created November 21, 2012 19:21
Parts of a stream interface

The Basics

Every stream has two basic parts

  • data-in - A chunk or EOF enters the stream
  • data-out - A chunk or EOF leaves the stream

I'm combining both "data" and "end" events since "end" is just a special data packet signifying the end of the stream.

Flow Control

@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@yangchenyun
yangchenyun / .osx
Created November 4, 2011 17:12 — forked from paulstefanort/.osx
Mac OS X Lion Modifications
# Originally from https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Enable the 2D Dock
defaults write com.apple.dock no-glass -bool true
# Disable menu bar transparency
defaults write -g AppleEnableMenuBarTransparency -bool false
# Expand save panel by default
defaults write -g NSNavPanelExpandedStateForSaveMode -bool true
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt