几个小脚本
2019獨角獸企業(yè)重金招聘Python工程師標準>>>
隨便翻一下谷歌瀏覽器調(diào)試工具(F12)執(zhí)行過的腳本,摘幾個貼一下。
原文鏈接:http://www.markjour.com/article/20181205-scripts.html
隨意轉(zhuǎn)載,留個上面這個鏈接即可,哈哈。
Gitee GVP
導(dǎo)出 GVP 項目列表,做個參考。
var jqEleProjects = $('#gvp-index-segment > div.ui.four.cards.all-projects > div > div.content.description-content'); var projects = {}; var languages = {}; var types = {}; jqEleProjects.each(function(){var name = $(this).find('h3 > a').text();var url = $(this).find('h3 > a').attr('href');var type = $(this).find('div > div > div:nth-child(1)').text();var language = $(this).find('div > div > div:nth-child(2)').text();projects[name] = {name: name, url: url, type: type, language: language};if (!languages.hasOwnProperty(language)) { languages[language] = []; }languages[language].push(name);if (!types.hasOwnProperty(type)) { types[type] = []; }types[type].push(name);// console.log(name + ' - ' + type + ' - ' + language + ' - ' + url); }); console.log(projects); console.log(languages); console.log(types);API 測試時先調(diào)登錄接口
xhr = new XMLHttpRequest(); xhr.open('post', 'http://localhost:9996/login', true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.send('username=catroll&password=123456');heidiSQL 找回數(shù)據(jù)庫密碼
get database password from heidisql settings file
有個配置文件,就在 heidisql 安裝目錄下,叫 settings.txt,自己找找。
function heidiDecode(hex) {var str = '';var shift = parseInt(hex.substr(-1));hex = hex.substr(0, hex.length - 1);for (var i = 0; i < hex.length; i += 2)str += String.fromCharCode(parseInt(hex.substr(i, 2), 16) - shift);return str; }Python 版本:
from __future__ import print_functionimport re import codecsHEIDI_CONF = '/media/sf_D_DRIVE/Program Files/HeidiSQL/settings.txt' HEIDI_CONF_SEP = re.compile(re.escape('<|||>'))def heidi_pw_decode(code):shift = int(code[-1])code = code[:-1]password = ''.join(map(lambda x: chr(int(x, 16) - shift), re.findall(r'\w{2}', code)))return passworddef main():with codecs.open(HEIDI_CONF, encoding="utf8") as fp:lines = [line.strip() for line in fp.readlines()if line.startswith('Servers') and '\\Password<' in line]passwords = []for line in lines:parts = HEIDI_CONF_SEP.split(line)server_name = parts[0].split('\\')[1]password = heidi_pw_decode(parts[-1])passwords.append((server_name, password))if passwords:print(' All Database Passwords '.center(80, '-'))print()for server_name, password in passwords:print('Database: %s' % server_name)print('Password: %s' % password)print()else:print('[INFO] No password can be found!')if __name__ == '__main__':main()列出 Python 文檔中的章節(jié)
我當時好像是為了比對 2 和 3 的文檔章節(jié)差異,看看 3 多了些什么...
- https://docs.python.org/2/library/
- https://docs.python.org/3/library/
自動刪除網(wǎng)易郵箱的郵件
有些文件夾下的郵件實在太多,好幾千封,兩百大幾十頁,要是一個一個的全選、刪除、等執(zhí)行完成,那不累死,不是程序員該做的事。
寫了個腳本,自動勾選刪除。
PS:腳本沒有找到,等找到了再補上。
轉(zhuǎn)載于:https://my.oschina.net/catroll/blog/2979193
總結(jié)
- 上一篇: 测试访问速度
- 下一篇: 冲刺第八天 12.4 TUE