This file contains 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
{"lastUpload":"2020-11-03T15:09:27.151Z","extensionVersion":"v3.4.3"} |
This file contains 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 subprocess | |
def getClipboardData(): | |
p = subprocess.Popen(['pbpaste'], stdout=subprocess.PIPE) | |
retcode = p.wait() | |
data = p.stdout.read() | |
return data |
This file contains 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 BaseModel(models.Model): | |
create_time = models.DateTimeField(verbose_name=u'创建时间', auto_now_add=True) | |
update_time = models.DateTimeField(verbose_name=u'更新时间', auto_now=True) | |
objects = BaseManager() | |
def get_type(self): | |
return self.__class__.__name__ |
This file contains 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, re, sys, time | |
def filerev(somefile, buffer=256): | |
somefile.seek(0, os.SEEK_END) | |
size = somefile.tell() | |
lines = [''] | |
rem = size % buffer | |
pos = max(0, (size // buffer - 1) * buffer) | |
while pos >= 0: |
This file contains 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 ssl | |
context = ssl._create_unverified_context() | |
urllib.urlopen("https://no-valid-cert", context=context) | |
requests.get('URL', verify=False) |
This file contains 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 pickle | |
data = {'username': 'fengxu'} | |
s = pickle.dumps(data) | |
data2 = pickle.loads(s) |
This file contains 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
# 根据全局的对象名称获取对象实例,类似java的class.forName | |
self.obj = globals()[api](*args, **kwargs) | |
# 根据方法名称执行方法 | |
attr = getattr(self, api) | |
attr(*args, **kwargs) |
This file contains 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: utf-8 -*- | |
# @author weishu @2015/12/7 | |
import subprocess | |
import os | |
import re | |
import json |
This file contains 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
function getParam(name, url) { | |
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); | |
if (!url){ | |
url = window.location.href; | |
} | |
if(url.indexOf("?") <0){ | |
return null; | |
} | |
var query = url.substr(url.indexOf("?"), url.length); | |
var r = query.substr(1).match(reg); |
This file contains 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 FileTransferForm(forms.Form): | |
name = forms.CharField() | |
file_path = forms.CharField() | |
dest = forms.CharField() | |
user = forms.CharField() | |
server_ids = forms.CharField() | |
def clean_server_ids(self): | |
return self.data.getlist('server_ids', []) |