Skip to content

Instantly share code, notes, and snippets.

View Decstasy's full-sized avatar
☺️

Dennis Decstasy

☺️
  • Hamburg, Germany
View GitHub Profile
@Decstasy
Decstasy / csv2ascii.ksh
Last active July 1, 2017 14:12
Convert csv to ascii table (mysql style)
#!/bin/ksh
# Dennis Ullrich
# Version 1.0-0 (2017-07-01)
# request@decstasy.de
csv2ascii(){
if [[ $# -ne 2 ]]; then
echo "$0 [separator] [file or \"-\" for stdin]"
return false
fi
@Decstasy
Decstasy / bash_unset_readonly_variable_poc.sh
Last active September 16, 2017 01:13
Unset a readonly variable in bash. ITS JUST A PROOF OF CONCEPT! DONT USE THIS FOR REAL, ITS NASTY!!!
#!/bin/bash
# Dennis Ullrich
# request@decstasy.de
# 2017-06-17
# Unset readonly variable in bash
# ITS JUST A PROOF OF CONCEPT! DONT USE THIS FOR REAL, ITS NASTY!!!
readonly testvar="Bla bla"
unset testvar
@Decstasy
Decstasy / lsscsi-for-bashrc.sh
Created October 4, 2017 09:52
simple lsscsi for .bashrc if there is no repository available or the server is too old
#!/bin/bash
# Dennis Ullrich
# request@decstasy.de
# 2017-10-03
# Insert the following to your .bashrc and execute "source ~/.bashrc"
# It is for servers with no connection to a repository as a short workaround
if ! type lsscsi >/dev/null 2>&1; then
lsscsi() {
#!/bin/bash
# Dennis U.
# request@decstasy.de
#
# Script to shutdown local machine when a remote host is not available
# Check out the exception_present function!
#
# V 0.1 Initial release
# V 0.2 Added support for exceptions
@Decstasy
Decstasy / check_mounts.sh
Created July 5, 2017 11:19
Compare /etc/fstab with /proc/mounts and try remount if something is missing
#!/bin/bash
# Dennis Ullrich
# Version 0.1-0 (2017-07-02)
# request@decstasy.de
if [ "$1" = "-v" ]; then
set -x
shift
fi
@Decstasy
Decstasy / get_upgradable_packages.sh
Last active September 16, 2018 22:07
Lists upgradable packages comma separated on systems with apt package management (hopefully)
#!/bin/bash
# Dennis Ullrich
#
# Lists upgradable packages comma separated on systems with apt package management (hopefully)
# Made for "Linux Helpdesk Deutschland - Hilfe für Linux Einsteiger" group
#
# 2018-09-14 v0.1: First release
# 2018-09-14 v0.2: Improved code... No read, while loops etc... Everything is processed with bash internals.
get_upgradable_packages() {
@Decstasy
Decstasy / check_uptime
Created April 2, 2019 17:24
Checks server uptime on linux machines and raises critical if uptime <= 5 minutes
#!/bin/bash
#####
#
# Author: Dennis Ullrich (request@decstasy.de)
#
# Description:
# Checks server uptime on linux machines and raises critical if uptime <= 5 minutes.
# Made for icinga2 - parameters are not implemented yet.
#
@Decstasy
Decstasy / rtsp-stream.sh
Created April 15, 2019 13:49
Starts VLC RTSP Stream from Raspberry Pi Camera
#!/bin/bash
ip=( $(ip a | grep inet | grep -v 127.0.0 | grep -oP '(\d{1,3}.){3}\d{1,3}') )
echo "Connect with VLC Media Player via Network stream: rtsp://${ip[0]}:8554/"
echo "Press enter to start the stream..."
read lol
raspivid -o - -t 0 -n | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/}' :demux=h264
@Decstasy
Decstasy / check_net_if_stats.sh
Last active January 14, 2020 12:58
Icinga check to get network interface performance data
#!/bin/bash
# Dennis Ullrich
# request@decstasy.de
####################################
############# Variables ##########
################################
# Arrays
declare -A interface
#!/bin/bash
if [[ $# -ne 1 ]]; then
echo "$0 [path to sysstat file made with: \"LANG=POSIX LC_ALL=C sar -Adp\"]"
exit 1
fi
_FILE = "$1"
# Der Parser von ksar mag bestimmte sachen nicht und beendet sich dann mit einer exception