1
mirror of https://github.com/jakejarvis/dotfiles.git synced 2025-04-26 15:48:27 -04:00

update some aliases and functions

This commit is contained in:
Jake Jarvis 2019-09-10 12:54:27 -04:00
parent ffe377050b
commit f40a23352c
Signed by: jake
GPG Key ID: 2B0C9CF251E69A39
2 changed files with 32 additions and 16 deletions

View File

@ -16,8 +16,9 @@ alias ~="cd ~"
# My own creation! See: https://github.com/jakejarvis/simpip # My own creation! See: https://github.com/jakejarvis/simpip
alias ipv4="curl -4 simpip.com --max-time 1 --proto-default https --silent" alias ipv4="curl -4 simpip.com --max-time 1 --proto-default https --silent"
alias ipv6="curl -6 simpip.com --max-time 1 --proto-default https --silent" alias ipv6="curl -6 simpip.com --max-time 1 --proto-default https --silent"
alias ip="ipv6; ipv4" alias ip="ipv4; ipv6"
alias iploc="ipconfig getifaddr en0" alias iploc="ipconfig getifaddr en0"
alias ips="ip; ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'"
alias dns-clear="networksetup -setdnsservers Wi-Fi" alias dns-clear="networksetup -setdnsservers Wi-Fi"
alias dns-check="networksetup -getdnsservers Wi-Fi" alias dns-check="networksetup -getdnsservers Wi-Fi"
@ -30,6 +31,7 @@ alias hosts="sudo $EDITOR /etc/hosts"
alias speed="wget -O /dev/null http://cachefly.cachefly.net/100mb.test" alias speed="wget -O /dev/null http://cachefly.cachefly.net/100mb.test"
alias digg="dig @8.8.8.8 +nocmd any +multiline +noall +answer" alias digg="dig @8.8.8.8 +nocmd any +multiline +noall +answer"
# Update: brew, npm, gem, macos
alias update="brew update; brew upgrade; brew cask upgrade; brew cleanup; nvm install node --latest-npm --reinstall-packages-from=node; npm install npm -g; npm update -g; gem update --system; gem update; gem cleanup; sudo gem update --system; sudo gem update; sudo gem cleanup; sudo softwareupdate -ia --include-config-data;" alias update="brew update; brew upgrade; brew cask upgrade; brew cleanup; nvm install node --latest-npm --reinstall-packages-from=node; npm install npm -g; npm update -g; gem update --system; gem update; gem cleanup; sudo gem update --system; sudo gem update; sudo gem cleanup; sudo softwareupdate -ia --include-config-data;"
alias rehide="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder" alias rehide="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"
@ -42,20 +44,27 @@ alias displays="system_profiler SPDisplaysDataType"
alias cpu="sysctl -n machdep.cpu.brand_string" alias cpu="sysctl -n machdep.cpu.brand_string"
alias screenfetch="neofetch" alias screenfetch="neofetch"
alias ripfinder="killall Finder" alias ripfinder="sudo killall Finder"
alias ripdock="killall Dock" alias ripdock="sudo killall Dock"
alias ripmenu="killall SystemUIServer NotificationCenter" alias ripmenu="sudo killall SystemUIServer NotificationCenter"
alias finder="open ./" alias finder="open -a Finder ./"
alias vsc="code ./" alias vs="code ./"
alias gundo="git reset --soft HEAD~1" alias gc="git commit -m" # + commit message
alias gc="git commit -m" alias gca="git add . && git commit -m" # + commit message
alias gca="git add . && git commit -m"
alias gs="git status -sb" alias gs="git status -sb"
alias gl="git log --pretty=short" alias gl="git log --pretty=short"
alias gd="git diff" alias gd="git diff"
alias gds="git diff --staged" alias gds="git diff --staged"
alias gpom="git push origin master"
alias glom="git pull origin master"
alias gpo="git push origin" # + branch name
alias glo="git pull origin" # + branch name
alias gb="git checkout" # + branch name
alias gbn="git checkout -b" # + branch name
alias grm="git rebase -i origin/master"
alias gundo="git reset --soft HEAD~1"
alias dc="docker-compose" alias dc="docker-compose"

View File

@ -45,14 +45,21 @@ unshort() {
curl -sIL $1 | sed -n 's/Location: *//p' curl -sIL $1 | sed -n 's/Location: *//p'
} }
# Create a custom git.io short URL (if available) # Create a git.io short URL (custom slug optional)
# ex: gitio jakesdotfiles https://github.com/jakejarvis/dotfiles => https://git.io/jakesdotfiles # ex: gitio https://github.com/jakejarvis/dotfiles [jakesdotfiles] => https://git.io/jakesdotfiles
# https://blog.github.com/2011-11-10-git-io-github-url-shortener
gitio() { gitio() {
if [ -z "${1}" ] || [ -z "${2}" ]; then PARAMS="-F \"url=$1\""
echo "Usage: \`gitio slug url\`" if [ -n "$2" ]; then PARAMS="$PARAMS -F \"code=$2\""; fi
return 1 RESPONSE=$(eval "curl -i https://git.io $PARAMS 2>&1" | grep "Location: ")
fi echo "${RESPONSE//Location: /}"
curl -i https://git.io/ -F "url=${2}" -F "code=${1}" }
# Transfers text file as sharable link.
# See https://transfer.sh/
transfer() {
if [ $# -eq 0 ]; then echo "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi
tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile;
} }
# List files in an S3 bucket # List files in an S3 bucket