Skip to content

Instantly share code, notes, and snippets.

@nurse
nurse / gist:2779978
Created May 24, 2012 07:07
chkbuild用config.ru for sqale
class Rack::File
alias _serving serving
def serving(env)
_serving(env).tap do |status, headers, body|
path = env['PATH_INFO']
if path.end_with?('/rss')
headers["Content-Type"] = 'application/rss+xml'
elsif path.end_with?('.gz')
headers["Content-Type"] = Rack::Mime.mime_type(::File.extname(path[0..-4]), 'text/plain')
headers["Content-Encoding"] = 'gzip'
@nurse
nurse / gist:2695368
Created May 14, 2012 18:00
SEGV in __flockfile_internal on NetBSD
% uname -a
NetBSD nbsd.rubyci.org 6.99.4 NetBSD 6.99.4 (GENERIC) #0: Fri Apr 13 00:47:23 JST 2012 naruse@nbsd.rubyci.org:/usr/obj/sys/arch/i386/compile/GENERIC i386
% ./ruby -v
ruby 2.0.0dev (2012-05-14 trunk 35645) [i386-netbsdelf6.99.4]
% cat test/ruby/test_io2.rb
require 'test/unit'
require 'tempfile'
require_relative 'envutil'
class TestIO < Test::Unit::TestCase
@nurse
nurse / .gitconfig
Created April 16, 2012 04:19
Naruse's .gitconfig
[core]
pager = less
editor = vim
[alias]
ci = commit -v
st = status
di = diff
co = checkout
br = branch
l = log --date=local
@nurse
nurse / gist:1995260
Created March 7, 2012 19:17
scan authorized_keys and show fingerprints
#!/usr/bin/env ruby
require 'tempfile'
IO.foreach(File.join(ENV['HOME'], '.ssh/authorized_keys')).each do |line|
Tempfile.open("key") do |f|
f.puts line
f.flush
r = `ssh-keygen -lf #{f.path}`
r.sub!(f.path, '')
puts r if $? == 0
end
@nurse
nurse / gist:1956692
Created March 2, 2012 08:08
Time.parse
diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb
index cf7aad3..bff1d17 100644
--- a/test/ruby/test_time.rb
+++ b/test/ruby/test_time.rb
@@ -744,4 +744,145 @@ class TestTime < Test::Unit::TestCase
end
assert_equal("Insecure: can't modify #{tc}", error.message, bug5036)
end
+
+ def test_time_html5
@nurse
nurse / gist:1843273
Created February 16, 2012 08:23
ext/dbm/extconf.rb of Ruby 1.9.3
Index: ext/dbm/extconf.rb
===================================================================
--- ext/dbm/extconf.rb (revision 34640)
+++ ext/dbm/extconf.rb (working copy)
@@ -5,7 +5,8 @@
if dblib = with_config("dbm-type", nil)
dblib = dblib.split(/[ ,]+/)
else
- dblib = %w(libc db db2 db1 db5 db4 db3 dbm gdbm gdbm_compat qdbm)
+ #dblib = %w(libc db db2 db1 db5 db4 db3 dbm gdbm gdbm_compat qdbm)
@nurse
nurse / gist:1842399
Created February 16, 2012 05:42
Patch to dtcpc
--- dtcpc 2012-02-15 18:48:24.000000000 +0900
+++ /usr/local/sbin/dtcpc 2012-02-16 08:06:45.000000000 +0900
@@ -286,7 +286,7 @@
end
def authenticate(user, seed, pass)
- m = MD5.new
+ m = Digest::MD5.new
m.update(user)
m.update(seed)
@nurse
nurse / gist:1792842
Created February 10, 2012 20:58
Release note of Ruby 1.9.3.1
Ruby 1.9.3-pXXX is released.
This release include a security fixes of the Ruby OpenSSL extension.
And many bugs are fixed in this release.
* Fixed: LLVM/clang support [Bug #5076]
* Fixed: GCC 4.7 support [Bug #5851]
* TODO: autoload
* TODO: ruby-debug
@nurse
nurse / chat.cgi
Created January 7, 2012 18:52
TeaChat with flock(2)
#!/usr/local/bin/perl
# ---------------------------------------------------
#
# TeaChat
$version = '1.8.4b'; # 04/01/19 00:29
# (c) 1998-2004 Toshikazu.S All rights reserved.
#
# URL : http://www.teachat.org/
# E-Mail : webmaster@teachat.org