commit 6b018ca756e41b4e8d1d230d14ce433e6eaee41c (tree)
parent edde5cbc11196e6c2e8b91715cd5fa8e465483f2
Author: Motiejus Jakštys <motiejus@uber.com>
Date: Fri, 14 Jun 2019 09:30:30 +0300
screen lock + maxdepth
Diffstat:
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/bash/.gg.sh b/bash/.gg.sh
@@ -1,6 +1,9 @@
#
# Change to the directory of the specified Go package name.
#
+
+maxdepth=3
+
gg() {
paths=($(g "$@"))
path_index=0
@@ -25,7 +28,7 @@ gg() {
# Print the directories of the specified Go package name.
#
g() {
- local pkg_candidates="$((cd $GOPATH/src && find . -mindepth 1 -maxdepth 4 -type d \( -path "*/$1" -or -path "*/$1.git" \) -and -not -path '*/vendor/*' -print) | sed 's/^\.\///g')"
+ local pkg_candidates="$((cd $GOPATH/src && find . -mindepth 1 -maxdepth ${maxdepth} -type d \( -path "*/$1" -or -path "*/$1.git" \) -and -not -path '*/vendor/*' -print) | sed 's/^\.\///g')"
echo "$pkg_candidates"
}
#
@@ -38,7 +41,7 @@ _g_complete()
local prev
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
- COMPREPLY=( $(compgen -W "$(for f in $(find "$GOPATH/src" -mindepth 1 -maxdepth 4 -type d -name "${cur}*" ! -name '.*' ! -path '*/.git/*' ! -path '*/test/*' ! -path '*/Godeps/*' ! -path '*/examples/*' ! -path '*/vendor/*'); do echo "${f##*/}"; done)" -- "$cur") )
+ COMPREPLY=( $(compgen -W "$(for f in $(find "$GOPATH/src" -mindepth 1 -maxdepth ${maxdepth} -type d -name "${cur}*" ! -name '.*' ! -path '*/.git/*' ! -path '*/test/*' ! -path '*/Godeps/*' ! -path '*/examples/*' ! -path '*/vendor/*'); do echo "${f##*/}"; done)" -- "$cur") )
return 0
}
complete -F _g_complete g
diff --git a/bash/.profile_motiejus b/bash/.profile_motiejus
@@ -34,5 +34,16 @@ ckdir() {
. $HOME/.gg.sh
alias l='echo -n ł | pbcopy'
-alias cerberus='cerberus --no-status-page'
+alias cerberus='cerberus --zone phx2 --no-status-page'
alias grep='/usr/local/bin/ggrep'
+
+alias hosts='cat $HOME/x/hosts'
+
+# lock your screen
+_motiejus() {
+ local sleeptime=$((cat .motiejus 2>/dev/null || echo -n 0; echo +0.1) | bc)
+ echo -n $sleeptime > .motiejus
+ echo $sleeptime
+}
+
+#sleep $(_motiejus)