Compare commits

...

13 Commits

6 changed files with 141 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2019-2022, 2025 Kris Lamoureux <kris@lamoureux.io>
# SPDX-FileCopyrightText: 2019-2022, 2025-2026 Kris Lamoureux <kris@lamoureux.io>
# SPDX-License-Identifier: 0BSD
# shellcheck shell=bash
@@ -11,8 +11,13 @@ alias 'otheralias'='vim ~/.other_aliases && . ~/.bash_aliases'
alias 'viewalias'='view ~/.bash_aliases'
alias 'refreshalias'='source ~/.bash_aliases'
# File management
alias put='mv --update=none-fail --verbose'
alias copy='cp --update=none-fail --verbose'
alias mv='mv -i'
# SSH management
alias 'fssh'='ssh-add && ssh -A'
alias 'fssh'='ssh-add && ssh -A -S none'
alias 'editssh'='vim ~/.ssh/config'
# Edit hosts file
@@ -77,20 +82,20 @@ alias 'signhist'='git rebase --exec "git commit -S --amend --no-edit -n"'
alias 'signhistnew'='git rebase --exec "git commit -S --amend --date '\''`date -R`'\'' --no-edit -n"'
function gd() {
git diff HEAD~$1
git diff "HEAD~$1"
}
function rebase() {
git rebase -i HEAD~$1
git rebase -i "HEAD~$1"
}
function delcommit() {
git reset --hard HEAD~$1
git reset --hard "HEAD~$1"
}
# Docker shortcuts
function inspect() {
docker inspect "$1" | less
docker inspect "$1" | less
}
# Color shift
@@ -103,9 +108,11 @@ alias 'socks'='screen -dm ssh -D 1337 -q -C -N'
# sshuttle proxy
#e.g. alias 'proxyhome'='proxy user hostdomain:22 192.168.1.0/24'
function proxy() {
screen -dm sshuttle -v -r $1@$2 -x $2 ${@:2}; screen -r;
screen -dm sshuttle -v -r "$1@$2" -x "$2" "${@:2}"
screen -r
}
if [ -f ~/.other_aliases ]; then
source ~/.other_aliases
# shellcheck disable=SC1090
source ~/.other_aliases
fi

5
docker/.local/bin/docker Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2025 Kris Lamoureux
# SPDX-License-Identifier: 0BSD
unset DOCKER_HOST
exec /usr/bin/docker "$@"

4
docker/.local/bin/podman Executable file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2025 Kris Lamoureux
# SPDX-License-Identifier: 0BSD
exec /usr/bin/docker --context podman "$@"

90
gotify/.local/bin/gotify Executable file
View File

@@ -0,0 +1,90 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2025 Kris Lamoureux
# SPDX-License-Identifier: GPL-3.0-or-later
set -euo pipefail
for cmd in curl jq; do
if ! command -v "$cmd" &>/dev/null; then
echo "[ERROR]: $cmd is required but can't be found"
exit 1
fi
done
USAGE="Usage: $0 [-v] <priority> <title> <message>"
VERBOSE=0
while getopts "hv" OPT; do
case "$OPT" in
h)
echo "$USAGE"
exit 0
;;
v)
VERBOSE=1
;;
*)
echo "$USAGE"
exit 1
;;
esac
done
shift $((OPTIND - 1))
if [ $# -lt 3 ]; then
echo "[ERROR]: Missing required arguments"
echo "$USAGE"
exit 1
fi
if [ -z "${GOTIFY_URL:-}" ] || [ -z "${GOTIFY_TOKEN:-}" ]; then
if [ -d ~/.config/gotify ] && [ -f ~/.config/gotify/env ]; then
# shellcheck disable=SC1090
. ~/.config/gotify/env
fi
fi
if [ -z "${GOTIFY_URL:-}" ]; then
echo "[ERROR]: GOTIFY_URL environment variable is not set"
exit 1
fi
if [ -z "${GOTIFY_TOKEN:-}" ]; then
echo "[ERROR]: GOTIFY_TOKEN environment variable is not set"
exit 1
fi
PRIORITY="$1"
TITLE="$2"
MESSAGE="$3"
if ! echo "$PRIORITY" | grep -qE '^[0-9]+$'; then
echo "[ERROR]: Priority must be a number, got: $PRIORITY"
exit 1
fi
if ! PAYLOAD=$(
jq -nc \
--argjson priority "$PRIORITY" \
--arg title "$TITLE" \
--arg message "$MESSAGE" \
'{title: $title, message: $message, priority: $priority}'
); then
echo "[ERROR]: Error with input syntax"
exit 1
fi
if ! RESPONSE=$(
curl -sSf -X POST "$GOTIFY_URL/message" \
-H "X-Gotify-Key: $GOTIFY_TOKEN" \
-H "Content-Type: application/json" \
-d "$PAYLOAD"
); then
echo "[ERROR]: Couldn't send message to $GOTIFY_URL"
echo "$RESPONSE"
exit 1
fi
if [ "$VERBOSE" -eq 1 ]; then
echo "$RESPONSE"
fi
exit 0

25
tmux/.tmux.conf Normal file
View File

@@ -0,0 +1,25 @@
# prefix+r to reload
bind r source-file ~/.tmux.conf \; display "Config reloaded!"
# long history, 2k default
set-option -g history-limit 100000
# vi-style key bindings in copy mode, etc
set-window-option -g mode-keys vi
# Trying out mouse mode for now, use shift to bypass to local emulator
bind-key m set-option -g mouse \; display "Mouse: #{?mouse,ON,OFF}"
set -g mouse on
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
# F12 to toggle whether tmux commands affect local or nested (remote) session
bind -T root F12 \
set prefix None \;\
set key-table off \;\
refresh-client -S
bind -T off F12 \
set -u prefix \;\
set -u key-table \;\
refresh-client -S

View File

@@ -18,3 +18,5 @@ if &term =~ '256color'
set t_ut=
endif
" Use tabs in shell
autocmd FileType sh setlocal tabstop=4 shiftwidth=4 noexpandtab