Skip to content

Instantly share code, notes, and snippets.

Mathias Perlet mperlet

View GitHub Profile
@mperlet
mperlet / Google Meet Focus And Toggle Mic
Created May 26, 2020
I use that script for a gnome keyboard shortcut
View Google Meet Focus And Toggle Mic
xdotool search --name 'Meet' | xargs xdotool windowactivate;sleep 0.2; xdotool key Ctrl+d
View record_mp3_and_split.sh
# record from soundcard
parec -d 1 | lame -r -V0 - my.mp3
# split file by silence
ffmpeg -i my.mp3 -af silencedetect=noise=-30dB:d=0.5 -f null - 2>&1 | grep silence_end | cut -d" " -f 5 | xargs -L 2 | nl | xargs -l bash -c 'ffmpeg -i my.mp3 -acodec copy -ss $1 -to $2 my$0.mp3'
@mperlet
mperlet / pycheck.sh
Created Jan 4, 2019
Check python files in pwd
View pycheck.sh
function pycheck() {
echo
echo
echo
find . -name "*.py" | xargs mypy --ignore-missing-imports
echo
echo
@mperlet
mperlet / imagediff.sh
Created Sep 6, 2018
Diff two images with imagemagick without saving them
View imagediff.sh
#!/bin/bash
# TODO: Add Readme
# TODO: Add Example
# TODO: Check if imagemagick is installed
IMG_A="$1"
IMG_B="$2"
convert "$IMG_A" "$IMG_B" <(compare "$IMG_A" "$IMG_B" -) +append - | display
View Abfall_LRO_iCal_Api.sh
curl 'https://www.abfall-lro.de/wp-content/themes/abfall_lro/ical.php?letters=B_K_D_P&year=2018&black=4w&green=&yellow=y&blue=y'
@mperlet
mperlet / vcy
Created Feb 11, 2018
vlc player chromecast youttube-dl
View vcy
#!/bin/bash
# v - VLC Player
# c - chromecast
# y - youttube-dl
CHROMECASTIP="192.168.178.39"
STREAMURI="$1"
CERTDIR="$HOME/.vcy"
mkdir -p "$CERTDIR"
@mperlet
mperlet / yt2mp3.sh
Created Aug 23, 2017
Convert Youtube-Videos or Playlists to mp3
View yt2mp3.sh
#!/bin/bash
# Example: $ yt2mp3 "https://www.youtube.com/playlist?list=PL63F1E17EE312CC7D"
function yt2mp3 () {
youtube-dl -i -t --extract-audio --audio-format mp3 "$1"
}
View randomStress.sh
#!/bin/bash
echo "Start random stress"
while true; do
RANYES=$[ ( $RANDOM % 4 ) + 1 ]
RANSTR=$[ ( $RANDOM % 300 ) + 1 ]s
RANSLEEP=$[ ( $RANDOM % 3000 ) + 1 ]s
echo "Start $RANYES proccess for $RANSTR seconds"
c=1
View split_file_into_two_parts.sh
FILE="myfile.txt"
split -l $(( $(wc -l "$FILE" | cut -d" " -f1) / 2 )) "$FILE" "$FILE_split_"
@mperlet
mperlet / gist:563055c0b7df5f2af8968568d685ab21
Created Jun 10, 2017
Merge mp4 files with ffmpeg in one bash line
View gist:563055c0b7df5f2af8968568d685ab21
# input current mp4 files, output: merged.mp4
ls *mp4 | sed "s#^#file '#g" | sed "s#\$#'#g" > tm.txt && ffmpeg -f concat -safe 0 -i tm.txt -c copy merged.mp4 && rm tm.txt
You can’t perform that action at this time.