17/09/20 Notes
Cron & GitHub
Below is a bash script designed to be run periodically via cron to completely purge and rebuild my containerised web server:
#!/bin/bash
# Stop the container
/usr/bin/docker stop tayicseua
# Delete the container
/usr/bin/docker rm tayicseua
# Remove the docker images
/usr/bin/docker image rm ubuntu:20.04
/usr/bin/docker image rm website-image:latest
# Build the docker image
/usr/bin/docker build -t website-image /opt/web-contained
# Start the container
/usr/bin/docker run -d -t -p 80:80 --name tayicseua website-image bash -c "service apache2 start && sleep infinity"

To create the schedule I ran crontab -e as root and added the below lines.
# Run script every Sunday at 4:30am
30 4 * * Sun /bin/bash /root/docker-rebuild.sh

A way to pull a GitHub repo with using a username/password is to use an auth token.
However, I could only grant the auth token the ability to clone my private repo by giving it repo scope which appears to be god mode?
Lower level permissions were unable to clone the repo.
git pull https://@github.com/username/website.git master
Instead of:
git pull https://username:password@github.com/username/website.git

Also, in github lingo 'pull requests' are effectively 'merge requests'.

Other Stuff:

Create a password hash for /etc/shadow
The below creates a password hash that can be used to create a user.
The below example will create a user named bob with a password of password1
echo "password1" | openssl passwd -1 -stdin
$1$kBoyM8Bj$PpkZ7g//V04zkLg9BgLH0/
useradd bob --password '$1$kBoyM8Bj$PpkZ7g//V04zkLg9BgLH0/'

Cryptocurrency nodes ports/protocols
If you are running your own node for these cryptos, these are the ports/protocols you will need to allow to accept incoming peers.
Bitcoin = 8333 TCP/UDP 
Ravencoin = 8767 TCP/UDP 
Litecoin = 9333 TCP/UDP 

A useful PowerShell command to view connected peers, both incoming and outgoing is the below.
First, identify the PID of your node software.
get-process  -name litecoin-qt

Then view connections:
Get-NetTCPConnection -OwningProcess 12481