1
mirror of https://github.com/jakejarvis/dotfiles.git synced 2025-11-04 22:10:09 -05:00

tidy up aliases and functions

This commit is contained in:
2019-09-07 22:07:10 -04:00
parent 2c71836ba6
commit e3d6f992ae
2 changed files with 19 additions and 25 deletions

View File

@@ -11,10 +11,6 @@ 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 ipv4="curl -4 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 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 speed="wget -O /dev/null http://cachefly.cachefly.net/100mb.test"
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 unhide="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
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 displays="system_profiler SPDisplaysDataType"
@@ -45,27 +43,22 @@ alias ripfinder="killall Finder"
alias ripdock="killall Dock"
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 pubkey="more ~/.ssh/id_rsa.pub | pbcopy | echo '=> Public key copied to pasteboard.'"
alias finder="open ./"
alias vs="code ./"
alias gundo="git reset --soft HEAD~1"
alias gc="git add . && git commit -m "
alias gs="git status -sb"
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 sshalt="ssh -p 2222"
alias moshalt="mosh --ssh=\"ssh -p 2222\""
alias finder="open ./"
alias unq="sudo xattr -rd com.apple.quarantine"
alias ios="open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app"
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"

View File

@@ -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() {
mkdir -p -- "$1" &&
cd -P -- "$1"
@@ -6,10 +6,10 @@ mkcd() {
# Start an HTTP server from a directory, optionally specifying the port
serve() {
local port="${1:-8000}"
local port="${1:-8090}"
sleep 1 && open "http://localhost:${port}/" &
# Set the default Content-Type to `text/plain` instead of `application/octet-stream`
# And serve everything as UTF-8 (although not technically correct, this doesnt 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"
}
@@ -18,9 +18,9 @@ docker-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() {
if [ -f $1 ] ; then
if [ -f $1 ]; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
@@ -45,7 +45,8 @@ unshort() {
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() {
if [ -z "${1}" ] || [ -z "${2}" ]; then
echo "Usage: \`gitio slug url\`"
@@ -54,7 +55,7 @@ gitio() {
curl -i https://git.io/ -F "url=${2}" -F "code=${1}"
}
# List files in an S3 buckett
# List files in an S3 bucket
s3ls() {
aws s3 ls s3://$1
}
@@ -69,4 +70,4 @@ push_ssh_cert() {
echo $_host
ssh $_host 'cat >> ~/.ssh/authorized_keys' < ~/.ssh/id_rsa.pub
done
}
}