Skip to content

Instantly share code, notes, and snippets.

ArneAnka / gist:051571f0306c52a9aeccc4c6eee28448
Last active June 30, 2019 11:44
Find images, and copy or move them
View gist:051571f0306c52a9aeccc4c6eee28448
# Two scripts that do the same thing a little different, notice `mv` and `cp`. Your choice
# What will happen is that find will recursivly serach the current folder for images, read when
# the file was created, and move/copy it to a corresponding folder.
# This is from
find -E . -regex '.*\.(jpg|JPG|png|PNG|jpeg|JPEG|bmp|BMP)' | while read file; do
ts=$(stat -f '%Sm' -t '%Y-%m-%d' "$file")
ArneAnka / gist:f245043a1fd2a29c68cb4f71b78203c7
Created April 10, 2017 20:01
Extract rar files recursively and remove the rar files afterwards
View gist:f245043a1fd2a29c68cb4f71b78203c7
# Assuming extglob option of bash is set, which is the default, otherwise set with shopt -s extglob
`find . -name '*.rar' -exec unrar e {} \; -exec rm {} \; && rm *.r+([[:digit:]])`
# Maybe better option?
find . -name '*.rar' -exec unrar e {} \; -exec rm {} \; && rm *.r*
ArneAnka / gist:bf636079faa9df86f7511b38982424ed
Created May 11, 2017 11:42
Search images of a specific dimension
View gist:bf636079faa9df86f7511b38982424ed
# This scripts helps you when seraching images of a speceifc dimension. Lets
# say you want to remove thumbnails or something, then this is good!
# Notice the `echo`, remove that and run the script. That will REMOVE you files.
# Change `rm` to `cp` to copy the files if you want to review them before deletion.
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";
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##*.}"' {} \;
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: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>
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 (
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