📱 Erkannter Endgerättyp ⛱️ Tag und Nacht. Verbraucht keinen oder einen 🍪. 🖼️ Hintergrund ändern. Verbraucht keinen oder einen 🍪.
🧬 0 Ihre DNS in den Krei.se-DNS-Servern, führt zum Bio-Labor 🍪 0 Anzahl Ihrer gespeicherten Kekse, führt zur Keksdose       

🌃 Konsolen-Zeug

Hier sammel ich so meine Skripte :)

Bash-RC für alle Nutzer

Diese beinhalten nur einen Fix für SCP/SFTP wenn das /etc/skel nicht kopiert wird (nervt sonst),

eine unendliche History und den MC-Wrapper.

/etc/bash.bashrc ergänzen:

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

export HISTSIZE=-1 # infinite
export HISTFILESIZE=-1 # infinite

alias mc='. /usr/lib/mc/mc-wrapper.sh'

SSHA-Agent automatisch starten und lokalen Socket setzen-Funktion

function ssha() {

    # Get the current hostname
    local current_hostname=$(hostname)

    # Specify the SSH agent environment file based on the hostname
    local agent_file="$HOME/.ssh-agent-$current_hostname"

    # Get the user's UID
    local uid=$(id -u) 

    # Sockets per Machine (not used currently)
    local agent_dir="/tmp/ssh-agent"
    local agent_sock="${agent_dir}/${uid}-ssh-sock"

    # Ensure the directory exists with proper permissions
    mkdir -p "$agent_dir"
    chmod 700 "$agent_dir"

    # Check if the SSH agent environment file exists
    if [ -f "$agent_file" ]; then
        # Load the environment variables from the file
        . "$agent_file" > /dev/null
    fi

    # Check if the SSH agent is still running
    if [ -z "$SSH_AGENT_PID" ] || ! ps -p "$SSH_AGENT_PID" > /dev/null 2>&1; then
        echo "Starting a new SSH agent..."
        # Start a new SSH agent and save its environment variables
        eval $(ssh-agent -s) > /dev/null
        echo "export SSH_AUTH_SOCK=$SSH_AUTH_SOCK" > "$agent_file"
        echo "export SSH_AGENT_PID=$SSH_AGENT_PID" >> "$agent_file"
        ssh-add ~/.ssh/id_ed25519

    #echo $SSH_AUTH_SOCK

        # Symlink the socket to the machine socket directory
        ln -sf "$SSH_AUTH_SOCK" "$agent_sock"

    else
        echo "Using existing SSH agent with PID $SSH_AGENT_PID"
    fi

}

# Automatically run `ssha` to ensure the agent is loaded
ssha

🐄 Schlaue und schöne Cowsay-Sprüche

root@linux:~# apt install fortunes cowsay

# sind beide in /usr/games, das ist aber nicht im Pfad, in bashrc mit setzen

root@linux:~# git clone https://github.com/paulkaefer/cowsay-files
root@linux:~# cd cowsay-files
root@linux:~# make install

/etc/bash.bashrc

# True Color Cows (not many):
# COWS=($(ls /usr/local/share/cowsay-files/cows/true-color/*.cow 2>/dev/null))
# 256-color cows (~500)
COWS=($(ls /usr/local/share/cowsay-files/cows/*.cow 2>/dev/null))
RAND_COW_INDEX=$(($RANDOM % ${#COWS[@]}))
RAND_COW=${COWS[$RAND_COW_INDEX]}
COW_NAME=$(basename $RAND_COW .cow)

PATH=$PATH:/usr/games

# Eigene Sprüche in Home
# ~/fortunes erstellen, jede Zeile ein Spruch, mit % neuer Spruch
# danach
# user@linux:~# strfile -c % fortunes fortunes.dat

# MESSAGE="$COW_NAME sagt: $(fortune ~/fortunes)"

# Irgendwelche Sprüche
MESSAGE="$COW_NAME sagt: $(fortune)"

echo $MESSAGE | cowsay -f $RAND_COW ""

Konsolenhintergrund einfärben

Das ist etwas komplexer, denn wir biegen lokal su und auch ssh etwas um, damit es danach auch wieder zurückgesetzt wird:

# dark purple background 
# https://www.color-hex.com/color-palette/1044210

# Hier die Farbe für diesen User setzen

BGCOLOR=608511

# https://www.canva.com/colors/color-wheel/ with Tetradic

# intern color palette
#852611 root
#368511 user
#117085 server
#601185 entertainment

# extern color palette
#261185 public ns1 
#851136 public ns2
#708511 public firewall
#118560 public www

echo -e "\033]11;#$BGCOLOR\007"

function ssh_alias() {
    TERM=xterm-256color ssh "$@";
    #reset background
    echo -e "\033]11;#$BGCOLOR\007";
}

alias ssh=ssh_alias

function su_alias() {
    su "$@";
    #reset background
    echo -e "\033]11;#$BGCOLOR\007";
}

alias su=su_alias

🇺🇸 US-Interface, aber 🇩🇪 deutsches Datums-Format:

root@linux:~# dpkg-reconfigure locales

de_DE.UTF-8 und en_US.UTF-8 auswählen, en_US.UTF-8 als Standard nehmen

/etc/default/locale (evtl. symlink zu /etc/locale.conf)

LANG=en_US.UTF-8
LANGUAGE="en_US:en"
LC_TIME=de_DE.UTF-8