Pythonで存在しているURLを捜索
リドルゲームで完全に詰まった時などにどのURLが存在しているかの一覧が欲しくなったりする。
一つ一つURLを叩いて調べるのは骨が折れるので総当りをして存在するURLを捜索するコードを書いた。
元ネタはこちらを参考に英数混じりの文字列を試すようにした。
#! /usr/bin/python
#-*- using:utf-8 -*-
import urllib2
import sys
def checkURL(url):
try:
f = urllib2.urlopen(url)
output = open("result.txt","a")
output.write(url)
output.write("\n")
output.close()
print " URL Found : " + url
f.close()
except urllib2.HTTPError:
print "NotFound : " + url
except:
pass
if 'unichr' not in globals():
unichr = chr
def moziretu(chars, len):
if len <= 0:
yield ''
else:
for c in chars:
for s in moziretu(chars, len - 1):
yield c + s
chars = [unichr(97 + i) for i in range(0, 26)] + [unichr(48 + i) for i in range(0, 10)]
minlen = 1
maxlen = 8
if __name__ == '__main__':
for l in range(minlen, maxlen + 1):
for thisURL in moziretu(chars, l):
url = "https://www.google.co.jp/" + thisURL
checkURL(url)
続きを読む
COSMIC EXPLORER LINER NOTESの惑星は実は曲に合わせて震動している
のっちの提案ではじまったCOSMIC EXPLORERのLINER NOTESサイト
cosmic-explorer.com
太陽を中心に14曲の惑星たちが回っています。
この惑星たちはそれぞれ独自の震動をしていますが毎回決まったように動くし曲によって違う気がする。。。
曲を選択した瞬間から震動は始まりますが、始まるタイミングに合わせて手元のiPhoneで音楽を掛けるとシンクロして動いているではありませんか。(パソコンが音を拾っているわけではないので最初のタイミングが大事です)
一番わかり易い Baby Faceで合わせてみたのが次の動画
他の曲も連動しています。
こんな細かい仕掛けがあるとは…
svn + sshで『ネットワーク接続が突然切られました』と言われる
svnのリポジトリを持っているサーバーAからファイルをチェックアウトしているサーバーBでsvn upを試みたところネットワークが切られた。
[ServerB] smith: svndirectory $ svn up
svn: To better debug SSH connection problems, remove the -q option from 'ssh' in the [tunnels] section of your Subversion configuration file.
svn: ネットワーク接続が突然切られました
そういえばサーバーAのOSが更新されてたんだった。
試しにsshしてみると
[ServerB] smith: svndirectory $ ssh ServerA
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
0x:0x:0x:0x:0x:0x:0x:0x:0x:0x:0x:0x:0x:0x:0x:0x.
Please contact your system administrator.
Add correct host key in /home/smith/.ssh/known_hosts to get rid of this message.
Offending key in /home/smith/.ssh/known_hosts:1
RSA host key for ServerA has changed and you have requested strict checking.
Host key verification failed.
うむ繋がらない、ということなので ~/.ssh/known_hostsにあるサーバーAの行を削除すると繋がりました。