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 'ffi' | |
class IO | |
extend FFI::Library | |
ffi_lib FFI::Library::LIBC | |
attach_function :fdwalk_c, :fdwalk, [:pointer, :pointer], :void | |
def self.fdwalk(lowfd) | |
func = FFI::Function.new(:int, [:pointer, :int]){ |cd, fd| |
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
1) Failure: | |
test_self_default_dir(TestGem) [./test/rubygems/test_gem.rb:577]: | |
Expected /\/[Rr]uby\/[Gg]ems\/[0-9.]+/ to match "/Library/Frameworks/JRuby.framework/Gems/1.8". | |
2) Error: | |
test_execute_build(TestGemCommandsCertCommand): | |
Errno::ENOENT: No such file or directory - gem-private_key.pem | |
org/jruby/RubyFile.java:694:in `chmod' | |
/Users/djberge/Repositories/rubygems/lib/rubygems/security.rb:719:in `build_self_signed_cert' | |
org/jruby/RubyIO.java:1139:in `open' |
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
ruby 1.9.3-p194 | |
OSX 10.6 | |
dyld: lazy symbol binding failed: Symbol not found: _ruby_thread_has_gvl_p | |
Referenced from: /opt/local/lib/ruby/gems/1.9.1/gems/ffi-1.0.11/lib/ffi_c.bundle | |
Expected in: flat namespace |
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
>gem search -r -d | |
*** REMOTE GEMS *** | |
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError) | |
bad response Not Found 404 (http://production.cf.rubygems.org/quick/Marshal.4.8/ghostplus-0.0.1.gemspec.rz) |
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
# The "old" way | |
buf_target = "\\??\\" << from_path | |
wide_string = multi_to_wide(buf_target)[0..-3] | |
# REPARSE_JDATA_BUFFER | |
rdb = [ | |
"0xA0000003L".hex, # ReparseTag (IO_REPARSE_TAG_MOUNT_POINT) | |
wide_string.size + 12, # ReparseDataLength | |
0, # Reserved | |
0, # SubstituteNameOffset |
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 'ffi' | |
class MyStruct < FFI::Struct | |
layout(:path, [:char, 2]) # wchar | |
end | |
s = "hello".encode("UTF-16LE") | |
m = MyStruct.new | |
m[:path].to_ptr.put_bytes(0, s, s.bytesize) |
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
>gem search -r ghostplus | |
*** REMOTE GEMS *** | |
ghostplus (0.0.1) | |
>gem search -r -d ghostplus | |
*** REMOTE GEMS *** |
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
jruby 1.6.7.2 (ruby-1.8.7-p357) (2012-05-01 26e08ba) (Java HotSpot(TM) Client VM 1.6.0_31) [Windows 7-x86-java] | |
c:\Users\djberge>jruby --1.9 -S jirb | |
irb(main):001:0> Encoding.default_external | |
=> #<Encoding:Windows-1252> | |
ruby 1.9.3p194 (2012-04-20 revision 35410) [i386-mswin32_100] | |
c:\Users\djberge>irb | |
irb(main):001:0> Encoding.default_external |
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 'ffi' | |
class Windows | |
extend FFI::Library | |
ffi_lib :shell32 | |
attach_function :SHGetFolderPath, :SHGetFolderPathW, [:ulong, :int, :ulong, :ulong, :buffer_out], :ulong | |
def self.folder | |
buf = 0.chr * 1024 |
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
module Foo | |
end | |
class Bar | |
def initialize | |
puts "Hello, this is Bar" | |
end | |
end | |
class Baz |