Linux and Bash

Bash

Great reference Ctrl, Alt

For Loops

Digital Ocean has a great writeup to get you started

Shell

sed: String Replacement

Here is an illustrative example. We want to change a folder’s permissions, but the path name is surrounded in quotation marks and needs to be extracted from the output of another command (docker ps). Our desired path is the second string in the output of grep, so we pass it to awk before sed:

sudo chmod 777 $(docker inspect shared-shared | grep "Mountpoint" | awk '{print $2}' | sed 's/"//g' | sed 's/,//g')

GitHub’s ssh walkthrough

ssh-agent: logging in remotely

ssh-copy-id name-of-remote-server

SSH Keys with Multiple GitHub Accounts

Using multiple keys on the same computer

Summary: set urls like this, where the url refers to the Host in file ~/.ssh/config (shown below):

git remote set-url origin ssh://git@github.com/mathematicalmichael/repo.git
Host github.com
  Hostname github.com
  User git
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_rsa

You need to add the key to your agent.

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa_personal

make (GNUMake)

Autocomplete make targets

complete -W "\`grep -oE '^[a-zA-Z0-9_.-]+:([^=]|$)' ?akefile | sed 's/[^a-zA-Z0-9_.-]*$//'\`" make

pgp / gnupg

walkthrough

password manager

To enter password via command-line, select pinetry-tty after running the following:

sudo apt install pinentry-tty
sudo update-alternatives --config pinentry
export GPG_TTY=$(tty)

To restart, echo RELOADAGENT | gpg-connect-agent or gpg-connect-agent reloadagent /bye

Linux (Ubuntu), General

Mark packages to avoid upgrade

Restarting Networking

Setting Up A Secure Ubuntu Server in the Cloud

tmux cheatsheet (gist)

tmuxcheatsheet.com

pass - the standard UNIX password manager

good write-up about Jupyter with Docker

my own Docker environment setup

Avatar
Michael Pilosov
An (applied) mathematician on a mission. Denver, CO.
Next
Previous