Skip to content

Instantly share code, notes, and snippets.

View yangchenyun's full-sized avatar

Steven Yang yangchenyun

View GitHub Profile
@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

@soarez
soarez / ca.md
Last active May 3, 2024 00:04
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.

@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 2, 2024 05:55
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:

@dnagir
dnagir / rspec-syntax-cheat-sheet.rb
Created November 5, 2010 09:29
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@kujohn
kujohn / portforwarding.md
Last active April 27, 2024 20:16
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:

@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

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@dansimpson
dansimpson / twilight_pygments.css
Created January 30, 2011 16:57
Pygments stylesheet based on Textmates's Twilight theme
pre.code { background: #181818; padding: 16px; color: #F8F8F8; font-family: Consolas, Monaco,"Lucida Console"; }
pre.code * { font-family: Consolas, Monaco,"Lucida Console"; }
pre.code .hll { background-color: #ffffcc }
pre.code .c { color: #5F5A60; font-style: italic } /* Comment */
pre.code .err { border:#B22518; } /* Error */
pre.code .k { color: #CDA869 } /* Keyword */
pre.code .cm { color: #5F5A60; font-style: italic } /* Comment.Multiline */
pre.code .cp { color: #5F5A60 } /* Comment.Preproc */
pre.code .c1 { color: #5F5A60; font-style: italic } /* Comment.Single */
pre.code .cs { color: #5F5A60; font-style: italic } /* Comment.Special */
@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
@rklemme
rklemme / album.rb
Created October 24, 2009 17:58
Complete file for blog entry "The Complete Class"
require 'yaml'
Track = Struct.new :title, :duration
# An Album represents an audio medium which has title,
# interpret, a pause duration between tracks and a list
# of individual tracks.
class Album
attr_reader :title, :interpret, :pause