Skip to content

Instantly share code, notes, and snippets.

View bovi's full-sized avatar

Daniel Bovensiepen Li bovi

View GitHub Profile
@bovi
bovi / ruby.taobao.org.rb
Created August 6, 2012 19:33
ruby.taobao.org
boviAir:~ daniel$ curl -I http://rubygems.org/gems/gx-1.0.0.gem
HTTP/1.1 302 Moved Temporarily
Server: nginx/1.2.2
Date: Mon, 06 Aug 2012 19:35:54 GMT
Content-Type: text/html
Content-Length: 160
Connection: keep-alive
Location: http://ruby.taobao.org/gems/gx-1.0.0.gem
@bovi
bovi / segfault_mruby.rb
Created May 25, 2012 20:15
A file to segfault mruby
{ 'key' => 1 }
{ 'key' => 1 }
{ 'key' => 1 }
{ 'key' => 1 }
{ 'key' => 1 }
{ 'key' => 1 }
{ 'key' => 1 }
{ 'key' => 1 }
{ 'key' => 1 }
{ 'key' => 1 }
@bovi
bovi / segmentation_fault.rb
Created May 17, 2012 04:19
Segmentation fault: 11 for mruby
def t_method(args); end
t_method('x') {}
t_method('x') {}
t_method('x') {}
t_method('x') {}
t_method('x') {}
t_method('x') {}
t_method('x') {}
t_method('x') {}
--- ruby18-growl.rb 2005-11-14 21:15:15.000000000 -0800
+++ ruby-growl.rb 2009-11-22 00:47:06.000000000 -0800
@@ -2,7 +2,7 @@
$TESTING = false unless defined? $TESTING
-require 'md5'
+require 'digest/md5'
require 'socket'
@bovi
bovi / gist:239373
Created November 20, 2009 09:07
Translation plugin for Termtter
# -*- coding: utf-8 -*-
# this plugin is detecting the language of a tweet and
# translate it to your language, if you can't understand
# the specific language
#
# configuration:
# add to your .termtter/config some additional stuff
# which language you prefer to read?
# - config.mylang = 'en'
boviAir$ irb-trunk
irb(main):001:0> class Peng; end
=> nil
irb(main):002:0> s = "Peng"
=> "Peng"
irb(main):003:0> klass = Kernel.const_get s.to_sym
=> Peng
irb(main):004:0> klass.new
=> #<Peng:0x000001008f6898>
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
require "json"
JSON.parse "{}" #=> {}
JSON.parse %Q( { "key": "value"} ) # => {"key"=>"value"}
@bovi
bovi / gist:59696
Created February 7, 2009 00:17
Output of testing ruby-hmac with Ruby 1.9
boviAir:test danielbovensiepen$ ruby19 -rrubygems ./test_hmac.rb
Loaded suite ./test_hmac
Started
EEEEEEEEEE.
Finished in 0.002584 seconds.
1) Error:
test_hmac_md5_1(TestHMAC):
NoMethodError: undefined method `reset_key' for nil:NilClass
/Users/danielbovensiepen/Programs/ruby/lib/ruby19/gems/1.9.1/gems/ruby-hmac-0.3.2/lib/hmac.rb:111:in `ensure in hexdigest'