Skip to content

Instantly share code, notes, and snippets.


Yorick Peterse YorickPeterse

View GitHub Profile
View growth.patch
diff --git a/rss_growth_during_redis_publish.rb b/rss_growth_during_redis_publish.rb
index f6d1526..cecfdef 100755
--- a/rss_growth_during_redis_publish.rb
+++ b/rss_growth_during_redis_publish.rb
@@ -8,6 +8,14 @@ require 'celluloid/io' # Unclear if this is required, or if Celluloid will hand
require 'celluloid/redis'
require 'celluloid/autostart' do
+ loop do
YorickPeterse / basic_lexer.rl
Last active Aug 29, 2015
Basic boilerplate for Ragel and Ruby, extracted from Oga.
View basic_lexer.rl
# Since public domain doesn't exist everywhere in the world and people might
# actually want to use this snippet here's the license (you can leave out
# the lines preceding it):
# Copyright (c) 2014, Yorick Peterse
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
View gist:190a87a31634eea5ef07
#!/usr/bin/env bash
# Small wrapper around the actual command used to start the daemon. This
# wrapper allows us to set various environment variables before Ruby is
# started.
# See the following URLs for more information on these options and their
# values:
View gist:f848b62a81e249067f3b
[yorickpeterse in oga]$ pry -r ./lib/oga
2.1.2p95 >'/div[@class="container"]/div[@class="review"]').parse
=> (xpath
(name nil "div")
(axis "attribute" "class")
(string "container")))
(name nil "div")
View gist:29db9183c79f6ffd7844
2.1.2p95 > require 'csv'
=> true
2.1.2p95 > headers = %w{foo bar}
=> ["foo", "bar"]
2.1.2p95 > row =, [10, 20])
=> #<CSV::Row "foo":10 "bar":20>
2.1.2p95 >
=> [true, true]
2.1.2p95 > headers.first.upcase!
RuntimeError: can't modify frozen String
View app.rb
require 'gir_ffi-gtk3'
require 'sequel'
GirFFI.setup :GtkSource
Thread.abort_on_exception = true
client = Sequel.connect(
View main.go
package main
import (
func main() {
View gist:c861d7140f836f6c622b
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x418efd]
goroutine 16 [running]:
runtime.panic(0x668940, 0x80ae73)
/build/go/src/go-1.3/src/pkg/runtime/panic.c:279 +0xf5
main.(*typeConv).Type(0xc20804e160, 0x7f06feab87c8, 0xc208d700c0, 0x53203, 0xc208d2b801)
/build/go/src/go-1.3/src/cmd/cgo/gcc.go:1288 +0x1f2d
main.(*typeConv).Type(0xc20804e160, 0x7f06feab8730, 0xc208d70060, 0x53203, 0x0)
View gist:37b9c7177cb91a517957
# command-line-arguments
src/sqlgui/main.go:9: syntax error: unexpected semicolon or newline before {
src/sqlgui/main.go:12: non-declaration statement outside function body
src/sqlgui/main.go:14: missing condition in if statement
src/sqlgui/main.go:17: non-declaration statement outside function body
src/sqlgui/main.go:19: non-declaration statement outside function body
src/sqlgui/main.go:21: missing condition in if statement
src/sqlgui/main.go:24: non-declaration statement outside function body
src/sqlgui/main.go:26: non-declaration statement outside function body
src/sqlgui/main.go:28: non-declaration statement outside function body
View gist:b7232a8a7e78bb51626f
$ cloc config lib
283 text files.
282 unique files.
1 file ignored. v 1.60 T=0.46 s (615.6 files/s, 48320.3 lines/s)
Language files blank comment code
Ruby 219 2461 7587 10389