Created
December 27, 2014 05:47
-
-
Save jamtur01/4b4916df93cc6ffd3be7 to your computer and use it in GitHub Desktop.
Tilde.works active user list script
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 'digest/md5' | |
require 'pathname' | |
default_md5 = Digest::MD5.hexdigest(File.read('/etc/skel/public_html/index.html')) | |
homedirs = Pathname.glob('/home/*/').map(&:basename) | |
html = "our hard working users (#{homedirs.length})<br> <sub>generated at #{Time.now.strftime("%Y-%m-%d %H:%M:%S")}</sub><br>\n<ul>\n" | |
homedirs.each { |d| | |
index = Dir.glob("/home/#{d}/public_html/index.html") | |
md5 = Digest::MD5.hexdigest(File.read(index.first)) | |
if md5 == default_md5 | |
html << "<li><a href=\"http://tilde.works/~#{d}\">#{d}</a> - default :3</li>" | |
else | |
html << "<li><a href=\"http://tilde.works/~#{d}\">#{d}</a> </li>" | |
end | |
html << "\n" | |
} | |
html << "</ul>" | |
puts html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment