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
| # coding=utf-8 | |
| import os | |
| import logging | |
| from datetime import datetime, timedelta | |
| import tarfile | |
| from glob import glob | |
| DATETIME = datetime.today().strftime("%Y-%m-%d-%H-%M") | |
| FORMAT = '%(asctime)-15s %(message)s' |
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
| # coding=utf-8 | |
| import logging | |
| from datetime import datetime, timedelta | |
| import os.path | |
| import csv | |
| # from collections import Iterable | |
| DATETIME = datetime.today().strftime("%Y%m%d") | |
| FORMAT = '%(asctime)-15s %(message)s' |
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 python | |
| #-*- coding: utf8 -*- | |
| import logging | |
| import MySQLdb | |
| MYSQL_CONFIG = { | |
| 'host': 'localhost', | |
| 'port': 3306, |
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
| # coding=utf-8 | |
| from ftplib import FTP | |
| import os | |
| import logging | |
| from datetime import datetime, timedelta | |
| from sys import argv | |
| import tarfile | |
| DATETIME = datetime.today().strftime("%Y-%m-%d-%H-%M") | |
| FORMAT = '%(asctime)-15s %(message)s' |
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
| # coding=GBK | |
| import os | |
| import shutil | |
| os.chdir('/pro/udp') | |
| cfg_text = r'''<?xml version="1.0" encoding="GBK"?> | |
| <system version="3.8"> | |
| <ip>10.34.57.57</ip> |
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.7 | |
| #-*- coding: utf-8 -*- | |
| from hashlib import md5 | |
| from fabric.api import env, run, cd, local # , settings | |
| from fabric.tasks import execute | |
| from fabric.decorators import with_settings # , task | |
| from datetime import datetime as dt, timedelta | |
| result = [] |
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
| class FuncArgsDict(object): | |
| @staticmethod | |
| def generate_dic(f, args): | |
| return {k: v for (k, v) in zip(f.func_code.co_varnames[1:], args)} | |
| def func(self, a, b, c): | |
| kws = self.generate_dic(self.func, [a, b, c]) | |
| for k in kws: | |
| print k, ':', kws[k] |
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
| // http://tour.golang.org/#58 | |
| package main | |
| import ( | |
| "fmt" | |
| ) | |
| type ErrNegativeSqrt float64 |
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
| // http://tour.golang.org/#52 | |
| // code - 1 | |
| package main | |
| import ( | |
| "fmt" | |
| "math" | |
| ) | |
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
| package main | |
| import "fmt" | |
| func qsort(data []int) { | |
| if len(data) <= 1 { | |
| return | |
| } | |
| mid, i := data[0], 1 | |
| head, tail := 0, len(data)-1 |