Вирізка аудіо з відео
# ffmpeg -i video.mp4 -q:a 0 -map a audio.mp3
Оцифровка тексту з аудіофайлу
# whisper файл.mp4 --language Ukrainian
Вирізка аудіо з відео
# ffmpeg -i video.mp4 -q:a 0 -map a audio.mp3
Оцифровка тексту з аудіофайлу
# whisper файл.mp4 --language Ukrainian
$fonts = @(
"FiraCode", "JetBrainsMono", "Consolas", "Monaspace",
"Monaco", "Inconsolata", "DejaVuSansMono", "Hack",
"UbuntuMono", "Iosevka", "Menlo", "IBMPlexMono",
"CascadiaCode", "VictorMono", "SourceCodePro"
)
$fontFolder = "$env:TEMP\fonts"
New-Item -ItemType Directory -Force -Path $fontFolder | Out-Null
Set-Location $fontFolder
foreach ($f in $fonts) {
$url = "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.1/$f.zip"
$zip = "$f.zip"
Invoke-WebRequest -Uri $url -OutFile $zip
Expand-Archive -Path $zip -DestinationPath "$f" -Force
$ttfs = Get-ChildItem "$f" -Filter "*.ttf"
foreach ($ttf in $ttfs) {
Copy-Item $ttf.FullName -Destination "$env:WINDIR\Fonts" -Force
$fontRegName = $ttf.BaseName
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" -Name "$fontRegName (TrueType)" -Value $ttf.Name -PropertyType String -Force
}
}
зберігаємо в fonts.ps1
запускаємо під адміном:
powershell -ExecutionPolicy Bypass -File .\fonts.ps1
pip install mysqlclient --config-settings="build_options.c_options=-IC:\Program Files\MariaDB\MariaDB Connector C 64-bit\include -LC:\Program Files\MariaDB\MariaDB Connector C 64-bit\lib"
sudo dd bs=4M if=/path/to/iso/file of=/dev/sdb status=progress && sync
DELETE FROM history_uint WHERE clock < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 2 DAY)); DELETE FROM history WHERE clock < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 2 DAY)); DELETE FROM trends_uint WHERE clock < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 2 DAY)); DELETE FROM trends WHERE clock < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 2 DAY)); DELETE FROM events WHERE clock < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 2 DAY)); DELETE FROM alerts WHERE clock < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 2 DAY));
SET GLOBAL validate_password.LENGTH = 4;
SET GLOBAL validate_password.policy = 0;
SET GLOBAL validate_password.mixed_case_count = 0;
SET GLOBAL validate_password.number_count = 0;
SET GLOBAL validate_password.special_char_count = 0;
SET GLOBAL validate_password.check_user_name = 0;
ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'password';FLUSH PRIVILEGES;
створюємо файл
/etc/profile.d/qt-fix.sh
з наступним вмістом
# For the graphical elements export QT_SCALE_FACTOR=1.5 # To make the fonts readable export QT_FONT_DPI=96 export QT_AUTO_SCREEN_SCALE_FACTOR=1
FROM ubuntu:14.04 ENV DEBIAN_FRONTEND noninteractive ##///*******************************************************/ ##//------------------------ ## append apt mirror for ubuntu, update & install ##//------------------------ ## RUN sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list RUN echo "deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse" > /etc/apt/sources.list RUN echo "deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse" >> /etc/apt/sources.list RUN echo "deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse" >> /etc/apt/sources.list RUN echo "deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse" >> /etc/apt/sources.list RUN echo "deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse" >> /etc/apt/sources.list ## do update, upgrade (which may not be needed) & install: RUN apt-get update -y && apt-get -y upgrade RUN apt-get install -y debconf build-essential \ software-properties-common python-software-properties \ nano vim git htop wget curl nload unzip RUN rm -rf /var/lib/apt/lists/*
deb http://archive.ubuntu.com/ubuntu precise main universe restricted multiverse deb http://archive.ubuntu.com/ubuntu precise-security universe main multiverse restricted deb http://archive.ubuntu.com/ubuntu precise-updates universe main multiverse restricted deb http://archive.ubuntu.com/ubuntu precise-proposed universe main multiverse restricted
Є скрипт під віндою, який час від часу залипає і це є проблемою. Варіант вирішення - задавати час на виконання функції, якщо він перевищує поріг, вбивати виконання функції. Нагуглив кілька варіантів, але під віндою не працює SIGALRM. А цей сніп досить гарно працює.
import multiprocessing
import time
# bar
def bar():
for i in range(100):
print "Tick"
time.sleep(1)
if __name__ == '__main__':
# Start bar as a process
p = multiprocessing.Process(target=bar)
p.start()
# Wait for 10 seconds or until process finishes
p.join(10)
# If thread is still active
if p.is_alive():
print "running... let's kill it..."
# Terminate - may not work if process is stuck for good
p.terminate()
# OR Kill - will work for sure, no chance for process to finish nicely however
# p.kill()
p.join()
в zabbix_agentd.conf
EnableRemoteCommands=1
файл: checkdomain.sh
#!/bin/bash
DOMAIN="$1"
data=$(whois $1 | grep -E 'paid|Expir|expir' | grep -o -E '[0-9]{4}.[0-9]{2}.[0-9]{2}|[0-9]{2}/[0-9{2}/[0-9]{4}' | tr . / | awk 'NR == 1')
expire=$((`date -d "$data" '+%s'`))
today=$((`date '+%s'`))
lefts=$(($expire - $today))
leftd=$(($lefts/86400))
echo $leftd
Items:
в zabbix_agentd.conf
EnableRemoteCommands=1
файл: checkssl.sh
#!/bin/bash
ssl-cert-check -s $1 -p $2 -n | sed 's/ */ /g' | cut -f6 -d" " | sed -e 's#|days=##'
Items:
# touch /etc/systemd/system/icecast.service
[Unit]
Description=Icecast Network Audio Streaming Server
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/Icecast-Server/bin/icecast -c /usr/local/Icecast-Server/etc/icecast.xml
ExecReload=/bin/kill -HUP $MAINPID
User=radio
Group=radio
WorkingDirectory=/usr/local/Icecast-Server
[Install]
WantedBy=multi-user.target
# systemctl enable icecast
# systemctl start icecast
# systemctl stop icecast
# systemctl restart icecast
Таблиці:
SELECT CONCAT('ALTER TABLE ',
table_schema,
'.',
table_name,
' COLLATE=utf8_bin;') AS cmd
FROM (SELECT table_schema,
table_name,
table_collation
FROM information_schema.tables t
WHERE table_schema = 'zabbix'
AND table_collation != 'utf8_bin') AS tables
ORDER BY cmd;Поля:
SELECT CONCAT('ALTER TABLE ',
table_schema,
'.',
table_name,
' MODIFY COLUMN ',
column_name,
' ',
column_type,
' CHARACTER SET utf8 COLLATE utf8_bin',
defaultval,
nullable,
';') AS cmd
FROM (SELECT table_schema,
table_name,
column_name,
collation_name,
character_set_name,
column_type,
column_default,
CASE
WHEN column_default IS NULL THEN ''
ELSE CONCAT(' DEFAULT ''', column_default, ''' ')
END AS defaultval,
CASE
WHEN is_nullable = 'NO' THEN ' NOT NULL '
ELSE ''
END AS nullable
FROM information_schema.columns
WHERE table_schema = 'zabbix'
AND ( collation_name != 'utf8_bin'
OR character_set_name != 'utf8' )) AS cols
ORDER BY cmd;
# /etc/systemd/system/docker-compose-app.service
[Unit]
Description=Docker Compose Application Service
Requires=docker.service
After=docker.service
[Service]
Type=oneshot
RemainAfterExit=yes
WorkingDirectory=/srv/docker
ExecStart=/usr/local/bin/docker-compose up -d
ExecStop=/usr/local/bin/docker-compose down
TimeoutStartSec=0
[Install]
WantedBy=multi-user.target
активовуємо автозапуск сервісу# systemctl enable docker-compose-app
DELETE FROM `table` WHERE id NOT IN ( SELECT id FROM ( SELECT id FROM `table` ORDER BY id DESC LIMIT 10 -- keep this many records ) foo );