Add gitattributesdb support. Update bash startup files. Small changes to other files.

This commit is contained in:
Darren 'Tadgy' Austin 2024-08-25 21:20:56 +01:00
commit 93e8fe1e3f
22 changed files with 742 additions and 620 deletions

View file

@ -20,5 +20,6 @@ hash ssh-add ssh-agent >/dev/null 2>&1 && {
}
# Update the ~/.ssh/agents file.
__read_ssh_agents && __write_ssh_agents
__write_ssh_agents
(( $? == 2 )) && __read_ssh_agents && __write_ssh_agents
}

View file

@ -1,17 +1,14 @@
#!/bin/bash - not strictly necessary, but helps nano with syntax highlighting.
# Bash shell environmental set up.
# Source bash specific set up,
[[ -f "$HOME/.bashrc" ]] && . "$HOME/.bashrc"
# Environment.
export EDITOR="nano"
# Common environment.
export LANG="en_GB.UTF-8"
export LC_COLLATE="POSIX" # 'C' causes issues with some applications
# export LC_CTYPE="POSIX" # Not sure why I set this in the first place...
export LESS='-RM -j.5 -i -PM?f%F:stdin. -- Page %dt of %D -- %lt/%L (%Pt\%)$'
export PAGER="less"
export VISUAL="$EDITOR"
hash less >/dev/null 2>&1 && export PAGER="less"
hash lesspipe >/dev/null 2>&1 && eval "$(SHELL=/bin/sh lesspipe)"
hash nano >/dev/null 2>&1 && export EDITOR="nano" && export VISUAL="$EDITOR"
# Platform specific set up.
PLATFORM="${PLATFORM:-$(uname -s)}"
@ -21,9 +18,10 @@ if [[ "$PLATFORM" = "Linux" ]]; then
export I_WANT_A_BROKEN_PS=1
export LYNX_CFG="$HOME/.lynx.cfg"
export LYNX_LSS="$HOME/.lynx.lss"
export MANPAGER="less"
export MANPAGER="$PAGER"
export MANPATH="$HOME/.local/share/man:$MANPATH"
export PATH="/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
hash dircolors >/dev/null 2>&1 && eval "$(dircolors -b "$HOME/.dir_colors")"
hash gpgconf >/dev/null 2>&1 && {
GPG_SOCK_DIR="$(gpgconf --list-dirs | awk -F : '/socketdir:/ { print $2 }')"
@ -33,6 +31,7 @@ if [[ "$PLATFORM" = "Linux" ]]; then
unset GPG_SOCK_DIR
}
hash gpg-connect-agent >/dev/null 2>&1 && gpg-connect-agent updatestartuptty /bye >/dev/null 2>&1
[[ ! -e "$HOME/.config/lxterminal/lxterminal.conf" ]] && (
cd "$HOME/.config/lxterminal" 2>/dev/null || exit 1
[[ -e "lxterminal.conf-${HOSTNAME%%.*}" ]] && ln -sf "lxterminal.conf-${HOSTNAME%%.*}" "lxterminal.conf"
@ -46,57 +45,20 @@ else
printf "%s: %s\\n" "${BASH_SOURCE##*/}" "unsupported platform: $PLATFORM" >&2
fi
# Add bin directories to PATH.
# Add local perl directories to PATH if they exist.
[[ -d "$HOME/.local/perl5/bin" ]] && export PATH="$HOME/.local/perl5/bin:$PATH"
[[ -d "$HOME/.local/perl5/sbin" ]] && export PATH="$HOME/.local/perl5/sbin:$PATH"
# Add extra bin directories to PATH if they exist.
[[ -d "$HOME/files/bin" ]] && export PATH="$HOME/files/bin:$PATH"
[[ -d "$HOME/.local/bin" ]] && export PATH="$HOME/.local/bin:$PATH"
[[ -d "$HOME/bin" ]] && export PATH="$HOME/bin:$PATH"
# Screen.
hash screen >/dev/null 2>&1 && {
[[ -e "$HOME/.screenrc-${HOSTNAME%%.*}" ]] && export SCREENRC="$HOME/.screenrc-${HOSTNAME%%.*}"
export SCREENDIR="$HOME/.screen-${HOSTNAME%%.*}"
if [[ -n "$SSH_TTY" ]]; then
if [[ -n "$STY" ]]; then
# shellcheck disable=SC2154
printf "%s\\n\\n" "Screen $STY, window $WINDOW."
else
SCREENS="$(screen -ls | grep '[[:alpha:]]' | grep -E -v '^([[:digit:]]+|No) Socket(s)?')"
if [[ -n "$SCREENS" ]]; then
printf "%s\\n\\n" "$SCREENS"
else
printf "%s\\n\\n" "No screens."
fi
unset SCREENS
fi
elif [[ -n "$STY" ]]; then
# shellcheck disable=SC2154
printf "%s\\n\\n" "Screen $STY, window $WINDOW."
else
TTY="$(tty | cut -d/ -f3-)"
SCREENS="$(screen -ls | grep -F "${HOSTNAME%%.*}" | grep -F "${TTY//\//-}")"
# This has to be an echo, not printf.
case "$(echo "${SCREENS:--n}" | wc -l)" in
0)
# No screens found - start a new instance if on a tty.
# Disabled this because screens should be started on chuckie not the desktop/laptop.
# [[ "$TTY" == tty* ]] && screen
:
;;
1)
# Just one screen - reconnect if it's not dead.
if (( $(printf "%s" "$SCREENS" | grep -c -F 'Dead') == 1 )); then
printf "%s:\\n" "Found dead screen for $TTY"
printf "%s\\n" "$SCREENS" | sed -e 's/^/ /g'
else
screen -dr "${TTY//\//-}.${HOSTNAME%%.*}"
fi
;;
*)
# Multiple screens - output a list
printf "%s:\\n" "Multiple screens found for $TTY"
printf "%s\\n" "$SCREENS" | sed -e 's/^/ /g'
;;
esac
fi
unset SCREENS TTY
}
# Read in the environment from .bash_profile.d/*.
for FILE in "$HOME"/.bash_profile.d/*; do
[[ -x "$FILE" ]] && source "$FILE"
done
unset FILE
# Source bash specific set up,
[[ -f "$HOME/.bashrc" ]] && . "$HOME/.bashrc"

21
.bash_profile.d/gitconfig Normal file
View file

@ -0,0 +1,21 @@
#!/bin/bash - not strictly necessary, but helps nano with syntax highlighting.
# Symlink the .gitconfig file to the most specific .gitconfig-* file.
if [[ -e "$HOME/.gitconfig-$USER@$HOSTNAME" ]]; then
FILE=".gitconfig-$USER@$HOSTNAME"
elif [[ -e "$HOME/.gitconfig-$USER@*.${HOSTNAME#*.}" ]]; then
FILE=".gitconfig-$USER@*.${HOSTNAME#*.}"
elif [[ -e "$HOME/.gitconfig-$USER@*" ]]; then
FILE=".gitconfig-$USER@*"
elif [[ -e "$HOME/.gitconfig-*@$HOSTNAME" ]]; then
FILE=".gitconfig-*@$HOSTNAME"
elif [[ -e "$HOME/.gitconfig-*.${HOSTNAME#*.}" ]]; then
FILE=".gitconfig-*.${HOSTNAME#*.}"
elif [[ -e "$HOME/.gitconfig-default" ]]; then
FILE=".gitconfig-default"
else
(cd "$HOME" && [[ -L ".gitconfig" ]] && rm -f ".gitconfig")
printf "%s: %s\\n" "${BASH_SOURCE##*/}" "failed to update .gitconfig symlink" >&2
fi
[[ -n "$FILE" ]] && (cd "$HOME" && ln -sf "$FILE" ".gitconfig")
unset FILE

8
.bash_profile.d/perl5 Executable file
View file

@ -0,0 +1,8 @@
#!/bin/bash - not strictly necessary, but helps nano with syntax highlighting.
hash perl >/dev/null 2>&1 && {
export PERL_MB_OPT="--install_base \"$HOME/.local/perl5\""
export PERL_MM_OPT="INSTALL_BASE=$HOME/.local/perl5"
export PERL_LOCAL_LIB_ROOT="$HOME/.local/perl5${PERL_LOCAL_LIB_ROOT:+:$PERL_LOCAL_LIB_ROOT}"
export PERL5LIB="$HOME/.local/perl5/lib/perl5${PERL5LIB:+:$PERL5LIB}"
}

48
.bash_profile.d/screen Executable file
View file

@ -0,0 +1,48 @@
#!/bin/bash - not strictly necessary, but helps nano with syntax highlighting.
hash screen >/dev/null 2>&1 && {
[[ -e "$HOME/.screenrc-${HOSTNAME%%.*}" ]] && export SCREENRC="$HOME/.screenrc-${HOSTNAME%%.*}"
export SCREENDIR="$HOME/.screen-${HOSTNAME%%.*}"
if [[ -n "$SSH_TTY" ]]; then
if [[ -n "$STY" ]]; then
printf "%s\\n\\n" "Screen $STY, window $WINDOW."
else
SCREENS="$(screen -ls | command grep '[[:alpha:]]' | command grep -E -v '^([[:digit:]]+|No) Socket(s)?')"
if [[ -n "$SCREENS" ]]; then
printf "%s\\n\\n" "$SCREENS"
else
printf "%s\\n\\n" "No screens."
fi
unset SCREENS
fi
elif [[ -n "$STY" ]]; then
printf "%s\\n\\n" "Screen $STY, window $WINDOW."
else
TTY="$(tty | cut -d/ -f3-)"
SCREENS="$(screen -ls | command grep -F "${HOSTNAME%%.*}" | command grep -F "${TTY//\//-}")"
# This has to be an echo, not printf.
case "$(echo "${SCREENS:--n}" | wc -l)" in
0)
# No screens found - start a new instance if on a tty.
# Disabled this because screens should be started on chuckie not the desktop/laptop.
# [[ "$TTY" == tty* ]] && screen
:
;;
1)
# Just one screen - reconnect if it's not dead.
if (( $(printf "%s" "$SCREENS" | command grep -c -F 'Dead') == 1 )); then
printf "%s:\\n" "Found dead screen for $TTY"
printf "%s\\n" "$SCREENS" | sed -e 's/^/ /g'
else
screen -dr "${TTY//\//-}.${HOSTNAME%%.*}"
fi
;;
*)
# Multiple screens - output a list
printf "%s:\\n" "Multiple screens found for $TTY"
printf "%s\\n" "$SCREENS" | sed -e 's/^/ /g'
;;
esac
fi
unset SCREENS TTY
}

556
.bashrc
View file

@ -1,150 +1,5 @@
#!/bin/bash - not strictly necessary, but helps nano with syntax highlighting.
__prompt_git_status() {
# Generate a git branch/status prompt.
# Based on git-prompt.sh by Shawn O. Pearce <spearce@spearce.org>.
# Arguments:
# $1 The printf format string for the prompt. Must include %s.
# Environment variables:
# GIT_PROMPT_SHOW_TYPE=1 Show type of repository (Bare, Shallow).
# GIT_PROMPT_SHOW_UPSTREAM=1 Show status of this repository compaired to upstream:
# ?? - No upstream set.
# == - Working tree is equal to upstream.
# <> - Divergent from upstream.
# >> or >x - Working tree is ahead of upstream (x = commits ahead when used with next option).
# << or <x - Working tree is behind upstream (x = commits behind when used with next option).
# GIT_PROMPT_SHOW_UPSTREAM_EXTENDED=1 In addition to upstream status, show the number of commits difference (inplies above).
# GIT_PROMPT_SHOW_IGNORED=1 Show a ! if the current directory is ignored, or _ if the git operation was timed out.
# GIT_PROMPT_SHOW_UNSTAGED=1 Show a * if there are unstaged changes (superceeded by above).
# GIT_PROMPT_SHOW_UNCOMMITTED=1 Show a & if there are staged but uncommitted changes (superceeded by above).
# GIT_PROMPT_SHOW_UNTRACKED=1 Show a + if there are untracked files in the working directory (superceeded by above).
# GIT_PROMPT_SHOW_STASH=1 Show a $ if there is a stash in this repository (superceeded by above).
# Displays: The printf formatted git prompt based upon $1 and the environment vaiables above, for example:
# S:branch_name >5 *
# Returns: 0 = Produced a prompt successfully.
# 1 = An error occured.
local BRANCH COUNT GIT_PROMPT GIT_PROMPT_MARKER_SET GIT_REPO_INFO IFS=$'\n'
# Don't do anything if GIT_PROMPT_DISABLE is set.
[[ -v GIT_PROMPT_DISABLE ]] && return 0
# Bail out if there's no format argument given, or it doesn't contain %s
(( $# != 1 )) || [[ "$1" != *%s* ]] && return 1
# Get some repository information.
# shellcheck disable=SC2207
GIT_REPO_INFO=( $( git rev-parse --is-bare-repository --is-shallow-repository --is-inside-git-dir --is-inside-work-tree 2>/dev/null) ) || return 1
# Generate the prompt.
if [[ "${GIT_REPO_INFO[2]}" == "true" ]]; then
# In the git directory, use a special branch marker.
GIT_PROMPT+="!GIT_DIR!"
elif [[ "${GIT_REPO_INFO[3]}" == "true" ]]; then
# In the working directory, generate the prompt.
# Add type markers.
[[ -n "$GIT_PROMPT_SHOW_TYPE" ]] && {
if [[ "${GIT_REPO_INFO[0]}" == "true" ]]; then
GIT_PROMPT+="B:"
elif [[ "${GIT_REPO_INFO[1]}" == "true" ]]; then
GIT_PROMPT+="S:"
fi
}
# Add the branch or a no commits marker.
BRANCH="$(git rev-parse --abbrev-ref HEAD 2>/dev/null)"
if [[ "$BRANCH" == "HEAD" ]]; then
GIT_PROMPT+="?NO COMMITS?"
# Output the prompt and escape early.
# shellcheck disable=SC2059
printf -- "$1" "$GIT_PROMPT"
return 0
else
GIT_PROMPT+="$BRANCH"
fi
# Add upstream status.
[[ -n "$GIT_PROMPT_SHOW_UPSTREAM" ]] || [[ -n "$GIT_PROMPT_SHOW_UPSTREAM_EXTENDED" ]] && {
COUNT="$(git rev-list --count --left-right "${BRANCH:+refs/prefetch/remotes/origin/}${BRANCH:-@{upstream\}}...HEAD" 2>/dev/null | tr '[:blank:]' ' ')"
case "$COUNT" in
"")
# No upstream.
GIT_PROMPT+=" ??"
;;
"0 0")
# Equal to upstream.
GIT_PROMPT+=" =="
;;
"0 "*)
# Ahead of upstream.
GIT_PROMPT+=" >"
if [[ -n "$GIT_PROMPT_SHOW_UPSTREAM_EXTENDED" ]]; then
# Show the number of the difference.
GIT_PROMPT+="${COUNT#0 }"
else
GIT_PROMPT+=">"
fi
;;
*" 0")
# Behind upstream.
GIT_PROMPT+=" <"
if [[ -n "$GIT_PROMPT_SHOW_UPSTREAM_EXTENDED" ]]; then
# Show the number of the difference.
GIT_PROMPT+="${COUNT% 0}"
else
GIT_PROMPT+="<"
fi
;;
*)
# Divergent from upstream.
GIT_PROMPT+=" <>"
;;
esac
}
# Add a marker if directory is ignored, there's unstaged files, uncommitted changes, untracked files or a stash.
[[ -n "$GIT_PROMPT_SHOW_IGNORED" ]] && git check-ignore . >/dev/null 2>&1 && {
GIT_PROMPT+=" !"
GIT_PROMPT_MARKER_SET=1
}
[[ -z "$GIT_PROMPT_MARKER_SET" ]] && [[ -n "$GIT_PROMPT_SHOW_UNSTAGED" ]] && {
timeout --signal=KILL 2s git ls-files --modified --exclude-standard --directory --error-unmatch -- ':/*' >/dev/null 2>&1
ERR=$?
if (( ERR == 124 )) || (( ERR == 137 )); then
GIT_PROMPT+=" _"
GIT_PROMPT_MARKER_SET=1
elif (( ERR == 0 )); then
GIT_PROMPT+=" *"
GIT_PROMPT_MARKER_SET=1
fi
}
[[ -z "$GIT_PROMPT_MARKER_SET" ]] && [[ -n "$GIT_PROMPT_SHOW_UNCOMMITTED" ]] && ! git diff --name-only --cached --exit-code >/dev/null 2>&1 && {
GIT_PROMPT+=" &"
GIT_PROMPT_MARKER_SET=1
}
[[ -z "$GIT_PROMPT_MARKER_SET" ]] && [[ -n "$GIT_PROMPT_SHOW_UNTRACKED" ]] && {
timeout --signal=KILL 2s git ls-files git ls-files --others --exclude-standard --directory --error-unmatch -- ':/*' >/dev/null 2>&1
ERR=$?
if (( ERR == 124 )) || (( ERR == 137 )); then
GIT_PROMPT+=" _"
GIT_PROMPT_MARKER_SET=1
elif (( ERR == 0 )); then
GIT_PROMPT+=" +"
GIT_PROMPT_MARKER_SET=1
fi
}
[[ -z "$GIT_PROMPT_MARKER_SET" ]] && [[ -n "$GIT_PROMPT_SHOW_STASH" ]] && git rev-parse --verify --quiet refs/stash >/dev/null && {
GIT_PROMPT+=" $"
GIT_PROMPT_MARKER_SET=1
}
fi
# Output the prompt.
# shellcheck disable=SC2059
printf -- "$1" "$GIT_PROMPT"
return 0
}
# Bash specific configuration.
__prompt_user_colour() {
# Determine the colour of the username in the prompt.
@ -160,327 +15,8 @@ __prompt_user_colour() {
return 0
}
__git_prompt_command() {
# Perform git actions.
# Environment variables:
# GIT_DISABLE_PROMPT_PREFETCH=1 Disable automatic 'prefetch' of upstream refs.
# This can also be disabled on a per repository basis using:
# git config ---local -replace-all --type bool script.DisablePromptPrefetch true
# Returns: 0 = Tasks completed successfully.
# 1 = An error occured.
local GIT_REPO_INFO LC_ALL="C" NOW REPO_TIMESTAMP TIMESTAMP_VAR
# shellcheck disable=SC2207
GIT_REPO_INFO=( $( git rev-parse --is-inside-work-tree --show-toplevel 2>/dev/null) ) || return 1
# Only process if in a work directory.
[[ "${GIT_REPO_INFO[0]}" == "true" ]] && {
# Run prefetch tasks if not disabled.
[[ -z "$GIT_DISABLE_PROMPT_PREFETCH" ]] && [[ "$(git config --local --get --type bool script.DisablePromptPrefetch 2>/dev/null)" != "true" ]] && {
timeout --signal=KILL 7s git maintenance run --task=prefetch 2>/dev/null || {
printf "\\033[1;31m%s\\033[0m\\n" "Git maintenance 'prefetch' task failed." >&2
return 1
}
}
# The time now.
if [[ "$PLATFORM" == "Linux" ]]; then
NOW="$(date +'%s%3N')"
elif [[ "$PLATFORM" == "Darwin" ]]; then
NOW="$(perl -e 'use Time::HiRes; printf "%.3f", Time::HiRes::time();')"
NOW="${NOW/.}"
fi
# Determine the timestamp variable name depending on bash version.
if (( BASH_VERSINFO[0] >= 4 )); then
TIMESTAMP_VAR="GIT_REPO_TIMESTAMP[${GIT_REPO_INFO[1]//[^[:alnum:]]/_}]"
else
# This is going to pollute the environment, but Darwin is a PITA.
TIMESTAMP_VAR="GIT_REPO_TIMESTAMP_${GIT_REPO_INFO[1]//[^[:alnum:]]/_}"
fi
if [[ -n "${!TIMESTAMP_VAR}" ]]; then
# Monitor the git repo.
REPO_TIMESTAMP="$(git config --local --get --type int script.AutoMergeLast)"
(( ${!TIMESTAMP_VAR:-0} < REPO_TIMESTAMP )) && {
# Display message depending on status.
if [[ "$(git config --local --get --type bool script.AutoMergeSuccess)" == "true" ]]; then
printf "\\033[1;32m%s" "Git auto-merge succeeded for this repo."
if [[ "${GIT_REPO_INFO[1]}" == "$HOME" ]]; then
printf " %s\\033[0m\\n" "Re-source .bash* files."
else
printf "\\033[0m\\n"
fi
# Update the timestamp in the environment.
declare -g "$TIMESTAMP_VAR"="$NOW"
else
printf "\\033[1;31m%s\\033[0m\\n" "Git auto-merge failed for this repo - correct manually." >&2
fi
}
else
# Just set the timestamp in the environment.
declare -g "$TIMESTAMP_VAR"="$NOW"
fi
}
return 0
}
__nanorc_prompt_command() {
# Dynamically handle .nanorc file versions.
hash nano >/dev/null 2>&1 && {
# shellcheck disable=SC2155
local NANO_VER="$(command nano --version | awk '/version/ { print $4 }' | cut -d. -f1)"
# Darwin specifc .nanorc version.
[[ "$PLATFORM" == "Darwin" ]] && NANO_VER="darwin"
if [[ -f "$HOME/.nanorc-$NANO_VER" ]]; then
if (( NANO_VER <= 4 )); then
( cd "$HOME" && ln -sf ".nanorc-$NANO_VER" ".nanorc" )
else
# shellcheck disable=SC2139
alias nano="nano -f \"$HOME/.nanorc-$NANO_VER\""
fi
else
if (( NANO_VER <= 4 )); then
[[ -L "$HOME/.nanorc" ]] && rm -f "$HOME/.nanorc"
else
unalias nano 2>/dev/null
fi
printf "\\033[1;31m%s\\033[0m\\n" "No .nanorc for version '$NANO_VER'." >&2
fi
}
return 0
}
__ssh_agent_prompt_command() {
# If necessary, find and activate a new ssh agent socket before each prompt is displayed.
# Returns: 0 = All is good.
# 1 = An error occured.
local ERR
if [[ -z "$SSH_AUTH_SOCK" ]]; then
ERR=2
else
ssh-add -l >/dev/null 2>&1
ERR=$?
fi
(( ERR == 2 )) && {
# Read alternative sockets from ~/.ssh/agents.
__read_ssh_agents || {
unset SSH_AUTH_SOCK
return 1
}
# Find a new socket to use.
if __find_ssh_agent_sock; then
printf "\\033[1;33m%s\\033[0m\\n" "Connected to existing ssh-agent socket."
sleep 0.5
else
# Start a new agent.
eval "$(ssh-agent -s 2>/dev/null | grep -v 'echo'; printf "%s" "ERR=${PIPESTATUS[0]}")"
(( ERR > 0 )) && {
printf "\\033[1;31m%s\\033[0m\\n" "Failed to start new ssh-agent - continuing with no agent."
sleep 0.5
return 1
}
printf "\\033[1;32m%s\\033[0m\\n" "Started new ssh-agent."
__write_ssh_agents
sleep 0.5
fi
}
return 0
}
__find_ssh_agent_sock() {
# Find an *active* ssh agent socket.
# Returns: 0 = Found an active socket.
# 1 = Did not find a viable socket.
local I
# Search the SSH_AUTH_SOCKS array for a viable socket.
for ((I = 0; I < ${#SSH_AUTH_SOCKS[@]}; I++)); do
[[ "${SSH_AUTH_SOCKS[$I]}" =~ ^[[:blank:]]*$ ]] && continue
SSH_AUTH_SOCK="${SSH_AUTH_SOCKS[$I]}" ssh-add -l >/dev/null 2>&1
(( $? <= 1 )) && {
export SSH_AUTH_SOCK="${SSH_AUTH_SOCKS[$I]}"
return 0
}
unset SSH_AUTH_SOCK
done
return 1
}
__read_ssh_agents() {
# Read all the known ssh agent sockets into an array.
# Returns: 0 = Processed and read the agents file without issue.
# 1 = Error processing/reading the agents file.
local ERR I SOCK
[[ ! -e "$HOME/.ssh/agents" ]] && touch "$HOME/.ssh/agents"
# Lock the ~/.ssh/agents file.
if [[ "$PLATFORM" == "Linux" ]]; then
# Linux has 'flock', thankfully.
exec 9<"$HOME/.ssh/agents" && flock -E 10 -e -w 0.5 9
ERR=$?
if (( ERR == 10 )); then
printf "\\033[1;31m%s\\033[0m\\n" "Failed to obtain lock on ~/.ssh/agents." >&2
return 1
elif (( ERR > 0 )); then
printf "\\033[1;31m%s\\033[0m\\n" "Flock usage error." >&2
return 1
fi
# Make note of the mtime for use in write_ssh_agents.
SSH_AGENTS_MTIME="$(stat --format=%.9Y "$HOME/.ssh/agents")"
elif [[ "$PLATFORM" == "Darwin" ]]; then
# Do locking the sucky way on macOS.
for ((I = 0; I <= 5; I++)); do
if shlock -p "$$" -f "$HOME/.ssh/agents.lock"; then
exec 9<"$HOME/.ssh/agents"
# Make note of the mtime for use in write_ssh_agents.
SSH_AGENTS_MTIME="$(stat -f %Fm "$HOME/.ssh/agents")"
ERR=0
break
else
ERR=1
sleep 0.1
fi
done
(( ERR != 0 )) && {
printf "\\033[1;31m%s\\033[0m\\n" "Failed to obtain lock on ~/.ssh/agents." >&2
return 1
}
else
printf "\\033[1;31m%s\\033[0m\\n" "File locking unsupported on '$PLATFORM'." >&2
return 1
fi
# Read the socket list (bash v2+ compliant)
while read -u 9 -r SOCK; do
[[ -n "$SOCK" ]] && SSH_AUTH_SOCKS+=("$SOCK")
done
ERR=$?
# Close the file descriptor (which on Linux releases the flock too).
exec 9<&-
# On Darwin, release the lock on the file.
rm -f "$HOME/.ssh/agents.lock"
# Remove the . in the mtime.
SSH_AGENTS_MTIME="${SSH_AGENTS_MTIME/\.}"
# Error out if the data couldn't be read.
(( ERR != 0 )) && {
printf "\\033[1;31m%s\\033[0m\\n" "Failed to read ssh-agent socket list." >&2
unset SSH_AUTH_SOCKS SSH_AGENTS_MTIME
return 1
}
return 0
}
__write_ssh_agents() {
# Write all unique ssh agent sockets into the ~/.ssh/agents file.
# Returns: 0 = Processed and wrote the agents file without issue.
# 1 = Error processing/writing the agents file.
# 2 = The SSH_AUTH_SOCKS array may be out of date as the agents file'a mtime has changed.
local ERR I J MTIME SOCKS
# Add the current agent socket to the sockets array.
SSH_AUTH_SOCKS=("$SSH_AUTH_SOCK" "${SSH_AUTH_SOCKS[@]}")
# Remove any duplicates from SSH_AUTH_SOCKS.
for ((I = 0; I < ${#SSH_AUTH_SOCKS[@]}; I++)); do
[[ -z "${SSH_AUTH_SOCKS[$I]}" ]] && continue
for ((J = 0; J < ${#SOCKS[@]}; J++)); do
[[ "${SSH_AUTH_SOCKS[$I]}" == "${SOCKS[$J]}" ]] && continue 2
done
# Only add the socket if it's still viable.
SSH_AUTH_SOCK="${SSH_AUTH_SOCKS[$I]}" ssh-add -l >/dev/null 2>&1
(( $? <= 1 )) && SOCKS+=("${SSH_AUTH_SOCKS[$I]}")
done
# Lock the ~/.ssh/agents file.
if [[ "$PLATFORM" == "Linux" ]]; then
# Make sure SSH_AUTH_SOCKS has the most up to date data.
MTIME="$(stat --format=%.9Y "$HOME/.ssh/agents")"
(( ${MTIME/\.} > SSH_AGENTS_MTIME )) && return 2
# Lock the agents file.
exec 9<"$HOME/.ssh/agents" && flock -E 10 -e -w 0.5 9
ERR=$?
if (( ERR == 10 )); then
printf "\\033[1;31m%s\\033[0m\\n" "Failed to obtain lock on ~/.ssh/agents." >&2
return 1
elif (( ERR > 0 )); then
printf "\\033[1;31m%s\\033[0m\\n" "Flock usage error." >&2
return 1
fi
elif [[ "$(uname -s)" == "Darwin" ]]; then
# Make sure SSH_AUTH_SOCKS has the most up to date data.
MTIME="$(stat -f %Fm "$HOME/.ssh/agents")"
(( ${MTIME/\.} > SSH_AGENTS_MTIME )) && return 2
# Do locking the sucky way on OSX.
for ((I = 0; I <= 5; I++)); do
if shlock -p "$$" -f "$HOME/.ssh/agents.lock"; then
exec 9<"$HOME/.ssh/agents"
ERR=0
break
else
ERR=1
sleep 0.1
fi
done
(( ERR != 0 )) && {
printf "\\033[1;31m%s\\033[0m\\n" "Failed to obtain lock on ~/.ssh/agents." >&2
return 1
}
else
printf "\\033[1;31m%s\\033[0m\\n" "File locking unsupported on '$PLATFORM'." >&2
return 1
fi
# Write the cleaned array to disk.
ERR=-1
[[ -n "${SOCKS[*]}" ]] && { printf "%s\\n" "${SOCKS[@]}" >"$HOME/.ssh/agents" 2>/dev/null; ERR=$?; }
# Release locks.
exec 9<&-
rm -f "$HOME/.ssh/agents.lock"
# Error out if the data couldn't be written.
if (( ERR == -1 )); then
rm -f "$HOME/.ssh/agents" 2>/dev/null
elif (( ERR >= 1 )); then
rm -f "$HOME/.ssh/agents" 2>/dev/null
printf "\\033[1;31m%s\\033[0m\\n" "Failed to write ssh-agent socket list." >&2
return 1
fi
return 0
}
imagebin() {
# Throw an image file into an imagebin.
[[ -z "$1" ]] || [[ ! -e "$1" ]] && {
printf "%s: %s\\n" "Usage" "${FUNCNAME[0]} <filename>" >&2
return 1
}
curl -F file="@$1" https://imagebin.ca/upload.php | grep '^url:' | cut -d: -f2-
}
# Determine the platform being logged into.
PLATFORM="$(uname -s)"
PLATFORM="${PLATFORM:-$(uname -s)}"
# Make bash a little more pleasent - these are valid for all versions.
shopt -s cdspell checkhash checkwinsize cmdhist histappend no_empty_cmd_completion
@ -498,9 +34,6 @@ HISTTIMEFORMAT="%d/%m/%y %H:%M:%S "
history -a
history -r
# The commands to execute before the prompt is displayed.
PROMPT_COMMAND="__nanorc_prompt_command; __ssh_agent_prompt_command; __git_prompt_command"
# Git prompt options.
GIT_PROMPT_SHOW_TYPE=1
GIT_PROMPT_SHOW_UPSTREAM=1
@ -518,13 +51,11 @@ if (( BASH_VERSINFO[0] >= 4 )); then
# Trim the path in the prompt.
PROMPT_DIRTRIM=2
# Coloured username + host + directory:
PS1='[\[\033[$(__prompt_user_colour)\]\u\[\033[0m\]@\[\033[1;33m\]\h\[\033[0m\]] \[\033[1;34m\]\w\[\033[0m\]$(__prompt_git_status "\[\\033[1;35m\] (%s)\[\\033[0m\]") ->'
# Coloured username + host + directory in the prompt.
PS1='[\[\033[$(__prompt_user_colour)\]\u\[\033[0m\]@\[\033[1;33m\]\h\[\033[0m\]] \[\033[1;34m\]\w\[\033[0m\]'
else
# Set the prompts.
# Coloured username + host + directory:
# shellcheck disable=SC2154
PS1='[\[\033[$(__prompt_user_colour)\]\u\[\033[0m\]@\[\033[1;33m\]\h\[\033[0m\]] \[\033[1;34m\]$(printf "%s" "${PWD/#$HOME/~}" | awk -F/ '\''{if (NF>3) {printf ".../" $(NF-1) "/" $NF} else {printf $0}}'\'')\[\033[0m\]$(__prompt_git_status "\[\\033[1;35m\] (%s)\[\\033[0m\]") ->'
# Coloured username + host + directory in the prompt.
PS1='[\[\033[$(__prompt_user_colour)\]\u\[\033[0m\]@\[\033[1;33m\]\h\[\033[0m\]] \[\033[1;34m\]$(printf "%s" "${PWD/#$HOME/~}" | awk -F/ '\''{if (NF>3) {printf ".../" $(NF-1) "/" $NF} else {printf $0}}'\'')\[\033[0m\]'
fi
# Set the debugger prompt.
@ -533,53 +64,7 @@ export PS4='+(\[\033[1;33m\]$?\[\033[0m\]) \[\033[1;34m\]${BASH_SOURCE##*/}\[\03
# Common aliases.
hash bc >/dev/null 2>&1 && alias bc='bc -lq'
hash grep >/dev/null 2>&1 && {
alias egrep='grep -E --color=auto'
alias fgrep='grep -F --color=auto'
alias grep='grep --color=auto'
}
# Auto start the ssh agent and add keys for scp/sftp/ssh.
__ssh_agent_prompt_command
hash scp ssh ssh-add >/dev/null 2>&1 && alias scp='_EXEC=scp ssh'
hash sftp ssh ssh-add >/dev/null 2>&1 && alias sftp='_EXEC=sftp ssh'
hash ssh ssh-add >/dev/null 2>&1 && ssh() {
local ERR
if [[ -z "$SSH_AUTH_SOCK" ]]; then
ERR=2
else
ssh-add -l >/dev/null 2>&1
ERR=$?
fi
if (( ERR == 1 )); then
ssh-add
elif (( ERR == 2 )); then
__ssh_agent_prompt_command
ssh-add
fi
command "${_EXEC:-${FUNCNAME[0]}}" "$@"
}
# Handle the ~/.gitconfig link.
if [[ -e "$HOME/.gitconfig-$USER@$HOSTNAME" ]]; then
FILENAME=".gitconfig-$USER@$HOSTNAME"
elif [[ -e "$HOME/.gitconfig-$USER@*.${HOSTNAME#*.}" ]]; then
FILENAME=".gitconfig-$USER@*.${HOSTNAME#*.}"
elif [[ -e "$HOME/.gitconfig-$USER@*" ]]; then
FILENAME=".gitconfig-$USER@*"
elif [[ -e "$HOME/.gitconfig-*@$HOSTNAME" ]]; then
FILENAME=".gitconfig-*@$HOSTNAME"
elif [[ -e "$HOME/.gitconfig-*.${HOSTNAME#*.}" ]]; then
FILENAME=".gitconfig-*.${HOSTNAME#*.}"
elif [[ -e "$HOME/.gitconfig-default" ]]; then
FILENAME=".gitconfig-default"
else
(cd "$HOME" && [[ -L ".gitconfig" ]] && rm -f ".gitconfig")
printf "%s: %s\\n" "${BASH_SOURCE##*/}" "failed to update .gitconfig symlink" >&2
fi
[[ -n "$FILENAME" ]] && (cd "$HOME" && ln -sf "$FILENAME" ".gitconfig")
unset FILENAME
hash grep >/dev/null 2>&1 && { alias egrep='grep -E --color=auto'; alias fgrep='grep -F --color=auto'; alias grep='grep --color=auto'; }
# Platform specific set up.
if [[ "$PLATFORM" = "Linux" ]]; then
@ -587,7 +72,7 @@ if [[ "$PLATFORM" = "Linux" ]]; then
hash ps grep >/dev/null 2>&1 && psgrep() {
if [[ -n "$1" ]]; then
# shellcheck disable=SC2009
ps -auwwx | grep -E --color=always -- "(.*RSS.*|$1)" | grep -F -v '(.*RSS.*|'
ps -auwwx | command grep -E --color=always -- "(.*RSS.*|$1)" | command grep -F -v '(.*RSS.*|'
else
printf "%s: %s\\n" "Usage" "${FUNCNAME[0]} <something>" >&2
return 1
@ -604,23 +89,32 @@ if [[ "$PLATFORM" = "Linux" ]]; then
hash last less >/dev/null 2>&1 && alias laston='last -a | less'
hash ls >/dev/null 2>&1 && alias ls='ls -bFv --color=auto'
hash minicom >/dev/null 2>&1 && alias minicom='minicom -m -c on'
hash mkpasswd >/dev/null 2>&1 && alias mkpasswd='mkpasswd -m sha512crypt'
hash mkpasswd >/dev/null 2>&1 && alias pwgen='mkpasswd -m sha512crypt'
hash mkpasswd >/dev/null 2>&1 && { alias mkpasswd='mkpasswd -m sha512crypt'; alias pwgen='mkpasswd -m sha512crypt'; }
hash nc >/dev/null 2>&1 && alias pastebin='nc termbin.com 9999'
hash pinfo >/dev/null 2>&1 && alias info='pinfo'
hash ping >/dev/null 2>&1 && alias ping='ping -b'
hash xclip >/dev/null 2>&1 && alias file2clip='DISPLAY=:0.0 xclip -selection clipboard'
elif [[ "$PLATFORM" = "Darwin" ]]; then
# Darwin specific aliases (some dependant on macports)
[[ ! -e "/opt/local/libexec/gnubin/df" ]] && alias df='df -kP'
# shellcheck disable=SC2015
[[ ! -e "/opt/local/libexec/gnubin//diff" ]] && alias diff='diff -u' || alias diff='diff --color=auto -u'
# Darwin specific aliases (some dependant on macports).
hash df >/dev/null 2>&1 && [[ ! -e "/opt/local/libexec/gnubin/df" ]] && alias df='df -kP'
hash diff >/dev/null 2>&1 && alias diff='diff -u'
[[ -e "/opt/local/libexec/gnubin//diff" ]] && alias diff='diff --color=auto -u'
hash last less >/dev/null 2>&1 && alias laston='last | less'
# shellcheck disable=SC2015
[[ ! -e "/opt/local/libexec/gnubin/ls" ]] && alias ls='ls -bFGO' || alias ls='ls -bFv --color=auto'
hash ls >/dev/null 2>&1 && alias ls='ls -bFGO'
[[ -e "/opt/local/libexec/gnubin/ls" ]] && alias ls='ls -bFv --color=auto'
[[ -e "/opt/local/libexec/gnubin/nc" ]] && alias pastebin='nc termbin.com 9999'
[[ -e "/opt/local/bin/pinfo" ]] && alias info='pinfo'
hash top >/dev/null 2>&1 && alias top='top -o cpu -S'
else
printf "%s: %s\\n" "${BASH_SOURCE##*/}" "unsupported platform: $PLATFORM" >&2
fi
# Read in the shell configuration from .bashrc.d/*.
for FILE in "$HOME"/.bashrc.d/*; do
[[ -x "$FILE" ]] && source "$FILE"
done
unset FILE
# Finalise the prompt.
PS1+=' ->'

220
.bashrc.d/git Executable file
View file

@ -0,0 +1,220 @@
#!/bin/bash - not strictly necessary, but helps nano with syntax highlighting.
__git_prompt_command() {
# Perform git actions as part of PROMPT_COMMAND.
# Environment variables:
# GIT_PROMPT_COMMAND_DISABLE_PREFETCH=1 Disable automatic 'prefetch' of upstream refs.
# This can also be disabled on a per repository basis using:
# git config ---local -replace-all --type bool script.PromptCommandDisablePrefetch true
# Returns: 0 = Tasks completed successfully.
# 1 = An error occured.
local GIT_REPO_INFO LC_ALL="C" NOW REPO_TIMESTAMP TIMESTAMP_VAR
# shellcheck disable=SC2207
GIT_REPO_INFO=( $(git rev-parse --is-inside-work-tree --show-toplevel 2>/dev/null) ) || return 1
# Only process if in a work directory.
[[ "${GIT_REPO_INFO[0]}" == "true" ]] && {
# Run prefetch tasks if not disabled.
[[ -z "$GIT_PROMPT_COMMAND_DISABLE_PREFETCH" ]] && [[ "$(git config --local --get --type bool script.PromptCommandDisablePrefetch 2>/dev/null)" != "true" ]] && {
timeout --signal=KILL 7s git maintenance run --task=prefetch 2>/dev/null || {
printf "\\033[1;31m%s\\033[0m\\n" "Git maintenance 'prefetch' task failed." >&2
return 1
}
}
# The time now.
if [[ "$PLATFORM" == "Linux" ]]; then
NOW="$(date +'%s%3N')"
elif [[ "$PLATFORM" == "Darwin" ]]; then
NOW="$(perl -e 'use Time::HiRes; printf "%.3f", Time::HiRes::time();')"
NOW="${NOW/.}"
fi
# Determine the timestamp variable name depending on bash version.
if (( BASH_VERSINFO[0] >= 4 )); then
TIMESTAMP_VAR="GIT_REPO_TIMESTAMP[${GIT_REPO_INFO[1]//[^[:alnum:]]/_}]"
else
# This is going to pollute the environment, but Darwin is a PITA.
TIMESTAMP_VAR="GIT_REPO_TIMESTAMP_${GIT_REPO_INFO[1]//[^[:alnum:]]/_}"
fi
if [[ -n "${!TIMESTAMP_VAR}" ]]; then
# Monitor the git repo.
REPO_TIMESTAMP="$(git config --local --get --type int script.AutoMergeLast)"
(( ${!TIMESTAMP_VAR:-0} < REPO_TIMESTAMP )) && {
# Display message depending on status.
if [[ "$(git config --local --get --type bool script.AutoMergeSuccess)" == "true" ]]; then
printf "\\033[1;32m%s" "Git auto-merge succeeded for this repo."
if [[ "${GIT_REPO_INFO[1]}" == "$HOME" ]]; then
printf " %s\\033[0m\\n" "Re-source .bash* files."
else
printf "\\033[0m\\n"
fi
# Update the timestamp in the environment.
declare -g "$TIMESTAMP_VAR"="$NOW"
else
printf "\\033[1;31m%s\\033[0m\\n" "Git auto-merge failed for this repo - correct manually." >&2
fi
}
else
# Just set the timestamp in the environment.
declare -g "$TIMESTAMP_VAR"="$NOW"
fi
}
return 0
}
__prompt_git_status() {
# Generate a git branch/status prompt.
# Based on git-prompt.sh by Shawn O. Pearce <spearce@spearce.org>.
# Arguments:
# $1 The printf format string for the prompt. Must include %s.
# Environment variables:
# GIT_PROMPT_DISABLE=1 Disable git prompt processing completely in this shell.
# GIT_PROMPT_SHOW_TYPE=1 Show type of repository (Bare, Shallow).
# GIT_PROMPT_SHOW_UPSTREAM=1 Show status of this repository compaired to upstream:
# ?? - No upstream set.
# == - Working tree is equal to upstream.
# <> - Divergent from upstream.
# >> or >x - Working tree is ahead of upstream (x = commits ahead when used with next option).
# << or <x - Working tree is behind upstream (x = commits behind when used with next option).
# GIT_PROMPT_SHOW_UPSTREAM_EXTENDED=1 In addition to upstream status, show the number of commits difference (inplies above).
# GIT_PROMPT_SHOW_IGNORED=1 Show a ! if the current directory is ignored, or _ if the git operation was timed out.
# GIT_PROMPT_SHOW_UNSTAGED=1 Show a * if there are unstaged changes (superceeded by above).
# GIT_PROMPT_SHOW_UNCOMMITTED=1 Show a & if there are staged but uncommitted changes (superceeded by above).
# GIT_PROMPT_SHOW_UNTRACKED=1 Show a + if there are untracked files in the working directory (superceeded by above).
# GIT_PROMPT_SHOW_STASH=1 Show a $ if there is a stash in this repository (superceeded by above).
# Displays: The printf formatted git prompt based upon $1 and the environment vaiables above, for example:
# S:branch_name >5 *
# Returns: 0 = Produced a prompt successfully, or returned because GIT_PROMPT_DISABLE=1 was set.
# 1 = An error occured.
local BRANCH COUNT GIT_PROMPT GIT_PROMPT_MARKER_SET GIT_REPO_INFO IFS=$'\n'
# Don't do anything if GIT_PROMPT_DISABLE is set.
[[ -v GIT_PROMPT_DISABLE ]] && return 0
# Bail out if there's no format argument given, or it doesn't contain %s
(( $# != 1 )) || [[ "$1" != *%s* ]] && return 1
# Get some repository information.
# shellcheck disable=SC2207
GIT_REPO_INFO=( $(git rev-parse --is-bare-repository --is-shallow-repository --is-inside-git-dir --is-inside-work-tree 2>/dev/null) ) || return 1
# Generate the prompt.
if [[ "${GIT_REPO_INFO[2]}" == "true" ]]; then
# In the git directory, use a special branch marker.
GIT_PROMPT+="!GIT_DIR!"
elif [[ "${GIT_REPO_INFO[3]}" == "true" ]]; then
# In the working directory, generate the prompt.
# Add type markers.
[[ -n "$GIT_PROMPT_SHOW_TYPE" ]] && {
if [[ "${GIT_REPO_INFO[0]}" == "true" ]]; then
GIT_PROMPT+="B:"
elif [[ "${GIT_REPO_INFO[1]}" == "true" ]]; then
GIT_PROMPT+="S:"
fi
}
# Add the branch or a no commits marker.
BRANCH="$(git rev-parse --abbrev-ref HEAD 2>/dev/null)"
if [[ "$BRANCH" == "HEAD" ]]; then
GIT_PROMPT+="?NO COMMITS?"
# Output the prompt and escape early.
# shellcheck disable=SC2059
printf -- "$1" "$GIT_PROMPT"
return 0
else
GIT_PROMPT+="$BRANCH"
fi
# Add upstream status.
[[ -n "$GIT_PROMPT_SHOW_UPSTREAM" ]] || [[ -n "$GIT_PROMPT_SHOW_UPSTREAM_EXTENDED" ]] && {
COUNT="$(git rev-list --count --left-right "${BRANCH:+refs/prefetch/remotes/origin/}${BRANCH:-@{upstream\}}...HEAD" 2>/dev/null | tr '[:blank:]' ' ')"
case "$COUNT" in
"")
# No upstream.
GIT_PROMPT+=" ??"
;;
"0 0")
# Equal to upstream.
GIT_PROMPT+=" =="
;;
"0 "*)
# Ahead of upstream.
GIT_PROMPT+=" >"
if [[ -n "$GIT_PROMPT_SHOW_UPSTREAM_EXTENDED" ]]; then
# Show the number of the difference.
GIT_PROMPT+="${COUNT#0 }"
else
GIT_PROMPT+=">"
fi
;;
*" 0")
# Behind upstream.
GIT_PROMPT+=" <"
if [[ -n "$GIT_PROMPT_SHOW_UPSTREAM_EXTENDED" ]]; then
# Show the number of the difference.
GIT_PROMPT+="${COUNT% 0}"
else
GIT_PROMPT+="<"
fi
;;
*)
# Divergent from upstream.
GIT_PROMPT+=" <>"
;;
esac
}
# Add a marker if directory is ignored, there's unstaged files, uncommitted changes, untracked files or a stash.
[[ -n "$GIT_PROMPT_SHOW_IGNORED" ]] && git check-ignore . >/dev/null 2>&1 && {
GIT_PROMPT+=" !"
GIT_PROMPT_MARKER_SET=1
}
[[ -z "$GIT_PROMPT_MARKER_SET" ]] && [[ -n "$GIT_PROMPT_SHOW_UNSTAGED" ]] && {
timeout --signal=KILL 2s git ls-files --modified --exclude-standard --directory --error-unmatch -- ':/*' >/dev/null 2>&1
ERR=$?
if (( ERR == 124 )) || (( ERR == 137 )); then
GIT_PROMPT+=" _"
GIT_PROMPT_MARKER_SET=1
elif (( ERR == 0 )); then
GIT_PROMPT+=" *"
GIT_PROMPT_MARKER_SET=1
fi
}
[[ -z "$GIT_PROMPT_MARKER_SET" ]] && [[ -n "$GIT_PROMPT_SHOW_UNCOMMITTED" ]] && ! git diff --name-only --cached --exit-code >/dev/null 2>&1 && {
GIT_PROMPT+=" &"
GIT_PROMPT_MARKER_SET=1
}
[[ -z "$GIT_PROMPT_MARKER_SET" ]] && [[ -n "$GIT_PROMPT_SHOW_UNTRACKED" ]] && {
timeout --signal=KILL 2s git ls-files git ls-files --others --exclude-standard --directory --error-unmatch -- ':/*' >/dev/null 2>&1
ERR=$?
if (( ERR == 124 )) || (( ERR == 137 )); then
GIT_PROMPT+=" _"
GIT_PROMPT_MARKER_SET=1
elif (( ERR == 0 )); then
GIT_PROMPT+=" +"
GIT_PROMPT_MARKER_SET=1
fi
}
[[ -z "$GIT_PROMPT_MARKER_SET" ]] && [[ -n "$GIT_PROMPT_SHOW_STASH" ]] && git rev-parse --verify --quiet refs/stash >/dev/null && {
GIT_PROMPT+=" $"
GIT_PROMPT_MARKER_SET=1
}
fi
# Output the prompt.
# shellcheck disable=SC2059
printf -- "$1" "$GIT_PROMPT"
return 0
}
# Add the git prompt function call to PROMPT_COMMAND.
PROMPT_COMMAND+="__git_prompt_command;"
# Add the git information to the prompt.
PS1+='$(__prompt_git_status "\[\\033[1;35m\] (%s)\[\\033[0m\]")'

11
.bashrc.d/imagebin Executable file
View file

@ -0,0 +1,11 @@
#!/bin/bash - not strictly necessary, but helps nano with syntax highlighting.
imagebin() {
# Throw an image file into imagebin.
[[ -z "$1" ]] || [[ ! -e "$1" ]] && {
printf "%s: %s\\n" "Usage" "${FUNCNAME[0]} <filename>" >&2
return 1
}
curl -F file="@$1" https://imagebin.ca/upload.php | grep '^url:' | cut -d: -f2-
}

25
.bashrc.d/nanorc Executable file
View file

@ -0,0 +1,25 @@
#!/bin/bash - not strictly necessary, but helps nano with syntax highlighting.
__nanorc_prompt_command() {
# Dynamically handle .nanorc file versions.
hash nano >/dev/null 2>&1 && {
# Darwin specifc .nanorc version.
[[ "$PLATFORM" == "Darwin" ]] && [[ "$(hash -t nano)" == "/usr/bin/nano" ]] && local NANO_VER="darwin"
# shellcheck disable=SC2155
[[ -v NANO_VER ]] || local NANO_VER="$(command nano --version | awk '/version/ { print $4 }' | cut -d. -f1)"
# Set the .nanorc symlink if it doesn't already point to the correct versioned file.
if [[ -f "$HOME/.nanorc-$NANO_VER" ]]; then
[[ "$(readlink "$HOME/.nanorc")" != ".nanorc-$NANO_VER" ]] && (cd "$HOME" && ln -sf ".nanorc-$NANO_VER" ".nanorc")
else
[[ -L "$HOME/.nanorc" ]] && rm -f "$HOME/.nanorc"
printf "\\033[1;31m%s\\033[0m\\n" "No .nanorc for version '$NANO_VER'." >&2
fi
}
return 0
}
# Add the nanorc prompt function call to PROMPT_COMMAND.
PROMPT_COMMAND+="__nanorc_prompt_command;"

243
.bashrc.d/ssh Executable file
View file

@ -0,0 +1,243 @@
#!/bin/bash - not strictly necessary, but helps nano with syntax highlighting.
__find_ssh_agent_sock() {
# Find an *active* ssh agent socket.
# Returns: 0 = Found an active socket.
# 1 = Did not find a viable socket.
local I
# Search the SSH_AUTH_SOCKS array for a viable socket.
for ((I = 0; I < ${#SSH_AUTH_SOCKS[@]}; I++)); do
[[ "${SSH_AUTH_SOCKS[$I]}" =~ ^[[:blank:]]*$ ]] && continue
SSH_AUTH_SOCK="${SSH_AUTH_SOCKS[$I]}" ssh-add -l >/dev/null 2>&1
(( $? <= 1 )) && {
export SSH_AUTH_SOCK="${SSH_AUTH_SOCKS[$I]}"
return 0
}
unset SSH_AUTH_SOCK
done
return 1
}
__read_ssh_agents() {
# Read all the known ssh agent sockets into an array.
# Returns: 0 = Processed and read the agents file without issue.
# 1 = Error processing/reading the agents file.
local ERR I SOCK
[[ ! -e "$HOME/.ssh/agents" ]] && touch "$HOME/.ssh/agents"
# Lock the ~/.ssh/agents file.
if [[ "$PLATFORM" == "Linux" ]]; then
# Linux has 'flock', thankfully.
exec 9<"$HOME/.ssh/agents" && flock -E 10 -e -w 0.5 9
ERR=$?
if (( ERR == 10 )); then
printf "\\033[1;31m%s\\033[0m\\n" "Failed to obtain lock on ~/.ssh/agents." >&2
return 1
elif (( ERR > 0 )); then
printf "\\033[1;31m%s\\033[0m\\n" "Flock usage error." >&2
return 1
fi
# Make note of the mtime for use in write_ssh_agents.
SSH_AGENTS_MTIME="$(stat --format=%.9Y "$HOME/.ssh/agents")"
elif [[ "$PLATFORM" == "Darwin" ]]; then
# Do locking the sucky way on Darwin.
for ((I = 0; I <= 5; I++)); do
if shlock -p "$$" -f "$HOME/.ssh/agents.lock"; then
exec 9<"$HOME/.ssh/agents"
# Make note of the mtime for use in write_ssh_agents.
SSH_AGENTS_MTIME="$(stat -f %Fm "$HOME/.ssh/agents")"
ERR=0
break
else
ERR=1
sleep 0.1
fi
done
(( ERR != 0 )) && {
printf "\\033[1;31m%s\\033[0m\\n" "Failed to obtain lock on ~/.ssh/agents." >&2
return 1
}
else
printf "\\033[1;31m%s\\033[0m\\n" "File locking unsupported on '$PLATFORM'." >&2
return 1
fi
# Read the socket list (bash v2+ compliant)
while read -u 9 -r SOCK; do
[[ -n "$SOCK" ]] && SSH_AUTH_SOCKS+=("$SOCK")
done
ERR=$?
# Close the file descriptor (which on Linux releases the flock too).
exec 9<&-
# On Darwin, release the lock on the file.
rm -f "$HOME/.ssh/agents.lock"
# Remove the . in the mtime.
SSH_AGENTS_MTIME="${SSH_AGENTS_MTIME/\.}"
# Error out if the data couldn't be read.
(( ERR != 0 )) && {
printf "\\033[1;31m%s\\033[0m\\n" "Failed to read ssh-agent socket list." >&2
unset SSH_AUTH_SOCKS SSH_AGENTS_MTIME
return 1
}
return 0
}
__ssh_agent_prompt_command() {
# If necessary, find and activate a new ssh agent socket before each prompt is displayed.
# Returns: 0 = All is good.
# 1 = An error occured.
local ERR
if [[ -z "$SSH_AUTH_SOCK" ]]; then
ERR=2
else
ssh-add -l >/dev/null 2>&1
ERR=$?
fi
(( ERR == 2 )) && {
# Read alternative sockets from ~/.ssh/agents.
__read_ssh_agents || {
unset SSH_AUTH_SOCK
return 1
}
# Find a new socket to use.
if __find_ssh_agent_sock; then
printf "\\033[1;33m%s\\033[0m\\n" "Connected to existing ssh-agent socket."
sleep 0.5
else
# Start a new agent.
eval "$(ssh-agent -s 2>/dev/null | grep -v 'echo'; printf "%s" "ERR=${PIPESTATUS[0]}")"
(( ERR > 0 )) && {
printf "\\033[1;31m%s\\033[0m\\n" "Failed to start new ssh-agent - continuing with no agent."
sleep 0.5
return 1
}
printf "\\033[1;32m%s\\033[0m\\n" "Started new ssh-agent."
__write_ssh_agents
(( $? == 2 )) && __read_ssh_agents && __write_ssh_agents
sleep 0.5
fi
}
return 0
}
__write_ssh_agents() {
# Write all unique ssh agent sockets into the ~/.ssh/agents file.
# Returns: 0 = Processed and wrote the agents file without issue.
# 1 = Error processing/writing the agents file.
# 2 = The SSH_AUTH_SOCKS array may be out of date as the agents file'a mtime has changed.
local ERR I J MTIME SOCKS
# Add the current agent socket to the sockets array.
SSH_AUTH_SOCKS=("$SSH_AUTH_SOCK" "${SSH_AUTH_SOCKS[@]}")
# Remove any duplicates from SSH_AUTH_SOCKS.
for ((I = 0; I < ${#SSH_AUTH_SOCKS[@]}; I++)); do
[[ -z "${SSH_AUTH_SOCKS[$I]}" ]] && continue
for ((J = 0; J < ${#SOCKS[@]}; J++)); do
[[ "${SSH_AUTH_SOCKS[$I]}" == "${SOCKS[$J]}" ]] && continue 2
done
# Only add the socket if it's still viable.
SSH_AUTH_SOCK="${SSH_AUTH_SOCKS[$I]}" ssh-add -l >/dev/null 2>&1
(( $? <= 1 )) && SOCKS+=("${SSH_AUTH_SOCKS[$I]}")
done
# Lock the ~/.ssh/agents file.
if [[ "$PLATFORM" == "Linux" ]]; then
# Make sure SSH_AUTH_SOCKS has the most up to date data.
MTIME="$(stat --format=%.9Y "$HOME/.ssh/agents")"
(( ${MTIME/\.} > SSH_AGENTS_MTIME )) && return 2
# Lock the agents file.
exec 9<"$HOME/.ssh/agents" && flock -E 10 -e -w 0.5 9
ERR=$?
if (( ERR == 10 )); then
printf "\\033[1;31m%s\\033[0m\\n" "Failed to obtain lock on ~/.ssh/agents." >&2
return 1
elif (( ERR > 0 )); then
printf "\\033[1;31m%s\\033[0m\\n" "Flock usage error." >&2
return 1
fi
elif [[ "$(uname -s)" == "Darwin" ]]; then
# Make sure SSH_AUTH_SOCKS has the most up to date data.
MTIME="$(stat -f %Fm "$HOME/.ssh/agents")"
(( ${MTIME/\.} > SSH_AGENTS_MTIME )) && return 2
# Do locking the sucky way on Darwin.
for ((I = 0; I <= 5; I++)); do
if shlock -p "$$" -f "$HOME/.ssh/agents.lock"; then
exec 9<"$HOME/.ssh/agents"
ERR=0
break
else
ERR=1
sleep 0.1
fi
done
(( ERR != 0 )) && {
printf "\\033[1;31m%s\\033[0m\\n" "Failed to obtain lock on ~/.ssh/agents." >&2
return 1
}
else
printf "\\033[1;31m%s\\033[0m\\n" "File locking unsupported on '$PLATFORM'." >&2
return 1
fi
# Write the cleaned array to disk.
ERR=-1
[[ -n "${SOCKS[*]}" ]] && { printf "%s\\n" "${SOCKS[@]}" >"$HOME/.ssh/agents" 2>/dev/null; ERR=$?; }
# Release locks.
exec 9<&-
rm -f "$HOME/.ssh/agents.lock"
# Error out if the data couldn't be written.
if (( ERR == -1 )); then
rm -f "$HOME/.ssh/agents" 2>/dev/null
elif (( ERR >= 1 )); then
rm -f "$HOME/.ssh/agents" 2>/dev/null
printf "\\033[1;31m%s\\033[0m\\n" "Failed to write ssh-agent socket list." >&2
return 1
fi
return 0
}
# Add the ssh-agent prompt function call to PROMPT_COMMAND.
PROMPT_COMMAND+="__ssh_agent_prompt_command;"
# Auto start the ssh agent.
__ssh_agent_prompt_command
# Prompt to add keys to ssh-agent with scp/sftp/ssh commands.
hash scp ssh ssh-add >/dev/null 2>&1 && alias scp='_SSHEXEC=scp ssh'
hash sftp ssh ssh-add >/dev/null 2>&1 && alias sftp='_SSHEXEC=sftp ssh'
hash ssh ssh-add >/dev/null 2>&1 && ssh() {
local ERR
if [[ -z "$SSH_AUTH_SOCK" ]]; then
ERR=2
else
ssh-add -l >/dev/null 2>&1
ERR=$?
fi
if (( ERR == 1 )); then
ssh-add
elif (( ERR == 2 )); then
__ssh_agent_prompt_command
ssh-add
fi
command "${_SSHEXEC:-ssh}" "$@"
unset _SSHEXEC
}

View file

@ -1,4 +1,3 @@
/*
!/.gitignore
!/Preferences
!/config.json
!/*.gpg

View file

@ -0,0 +1,2 @@
Њ  __0*~ЊжТАЉvПыФ4 ЉФЅТ_>дщs€#eYfШиИ—$дЩ.ґbЄіҐL*г.ЖVЛіўҐ•аЦыvЗ:®|5ТжиФяLКExЧ±Хв8Э юLVЖМ&єжѓdҐз[(Э э#]хь©ѓ>П©
|РDwЉsећ±з‡Ц±ЌF¶3в Q,В"W )УЙ8о Ѓ Х<C2A0>бtboЫ®Щ·_9-ГЇэп©M3і{хb•NGX4<!`ѓ];ш,4Кm<D09A>”NУ0ы"е&Жч щ…=сCћШB7МмcmЊZvM.qxtБ)< ЄЈHћI"°ЦPл€`щҐгоO`В5№)$)ДЁ Ж·ЎIьІЩyOMju+rґТ©x)ь>ѕSНИАлx8xiБYоxБЉ)ч­R°1Bу?HtЫФ

View file

@ -0,0 +1,2 @@
Œ  ¥”ý%'eÒæÒ®E•|<7C>sè?]¡&?\µ<>Í1\ÆÜ"©
¯ë9ig¤ŸBôR{Ï>šÅÇìêò ì\¢¯ ÐSè1|mÈ*6è<36>Ño@'m¡eâHmZÅúþšé—Åê}3´Ýßx´M…ºû·¡Ô‡ÝÖüœfÊLu¼KÝz/Ÿè¼`ÓùñLŽÝzµäËuï[Ž<>¯¾<>}ô(É´‹™ºï|§Ú ?¦apý)GN/7¶ÐÁ

View file

@ -1,18 +1,25 @@
# This is the gitattributesdb database file.
# Do not manually edit this file - any changes will be overwritten.
LmFkZHJlc3Nib29r 1724463580.692228929 1724463580.690228954 tadgy:users 0644 - -
LmFscGluZS5wYXNzZmlsZQ== 1724463580.698228856 1724463580.697228869 tadgy:users 0644 - -
LmFkZHJlc3Nib29r 1724463580.692228929 1724463580.690228954 tadgy:users 0600 - -
LmFscGluZS5wYXNzZmlsZQ== 1724463580.698228856 1724463580.697228869 tadgy:users 0600 - -
LmFuc2libGUuY2Zn 1724463580.704228783 1724463580.703228795 tadgy:users 0644 - -
LmJhc2hfbG9nb3V0 1724522863.485759261 1724462924.335195828 tadgy:users 0644 - -
LmJhc2hfcHJvZmlsZQ== 1724528760.102027666 1699054853.073970225 tadgy:users 0644 - -
LmJhc2hfcHJvZmlsZQ== 1724603117.381212400 1699054853.073970225 tadgy:users 0644 - -
LmJhc2hfcHJvZmlsZS5kL2dpdGNvbmZpZw== 1724529135.866494652 1724529135.865494664 tadgy:users 0644 - -
LmJhc2hfcHJvZmlsZS5kL3Blcmw1 1724603434.952337213 1724602401.584963348 tadgy:users 0755 - -
LmJhc2hfcHJvZmlsZS5kL3NjcmVlbg== 1724527600.768251861 1724527096.429458878 tadgy:users 0755 - -
LmJhc2hyYw== 1724529154.441277405 1724462955.427818700 tadgy:users 0644 - -
LmJhc2hyYy5kL2dpdA== 1724523575.106991980 1724516588.939511563 tadgy:users 0755 - -
LmJhc2hyYy5kL2ltYWdlYmlu 1724522976.223364495 1724522888.383454497 tadgy:users 0755 - -
LmJhc2hyYy5kL25hbm9yYw== 1724524202.806528473 1724518021.821827517 tadgy:users 0755 - -
LmJhc2hyYy5kL3NzaA== 1724522806.719454222 1724520274.925410155 tadgy:users 0755 - -
LmNvbmZpZy8uZ2l0aWdub3Jl 1724463235.213424631 1724463235.212424643 tadgy:users 0644 - -
LmNvbmZpZy9Nb3VzZXBhZC9hY2NlbHMuc2Nt 1724463580.715228649 1724463580.713228674 tadgy:users 0644 - -
LmNvbmZpZy9Nb3VzZXBhZC9tb3VzZXBhZHJj 1724463580.723228552 1724463580.722228564 tadgy:users 0644 - -
LmNvbmZpZy9TaWduYWwvLmdpdGlnbm9yZQ== 1724463580.733228430 1724463580.732228442 tadgy:users 0644 - -
LmNvbmZpZy9TaWduYWwvUHJlZmVyZW5jZXM= 1724463580.741228333 1724463580.740228345 tadgy:users 0644 - -
LmNvbmZpZy9TaWduYWwvY29uZmlnLmpzb24= 1724463580.749228235 1724463580.747228259 tadgy:users 0644 - -
LmNvbmZpZy9TaWduYWwvLmdpdGlnbm9yZQ== 1724615489.051077578 1724463580.732228442 tadgy:users 0644 - -
LmNvbmZpZy9TaWduYWwvUHJlZmVyZW5jZXMuZ3Bn 1724615507.948847529 1724615507.946847553 tadgy:users 0644 - -
LmNvbmZpZy9TaWduYWwvY29uZmlnLmpzb24uZ3Bn 1724615536.300502702 1724615536.298502727 tadgy:users 0644 - -
LmNvbmZpZy9iYXQvY29uZmln 1724463022.797001518 1724463022.792001579 tadgy:users 0644 - -
LmNvbmZpZy9kY29uZi8uZ2l0aWdub3Jl 1724463580.759228113 1724463580.758228126 tadgy:users 0644 - -
LmNvbmZpZy9nYWxjdWxhdG9yL2dhbGN1bGF0b3IuY29uZg== 1724463580.771227967 1724463580.769227992 tadgy:users 0644 - -
@ -56,10 +63,10 @@ LmdpdGNvbmZpZy1yb290QCouYWZ0ZXJkYXJrLmxhbg== 1699048695.939311057 1699048695.938
LmdpdGNvbmZpZy10YWRneUAq 1699053400.866388202 1699053400.859388296 tadgy:users 0644 - -
LmdpdGNvbmZpZy10YWRneUAqLmFmdGVyZGFyay5sYW4= 1699048695.941311030 1699048695.940311044 tadgy:users 0644 - -
LmdpdGNvbmZpZy10YWRneUBjaHVja2llLmFmdGVyZGFyay5sYW4= 1699211453.500119441 1699211453.499119454 tadgy:users 0644 - -
LmdpdGhvb2tzL2dpdGF0dHJpYnV0ZXNkYg== 1724530731.179194849 1724529603.257920116 tadgy:users 0755 - -
LmdpdGhvb2tzL3Bvc3QtY2hlY2tvdXQ= 1724529818.878313877 1724529707.823657328 tadgy:users 0755 - -
LmdpdGhvb2tzL3Bvc3QtbWVyZ2U= 1724529830.462173646 1724529707.824657316 tadgy:users 0755 - -
LmdpdGhvb2tzL3ByZS1jb21taXQ= 1724529839.646062456 1724529707.825657303 tadgy:users 0755 - -
LmdpdGhvb2tzL2dpdGF0dHJpYnV0ZXNkYg== 1724612794.912354623 1724529603.257920116 tadgy:users 0755 - -
LmdpdGhvb2tzL3Bvc3QtY2hlY2tvdXQ= 1724595844.224293406 1724529707.823657328 tadgy:users 0755 - -
LmdpdGhvb2tzL3Bvc3QtbWVyZ2U= 1724595855.280159575 1724529707.824657316 tadgy:users 0755 - -
LmdpdGhvb2tzL3ByZS1jb21taXQ= 1724614209.075614677 1697830629.854321208 tadgy:users 0755 - -
LmdpdGlnbm9yZQ== 1724462955.439818554 1724462955.438818566 tadgy:users 0644 - -
LmdpdG1vZHVsZXM= 1724529603.915912178 1724529603.913912202 tadgy:users 0644 - -
LmdudXBnLy5naXRpZ25vcmU= 1697830630.665311226 1697830630.665311226 tadgy:users 0644 - -
@ -92,7 +99,7 @@ Lmlyc3NpL3NjcmlwdHMvc2xhY2t0b3BpYy5wbA== 1724463581.196222791 1724463581.1942228
Lmlyc3NpL3NjcmlwdHMvdHJhY2tiYXIucGw= 1724463581.204222693 1724463581.202222718 tadgy:users 0644 - -
Lmlyc3NpL3NjcmlwdHMvdXJsbWFjaGluZTIucGw= 1724463581.212222596 1724463581.209222632 tadgy:users 0644 - -
Lmlyc3NpL3N0YXJ0dXA= 1724463581.219222511 1724463581.217222535 tadgy:users 0644 - -
LmxvY2FsLy5naXRpZ25vcmU= 1697830630.781309799 1697830630.780309811 tadgy:users 0644 - -
LmxvY2FsLy5naXRpZ25vcmU= 1724616340.354806836 1697830630.780309811 tadgy:users 0644 - -
LmxvY2FsL3NoYXJlLy5naXRpZ25vcmU= 1724463581.229222389 1724463581.227222413 tadgy:users 0644 - -
LmxvY2FsL3NoYXJlL2FwcGxpY2F0aW9ucy8uZ2l0aWdub3Jl 1724463581.240222255 1724463581.239222267 tadgy:users 0644 - -
LmxvY2FsL3NoYXJlL2FwcGxpY2F0aW9ucy9maXJlZm94LVRhZGd5LmRlc2t0b3A= 1724463581.249222145 1724463581.247222170 tadgy:users 0644 - -
@ -105,14 +112,15 @@ Lmx5bngtYm9va21hcmtzLmh0bWw= 1697830630.805309503 1697830630.804309515 tadgy:use
Lmx5bnguY2Zn 1697830630.824309269 1697830630.807309478 tadgy:users 0644 - -
Lmx5bngubHNz 1697830630.827309232 1697830630.826309245 tadgy:users 0644 - -
Lmx5bnhyYw== 1697830630.832309171 1697830630.829309208 tadgy:users 0644 - -
Lm1pbmlyYy5taWtyb3Rpaw== 1724463581.283221731 1724463581.281221755 tadgy:users 0644 - -
Lm1pbmlyYy5kZmw= 1724617220.887224071 1724616407.779996940 tadgy:users 0644 - -
Lm1pbmlyYy5taWtyb3Rpaw== 1724617236.760034122 1724463581.281221755 tadgy:users 0644 - -
Lm5hbm9yYy0y 1697830630.835309134 1697830630.833309158 tadgy:users 0644 - -
Lm5hbm9yYy01 1697830630.837309109 1697830630.836309121 tadgy:users 0644 - -
Lm5hbm9yYy02 1697830630.840309072 1697830630.839309085 tadgy:users 0644 - -
Lm5hbm9yYy03 1697830630.843309035 1697830630.842309048 tadgy:users 0644 - -
Lm5hbm9yYy04 1724462704.953856120 1724462704.948856181 tadgy:users 0644 - -
Lm5hbm9yYy1kYXJ3aW4= 1697830630.846308998 1697830630.845309011 tadgy:users 0644 - -
LnBpbmVyYw== 1724463581.298221548 1724463581.291221634 tadgy:users 0644 - -
LnBpbmVyYw== 1724463581.298221548 1724463581.291221634 tadgy:users 0600 - -
LnB1c2hvdmVyLWNsaWVudC8uZ2l0aWdub3Jl 1724463581.307221439 1724463581.306221451 tadgy:users 0644 - -
LnB1c2hvdmVyLWNsaWVudC9iYWNrdXBzLmdwZw== 1724463581.315221341 1724463581.314221353 tadgy:users 0644 - -
LnJ0b3JyZW50LnJj 1724463581.321221268 1724463581.320221280 tadgy:users 0644 - -
@ -121,12 +129,19 @@ LnNjcmVlbnJj 1697830630.860308826 1697830630.859308838 tadgy:users 0644 - -
LnNjcmVlbnJjLXphcHA= 1724463581.337221073 1724463581.335221098 tadgy:users 0644 - -
LnNoZWxsY2hlY2tyYw== 1697830630.866308752 1697830630.866308752 tadgy:users 0644 - -
LnNzaC8uZ2l0aWdub3Jl 1724463581.344220988 1724463581.342221012 tadgy:users 0644 - -
LnNzaC9hdXRob3JpemVkX2tleXM= 1697830630.876308629 1697830630.875308641 tadgy:users 0644 - -
LnNzaC9jb25maWc= 1724463470.165574076 1724463470.163574100 tadgy:users 0644 - -
LnNzaC9pZF9lZDI1NTE5LXBlcnNvbmFsLmdwZw== 1724463581.349220927 1724463581.348220939 tadgy:users 0644 - -
LnNzaC9pZF9lZDI1NTE5LXBlcnNvbmFsLnB1Yg== 1724463581.355220854 1724463581.353220878 tadgy:users 0644 - -
LnNzaC9pZF9lZDI1NTE5LXdvcmsuZ3Bn 1724463581.360220793 1724463581.359220805 tadgy:users 0644 - -
LnNzaC9pZF9lZDI1NTE5LXdvcmsucHVi 1724463581.366220720 1724463581.364220744 tadgy:users 0644 - -
LnNzaC9pZF9yc2EtcGVyc29uYWwuZ3Bn 1724463581.372220647 1724463581.370220671 tadgy:users 0644 - -
LnNzaC9pZF9yc2EtcGVyc29uYWwucHVi 1724463581.377220586 1724463581.375220610 tadgy:users 0644 - -
LnNzaC9hdXRob3JpemVkX2tleXM= 1697830630.876308629 1697830630.875308641 tadgy:users 0600 - -
LnNzaC9jb25maWc= 1724463470.165574076 1724463470.163574100 tadgy:users 0600 - -
LnNzaC9pZF9lZDI1NTE5LXBlcnNvbmFsLmdwZw== 1724463581.349220927 1724463581.348220939 tadgy:users 0600 - -
LnNzaC9pZF9lZDI1NTE5LXBlcnNvbmFsLnB1Yg== 1724463581.355220854 1724463581.353220878 tadgy:users 0600 - -
LnNzaC9pZF9lZDI1NTE5LXdvcmsuZ3Bn 1724463581.360220793 1724463581.359220805 tadgy:users 0600 - -
LnNzaC9pZF9lZDI1NTE5LXdvcmsucHVi 1724463581.366220720 1724463581.364220744 tadgy:users 0600 - -
LnNzaC9pZF9yc2EtcGVyc29uYWwuZ3Bn 1724463581.372220647 1724463581.370220671 tadgy:users 0600 - -
LnNzaC9pZF9yc2EtcGVyc29uYWwucHVi 1724463581.377220586 1724463581.375220610 tadgy:users 0600 - -
LnhzY3JlZW5zYXZlcg== 1724463581.384220501 1724463581.381220538 tadgy:users 0644 - -
LmdpdA== 1724617256.744794884 1697830629.829321516 tadgy:users 0700 - -
LnNzaC9pZF9yc2EtcGVyc29uYWwuZ3Bn 1724463581.372220647 1724463581.370220671 tadgy:users 0600 - -
LnNzaC9pZF9yc2EtcGVyc29uYWwucHVi 1724463581.377220586 1724463581.375220610 tadgy:users 0600 - -
LnNzaC9pZF9lZDI1NTE5LXBlcnNvbmFsLmdwZw== 1724463581.349220927 1724463581.348220939 tadgy:users 0600 - -
LnNzaC9pZF9lZDI1NTE5LXBlcnNvbmFsLnB1Yg== 1724463581.355220854 1724463581.353220878 tadgy:users 0600 - -
LnNzaC9pZF9lZDI1NTE5LXdvcmsuZ3Bn 1724463581.360220793 1724463581.359220805 tadgy:users 0600 - -
LnNzaC9pZF9lZDI1NTE5LXdvcmsucHVi 1724463581.366220720 1724463581.364220744 tadgy:users 0600 - -

19
.gitattributesdb-extra Normal file
View file

@ -0,0 +1,19 @@
LmJhc2hfaGlzdG9yeSo=
LmVzeGNsaS0q
LmdpdA==
LmdudXBnL29wZW5wZ3AtcmV2b2NzLmQvKi5yZXY=
LmdudXBnL3ByaXZhdGUta2V5cy12MS5kLyoua2V5
LmdudXBnL3JhbmRvbV9zZWVk
Lmlyc3NpL2NvbmZpZw==
LnB1c2hvdmVyLWNsaWVudC9iYWNrdXBz
Lmxlc3Noc3Q=
Lm1vemlsbGE=
LnNjcmVlbi0q
LnNzaC9hZ2VudHM=
LnNzaC9pZF9yc2E=
LnNzaC9pZF9yc2EtKg==
LnNzaC9pZF9lZDI1NTE5
LnNzaC9pZF9lZDI1NTE5LSo=
LnNzaC9rbm93bl9ob3N0cw==
LndnZXQtaHN0cw==
LnhzZXNzaW9uLWVycm9ycw==

@ -1 +1 @@
Subproject commit 548d33c013760cd6ba0cef4b48d2160f854ca6b1
Subproject commit ac9b32f13b351778ade18d595fb08e037541925a

View file

@ -1,4 +1,4 @@
#!/usr/bin/env bash
# Store/restore the attributes of files:
.githooks/gitattributesdb/gitattributesdb "${0##*/}"
.githooks/gitattributesdb/gitattributesdb "${0##*/}" || exit $?

View file

@ -1,4 +1,4 @@
#!/usr/bin/env bash
# Store/restore the attributes of files:
.githooks/gitattributesdb/gitattributesdb "${0##*/}"
.githooks/gitattributesdb/gitattributesdb "${0##*/}" || exit $?

View file

@ -1,4 +1,51 @@
#!/usr/bin/env bash
#!/bin/bash
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
# Store/restore the attributes of files:
.githooks/gitattributesdb/gitattributesdb "${0##*/}"
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=$(git hash-object -t tree /dev/null)
fi
# If you want to allow non-ASCII filenames set this variable to true.
allownonascii=$(git config --type=bool hooks.allownonascii)
# Redirect output to stderr.
exec 1>&2
# Cross platform projects tend to avoid non-ASCII filenames; prevent
# them from being added to the repository. We exploit the fact that the
# printable range starts at the space character and ends with tilde.
if [ "$allownonascii" != "true" ] &&
# Note that the use of brackets around a tr range is ok here, (it's
# even required, for portability to Solaris 10's /usr/bin/tr), since
# the square bracket bytes happen to fall in the designated range.
test $(git diff --cached --name-only --diff-filter=A -z $against |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
cat <<\EOF
Error: Attempt to add a non-ASCII file name.
This can cause problems if you want to work with people on other platforms.
To be portable it is advisable to rename the file.
If you know what you are doing you can disable this check using:
git config hooks.allownonascii true
EOF
exit 1
fi
# If there are whitespace errors, print the offending file names and fail.
git diff-index --check --cached $against -- || exit $?
.githooks/gitattributesdb/gitattributesdb "${0##*/}" || exit $?

1
.local/.gitignore vendored
View file

@ -1,2 +1,3 @@
/bin/
/lib/
/perl5/

4
.minirc.dfl Normal file
View file

@ -0,0 +1,4 @@
# Machine-generated file - use setup menu in minicom to change parameters.
pu port /dev/ttyUSB0
pu rtscts No
pu linewrap Yes

View file

@ -4,4 +4,4 @@ pu baudrate 115200
pu bits 8
pu parity N
pu stopbits 1
pu rtscts No
pu rtscts No