-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.functions
43 lines (38 loc) · 1.19 KB
/
.functions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Git upstream branch syncer.
# Usage: gsync master (checks out master, pull upstream, push origin).
function gsync() {
if [[ ! "$1" ]] ; then
echo "You must supply a branch."
return 0
fi
BRANCHES=$(git branch --list $1)
if [ ! "$BRANCHES" ] ; then
echo "Branch $1 does not exist."
return 0
fi
git checkout "$1" && \
git pull upstream "$1" && \
git push origin "$1"
}
# Delete a given line number in the known_hosts file.
# Usage: knownrm LINENUMBER
knownrm() {
re='^[0-9]+$'
if ! [[ $1 =~ $re ]] ; then
echo "error: line number missing" >&2;
else
sed -i '' "$1d" ~/.ssh/known_hosts
fi
}
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo "Succeeded - running with settings from ${SSH_ENV}"
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add;
}
awsvl () {
aws-vault --debug login $1 --stdout | xargs -t nohup /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome %U --no-first-run --new-window --disk-cache-dir=$(mktemp -d /tmp/chrome.XXXXXX) --user-data-dir=$(mktemp -d /tmp/chrome.XXXXXX) > /dev/null 2>&1 &
}