Skip to content

Instantly share code, notes, and snippets.

@fredjoseph
Last active March 19, 2020 04:29
Show Gist options
  • Save fredjoseph/c5ca239111227c41669df43cf86bfef2 to your computer and use it in GitHub Desktop.
Save fredjoseph/c5ca239111227c41669df43cf86bfef2 to your computer and use it in GitHub Desktop.
ZSH aliases
alias ls="ls --color=auto -v -h --group-directories-first"
unalias fd 2>/dev/null
alias mvn-quick-install="mvn clean install -DskipTests -T2C"
alias iless="less -iMSx4 -FXR"
# Kill all the tabs in Chrome to free up memory
# [C] explained: http://www.commandlinefu.com/commands/view/402/exclude-grep-from-your-grepped-output-of-ps-alias-included-in-description
alias chromekill="ps ux | grep '[C]hrome Helper --type=renderer' | grep -v extension-process | tr -s ' ' | cut -d ' ' -f2 | xargs kill"
alias chromiumkill="ps ux | grep '[c]hromium --type=renderer' | grep -v extension-process | tr -s ' ' | cut -d ' ' -f2 | xargs kill"
# ----------
# Functions
# ----------
localip() {hostname -I | awk '{print $1}'}
remoteip() {curl watismijnip.nl 2>/dev/null | grep -io "ipaddress:\ [^\ ^<]*" | awk -F' ' '{print $2}'}
now() {date '+%Y-%m-%d %H-:%M:%S'}
please() {sudo $(fc -ln -1)}
bro() {curl bropages.org/$1.json | jq -r ".[].msg" | highlight --out-format=truecolor --syntax=bash | less -R}
toEN() {curl "https://de.pons.com/_translate/translate" --data "source_language=fr&target_language=en&service=deepl&text=""$*""&lookup=true&requested_by=Web&source_language_confirmed=true" | jq .translation}
toFR() {curl "https://de.pons.com/_translate/translate" --data "source_language=en&target_language=fr&service=deepl&text=""$*""&lookup=true&requested_by=Web&source_language_confirmed=true" | jq .translation}
cleanenv() {
if [ $# -ne 0]; then
env -i \
HOME=\"$HOME\" \
PATH=\"$PATH\" \
LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH\" \
TERM=\"$TERM\" \
USER=\"$USER\" \
zsh -c $@
else
echo "Usage: cleanenv <program> [arglist]" 1>&2
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment