Created
May 6, 2013 17:11
-
-
Save henix/5526469 to your computer and use it in GitHub Desktop.
Download top 50 highest voted ${tag} questions on stackoverflow, and convert them to pdf. depends on web2pdf.sh
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
.PHONY: all | |
all: highvote-pdf.mk | |
make -j4 -f $< WEB2PDF=/home/henix/web2pdf.sh | |
highvote-pdf.mk: highvote.html | |
xmllint --html --xpath "//a[@class='question-hyperlink']/@href" $< 2> /dev/null | sed -e 's/ href="//g' -e 's/"/\n/g' | lua link2mk.lua > $@ | |
highvote.html: | |
curl 'http://stackoverflow.com/questions/tagged/scala?sort=votes&pagesize=50' > $@ |
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 pdfnames = {} | |
local output = {} | |
local nu = 1 | |
for line in io.lines() do | |
local id, title = string.match(line, "/questions/([^/]*)/(.*)") | |
local fname = tostring(nu)..'-'..title | |
table.insert(output, fname..".pdf:") | |
table.insert(output, "\t$(WEB2PDF) "..fname.." http://stackoverflow.com/questions/"..id.."/"..title) | |
table.insert(output, '') | |
table.insert(pdfnames, fname..".pdf") | |
nu = nu + 1 | |
end | |
print(".PHONY: all\n") | |
io.write("all: ", table.concat(pdfnames, ' '), '\n\n') | |
io.write(table.concat(output, '\n')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment