- A script for killing my iMac's broken HDD fan - A script for scraping Culture ship names from Wikipediapull/28/head
parent
810844e899
commit
c58d44e660
@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
fan_speed = (ARGV.shift || 1100).to_i
|
||||||
|
|
||||||
|
smc = '~/Applications/smcFanControl.app/Contents/Resources/smc'
|
||||||
|
fan_speed = (fan_speed << 2).to_s(16)
|
||||||
|
`#{smc} -k F1Mx -w #{fan_speed}`
|
@ -0,0 +1,9 @@
|
|||||||
|
require "open-uri"
|
||||||
|
require "rexml/document"
|
||||||
|
|
||||||
|
html = open('https://en.wikipedia.org/wiki/List_of_spacecraft_in_the_Culture_series').read
|
||||||
|
doc = REXML::Document.new(html)
|
||||||
|
tds = doc.elements.to_a('//table[tr/th/text()="Name"]/tr//td[3]')
|
||||||
|
names = tds.map {|td| REXML::XPath.match(td, './/text()')[0] }
|
||||||
|
|
||||||
|
puts names
|
Loading…
Reference in new issue