This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Via: http://news.ycombinator.com/item?id=4686338 | |
| https://gist.github.com/3932768 | |
| https://gist.github.com/3933451 | |
| https://gist.github.com/3934073 | |
| https://gist.github.com/3935007 | |
| https://gist.github.com/3935671 | |
| Redisconf Notes: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >> /usr/bin/time -l ruby thebench.rb 30 1000 | |
| Rehearsal -------------------------------------------------------- | |
| fib(30) 0.260000 0.000000 0.260000 ( 0.255475) | |
| 1000 tempfiles 0.120000 0.250000 0.370000 ( 0.429621) | |
| ----------------------------------------------- total: 0.630000sec | |
| user system total real | |
| fib(30) 0.260000 0.000000 0.260000 ( 0.259108) | |
| 1000 tempfiles 0.130000 0.270000 0.400000 ( 0.848950) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env ruby | |
| # | |
| # -*- mode: ruby -*- | |
| # Backup Redis database | |
| # | |
| # This should be placed in the crontab, as in the following example | |
| # (hourly backups) | |
| # | |
| # 0 * * * * /path/to/backup | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Original http://play.golang.org/p/wyxEQ9RRPD | |
| package main | |
| import ( | |
| "bytes" | |
| "fmt" | |
| "math/rand" | |
| "time" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env ruby | |
| BIN = "hipchat".freeze | |
| USAGE =<<EOS | |
| #{BIN}(1) | |
| NAME | |
| #{BIN} -- Simple interface to HipChat | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require_relative "./users" | |
| require_relative "./posts" | |
| Cuba.use JSONAllTheThings | |
| Cuba.define do | |
| on "users" do | |
| run Users | |
| end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env ruby | |
| require "benchmark" | |
| SET = (1..100) | |
| N = (ARGV[0] || 1_000_000).to_i | |
| Benchmark.bm(22) do |r| | |
| r.report("#include? - best case") do | |
| N.times { SET.include?(1) } |
