PYTHONPATH
python -m myscript01 arg1 arg2
refer to:
https://stackoverflow.com/questions/18247333/pythonpath-on-linux
人,技术,生活。
PYTHONPATH
python -m myscript01 arg1 arg2
refer to:
https://stackoverflow.com/questions/18247333/pythonpath-on-linux
from vosk import Model, KaldiRecognizer, SetLogLevel import sys import os import wave import subprocess import codecs import datetime import json def format_sec(sec): total_sec = int(sec) s = total_sec % 60 m = total_sec // 60 h = m // 60 m = m % 60 frame = int(sec * 1000) % 1000 frame = frame // (1000 // 25) return "{0:02d}:{1:02d}:{2:02d},{3:03d}".format(h, m, s, frame) class Stt: def __init__(self, mp4_path): self.index = 0 self.model_path = r'/path/to/vosk-model-en-us-0.42-gigaspeech' self.mp4_path = mp4_path self.ffmpeg_path = 'ffmpeg' self.sample_rate = 16000 self.model = Model(self.model_path) self.rec = KaldiRecognizer(self.model, self.sample_rate) self.rec.SetWords(True) SetLogLevel(-1) self.process = subprocess.Popen([self.ffmpeg_path, '-loglevel', 'quiet', '-i', self.mp4_path, '-ar', str(self.sample_rate), '-ac', '1', '-f', 's16le', '-'], stdout=subprocess.PIPE) def output_one_line(self, result, frm, to, f): sentence = "" start_sec = 60 * 60 * 24 end_sec = 0 for i in range(frm, to): float_value = float(result[i]["start"]) if start_sec > float_value: start_sec = float_value float_value = float(result[i]["end"]) if end_sec < float_value: end_sec = float_value sentence += result[i]["word"] + " " self.index += 1 f.write(str(self.index) + "\n") f.write(format_sec(start_sec) + " --> " + format_sec(end_sec) + "\n") f.write(sentence + "\n") f.write("\n") f.flush() sys.stdout.write(format_sec(end_sec) + "\n") def recv_text(self, subtitle, f): js = json.loads(subtitle) if not "result" in js: sys.stdout.write("no result in json.\n") return result = js["result"] frm = 0 length = len(result) while frm < length: to = frm + 7 if length - to < 7: to = length if to > length: to = length self.output_one_line(result, frm, to, f) frm = to # sys.stdout.buffer.write(subtitle) sys.stdout.flush() def transcribe(self): with open(self.mp4_path + ".srt", 'w') as f: while True: data = self.process.stdout.read(4000) if len(data) == 0: subtitle = self.rec.FinalResult().encode('utf-8') self.recv_text(subtitle, f) break if self.rec.AcceptWaveform(data): subtitle = self.rec.Result().encode('utf-8') self.recv_text(subtitle, f) f.close() stt = Stt(sys.argv[1]) stt.transcribe() |
refer to:
kdenlive-23.04.1/bin/data/kdenlive/scripts/speechtotext.py
https://docs.kdenlive.org/en/effects_and_compositions/subtitles.html
https://realpython.com/python-formatted-output/
eventvwr.msc
C:\Windows\System32\LogFiles\WMI
refer to:
https://superuser.com/questions/1516725/how-to-disable-windows-10-system-log
sudo su cp -R /var/lib/mysql /home/work/ chown -R mysql:mysql /home/work/mysql vi /etc/mysql/mysql.conf.d/mysqld.cnf socket = /home/work/mysql/mysqld.sock datadir = /home/work/mysql systemctl start mysql cat /var/log/mysql/error.log mysqld: File './binlog.index' not found (OS errno 13 - Permission denied) vi /etc/apparmor.d/usr.sbin.mysqld /usr/sbin/mysqld { /home/work/mysql/ r, /home/work/mysql/** rwk, ... systemctl restart apparmor systemctl start mysql |
refer to:
https://askubuntu.com/questions/1089045/mysql8-wont-start
Download win11 iso and reinstall os, keeping user data.
refer to:
https://www.microsoft.com/en-us/software-download/windows11
https://answers.microsoft.com/en-us/windows/forum/all/windows-11-update-error-0x800f0922/3ad1fcf3-15e8-4f3b-9c74-e212b74323cb
https://learn.microsoft.com/en-us/windows/release-health/status-windows-11-22h2
https://helpdeskgeek.com/how-to/how-to-fix-a-windows-update-error-0x800f0922
// @grant GM_addStyle |
And we must delete,
@grant none
refer to:
https://github.com/dorian-marchal/userscript-css-loader/issues/1
qgis-bin.env.sh
sed -e 's/\%CUR_DIR\%/E\:\\tool\\QGIS/g' \ -e 's/\%CUR_DIR_LINUX\%/E\:\/tool\/QGIS/g' qgis-bin.env.scheme > qgis-bin.env
qgis-bin.env.scheme
PATH=%CUR_DIR%\bin;%CUR_DIR%\apps\grass\grass82\lib;%CUR_DIR%\apps\grass\grass82\bin;%CUR_DIR%\apps\qt5\bin;%CUR_DIR%\apps\Python39\Scripts;%CUR_DIR%\bin;%CUR_DIR%\apps\qgis\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBem GDAL_DATA=%CUR_DIR%\apps\gdal\share\gdal GDAL_DRIVER_PATH=%CUR_DIR%\apps\gdal\lib\gdalplugins GDAL_FILENAME_IS_UTF8=YES PDAL_DRIVER_PATH=%CUR_DIR%\apps\pdal\plugins GISBASE=%CUR_DIR%\apps\grass\grass82 GRASS_PROJSHARE=%CUR_DIR%\share\proj GRASS_PYTHON=%CUR_DIR%\bin\python3.exe OSGEO4W_ROOT=%CUR_DIR% PROJ_LIB=%CUR_DIR%\share\proj PYTHONHOME=%CUR_DIR%\apps\Python39 PYTHONPATH=%CUR_DIR%\apps\grass\grass82\etc\python; PYTHONUTF8=1 QGIS_PREFIX_PATH=%CUR_DIR_LINUX%/apps/qgis QT_PLUGIN_PATH=%CUR_DIR%\apps\qgis\qtplugins;%CUR_DIR%\apps\qt5\plugins VSI_CACHE=TRUE VSI_CACHE_SIZE=1000000 O4W_QT_PREFIX=%CUR_DIR_LINUX%/apps/Qt5 O4W_QT_BINARIES=%CUR_DIR_LINUX%/apps/Qt5/bin O4W_QT_PLUGINS=%CUR_DIR_LINUX%/apps/Qt5/plugins O4W_QT_LIBRARIES=%CUR_DIR_LINUX%/apps/Qt5/lib O4W_QT_TRANSLATIONS=%CUR_DIR_LINUX%/apps/Qt5/translations O4W_QT_HEADERS=%CUR_DIR_LINUX%/apps/Qt5/include QGIS_WIN_APP_NAME=QGIS_3.30\QGIS Desktop 3.30.2 SSL_CERT_DIR=%CUR_DIR%\apps\openssl\certs SSL_CERT_FILE=%CUR_DIR%\bin\curl-ca-bundle.crt
Plugins,
QuickOSM Search Layers
refer to:
https://github.com/sourcepole/qgis-openlayers-plugin
http://www.uwenku.com/question/p-gajlmliq-bag.html
https://www.naturalearthdata.com
https://www.qgistutorials.com/en/docs/3/making_a_map.html
Global.iris service of Windows 11, which is related to the wallpaper of the day feature, cannot be turned off from the services menu.
reg delete HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\IrisService |
then reboot the pc.
refer to:
https://windowsreport.com/global-iris-service-windows-11
http://www.ulaojiu.com/xitong/xtjc/20210903/224262.html
Intel non-free wifi firmware,
lspci -nnk lshw -c modinfo iwlwifi dmesg | grep microcode apt install intel-microcode sudo apt-get install--reinstall linux-firmware |
https://www.intel.com/content/www/us/en/support/articles/000005511/wireless.html
https://wiki.debian.org/iwlwifi
https://forums.debian.net/viewtopic.php?t=152523
https://wiki.debian.org/Microcode
Learnt from referred link, we first install Xubuntu along with Win11 in the same metal disk,
then we reboot into Xubuntu, update it to PVE kernel,
# sudo vi /etc/apt/sources.list.d/pve-install-repo.list deb [arch=amd64] http://download.proxmox.com/debian/pve bullseye pve-no-subscription sudo wget https://enterprise.proxmox.com/debian/proxmox-release-bullseye.gpg -O /etc/apt/trusted.gpg.d/proxmox-release-bullseye.gpg sudo apt update sudo apt full-upgrade sudo apt install pve-kernel-5.15 reboot sudo apt install proxmox-ve postfix open-iscsi |
To be continued ...
p.s. dependency failed while installing pve in ubuntu, which means we must play it under debian os.
refer to:
https://post.smzdm.com/p/awzzqlep
https://pve.proxmox.com/wiki/Install_Proxmox_VE_on_Debian_Buster