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
# One-off script I wrote to slurp sample sentences off http://smart.fm | |
require 'rubygems' | |
require 'open-uri' | |
require 'hpricot' | |
def cleanup_text(str) | |
# str = str.gsub /<\/?b>/, "" # Human readable | |
str = str.gsub /\s+/, " " | |
return str.strip |
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 "mechanize" | |
@mechanize = WWW::Mechanize.new{|agent| agent.user_agent_alias = "Linux Mozilla"} | |
STDOUT.sync = false | |
def fetch_data(url) | |
STDERR.puts "fetching #{url}" | |
urls = @mechanize.get(url).search("a").map{|x| x['href']}; |
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
= A submission script for AizuOnlineJudge(AOJ; http://rose.u-aizu.ac.jp/onlinejudge/index.jsp ). | |
== Requirement | |
- Ruby1.9.x | |
- Mechanize (execute '$ gem install mechanize' if you don't have it) | |
== How to use. | |
1. Edit submit.auth.yaml with your AOJ id and Password. | |
2. Place your answer program XXXX.c in the same directory (XXXX is the problem id). | |
3. $ ruby submit.rb XXXX |
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 'rubygems' | |
require 'mechanize' | |
require 'nokogiri' | |
require 'kconv' | |
require 'open-uri' | |
USER = 'username' | |
PASS = 'passpass' |
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 -Ku | |
# only needs mech/noko retrievs goog link/titf | |
args = ARGV | |
if args.length == 0 | |
puts "Usage: ggrks [-n num] [-p page] [query]" | |
puts "Try `gglks --help' for more information." | |
exit | |
end |