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
| 1. Make directory. | |
| overworked ~ $ mkdir lists | |
| 2. Get in it. | |
| overworked ~ $ cd lists | |
| 3. Make a file of awesome. |
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
| From 66cdf0a972d52822e6e0c3e8809c36692ca158e8 Mon Sep 17 00:00:00 2001 | |
| From: Jerry Chen <jerry@apache.org> | |
| Date: Sat, 17 Jul 2010 14:39:18 -0500 | |
| Subject: [PATCH] Added 'version' command, tied to REDIS_VERSION | |
| --- | |
| src/redis-cli.c | 3 ++- | |
| src/redis.c | 11 ++++++++++- | |
| src/redis.h | 1 + | |
| 3 files changed, 13 insertions(+), 2 deletions(-) |
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
| From 66cdf0a972d52822e6e0c3e8809c36692ca158e8 Mon Sep 17 00:00:00 2001 | |
| From: Jerry Chen <jerry@apache.org> | |
| Date: Sat, 17 Jul 2010 14:39:18 -0500 | |
| Subject: [PATCH] Added 'version' command, tied to REDIS_VERSION | |
| --- | |
| src/redis-cli.c | 3 ++- | |
| src/redis.c | 11 ++++++++++- | |
| src/redis.h | 1 + | |
| 3 files changed, 13 insertions(+), 2 deletions(-) |
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
| # clean start | |
| >> words.drop | |
| => true | |
| # unique index on 'ngram' and 'n' | |
| >> words.create_index([[:ngram, 1], [:n, 1]], true) | |
| => "ngram_1_n_1" | |
| # insert 'bar foo' | |
| >> words.update({:n => 2, :ngram => 'bar foo'.split}, {'$inc' => {:freq => 1}}, {:upsert => true}) |
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 'test/unit' | |
| class Context | |
| RE_PAIRS = [[/#([a-z0-9_]+)/, | |
| '<a href="http://search.twitter.com/search?q=#\1">' + | |
| '#\1</a>'], | |
| [/@([a-z0-9_]+)/, | |
| '<a href="http://twitter.com/\1">@\1</a>']] |
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 | |
| # | |
| # Munin script for Abnormal Return Codes in haproxy logs | |
| # | |
| require 'time' | |
| LOG_FILE="/var/log/haproxy.log" | |
| TAIL_LINES = 1500 | |
| THRESHOLD_MINUTES = 5 |
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
| import unittest | |
| # regular ole object | |
| class Image: | |
| def __init__(self): | |
| self.os = 'centos' | |
| self.version = 5.3 | |
| self.region = 'us-east' | |
| self.size = 'floor' |
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
| Given: "well i want to create a reasonably well oiled machine that is flexible and recognizes that we'll always have spotty information" | |
| Prove: "matz is the killer of dinosaurs?" | |
| 1. The "well oiled machine" is a metaphor for a Ruby-on-Rails application | |
| 2. Well oiled machines require oil | |
| 3. Oil comes from fossil fuels | |
| 4. Fossil fuels originate from buried dead organisms over millions of years | |
| 5. A major source of said organisms given this timeframe is the dinosaur | |
| 6. A catalyst for dead dinosaurs would be one who kills them |
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
| $ time ruby test.rb && time ruby test2.rb | |
| real 0m0.358s | |
| user 0m0.270s | |
| sys 0m0.003s | |
| real 0m0.023s | |
| user 0m0.014s | |
| sys 0m0.002s |
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 | |
| FIELDS=%w( req_total req_rendering req_database ) | |
| def output_config | |
| puts <<-END | |
| graph_category App | |
| graph_title Passenger Performance | |
| graph_vlabel time in seconds | |