Skip to content

Instantly share code, notes, and snippets.

View Luocy7's full-sized avatar
💭
🚴🏽

Luocy Luocy7

💭
🚴🏽
View GitHub Profile
@Luocy7
Luocy7 / rm_old_subtitles_and_add_chi_subtitle.sh
Created November 20, 2023 08:52
batch script for removing old subtitles and adding ass format subtitles in the same directory as an MKV file
#!/bin/bash
# Set default values
current_dir="$(pwd)"
work_dir=$(gum input --placeholder "work_dir (default: $current_dir)")
test -z "$work_dir" && work_dir=$current_dir
with_subdir="true"
output_dir="$work_dir/output"
if [ ! -d "$output_dir" ]; then
@Luocy7
Luocy7 / alembic work properly with PostgreSQL schemas.md
Last active October 18, 2023 06:07
Alembic work properly with PostgreSQL schemas

Alembic work properly with PostgreSQL schemas

Version

  • alembic: 1.12.0
  • python: 3.11
  • Sqlalchemy: 2.0.22

Init

@Luocy7
Luocy7 / cutoff.sh
Created August 7, 2023 01:25
cut relive video advertising off use gum and ffmpeg
WORK_DIR=$(gum input --placeholder "Work dir path, default:.")
INPUT_FILE_PATH=$(gum file "$WORK_DIR")
if [ ! -d "$WORK_DIR" ] || [ ! -f "$INPUT_FILE_PATH" ]; then
echo "path not exist"
exit
fi
OUTPUT_FILE=$(gum input --placeholder "Output file name, like: output.mp4")
OUTPUT_FILE="${OUTPUT_FILE:-output.mp4}"
OUTPUT_FILE_PATH=$WORK_DIR/$OUTPUT_FILE
@Luocy7
Luocy7 / Jetbrains External Tools.xml
Created July 6, 2023 03:04
Pycharm black&poetry export tools
<toolSet name="External Tools">
<tool name="Black" description="Black is the uncompromising Python code formatter." showInMainMenu="false" showInEditor="false" showInProject="false" showInSearchPopup="false" disabled="false" useConsole="false" showConsoleOnStdOut="false" showConsoleOnStdErr="true" synchronizeAfterRun="true">
<exec>
<option name="COMMAND" value="$PyInterpreterDirectory$/black" />
<option name="PARAMETERS" value="$FilePath$" />
<option name="WORKING_DIRECTORY" value="$ProjectFileDir$" />
</exec>
</tool>
<tool name="Poetry Export" description="poetry export to requirements.txt" showInMainMenu="false" showInEditor="false" showInProject="false" showInSearchPopup="false" disabled="false" useConsole="false" showConsoleOnStdOut="false" showConsoleOnStdErr="true" synchronizeAfterRun="true">
<exec>
@Luocy7
Luocy7 / pyenv_init.sh
Last active January 17, 2022 14:27
pyenv init for wsl ubuntu20
#!/bin/sh
pyenv_home=$HOME/.pyenv
pyenv_cache=$pyenv_home/cache
pip_folder=$HOME/.pip
pip_file=$pip_folder/pip.conf
if [ ! -d "$pyenv_home" ]; then
git clone https://github.com/pyenv/pyenv.git "$pyenv_home"
git clone https://github.com/pyenv/pyenv-virtualenv.git "$pyenv_home"/plugins/pyenv-virtualenv
@Luocy7
Luocy7 / DeleteFolder.reg
Last active January 4, 2022 08:35
Delete folders such as 3D objects under ’This PC‘ in Windows Explorer
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{0ddd015d-b06c-45d5-8c4c-f59713854639}\PropertyBag]
"ThisPCPolicy"="Hide"
; Pictures
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{35286a68-3c57-41a1-bbb1-0eae73d76c95}\PropertyBag]
"ThisPCPolicy"="Hide"
; Videos