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
import os | |
import sys | |
import re | |
import hashlib | |
import csv | |
import time | |
import locale | |
import getopt | |
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
import re | |
dic = {} | |
with open ('access_log.txt') as fh: | |
lines = fh.readlines() | |
for item in lines: | |
time = re.search(r'\d\d\/\w{3}\/\d{4}\:\d\d', item).group() | |
#print time.group() | |
#hour = re.search(r'\d\d\:\d\d\s$',item) | |
hour = time.split(':')[1] | |
# dic[time] = hour |
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
outerdic = {} | |
with open('F-F_Research_Data_Factors_daily.txt') as fh: | |
lines = fh.readlines() | |
slicedline = lines[6:-2] | |
header = lines[5].split() | |
for element in slicedline: | |
date = element.split()[0][:6] | |
outerdic[date] = outerdic.setdefault(date, []) | |
outerdic[date].append(float(element.split()[1])) |
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
outerdic = {} | |
with open('F-F_Research_Data_Factors_daily.txt') as fh: | |
lines = fh.readlines() | |
slicedline = lines[6:-2] | |
header = lines[5].split() | |
for element in slicedline: | |
date = element.split()[0][:6] | |
outerdic[date] = outerdic.setdefault(date, []) | |
outerdic[date].append(float(element.split()[1])) |
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
#!/usr/bin/env python2 | |
import urllib | |
import urllib2 | |
import json | |
data = {'test': 'value'} | |
data = json.dumps(data) | |
url = "http://10.20.72.96:8181/api/send/5556?gm_url=http://192.168.65.156:9002/sendmail&menu_id=1" | |
#data = urllib.urlencode(data) |
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
year_input = raw_input('Please enter a 4-digit year: ') | |
mylist = [] | |
with open('F-F_Research_Data_Factors_daily.txt') as fh: | |
lines = fh.readlines() | |
slicedline = lines[6:-2] | |
header = lines[5].split() | |
for element in slicedline: | |
yearstr = element.split()[0] |
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
#!/usr/bin/env python2 | |
try: | |
year_input = int(raw_input('Please enter a 4-digit year: ')) | |
except: | |
exit('1st arg must be 4-digit year between 1926 and 2012') | |
factor_input = raw_input('please enter a Fama-French factor: ') | |
mylist = [] | |
with open('F-F_Research_Data_Factors_daily.txt') as fh: |
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
year_input = raw_input('Please enter a 4-digit year: ') | |
mylist = [] | |
with open('F-F_Research_Data_Factors_daily.txt') as fh: | |
lines = fh.readlines() | |
slicedline = lines[6:-2] | |
header = lines[5].split() | |
for element in slicedline: | |
yearstr.mkt.smb.hml.rf = element.split() |
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
worddict = set() | |
with open ('words.txt') as fh: | |
lines = fh.readlines() | |
for element in lines: | |
words = element.rstrip() | |
worddict.add(words) | |
print '{0} words in spelling words'.format(len(worddict)) | |
with open ('3-2_example.txt') as ex: |
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
#当前架构 | |
heka(日志收集器) -> ElasticSearch(分布式搜索引擎,相当于数据库) -> Kibana(界面展现) | |
##Heka | |
- 日志收集服务 | |
- Mozilla出品 | |
- Golang编写 | |
- 轻量却功能强大 | |
- 灵活易用 | |
- Go/Lua扩展 |