This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'simplegeo' # gem install sg-ruby | |
require 'nokogiri' # gem install nokogiri | |
require 'typhoeus' # gem install typhoeus | |
require 'sinatra' # gem install sinatra | |
## | |
# About: | |
# This little script, sacca.rb allows you to save a gowalla user's checkins to a layer on SimpleGeo. | |
# it's using PubSubHubbub (Gowalla's hub is at http://hub.gowalla.com/) to subscribe to the Atom feed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
merb : worker (port 4000) ~ undefined method `closed?' for nil:NilClass - (NoMethodError) | |
/usr/lib/ruby/1.8/net/http.rb:1060:in `request' | |
/usr/share/chef-server-api/lib/../../chef-solr/lib/chef/solr.rb:58:in `solr_select' | |
/usr/share/chef-server-api/lib/../../chef-solr/lib/chef/solr/query.rb:63:in `raw' | |
/usr/share/chef-server-api/lib/../../chef-solr/lib/chef/solr/query.rb:84:in `search' | |
/usr/share/chef-server-api/app/controllers/search.rb:48:in `show' | |
/usr/lib/ruby/1.8/merb-core/controller/abstract_controller.rb:315:in `send' | |
/usr/lib/ruby/1.8/merb-core/controller/abstract_controller.rb:315:in `_call_action' | |
/usr/lib/ruby/1.8/merb-core/controller/abstract_controller.rb:289:in `_dispatch' | |
/usr/lib/ruby/1.8/merb-core/controller/merb_controller.rb:252:in `_dispatch' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
memory_usage = `ps -o rss= -p #{Process.pid}`.to_i # in kilobytes | |
puts memory_usage | |
# $ ruby mem.rb | |
# 8864 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "addressable/uri" | |
uri = Addressable::URI.parse("http://example.com/path/to/resource/") | |
while true | |
uri = Addressable::URI.parse("http://example.com/path/to/resource/#{rand(10000)}") | |
sleep 10 | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'simplegeo' | |
require 'sinatra' | |
require 'nokogiri' | |
#set :port, 8084 | |
SimpleGeo::Client.set_credentials('', '') | |
# Accepts subscriptions vcerification and unsubscription verification | |
get '/ok' do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<rss version="2.0"> | |
<channel> | |
<generator>NFE/1.0</generator> | |
<title>Business - Google News</title> | |
<link>http://news.google.com?ned=us&hl=en</link> | |
<language>en</language> | |
<webMaster>[email protected]</webMaster> | |
<copyright>&copy;2010 Google</copyright> | |
<pubDate>Thu, 12 Aug 2010 20:22:17 GMT+00:00</pubDate> | |
<lastBuildDate>Thu, 12 Aug 2010 20:22:17 GMT+00:00</lastBuildDate> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class File | |
def self.canonical(_path) | |
_path.split("/").inject([]) { |p,n| | |
case n | |
when "." | |
p | |
when ".." | |
p.pop | |
p | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<status feed="http://domain.tld/feed.xml" xmlns="http://superfeedr.com/xmpp-pubsub-ext"> | |
<http code="200">9718 bytes fetched in 1.462708s : 2 new entries.</http> | |
<next_fetch>2010-05-10T11:19:38-07:00</next_fetch> | |
<period>900</period> | |
<last_fetch>2010-05-10T11:19:38-07:00</last_fetch> | |
<last_parse>2010-05-10T11:17:19-07:00</last_parse> | |
<last_maintenance_at>2010-05-10T09:45:08-07:00</last_maintenance_at> | |
<entries_count_since_last_maintenance>5</entries_count_since_last_maintenance> | |
<tilte>Lorem Ipsum</tilte> | |
</status> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'em-http' | |
require 'time' | |
#"{\"modified\":1282228860,\"etag\":\"NaTRM8p2KwPYAS3C82mbgEwF2QA\",\"period\":43200,\"entries_count\":0,\"url\":\"http://shannoncarlson.tumblr.com/rss\",\"last_maintenance_at\":1282229793}" | |
EventMachine.run { | |
http = EventMachine::HttpRequest.new('http://shannoncarlson.tumblr.com/rss').get :timeout => 10, :head => {'If-None-Match' => "NaTRM8p2KwPYAS3C82mbgEwF2QA", 'If-Modified-Since' => Time.at(1282228860).httpdate}, :redirects => 5 | |
http.callback { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sinatra' | |
require 'rack/facebook' | |
set :port, 3000 | |
use Rack::Facebook, :app_name => "PubSubHubbub Subscriber", :application_secret => "hah", :api_key => "huh" | |
get '/' do | |
"Hello!" |