Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
place bind in a tty detection block,
mrzool/bash-sensible#19

defined .inputrc file, example https://www.gnu.org/software/bash/manual/html_node/Sample-Init-File.html

gnupg settings

disable gpg agent, as it runs as a system service

slit setup across files

typos

working version, sexy bash prompt support

beta release

fixed config alias to use brew which

changed README to use ssh rather than http

removed from bash_profile call to profile, as it might call twice bashrc

fix ls colors for linux. bash_alias was overwriting the dircolors alias

linux fixes, fix byobu, update gpg-agent

new genv alias, updated mail in gitconfig

fixed ssh-agent for linux, source highlight for linux and dircolors in osx

fix colorizer condition

fix ll alias, remove -G parameter to allow display group ownership

less colours for linux

remove less line number

pygments and dircolor theme support

fix dircolors in byobu

remove debian_prompt from bashrc

alias f2b

alias f2b

add colors to git and default master branch

alias psmem and pscpu

fix pyenv

reverse lt and left alias, sudo alias, alias to purge deb packages.

alias for reboot-required

added git aliases

update repo address in README.md

updated PATH for multipass aliases

clean up PATH

config advice.ignoredHook false

remove auto retrieve key from dirmngr.conf

ammend pyenv virtualenv-init statement

fix pipup alias to support local repositories with an @ symbol.

lsurl function in bash_aliases it will list a url index content

fix space in python REPL due to inputrc magic space

remove gnupg conf files, trust default settings.

add check for pygmentize and support for osx amd64

add and comment default brew completion

update .config/one-dark.dircolors

add source

stow ignore file, updated README, colors, lots of colors

fix ssh agent error in linux

fix missing en_US.utf8 locale, set C.utf8 as fallback

jsonpp alias

set gpg-agent as agent for ssh

add logic to call gpgconf only when it's installed

fix locale error

fix locale error

disable locale

update readme, set standard brew bash completion
  • Loading branch information
gnzsnz committed Aug 28, 2023
1 parent 5a8f48b commit 65e7f1b
Show file tree
Hide file tree
Showing 27 changed files with 3,924 additions and 216 deletions.
100 changes: 100 additions & 0 deletions .bash_aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#!/usr/bin/env bash
###############################################################################
# ~/.bash_logout
#
# gnzsnz dotfiles
#
# ~/.bash_aliases: a collection of handy bash aliases.
#
###############################################################################

alias cp='cp -iv' # Preferred 'cp' implementation
alias mv='mv -iv' # Preferred 'mv' implementation
alias mkdir='mkdir -pv' # Preferred 'mkdir' implementation
alias ln='ln -iv' # Preferred 'ln' implementation
alias ls='ls -F --color=auto' # Preferred 'ls' implementation
alias sl='ls' # Preferred ls typo
alias ll='ls -FlAhp'
# some more ls aliases
alias la='ls -FAp'
alias l='ls -CF'
alias left='ls -Ftr -1' # sort by modification time

# cd
alias cd..='cd ..'

alias df='df -hT'
alias du='du -ch'
alias free='free -htw'

# grep ps
alias psg="ps aux | grep -v grep | grep -i -e VSZ -e"
alias psmem="ps aux | sort -nrk +4 | head | cat <(ps aux | head -1) - "
alias pscpu="ps aux | sort -nrk +3 | head | cat <(ps aux | head -1) - "

# grep history, ex gh grep
alias gh='history|grep -i '

# grep env(viroment)
alias genv='env|grep -i '

# allow sudo
alias sudo='sudo '

# just what you need mount
alias mnt="mount | awk -F' ' '{ printf \"%s\t%s\n\",\$1,\$3; }' | column -t | egrep ^/dev/ | sort"

# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

# dotfiles
# https://www.atlassian.com/git/tutorials/dotfiles
alias config='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
#

### add OS specific alias ###
case $(uname) in
Linux)
# sort by size
alias lt='ls --human-readable --size -1 -Sr --classify'
alias dpkg-purge-list="dpkg --list | grep ^rc| cut -d ' ' -f 3"
alias dpkg-purge='apt purge $(dpkg --list | grep ^rc| cut -d " " -f 3)'
alias reboot-required='[ -f /var/run/reboot-required ] && echo "Reboot required" || echo "Reboot NOT required"'
;;
Darwin)
# sort by size
alias lt='du -sh * | sort -hr'
;;
esac
## end OS specific alias

## fail2ban
alias f2bans='litecli -D /var/lib/fail2ban/fail2ban.sqlite3 -t -e "select jail, ip, datetime(a.timeofban, '\''unixepoch'\'') as timeofban, time(a.bantime, '\''unixepoch'\'') as bantime, a.bancount from bans a "'

alias f2bips='litecli -D /var/lib/fail2ban/fail2ban.sqlite3 -t -e "select a.jail, a.ip , datetime(a.timeofban, '\''unixepoch'\'') as timeofban, time(a.bantime, '\''unixepoch'\'' ) as bantime, a.bancount from bips a "'

# ls urls
lsurl() {
curl -s "$1" | grep -o 'href=".*">' | sed -e "s/href=\"//g" | sed -e 's/">//g'
}

if [[ $(which python) && $(which pygmentize) ]]; then
jsonpp() {
if [ -z "$THEME" ]; then
_style=one-dark
else
_style=$THEME
fi;
python -m json.tool "$1" | pygmentize -l json -O style="$_style" | less
}
fi;

# disable alias for current session
# unalias ll
#
# disable all aliases for current session
# unalias -a
#
# candidates for an alias - history top 10
# history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10
8 changes: 8 additions & 0 deletions .bash_logout
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#!/usr/bin/env bash
###############################################################################
# ~/.bash_logout
#
# gnzsnz dotfiles
#
# ~/.bash_logout: executed by bash(1) when login shell exits.
#
###############################################################################

# when leaving the console clear the screen to increase privacy

Expand Down
52 changes: 48 additions & 4 deletions .bash_profile
Original file line number Diff line number Diff line change
@@ -1,10 +1,54 @@
# .bash_profile
#!/usr/bin/env bash
###############################################################################
# ~/.bashrc
#
# gnzsnz dotfiles
#
# Load .bashrc and .profile if they exists
#
###############################################################################

if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi

if [ -f ~/.profile ]; then
source ~/.profile
fi
# if you enable it make sure that .profile is not calling bashrc
#if [ -f ~/.profile ]; then
# source ~/.profile
#fi

###############################################################################
#
##### From bash man page
#
# When bash is invoked as an interactive login shell, or as a non-interactive
# shell with the --login option, it first reads and executes commands from the
# file /etc/profile, if that file exists. After reading that file, it
# looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and
# reads and executes commands from the first one that exists and is readable. The
# --noprofile option may be used when the shell is started to inhibit this
# behavior.
#
# When an interactive login shell exits, or a non-interactive login shell
# executes the exit builtin command, bash reads and executes commands from the
# file ~/.bash_logout, if it exists.
#
# When an interactive shell that is not a login shell is started, bash reads and
# executes commands from /etc/bash.bashrc and ~/.bashrc, if these files exist.
# This may be inhibited by using the --norc option. The --rcfile file option
# will force bash to read and execute commands from file instead of
# /etc/bash.bashrc and ~/.bashrc.
#
# If bash is invoked with the name sh, it tries to mimic the startup behavior of
# historical versions of sh as closely as possible, while conforming to the POSIX
# standard as well. When invoked as an interactive login shell, or a
# non-interactive shell with the --login option, it first attempts to read and
# execute commands from /etc/profile and ~/.profile, in that order.
#
# Bash attempts to determine when it is being run with its standard input
# connected to a network connection, as when executed by the remote shell daemon,
# usually rshd, or the secure shell daemon sshd. If bash determines it is being
# run in this fashion, it reads and executes commands from ~/.bashrc and
# ~/.bashrc, if these files exist and are readable.
#
###############################################################################
Loading

0 comments on commit 65e7f1b

Please sign in to comment.