Skip to content

Commit 96484d0

Browse files
committed
Merge pull request Show-Me-the-Code#94 from kamendula/master
complete 0000-0014
2 parents 55fb8cf + 04840ed commit 96484d0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+644
-2
lines changed

agmcs/0000/heihei.bmp

1.02 MB
Binary file not shown.

burness/0007/Program_lines_stat.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# 解决多行注释 如python中的'''
1515
multi_comment_start={'python':'\'\'\'','c':'/*'}
1616
multi_comment_end={'python':'\'\'\'','c':'*/'}
17-
1817
def stat_lines(file_name,file_type):
1918
import re
2019
is_comment=False
@@ -69,4 +68,4 @@ def main():
6968

7069

7170
if __name__=='__main__':
72-
main()
71+
main()

kamen/0000/0.jpg

9.24 KB
Loading

kamen/0000/0000.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import Image,ImageFont,ImageDraw
2+
text='6'
3+
image = Image.open('0.jpg')
4+
width,height=image.size
5+
font=ImageFont.truetype('Inconsolata.otf',width/6) #set fonttype and size
6+
7+
draw=ImageDraw.Draw(image)
8+
s_width,s_heitht=draw.textsize(text,font) # get text size
9+
draw.text((width-s_width,0), text, fill=(255,0,0),font=font)
10+
image.save('0add.jpg')

kamen/0000/0add.jpg

9.92 KB
Loading

kamen/0000/Inconsolata.otf

57.1 KB
Binary file not shown.

kamen/0001/gene_200_keys.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import uuid,pickle
2+
3+
class gene_keys():
4+
def __init__(self,num):
5+
self.num = num;
6+
self.list = [];
7+
8+
def gene_list(self):
9+
for i in range(self.num):
10+
key=uuid.uuid1();
11+
self.list.append(key)
12+
13+
def return_list(self):
14+
return self.list;
15+
16+
g=gene_keys(200);
17+
g.gene_list();
18+
keys_list=g.return_list();
19+
#print keys_list
20+
21+
with open('keys.txt','wb') as f:
22+
for key in keys_list:
23+
f.write(str(key).replace('-','')+'\n')
24+

kamen/0001/keys.txt

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
ba97f900e1f011e481a8896c057971af
2+
ba98200fe1f011e497ae896c057971af
3+
ba982010e1f011e4b4e1896c057971af
4+
ba982011e1f011e491eb896c057971af
5+
ba982012e1f011e48c62896c057971af
6+
ba982013e1f011e49dd4896c057971af
7+
ba982014e1f011e4a029896c057971af
8+
ba982015e1f011e499bd896c057971af
9+
ba982016e1f011e4aa48896c057971af
10+
ba982017e1f011e4870d896c057971af
11+
ba982018e1f011e49120896c057971af
12+
ba982019e1f011e4a586896c057971af
13+
ba98201ae1f011e4aea0896c057971af
14+
ba98201be1f011e48780896c057971af
15+
ba98201ce1f011e48c32896c057971af
16+
ba98201de1f011e4af3d896c057971af
17+
ba98201ee1f011e4bd2a896c057971af
18+
ba98201fe1f011e49a3b896c057971af
19+
ba982020e1f011e492f4896c057971af
20+
ba982021e1f011e481fb896c057971af
21+
ba982022e1f011e4af2f896c057971af
22+
ba982023e1f011e4b52a896c057971af
23+
ba982024e1f011e48f2c896c057971af
24+
ba982025e1f011e48467896c057971af
25+
ba982026e1f011e4bb2f896c057971af
26+
ba982027e1f011e4b5a5896c057971af
27+
ba982028e1f011e4932c896c057971af
28+
ba982029e1f011e4a101896c057971af
29+
ba98202ae1f011e4a868896c057971af
30+
ba98202be1f011e48525896c057971af
31+
ba98202ce1f011e4b313896c057971af
32+
ba984721e1f011e4afbf896c057971af
33+
ba984722e1f011e49f18896c057971af
34+
ba984723e1f011e4b68e896c057971af
35+
ba984724e1f011e48705896c057971af
36+
ba984725e1f011e4b4ba896c057971af
37+
ba984726e1f011e4aaa9896c057971af
38+
ba984727e1f011e4a7b8896c057971af
39+
ba984728e1f011e49457896c057971af
40+
ba984729e1f011e4a253896c057971af
41+
ba98472ae1f011e4bc23896c057971af
42+
ba98472be1f011e48de6896c057971af
43+
ba98472ce1f011e4b759896c057971af
44+
ba98472de1f011e48461896c057971af
45+
ba98472ee1f011e48ac4896c057971af
46+
ba98472fe1f011e4b135896c057971af
47+
ba984730e1f011e4bcf6896c057971af
48+
ba984731e1f011e48463896c057971af
49+
ba984732e1f011e4a4d1896c057971af
50+
ba984733e1f011e481af896c057971af
51+
ba984734e1f011e49865896c057971af
52+
ba984735e1f011e4bd19896c057971af
53+
ba984736e1f011e48f20896c057971af
54+
ba984737e1f011e497ce896c057971af
55+
ba984738e1f011e48996896c057971af
56+
ba984739e1f011e495a4896c057971af
57+
ba98473ae1f011e4a506896c057971af
58+
ba98473be1f011e4a5e5896c057971af
59+
ba98473ce1f011e4af6b896c057971af
60+
ba98473de1f011e4823d896c057971af
61+
ba98473ee1f011e498b6896c057971af
62+
ba98473fe1f011e49218896c057971af
63+
ba984740e1f011e4893c896c057971af
64+
ba984741e1f011e49d2e896c057971af
65+
ba984742e1f011e491be896c057971af
66+
ba984743e1f011e4a78b896c057971af
67+
ba984744e1f011e49fc8896c057971af
68+
ba984745e1f011e4a475896c057971af
69+
ba984746e1f011e4862c896c057971af
70+
ba984747e1f011e4a706896c057971af
71+
ba984748e1f011e49620896c057971af
72+
ba984749e1f011e48fc0896c057971af
73+
ba98474ae1f011e48560896c057971af
74+
ba98474be1f011e4bd75896c057971af
75+
ba98474ce1f011e491cf896c057971af
76+
ba98474de1f011e4a364896c057971af
77+
ba98474ee1f011e487cb896c057971af
78+
ba98474fe1f011e483a0896c057971af
79+
ba984750e1f011e49b64896c057971af
80+
ba984751e1f011e485ae896c057971af
81+
ba984752e1f011e4a153896c057971af
82+
ba984753e1f011e49919896c057971af
83+
ba984754e1f011e4a2ec896c057971af
84+
ba984755e1f011e48bd0896c057971af
85+
ba984756e1f011e4a571896c057971af
86+
ba986e30e1f011e480d6896c057971af
87+
ba986e31e1f011e49647896c057971af
88+
ba986e32e1f011e48417896c057971af
89+
ba986e33e1f011e4b68b896c057971af
90+
ba986e34e1f011e4ba66896c057971af
91+
ba986e35e1f011e49543896c057971af
92+
ba986e36e1f011e49485896c057971af
93+
ba986e37e1f011e4991f896c057971af
94+
ba986e38e1f011e4b140896c057971af
95+
ba986e39e1f011e4bb54896c057971af
96+
ba986e3ae1f011e48687896c057971af
97+
ba986e3be1f011e48e69896c057971af
98+
ba986e3ce1f011e49567896c057971af
99+
ba986e3de1f011e4bb31896c057971af
100+
ba986e3ee1f011e4b29d896c057971af
101+
ba986e3fe1f011e481e6896c057971af
102+
ba986e40e1f011e4b8a0896c057971af
103+
ba986e41e1f011e48444896c057971af
104+
ba986e42e1f011e4b1c0896c057971af
105+
ba986e43e1f011e4844b896c057971af
106+
ba986e44e1f011e48f9c896c057971af
107+
ba986e45e1f011e491cf896c057971af
108+
ba986e46e1f011e4a5a5896c057971af
109+
ba986e47e1f011e4b560896c057971af
110+
ba986e48e1f011e49554896c057971af
111+
ba986e49e1f011e48ac9896c057971af
112+
ba986e4ae1f011e4b288896c057971af
113+
ba986e4be1f011e4bb62896c057971af
114+
ba986e4ce1f011e4bea0896c057971af
115+
ba986e4de1f011e4b068896c057971af
116+
ba986e4ee1f011e4b791896c057971af
117+
ba986e4fe1f011e4927d896c057971af
118+
ba986e50e1f011e4acde896c057971af
119+
ba986e51e1f011e481d1896c057971af
120+
ba986e52e1f011e4825e896c057971af
121+
ba986e53e1f011e49ca9896c057971af
122+
ba986e54e1f011e4b08c896c057971af
123+
ba986e55e1f011e4a341896c057971af
124+
ba986e56e1f011e4b686896c057971af
125+
ba989540e1f011e496b4896c057971af
126+
ba989541e1f011e48b8a896c057971af
127+
ba989542e1f011e4b5da896c057971af
128+
ba989543e1f011e4829e896c057971af
129+
ba989544e1f011e4896c896c057971af
130+
ba989545e1f011e4ad1d896c057971af
131+
ba989546e1f011e4a812896c057971af
132+
ba989547e1f011e4895c896c057971af
133+
ba989548e1f011e49a40896c057971af
134+
ba989549e1f011e4afc8896c057971af
135+
ba98954ae1f011e4b6aa896c057971af
136+
ba98954be1f011e494b1896c057971af
137+
ba98954ce1f011e48df9896c057971af
138+
ba98954de1f011e4bc21896c057971af
139+
ba98954ee1f011e4b71b896c057971af
140+
ba98954fe1f011e4a610896c057971af
141+
ba989550e1f011e49454896c057971af
142+
ba989551e1f011e4874d896c057971af
143+
ba989552e1f011e49155896c057971af
144+
ba989553e1f011e4acbe896c057971af
145+
ba989554e1f011e4b0de896c057971af
146+
ba989555e1f011e49d1c896c057971af
147+
ba989556e1f011e4ab6b896c057971af
148+
ba989557e1f011e483bd896c057971af
149+
ba989558e1f011e48ab8896c057971af
150+
ba989559e1f011e4805b896c057971af
151+
ba98955ae1f011e4b922896c057971af
152+
ba98955be1f011e4b71c896c057971af
153+
ba98955ce1f011e4a4ca896c057971af
154+
ba98955de1f011e4b27a896c057971af
155+
ba98955ee1f011e4b84b896c057971af
156+
ba98955fe1f011e480d5896c057971af
157+
ba989560e1f011e49d3b896c057971af
158+
ba989561e1f011e48aa0896c057971af
159+
ba989562e1f011e4924f896c057971af
160+
ba989563e1f011e4b8c0896c057971af
161+
ba989564e1f011e4a79d896c057971af
162+
ba989565e1f011e49695896c057971af
163+
ba989566e1f011e4a8ac896c057971af
164+
ba989567e1f011e4addd896c057971af
165+
ba989568e1f011e48fe6896c057971af
166+
ba989569e1f011e48c82896c057971af
167+
ba98956ae1f011e4806c896c057971af
168+
ba98956be1f011e4b0f6896c057971af
169+
ba98956ce1f011e4b814896c057971af
170+
ba98956de1f011e4b7d2896c057971af
171+
ba98956ee1f011e49723896c057971af
172+
ba98956fe1f011e4be12896c057971af
173+
ba989570e1f011e493d5896c057971af
174+
ba989571e1f011e4a0d8896c057971af
175+
ba989572e1f011e48270896c057971af
176+
ba989573e1f011e48af0896c057971af
177+
ba989574e1f011e4a5db896c057971af
178+
ba989575e1f011e4be3c896c057971af
179+
ba989576e1f011e49862896c057971af
180+
ba98bc51e1f011e49375896c057971af
181+
ba98bc52e1f011e4a38d896c057971af
182+
ba98bc53e1f011e499a6896c057971af
183+
ba98bc54e1f011e4a926896c057971af
184+
ba98bc55e1f011e48798896c057971af
185+
ba98bc56e1f011e4b8c2896c057971af
186+
ba98bc57e1f011e491ca896c057971af
187+
ba98bc58e1f011e4bb98896c057971af
188+
ba98bc59e1f011e48f0a896c057971af
189+
ba98bc5ae1f011e48334896c057971af
190+
ba98bc5be1f011e4a6e4896c057971af
191+
ba98bc5ce1f011e48d13896c057971af
192+
ba98bc5de1f011e4b35c896c057971af
193+
ba98bc5ee1f011e49a16896c057971af
194+
ba98bc5fe1f011e4856a896c057971af
195+
ba98bc60e1f011e4852a896c057971af
196+
ba98bc61e1f011e48fe5896c057971af
197+
ba98bc62e1f011e4a739896c057971af
198+
ba98bc63e1f011e49e3b896c057971af
199+
ba98bc64e1f011e4b073896c057971af
200+
ba98bc65e1f011e491f6896c057971af

kamen/0002/gene_200_keys.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import uuid,pickle
2+
3+
class gene_keys():
4+
def __init__(self,num):
5+
self.num = num;
6+
self.list = [];
7+
8+
def gene_list(self):
9+
for i in range(self.num):
10+
key=uuid.uuid1();
11+
self.list.append(key)
12+
13+
def return_list(self):
14+
return self.list;
15+
16+
g=gene_keys(200);
17+
g.gene_list();
18+
keys_list=g.return_list();
19+
#print keys_list
20+
21+
with open('keys.txt','wb') as f:
22+
for key in keys_list:
23+
f.write(str(key).replace('-','')+'\n')
24+

kamen/0002/gene_key_save_in_mysql.py

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import mysql.connector
2+
import uuid
3+
4+
config={
5+
'host':'127.0.0.1',
6+
'user':'root',
7+
'password':'',
8+
'port':3306,
9+
'database':'class',
10+
'charset':'utf8'
11+
}
12+
13+
14+
15+
class sql_struct():
16+
def __init__(self,config):
17+
self.config=config
18+
19+
def conn_sql(self):
20+
try:
21+
conn=mysql.connector.connect(**self.config)
22+
except mysql.connector.Error as e:
23+
print ('connect fails!{}'.format(e))
24+
self.conn=conn
25+
26+
27+
def conn_execute(self, sql_string, data):
28+
cursor=self.conn.cursor()
29+
#cursor.execute(sql_string);
30+
try:
31+
if data is '':
32+
cursor.execute(sql_string);
33+
elif type(data) is tuple:
34+
cursor.execute(sql_string, data);
35+
elif type(data) is dict:
36+
cursor.execute(sql_string, data)
37+
except mysql.connector.Error as e:
38+
print('fails{}'.format(e));
39+
40+
def sql_close(self):
41+
self.conn.close()
42+
43+
def sql_commit(self):
44+
self.conn.commit()
45+
46+
class gene_keys():
47+
def __init__(self,num):
48+
self.num = num;
49+
self.list = [];
50+
51+
def gene_list(self):
52+
for i in range(self.num):
53+
key=uuid.uuid1();
54+
self.list.append(str(key).replace('-',''));
55+
56+
def return_list(self):
57+
return self.list;
58+
59+
g=gene_keys(2);
60+
g.gene_list();
61+
keys_list=g.return_list();
62+
db=sql_struct(config);
63+
db.conn_sql();
64+
#print cnn
65+
66+
#sql create table ``
67+
sql_create_table='create table `keyss1` (\
68+
`source` varchar(10),\
69+
`key` varchar(20)\
70+
)';
71+
72+
sql_insert2=("insert into keyss1(source, keyss) values (%s, %s)")
73+
for key in keys_list:
74+
data=('uuid', key);
75+
db.conn_execute(sql_insert2,data)
76+
77+
db.sql_commit();
78+
db.sql_close()
79+
80+
81+
82+
83+

kamen/0004/a.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
A Counter is a dict subclass for counting hashable objects.
2+
It is an unordered collection where elements are stored as dictionary keys and their
3+
counts are stored as dictionary values. Counts are allowed to be any integer value including
4+
zero or negative counts. The Counter class is similar to bags or multisets in other languages

kamen/0004/word_count.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from collections import Counter
2+
#collections
3+
#counter + - & | most_common
4+
with open('a.txt', 'r') as f:
5+
c=Counter()
6+
for line in f:
7+
line_list=line.split()
8+
c+=Counter(line_list)
9+
10+
print c.most_common()
11+

kamen/0008/0008.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from bs4 import BeautifulSoup
2+
from urllib import urlopen
3+
4+
r = urlopen('http://sports.sina.com.cn/nba/2015-04-23/00007584374.shtml').read()
5+
soup = BeautifulSoup(r)
6+
#print soup
7+
t = soup.find_all(id='artibody')
8+
#print t
9+
#print type(t)
10+
s=''
11+
for p in t[0].find_all("p"):
12+
s = s + p.get_text()+'\n'
13+
14+
print s
15+
16+
17+

0 commit comments

Comments
 (0)