Skip to content

Instantly share code, notes, and snippets.

@jfeilbach
jfeilbach / clean_mkv.sh
Last active May 4, 2019 17:02
strip all non english audio tracks and all subtitles from mkv
#!/bin/bash
# keep only audio track 1
# keep no subtitle tracks
# or use -map 0:m:language:eng
LOGLEVEL='warn'
OPTS='-hide_banner -loglevel ${LOGLEVEL}'
for x in *.mkv ; do
echo ${x}
ffmpeg ${OPTS} -i "${x}" -map 0:v -map 0:a:0 -map -0:s -c copy "new-${x}"
@jfeilbach
jfeilbach / colors.vim
Last active April 23, 2019 17:33
~/.vim/colors for Ubuntu 19.10
" Basic init
scriptencoding utf-8
set background=dark
if version > 580
hi clear
if exists("syntax_on")
syntax reset
endif
endif
syntax enable
@jfeilbach
jfeilbach / check_update.md
Last active April 15, 2023 18:20
check if reboot needed on RHEL or Ubuntu

RHEL

Should work on Amazon Linux as well

needs-restarting -r ; echo $?

or

needs-restarting -r || shutdown -r

or

#!/bin/bash
@jfeilbach
jfeilbach / add_cover_m4a.sh
Last active April 22, 2019 19:34
add album cover art to m4a audio files, requires AtomicParsley
#!/bin/bash
# This will add cover art to all *.m4a in a directory without transcoding the input file
# jpeg or png only
# requires AtomicParsley 'sudo apt install AtomicParsley'
# run in your working directory
# JPEGs will be converted into PNGs
SECONDS='0'
COVER=${1}
CMD='AtomicParsley'
@jfeilbach
jfeilbach / add_cover_flac.sh
Last active May 1, 2019 17:49
add album cover art to flac audio files
#!/bin/bash
# add cover art image to flac audio files, requires metaflac
# run from working directory
SECONDS=0
COVER=${1}
COUNT=$(ls *.flac | wc -l)
COUNTER='1'
CMD='metaflac'
NC='\e[0m'
@jfeilbach
jfeilbach / get_temp.sh
Last active April 11, 2019 19:29
Get disk temperatures in Fahrenheit
#!/bin/bash
# list the temperatures of all sd devices and convert it to Fahrenheit
# Will get temp for USB devices as well
for i in /dev/sd? ; do
temp=$(smartctl --all ${i} | grep "^194" | awk '{ print $10 }' | awk -v RS=" " '{printf("%.1f ",$1*1.8+32)}')
echo ${i} ${temp} deg F
done
exit 0
@jfeilbach
jfeilbach / get_splunk.sh
Created April 8, 2019 20:11
Get splunk universal forwarder download URL
#!/bin/bash
#URL="https://www.splunk.com/en_us/download/splunk-enterprise.html"
URL="https://www.splunk.com/en_us/download/universal-forwarder.html"
OS_REGEX="linux-2\.6-x86_64\.rpm"
#OS_REGEX="Linux-x86_64\.md5"
RESPONSE=`curl -s --connect-timeout 10 --max-time 10 $URL`
LINK=`echo $RESPONSE | egrep -o "data-link=\"https://[^\"]+-${OS_REGEX}\"" | cut -c12- | rev | cut -c2- | rev`
@jfeilbach
jfeilbach / add_cover_mp3.sh
Last active April 16, 2019 19:31
add cover art to mp3 files (a reality sometimes)
#!/bin/bash
# This will add cover art to all *.mp3 in a directory without transcoding the input file
# requires ffmpeg
# JPEGs will be converted into PNGs
SECONDS=0
COVER=${1}
CMD='ffmpeg'
COUNT=$(ls *.mp3 | wc -l)
COUNTER='1'
@jfeilbach
jfeilbach / get_tls.sh
Last active June 25, 2019 19:38
Get TLS cert expiration and send reminder
#!/bin/bash
SECONDS=0
RED='\033[0;31m'
WHITE='\033[1;37m'
CYAN='\033[0;36m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
LIST='host1 host2 host3'
@jfeilbach
jfeilbach / gist:fb27b2bc211892e07cc4a36d7c154294
Created March 12, 2019 20:53 — forked from Ray33/gist:ba189a729d81babc99d7cef0fb6fbcd8
Amazon Elastic Network Adapter (ENA) on CentOS 7
sudo su
yum --enablerepo=extras install epel-release
yum -y install patch dkms kernel-devel perl
yum update
reboot
sudo su