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
# ----------------- django --------------------------- | |
from django.core.mail import send_mail | |
send_mail('Subject here', 'Here is the message.', '[email protected]', ['[email protected]']) | |
# ----------------- settings.py ---------------------- | |
SERVER_EMAIL = '[email protected]' | |
EMAIL_HOST = 'smtp.163.com' | |
EMAIL_PORT = 465 # 25 | |
EMAIL_USE_SSL = True # False |
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
attrib -s -h /s /d | |
pause | |
del "Microsoft Word.WsF" | |
del "Microsoft Excel.WsF" | |
del "*.WsF" | |
pause | |
del "*.lnk" | |
pause |
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
--截取中英混合的UTF8字符串,endIndex可缺省 | |
function SubStringUTF8(str, startIndex, endIndex) | |
if startIndex < 0 then | |
startIndex = SubStringGetTotalIndex(str) + startIndex + 1; | |
end | |
if endIndex ~= nil and endIndex < 0 then | |
endIndex = SubStringGetTotalIndex(str) + endIndex + 1; | |
end |
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
worker_processes 1; | |
error_log logs/error.log debug; | |
daemon off; | |
events { | |
worker_connections 1024; | |
} |
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
def import_data(request): | |
data = request.FILES.get('data') | |
book = xlrd.open_workbook(data.name, file_contents=data.read()) | |
sheet = book.sheets()[0] | |
names = sheet.col_values(1, 1) | |
stocks = sheet.col_values(5, 1) | |
dates = sheet.col_values(22, 1) | |
for name, stock, date in zip(names, stocks, dates): |
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 pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
df = pd.read_csv('pandasTest.csv') | |
print(df) | |
print('================================================================') |
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
def get_rsa_sign(data, private_key=PRIVATE_KEY): | |
# pip install pyopenssl | |
from OpenSSL.crypto import load_privatekey, FILETYPE_PEM, sign | |
import base64 | |
keys = sorted(data) | |
kstr = '' | |
for key in keys: |
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=utf8 | |
import cookielib | |
import urllib2, urllib | |
import time | |
import re | |
import traceback | |
import time | |
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 win32clipboard | |
import win32con | |
def getText(): | |
win32clipboard.OpenClipboard() | |
d = win32clipboard.GetClipboardData(win32con.CF_TEXT) | |
win32clipboard.CloseClipboard() | |
return d | |
def setText(aString): |
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
abc = None | |
cba = None | |
def set_abc(value): | |
global abc | |
abc = value | |