Skip to content

Instantly share code, notes, and snippets.

@isa
Last active June 20, 2022 12:15
Show Gist options
  • Save isa/b3713003c3db6bb58ba5a65843de5b8d to your computer and use it in GitHub Desktop.
Save isa/b3713003c3db6bb58ba5a65843de5b8d to your computer and use it in GitHub Desktop.
function ll
command /opt/homebrew/opt/coreutils/libexec/gnubin/ls --color=auto -Falh --group-directories-first $argv
end
function wget
command wget -cq --show-progress $argv
end
function myip
command dig +short myip.opendns.com @resolver1.opendns.com
command ipconfig getifaddr en0
end
function doc
command docker-compose $argv
end
function add_spacer
command defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'; killall Dock
end
function add_small_spacer
command defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="small-spacer-tile";}'; killall Dock
end
function print_java_home
command java -XshowSettings:properties -version 2>&1 > /dev/null | grep 'java.home' | cut -d= -f2 | xargs
end
function pdfcompress
gs -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -dPDFSETTINGS=/printer -sOutputFile=(basename -s .pdf $argv)-compressed.pdf $argv
end
function scale
# -- scale *.jpg 2048
set -lx resx 1680
if test -n "$argv[2]"
set -lx resx $argv[2]
end
mogrify -filter Triangle -thumbnail $resx -unsharp 0.25x0.08+8.3+0.045 -dither None -posterize 136 -quality 82 -interlace none -colorspace sRGB $argv[1]
end
function reset_terminal
command clear; printf '\e[3J'
end
function fish_prompt
set -l exit_code $status
set_color blue
set -l parent = (dirname (pwd))
echo -n -s (echo $parent | perl -ne 'print $1 while /(\/\w)/g;')
echo -n -s '/'
set_color white
echo -n -s (basename (pwd))
if test -e .git
set_color --bold magenta
echo -n -s ":" (git branch 2>/dev/null | cut -d\ -f2)
end
set_color --bold green
if test $exit_code -ne 0
set_color --bold red
end
echo -n -s ' λ '
# echo -n -s ' ◉ '
set_color normal
end
function fish_right_prompt -d "Write out the right prompt"
set_color --bold black
if set -q VIRTUAL_ENV
echo -n -s (set_color yellow) (basename "$VIRTUAL_ENV") (set_color --bold black) " | "
end
printf (date "+$c2%H$c0:$c2%M$c0:$c2%S")
# Print the username when the user has been changed.
if test $USER != $LOGNAME
echo -n "$USER@"
end
set_color normal
end
set -x VIRTUAL_ENV_DISABLE_PROMPT true
set -x JAVA_HOME (java -XshowSettings:properties -version 2>&1 > /dev/null | grep 'java.home' | cut -d= -f2 | xargs)
set -x PYTHONDONTWRITEBYTECODE 1
set PATH /opt/homebrew/bin $PATH
set PATH /opt/homebrew/sbin $PATH
set PATH $JAVA_HOME $PATH
set PATH $HOME/.cargo/bin $PATH
set PATH $HOME/.gobin $PATH
set -g fish_user_paths "/usr/local/opt/openjdk/bin" $fish_user_paths
set -x NODE_PATH (npm root)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment