Random Ruby
I found some old random ruby scripts from ages ago.
This is a script to create 1,000 hidden services. Apparently I ran it as create_hidden_serv.rb >> torrc
#!/usr/bin/ruby start_port = 10000; datadir = "~/.tor"; end_port = 11000; until start_port == end_port do puts "HiddenServiceDir #{datadir}/hidserv/#{start_port} HiddenServicePort #{start_port} 127.0.0.1:#{start_port}"; #puts "#{start_port}"; start_port += 1; end
Create a tag cloud based on a body of text.
#!/usr/bin/ruby -w # Usage: tagme.rb /path/to/file require 'rubygems' require 'classifier' lsi = Classifier::LSI.new # start fresh # read the file into an array f = File.open("#{ARGV[0]}") textarray = f.readlines textarray.each { |item| item.downcase! } # add each word into the index textarray.each { |item| lsi.add_item item } # build the index lsi.build_index # classify the index # this really wants to be something else, like lsi.items, or some # reference to the index itself lsi.classify textarray # spit out a list of words puts lsi.items