Skip to content

Instantly share code, notes, and snippets.

[hukl@eight /Volumes/Data/Source]$ git clone http://github.com/luislavena/sqlite3-ruby.git
Cloning into sqlite3-ruby...
remote: Counting objects: 1957, done.
remote: Compressing objects: 100% (677/677), done.
remote: Total 1957 (delta 1220), reused 1854 (delta 1140)
Receiving objects: 100% (1957/1957), 308.04 KiB | 162 KiB/s, done.
Resolving deltas: 100% (1220/1220), done.
[hukl@eight /Volumes/Data/Source]$ cd sqlite3-ruby/
[hukl@eight /Volumes/Data/Source/sqlite3-ruby:master]$ ruby setup.rb config
---> lib
source :rubygems
gem "nokogiri", :git => "git://github.com/tenderlove/nokogiri.git"
require 'openssl'
require 'socket'
header = <<HEADER
GET / HTTP/1.1
Host: example.com
Origin: localhost
Content-Length: 0
Content-Type: text/plain
Connection: close\r\n\r\n
require 'async_sinatra'
class App < Sinatra::Base
register Sinatra::Async
aget '/' do
timed_out = false
timeout = EM::Timer.new(7) do
timed_out = true
require 'async_sinatra'
class App < Sinatra::Base
register Sinatra::Async
@next_id = 0
def self.next_id
@next_id += 1
end
[hukl@eight ~/server/v3:v3]$ gem list
*** LOCAL GEMS ***
[hukl@eight ~/server/v3:v3]$ rvm gemset create hoccerv3
'hoccerv3' gemset created (/Volumes/Data/RVM/rvm/gems/ruby-1.9.2-p0@hoccerv3).
[hukl@eight ~/server/v3:v3]$ rvm use 1.9.2@hoccerv3
info: Using /Volumes/Data/RVM/rvm/gems/ruby-1.9.2-p0 with gemset hoccerv3
[hukl@eight ~/server/v3:v3]$ gem install bundler --pre
[hukl@eight /Volumes/Data/Downloads/forked-daapd-0.12]$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
[hukl@eight /Volumes/Data/Downloads/forked-daapd-0.12]$ make
make all-recursive
Making all in src
gcc -DHAVE_CONFIG_H -I. -I.. -D_GNU_SOURCE -I/usr/local/Cellar/zlib/1.2.5/include -D_REENTRANT -I/usr/local/Cellar/avahi/0.6.27/include -I/usr/local/Cellar/sqlite/3.7.2/include -I/usr/local/Cellar/ffmpeg/0.6/include -I/usr/local/Cellar/confuse/2.7/include -D_THREAD_SAFE -D_REENTRANT -I/usr/local/include -I/usr/local/Cellar/libgcrypt/1.4.6/include -I/usr/local/Cellar/libgpg-error/1.9/include -DDATADIR="\"/usr/local/share/forked-daapd\"" -DCONFDIR="\"/usr/local/etc\"" -DSTATEDIR="\"/usr/local/var\"" -g -O2 -Wall -D_LARGEFILE_SOURCE -MT forked_daapd-main.o -MD -MP -MF .deps/forked_daapd-main.Tpo -c -o forked_daapd-main.o `test -f 'main.c' || echo './'`main.c
main.c: In function ‘main’:
main.c:745: warning: label ‘signalfd_fail’ defined but not used
main.c:433: warning: unused variable ‘sigfd’
main.c: At top level:
main.c:75: warning: ‘main_exit’ defined but not used
main.c: In function ‘main’:
def foo a
puts "hey" + a
end
["1","2","3"].each(&method(:foo))
@hukl
hukl / parser_1.rb
Created February 12, 2011 13:08
Simple approach of parsing a large logfile
require 'time'
class LogfileParser
# Regexp to match the timestamps in the apache common log format
TIME_REGEXP = /\[\d{2}\/\w{3}\/\d{4}\:\d{2}:\d{2}:\d{2}\s.{5}\]/
def initialize path, starting_at
raise ArgumentError unless File.exists?( path )