Skip to content

Instantly share code, notes, and snippets.

ArneAnka / gist:612b9f51566b73b10fc8b3eddce16747
Created July 8, 2022 16:50
Get all emails from a file with grep and regex
View gist:612b9f51566b73b10fc8b3eddce16747
`$ grep -E -o "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b" file.txt`
View Mini preview of

mkv or mp4 shouldn't matter because they get decoded before getting filtered. Try removing just that option ( :force_divisible_by=2 ) and see if it works.

That select filter is a lot to digest, here I'll highlight some of the key tunable numbers so you can adjust it and find what works best for your content.

ffmpeg -i "video" -vsync vfr -vf "select=if(gt(scene\,0.5)*(isnan(prev_selected_t)+gte(t-prev_selected_t\,2))\,st(1\,t)*0*st(2\,ld(2)+1)\,if(ld(1)*lt(ld(2)\,4)\,between(t\,ld(1)+2\,ld(1)+4))),scale=320:180:force_original_aspect_ratio=decrease:flags=bicubic+full_chroma_inp:sws_dither=none,framestep=2,setpts=N/(12*TB)" -an -sn -map_metadata -1 -compression_level 5 -q:v 75 -loop 0 -f webp -y "out.webp"

1st "2" is the minimum number of seconds between captured scene cuts.

2nd "4" is n+1 number of scene cuts to capture.

ArneAnka / gist:1bf5b39cfd208e7c10caf28d17f416cb
Created July 29, 2020 06:14
Move "The" to the end of a column
View gist:1bf5b39cfd208e7c10caf28d17f416cb
UPDATE games
SET title = CASE WHEN INSTR(title,' ')>0
AND LEFT(title,INSTR(title,' '))
IN ('The ')
,SUBSTRING(title,INSTR(title,' ')+2)
, ', '
, LEFT(title,INSTR(title,' ')-1))
ELSE title
View Mount NAS
# Check if the script is being executed as root
if [[ $EUID -ne 0 ]]; then
echo -e "🥴 \033[0;31mThis script must be run as root \033[0m"
exit 1
# Ping the storage server to determin connectivity
View How to pingpong
1. youtube-dl -a lista.txt // Download all lectures with youtube-dl from file `lista.txt`
2. for f in *.mp4; do ffmpeg -i "$f" -vn "$(basename "$f" .mp4).mp3"; done // convert all mp4 to mp3
3. for f in *.mp3; do ffmpeg -i "$f" -af "highpass=f=200, lowpass=f=3000" "$(basename "$f" .mp3)_noice.mp3"; done
4. for f in *_noice.mp3; do ffmpeg -i "$f" -af silenceremove=1:0:-50dB "$(basename "$f" .mp3)_silence.mp3"; done
5. ffmpeg-normalize *.mp3 -c:a libmp3lame -b:a 192k -ext mp3 (,
6. ????
(2. ffmpeg -i input.mp4 -f mp3 -ab 192000 -vn output.mp3)
(3. ffmpeg -i output.mp3 -af "highpass=f=200, lowpass=f=3000" output_clean.mp3) // reduce noice (
ArneAnka / gist:a1348b13fc291f72f862d92f35380428
Created January 5, 2020 13:54
FFmpeg: How to convert vertical video with black sides, to video 16:9, with blurred background sides
View gist:a1348b13fc291f72f862d92f35380428
ffmpeg -i <input_file> -filter_complex "[0:v]scale=ih*16/9:-1,boxblur=luma_radius=min(h\,w)/20:luma_power=1:chroma_radius=min(cw\,ch)/20:chroma_power=1[bg];[bg][0:v]overlay=(W-w)/2:(H-h)/2,crop=h=iw*9/16" <output_file>
ArneAnka / gist:56ce9657190fee72051dbf1012871726
Created December 16, 2018 13:01
How to repair broken permission
View gist:56ce9657190fee72051dbf1012871726
find /home/user -type d -print0 | xargs -0 chmod 0775
find /home/user -type f -print0 | xargs -0 chmod 0664
ArneAnka / gist:2fac16fa6c7204b0990365d1af2f5331
Created December 16, 2018 11:42
Move/copy files to folder corresponding their fileextension
View gist:2fac16fa6c7204b0990365d1af2f5331
find . -type f -exec bash -c 'mkdir -p sorted/"${0##*.}"; cp "$0" sorted/"${0##*.}"' {} \;
View Font-awesome and bulma to a Laravel project
Font awesome:
In App directory, run:
npm install font-awesome
In App/resources/assets/sass/app.scss add
// Font awsome
$fa-font-path: "/assets/fonts";