Last active
July 16, 2019 00:24
-
-
Save eggplants/19408b36d125c5b57f83e85682bee04a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
cat exist.csv |grep "status=>\"200\""|grep -oP "url=>\".*?\""|sed -e "s/\"//g" -e "s/url=>//g" |
This file contains hidden or 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 "open-uri" | |
require "date" | |
p=[] | |
data=`ls -la /www|awk '$0=$9'|grep -oP "s181[0-9]+"` | |
data.scan(/^s[0-9]+$/).each{|i|["https","http"].each{|prot| | |
begin | |
print url="#{prot}://www.u.tsukuba.ac.jp/~#{i}" | |
s=open(url).status[0] | |
rescue | |
s=$! | |
end | |
print "\r" | |
p<<[ :status=>s, :id=>"20#{i.scan(/[0-9]+/)[0]}", :url=>url, :time=>DateTime.now.strftime("%Y-%m-%d")] | |
}} | |
File.open("exist.csv","w"){|file|p.each{|i| | |
file.puts i.join(" ") | |
}} |
This file contains hidden or 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 "open-uri" | |
require "date" | |
p=[] | |
data=`ls -la /www|awk '$0=$9'|grep -oP "s[0-9]+"` | |
data.scan(/^s[0-9]+$/).each{|i|["www","cgi"].each{|serv|["https","http"].each{|prot| | |
begin | |
print url="#{prot}://#{serv}.u.tsukuba.ac.jp/~#{i}" | |
s=open(url).status[0] | |
rescue | |
s=$! | |
end | |
print "\r" | |
p<<[ :status=>s, :id=>"20#{i.scan(/[0-9]+/)[0]}", :url=>url, :time=>DateTime.now.strftime("%Y-%m-%d")] | |
}}} | |
File.open("exist.csv","w"){|file|p.each{|i| | |
file.puts i.join(" ") | |
}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment