Skip to content

Instantly share code, notes, and snippets.

View dale-c-anderson's full-sized avatar

Dale Anderson dale-c-anderson

View GitHub Profile
#!/bin/bash
W_PATH="$(xclip -selection clipboard -o)"
U_PATH="$(echo "$W_PATH" | sed -e 's/\\/\//g' -e 's/A:/\/media\/accounts/g')"
nautilus "$U_PATH"
@dale-c-anderson
dale-c-anderson / .bash_aliases
Created November 1, 2017 18:04 — forked from vratiu/.bash_aliases
Git shell coloring
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
# Reset
Color_Off="\[\033[0m\]" # Text Reset
@dale-c-anderson
dale-c-anderson / gist:0829da885ee117580407aa8d2f292e2a
Created November 1, 2019 18:00 — forked from mancubus77/gist:447281619be3731461b73dd4a18593c5
Prometheus node exporter init.d (Centos6/RHEL6)
#!/bin/bash
#
# /etc/rc.d/init.d/node_exporter
#
# Prometheus node exporter
#
# description: Prometheus node exporter
# processname: node_exporter
# Source function library.
@dale-c-anderson
dale-c-anderson / authkeys_to_sha256.sh
Last active June 7, 2024 17:23 — forked from SharkyRawr/authkeys_to_sha256.sh
Convert OpenSSH authorized_keys entries in to sha256 sums used in /var/log/auth.log
#!/bin/bash
set -eu -o pipefail
function main() {
AUTHORIZED_KEYS=${1:-~/.ssh/authorized_keys}
while read -r p; do
echo -e "\n$p ->"
echo "$p" | awk '{ print $2 }' | # Only the actual key data without prefix or comments
base64 -d | # decode as base64
sha256sum | # SHA256 hash (returns hex)