-
-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy path.bash_aliases_private
163 lines (139 loc) · 9.83 KB
/
.bash_aliases_private
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# This file is part of eRCaGuy_dotfiles: https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles
# >> THIS IS THE PRIMARY BASH CONFIGURATION FILE FOR YOU TO EDIT AND CUSTOMIZE! <<
# INSTALLATION & USAGE INSTRUCTIONS:
# - If you are pulling in my bash configuration files for your usage, I recommend you leave my
# ".bashrc" and ".bash_aliases" files as-is, and edit and customize this
# ".bash_aliases_private" file instead!
# - See the "eRCaGuy_dotfiles/home/README.md" file, with full instructions and details, here:
# https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles/tree/master/home
#
# 1. Install by copying this file to your home dir, and editing your own personal copy there:
# cp -i .bash_aliases_private ~
# Note: to remind yourself what the definition is for any given alias, just run
# `alias some_alias_name` at the terminal. To see all aliases, run just `alias`. To see
# ALL my custom aliases AND functions AND executable scripts, type `gs_` then press Tab Tab
# (Tab two times).
# ==================================================================================================
# PERSONAL (PRIVATE) Bash Setup, Variables, Aliases, & Functions
# - Add your personal, custom, or otherwise unshared bash aliases and functions here below.
# - It is recommended to use this file for your personal or private aliases and functions rather
# than defining them in the "~/.bashrc" or "~/.bash_aliases" file.
# - If you have something you think is very useful to others, add it to the "~/.bash_aliases" file
# and then open up a Pull Request on GitHub to ask me to merge it into the main eRCaGuy_dotfiles
# repo.
# - All bash aliases or functions below will override any from the "~/.bash_aliases" file, prior
# to the point this "~/.bash_aliases_private" file is sourced (imported), if they have the
# same name.
# ==================================================================================================
# In my naming of aliases and functions, I like to precede names with my initials followed by an
# underscore, like this: `gs_some_cmd_name`. This way, simply by typing `gs_` at the terminal and
# then pressing Tab twice, I can quickly see a list of ALL of my available custom functions. To
# add your own initials, one technique is to simply add an alias to my aliases, like this. Let's
# assume your initials are "am":
# alias am_open_default_tabs="gs_open_default_tabs"
# alias am_alert="gs_alert"
# # etc.
# Default terminal title:
# Uncomment one of the below options, or write your own, to set a default terminal title each time
# you open up a terminal. You can also change the current terminal title manually at any time. See
# `gs_set_title -h` for help.
#
# 1. Example static titles
# DEFAULT_TERMINAL_TITLE="my new title"
# 2. Example dynamic titles (must use single quotes around the whole title, as shown below)
# DEFAULT_TERMINAL_TITLE='Current Directory is "$PWD"'
# DEFAULT_TERMINAL_TITLE='Date and time of last cmd is "$(date)"'
# ------------- CONFIGURATION FOR `gs_open_default_tabs` Bash function (START) ---------------------
# You may configure any number of terminal tabs to be rapidly opened whenever you run
# `gs_open_default_tabs`. Each tab can be given a static or dynamic title, as well as a command to
# run when the tab is opened.
# See my answer here for additional reference:
# https://askubuntu.com/questions/315408/open-terminal-with-multiple-tabs-and-execute-application/1026563#1026563
# Uncomment the line for your desired terminal.
# - NB: this variable is sourced by and used by my custom `~/.bash_aliases` file.
TERMINAL="terminator" # my preference since you can right-click and go to
# "Split Horizontally" or "Split Vertically"
# TERMINAL="gnome-terminal" # the default that comes with Ubuntu 18.04, 20.04, etc.
# Specify terminal tabs to open with the specified title and command.
# - You may configure just a title, just a command, or both. Use an empty string for one or the
# other to leave it unconfigured.
# 1. Tab titles
# 1. You may use static titles, OR dynamic titles which automatically change. See some examples of
# dynamic titles at the end of the examples below.
# 2. Tab commands
# 1. You must use quotes, as shown in the examples below, around any paths with spaces in
# the path.
# 2. Escape apostrophes in `echo -e` with `\x27`, as shown in the examples below. See also my
# detailed answer here for more examples: https://stackoverflow.com/a/65878993/4561887
# - For 2D arrays in Bash, see my answer here: https://stackoverflow.com/a/77677059/4561887
TERMINAL_TABS_NUM_COLS="2"
TERMINAL_TABS=(
# ----------- ------------
# Tab title Tab command
# ----------- ------------
# MY DEFAULT TABS I LIKE
'Python' "cd \"$HOME/GS/dev\""
'eRCaGuy_dotfiles' "cd \"$HOME/GS/dev/eRCaGuy_dotfiles\""
'eRCaGuy_hello_world' "cd \"$HOME/GS/dev/eRCaGuy_hello_world\""
'.github.io' "cd \"$HOME/GS/dev/ElectricRCAircraftGuy.github.io\""
'eRCaGuy_Engineering' "cd \"$HOME/GS/dev/eRCaGuy_Engineering\""
'trade_me' "cd \"$HOME/GS/dev/trade_me\""
'ssh1' "cd \"$HOME/GS/dev\""
'ssh2' "cd \"$HOME/GS/dev\""
'ssh3' "cd \"$HOME/GS/dev\""
'picocom' "cd \"$HOME/GS/dev\"; echo -e \"\nConnected USB devices (\x27dmesg | grep -i ttyusb\x27):\"; dmesg | grep -i ttyusb; echo -e \"\n===== Use picocom to connect to any boards over serial here. =====\n\nSee: https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles/blob/master/useful_apps/serial_terminals_README.md#picocom\n\""
'VPN' "cd \"$HOME/GS/dev\"; echo -e \"\n===== run \x27gs_vpn_openconnect-sso\x27 to connect to the VPN, or just \x27openconnect-sso\x27 for subsequent connections. See my answer here: https://superuser.com/a/1753172/425838 =====\n\nFor a WatchGuard VPN instead, see my answer here: https://serverfault.com/a/1132673/357116\n\""
# MORE EXAMPLES
# 'git' "cd \"$HOME/GS/dev\""
# 'bazel' "cd \"$HOME/GS/dev\""
# 'Python' "cd \"$HOME/GS/dev\""
# 'foo repo' "cd \"$HOME/GS/dev/foo\"; echo -e \"\n===== Let\x27s get ready to code! =====\n\""
# 'foo repo' "cd \"$HOME/GS/dev/foo\"; echo -e \"\n===== Let\x27s get ready to code! =====\n\""
# 'bar repo' "cd \"$HOME/GS/dev/bar\"; echo -e \"\n===== Let\x27s get ready to code! =====\n\""
# 'bar repo' "cd \"$HOME/GS/dev/bar\"; echo -e \"\n===== Let\x27s get ready to code! =====\n\""
# 'picocom' "cd \"$HOME/GS/dev\"; echo -e \"\nConnected USB devices:\"; dmesg | grep -i ttyusb; echo -e \"\n===== Probably use picocom for a serial connection here =====\n\""
# 'ssh1' "cd \"$HOME/GS/dev\"; ll"
# 'ssh2' "cd \"$HOME/GS/dev\"; ll"
# 'ssh3' "cd \"$HOME/GS/dev\"; ll"
# 'ssh4' "cd \"$HOME/GS/dev\"; ll"
# 'VPN' "cd \"$HOME/GS/dev\"; echo -e \"\n===== run \x27gs_vpn_openconnect-sso\x27 to connect to the VPN, or just \x27openconnect-sso\x27 for subsequent connections. See my answer: https://superuser.com/a/1753172/425838 =====\n\""
# 'other' "cd \"$HOME/GS/dev\"; ls; echo -e \"\n===== Let\x27s get ready to code! =====\n\""
# OTHERS, INCL. DYNAMIC TITLES VIA "$(date)", "$(pwd)", ETC. (UNCOMMENT TO USE)
# 'other2' "cd \"$HOME/temp\""
# 'dynamic title: last cmd time: "$(date)"' "cd \"$HOME/some directory with spaces\"; ls"
# 'dynamic title (change your dir) "$(pwd)"' "cd \"$HOME/GS/dev\"; ls; echo -e \"\n===== Let\x27s get ready to code! =====\n\""
)
# ------------- CONFIGURATION FOR `gs_open_default_tabs` Bash function (END) -----------------------
# UPDATE THESE SSH ALIASES FOR YOURSELF! See .bash_aliases for detailed notes.
# alias gs_ssh="ssh -X -o \"ServerAliveInterval 60\" username@domain_name"
# alias gs_ssh_dropbear=""
# alias gs_sshfs=""
# alias gs_sshfs_umount=""
# See git & Linux cmds doc:
# alias bazel_build_lldb='time bazel build --copt=-glldb --copt=-O0 --strip=never \
# //my/target1/... //my/target2/...; gs_alert'
# alias bazel_test_lldb='time bazel test --copt=-glldb --copt=-O0 --strip=never \
# //my/target1/... //my/target2/...; gs_alert'
# Get the size of your built executable or shared object (*.so file) and print it out.
# Related: see also my detailed Q & A here:
# https://electronics.stackexchange.com/questions/363931/how-do-i-find-out-at-compile-time-how-much-of-an-stm32s-flash-memory-and-dynami
# - Note that the `echo "$ ..."` parts of the command are just to remind you where these files are
# located is all--as though you had just manually typed the `size` command at the command-line
# instead of calling this alias. There is no magic there, and `$` means nothing special in this
# case other than to make it look like a command you typed at the terminal.
# alias gs_program_size='\
# echo "$ size build/bin/path/to/my/executable1" && \
# size build/bin/path/to/my/executable1; \
# echo "$ size build/bin/path/to/my/executable2" && \
# size build/bin/path/to/my/executable2'
# TODO: finish this thought; I haven't finished testing or developing this little blob or idea.
# This requires this script: "eRCaGuy_dotfiles/useful_scripts/sublf.sh"
# See also my answer on `find`: https://stackoverflow.com/a/69830768/4561887
# alias sublf_custom='sublf -not \( -path "./build*" -prune \)'
# To connect to a VPN via `openconnect-sso`. See my answer here:
# https://superuser.com/a/1753172/425838
# - For usage inside ~/.bash_aliases
VPN_SERVER_ADDRESS="myvpn.whatever.com" # example server address to connect to
VPN_SAML_GROUP="whatever-saml-whatever" # example SAML group name
VPN_USER="[email protected]" # example username
alias gs_cd_to_dev_w="cd \"$HOME/GS-w/dev-w\""