Skip to content

Instantly share code, notes, and snippets.

View senventise's full-sized avatar

Senventise senventise

View GitHub Profile
@senventise
senventise / mox2cbz.fish
Last active January 28, 2024 05:14
将 kepub 转为 cbz 格式。
#!/bin/fish
argparse --name mox2cbz 'w/webp' -- $argv
or return
# input filename
set fn $argv
# output filename
set out_fn (basename $fn ".epub")".cbz"
@senventise
senventise / sub_match.py
Last active February 24, 2024 08:30
Match filename of videos and subtitles.
import sys
import os
import re
"""
USAGE: python sub_match.py DIR
"""
@senventise
senventise / shell_cheatsheet.md
Last active December 3, 2023 02:42
各种自用 shell 命令的 cheatsheet 大杂集。

视频加速

速度较慢,-an不保留音频。

ffmpeg -i input.mkv -an -filter:v "setpts=PTS/60" output.mkv

图片二值化

将扫描版图片转为黑白,自适应threshold,效果挺好。

convert input.png -colorspace gray -negate -lat 50x50+10% -negate output.png
@senventise
senventise / auto-reload.sh
Created April 22, 2023 12:59
Auto re-run a script when its content is modified (and saved).
#!/bin/fish
set SCRIPT_PATH "/path/to/script.py"
set EXEC_PATH /bin/python
while true
inotifywait -e modify $SCRIPT_PATH && $EXEC_PATH $SCRIPT_PATH
end
@senventise
senventise / fix_extension.fish
Created February 1, 2023 07:52
Fix wrong extension with `file`
#!/usr/bin/env fish
argparse --name=test "d/dryrun" "p/path=" -- $argv
if test $_flag_d
echo "Dry running..."
end
if not test -d $_flag_p
echo "Path not exists: $_flag_p"