Over the past 2 years, only 3 books got me reading until their end.

The first, titled Mountain Beyond Mountains by Dr. Paul Farmer, a book chuck into my hands by a close friend. Unbeknownst to me, it was the book that inspired and got me moving out of nursing to explore technology with its unknown, depth and intricacies. It’s a book about the struggles of a doctor and ultimately building a health system for the people his life crossed passed with.

The second, Big Debt Crisis by Ray Dalio, breaks down the history of the financial crisis with the reasons and policies behind it. How the decisions of governments and the finance industries can alleviate or aggravate events that could vastly affect the finances of the country. It gives a valuable perspective and insight on how the market works. (Took me a long while to complete it though :))

The current, lent by a friend, fresh off his recent books purchasing galore, People, Power and Profits by Joseph E. Stiglitz, talks about true wealth, not through exploitation and rent-seeking. Where a country’s measure of success is a result of increasing knowledge and research, and where the growth of an efficient and stable economy is shared fairly. That is wealth creation. A nation with increasing GDP, contributed only by the top % of its citizens, accompanied by a deteriorating environment and depleting resources does not bode well for its citizens, environment and the economy.

Technology weaves through every part of the system, and has been knitted into our daily lives, and even if I never was interested in finance and the economy, it has got me reading up the many thoughts, ideas, and perspectives. very formidable indeed.

other reads:


Listened to this podcast while commuting

A research scientist in Toyota working on deep learning simulation for high image resolution needed to learn dev-ops to scale their testing. Tools used: docker, kubernetes, Beegfs. Why beegfs though? He did mention that there were db that could store up to 700gb until a point that they can’t and so moved over to beegfs. (to read up on beegfs)

On a separate note when we were working on scaling to 100k users on a project, it took us on the same route to use kubernetes to scale, and it is very stable.

Distance detector

The distance detector with LED and buzzer

Tutorial for above is here.

Tried the first time and fried my usb-c, wasn’t reading that I needed to ground them… Now it works 🙂 Adjusted the frequency much higher for nicer sounding tones. Tried to use the frequency for notes C – G, and it sounded pretty jarring to the ears. The electronic buzzer obviously cannot compare to the piano.

#define trigPin 7
#define echoPin 6
#define led 13
#define led2 12
#define led3 11
#define led4 10
#define led5 9
#define led6 8
#define buzzer 3

int sound = 5550;

void setup() {
  Serial.begin (9600);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  pinMode(led, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);
  pinMode(led4, OUTPUT);
  pinMode(led5, OUTPUT);
  pinMode(led6, OUTPUT);
  pinMode(buzzer, OUTPUT);

void loop() {
  long duration, distance;
  digitalWrite(trigPin, LOW); 
  digitalWrite(trigPin, HIGH);
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = (duration/2) / 29.1;

  if (distance <= 30) {
    digitalWrite(led, HIGH);
    sound = 5550;
  else {
  if (distance < 25) {
      digitalWrite(led2, HIGH);
      sound = 9250;
  else {
      digitalWrite(led2, LOW);
  if (distance < 20) {
      digitalWrite(led3, HIGH);
      sound = 11200;
  else {
    digitalWrite(led3, LOW);
  if (distance < 15) {
    digitalWrite(led4, HIGH);
    sound = 12500;
  else {
  if (distance < 10) {
    digitalWrite(led5, HIGH);
    sound = 13500;
  else {
  if (distance < 5) {
    digitalWrite(led6, HIGH);
    sound = 15000;
  else {
  if (distance > 30 || distance <= 0){
    Serial.println("Out of range");
  else {
    Serial.println(" cm");
    // tone( pin number, frequency in hertz, duration in milliseconds);
    tone(buzzer, sound);

Crash collision sensor

Having some time to myself to play with some new sensor, the circuit is pretty straight forward, waiting for my raspberry pi in the meantime..

VCC >> 5V
OUT >> pin 3

/* Crash Collision Sensor Detection Module
int ledPin = 13;                // choose the pin for the LED
int inputPin = 3;               // connect sensor to input pin 3
int count = 0;

void setup() {
  Serial.begin(9600);           // Init the serial port
  pinMode(ledPin, OUTPUT);      // declare LED as output
  pinMode(inputPin, INPUT);     // declare Micro switch as input
void loop(){
  int val = digitalRead(inputPin);  // read input value
  if (val == HIGH) {                // check if the input is HIGH
    digitalWrite(ledPin, LOW);      // turn LED OFF
  } else {
    digitalWrite(ledPin, HIGH);     // turn LED ON
    count += 1;
    Serial.println("Switch Pressed!");
  delay(80); // the higher the delay the less sensitive the switch

Random reads to keep

Companies that does vulnerability scanning

Encrypted Database and todos

From the discussions, when a company has a encrypted database(s)
– It needs to be backedup
– backups needs to be tested and verified using a snapshot on a separate vm instance
– if it was encrypted, the generated keys need to be saved
– there are ITCP audits that exists in large companies

Finding an error in a haystack

Well, today I needed to debug an error on the server. I needed to search the logs to find what the error was. Finding the particular information that I needed was difficult simply because I wasn’t proficient in vim and linux commands, and, the log was more than 20GB of data..

As usual, I looked for my all-knowing friend google. One of the developers on stack overflow suggested using grep instead because searching large files using vim is slow. So I went to the folder containing the logs to grep the particular regex I was looking for into a text file.

cat myerrors.log | grep theRegexIWant >> outputMySearchResults.txt

From there, retrieve (copy) the id that is relevant to that particular error and search using vim. So heading back to the massive .log file

vim myerrors.log

# using vim to find the particular error

Perhaps there is a better way, but at least I managed to find what I wanted from the logs. Probably truncating the logs to days or size is a better option. 😀

Jest, Puppeteer or ?Nightwatch

After using nightwatch we decided to switch to using jest and puppeteer for the many more apis and functionalities to support our wordpress plugin and chrome extension. A note here though that puppeteer only supports chrome/chromium. If you need to test cross browsers, nightwatch may be better with their browser drivers.

To setup jest and puppeteer. `—save-dev` or `-D` is saving to a dev dependency in package.json.

npm install --save-dev jest-puppeteer puppeteer jest

for simplicity, in package.json, add jest config. Alternatively, jest can have its own jest.config.js

“scripts": { 
"jest": { 
"preset": "jest-puppeteer" 

I’ve also install ndb, a useful debugger for jest and puppeteer

npm install —D ndb 

and in your package.json, scripts can include

“scripts”: { "test:debug": "npx ndb jest” } 

also to add linting for jest

npm install @types/jest 

create a simple sum.js and sum.test.js to test jest

to run the test,

npm run test

create also a simple google.test.js to test puppeteer with jest. `describe` `it` `expect` are jest while `browser` `page` are automatically handled by puppeteer, there is no need to add its dependency here. 

Read jest with puppeteer documents

Read puppeteer documents

describe('Google', () => { 
beforeAll(async () => { 
await page.goto(''); 
it('should be titled "Google"', async () => { 
await expect(page.title()).resolves.toMatch('Google'); 
}); }); 


npm run test 

Ubuntu auto script

So I was pretty tired of updating every single server I was messing around with for experimental purpose so I decided to create an auto scripting for the usual ‘apt update && apt upgrade’ command

Go to your server


Go to the folder where Cron exists. Cron is a time-based scheduler that allows daily, weekly, monthly and custom scripting.

cd /etc/cron.weekly

If I wanted it to run the updates and upgrades on a daily basis, it would be ‘cron.daily’. So in the directory where you wish to schedule your auto script, create a file using any editor of your choice (vim for me)

vim auto_update

In the file add

apt update && apt upgrade -y 
apt autoclean 
apt autoremove

A note though that upgrade might sometimes cause stuff to break, so a heads up here.

‘apt autoclean‘ → cleans obsolete packages,
‘apt autoremove‘ → removes orphaned packages which are not longer needed from the system

Now, to make the file executable in order for cron to be able to run it. In the directory where the script is, run,

chmod 755 auto_update 

Some other stuff you can do is to find files in example directory with size >+30GB and execute remove

find ~/example -type f -size +30000M -exec rm {} \;