Skip to content

Instantly share code, notes, and snippets.

View tysonmote's full-sized avatar
🤠
code cowboy

Tyson Mote tysonmote

🤠
code cowboy
View GitHub Profile
1367380380 3852840.000000
1367380440 3889616.000000
1367380500 3857600.000000
1367380560 3862477.333333
1367380620 3876914.666667
1367380680 3839693.333333
1367380740 3852773.333333
1367380800 3827573.333333
1367380860 3827392.000000
1367380920 3827498.666667
1367380560 3862477.333333
1367380620 3876914.666667
1367380680 3839693.333333
1367380740 3852773.333333
1367380800 3827573.333333
1367380860 3827392.000000
1367380920 3827498.666667
1367380980 3827685.333333
1367381040 3824862.666667
1367381100 3814248.000000
@tysonmote
tysonmote / gist:5632433
Last active September 7, 2016 16:30
Stop overcomplicating things, JavaScript nerds. You need, like, 20 lines of JS, max, to do a modal window. Stop writing 500-line JS library monstrosities with painfully slow animations that break if you so much as breathe on them. Jesus.
<a href="#" data-modal="#myModal">Open</a>
<div class="modal hide" id="myModal">
<button class="close-modal">X</button>
(stuff)
</div>
require 'redis'
def long_running_command
t = Thread.new do
conn = Redis.new
conn.client.call(["DEBUG", "SLEEP", "1"])
end
sleep 0.1 # let it connect before we return
t
end
CFEngine policy files:
bundle common env {
vars:
"hosts" slist => { "foo", "bar" };
}
...
bundle agent handle_hosts {
~ % brew doctor
Your system is ready to brew.
~ % brew install go --cross-compile-common
==> Downloading https://go.googlecode.com/files/go1.1.2.src.tar.gz
Already downloaded: /Library/Caches/Homebrew/go-1.1.2.tar.gz
==> ./make.bash --no-clean
==> ./make.bash --no-clean
==> ./make.bash --no-clean
/private/tmp/go-OXep/go/src/cmd/5l/../ld/lib.c:661:9: error: no case matching constant switch condition '53' [-Werror]
switch(thechar){
~ % brew install go
==> Downloading https://go.googlecode.com/files/go1.1.2.src.tar.gz
Already downloaded: /Library/Caches/Homebrew/go-1.1.2.tar.gz
==> ./make.bash --no-clean
==> Caveats
The go get command no longer allows $GOROOT as
the default destination in Go 1.1 when downloading package source.
To use the go get command, a valid $GOPATH is now required.
As a result of the previous change, the go get command will also fail
~ % brew --config
HOMEBREW_VERSION: 0.9.4
ORIGIN: http://github.com/mxcl/homebrew.git
HEAD: c7f398392ac2c948b3e09ae4db36f7feed7aa376
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit ivybridge
OS X: 10.8.4-x86_64
Xcode: 5.0 => /Applications/Xcode5-DP6.app/Contents/Developer
CLT: 1.0.0.9000000000.1.1249367152
// BenchmarkBytesBufferNoReuse 2000000 790 ns/op 152 B/op 6 allocs/op
// BenchmarkBytesBufferWithReuse 5000000 675 ns/op 40 B/op 5 allocs/op
// BenchmarkBufioWriterNoReuse 1000000 2273 ns/op 4200 B/op 7 allocs/op
// BenchmarkBufioWriterWithReuse 5000000 541 ns/op 40 B/op 5 allocs/op
// BenchmarkFmt 1000000 1894 ns/op 176 B/op 5 allocs/op
package main
import (
"bufio"
"bytes"

Start master in another window with redis-server master.conf

Fill master server with 10% keys that will expire very soon and 90% keys that wont expire for a while:

% ruby fill.rb | redis-cli --pipe -p 9998
All data transferred. Waiting for the last reply...
Last reply received from server.
errors: 0, replies: 1000002

Wait a few seconds and then start slave in another window with redis-server slave.conf