Skip to content

Instantly share code, notes, and snippets.

View Decstasy's full-sized avatar
☺️

Dennis Decstasy

☺️
  • Hamburg, Germany
View GitHub Profile
#!/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 / 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() {
@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 / 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 / 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 / args_parser.sh
Last active January 16, 2024 18:42
Parse Bash arguments without getopts or getopt
#!/bin/bash
# Dennis Ullrich
# Version 0.1-0 (2017-06-29)
# request@decstasy.de
# Bash Version 3 required (it also works with ksh)
[[ ${BASH_VERSINFO[0]} -lt 3 ]] && exit 1
# Defaults
stdin=0