Skip to content

Commit 02f893d

Browse files
author
Bryan MacFarlane
committed
start
1 parent 73803ac commit 02f893d

File tree

14 files changed

+201
-79
lines changed

14 files changed

+201
-79
lines changed

.npmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
//registry.npmjs.org/:_authToken=
1+
//registry.npmjs.org/:_authToken=${SEC_NPM_AUTH_TOKEN}

.zshrc

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1+
# .zshrc is a symlink to .zshrc in this repo wherever it is cloned on disk
12
export DOT_FILES_PATH=$(dirname $(readlink ~/.zshrc))
2-
export DOT_PRIV_PATH="${DOT_FILES_PATH}/../dotprivate"
33

4+
source "${DOT_FILES_PATH}/dot/load.sh"
45

5-
# get rid of the dots
6-
# https://stackoverflow.com/a/27756399/775184
7-
DOT_PRIV_PATH=$(cd ${DOT_PRIV_PATH} && pwd)
6+
# workspaces is either in ~/Projects or in codespaces it's in /codespaces
7+
export DOT_WORKSPACE_PATH="${HOME}/Projects"
8+
if [ -d "/workspaces" ]; then
9+
# codespaces
10+
DOT_WORKSPACE_PATH="/workspaces"
11+
fi
12+
13+
export DOT_PRIV_PATH="${DOT_WORKSPACE_PATH}/dotprivate"
814

915
clear
10-
source "${DOT_FILES_PATH}/common/load.sh"
11-
echo
12-
echo -n -e "\033]0;Dev Environment\007"
13-
echo Dev Environment
14-
echo Welcome ${USER}!
15-
echo
16+
17+
"${DOT_FILES_PATH}/dot/welcome.sh"
1618

1719
# https://scriptingosx.com/2019/07/moving-to-zsh-06-customizing-the-zsh-prompt/
1820
PROMPT='%(?.%F{green}√.%F{red}?%?)%f %B%F{250}%1~%f%b %(!.#.$) '

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

2-
<p align="center">
3-
<img src="res/tilda.png"/>
2+
3+
<p align="center" style="font-size:20vw">
4+
~/.
45
</p>
56

67
## setup

common/env.sh

Lines changed: 0 additions & 2 deletions
This file was deleted.

dot/common.sh

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
#!/bin/bash
2+
3+
[[ "${DOT_COMMON:-""}" == "loaded" ]] && return 0
4+
DOT_COMMON=loaded
5+
6+
function fail()
7+
{
8+
rc=$?
9+
echo
10+
echo "$1 (last rc: ${rc})" >&2
11+
echo
12+
exit 1
13+
}
14+
15+
pushd () {
16+
command pushd "$@" > /dev/null
17+
}
18+
19+
popd () {
20+
command popd "$@" > /dev/null
21+
}
22+
23+
cprint() {
24+
# https://stackoverflow.com/a/64824268/775184
25+
intense='1'
26+
under='4'
27+
28+
# Regular Colors
29+
black='30' # Black
30+
red='31' # Red
31+
green='32' # Green
32+
yellow='33' # Yellow
33+
blue='34' # Blue
34+
purple='35' # Purple
35+
cyan='36' # Cyan
36+
white='37' # White
37+
38+
# Background
39+
onblack='40' # Black
40+
onred='41' # Red
41+
ongreen='42' # Green
42+
onyellow='43' # Yellow
43+
onblue='44' # Blue
44+
onpurple='45' # Purple
45+
oncyan='46' # Cyan
46+
onwhite='47' # White
47+
48+
msg=$1
49+
shift
50+
51+
codes="\033["
52+
for ((i=1; i<=$#; i++))
53+
do
54+
id=${!i}
55+
# echo "${id} is ${!id}"
56+
codes="${codes}${!id}"
57+
58+
if [ $i -ne $# ]; then
59+
codes="${codes};"
60+
fi
61+
done
62+
codes="${codes}m"
63+
64+
# echo "${codes}"
65+
66+
printf "${codes}${msg}\033[0m"
67+
}
68+
69+
dot_section() {
70+
printf "\n "
71+
cprint "${1}" "white" "intense"
72+
if [ "$2" ]; then
73+
printf " : $2"
74+
fi
75+
echo
76+
}
77+
78+
dot_message() {
79+
cprint "${1}" "white" "intense"
80+
if [ "$2" ]; then
81+
printf " $2"
82+
fi
83+
printf "\n"
84+
}
85+
86+
# manSection() {
87+
# printf "\n "
88+
# cprint "$1" "white" "under" "intense"
89+
# }
90+
91+
dot_man() {
92+
cmd="$(printf " %-15s" "${1}")"
93+
cprint "$cmd" "cyan" "intense"
94+
cprint "$2\n"
95+
96+
if [ "$3" ]; then
97+
eg="$(printf " %-18s%s" "" "( e.g. $3 )")"
98+
cprint "$eg\n" "grey"
99+
fi
100+
}

common/load.sh renamed to dot/load.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function dot_load() {
1919

2020
[ ! -d "${DOT_FILES_PATH}" ] && >&2 echo "${DOT_FILES_PATH} missing" && return 1
2121

22-
source "${DOT_FILES_PATH}/common/env.sh"
22+
# source "${DOT_FILES_PATH}/common/env.sh"
2323

2424
# load public scripts
2525
for filename in ${DOT_FILES_PATH}/rc/*.sh; do
@@ -40,4 +40,4 @@ function dot_load_tools() {
4040
for filename in ${DOT_FILES_PATH}/tools/*.sh; do
4141
source "${filename}"
4242
done
43-
}
43+
}

dot/man.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
4+
. $SCRIPT_DIR/common.sh
5+
6+
dot_section "Commands"
7+
echo
8+
dot_man "help" "show this help"
9+
dot_man "reload" "reload shell in same terminal"
10+
dot_man "c" "clear"
11+
dot_man "all" "show all commands"
12+
13+
echo
14+
dot_man "tools" "list tools and versions"
15+
dot_man "me" "who am I for all tools"
16+
17+
echo
18+
dot_man "setsec" "set secret. e.g. setsec foo \"bar baz\""
19+
dot_man "getsec" "get secret. e.g. getsec foo"
20+
dot_man "lssec" "list secrets."
21+
22+
echo
23+
dot_man "tz" "targz full dir. tz <pathToCompress> <outputfile>" "tz ./tools ./tools.tar.gz"
24+
dot_man "utz" "extract targz dir. utz <fileToUncompress> <pathUncompressTo>" "utz ./tools.tar.gz ./tools"
25+

dot/welcome.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
4+
. $SCRIPT_DIR/common.sh
5+
6+
# echo
7+
echo -n -e "\033]0;Dev Environment\007"
8+
echo
9+
dot_message "Dev Environment"
10+
dot_message "Welcome" "${USER}!"
11+
dot_section "Workspaces" "${DOT_WORKSPACE_PATH}"

man

Lines changed: 0 additions & 16 deletions
This file was deleted.

rc/alias.sh

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
11

2-
workspaces="~"
3-
if [ -d "${HOME}/Projects" ]; then
4-
workspaces="~/Projects"
5-
elif [ -d "/workspaces" ]; then
6-
# codespaces
7-
workspaces="/workspaces"
8-
fi
9-
10-
echo "workspace: ${workspaces}"
11-
122
alias help="dot_help"
133
alias all="echo;alias;echo"
14-
alias c="clear"
4+
alias c="tput reset"
155

166
# Reload the shell (i.e. invoke as a login shell)
177
alias reload="exec ${SHELL} -l"
@@ -34,7 +24,7 @@ alias -- -="cd -"
3424
# Shortcuts
3525
alias dl="pushd ~/Downloads > /dev/null"
3626
alias dt="pushd ~/Desktop > /dev/null"
37-
alias w="pushd ${workspaces} > /dev/null"
27+
alias w="pushd ${DOT_WORKSPACE_PATH} > /dev/null"
3828
alias s="pushd ~/Study > /dev/null"
3929
alias pkg="pushd ~/Packages > /dev/null"
4030

rc/functions.sh

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,13 @@
11
function dot_help() {
22
echo
3-
local files_help_path="${DOT_FILES_PATH}/man"
3+
${DOT_FILES_PATH}/dot/man.sh
4+
# local files_help_path="${DOT_FILES_PATH}/man"
45
local priv_help_path="${DOT_PRIV_PATH}/man"
56

6-
[ -f "${files_help_path}" ] && cat "${files_help_path}" && echo
7+
# [ -f "${files_help_path}" ] && cat "${files_help_path}" && echo
78
[ -f "${priv_help_path}" ] && cat "${priv_help_path}" && echo
89
}
910

10-
function printToolInfo() {
11-
printf " %-15s%s\n" "$1" ": $2"
12-
# | tr ' ~' '- '
13-
}
14-
15-
function dot_tool_versions() {
16-
echo
17-
for filename in ${DOT_FILES_PATH}/tools/*.sh; do
18-
file="${filename##*/}"
19-
tool="${file%.sh}"
20-
func="dot_${tool}_version"
21-
eval "$func"
22-
done
23-
echo
24-
}
25-
26-
function dot_tool_whoami() {
27-
echo
28-
echo "Who am I? ..."
29-
for filename in ${DOT_FILES_PATH}/tools/*.sh; do
30-
file="${filename##*/}"
31-
tool="${file%.sh}"
32-
func="dot_${tool}_whoami"
33-
eval "$func"
34-
done
35-
echo
36-
}
37-
3811
export DOT_CFG_PATH="${HOME}/.dotfiles"
3912
export DOT_KEY_PATH="${DOT_CFG_PATH}/secrets.key"
4013

rc/tools.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
function printToolInfo() {
3+
printf " %-15s%s\n" "$1" ": $2"
4+
# | tr ' ~' '- '
5+
}
6+
7+
function dot_tool_versions() {
8+
echo
9+
for filename in ${DOT_FILES_PATH}/tools/*.sh; do
10+
file="${filename##*/}"
11+
tool="${file%.sh}"
12+
func="dot_${tool}_version"
13+
eval "$func"
14+
done
15+
echo
16+
}
17+
18+
function dot_tool_whoami() {
19+
echo
20+
echo "Who am I? ..."
21+
for filename in ${DOT_FILES_PATH}/tools/*.sh; do
22+
file="${filename##*/}"
23+
tool="${file%.sh}"
24+
func="dot_${tool}_whoami"
25+
eval "$func"
26+
done
27+
echo
28+
}

tools/brew.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
# install brew if not installed
4+
# we can install most other things using brew afterwards
5+
6+
if [ ! -x "$(command -v brew)" ]; then
7+
echo "Installing brew ..."
8+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
9+
echo
10+
fi

tools/node.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

2-
export NVM_DIR="$HOME/.nvm"
3-
if [ -d ${NVM_DIR} ]; then
4-
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
5-
nvm use 14
2+
NODE_VERSION=16
3+
NODE_BREW_PATH=/usr/local/opt/node@16/bin
4+
if [ -d "${NODE_BREW_PATH}" ]; then
5+
PATH="$NODE_BREW_PATH:$PATH"
66
fi
77

88
nodePath=`which node`

0 commit comments

Comments
 (0)