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
#!/bin/bash | |
url='http://www.last.fm/music/+free-music-downloads?page=1' | |
num=$(wget -O- -q "$url" | awk -vRS="</[aA]>" '/class=\"lastpage\"/ {gsub(/.*>/,""); print}') | |
for((i=1;i<=$num;i++)) | |
do | |
url="http://www.last.fm/music/+free-music-downloads?page=$i" | |
wget -O- -q $url | awk 'BEGIN{ RS="</[aA]>" } | |
/http:\/\/freedownloads.last/{ | |
gsub(/.*href=[\047\042]/,"") |
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 |
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
= 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
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
##############3 | |
#open and scrap | |
###################################### | |
#scan_page.rb = Retrieves the html page of interest from the server, | |
# navigates to links within the main page and construct a | |
# context document | |
#!/usr/bin/ruby | |
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
#!/bin/sh | |
# ./lookup-sentences 1 < ./deck-exported.txt > ./deck-toimport.txt | |
# $Revision: 1.3 $ $Date: 2010/02/23 02:36:09 $ | |
while read line | |
do | |
sentence=`echo "$line" | awk -F'\t' '{print $'"$1"'}' | sed 's/<[^<]*>//g'` | |
echo -ne "$line\t" | |
wget -O - "http://www.csse.monash.edu.au/~jwb/cgi-bin/wwwjdic.cgi?9MIH$sentence" | \ |
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
\documentclass[21pt]{scrartcl} | |
\usepackage[]{forloop} | |
\usepackage[]{blindtext} | |
\setlength{\parindent}{0pt} | |
\usepackage[]{lmodern} | |
\newcounter{ct} | |
\usepackage{pgfpages} | |
\edef\pgfpageoptionheight{\the\paperwidth} % landscaped by default | |
\edef\pgfpageoptionwidth{\the\paperheight} |
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 | |
# | |
# Originally written by http://redartisan.com/tags/csv | |
# Added and minor changes by Gavin Laking | |
# only works with ruby 1.8 ??? | |
# | |
# "id","name","mime_type","extensions","icon_url" | |
# "1","unknown","unknown/unknown","||","/images/icon/file_unknown.gif" | |
# "2","image/tiff","image/tiff","|tiff|tif|","/images/icon/blank.png" | |
# |
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
class Delicious | |
class << self | |
def tag(username, name, count = 15) | |
links = [] | |
url = "http://feeds.delicious.com/v2/rss/#{username}/#{name}?count=#{count}" | |
feed = Hpricot(open(url)) | |
feed.search("item").each do |i| | |
item = OpenStruct.new | |
item.link = i.at('link').next.to_s |
OlderNewer