Skip to content

Instantly share code, notes, and snippets.

View wotori's full-sized avatar
🦀
Fighting with the borrow checker

Wotori Movako wotori

🦀
Fighting with the borrow checker
View GitHub Profile
@wotori
wotori / ffmpeg_tips_and_tricks.md
Last active January 26, 2024 09:31
ffmpeg sequences of video

simple batch video conversion

for i in .avi; do ffmpeg -i "$i" "${i%.}.mp4"; done

deinterlace

-vf yadif -c:v libx264 -preset slow -crf 19 -c:a aac -b:a 256k

for i in *.avi; do ffmpeg -i "$i" -vf yadif -c:v libx264 -preset slow -crf 19 -c:a aac -b:a 256k "${i%.avi}.mp4"; done

more comprehensive script

# 1. Compress a video to the smallest possible size
ffmpeg -i input.mp4 -vf "scale=iw/2:ih/2" -c:v libx265 -preset ultrafast -crf 28 -c:a aac -b:a 64k output.mp4
# 2. Remove audio from a video
ffmpeg -i input.mp4 -an output.mp4
# 3. Convert a video to a GIF
ffmpeg -i input.mp4 -vf "fps=10,scale=320:-1:flags=lanczos" output.gif
# 4. Convert a specific part of a video to a GIF (from 30s, duration 10s)
@wotori
wotori / copy.py
Last active August 4, 2023 13:32
copy media by date creation
import os
import shutil
from datetime import datetime
from tqdm import tqdm
source = "/from"
dest = "/to"
dist_set = set()
file_count = 0
@wotori
wotori / copy_gb_games.py
Created April 30, 2023 19:16
copy U or UE and [!] gb games
import os
import shutil
from tqdm import tqdm
gb_games = []
gbc_games = []
folder_path = "/Users/wotori/Documents/ROMS/GB/"
@wotori
wotori / mac_terminal.md
Created September 7, 2022 10:28
mac terminal

hide desktop

defaults write com.apple.finder CreateDesktop false; killall Finder

dump remote

pg_dump --dbname=postgresql://postgres:DB_PASSWORD@DB_HOST:DB_PORT/DB_NAME -f ~/backup.sql

dump into db

pg_dump --dbname=postgresql://postgres:DB_PASSWORD@DB_HOST:DB_PORT/DB_NAME | psql -U postgres DB_NAME

docker example

docker exec local_pg_container bash -c "pg_dump --dbname=postgresql://postgres:DB_PASSWORD@DB_HOST:DB_PORT/DB_NAME | psql -U postgres DB_NAME"

# from here https://askubuntu.com/questions/59356/how-do-i-get-chinese-input-to-work
sudo apt-get install ibus-pinyin;
# or
sudo apt-get install ibus-sunpinyin;
# reduce animation
dconf write /org/gnome/desktop/interface/enable-animations false
@wotori
wotori / ffmpeg
Last active April 22, 2022 08:08
video to gif
```
ffmpeg -ss 0 -t 10 -i enter.mp4 -vf "fps=10,scale=500:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 enter.gif
```
git filter-branch --index-filter 'git rm -rf --cached --ignore-unmatch path_to_file' HEAD