Tidy files
Former-commit-id: 3ad18d4bae036b9c55576f4c8b726a32a4e30c76
This commit is contained in:
@ -7,10 +7,9 @@ from traceback import print_exc
|
|||||||
|
|
||||||
def init():
|
def init():
|
||||||
if len(argv) != 2:
|
if len(argv) != 2:
|
||||||
print("Usage: a.py file.mp3")
|
print(f"Usage: {__file__} file.mp3")
|
||||||
exit(1)
|
exit(1)
|
||||||
return argv[1]
|
return argv[1]
|
||||||
# return "新课程外研高一第32期.mp3"
|
|
||||||
|
|
||||||
def make_dir(pth:str):
|
def make_dir(pth:str):
|
||||||
if not path.isdir(pth):
|
if not path.isdir(pth):
|
||||||
|
@ -1,88 +0,0 @@
|
|||||||
from sys import argv,exit
|
|
||||||
from pydub import AudioSegment,silence
|
|
||||||
from os import path,mkdir,system
|
|
||||||
from shutil import rmtree
|
|
||||||
from traceback import print_exc
|
|
||||||
from json import dumps,loads
|
|
||||||
|
|
||||||
|
|
||||||
def init():
|
|
||||||
if len(argv) != 2:
|
|
||||||
print("Usage: a.py file.mp3")
|
|
||||||
exit(1)
|
|
||||||
return argv[1]
|
|
||||||
# return "新课程外研高一第32期.mp3"
|
|
||||||
|
|
||||||
def make_dir(pth:str):
|
|
||||||
if not path.isdir(pth):
|
|
||||||
try:
|
|
||||||
mkdir(pth)
|
|
||||||
except PermissionError:
|
|
||||||
print("Could not create directory '{pth}' because of permission error.".format(pth=pth))
|
|
||||||
exit(-1)
|
|
||||||
else:
|
|
||||||
ipt=input(f"'{pth}' exists. Remove it [YES/no]: ")
|
|
||||||
if ipt == "" or ipt == "yes":
|
|
||||||
try:
|
|
||||||
rmtree(pth)
|
|
||||||
except PermissionError:
|
|
||||||
print("Could not remove '{pth}' because of permission error.".format(pth=pth))
|
|
||||||
exit(-1)
|
|
||||||
mkdir(pth)
|
|
||||||
else:
|
|
||||||
print(f"Warning: Directory '{pth}' exists, which may influence the programm!")
|
|
||||||
|
|
||||||
def cut(file:AudioSegment,length:list[int],keep=300) -> AudioSegment:
|
|
||||||
maxlen = len(file)
|
|
||||||
bgn,end=length
|
|
||||||
if bgn-keep>=0:
|
|
||||||
bgn-=keep
|
|
||||||
if end+keep<=maxlen:
|
|
||||||
end+=keep
|
|
||||||
return file[bgn:end]
|
|
||||||
|
|
||||||
def main():
|
|
||||||
file = init()
|
|
||||||
NAMES=["BASIC", "1-5", "Others"]
|
|
||||||
make_dir("OUTPUT")
|
|
||||||
for i in NAMES:
|
|
||||||
make_dir(f"OUTPUT/{i}")
|
|
||||||
print("Reading file ...")
|
|
||||||
file:AudioSegment = AudioSegment.from_file(file)
|
|
||||||
print("Detecting audio segments ...")
|
|
||||||
arr=silence.detect_nonsilent(
|
|
||||||
file,
|
|
||||||
silence_thresh=-100,
|
|
||||||
seek_step=500,
|
|
||||||
min_silence_len=4000
|
|
||||||
)
|
|
||||||
print("Cutting audio segments ...")
|
|
||||||
group=[]
|
|
||||||
groups=[]
|
|
||||||
|
|
||||||
groups.append([(cut(file,arr[0]),'info'),(cut(file,arr[1]),'example')])
|
|
||||||
for i in range(2,2+5):
|
|
||||||
group.append((cut(file,arr[i]),str(i-1)))
|
|
||||||
groups.append(group)
|
|
||||||
group=[]
|
|
||||||
for i in range(7,len(arr)-1,2):
|
|
||||||
group.append((cut(file,arr[i]),f"Tips_of_{(i-7)//2+6}"))
|
|
||||||
group.append((cut(file,arr[i+1]),f"Text_{(i-7)//2+6}"))
|
|
||||||
groups.append(group)
|
|
||||||
for i,group in enumerate(groups):
|
|
||||||
print(f"Saving audio segments '{NAMES[i]}' ...")
|
|
||||||
for f,name in group:
|
|
||||||
f.export(f"OUTPUT/{NAMES[i]}/{name}.mp3")
|
|
||||||
print("Done!")
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
try:
|
|
||||||
main()
|
|
||||||
except SystemExit:
|
|
||||||
system("pause")
|
|
||||||
except KeyboardInterrupt as e:
|
|
||||||
raise e
|
|
||||||
except Exception:
|
|
||||||
print("An unexpected exception occurred.")
|
|
||||||
print_exc()
|
|
78
README.md
Normal file
78
README.md
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
# 个人使用小工具集
|
||||||
|
|
||||||
|
## [修改连接数](changeConnectionLimit)
|
||||||
|
|
||||||
|
win10修改wifi热点最大连接终端数
|
||||||
|
|
||||||
|
Usage:`main.bat`
|
||||||
|
|
||||||
|
## [学*网预览下载](zxxk_dl)
|
||||||
|
|
||||||
|
下载学*网资源,通过预览的形式,下载的文件以html形式保存。可以使用adobe Acrobat的打印转为pdf,文字版文件以svg下载,图片版原图。
|
||||||
|
|
||||||
|
1. 研究过程:[process.md](zxxk_dl/process.md)
|
||||||
|
|
||||||
|
2. usage: `python main.py`
|
||||||
|
3. requirements: python, requests
|
||||||
|
|
||||||
|
## adb快速传手机文件
|
||||||
|
|
||||||
|
源文件丢了,TODO
|
||||||
|
|
||||||
|
## [并行auto-editor](mult)
|
||||||
|
|
||||||
|
并行运行auto-editor, 递归转码所有视频。(PS:网课时用的)
|
||||||
|
|
||||||
|
### files
|
||||||
|
|
||||||
|
#### main.py
|
||||||
|
|
||||||
|
主程序
|
||||||
|
|
||||||
|
### main_up.py
|
||||||
|
|
||||||
|
使用hevc(CUDA)硬解码
|
||||||
|
|
||||||
|
### usage
|
||||||
|
|
||||||
|
`python main.py`
|
||||||
|
|
||||||
|
## 菁*网题目下载
|
||||||
|
|
||||||
|
**ATTENTION:目前制作时的账号疑似被封禁,请谨慎使用**
|
||||||
|
|
||||||
|
如需打印,请使用浏览器打印或转pdf
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
菁优网任意界面,F12抓Cookie
|
||||||
|
运行main.py,输入复制的内容,根据提示输入网址即可。
|
||||||
|
|
||||||
|
### requements
|
||||||
|
|
||||||
|
python, requests,bs4
|
||||||
|
|
||||||
|
## [听力文件拆分](English_Listening_cut)
|
||||||
|
|
||||||
|
基于学英语报的听力做听力文件拆解,拆分到每段对话
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
`python main.py`
|
||||||
|
|
||||||
|
## seat_map
|
||||||
|
|
||||||
|
文档TODO
|
||||||
|
|
||||||
|
## 简单运动报警(move_warn)
|
||||||
|
|
||||||
|
对ip摄像头画面进行简单运动捕捉,核心代码来自网络。效果:运动达到一定范围,发出声音警告后自动关闭程序。
|
||||||
|
|
||||||
|
### usage
|
||||||
|
|
||||||
|
`python main.py`
|
||||||
|
|
||||||
|
### requirements
|
||||||
|
|
||||||
|
python, opencv
|
||||||
|
|
10
autostart.py
Normal file
10
autostart.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
from getpass import getpass
|
||||||
|
from subprocess import Popen
|
||||||
|
|
||||||
|
cmd=input("SSH: ").split()
|
||||||
|
pwd=getpass()
|
||||||
|
port=cmd[2]
|
||||||
|
ip=cmd[3].replace("root@",f"root:{pwd}@")
|
||||||
|
print(ip,port)
|
||||||
|
Popen(fr'"C:\Program Files (x86)\NetSarang\Xshell 7\Xshell.exe" ssh://{ip}:{port}')
|
||||||
|
ssh=Popen(f"ssh -CNg -L 6006:127.0.0.1:6006 -p {port} {cmd[3]}")
|
1
bfg-1.14.0.jar.REMOVED.git-id
Normal file
1
bfg-1.14.0.jar.REMOVED.git-id
Normal file
@ -0,0 +1 @@
|
|||||||
|
688fe713674b914c519bef018aa47f7a8ba18d58
|
39
changeConnectionLimit/main.bat
Normal file
39
changeConnectionLimit/main.bat
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
@echo off
|
||||||
|
:: Check if the script is run as administrator
|
||||||
|
NET SESSION >nul 2>&1
|
||||||
|
if %errorLevel% neq 0 (
|
||||||
|
echo Requesting administrator permissions...
|
||||||
|
goto runAsAdmin
|
||||||
|
) else (
|
||||||
|
goto main
|
||||||
|
)
|
||||||
|
|
||||||
|
:runAsAdmin
|
||||||
|
:: Request administrator permissions
|
||||||
|
powershell Start-Process "%0" -Verb RunAs
|
||||||
|
exit /B
|
||||||
|
|
||||||
|
:main
|
||||||
|
:: Get user input for WifiMaxPeers value
|
||||||
|
set /p WifiMaxPeersInput="Enter WifiMaxPeers value (decimal): "
|
||||||
|
|
||||||
|
:: Validate if the input is a number
|
||||||
|
set "WifiMaxPeers=%WifiMaxPeersInput%" 2>nul
|
||||||
|
if not defined WifiMaxPeers (
|
||||||
|
echo Invalid input. Please enter a valid decimal number.
|
||||||
|
pause
|
||||||
|
exit /B
|
||||||
|
)
|
||||||
|
|
||||||
|
:: Set the registry value
|
||||||
|
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\icssvc\Settings" /v WifiMaxPeers /t REG_DWORD /d %WifiMaxPeers% /f
|
||||||
|
|
||||||
|
echo WifiMaxPeers registry value set to %WifiMaxPeers%.
|
||||||
|
|
||||||
|
echo Restarting icssvc service.
|
||||||
|
|
||||||
|
net stop icssvc
|
||||||
|
net start icssvc
|
||||||
|
|
||||||
|
echo Succeed.
|
||||||
|
pause
|
4
fast_pull/main.py
Normal file
4
fast_pull/main.py
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
from subprocess import run
|
||||||
|
|
||||||
|
path="Sounds"
|
||||||
|
# Get file list
|
Binary file not shown.
Before Width: | Height: | Size: 117 KiB |
@ -4,8 +4,6 @@ from winsound import PlaySound,SND_ALIAS,SND_ASYNC
|
|||||||
from time import time
|
from time import time
|
||||||
# Beep(500,500)
|
# Beep(500,500)
|
||||||
|
|
||||||
# camera = cv2.VideoCapture(0) # 参数0表示第一个摄像头
|
|
||||||
# camera = cv2.VideoCapture("opt.flv")
|
|
||||||
camera = cv2.VideoCapture("http://192.168.124.17:8081/live.flv")
|
camera = cv2.VideoCapture("http://192.168.124.17:8081/live.flv")
|
||||||
# 判断视频是否打开
|
# 判断视频是否打开
|
||||||
if (camera.isOpened()):
|
if (camera.isOpened()):
|
4
pwd.txt
Normal file
4
pwd.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
***REMOVED***
|
||||||
|
***REMOVED******REMOVED***
|
||||||
|
***REMOVED***
|
||||||
|
***REMOVED******REMOVED***
|
74
seat_map/main.py
Normal file
74
seat_map/main.py
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
import numpy as np
|
||||||
|
from pandas import DataFrame
|
||||||
|
|
||||||
|
# seat = np.arange(48,dtype=np.byte).reshape((4,2,6))
|
||||||
|
seat = np.fromfile('seat.dat',dtype=np.byte).reshape((4,2,6))
|
||||||
|
print(seat.shape)
|
||||||
|
|
||||||
|
maps = np.arange(4)
|
||||||
|
maps[-1]=maps[0]
|
||||||
|
maps[:-1]+=1
|
||||||
|
|
||||||
|
seat[:,:,-1]=seat[:,:,0]
|
||||||
|
seat[:,:,0:-1]+=1
|
||||||
|
seat = seat[maps,:,:]
|
||||||
|
|
||||||
|
seat.tofile("seat.dat")
|
||||||
|
|
||||||
|
names = np.array([
|
||||||
|
"张姝肜",
|
||||||
|
"乔旺源",
|
||||||
|
"焦祺",
|
||||||
|
"丛金旺",
|
||||||
|
"周巧冉",
|
||||||
|
"张日昊",
|
||||||
|
"刘卓",
|
||||||
|
"宋智宪",
|
||||||
|
"张文桦",
|
||||||
|
"王子来",
|
||||||
|
"姜樱楠",
|
||||||
|
"于诗澳",
|
||||||
|
"张潇艺",
|
||||||
|
"李语恒",
|
||||||
|
"*",
|
||||||
|
"张晓轩",
|
||||||
|
"宋佳怡",
|
||||||
|
"宋雨蔓",
|
||||||
|
"于世函",
|
||||||
|
"王梁宇",
|
||||||
|
"*",
|
||||||
|
"毕一聪",
|
||||||
|
"娄晴",
|
||||||
|
"黄卓琳",
|
||||||
|
"刘宇航",
|
||||||
|
"刘雨鑫",
|
||||||
|
"庞惠铭",
|
||||||
|
"徐子灏",
|
||||||
|
"阎展博",
|
||||||
|
"崔子豪",
|
||||||
|
"王明仁",
|
||||||
|
"王耀增",
|
||||||
|
"李善伊",
|
||||||
|
"吴庆波",
|
||||||
|
"樊乐天",
|
||||||
|
"潘一鸣",
|
||||||
|
"洛艺伟",
|
||||||
|
"周含笑",
|
||||||
|
"苏振宇",
|
||||||
|
"沈洁",
|
||||||
|
"李柏畅",
|
||||||
|
"毕思淼",
|
||||||
|
"张濠亿",
|
||||||
|
"李怡萱",
|
||||||
|
"高镆",
|
||||||
|
"张妍",
|
||||||
|
"杨颜聪",
|
||||||
|
"李南卓阳"
|
||||||
|
])
|
||||||
|
opt = seat.reshape((8,6))
|
||||||
|
opt = opt[:,::-1]
|
||||||
|
print(DataFrame(opt))
|
||||||
|
opt = names[opt]
|
||||||
|
with open("seat.csv", "w", encoding="gb2312") as f:
|
||||||
|
for i in range(6):
|
||||||
|
print(",".join(opt[:,i]),file=f)
|
@ -30,7 +30,7 @@ def writefile(filename,text):
|
|||||||
def main():
|
def main():
|
||||||
softID=input("ID: ")
|
softID=input("ID: ")
|
||||||
url = "https://www.zxxk.com/soft/Preview/FirstLoadPreviewJson?softID={}&type=3&product=1&v=2&FullPreview=true"
|
url = "https://www.zxxk.com/soft/Preview/FirstLoadPreviewJson?softID={}&type=3&product=1&v=2&FullPreview=true"
|
||||||
response = requests.get(url.format(softID))
|
response = requests.get(url.format(softID),verify=False)
|
||||||
if response.status_code!=200:
|
if response.status_code!=200:
|
||||||
print("ERROR")
|
print("ERROR")
|
||||||
print(response.status_code)
|
print(response.status_code)
|
||||||
@ -66,7 +66,7 @@ def main():
|
|||||||
if "jpg" in url:
|
if "jpg" in url:
|
||||||
l.append(f"<img src={url} />")
|
l.append(f"<img src={url} />")
|
||||||
continue
|
continue
|
||||||
page=requests.get(url,cookies=response.cookies)
|
page=requests.get(url,cookies=response.cookies,verify=False)
|
||||||
if not page.status_code==200:
|
if not page.status_code==200:
|
||||||
print(page)
|
print(page)
|
||||||
print(page.status_code)
|
print(page.status_code)
|
||||||
|
Reference in New Issue
Block a user