Four coloring for large software

“In mathematics, the four colour theorem, or the four colour map theorem, states that, given any separation of a plane into contiguous regions, producing a figure called a map, no more than four colour are required to colour the regions of the map so that no two adjacent regions have the same colour.” — Wikipedia

“A codebase composed of small interconnected modules that communicate with each other in a well-defined way will have a lower complexity than one where the modules communicate with each other haphazardly.” –

How to recover locked out AWS EC2 ssh machine

One time I accidentally messed with the `/etc/passwd` and locked myself out of being able to SSH into the machine. Since this is a remote machine in AWS I had no way of doing what I’d normally do. Which is attaching a keyboard and monitor and fixing this manually.

To fix, use the AWS EC2 Management page to:
– spin up a new instance of vanilla ubuntu EC2 (let’s call it David)
– shutdown the locked machine (let’s call it Goliath)
– unmount Goliath’s volume
– attach the volume to David

Then follow this guide:

Summary of what I did from this guide:
sudo file -s /dev/xvdf # MBR (not data type)
sudo file -s /dev/xvdf1 # ext4
sudo mkdir mount_folder
sudo mount /dev/xvdf1 mount_folder # ext4 mounted
cd mount_folder
# undo crazy setting (see Note #1)
cd .. # to unmount
sudo umount /dev/xvdf1
# Note #2

Note #1: For me I tried to modify `/etc/ssh/sshd_config` to allow one more user to login. But this made me unable to login after. So I removed the offending line.

Note #2: now in the Volume webpage
– undo attach to David (Volumes tab)
– mount to Goliath (Volumes tab: attach as EBS path /dev/sda1)
– boot up Goliath (Instance tab)