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 | |
import sys | |
import json | |
import subprocess | |
import os | |
from urllib.parse import urlparse | |
import requests | |
def request(url): |
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 re | |
import json | |
from mitmproxy import ctx | |
from urllib.parse import quote | |
from pprint import pformat | |
def response(flow): | |
path = flow.request.path | |
if path == '/index/index_one_nine_two/make_question': | |
ctx.log.info('Start') |
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
def parse_second(second): | |
m, s = divmod(second, 60) | |
h, m = divmod(m, 60) | |
return "%02d:%02d:%02d" % (h, m, 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
import subprocess | |
def parse_second(second): | |
# https://gist.github.com/ImSingee/f1272ab376066749c2e0141d2f57c320 | |
m, s = divmod(second, 60) | |
h, m = divmod(m, 60) | |
return "%02d:%02d:%02d" % (h, m, s) | |
def get_video_time(file_path, t=False): | |
# ffmpeg (ffprobe) required |
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
def get_random(start=0, end=1, accuracy=0): | |
rnd = random.random() # [0, 1) | |
rnd = (end - start) * rnd + start # [start, end) | |
if accuracy == 0: | |
return int(rnd) | |
else: | |
return round(rnd, accuracy) |
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
def get_head_number(s): | |
m = '' | |
for i in s: | |
if i.isdigit(): | |
m += i | |
else: | |
break | |
if m == '': | |
return None | |
else: |
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
SEEDS = ( | |
(0, '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'), | |
(1, '1234567890'), | |
(2, '1234567890abcdefghijklmnopqrstuvwxyz'), | |
(3, '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'), | |
(4, 'abcdefghijklmnopqrstuvwxyz'), | |
(5, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), | |
(6, '!@\\#$%^&*()/_+=-\'\"'), # 特殊符号:!@\#$%^&*()/_+=-'" | |
(7, ''), | |
(8, ''), |
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
def get_distance(latitude_start, latitude_end, longitude_start, longitude_end): | |
""" | |
计算经纬度距离差 | |
:param latitude_start: 纬度1 | |
:param latitude_end: 纬度2 | |
:param longitude_start: 经度1 | |
:param longitude_end: 经度2 | |
:return: | |
""" | |
import math |
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
global NEED_CONFIRM | |
on run {} | |
set NEED_CONFIRM to true | |
set theSelecteditems to my selectedActions() | |
if (count of theSelecteditems) is equal to 0 then | |
display alert "请选择一个有效的动作" as critical | |
return |
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
on run {} | |
set i to 1 | |
repeat with _action in my selectedActions() | |
my processAction(_action, i) | |
set i to i + 1 | |
end repeat | |
tell application "OmniFocus" | |
tell default document | |
compact | |
end tell |
OlderNewer