Ubuntu Desktop 18 + Vi – Add Color Schemes (Molokai)

This is just a simple reminder for myself.  To get VIM working with custom color schemes on Ubuntu Desktop, you need to install a couple extra packages.

Here are the steps to install the molokai theme from GitHub properly:

sudo apt-get update
sudo apt-get install vim-gui-common -y
sudo apt-get install vim-runtime -y
mkdir -p ~/.vim/colors
cd ~/.vim/colors
wget https://raw.githubusercontent.com/tomasr/molokai/master/colors/molokai.vim

And to enable it as default, you have to edit your “~/.vimrc” file to say the following color scheme line. I also left in a couple lines that help arrow keys and backspace to work normally for the heck of it.

set nocompatible
set backspace=2
colorscheme molokai

Fn / Function Key Lock on Dell Laptops (Running Ubuntu which is Irrelevant)

This isn’t much of a post, but I suspect some people will find it useful =).

If your laptop is acting as if your function key is always held down; e.g. the F1-F12 keys do the special action (change volume, or whatever) instead of their normal purpose, then try Hold Fn + Esc and, depending on your model, it may disable the “Function Key Lock”.

On my laptop this actually shows a picture of a lock with the letters Fn within it to indicate it locks the function key as on.  But I didn’t see that in advance and had to google more than I would have liked to figure it out.

Linux Neatly Manage SSH Sessions Like MRemoteNG on Windows

SSH technically works the same anywhere, but on Windows without special tooling, using SSH can be cumbersome as the CLI is not very… elegant?  Generally, on Windows, people use tools like putty or MRemoteNG (also putty based) to make things neater.

If you’re on Linux, you can use SSH out of the box very cleanly by leveraging the config file to create named hosts.

For example, this verbose command:

ssh -i ~/.ssh/prod-key.pem centos@10.20.30.40

Can be replaced by the following command – and the nice “pgadmin-prod” name even auto-completes.  So, if you have 100 servers for different things, you can still find them easily.

ssh pgadmin-prod

This works if you add the following block into your ~/.ssh/config file.

Host pgadmin-prod
User centos
HostName 10.20.30.40
IdentityFile ~/.ssh/prod-key.pem

Where:

  • Host = the user-friendly name I want to use for this connection.
  • User = the user I normally have to log in as.
  • HostName = the IP address of the target host.
  • IdentityFile = the path to the private key used for the connection.

You can have as many named hosts as you like and, again, their names will auto complete after the ssh command – so they’re very easy to use.

This gets even more effective if you combine it with a screen/session management app like tmux or screen.  So, I recommend you look into those too if you don’t use them already (tmux is a little more modern if you’re a new to both).

I hope this helps you be a little more efficient, and thanks for reading.

Kubernetes Run Bash / Get Logs for Pod in Namespace

Here are some useful commands for managing pods within a given namespace.

List Pods in Namespace “qaas”

This will show you all the available pods in the given namespace.

$> kubectl get pods -n qaas
NAME READY STATUS RESTARTS AGE
dapper-kudu-pgadmin-694bdf8c7f-ljcc4 1/1 Running 0 9h

Get Logs for Pod

After finding the pod name, you can view its logs centrally from kubernetes which is very cool.

$> kubectl logs dapper-kudu-pgadmin-694bdf8c7f-ljcc4 -n qaas
::ffff:10.237.183.230 - - [01/Nov/2019:13:18:26 +0000] "GET / HTTP...
::ffff:10.237.183.230 - - [01/Nov/2019:13:18:26 +0000] "GET /login?...

Exec Into Pod And Run a Shell

This will let you get into the pod with a shell (like BASH) so that you can look around and see what’s going on.

$> kubectl exec -it dapper-kudu-pgadmin-694bdf8c7f-ljcc4 /bin/sh -n qaas
/pgadmin4 #