From 0480e7d0f7bfed64c8bee5091c973596fe173995 Mon Sep 17 00:00:00 2001 From: Merlin Rabens Date: Mon, 29 Jul 2019 11:57:31 +0200 Subject: [PATCH 1/6] Retrieve local ip independently Signed-off-by: Merlin Rabens --- .aliases | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.aliases b/.aliases index 35446a14288..f9c3a50115c 100644 --- a/.aliases +++ b/.aliases @@ -57,7 +57,7 @@ alias canary='/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Ch # IP addresses alias ip="dig +short myip.opendns.com @resolver1.opendns.com" -alias localip="ipconfig getifaddr en0" +alias localip="echo $(ifconfig -a | grep -E 'UP|inet[^6]' | grep -A1 UP | grep inet | grep -v 127 | tail -1 | awk '{print $2}')" alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'" # Show active network interfaces From 1a622f26c3cfb01b493a6d3da85b01be2f6c3441 Mon Sep 17 00:00:00 2001 From: Merlin Rabens Date: Wed, 24 Jul 2019 11:26:39 +0200 Subject: [PATCH 2/6] Change some .macos defaults Signed-off-by: Merlin Rabens Closes #1. --- .macos | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.macos b/.macos index 2ce16068182..c0a0404e34b 100755 --- a/.macos +++ b/.macos @@ -156,7 +156,7 @@ defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClic defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true # Disable “natural” (Lion-style) scrolling -defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false +# defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false # Increase sound quality for Bluetooth headphones/headsets defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40 @@ -181,8 +181,8 @@ defaults write NSGlobalDomain InitialKeyRepeat -int 10 # Set language and text formats # Note: if you’re in the US, replace `EUR` with `USD`, `Centimeters` with # `Inches`, `en_GB` with `en_US`, and `true` with `false`. -defaults write NSGlobalDomain AppleLanguages -array "en" "nl" -defaults write NSGlobalDomain AppleLocale -string "en_GB@currency=EUR" +defaults write NSGlobalDomain AppleLanguages -array "en" +defaults write NSGlobalDomain AppleLocale -string "en_US@currency=EUR" defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters" defaults write NSGlobalDomain AppleMetricUnits -bool true From e723d9bd8ad75b66a6411e63a65423ccdd4c6ae7 Mon Sep 17 00:00:00 2001 From: Merlin Rabens Date: Mon, 29 Jul 2019 17:05:01 +0200 Subject: [PATCH 3/6] Add dg git alias --- .gitconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitconfig b/.gitconfig index b44243359b9..81aa176a260 100644 --- a/.gitconfig +++ b/.gitconfig @@ -59,6 +59,9 @@ # Remove branches that have already been merged with master # a.k.a. ‘delete merged’ dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d" + + # Remove stale branches that are gone on remote + dg = "!git branch -vv | grep ': gone]'| grep -v '\\*' | awk '{ print $1; }' | xargs -I F git branch -D \"F\"" # List contributors with number of commits contributors = shortlog --summary --numbered From 83ff0385644ed52e64c931d9765d0d871c337d26 Mon Sep 17 00:00:00 2001 From: Merlin Rabens Date: Wed, 31 Jul 2019 16:45:44 +0200 Subject: [PATCH 4/6] Try to checkout first an existing branch Signed-off-by: Merlin Rabens --- .gitconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitconfig b/.gitconfig index 81aa176a260..05f94762c18 100644 --- a/.gitconfig +++ b/.gitconfig @@ -22,7 +22,7 @@ ca = !git add -A && git commit -av # Switch to a branch, creating it if necessary - go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f" + go = "!f() { git checkout \"$1\" 2> /dev/null || git checkout -b \"$1\"; }; f" # Show verbose output about tags, branches or remotes tags = tag -l From 552c9be637551c422df57439e5989bacfcc5eaec Mon Sep 17 00:00:00 2001 From: Merlin Rabens Date: Wed, 31 Jul 2019 17:26:59 +0200 Subject: [PATCH 5/6] Create git alias for comparing branches Signed-off-by: Merlin Rabens --- .gitconfig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitconfig b/.gitconfig index 05f94762c18..283aed074a5 100644 --- a/.gitconfig +++ b/.gitconfig @@ -82,6 +82,10 @@ fi \ }; f" + # Compare two branches and show which commits are not in the first + # but in the second branch + compare = "!f() { git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative $1..$2; }; f" + [apply] # Detect whitespace errors when applying a patch From e99d49a0bf46ad2dd30b1c58db9bce209bed5183 Mon Sep 17 00:00:00 2001 From: Merlin Rabens Date: Fri, 23 Aug 2019 10:17:33 +0200 Subject: [PATCH 6/6] Retrieve local ip for currently active interface Signed-off-by: Merlin Rabens --- .aliases | 1 - .functions | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.aliases b/.aliases index f9c3a50115c..8321d47ba4a 100644 --- a/.aliases +++ b/.aliases @@ -57,7 +57,6 @@ alias canary='/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Ch # IP addresses alias ip="dig +short myip.opendns.com @resolver1.opendns.com" -alias localip="echo $(ifconfig -a | grep -E 'UP|inet[^6]' | grep -A1 UP | grep inet | grep -v 127 | tail -1 | awk '{print $2}')" alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'" # Show active network interfaces diff --git a/.functions b/.functions index bce0305db69..91b2397ac20 100644 --- a/.functions +++ b/.functions @@ -169,3 +169,9 @@ function o() { function tre() { tree -aC -I '.git|node_modules|bower_components' --dirsfirst "$@" | less -FRNX; } + +# echo the IP address for the currently active network interface +function localip() { + local activeIf=$(netstat -rn | grep default | awk '{print $NF}' | head -1) + ipconfig getifaddr ${activeIf} +}