Skip to content

Instantly share code, notes, and snippets.

@manveru
manveru / twicl
Created November 10, 2008 02:52 — forked from leahneukirchen/twicl
#!/usr/bin/env ruby
# -*- ruby -*-
# twitter command line client
# That's What I Call Lame
# 09nov2008 +chris+
require 'json'
require 'open-uri'
%w[hpricot json open-uri].each{|lib| require(lib) }
class Feed
def self.parse(uri)
doc = Hpricot.XML(open(uri))
feed = new(uri)
if doc.at(:item)
feed.parse_rss2(doc)
elsif doc.at(:entry)
@manveru
manveru / gist:54476
Created January 29, 2009 09:10 — forked from Syd/gist:53721
module Base62
CHARS = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a
MOD = CHARS.size # 62
module_function
def encode_packed(string)
encode(string.unpack('H*').at(0).to_i(16))
end
@manveru
manveru / selfmarks.js
Created February 3, 2009 04:06
Ubiquity command to add bookmarks to http://sm.purepistos.com
CmdUtils.CreateCommand({
name: "selfmark",
homepage: "http://manveru.net",
author: { name: "Michael Fellinger", email: "m.fellinger@gmail.com"},
contributors: ["Michael Fellinger"],
license: "MIT",
description: "Tags the current site using selfmarks",
icon: "http://sm.purepistos.net/favicon.ico",
help: "Save the current url to selfmarks with the tags input by the user. Any selected text on the page will be recorded as the note.",
def by_loop
loop do
break if yield
end
end
def by_while
while true
break if yield
end
@manveru
manveru / cgi.rb
Created February 10, 2009 11:55
How to use Bacon & Heckle
require 'spec/helper'
require 'innate/helper/cgi'
require 'heckle'
module Bacon
class HeckleRunner
def initialize(filter, heckle_class = Heckler)
@filter, @heckle_class = filter, heckle_class
end
@manveru
manveru / README
Created February 12, 2009 12:44 — forked from Pistos/README
With this code, CPU usage shoots to 100% when serving the index page.
% gem19 list -l
*** LOCAL GEMS ***
daemons (1.0.10)
diakonos (0.8.7)
@manveru
manveru / get-github-wiki.rb
Created February 19, 2009 03:57
Download github wikis
require 'open-uri'
require 'hpricot'
user, project = ARGV # 'tobi', 'liquid'
fail "get-github-wiki <username> <projectname>" unless user and project
uri = "http://wiki.github.com/#{user}/#{project}"
xpath = "div.sidebar/ul[1]//a"
command = %w[wget -t 2 -mkc --no-parent]
#!/usr/bin/env ruby
# Small CLI tool to make adding selfmarks easier.
#
# @see http://sm.purepistos.net
options = {'host' => 'http://sm.purepistos.net/uri/add_window_add'}
key_file = File.expand_path("~/.config/sm.key")
require 'optparse'