Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the twentyfifteen domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/sunapi386.ca/wordpress/wp-includes/functions.php on line 6121
sunapi386's Blog – Page 10 – Hacker/scientist/entrepreneur.

XDinner

Wrapping up a project at and moving the project to phase 2. We celebrated with a team dinner at Cascal. Actually the first time our small project had outside dinner.

I didn’t take notes at the time so these are the memories from last night.

I will roughly summarize the events and some principles. I won’t write much into details partly for sake of privacy and partly because I can’t remember nor have the time to flush it all out. So I’ll write some memory triggers.

I had a bunch of questions in revolving around:
– What is going on with the project?
– What are the plans for our other projects?
– What were the lessons learned from building a company?

And other personal and life questions as
– Why did you create the company?
– How come you don’t want to be a professor anymore?
– Why did you want to become a professor?
– How did you climb the life ladder from where you started?
– What are your principles?
– How did you get to where you are today?

And some summaries of his responses
– work very very hard
– be opportunistic, they come and don’t wait
– surround yourself with people you want to become

Server migration

I’m in the middle of migrating the this website from hosted on a shared namecheap server to a VPS server. Namecheap notified me that this site will be undergoing for hardware upgrade, moving to a different physical server. Let me remember what the old hardware was, and I’ll update this post later with the new hardware. Schedule update is for Mar. 25, 2017.

[phepha@server159 ~]$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 62
model name : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
stepping : 4
microcode : 1064
cpu MHz : 2099.884
cache size : 15360 KB
physical id : 0
siblings : 12
core id : 0
cpu cores : 6
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes

[phepha@server159 ~]$ cat /proc/meminfo
MemTotal: 65786112 kB
MemFree: 740052 kB
Buffers: 10627716 kB
Cached: 38361744 kB
SwapCached: 0 kB
MemCommitted: 1031798784 kB
VirtualSwap: 0 kB
Active: 29757552 kB
Inactive: 25222428 kB
Active(anon): 4747632 kB
Inactive(anon): 1283136 kB
Active(file): 25009920 kB
Inactive(file): 23939292 kB
Unevictable: 5244 kB

[phepha@server159 ~]$ cat /proc/version
Linux version 2.6.32-604.30.3.lve1.3.63.el6.x86_64 (mockbuild@build.cloudlinux.com) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) ) #1 SMP Sun Sep 27 06:34:10 EDT 2015

Generate https cert

“`
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install -y python-certbot-nginx
“`
Then get a certificate `sudo certbot –nginx certonly`

Now edit the nginx config to add the fullchain.pem and privkey.pem paths.

sudo vim /etc/nginx/sites-enabled/default

Add lines 22-25.

server {
20 # SSL configuration
21 #
22 listen 443 ssl default_server;
23 listen [::]:443 ssl default_server;
24 ssl_certificate_key /etc/letsencrypt/live/autox.network/privkey.pem;
25 ssl_certificate /etc/letsencrypt/live/autox.network/fullchain.pem;

}

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.” – http://alexkudlick.com/blog/what-the-four-color-theorem-can-teach-us-about-writing-software/

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: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html

Summary of what I did from this guide:
“`
lsblk
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)