This file contains 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 'json' | |
require 'net/http' | |
def google(query, service='web', optargs='') | |
url = "http://ajax.googleapis.com/ajax/services/search/#{service}?v=1.0&q=#{URI.encode(query)}&rsz=large" + optargs | |
resp = Net::HTTP.get_response(URI.parse(url)) | |
data = resp.body | |
result = JSON.parse(data)['responseData']['results'] |
This file contains 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 'json' | |
require 'net/http' | |
def google(query, service='web', optargs='') | |
url = "http://ajax.googleapis.com/ajax/services/search/#{service}?v=1.0&q=#{URI.encode(query)}&rsz=large" + optargs | |
resp = Net::HTTP.get_response(URI.parse(url)) | |
data = resp.body | |
result = JSON.parse(data) |
This file contains 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 'scrubyt' | |
require 'cgi' | |
starttime = Time.now | |
google_data = Scrubyt::Extractor.define do | |
query = ['multi monitor'] | |
fetch 'http://awesome.naquadah.org/wiki/index.php?search=%s&go=Go' % query.join('+') | |
link_title "//ul[@class='mw-search-results']//a[@title]", :write_text => true do |
This file contains 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
#!/usr/bin/env ruby | |
class ProcFile | |
include Enumerable | |
def self.parse_file(file) | |
file = File.expand_path(file, "/proc") | |
new(File.new(file)) | |
end |
This file contains 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
#!/usr/bin/env ruby | |
require 'logger' | |
require File.dirname(__FILE__) + '/rules' | |
alias :L :lambda | |
class ParseError < RuntimeError; end | |
module Parser | |
extend self | |
@rule = '' |
This file contains 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
threads = [] | |
foo.each do |bar| | |
threads << Thread.new(bar) do |bar| | |
# insert operations here | |
end | |
end | |
threads.each { |t| t.join } |
This file contains 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
#!/usr/bin/env ruby | |
@paclist = `pacman -Qqe | grep -v "$(pacman -Qmp)"` | |
@listfile = ENV['HOME'] + '/abs/paclist.txt' | |
f = File.new(@listfile, 'w+') | |
f.write(@paclist) | |
f.close |
This file contains 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
# Copyright 2008 Dag Odenhall <dag.odenhall@gmail.com> | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
This file contains 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
#!/usr/bin/ruby -wW2 | |
# AUR search program. Uses the RPC/JSON interface to query the db. Requires | |
# rubygems and the JSON gem. And a whole lot more now! | |
# {{{ Require statements | |
%w{optparse pp cgi open-uri pathname ftools zlib rubygems json facets/version facets/minitar facets/ansicode}.each do |lib| | |
require lib | |
end |
This file contains 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
local tag_properties = | |
{ | |
{ name = '1', layout = layouts[1], mwfact = 0.618033988769 }, | |
{ name = '2', layout = layouts[3] }, | |
{ name = '3', layout = layouts[1] }, | |
{ name = '4', layout = layouts[1] }, | |
{ name = '5', layout = layouts[1] }, | |
{ name = '6', layout = layouts[1] }, | |
{ name = '7', layout = layouts[1] }, | |
{ name = '8', layout = layouts[1] }, |