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
git clone git://github.com/imathis/octopress.git octopress | |
cd octopress # If you use RVM, You'll be asked if you trust the .rvmrc file (say yes). | |
ruby --version # Should report Ruby 1.9.3 |
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
# 这是我的 python 解法,相当的 C 呢 | |
astring='''g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. | |
bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle | |
qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj.''' | |
import re | |
bstring='' | |
for a in astring: | |
if re.match('\w',a): | |
a=chr((ord(a)-95)%26+97) | |
bstring=bstring+a |
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
# 推荐的做法 | |
import string | |
text='''g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. | |
bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. | |
sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj.''' | |
table = string.maketrans(string.ascii_lowercase, | |
string.ascii_lowercase[2:]+string.ascii_lowercase[:2]) | |
text.translate(table) |
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
gets.tr "a-z", "c-zab" | |
# 就这么简单!然后输入字符串就好了!真让人喜欢! |
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
# 我的代码,判断每个字符是否是字母 | |
import re | |
astring = '''copy from the source page''' | |
bstring = '' | |
for a in astring: | |
if re.match('[a-zA-Z]',a): | |
bstring = bstring+a |
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
s = <<'EOF' | |
# copy from the source page | |
EOF | |
puts s.scan(/[a-z]/).join |
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
# 我的代码比较笨,但是方法是一样的,就不贴上来了。 | |
import re | |
s = ''' | |
copy from the source page | |
''' | |
print ''.join(re.findall('[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]', s)) |
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
s = <<'EOF' | |
copy from the source page | |
EOF | |
puts s.scan(/[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]/).join |
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
import re | |
from urllib import urlopen | |
astring='http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=' | |
temp='12345' | |
f = urlopen(astring+temp) | |
a=f.read() | |
restring=re.compile('and the next nothing is (\d{3,5})') | |
for i in range(400): | |
temp=re.findall(restring,a)[0] | |
print(temp) |
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 "open-uri" | |
n=12345 | |
loop do | |
flag = '' | |
open("http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=#{n}") do |f| | |
s=f.read | |
flag = s if s=~/htm/ | |
n=(s=~/div/ ? n/2 : s.split[-1].to_i) | |
end | |
if !flag.empty? |
OlderNewer