Skip to content

Instantly share code, notes, and snippets.

View m040601's full-sized avatar

somename123 m040601

View GitHub Profile
# 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
@m040601
m040601 / fetchgists.rb
Created October 14, 2010 10:38 — forked from grantmichaels/fetchgists.rb
fetch gists/from user - very simple mechanize with arg
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']};
@m040601
m040601 / README
Created October 14, 2010 10:19 — forked from biangle/README
post file - mecha/yam/ENV
= 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
@m040601
m040601 / hatena-land-post.rb
Created October 14, 2010 10:13 — forked from shokai/hatena-land-post.rb
hatena posts - noko/mech/openuri
#!/usr/bin/env ruby
require 'rubygems'
require 'mechanize'
require 'nokogiri'
require 'kconv'
require 'open-uri'
USER = 'username'
PASS = 'passpass'
@m040601
m040601 / mechanize gists - 1)ggrks
Created October 14, 2010 10:08 — forked from rummelonp/ggrks
goog link/tit - only mech needed, shebang
#!/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