Last active
December 21, 2017 17:27
-
-
Save didenko/2493230 to your computer and use it in GitHub Desktop.
BASH profile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias l="ls -AFGhlO " | |
alias ll="ls -alFgeh " | |
alias lll="ls -alFgeh@@ " | |
alias hig="history | grep " | |
alias less="less -i -~ " | |
alias ci="vi " | |
alias bb="bbedit" | |
alias gdc="godoc -http=:6060; open \"http:\\\\localhost:6060\\\"" | |
function lg(){ | |
prev="" | |
while true | |
do | |
curr="$($* 2>&1)" | |
if [ "${prev}" != "${curr}" ] | |
then | |
echo $(date +"%H:%M:%S"): | |
echo "${curr}" | |
prev="${curr}" | |
fi | |
sleep 5 | |
done | |
} | |
function psf(){ | |
ps wwuxp `cat $1` | |
} | |
function gop(){ | |
[ $# -lt 1 ] && { | |
echo "Need a project name" 1>&2 | |
return 1 | |
} | |
if | |
[ -d "${HOME}/Code/${1}/src/go.didenko.com/${1}" ] | |
then | |
cd "${HOME}/Code/${1}/src/go.didenko.com/${1}" | |
export GOPATH="${HOME}/Code/${1}" | |
elif | |
[ -d "${HOME}/Code/go/src/go.didenko.com/${1}" ] | |
then | |
cd "${HOME}/Code/go/src/go.didenko.com/${1}" | |
export GOPATH="${HOME}/Code/go" | |
elif | |
[ -d "${HOME}/Code/go/src/github.com/didenko/${1}" ] | |
then | |
cd "${HOME}/Code/go/src/github.com/didenko/${1}" | |
export GOPATH="${HOME}/Code/go" | |
else | |
echo "Did not find the ${1} Go project" 1>&2 | |
return 1 | |
fi | |
} | |
function ngo() { | |
[ $# -lt 1 ] && { | |
echo "Need a project name" 1>&2 | |
return 1 | |
} | |
mkdir "${HOME}/Code/${1}" || { | |
echo "Failed to create the project directory: ${HOME}/Code/${1}" 1>&2 | |
return 1 | |
} | |
cd "${HOME}/Code/${1}" | |
mkdir -p bin pkg "src/go.didenko.com/${1}" | |
gop "${1}" | |
cobra init -a "Vlad Didenko" -l "apache20" "go.didenko.com/${1}" | |
cat >.gitignore <<-EOGI | |
# Binaries for programs and plugins | |
*.exe | |
*.dll | |
*.so | |
*.dylib | |
# Test binary, build with \`go test -c\` | |
*.test | |
# Output of the go coverage tool, specifically when used with LiteIDE | |
*.out | |
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736 | |
.glide/ | |
# Visual Studio Code settings | |
.vscode | |
*.code-workspace | |
EOGI | |
cat >>"${1}.code-workspace" <<-EOWS | |
{ | |
"folders": [ | |
{ | |
"name": "$(echo "${1}" | tr "[:upper:]" "[:lower:]")", | |
"path": "${HOME}/Code/${1}/src/go.didenko.com/${1}" | |
} | |
], | |
"settings": { | |
"go.inferGopath": true, | |
"go.gopath": null, | |
"go.toolsGopath": "", | |
"terminal.integrated.env.osx": { | |
"GOPATH": "${GOPATH}" | |
} | |
} | |
} | |
EOWS | |
git init | |
} | |
shopt -s histverify | |
export GOPATH=${GOPATH:=${HOME}/Code/go} | |
export PATH=${PATH}:${HOME}/bin | |
export PATH=${PATH}:${GOPATH}/bin | |
umask 027 | |
export PS1="\h:\W ⧴ " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment