mirror of
https://github.com/jakejarvis/dotfiles.git
synced 2026-01-12 16:32:54 -05:00
tidy up aliases and functions
This commit is contained in:
@@ -11,10 +11,6 @@ alias ...="cd ../.."
|
|||||||
alias ....="cd ../../.."
|
alias ....="cd ../../.."
|
||||||
alias ~="cd ~"
|
alias ~="cd ~"
|
||||||
|
|
||||||
#alias ip="dig +short myip.opendns.com A @resolver1.opendns.com"
|
|
||||||
#alias ipv4="dig +short myip.opendns.com A @resolver1.opendns.com"
|
|
||||||
#alias ipv6="dig +short -6 myip.opendns.com AAAA @resolver1.ipv6-sandbox.opendns.com"
|
|
||||||
|
|
||||||
alias ip="ipv4"
|
alias ip="ipv4"
|
||||||
alias ipv4="curl -4 icanhazip.com"
|
alias ipv4="curl -4 icanhazip.com"
|
||||||
alias ipv6="curl -6 icanhazip.com"
|
alias ipv6="curl -6 icanhazip.com"
|
||||||
@@ -27,14 +23,16 @@ alias dns-set-cloudflare="dns-set 1.1.1.1 1.0.0.1"
|
|||||||
alias dns-set-google="dns-set 8.8.8.8 8.8.4.4"
|
alias dns-set-google="dns-set 8.8.8.8 8.8.4.4"
|
||||||
|
|
||||||
alias flush="sudo killall -HUP mDNSResponder; sudo killall mDNSResponderHelper; sudo dscacheutil -flushcache"
|
alias flush="sudo killall -HUP mDNSResponder; sudo killall mDNSResponderHelper; sudo dscacheutil -flushcache"
|
||||||
# alias serve="echo 'Starting server at http://127.0.0.1:8000/ ...'; python3 -m http.server"
|
|
||||||
alias hosts="sudo $EDITOR /etc/hosts"
|
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"
|
||||||
|
|
||||||
alias unhide="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
|
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"
|
||||||
|
alias unhide="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
|
||||||
alias forcetrash="sudo rm -rf ~/.Trash /Volumes/*/.Trashes"
|
alias forcetrash="sudo rm -rf ~/.Trash /Volumes/*/.Trashes"
|
||||||
|
alias unq="sudo xattr -rd com.apple.quarantine"
|
||||||
alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend"
|
alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend"
|
||||||
|
|
||||||
alias displays="system_profiler SPDisplaysDataType"
|
alias displays="system_profiler SPDisplaysDataType"
|
||||||
@@ -45,27 +43,22 @@ alias ripfinder="killall Finder"
|
|||||||
alias ripdock="killall Dock"
|
alias ripdock="killall Dock"
|
||||||
alias ripmenu="killall SystemUIServer NotificationCenter"
|
alias ripmenu="killall SystemUIServer NotificationCenter"
|
||||||
|
|
||||||
alias update="brew update; brew 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 finder="open ./"
|
||||||
|
alias vs="code ./"
|
||||||
alias pubkey="more ~/.ssh/id_rsa.pub | pbcopy | echo '=> Public key copied to pasteboard.'"
|
|
||||||
|
|
||||||
alias gundo="git reset --soft HEAD~1"
|
alias gundo="git reset --soft HEAD~1"
|
||||||
alias gc="git add . && git commit -m "
|
alias gc="git add . && git commit -m "
|
||||||
alias gs="git status -sb"
|
alias gs="git status -sb"
|
||||||
alias gd="git diff"
|
alias gd="git diff"
|
||||||
|
|
||||||
alias ios="open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app"
|
|
||||||
alias watchos="open /Applications/Xcode.app/Contents/Developer/Applications/Simulator\ \(Watch\).app"
|
|
||||||
|
|
||||||
alias dc="docker-compose"
|
alias dc="docker-compose"
|
||||||
|
|
||||||
alias sshalt="ssh -p 2222"
|
alias sshalt="ssh -p 2222"
|
||||||
alias moshalt="mosh --ssh=\"ssh -p 2222\""
|
alias moshalt="mosh --ssh=\"ssh -p 2222\""
|
||||||
|
|
||||||
alias finder="open ./"
|
alias ios="open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app"
|
||||||
alias unq="sudo xattr -rd com.apple.quarantine"
|
alias watchos="open /Applications/Xcode.app/Contents/Developer/Applications/Simulator\ \(Watch\).app"
|
||||||
|
|
||||||
|
alias pubkey="more ~/.ssh/id_rsa.pub | pbcopy | echo '=> Public key copied to clipboard.'"
|
||||||
|
|
||||||
alias weather="curl -4 http://wttr.in/Boston"
|
alias weather="curl -4 http://wttr.in/Boston"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Make new directory and change into it (this seems like a no-brainer)
|
# Make a new directory and `cd` right into it (this seems like a no-brainer)
|
||||||
mkcd() {
|
mkcd() {
|
||||||
mkdir -p -- "$1" &&
|
mkdir -p -- "$1" &&
|
||||||
cd -P -- "$1"
|
cd -P -- "$1"
|
||||||
@@ -6,10 +6,10 @@ mkcd() {
|
|||||||
|
|
||||||
# Start an HTTP server from a directory, optionally specifying the port
|
# Start an HTTP server from a directory, optionally specifying the port
|
||||||
serve() {
|
serve() {
|
||||||
local port="${1:-8000}"
|
local port="${1:-8090}"
|
||||||
sleep 1 && open "http://localhost:${port}/" &
|
sleep 1 && open "http://localhost:${port}/" &
|
||||||
# Set the default Content-Type to `text/plain` instead of `application/octet-stream`
|
# Set the default Content-Type to `text/plain` instead of `application/octet-stream`
|
||||||
# And serve everything as UTF-8 (although not technically correct, this doesn’t break anything for binary files)
|
# And serve everything as UTF-8 (although not technically correct, this doesn't break anything for binary files)
|
||||||
python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port"
|
python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ docker-bash() {
|
|||||||
docker exec -ti $1 /bin/bash
|
docker exec -ti $1 /bin/bash
|
||||||
}
|
}
|
||||||
|
|
||||||
# Extract a compressed archive without worrying which tool to use
|
# Extract a compressed archive without worrying about which tool to use
|
||||||
extract() {
|
extract() {
|
||||||
if [ -f $1 ]; then
|
if [ -f $1 ]; then
|
||||||
case $1 in
|
case $1 in
|
||||||
@@ -45,7 +45,8 @@ unshort() {
|
|||||||
curl -sIL $1 | sed -n 's/Location: *//p'
|
curl -sIL $1 | sed -n 's/Location: *//p'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create a git.io short URL
|
# Create a custom git.io short URL (if available)
|
||||||
|
# ex: gitio dotfiles https://github.com/jakejarvis/dotfiles => https://git.io/dotfiles
|
||||||
gitio() {
|
gitio() {
|
||||||
if [ -z "${1}" ] || [ -z "${2}" ]; then
|
if [ -z "${1}" ] || [ -z "${2}" ]; then
|
||||||
echo "Usage: \`gitio slug url\`"
|
echo "Usage: \`gitio slug url\`"
|
||||||
@@ -54,7 +55,7 @@ gitio() {
|
|||||||
curl -i https://git.io/ -F "url=${2}" -F "code=${1}"
|
curl -i https://git.io/ -F "url=${2}" -F "code=${1}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# List files in an S3 buckett
|
# List files in an S3 bucket
|
||||||
s3ls() {
|
s3ls() {
|
||||||
aws s3 ls s3://$1
|
aws s3 ls s3://$1
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user