Skip to content

Instantly share code, notes, and snippets.

Date: Mon, 8 Mar 1999 21:44:30 -0500
From: Jim Weirich <[email protected]>
To: [email protected]
Subject: Infinite Loops
I'm packing up my basement in preparation for some construction next
week. In cleaning off my computer bookself, I came across a number of
really old items, some of which may be interesting.
I used to collect infinite loops. I came across my list of loops
Sudo
looks like sudo: test 1
looks like sudo: test 1
Failures:
1) Sudo looks like sudo: test 1
Failure/Error: Given(:sudo) { Sudo.new(bot_with_fatal_logger) }
NameError:
use Time::HiRes qw(time);
my $then = time();
my $pass = 0;
while (1) {
my $now = time();
if ($now < $then) {
die "$now < $then ($pass)\n";
}
$then = $now;
$pass++;
@paulv
paulv / clock.rb
Created April 18, 2012 00:01 — forked from jimweirich/abstract.md
Berlin Clock Kata
# Paul Visscher and Greg Mefford
require 'rspec/given'
require 'time'
class BerlinClock
def self.convert_time(time)
t = Time.parse(time)
clock = ""
1. 192.168.11.1 0.0% 6 0.9 0.9 0.9 1.1 0.1
2. 10.167.0.1 0.0% 6 8.3 9.8 8.3 13.2 1.8
3. ae0-1000.cr02.blasohdp.swo.rr.com 0.0% 6 11.7 16.6 10.2 42.4 12.6
4. ae1.tr00.clmkohpe.mwrtn.rr.com 0.0% 6 14.2 14.0 12.3 14.9 1.1
5. ae-9-0.cr0.chi30.tbone.rr.com 0.0% 6 26.2 25.9 24.6 27.0 0.9
6. 107.14.17.147 0.0% 6 26.7 25.7 24.4 27.4 1.2
7.
@paulv
paulv / urinal_etiquette.rb
Created February 22, 2012 01:00 — forked from st23am/urinal_etiquette.rb
Test Problem
# Paul Visscher and Josh Mills
require 'rspec/given'
class BathroomEtiquette
def initialize(stalls, line)
@stalls = stalls
@line_exists = line
@stalls_hash = make_stalls_hash(stalls)
end
ruby-mode 1.1 indents the following code like this
if true
val = string.split(/=/)
puts val
end
The puts line should be indented so that it matches the val line.
If you look at line 522 of ruby-mode.el (version 1.1, from elpa, I suspect other versions have the same code at possibly different line numbers) it says
+ : 1 > . /home/paulv/.rvm/scripts/rvm
++ /scripts/rvm : 8 > export HOME rvm_prefix rvm_user_install_flag rvm_path
++ /scripts/rvm : 9 > HOME=/home/paulv
++ /scripts/rvm : 11 > : rvm_stored_umask:0022
++ /scripts/rvm : 12 > (( 0 == 0 ))
++ /scripts/rvm : 14 > for rvmrc in /etc/rvmrc '"$HOME/.rvmrc"'
++ /scripts/rvm : 16 > [[ -f /etc/rvmrc ]]
++ /scripts/rvm : 14 > for rvmrc in /etc/rvmrc '"$HOME/.rvmrc"'
++ /scripts/rvm : 16 > [[ -f /home/paulv/.rvmrc ]]
++ /scripts/rvm : 18 > grep '^\s*rvm .*$' /home/paulv/.rvmrc
+ . /home/paulv/.rvm/scripts/rvm
++ export HOME rvm_prefix rvm_user_install_flag rvm_path
++ HOME=/home/paulv
++ : rvm_stored_umask:0022
++ (( 0 == 0 ))
++ for rvmrc in /etc/rvmrc '"$HOME/.rvmrc"'
++ [[ -f /etc/rvmrc ]]
++ for rvmrc in /etc/rvmrc '"$HOME/.rvmrc"'
++ [[ -f /home/paulv/.rvmrc ]]
++ grep '^\s*rvm .*$' /home/paulv/.rvmrc
# ruby 1.9.3 was released today. One of the notes in the NEWS file says
#
# * yaml
# * The default YAML engine is now Psych. You may downgrade to syck by setting
# YAML::ENGINE.yamler = 'syck'.
#
# I assumed that psych would be faster than syck, so I ran a test. timeline.yml is
# 984K of twitter timeline json converted to yaml.
require 'yaml'