Skip to content

Instantly share code, notes, and snippets.

View maurofaccenda's full-sized avatar

Mauro Faccenda maurofaccenda

View GitHub Profile
variant: fcos
version: 1.5.0
passwd:
users:
- name: faccenda
groups:
- sudo
- wheel
- docker
ssh_authorized_keys:
@maurofaccenda
maurofaccenda / transcode.sh
Last active January 7, 2025 14:53
Shrink video file with ffmpeg keeping all information
#!/usr/bin/env bash
input_file=$0
output_file=$1
x264_params="cabac=1:ref=5:analyse=0x133:me=umh:subme=9:chroma-me=1:deadzone-inter=21:deadzone-intra=11:b-adapt=2:rc-lookahead=60:vbv-maxrate=10000:vbv-bufsize=10000:qpmax=69:bframes=5:b-adapt=2:direct=auto:crf-max=51:weightp=2:merange=24:chroma-qp-offset=-1:sync-lookahead=2:psy-rd=1.00,0.15:trellis=2:min-keyint=23:partitions=all"
ffmpeg -y -vsync 0 -i "$input_file" -copy_unknown -map_metadata 0 -map 0 -codec copy -c:v libx264 -crf 27 \
-x264-params "$x264_params" -c:a aac -ar 44100 -b:a 128k "$output_file"
@maurofaccenda
maurofaccenda / environment
Created July 24, 2025 22:38
BEST SOLUTION FOR CEDILLA ON LINUX
LC_CTYPE="pt_BR.UTF-8"
@maurofaccenda
maurofaccenda / retry.sh
Last active August 5, 2025 14:16
retry in bash/zsh
# one-liner for adding a retry function in bash
# usage:
# retry <number of tries> <delay between each try> <command>
retry () { tries=0 ; max_tries="$1" ; delay="$2" ; shift 2 ; while [ "$tries" -lt "$max_tries" ] && ! $* ; do sleep "$delay" ; >&2 echo "Retrying..." ; ((tries++)) ; done }