Source file for this content is in the gh-pages
branch, root folder, filename index.md
.
Green and black…
This repo uses GitHub’s gh-pages service: Built as a distinct gh-pages
branch off the default Main.
gh-pages uses a jekyll template, whatever that is. There are, as a result, three places to be:
Here is how to get one of these https://organization.github.io/repo websites started:
gh-pages
branch: From the Main
branch, use the chooserindex.md
that renders (not a README)
index.md
renders as default content
https://organization.github.io/repo-name/subfolder
renders the index.md
thereinI want to understand–say–my Linux bash installation on my Windows laptop… and I want simple green text on a black background. Not a lot of ‘informative’ colorized text. I did it once… long ago… but there were all these squonking little details. Every two years or so, give or take, I have to drag through the same piddly little web searches and glaring my way through Stack Overflow answers…rrrrrr… You know what this is? This is the curse of having a semi-IT job while being a not-very-IT personality. So I put in some extra effort on these notes and every couple years they will save me… hours? days? minutes? of teeth gnashing.
The scenario:
bash
shellbash
shell and the vi
editor…This bias was inspired by this guy Curtis, who is cool nevermind late to rehearsal.
git
git pull
to get the latest; then git add .
then git commit -m 'ch ch ch changes'
then git push
~
store creds using git config --global credential.helper store
git reset --hard HEAD
or if necessary git reset --hard HEAD~1
etcetera
bash
fixLet’s begin on the Ubuntu bash shell running on a Windows PC. This can be customized; independent of customizing a VM bash.
ls -al
to observe that color support is still enabled. Yeccch..bashrc
# enable color support of ls and also add handy aliases
#if [ -x /usr/bin/dircolors ]; then
# test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
# alias ls='ls --color=auto'
# #alias dir='dir --color=auto'
# #alias vdir='vdir --color=auto'
#
# alias grep='grep --color=auto'
# alias fgrep='fgrep --color=auto'
# alias egrep='egrep --color=auto'
#fi
source ~/.bashrc
ls -al
againFor green text type this on the command line: echo -e "Default \e[32mDefault"
The prompt’s job is to tell me which computer I am entering commands on (and possibly whether I am working inside a conda environment).
~/.bashrc' in
vi, scroll past the
$PS1` stuff
$PS1
is a variable for the default bash promptPS1="my computer> "
source ~/.bashrc
Now the prompt tells me when I am working on my local machine. For VMs: Use simple but instructive prompts in like fashion.
A conda environment name will be prepended to this bash prompt. By default this
prompt will be (base) my computer>
. This is ok by me: When I switch
environments by means of conda activate some-environment
the prompt will
automatically change the prompt to (some-environment) my computer>
.
To change the colors of the text produced by ls
check an online resource like this.
The bare-bones to make directory names green is like so:
dircolors -b >> .bashrc
appends the current ls color scheme to .bashrc
.bashrc
and go to the end of the fileLS_COLORS=`rs=0:di=01;34....etcetera etcetera etceters....;export LS_COLORS`
di
(directory) and set it to di=01;32
.source ~/.bashrc
ls -al
vi
fixvi
and vim
are the same editor, specificially an ancient text editor
with arcane syntax inherited from an even older editor called ed
. vim
is the modern version of vi
.
To disable a profusion of colorized text in vi
: In escape mode type :syntax off
.
To disable a profusion of colorized text permanently:
vi ~/.vimrc
<escape>
G
o
syntax off
<escape>
:wq
vi
to verify this workedconda create/activate
commands engage Python environments as customized versions of
our base environment.
I want to run Jupyter on a secure VM inside the AWS cloud on a private subnet. Let’s call this VM worker
.
I have an intermediary bastion server called bastion
. I’m going to connect from my local machine to
bastion to worker so that in my browser I see a Jupyter notebook server that is in fact running on worker.
That means a two-hop ssh tunnel.
If bastion
has a moving target public ip address: Assign it a fixed ip address. For example on AWS
this is called an elastic ip. Now that ip address can be baked into a connect alias.
local
bash
: $ ssh -i bastion.pem ubuntu@12.23.34.45
local
: Move the worker.pem
file to bastion
$ sftp -i bastion.pem ubuntu@12.23.34.45
sftp> put worker.pem
ssh
from local
to bastion
to worker
ssh ubuntu@12.23.34.45 -i bastion.pem
ssh -i worker.pem ubuntu@10.0.1.234
worker
(jupyter notebook --no-browser --port=8889) &
4109891ab3e0ec38c2aec9c427c8be11eda975ab2882a52a
exit
worker
and verify the server is still running
ps -ef | grep jupyter
exit
bastion
create an ssh tunnel
ssh -N -f -i worker.pem -L localhost:7005:localhost:8889 ubuntu@10.0.1.234
bastion
traffic on port 7005 to outbound > worker
port 8889exit
local
create the second part of the tunnel to bastion
ssh -N -f -i bastion.pem -L localhost:7004:localhost:7005 ubuntu@12.23.34.45
local
browser address bar
localhost:7004
du -h -d1
Wes says: “Use top
from the bash command line.”
Wes says: “CloudWatch metrics (AWS EC2 console GUI) are delayed, updated once every 5 minutes. A localized spike in CPU use will take some time to display in the console. It is possible to pay for a higher sampling rate in the console… but why?”
sudo apt-get update -y && sudo apt-get upgrade -y