Skip to content

Instantly share code, notes, and snippets.

View gist:9747211
### Keybase proof
I hereby claim:
* I am rubenfonseca on github.
* I am rubenfonseca (https://keybase.io/rubenfonseca) on keybase.
* I have a public key whose fingerprint is 1DAC 72C5 CD4A 4387 BB49 CA63 BFD3 29F4 303E 036B
To claim this, I am signing this object:
View gist:62271ea10a5c9a7ed794
unsigned swap16(unsigned arg)
{
return ((arg >> 8) & 0x00FF) | ((arg << 8) & 0xFF00);
}
View gist:116644
diff -ur twinkle-1.4.2/src/protocol.h twinkle-1.4.2_new/src/protocol.h
--- twinkle-1.4.2/src/protocol.h 2009-01-03 16:53:58.000000000 +0000
+++ twinkle-1.4.2_new/src/protocol.h 2009-05-23 15:04:47.000000000 +0100
@@ -29,7 +29,7 @@
#define TCP_PING_PACKET CRLF CRLF
/** Product name */
-#define PRODUCT_NAME "Twinkle"
+#define PRODUCT_NAME "Optimus-SoftPhone"
View gist:125462
<item>
<title>Tiago Farrajota: Nova Gente diz: Queda do 447 com sobreviventes</title>
<link>http://www.prt.sc/r/post/40da93130f223c99c207485bb1b46227/</link>
<description>&lt;img src="http://prt.sc/media/mugshots/tiago_farrajota.png" alt="Tiago Farrajota" align="right" style="float:right;""&gt;&lt;br&gt;
&lt;p&gt;&lt;img src="http://tiagofarrajota.com/imagens/novagentequeda.jpg" /&gt;&lt;/p&gt;
&lt;img src="http://feeds2.feedburner.com/~r/tiagofarrajota/~4/L73vzTk6SpU" height="1" width="1" /&gt;</description>
<author>Tiago Farrajota</author>
<pubDate>Sun, 07 Jun 2009 19:06:52 -0000</pubDate>
<guid>http://www.prt.sc/r/post/40da93130f223c99c207485bb1b46227/</guid></item>
View gist:130921
class User < ActiveRecord::Base
acts_as_authentic do |c|
c.validate_login_field = false
# optional, but if a user registers by openid, he should at least share his email-address with the app
c.validate_email_field = false
# fetch email by ax
c.openid_required_fields = [:email, "http://axschema.org/contact/email"]
# fetch email by sreg
c.openid_optional_fields = ["email"]
end
View gist:192705
% brew list pkg-config
/Users/rubenfonseca/luser/homebrew/Cellar/pkg-config/0.23/AUTHORS
/Users/rubenfonseca/luser/homebrew/Cellar/pkg-config/0.23/bin/pkg-config
/Users/rubenfonseca/luser/homebrew/Cellar/pkg-config/0.23/ChangeLog
/Users/rubenfonseca/luser/homebrew/Cellar/pkg-config/0.23/COPYING
/Users/rubenfonseca/luser/homebrew/Cellar/pkg-config/0.23/README
/Users/rubenfonseca/luser/homebrew/Cellar/pkg-config/0.23/share/aclocal/pkg.m4
/Users/rubenfonseca/luser/homebrew/Cellar/pkg-config/0.23/share/man/man1/pkg-config.1
View gist:192706
checking pkg-config is at least version 0.7... yes
checking for GLIB - version >= 2.6.0... no
*** Could not run GLIB test program, checking why...
*** The test program failed to compile or link. See the file config.log for the
*** exact error that occured. This usually means GLIB is incorrectly installed.
*** trying without -lgmodule
checking for pkg-config... (cached) /Users/rubenfonseca/luser/homebrew/bin/pkg-config
checking pkg-config is at least version 0.7... yes
checking for GLIB - version >= 2.6.0... no
*** Could not run GLIB test program, checking why...
View gist:192707
configure:24371: gcc-4.2 -o conftest -O3 -march=nocona -mfpmath=sse -mmmx -msse4.1 -w -pipe -fomit-frame-pointer -mmacosx-version-min=10.5 -Wall -I/Users/rubenfonseca/luser/homebrew/Cellar/glib/2.20.5/include/glib-2.0 -I/Users/rubenfonseca/luser/homebrew/Cellar/glib/2.20.5/lib/glib-2.0/include -I/Users/rubenfonseca/luser/homebrew/include -L/Users/rubenfonseca/luser/homebrew/lib conftest.c -L/Users/rubenfonseca/luser/homebrew/Cellar/glib/2.20.5/lib -lglib-2.0 -lintl >&5
ld: library not found for -lintl
collect2: ld returned 1 exit status
View filter.rb
require 'mq'
require 'twitter/json_stream'
username = ARGV.shift
password = ARGV.shift
raise "need username and password" if !username or !password
AMQP.start(:host => 'localhost') do
twitter = MQ.new.fanout('twitter')
View server.rb
require 'em-websocket'
require 'uuid'
require 'mq'
uuid = UUID.new
EventMachine::WebSocket.start(:host => "0.0.0.0", :port => 8080) do |ws|
ws.onopen do
puts "WebSocket opened"