This file contains 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 'webrick' | |
require 'fileutils' | |
if ARGV.length != 0 | |
root = ARGV.first.gsub('\\', '/') | |
else | |
root = '.' | |
end | |
BACKUP_DIR = 'bak' |
This file contains 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 "uri" | |
(URI::REGEXP.constants - ["PATTERN"]).each do |rc| | |
puts "#{rc}: #{URI::REGEXP.const_get(rc)}" | |
end | |
URI::REGEXP::PATTERN.constants.each do |pc| | |
puts "#{pc}: #{URI::REGEXP::PATTERN.const_get(pc)}" | |
end |
This file contains 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
/*** Array ***/ | |
Array.prototype.random = function() { | |
return this[Math.floor((Math.random()*this.length))]; | |
}; | |
Array.prototype.each = function(fun) { | |
for(var i=0;i<this.length;i++) { | |
fun(this[i]); | |
} |
This file contains 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 | |
status = DATA.flock(File::LOCK_EX | File::LOCK_NB) | |
if status == 0 | |
puts "we have the lock..." | |
sleep | |
else |