Skip to content

Commit

Permalink
Merge pull request #94 from kamendula/master
Browse files Browse the repository at this point in the history
complete 0000-0014
  • Loading branch information
horx committed Apr 26, 2015
2 parents 55fb8cf + 04840ed commit 96484d0
Show file tree
Hide file tree
Showing 71 changed files with 644 additions and 2 deletions.
Binary file added agmcs/0000/heihei.bmp
Binary file not shown.
3 changes: 1 addition & 2 deletions burness/0007/Program_lines_stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# 解决多行注释 如python中的'''
multi_comment_start={'python':'\'\'\'','c':'/*'}
multi_comment_end={'python':'\'\'\'','c':'*/'}

def stat_lines(file_name,file_type):
import re
is_comment=False
Expand Down Expand Up @@ -69,4 +68,4 @@ def main():


if __name__=='__main__':
main()
main()
Binary file added kamen/0000/0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions kamen/0000/0000.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import Image,ImageFont,ImageDraw
text='6'
image = Image.open('0.jpg')
width,height=image.size
font=ImageFont.truetype('Inconsolata.otf',width/6) #set fonttype and size

draw=ImageDraw.Draw(image)
s_width,s_heitht=draw.textsize(text,font) # get text size
draw.text((width-s_width,0), text, fill=(255,0,0),font=font)
image.save('0add.jpg')
Binary file added kamen/0000/0add.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added kamen/0000/Inconsolata.otf
Binary file not shown.
24 changes: 24 additions & 0 deletions kamen/0001/gene_200_keys.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import uuid,pickle

class gene_keys():
def __init__(self,num):
self.num = num;
self.list = [];

def gene_list(self):
for i in range(self.num):
key=uuid.uuid1();
self.list.append(key)

def return_list(self):
return self.list;

g=gene_keys(200);
g.gene_list();
keys_list=g.return_list();
#print keys_list

with open('keys.txt','wb') as f:
for key in keys_list:
f.write(str(key).replace('-','')+'\n')

200 changes: 200 additions & 0 deletions kamen/0001/keys.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
ba97f900e1f011e481a8896c057971af
ba98200fe1f011e497ae896c057971af
ba982010e1f011e4b4e1896c057971af
ba982011e1f011e491eb896c057971af
ba982012e1f011e48c62896c057971af
ba982013e1f011e49dd4896c057971af
ba982014e1f011e4a029896c057971af
ba982015e1f011e499bd896c057971af
ba982016e1f011e4aa48896c057971af
ba982017e1f011e4870d896c057971af
ba982018e1f011e49120896c057971af
ba982019e1f011e4a586896c057971af
ba98201ae1f011e4aea0896c057971af
ba98201be1f011e48780896c057971af
ba98201ce1f011e48c32896c057971af
ba98201de1f011e4af3d896c057971af
ba98201ee1f011e4bd2a896c057971af
ba98201fe1f011e49a3b896c057971af
ba982020e1f011e492f4896c057971af
ba982021e1f011e481fb896c057971af
ba982022e1f011e4af2f896c057971af
ba982023e1f011e4b52a896c057971af
ba982024e1f011e48f2c896c057971af
ba982025e1f011e48467896c057971af
ba982026e1f011e4bb2f896c057971af
ba982027e1f011e4b5a5896c057971af
ba982028e1f011e4932c896c057971af
ba982029e1f011e4a101896c057971af
ba98202ae1f011e4a868896c057971af
ba98202be1f011e48525896c057971af
ba98202ce1f011e4b313896c057971af
ba984721e1f011e4afbf896c057971af
ba984722e1f011e49f18896c057971af
ba984723e1f011e4b68e896c057971af
ba984724e1f011e48705896c057971af
ba984725e1f011e4b4ba896c057971af
ba984726e1f011e4aaa9896c057971af
ba984727e1f011e4a7b8896c057971af
ba984728e1f011e49457896c057971af
ba984729e1f011e4a253896c057971af
ba98472ae1f011e4bc23896c057971af
ba98472be1f011e48de6896c057971af
ba98472ce1f011e4b759896c057971af
ba98472de1f011e48461896c057971af
ba98472ee1f011e48ac4896c057971af
ba98472fe1f011e4b135896c057971af
ba984730e1f011e4bcf6896c057971af
ba984731e1f011e48463896c057971af
ba984732e1f011e4a4d1896c057971af
ba984733e1f011e481af896c057971af
ba984734e1f011e49865896c057971af
ba984735e1f011e4bd19896c057971af
ba984736e1f011e48f20896c057971af
ba984737e1f011e497ce896c057971af
ba984738e1f011e48996896c057971af
ba984739e1f011e495a4896c057971af
ba98473ae1f011e4a506896c057971af
ba98473be1f011e4a5e5896c057971af
ba98473ce1f011e4af6b896c057971af
ba98473de1f011e4823d896c057971af
ba98473ee1f011e498b6896c057971af
ba98473fe1f011e49218896c057971af
ba984740e1f011e4893c896c057971af
ba984741e1f011e49d2e896c057971af
ba984742e1f011e491be896c057971af
ba984743e1f011e4a78b896c057971af
ba984744e1f011e49fc8896c057971af
ba984745e1f011e4a475896c057971af
ba984746e1f011e4862c896c057971af
ba984747e1f011e4a706896c057971af
ba984748e1f011e49620896c057971af
ba984749e1f011e48fc0896c057971af
ba98474ae1f011e48560896c057971af
ba98474be1f011e4bd75896c057971af
ba98474ce1f011e491cf896c057971af
ba98474de1f011e4a364896c057971af
ba98474ee1f011e487cb896c057971af
ba98474fe1f011e483a0896c057971af
ba984750e1f011e49b64896c057971af
ba984751e1f011e485ae896c057971af
ba984752e1f011e4a153896c057971af
ba984753e1f011e49919896c057971af
ba984754e1f011e4a2ec896c057971af
ba984755e1f011e48bd0896c057971af
ba984756e1f011e4a571896c057971af
ba986e30e1f011e480d6896c057971af
ba986e31e1f011e49647896c057971af
ba986e32e1f011e48417896c057971af
ba986e33e1f011e4b68b896c057971af
ba986e34e1f011e4ba66896c057971af
ba986e35e1f011e49543896c057971af
ba986e36e1f011e49485896c057971af
ba986e37e1f011e4991f896c057971af
ba986e38e1f011e4b140896c057971af
ba986e39e1f011e4bb54896c057971af
ba986e3ae1f011e48687896c057971af
ba986e3be1f011e48e69896c057971af
ba986e3ce1f011e49567896c057971af
ba986e3de1f011e4bb31896c057971af
ba986e3ee1f011e4b29d896c057971af
ba986e3fe1f011e481e6896c057971af
ba986e40e1f011e4b8a0896c057971af
ba986e41e1f011e48444896c057971af
ba986e42e1f011e4b1c0896c057971af
ba986e43e1f011e4844b896c057971af
ba986e44e1f011e48f9c896c057971af
ba986e45e1f011e491cf896c057971af
ba986e46e1f011e4a5a5896c057971af
ba986e47e1f011e4b560896c057971af
ba986e48e1f011e49554896c057971af
ba986e49e1f011e48ac9896c057971af
ba986e4ae1f011e4b288896c057971af
ba986e4be1f011e4bb62896c057971af
ba986e4ce1f011e4bea0896c057971af
ba986e4de1f011e4b068896c057971af
ba986e4ee1f011e4b791896c057971af
ba986e4fe1f011e4927d896c057971af
ba986e50e1f011e4acde896c057971af
ba986e51e1f011e481d1896c057971af
ba986e52e1f011e4825e896c057971af
ba986e53e1f011e49ca9896c057971af
ba986e54e1f011e4b08c896c057971af
ba986e55e1f011e4a341896c057971af
ba986e56e1f011e4b686896c057971af
ba989540e1f011e496b4896c057971af
ba989541e1f011e48b8a896c057971af
ba989542e1f011e4b5da896c057971af
ba989543e1f011e4829e896c057971af
ba989544e1f011e4896c896c057971af
ba989545e1f011e4ad1d896c057971af
ba989546e1f011e4a812896c057971af
ba989547e1f011e4895c896c057971af
ba989548e1f011e49a40896c057971af
ba989549e1f011e4afc8896c057971af
ba98954ae1f011e4b6aa896c057971af
ba98954be1f011e494b1896c057971af
ba98954ce1f011e48df9896c057971af
ba98954de1f011e4bc21896c057971af
ba98954ee1f011e4b71b896c057971af
ba98954fe1f011e4a610896c057971af
ba989550e1f011e49454896c057971af
ba989551e1f011e4874d896c057971af
ba989552e1f011e49155896c057971af
ba989553e1f011e4acbe896c057971af
ba989554e1f011e4b0de896c057971af
ba989555e1f011e49d1c896c057971af
ba989556e1f011e4ab6b896c057971af
ba989557e1f011e483bd896c057971af
ba989558e1f011e48ab8896c057971af
ba989559e1f011e4805b896c057971af
ba98955ae1f011e4b922896c057971af
ba98955be1f011e4b71c896c057971af
ba98955ce1f011e4a4ca896c057971af
ba98955de1f011e4b27a896c057971af
ba98955ee1f011e4b84b896c057971af
ba98955fe1f011e480d5896c057971af
ba989560e1f011e49d3b896c057971af
ba989561e1f011e48aa0896c057971af
ba989562e1f011e4924f896c057971af
ba989563e1f011e4b8c0896c057971af
ba989564e1f011e4a79d896c057971af
ba989565e1f011e49695896c057971af
ba989566e1f011e4a8ac896c057971af
ba989567e1f011e4addd896c057971af
ba989568e1f011e48fe6896c057971af
ba989569e1f011e48c82896c057971af
ba98956ae1f011e4806c896c057971af
ba98956be1f011e4b0f6896c057971af
ba98956ce1f011e4b814896c057971af
ba98956de1f011e4b7d2896c057971af
ba98956ee1f011e49723896c057971af
ba98956fe1f011e4be12896c057971af
ba989570e1f011e493d5896c057971af
ba989571e1f011e4a0d8896c057971af
ba989572e1f011e48270896c057971af
ba989573e1f011e48af0896c057971af
ba989574e1f011e4a5db896c057971af
ba989575e1f011e4be3c896c057971af
ba989576e1f011e49862896c057971af
ba98bc51e1f011e49375896c057971af
ba98bc52e1f011e4a38d896c057971af
ba98bc53e1f011e499a6896c057971af
ba98bc54e1f011e4a926896c057971af
ba98bc55e1f011e48798896c057971af
ba98bc56e1f011e4b8c2896c057971af
ba98bc57e1f011e491ca896c057971af
ba98bc58e1f011e4bb98896c057971af
ba98bc59e1f011e48f0a896c057971af
ba98bc5ae1f011e48334896c057971af
ba98bc5be1f011e4a6e4896c057971af
ba98bc5ce1f011e48d13896c057971af
ba98bc5de1f011e4b35c896c057971af
ba98bc5ee1f011e49a16896c057971af
ba98bc5fe1f011e4856a896c057971af
ba98bc60e1f011e4852a896c057971af
ba98bc61e1f011e48fe5896c057971af
ba98bc62e1f011e4a739896c057971af
ba98bc63e1f011e49e3b896c057971af
ba98bc64e1f011e4b073896c057971af
ba98bc65e1f011e491f6896c057971af
24 changes: 24 additions & 0 deletions kamen/0002/gene_200_keys.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import uuid,pickle

class gene_keys():
def __init__(self,num):
self.num = num;
self.list = [];

def gene_list(self):
for i in range(self.num):
key=uuid.uuid1();
self.list.append(key)

def return_list(self):
return self.list;

g=gene_keys(200);
g.gene_list();
keys_list=g.return_list();
#print keys_list

with open('keys.txt','wb') as f:
for key in keys_list:
f.write(str(key).replace('-','')+'\n')

83 changes: 83 additions & 0 deletions kamen/0002/gene_key_save_in_mysql.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import mysql.connector
import uuid

config={
'host':'127.0.0.1',
'user':'root',
'password':'',
'port':3306,
'database':'class',
'charset':'utf8'
}



class sql_struct():
def __init__(self,config):
self.config=config

def conn_sql(self):
try:
conn=mysql.connector.connect(**self.config)
except mysql.connector.Error as e:
print ('connect fails!{}'.format(e))
self.conn=conn


def conn_execute(self, sql_string, data):
cursor=self.conn.cursor()
#cursor.execute(sql_string);
try:
if data is '':
cursor.execute(sql_string);
elif type(data) is tuple:
cursor.execute(sql_string, data);
elif type(data) is dict:
cursor.execute(sql_string, data)
except mysql.connector.Error as e:
print('fails{}'.format(e));

def sql_close(self):
self.conn.close()

def sql_commit(self):
self.conn.commit()

class gene_keys():
def __init__(self,num):
self.num = num;
self.list = [];

def gene_list(self):
for i in range(self.num):
key=uuid.uuid1();
self.list.append(str(key).replace('-',''));

def return_list(self):
return self.list;

g=gene_keys(2);
g.gene_list();
keys_list=g.return_list();
db=sql_struct(config);
db.conn_sql();
#print cnn

#sql create table ``
sql_create_table='create table `keyss1` (\
`source` varchar(10),\
`key` varchar(20)\
)';

sql_insert2=("insert into keyss1(source, keyss) values (%s, %s)")
for key in keys_list:
data=('uuid', key);
db.conn_execute(sql_insert2,data)

db.sql_commit();
db.sql_close()





4 changes: 4 additions & 0 deletions kamen/0004/a.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
A Counter is a dict subclass for counting hashable objects.
It is an unordered collection where elements are stored as dictionary keys and their
counts are stored as dictionary values. Counts are allowed to be any integer value including
zero or negative counts. The Counter class is similar to bags or multisets in other languages
11 changes: 11 additions & 0 deletions kamen/0004/word_count.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from collections import Counter
#collections
#counter + - & | most_common
with open('a.txt', 'r') as f:
c=Counter()
for line in f:
line_list=line.split()
c+=Counter(line_list)

print c.most_common()

17 changes: 17 additions & 0 deletions kamen/0008/0008.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from bs4 import BeautifulSoup
from urllib import urlopen

r = urlopen('http://sports.sina.com.cn/nba/2015-04-23/00007584374.shtml').read()
soup = BeautifulSoup(r)
#print soup
t = soup.find_all(id='artibody')
#print t
#print type(t)
s=''
for p in t[0].find_all("p"):
s = s + p.get_text()+'\n'

print s



Loading

0 comments on commit 96484d0

Please sign in to comment.