Skip to content

Instantly share code, notes, and snippets.

@ayosec
Last active July 24, 2021 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayosec/0a140e57821a1f3cb253d8860438db13 to your computer and use it in GitHub Desktop.
Save ayosec/0a140e57821a1f3cb253d8860438db13 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
#
# Use the list from http://a3f.at/lists/linkers to build a single HTML file
# with all posts about linkers in https://www.airs.com/blog/.
require "net/http"
require "nokogiri"
# Index based on http://a3f.at/lists/linkers
INDEX = [
[ 38, "Intro" ],
[ 39, "Intro II" ],
[ 40, "Intro III" ],
[ 41, "Shared libraries" ],
[ 42, "Shared libraries Redux" ],
[ 43, "Relocations" ],
[ 44, "Thread-Local storage" ],
[ 45, "ELF Format" ],
[ 46, "Symbol versions" ],
[ 47, "Parallel linking" ],
[ 48, "Archives" ],
[ 49, "Symbol resolution" ],
[ 50, "Symbol versions Redux" ],
[ 51, "Link Time Optimization" ],
[ 52, "COMDAT sections" ],
[ 53, "C++ Template instantiation" ],
[ 54, "Warning symbols" ],
[ 55, "Incremental linking" ],
[ 56, "Misc" ],
[ 57, "Gold" ]
]
puts <<EOH
<DOCTYPE html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Linkers, by Lance Taylor</title>
<style>
code { color: darkred; }
.postmeta { color: gray; }
</style>
EOH
jobs = INDEX.map do |id, title|
queue = Queue.new
Thread.new do
title = %[<h1>#{title}</h1>]
url = "https://www.airs.com/blog/archives/#{id}"
post_html = Net::HTTP.get(URI(url))
post = Nokogiri::HTML.parse(post_html).at(".post")
queue.push("#{title}#{post}")
end
queue
end
jobs.each do |job|
print job.pop
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment