Skip to content

Instantly share code, notes, and snippets.

@howeyc
howeyc / watchalldirs.go
Created February 12, 2013 12:56
Watch for created directories.
package main
import (
"log"
"os"
"path/filepath"
"github.com/howeyc/fsnotify"
)
@mwunsch
mwunsch / emoji_image_replace.js
Last active August 13, 2023 21:44
Detect emoji unicode on a page, replace it with images (supplied by GitHub, for now). Goes great in your ~/.js
/**
*
* Here's a thing that will look through all the text nodes of a document, and
* upon encountering an emoji codepoint, will replace it with an image.
* For now, those images are pulled from GitHub, which isn't very nice, so I
* need to find a more suitable host.
*
* Much of this code was gleaned from staring at the minified GitHub JS.
*
* Copyright (c) 2013 Mark Wunsch. Licensed under the MIT License.
@aaronjensen
aaronjensen / edit_data_bag.rb
Created November 21, 2012 04:39
Edit encrypted data bags for use with chef-solo and knife-solo
#!/usr/bin/env ruby
Dir.chdir File.join(__FILE__, "../..")
unless ENV['EDITOR']
puts "No EDITOR found. Try:"
puts "export EDITOR=vim"
exit 1
end
unless ARGV.count == 2
@pearkes
pearkes / gist:4069203
Created November 13, 2012 23:45
My shell prompt, with Vagrant and Git status.
# Example: http://s.jack.ly/iXhJ
prompt() {
PS1="${GREEN}\W\$(parse_git_branch) $BROWN\$(parse_vm_state) ${GREEN}→ ${GREY}"
PS2="\[[33;1m\]continue \[[0m[1m\]> "
}
parse_git_branch() {
@srid
srid / subcommand.go
Created October 24, 2012 22:52
golang simple subcommand parser
// A simple sub command parser based on the flag package
package subcommand
import (
"flag"
"fmt"
"os"
)
type subCommand interface {
@holman
holman / cray.md
Created October 15, 2012 19:37
Dropbox is cray

Hi Zach,

We’re working to make it easier for your Dropbox for Teams administrators to manage all the stuff you and your teammates have in your Teams account. Soon, we’ll be releasing new features for admins to manage the security of your team’s stuff and make it easier for them to help when things go wrong.

In some cases, your admin may need the flexibility to take some actions on your Teams account, such as helping to manage shared folders or restoring access if you get locked out of your account. In order to clarify that admins may have access to team member accounts when managing the team, we're updating our Dropbox for Teams Agreement and Privacy Policy.

You might have some personal files in your Teams account that you’d like to move to a personal account. For example, if you want to keep vacation pictures in a different account from your latest Excel spreadsheet, you can use this online guide to move your files:

View the new agreement and get started here

@sjl
sjl / nextlast.vim
Created September 21, 2012 15:36
next/last text objects
" Next and Last {{{
" Motion for "next/last object". "Last" here means "previous", not "final".
" Unfortunately the "p" motion was already taken for paragraphs.
"
" Next acts on the next object of the given type in the current line, last acts
" on the previous object of the given type in the current line.
"
" Currently only works for (, [, {, b, r, B, ', and ".
"
@iros
iros / API.md
Created August 22, 2012 14:42
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@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

@eonnen
eonnen / gist:2647948
Created May 9, 2012 18:52
Sample ZK Configuration
# The number of milliseconds of each tick
tickTime=300
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
dataDir=/home/erik/var/data/zookeeper