-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.profile
More file actions
113 lines (89 loc) · 2.84 KB
/
Copy path.profile
File metadata and controls
113 lines (89 loc) · 2.84 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Aliases
alias cd..="cd .."
alias h="history"
alias ls='ls -FG'
alias ll='ls -lA'
alias lnn='bulkSymLink'
alias json="python -mjson.tool | pygmentize -ljson"
alias json="jq -C . | less"
alias xml="xmllint --format - | pygmentize -lxml"
# Functions
# Figure out how to rename/move a file in one folder without having to type path in second argument
function mkcd() {
mkdir -p "$@" && cd "$@"
}
function bulkSymLink() {
if [ -s "$2" ]; then
OUT="$2"
else
OUT="."
fi
find "$1" -type f -depth 1 -exec ln -s {} $OUT \;
}
# General Environment Variables
# History
export HISTCONTROL=ignorespace
# Git
alias gcc!='git commit -C HEAD --amend'
alias gsub='git submodule update --init --recursive'
# Github
alias ghnew='github_new_repo'
function github_new_repo() {
GITHUB_HOST='github.com'
GITHUB_API_PATH="api.$GITHUB_HOST"
CREATE_USER_REPO_LINK="https://$GITHUB_API_PATH/user/repos"
CREATE_ORG_REPO_LINK="https://$GITHUB_API_PATH/orgs/ORG_NAME/repos"
CURRENT_USERNAME=`git config --global github.user`
OAUTH_TOKEN=`git config --global github.token`
CURRENT_DIRNAME=${PWD##*/}
if [ -z "$2" ]; then
CREATE_REPO_LINK=$CREATE_USER_REPO_LINK
REPO_USERNAME=$CURRENT_USERNAME
REPO_NAME=${1:-$CURRENT_DIRNAME}
else
ORG_NAME=$1
CREATE_REPO_LINK=${CREATE_ORG_REPO_LINK/ORG_NAME/$ORG_NAME}
REPO_USERNAME=$ORG_NAME
REPO_NAME=${2:-$CURRENT_DIRNAME}
fi
curl -H "Authorization: token $OAUTH_TOKEN" "$CREATE_REPO_LINK" -d "{\"name\": \"$REPO_NAME\"}"
git init && git remote add origin git@$GITHUB_HOST:$REPO_USERNAME/$REPO_NAME.git
}
# GitHub Enterprise
alias ghenew='ghe_new_repo'
function ghe_new_repo() {
GITHUB_HOST='NO_GHE_HOST_SPECIFIED'
GITHUB_API_HOST="https://$GITHUB_HOST/api/v3"
CREATE_USER_REPO_LINK="$GITHUB_API_HOST/user/repos"
CREATE_ORG_REPO_LINK="$GITHUB_API_HOST/orgs/ORG_NAME/repos"
CURRENT_USERNAME=`git config --global ghe.user`
OAUTH_TOKEN=`git config --global ghe.token`
CURRENT_DIRNAME=${PWD##*/}
if [ -z "$2" ]; then
CREATE_REPO_LINK=$CREATE_USER_REPO_LINK
REPO_USERNAME=$CURRENT_USERNAME
REPO_NAME=${1:-$CURRENT_DIRNAME}
else
ORG_NAME=$1
CREATE_REPO_LINK=${CREATE_ORG_REPO_LINK/ORG_NAME/$ORG_NAME}
REPO_USERNAME=$ORG_NAME
REPO_NAME=${2:-$CURRENT_DIRNAME}
fi
curl -H "Authorization: token $OAUTH_TOKEN" "$CREATE_REPO_LINK" -d "{\"name\": \"$REPO_NAME\"}"
git init && git remote add origin git@$GITHUB_HOST:$REPO_USERNAME/$REPO_NAME.git
}
# Autojump
[ -f $(brew --prefix)/etc/profile.d/autojump.sh ] && . $(brew --prefix)/etc/profile.d/autojump.sh
# User binaries
PATH=$HOME/bin:$PATH
# Programming Languages and Platforms
# Node.js
PATH=/usr/local/share/npm/bin:$PATH
# Java
# export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
# Ruby
export GEM_HOME=$HOME/.gem
PATH=$GEM_HOME/bin:$PATH
PATH=/usr/local/opt/ruby/bin:$PATH
export PATH
launchctl setenv PATH $PATH