mirror of
https://gitea.blesmrt.net/mikaela/shell-things.git
synced 2024-11-22 11:19:22 +01:00
{bash,zsh}rc: add missing backslash, run prettier?
This commit is contained in:
parent
275295c9b2
commit
8dc98df80d
94
rc/bashrc
94
rc/bashrc
@ -45,7 +45,7 @@ fi
|
|||||||
|
|
||||||
# set a fancy prompt (non-color, unless we know we "want" color)
|
# set a fancy prompt (non-color, unless we know we "want" color)
|
||||||
case "$TERM" in
|
case "$TERM" in
|
||||||
xterm-color) color_prompt=yes ;;
|
xterm-color) color_prompt=yes ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
force_color_prompt=yes
|
force_color_prompt=yes
|
||||||
@ -78,10 +78,10 @@ fi
|
|||||||
|
|
||||||
# If this is an xterm set the title to user@host:dir
|
# If this is an xterm set the title to user@host:dir
|
||||||
case "$TERM" in
|
case "$TERM" in
|
||||||
xterm* | *rxvt*)
|
xterm* | *rxvt*)
|
||||||
PS1="\[\e]0;\u@\h: \w\a\]$PS1"
|
PS1="\[\e]0;\u@\h: \w\a\]$PS1"
|
||||||
;;
|
;;
|
||||||
*) ;;
|
*) ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# enable color support of ls and also add handy aliases
|
# enable color support of ls and also add handy aliases
|
||||||
@ -131,7 +131,7 @@ fi
|
|||||||
#shopt -s autocd
|
#shopt -s autocd
|
||||||
|
|
||||||
# Show the hostname, uptime and users logged in on shell start
|
# Show the hostname, uptime and users logged in on shell start
|
||||||
if hash hostname 2>/dev/null; then
|
if hash hostname 2> /dev/null; then
|
||||||
(hostname &)
|
(hostname &)
|
||||||
fi
|
fi
|
||||||
(uptime &)
|
(uptime &)
|
||||||
@ -211,7 +211,7 @@ TZ=$(date +%Z)
|
|||||||
PATH=$HOME/.local/bin:$HOME/bin:$HOME/go/bin:$HOME/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:/usr/local/bin:/usr/local/sbin:/usr/local/games:/snap/bin:/usr/bin:/usr/sbin:/usr/games:/bin:/sbin:/games:$PATH
|
PATH=$HOME/.local/bin:$HOME/bin:$HOME/go/bin:$HOME/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:/usr/local/bin:/usr/local/sbin:/usr/local/games:/snap/bin:/usr/bin:/usr/sbin:/usr/games:/bin:/sbin:/games:$PATH
|
||||||
|
|
||||||
# Add RubyGems to PATH
|
# Add RubyGems to PATH
|
||||||
if hash ruby 2>/dev/null; then
|
if hash ruby 2> /dev/null; then
|
||||||
PATH="$(ruby -e 'print Gem.user_dir')/bin:$PATH"
|
PATH="$(ruby -e 'print Gem.user_dir')/bin:$PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -235,8 +235,8 @@ CPUARCH=$(uname -p)
|
|||||||
# If we are on Linux, enable apt progress bar and colours
|
# If we are on Linux, enable apt progress bar and colours
|
||||||
if [[ $USER == "root" ]]; then
|
if [[ $USER == "root" ]]; then
|
||||||
mkdir -p /etc/apt/apt.conf.d/
|
mkdir -p /etc/apt/apt.conf.d/
|
||||||
echo 'Dpkg::Progress-Fancy "1";' >/etc/apt/apt.conf.d/99progressbar
|
echo 'Dpkg::Progress-Fancy "1";' > /etc/apt/apt.conf.d/99progressbar
|
||||||
echo 'APT::Color "1";' >/etc/apt/apt.conf.d/99color
|
echo 'APT::Color "1";' > /etc/apt/apt.conf.d/99color
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if gpg[-agent] has sshcontrol file, use it as ssh-agent. sshcontrol should
|
# if gpg[-agent] has sshcontrol file, use it as ssh-agent. sshcontrol should
|
||||||
@ -247,11 +247,11 @@ fi
|
|||||||
if [ -f ~/.gnupg/sshcontrol ]; then
|
if [ -f ~/.gnupg/sshcontrol ]; then
|
||||||
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
|
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
|
||||||
gpgconf --launch gpg-agent
|
gpgconf --launch gpg-agent
|
||||||
gpg-connect-agent updatestartuptty /bye >/dev/null 2>&1
|
gpg-connect-agent updatestartuptty /bye > /dev/null 2>&1
|
||||||
# otherwise use the normal ssh-agent
|
# otherwise use the normal ssh-agent
|
||||||
else
|
else
|
||||||
# if the output is going to /dev/null, it's non/existence doesn't matter
|
# if the output is going to /dev/null, it's non/existence doesn't matter
|
||||||
(ssh-agent -a /tmp/$USER.sshagent >/dev/null 2>&1)
|
(ssh-agent -a /tmp/$USER.sshagent > /dev/null 2>&1)
|
||||||
export SSH_AUTH_SOCK=/tmp/$USER.sshagent
|
export SSH_AUTH_SOCK=/tmp/$USER.sshagent
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -277,7 +277,7 @@ alias sudo="\sudo "
|
|||||||
alias ..="cd .."
|
alias ..="cd .."
|
||||||
|
|
||||||
# Use htop instead of top if available
|
# Use htop instead of top if available
|
||||||
if hash htop 2>/dev/null; then
|
if hash htop 2> /dev/null; then
|
||||||
alias top="htop"
|
alias top="htop"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -361,7 +361,7 @@ alias rsync-folder="rsync -h --progress -azvv "
|
|||||||
#fi
|
#fi
|
||||||
|
|
||||||
# Use GPG2 instead of GPG!
|
# Use GPG2 instead of GPG!
|
||||||
if hash gpg2 2>/dev/null; then
|
if hash gpg2 2> /dev/null; then
|
||||||
alias gpg=gpg2
|
alias gpg=gpg2
|
||||||
export KEYBASE_GPG=gpg2
|
export KEYBASE_GPG=gpg2
|
||||||
fi
|
fi
|
||||||
@ -493,7 +493,7 @@ alias venvpypy=pypyvenv
|
|||||||
|
|
||||||
# cp/mv using rsync. rcp appears to be link to scp in my system, so I can
|
# cp/mv using rsync. rcp appears to be link to scp in my system, so I can
|
||||||
# safely use this alias.
|
# safely use this alias.
|
||||||
if hash rsync 2>/dev/null; then
|
if hash rsync 2> /dev/null; then
|
||||||
alias rcp="rsync -a --progress"
|
alias rcp="rsync -a --progress"
|
||||||
alias rmv="rsync -a --progress --remove-source-files"
|
alias rmv="rsync -a --progress --remove-source-files"
|
||||||
fi
|
fi
|
||||||
@ -578,18 +578,18 @@ alias chattr="\chattr -V"
|
|||||||
alias chmod="\chmod --verbose"
|
alias chmod="\chmod --verbose"
|
||||||
|
|
||||||
# pnpm does less duplicating around
|
# pnpm does less duplicating around
|
||||||
if hash pnpm 2>/dev/null; then
|
if hash pnpm 2> /dev/null; then
|
||||||
alias npm=pnpm
|
alias npm=pnpm
|
||||||
alias npmx=pnpx
|
alias npmx=pnpx
|
||||||
alias npx=pnpx
|
alias npx=pnpx
|
||||||
alias pnpmx=pnpx
|
alias pnpmx=pnpx
|
||||||
if ! hash prettier 2>/dev/null; then
|
if ! hash prettier 2> /dev/null; then
|
||||||
alias prettier="pnpm exec prettier --cache --ignore-unknown"
|
alias prettier="pnpm exec prettier --cache --ignore-unknown"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# github-pages etc.
|
# github-pages etc.
|
||||||
if hash bundle 2>/dev/null; then
|
if hash bundle 2> /dev/null; then
|
||||||
alias jekyll="bundle exec jekyll"
|
alias jekyll="bundle exec jekyll"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -625,26 +625,26 @@ function geoip() {
|
|||||||
function ex() {
|
function ex() {
|
||||||
if [ -f "$1" ]; then
|
if [ -f "$1" ]; then
|
||||||
case "$1" in
|
case "$1" in
|
||||||
*.tar) tar xvf $1 ;;
|
*.tar) tar xvf $1 ;;
|
||||||
*.tar.bz2 | *.tbz2) tar xjvf $1 ;;
|
*.tar.bz2 | *.tbz2) tar xjvf $1 ;;
|
||||||
*.tar.gz | *.tgz) tar xzvf $1 ;;
|
*.tar.gz | *.tgz) tar xzvf $1 ;;
|
||||||
*.bz2) bunzip2 $1 ;;
|
*.bz2) bunzip2 $1 ;;
|
||||||
*.rar) unrar x $1 ;;
|
*.rar) unrar x $1 ;;
|
||||||
*.gz) gunzip $1 ;;
|
*.gz) gunzip $1 ;;
|
||||||
*.zip) unzip $1 ;;
|
*.zip) unzip $1 ;;
|
||||||
*.Z) uncompress $1 ;;
|
*.Z) uncompress $1 ;;
|
||||||
*.7z) 7z x $1 ;;
|
*.7z) 7z x $1 ;;
|
||||||
*.xz) tar xJvf $1 ;;
|
*.xz) tar xJvf $1 ;;
|
||||||
*.deb)
|
*.deb)
|
||||||
DIR=${1%%_*.deb}
|
DIR=${1%%_*.deb}
|
||||||
ar xv $1
|
ar xv $1
|
||||||
mkdir ${DIR}
|
mkdir ${DIR}
|
||||||
tar -C ${DIR} -xzvf data.tar.gz
|
tar -C ${DIR} -xzvf data.tar.gz
|
||||||
;;
|
;;
|
||||||
*.rpm) rpm2cpio $1 | cpio -vid ;;
|
*.rpm) rpm2cpio $1 | cpio -vid ;;
|
||||||
*)
|
*)
|
||||||
echo ""${1}" cannot be extracted via extract()"
|
echo ""${1}" cannot be extracted via extract()"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
echo ""${1}" is not a valid file"
|
echo ""${1}" is not a valid file"
|
||||||
@ -670,7 +670,7 @@ function gribble-gpg-everify() {
|
|||||||
|
|
||||||
echo -n 'Enter Bitcoin OTC URL: '
|
echo -n 'Enter Bitcoin OTC URL: '
|
||||||
read REPLY
|
read REPLY
|
||||||
lynx -hiddenlinks=ignore -dump $REPLY >bitcoin_otc.txt.asc
|
lynx -hiddenlinks=ignore -dump $REPLY > bitcoin_otc.txt.asc
|
||||||
$gpg --decrypt-file bitcoin_otc.txt.asc
|
$gpg --decrypt-file bitcoin_otc.txt.asc
|
||||||
echo -en '\e[1;32m;;everify '
|
echo -en '\e[1;32m;;everify '
|
||||||
cat bitcoin_otc.txt
|
cat bitcoin_otc.txt
|
||||||
@ -754,12 +754,12 @@ fix-node() {
|
|||||||
# Use clang if installed. It seems interesting and this is probably good
|
# Use clang if installed. It seems interesting and this is probably good
|
||||||
# way to test it. This might not be a function, but I don't have any better
|
# way to test it. This might not be a function, but I don't have any better
|
||||||
# place for this.
|
# place for this.
|
||||||
if hash clang 2>/dev/null; then
|
if hash clang 2> /dev/null; then
|
||||||
export CC=clang
|
export CC=clang
|
||||||
export HOMEBREW_CC=clang
|
export HOMEBREW_CC=clang
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if hash clang++ 2>/dev/null; then
|
if hash clang++ 2> /dev/null; then
|
||||||
export CXX=clang++
|
export CXX=clang++
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -772,7 +772,7 @@ github-add-pulls() {
|
|||||||
# Get server SSL certificate fingerprint in MD5, SHA1 and SHA256.
|
# Get server SSL certificate fingerprint in MD5, SHA1 and SHA256.
|
||||||
# Note that OpenSSL doesn't support IPv6 at time of writing (2015-01-13).
|
# Note that OpenSSL doesn't support IPv6 at time of writing (2015-01-13).
|
||||||
serversslcertfp() {
|
serversslcertfp() {
|
||||||
SSSLCFFN=$(openssl s_client -showcerts -connect $1 </dev/null)
|
SSSLCFFN=$(openssl s_client -showcerts -connect $1 < /dev/null)
|
||||||
# To see all validity information
|
# To see all validity information
|
||||||
echo "$SSSLCFFN"
|
echo "$SSSLCFFN"
|
||||||
# For getting the fingerprints
|
# For getting the fingerprints
|
||||||
@ -839,7 +839,7 @@ mtrp() {
|
|||||||
|
|
||||||
# My IPv4 address
|
# My IPv4 address
|
||||||
myip4() {
|
myip4() {
|
||||||
if hash dig 2>/dev/null; then
|
if hash dig 2> /dev/null; then
|
||||||
dig +short myip.opendns.com. A @208.67.222.222
|
dig +short myip.opendns.com. A @208.67.222.222
|
||||||
else
|
else
|
||||||
curl -L4s https://icanhazip.com/
|
curl -L4s https://icanhazip.com/
|
||||||
@ -848,7 +848,7 @@ myip4() {
|
|||||||
|
|
||||||
# My IPv6 address
|
# My IPv6 address
|
||||||
myip6() {
|
myip6() {
|
||||||
if hash dig 2>/dev/null; then
|
if hash dig 2> /dev/null; then
|
||||||
dig +short myip.opendns.com. AAAA @2620:0:ccc::2
|
dig +short myip.opendns.com. AAAA @2620:0:ccc::2
|
||||||
else
|
else
|
||||||
curl -L6s https://icanhazip.com/
|
curl -L6s https://icanhazip.com/
|
||||||
@ -859,15 +859,15 @@ myip6() {
|
|||||||
# It's assumed that signature of file.txt is called as file.txt.sig
|
# It's assumed that signature of file.txt is called as file.txt.sig
|
||||||
sshAllowedSigners=$HOME/src/gitea.blesmrt.net/Mikaela/ssh-allowed_signers/allowed_signers
|
sshAllowedSigners=$HOME/src/gitea.blesmrt.net/Mikaela/ssh-allowed_signers/allowed_signers
|
||||||
ssh-verify-file() {
|
ssh-verify-file() {
|
||||||
echo "$1 ${2:?Usage: ssh-verify-file <email> <file-to-verify>}" >/dev/null
|
echo "$1 ${2:?Usage: ssh-verify-file <email> <file-to-verify>}" > /dev/null
|
||||||
ssh-keygen -Y verify -f $sshAllowedSigners -I $1 -n file -s $2.sig <$2
|
ssh-keygen -Y verify -f $sshAllowedSigners -I $1 -n file -s $2.sig < $2
|
||||||
}
|
}
|
||||||
|
|
||||||
# I use nvim, while I keep running vim instead
|
# I use nvim, while I keep running vim instead
|
||||||
if hash nvim 2>/dev/null; then
|
if hash nvim 2> /dev/null; then
|
||||||
vim() {
|
vim() {
|
||||||
echo 'using nvim instead'
|
echo 'using nvim instead'
|
||||||
nvim "$@"
|
\nvim "$@"
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
vim() {
|
vim() {
|
||||||
|
Loading…
Reference in New Issue
Block a user