Skip to content

Instantly share code, notes, and snippets.

View flavio's full-sized avatar

Flavio Castelli flavio

View GitHub Profile
@flavio
flavio / gemfile_lock2geminabox.rb
Created February 2, 2012 09:21
Parse Gemfile.lock, download all gems from rubygems and then upload them to a local instance of geminabox
#!/usr/bin/env ruby
require 'rubygems'
require 'bundler'
require 'fileutils'
require 'net/http'
require 'net/https'
require 'uri'
TMP_DIR = "/tmp/gems"
@flavio
flavio / jamendo_downloader.rb
Created April 21, 2012 14:54
jamendo downloader
#!/usr/bin/ruby
require 'rubygems'
require 'open-uri'
require 'json'
require 'ftools'
require 'cgi'
require 'optparse'
@download_dir = nil
@flavio
flavio / ibook-itmap
Created April 23, 2012 09:20
ibook italian keyboard map
# Italian keymap with emacs enhancements
# Beta version Mon May 2 19:57:25 WET DST 1994
# Available for anon. ftp at cnuce_arch.cnr.it:/pub/Linux-local/kbd/it.map
#
# Based on all other keymaps available in Slackware-1.2.0.
#
# '@', '#', '[', and ']' are obtained by AltGr with the appropriate key.
#
# I have added '{', '}', '~', '`', iacute and uacute.
# They can be obtained by AltGr-(, AltGr-), AltGr-=, AltGr-', AltGr-igrave
@flavio
flavio / id3medit.sh
Created April 23, 2012 09:45
id3 multiple edit
#!/bin/bash
counter=0
if [ -n "$1" ]; then
if [[ $1 = "help" ]]; then
echo syntax: id3medit artist album year\(*\) genre\(*\)
echo *=optional
exit 0
else
File.lchmod returns false from #respond_to? FAILED
Expected true to be false
{ } in Object#__script__ at spec/ruby/core/file/lchmod_spec.rb:36
BasicObject(Object)#instance_eval at kernel/common/eval19.rb:45
{ } in Enumerable(Array)#all? at kernel/common/enumerable.rb:102
Array#each at kernel/bootstrap/array.rb:68
Enumerable(Array)#all? at kernel/common/enumerable.rb:102
Array#each at kernel/bootstrap/array.rb:68
Object#__script__ at spec/ruby/core/file/lchmod_spec.rb:3
Kernel.load at kernel/common/kernel.rb:580
nm -g /lib/libc.so.6 | grep chmod
000c39a0 W chmod
000c39e0 W fchmod
000c3a50 T fchmodat
000c3a20 T lchmod
nm -g /lib/libc.so.6 | grep chmod
000c39a0 W chmod
000c39e0 W fchmod
000c3a50 T fchmodat
000c3a20 T lchmod
flavio@roesti ~/hacking/rubinius ±file19_lchmod⚡ » cat test.rb
puts "#{RUBY_ENGINE} - #{RUBY_VERSION}"
puts File.respond_to?(:lchmod)
puts File.lchmod(0777, '/home/flavio/link_to_another_link')
flavio@roesti ~/hacking/rubinius ±file19_lchmod⚡ » ./bin/ruby test.rb
rbx - 1.9.3
true
1
diff --git a/kernel/bootstrap/rubinius18.rb b/kernel/bootstrap/rubinius18.rb
index 10fe27e..7433eab 100644
--- a/kernel/bootstrap/rubinius18.rb
+++ b/kernel/bootstrap/rubinius18.rb
@@ -13,4 +13,8 @@ module Rubinius
def self.binary_string(string)
string
end
+
+ def self.external_encoding_string(string)
{ "data" : [ [ 0, 25, 88, 0, 50, 0, 0, 1, 5 ], [ 0, 44, 156, 0, 50, 0, 0, 2, 30 ], [ 0, 51, 181, 0, 50, 0, 0, 3, 50 ], [ 0, 58, 205, 0, 50, 0, 0, 4, 55 ], [ 0, 69, 244, 0, 50, 1, 0, 5, 50 ], [ 0, 75, 266, 0, 50, 1, 0, 6, 50 ], [ 0, 78, 276, 0, 50, 1, 0, 7, 50 ], [ 0, 85, 301, 0, 50, 1, 0, 8, 50 ], [ 0, 90, 319, 0, 50, 1, 0, 9, 50 ], [ 0, 91, 323, 0, 50, 2, 0, 10, 50 ], [ 0, 93, 330, 0, 50, 2, 0, 11, 50 ], [ 0, 94, 333, 0, 50, 2, 0, 12, 50 ], [ 0, 94, 333, 0, 50, 2, 0, 13, 50 ], [ 0, 95, 337, 0, 50, 2, 0, 14, 50 ], [ 0, 95, 337, 1, 50, 3, 0, 15, 50 ], [ 0, 95, 337, 1, 50, 3, 0, 16, 50 ], [ 0, 95, 337, 1, 50, 3, 0, 17, 50 ], [ 0, 94, 333, 1, 50, 3, 0, 18, 50 ], [ 0, 94, 333, 1, 50, 3, 0, 19, 50 ], [ 0, 93, 330, 1, 50, 4, 0, 20, 50 ], [ 0, 93, 330, 1, 50, 4, 0, 21, 50 ], [ 0, 93, 330, 1, 50, 4, 0, 22, 50 ], [ 0, 92, 326, 1, 50, 4, 0, 23, 50 ], [ 0, 93, 330, 1, 50, 4, 0, 24, 50 ], [ 0, 94, 333, 1, 50, 5, 0, 25, 50 ], [ 0, 94, 333, 2, 50, 5, 0, 26, 50 ], [ 0, 94, 333, 2, 50, 5, 0, 27, 50 ], [ 0, 95, 337, 2, 50, 5,