Skip to content

Instantly share code, notes, and snippets.

View jasiek's full-sized avatar

Jan Szumiec jasiek

View GitHub Profile
@jasiek
jasiek / .config
Created August 2, 2013 14:09
Linux/arm 3.6.11 Kernel Configuration for Raspberry PI/QEMU
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm 3.6.11 Kernel Configuration
#
CONFIG_ARM=y
CONFIG_MIGHT_HAVE_PCI=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_HAVE_PROC_CPU=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
@jasiek
jasiek / install-fast-require.sh
Created November 1, 2012 12:05
Installs Ruby 1.9.3-p194 with a patch set for faster require. (http://bugs.ruby-lang.org/issues/7158)
#!/bin/bash
pushd /tmp
COMMITS="8243d294600ca6e635bb617be23f34172e7676ab c23b88eff207744cccc42fa74f991eacdb419957 bf0c8f0fe1643c011fe9fa7dd14faeed604bd797 c7ec412a92e279f7f8d1ae88a2b1673dd64312f6"
PATCHES=""
for f in $COMMITS; do
wget --no-check-certificate https://github.com/gnprice/ruby/commit/$f.patch
PATCHES=$PATCHES,/tmp/$f.patch
done
rvm install -n fast_require 1.9.3-p194 --patch $PATCHES
> java.lang.System.setProperty('java.nio.channels.spi.SelectorProvider','sun.nio.ch.PollSelectorProvider')
ruby -J-Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.PollSelectorProvider -S irb
linux: pid 23484 (java): syscall epoll_create not implemented
WARNING: Error fetching data:
IOError: Function not implemented (http://rubygems.org/latest_specs.4.8.gz)
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
IOError: Function not implemented (http://rubygems.org/gems/bundler-1.2.0.gem)
irb(main):002:0> Net::HTTP.get(URI.parse('http://www.google.com'))
IOError: Function not implemented
from org/jruby/ext/socket/RubyTCPSocket.java:110:in `initialize'
from org/jruby/RubyIO.java:1176:in `open'
from /usr/home/jps/.rvm/rubies/jruby-1.7.0/lib/ruby/1.9/net/http.rb:762:in `connect'
from org/jruby/ext/timeout/Timeout.java:105:in `timeout'
from /usr/home/jps/.rvm/rubies/jruby-1.7.0/lib/ruby/1.9/net/http.rb:762:in `connect'
from /usr/home/jps/.rvm/rubies/jruby-1.7.0/lib/ruby/1.9/net/http.rb:755:in `do_start'
from /usr/home/jps/.rvm/rubies/jruby-1.7.0/lib/ruby/1.9/net/http.rb:744:in `start'
from /usr/home/jps/.rvm/rubies/jruby-1.7.0/lib/ruby/1.9/net/http.rb:454:in `get_response'
require 'rubygems'
require 'net/http/persistent'
require 'pp'
require 'set'
$endpoint = URI.parse('http://localhost:7777/')
$tcpserver = TCPServer.new(44231)
candidates = {}
class Post
include Mongoid::Document
include Mongoid::Timestamps
identity :type => String
field :title, :type => String
field :body, :type => String
end
@jasiek
jasiek / debase256.rb
Created May 24, 2012 12:48
Convert base-256 byte string to base-10
def debase256(string)
string.reverse.bytes.inject([0, 1]) do |(sum, pow), byte|
[pow * byte.ord, pow * 256]
end.first
end