Skip to content

Instantly share code, notes, and snippets.

View yeyuguo's full-sized avatar
🎯
Focusing

Struggling Youth yeyuguo

🎯
Focusing
  • ...
  • China-BeiJing(Now)
View GitHub Profile
# coding: utf-8
# author: haofly
#
# fun: 生成随机姓名、随机电话号码、随机字符串,目前仅支持Python2
import random
def generateName(first_len=0, last_len=0):
surnames = [
def search_file(search_dir='/',file=None):
if file is None:
result = search_dir
return result
else:
for i in os.listdir(search_dir):
path_file = os.path.join(search_dir,i)
if os.path.isfile(path_file):
if i == file:
result = path_file
@yeyuguo
yeyuguo / search_file_index.py
Last active April 5, 2016 09:37
找到目录中的最后一个文件
def search_index_file(search_dir=None,index=None):
if search_dir is None:
search_dir = '/'
print(search_dir)
result = search_dir
if index is not None:
index = int(index)
dirs = sorted(os.listdir(search_dir))[index]
path_file = os.path.join(search_dir,dirs)
from time import time
t = time()
lista = [1,2,3,4,5,6,7,8,9,10]
listb =[0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,0.01]
len1=len(lista)
len2=len(listb)
for i in xrange (1000000):
for a in xrange(len1):
temp=lista[a]
for b in xrange(len2):
@yeyuguo
yeyuguo / timeList_conver_dayList.py
Last active July 4, 2016 05:49
一维的时间序列转成二维的,每天的放一个维度上
timesss=["20160504120000", "20160504130000", "20160504140000", "20160504150000", "20160504160000", "20160504170000", "20160504180000", "20160504190000", "20160504200000", "20160504210000", "20160504220000", "20160504230000", "20160505000000", "20160505010000", "20160505020000", "20160505030000", "20160505040000", "20160505050000", "20160505060000", "20160505070000", "20160505080000", "20160505090000", "20160505100000", "20160505110000", "20160505120000", "20160505130000", "20160505140000", "20160505150000", "20160505160000", "20160505170000", "20160505180000", "20160505190000", "20160505200000", "20160505210000", "20160505220000", "20160505230000", "20160506000000", "20160506010000", "20160506020000", "20160506030000", "20160506040000", "20160506050000", "20160506060000", "20160506070000", "20160506080000", "20160506090000", "20160506100000", "20160506110000", "20160506120000", "20160506130000", "20160506140000", "20160506150000", "20160506160000", "20160506170000", "20160506180000", "20160506190000", "201605
@yeyuguo
yeyuguo / python_server.py
Last active November 30, 2016 01:24
一个调试 和 正式服务的server文件
import os,sys
from main import app,db
# app is flask: app = Flask(__name__)
def runServer(debug=True):
print '*'*20
try:
port = int(sys.argv[1])
except Exception,e:
print 'error:',e
port = 64320
@yeyuguo
yeyuguo / want-less.less
Created January 6, 2017 14:38
less 的一些基本方式,逐渐完善
/* ------ 注释模板 --- start ------ */
/* ------ 注释模板 --- end ------ */
@noteTemplate : ' ------ 注释模板 --- start ------ ';
.init{margin:0;padding:0;}
.fl{float:left;}
@yeyuguo
yeyuguo / 神兽护体
Created February 9, 2017 06:31
神兽护体
/**
*
*----------Dragon be here!----------/
*    ┏┓   ┏┓
*   ┏┛┻━━━┛┻┓
*   ┃       ┃
*   ┃   ━   ┃
*   ┃ ┳┛ ┗┳ ┃
*   ┃       ┃
*   ┃   ┻   ┃
@yeyuguo
yeyuguo / 漂亮樱花.html
Created March 16, 2017 09:02
收藏 漂亮樱花
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
@yeyuguo
yeyuguo / baidu_login.py
Last active March 27, 2017 06:12
python 模拟百度登陆
# -*- coding: utf8 -*-
'''
Created on 2013-12-19
@author: good-temper
https://www.oschina.net/code/snippet_1183145_27432
'''
import urllib2
import urllib