Skip to content

Instantly share code, notes, and snippets.

View shugo's full-sized avatar

Shugo Maeda shugo

  • NaCl
  • Matsue, Shimane, Japan
View GitHub Profile
@shugo
shugo / gist:8684004
Created January 29, 2014 08:41
can't load openssl
excelsior:~$ cd /tmp/ruby-build.20140125230823.3913/ruby-2.1.0
excelsior:ruby-2.1.0$ ./ruby -I. -Ilib -I.ext/x86_64-freebsd10.0 -r openssl -e 0
/tmp/ruby-build.20140125230823.3913/ruby-2.1.0/lib/rubygems/core_ext/kernel_require.rb:55:in `require': /tmp/ruby-build.20140125230823.3913/ruby-2.1.0/.ext/x86_64-freebsd10.0/openssl.so: Undefined symbol "SSL_connect" - /tmp/ruby-build.20140125230823.3913/ruby-2.1.0/.ext/x86_64-freebsd10.0/openssl.so (LoadError)
from /tmp/ruby-build.20140125230823.3913/ruby-2.1.0/lib/rubygems/core_ext/kernel_require.rb:55:in `require'
excelsior:ruby-2.1.0$
@shugo
shugo / gist:8797506
Created February 4, 2014 03:02
earthquake.gem dumped core
defiant:~$ earthquake
_ _ _
___ __ _ _ __| |_| |__ __ _ _ _ __ _| | _____
/ _ \/ _` | '__| __| '_ \ / _` | | | |/ _` | |/ / _ \
| __/ (_| | | | |_| | | | (_| | |_| | (_| | < __/
\___|\__,_|_| \__|_| |_|\__, |\__,_|\__,_|_|\_\___|
|_| v1.0.0
1) open: https://api.twitter.com/oauth/authorize?oauth_token=3w6YqT2ZjbNhZu0Q0wxfLyGFLVC79VK9WXVmV7SjfwE
2) Enter the PIN: 3533056
@shugo
shugo / gist:8799568
Created February 4, 2014 07:39
disabling RUBYOPT using env
#!/bin/sh
exec env -u RUBYOPT ruby -x "$0" "$@"
#!ruby
puts "hello world"
@shugo
shugo / gist:8857621
Created February 7, 2014 05:11
strtoll on FreeBSD 10
excelsior:strtoll_test$ uname -a
FreeBSD excelsior 10.0-RELEASE FreeBSD 10.0-RELEASE #0 r260789: Thu Jan 16 22:34:59 UTC 2014 [email protected]:/usr/obj/usr/src/sys/GENERIC amd64
excelsior:strtoll_test$ cat strtoll_test.c
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
int main() {
printf("%lld\n", strtoll("1000000000000", NULL, 10));
return 0;
@shugo
shugo / t.rb
Created December 7, 2015 01:37
class C
def foo
puts "C#foo"
end
module M
def foo
puts "M#foo"
end
end
diff --git a/vm_method.c b/vm_method.c
index eff6b94..3175ead 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -25,6 +25,7 @@
#define GLOBAL_METHOD_CACHE(c,m) (rb_bug("global method cache disabled improperly"), NULL)
#endif
+static int vm_redefinition_check_flag(VALUE klass);
static void rb_vm_check_redefinition_opt_method(const rb_method_entry_t *me, VALUE klass);
Plugin Error
Errors in plugins? Retry to Update or Configure.
SecurityError
Insecure operation - require
(plugin/amazon.rb):279:in `require'
(plugin/amazon.rb):279:in `amazon_get'
(plugin/amazon.rb):387:in `isbn_image'
(TDiary::Plugin#eval_src):146:in `block in eval_src'
@shugo
shugo / foo.md
Last active April 13, 2016 08:48
  1. foo
    1. bar
      if condition then
        code
      end
      
  2. baz
@shugo
shugo / hidden_test.rb
Last active July 25, 2017 01:10
Using refinements for hidden methods
class Module
def hidden_methods
klass = self
Module.new {
refine klass do
# create an empty refinement for later use
klass.instance_variable_set(:@hidden_method_refinement, self)
end
}
end
@shugo
shugo / gist:f8b2f613baa6ba5079334738e442565b
Created January 24, 2017 03:58
rake-compiler cross-ruby HOST=i686-w64-mingw32 VERSION=2.2.6 fails
installing bundle gems: /home/shugo/.rake-compiler/ruby/i686-w64-mingw32/ruby-2.2.6/lib/ruby/gems/2.2.0 (build_info, cache, doc, extensions, gems, specifications)
/home/shugo/local/lib/ruby/2.5.0/fiddle/import.rb:89:in `rescue in block in dlload': can't load advapi32 (Fiddle::DLError)
from /home/shugo/local/lib/ruby/2.5.0/fiddle/import.rb:86:in `block in dlload'
from /home/shugo/local/lib/ruby/2.5.0/fiddle/import.rb:77:in `collect'
from /home/shugo/local/lib/ruby/2.5.0/fiddle/import.rb:77:in `dlload'
from /home/shugo/.rake-compiler/sources/ruby-2.2.6/lib/securerandom.rb:48:in `<module:AdvApi32>'
from /home/shugo/.rake-compiler/sources/ruby-2.2.6/lib/securerandom.rb:46:in `<module:SecureRandom>'
from /home/shugo/.rake-compiler/sources/ruby-2.2.6/lib/securerandom.rb:42:in `<top (required)>'
from /home/shugo/.rake-compiler/sources/ruby-2.2.6/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/shugo/.rake-compiler/sources/ruby-2.2.6/lib/rubygems/core_ext/kernel_require.rb:54:in `requi