Skip to content

Instantly share code, notes, and snippets.

@jrwarwick
Last active March 6, 2025 02:05
Show Gist options
  • Save jrwarwick/1bc3527e3db7b1a8cb7e5fcf6e916f39 to your computer and use it in GitHub Desktop.
Save jrwarwick/1bc3527e3db7b1a8cb7e5fcf6e916f39 to your computer and use it in GitHub Desktop.
jrwarwick standard home directory configuration file collection
# To deploy this to a newly created user account's home:
cd $HOME
GIST_ID="665715ff3fcdbf4f5b25b32feb8e8410ed37cf47"
curl -Lo github_gist_home.zip https://gist.github.com/jrwarwick/1bc3527e3db7b1a8cb7e5fcf6e916f39/archive/${GIST_ID}.zip
unzip github_gist_home.zip
ls -laFh *-${GIST_ID}/ && mv *-${GIST_ID} nix_home_kit
echo "ok, now something like: cp -i nix_home_kit/.[a-z]* \$HOME/"
# User specific functions
function getcmd () { echo $1; find `pwd` -name "*$1*" -maxdepth 5 | sed "s/^/scp $USER@$HOSTNAME:/"; }
function getscript () {
#not really compatible with a nonblank setting for export HISTTIMEFORMAT="". Maybe come up with a push/pop of that value?
history 30 | sed 's/\s*[0-9]*\s*//' | sed 's/^scripty/#extracted via scripty alias into: \/usr\/tmp\/quickscripty.sh/' |tee /usr/tmp/quickscripty.sh
}
function ssh-fingerprints() {
local file="$1"
if [[ -z "$1" ]] ; then
echo try: ssh-fingerprints authorized_keys
else
while read l; do
[[ -n $l && ${l###} = $l ]] && ssh-keygen -l -f /dev/stdin <<<$l && /bin/echo -en "\t" && echo $l | cut -f3 -d' '
echo
done < $file
fi
}
# User specific aliases
alias bigls="du -hsc * | egrep '[0-9]{2,}M|[0-9]G' | grep '^[0-9.]\+[MG]\s'"
[user]
name = jrwarwick
email = [email protected]
[credential]
helper = store
[color]
diff = auto
status = auto
branch = auto
interactive = auto
ui = true
pager = true
[push]
default = simple
CyberSpace: another vital final frontier.
These are the voyages of the humankind.
Its continuing mission: to explore strange new worlds. To seek out new life and new civilizations.
To boldly go where no one has gone before!
echo "$(at -l | wc -l) job, $(w -u | head -1 | cut -d',' -f3,4)" | sed 's/[ ]\{2,\}/ /g;s/average/avg./'
# GNU Screen - main configuration file
# All other .screenrc files should source this file to inherit settings.
# Author: Christian Wills - [email protected], minor mods [email protected]
# Allow bold colors - necessary for some reason
attrcolor b ".I"
# Tell screen how to set colors. AB = background, AF=foreground
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
# Enables use of shift-PgUp and shift-PgDn
termcapinfo xterm|xterms|xs|rxvt ti@:te@
# Erase background with current bg color
defbce "on"
# Enable 256 color term
term xterm-256color
# Cache 30000 lines for scroll back
defscrollback 5000
# New mail notification
##backtick 101 30 15 $HOME/bin/mailstatus.sh
backtick 102 10 15 $HOME/.screen_status_monitor.sh
hardstatus alwayslastline
# Very nice tabbed colored hardstatus line
hardstatus string '%{= Kd} %{= Kd}%-w%{= Kr}[%{= KW}%n %t%{= Kr}]%{= Kd}%+w %-= %{KG} %H%{KW}|%{KY}%102`%{KW}|%Y%m%d%{= Kc} %{-}'
# Hide hardstatus: ctrl-a f
bind f eval "hardstatus ignore"
# Show hardstatus: ctrl-a F
bind F eval "hardstatus alwayslastline"
screen -t "Logs"
stuff "cd /var/log"
screen -t "root"
stuff "sudo bash"
screen -t "Shell" bash
# SSH agency setup
# source this from .profile (or append to it)
SSH_ENV="$HOME/.ssh/environment"
if `tty >/dev/null 2>&1` ; then
export INTERACTIVE_LOGIN="1"
fi
function start_agent {
if [ "$INTERACTIVE_LOGIN" == "1" ] ; then
echo "Initialising new SSH agent..."
fi
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
if [ "$INTERACTIVE_LOGIN" == "1" ] ; then
echo succeeded
fi
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
#/usr/bin/ssh-add; # just does default private key files
/usr/bin/ssh-add $HOME/.ssh/*.ppk
/usr/bin/ssh-add $HOME/.ssh/id_rsa
}
# Source SSH settings, if applicable
if [ -f "${SSH_ENV}" ]; then
. "${SSH_ENV}" > /dev/null
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_agent;
}
if [ "$INTERACTIVE_LOGIN" == "1" ] ; then
echo SSH Agent active.
fi
else
start_agent;
fi
syntax on " syntax highlighting
set nocompatible " not strictly necessary but useful in some scenarii
set backspace=indent,eol,start " let the backspace key work "normally"
set incsearch " incremental search rules
set laststatus=2 " not strictly necessary but good for consistency
set ruler " shows line number in the status line
set switchbuf=useopen,usetab " better behavior for the quickfix window and :sb
set tags=./tags;/,tags;/ " search tags files efficiently
set wildmenu " better command line completion, shows a list of matches
colorscheme slate
#Informative Shell Prompt
find / -name 'git-prompt.sh' -type f -print -exec cp \{\} ./ \; -quit 2>/dev/null \
|| curl -LO https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh
mv -vn git-prompt.sh ~/.git-prompt.sh
echo -e "\n. ~/.git-prompt.sh\n" >> ~/.bashrc
echo -e "\nNow add this to your PS1 env var definition: \n\$(__git_ps1 \":[%s]\")"
echo -e "Default:\nPS1='[\u@\h:\w/\$(__git_ps1 \":{%s}\")]\$'"
#Completions
find / -name 'git-completion.bash' -type f -print -exec echo echo \'. \{\} \' \>\> ~/.bashrc \; -quit 2>/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment