Skip to content

Instantly share code, notes, and snippets.

View YourFriendCaspian's full-sized avatar
🙃
I'm sure I'll be slow to respond so don't be mad.

yourfriendcaspian YourFriendCaspian

🙃
I'm sure I'll be slow to respond so don't be mad.
View GitHub Profile
@YourFriendCaspian
YourFriendCaspian / htpasswd_command_example.txt
Created August 27, 2023 15:56
Command to hash a username and password with htpasswd.
# username: admin , password: 123 , hash command : htpasswd -nb -B admin 123 | cut -d ":" -f 2
@YourFriendCaspian
YourFriendCaspian / Caddyfile
Last active August 5, 2023 01:59
Working default Nextcloud w/ Caddy docker compose file
https://cloud.domain.com:443 {
header Strict-Transport-Security max-age=31536000;
reverse_proxy localhost:11000
}
function prompt_wikimatze_precmd {
git-info
}
function prompt_wikimatze_setup {
setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS
prompt_opts=(cr percent subst)
# Load required functions.
@YourFriendCaspian
YourFriendCaspian / dexec.sh
Created June 28, 2023 03:11 — forked from papes1ns/dexec.sh
dexec.sh
#!/usr/bin/env bash
set -eu # do not proceed on error
if [ $# -lt 1 ] || [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
cat <<EOF
Quick command to get a shell inside a running docker container.
Usage: dexec [container_name] [command]
@YourFriendCaspian
YourFriendCaspian / Proper_shebang
Created May 1, 2023 11:03
#!/usr/bin/env bash
Please use "#!/usr/bin/env bash" instead of directly linking bash with "#!/bin/bash"
@YourFriendCaspian
YourFriendCaspian / .init.sh
Last active May 1, 2023 10:58
.bashrc.d /.init.sh for directory based bashrc with "Colorful logging helper"
#!/usr/bin/env bash
# Originally from detro (Ivan De Marino)
# https://github.com/detro/.bashrc.d/blob/master/.init.sh
THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &>/dev/null && pwd )"
# Common utilities
case "${OSTYPE}" in
solaris*) OSNAME="SOLARIS" ;;
darwin*) OSNAME="MACOSX" ;;
#!/bin/bash
# Common utilities
case "${OSTYPE}" in
solaris*) OSNAME="SOLARIS" ;;
darwin*) OSNAME="MACOSX" ;;
linux*) OSNAME="LINUX" ;;
bsd*) OSNAME="BSD" ;;
msys*) OSNAME="WINDOWS" ;;
*) OSNAME="${OSTYPE}" ;;
@YourFriendCaspian
YourFriendCaspian / .gitconfig
Last active February 9, 2023 13:37 — forked from chrismccoy/gitcheats.txt
gitconfig cheatsheet
# list all tags
git fetch --all --tags --prune
# sort git tags by date
git for-each-ref --sort=taggerdate --format '%(tag)_,,,_%(taggerdate:raw)_,,,_%(taggername)_,,,_%(subject)' refs/tags | awk 'BEGIN { FS = "_,,,_" } ; { t=strftime("%Y-%m-%d %H:%M",$2); printf "%-20s %-18s %-25s %s\n", t, $1, $4, $3 }'
# delete all local tags, and update with list of remote tags
git tag -l | xargs git tag -d && git fetch -t
# get list of all author's emails of the repo
@YourFriendCaspian
YourFriendCaspian / show-ls-colors.sh
Created November 26, 2022 15:22 — forked from chrisniael/show-ls-colors.sh
Display environment variable LS_COLORS
#!/bin/bash
# Fork from https://github.com/gkotian/gautam_linux/blob/master/scripts/colours.sh
# Script to show the colours used for different file types
# This is just a more readable version of the 'eval' code at:
# http://askubuntu.com/a/17300/309899
# A nice description of the colour codes is here:
@YourFriendCaspian
YourFriendCaspian / .bashrc
Last active May 1, 2023 10:36 — forked from rot26/.bashrc
[.bashrc.d] Use bashrc directory instead of bashrc #bash #bashrc
# Add this to your ~/.bashrc file
# Use .bashrc.d directory instead of bloated .bashrc file
# From: https://waxzce.medium.com/use-bashrc-d-directory-instead-of-bloated-bashrc-50204d5389ff
BASHRC_DIR="${HOME}/.bashrc.d"
# Optionally create directory if not exists
if [ ! -d "${BASHRC_DIR}" ]; then
mkdir -p "${BASHRC_DIR}";
chmod 700 "${BASHRC_DIR}";
fi
# Load any *.bashrc files in ~/.bashrc.d/