Is Success Luck or Hard Work?

Do we live in a simulation? , If so working hard and luck are also part of that simulation ?

Forget the above question and enjoy this video.

Posted in Uncategorized | Leave a comment

CodeIgniter Email Configuration

I was debugging an issue with sending email with PHP CodeIgniter and found this interesting. Strange enough the issue was not setting the charset.

Below setting worked for me

<?php defined('BASEPATH') OR exit('No direct script access allowed');

$config['protocol'] = 'smtp', // 'mail', 'sendmail', or 'smtp'
$config['smtp_host'] = '', 
$config['smtp_port'] = 465,
$config['smtp_user'] = '',
$config['smtp_pass'] = '12345!',
$config['smtp_crypto'] = 'tls', //can be 'ssl' or 'tls' for example
$config['mailtype'] = 'text', //plaintext 'text' mails or 'html'
$config['smtp_timeout'] = '4', //in seconds
$config['charset'] = 'iso-8859-1',
$config['wordwrap'] = TRUE

On a side note, its interesting how to debug PHP application with VS Code and XDebug. If anyone interested this could be a great starting point ->

Posted in Uncategorized | Leave a comment

Add Google reCAPTCHA to your PHP site

How it works

See steps below

  1. If you are on Ubuntu, install php-curl
  2. Register for a key and secret ->
  3. Load js with client key -> src=”;
  4. Add following javascript to you client side html code
    • $(‘#contact’).submit(function(event) {
    • event.preventDefault();
    • grecaptcha.ready(function() {
    • grecaptcha.execute(‘CLIENT_KEY’, {action: ‘submit’}).then(function(token) {
    • $(‘#contact’).prepend(”);
    • $(‘#contact’).prepend(”);
    • $(‘#contact’).unbind(‘submit’).submit();
    • });
    • });
    • });
  5. Add following to server
    • /*
    • if (isset($_POST[’email’]) && $_POST[’email’]) {
    • $email = filter_var($_POST[’email’], FILTER_SANITIZE_STRING);
    • } else {
    • // set error message and redirect back to form…
    • header(‘location: index.php’);
    • exit;
    • }
    • */
    • $token = $_POST[‘token’];
    • $action = $_POST[‘action’];
    • // call curl to POST request
    • $ch = curl_init();
    • curl_setopt($ch, CURLOPT_URL,”;);
    • curl_setopt($ch, CURLOPT_POST, 1);
    • curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array(‘secret’ => RECAPTCHA_V3_SECRET_KEY, ‘response’ => $token)));
    • curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    • $response = curl_exec($ch);
    • curl_close($ch);
    • $arrResponse = json_decode($response, true);
    • if($arrResponse[“success”] == ‘1’ && $arrResponse[“score”] >= 0.5) {
    • //success
    • }
    • else{
    • //error
    • }

Posted in Uncategorized | Leave a comment

The Magic of Reality

Dawkins trying to explain science with story telling. Most chapters starts with myths ( I’m sure even adults are keen on these stories ), and then explains the science. Highly recommended.

Posted in Uncategorized | Leave a comment

Too many conspiracy theories, and many more to come ?

Until we find the ultimate truth, I’m guessing there will be more conspiracy theories.

Everyone understand, how frustrated the affected families are. However the more you put effort on this, the more mysterious it will be. Let the time to solve, and be hopeful a random event might shed some light to the ultimate truth.

Good one watch and highly recommended.

Posted in Uncategorized | Tagged | Leave a comment

Solving the last layer of Rubik’s cube

Solving first 2 layers seems straight forward. There are lots of videos on this.

After looking at several algorithms, I found this one to solve the last layer.

T-Top, C-Clockwise, A-Anticlockwise, R-Right, L-left, B-Bottom

  1. To make the cross
    1. FC, RC, TC, RA, TA, FA
  1. Check all center pieces are matching
    1. If they are adjacent
      1. RC, TC, RA, TC, RC, TC-2, RA
    2. If they are opposite – move matching one to the back
      1. RC, TC, RA, TC, RC, TC-2, RA
  1. Solving the corners
Posted in Uncategorized | Leave a comment

This is what ChatGPT says about skipping

Posted in Uncategorized | Tagged , | Leave a comment

Don’t get caught up to these crooks

Read this tip if you have plans to repair/replace the garage door.

First, it was my bad I forgot to service my garage door. There is no need to get the handyman for this . You can do it yourself, just buy WD-40 from bunnings and apply that to all mechanical parts of the door.

When the springs for the garage door is not serviced, it becomes a heavy load to the motor and will try to draw more current. As a result the 10A fuse inside the motor will burn out.

I had this issue and didnt bother checking the fuse, ( also it wasnt known to me as well and I was getting ready for the holidays) as the motor was used for a quite long time. I called the door repair guy and and he came and just said its busted and needs to replace the motor, which cost me $750 in total.

After the replacement, the guy was trying to take the motor and accessories with him. I asked him to keep, just for me to play around and I can bin in later.

After a bit of debugging I found where the issue was ( cost is < $1 ), and called to company and 1made the complaint. After a while the they called me and offered the options to reinstall the old one or charge only the cost.

Moral of the story, just check the fuse before calling the door repair guy.

Use this to service

Where the fuse is located, ( 1.11 )

Posted in Uncategorized | Leave a comment

Intel NUC or Raspberry PI ?

What ultimately matters is ROI, output/performance per 1w. ( if we ignore the cost factor ). In that perspective Intel NUC is way ahead than Raspberry PI. So why waiting if Raspberry Pi is out of stock.

Power is just a bit higher than Raspberry PI,

  • NUC with Ubuntu 22 ( i5 , 16GB, SSD ) – 7.2W
  • Raspberry Pi is with Raspbian ( Model 4, 8GB ) – 4.8W
  • Both running LAMP stack
Posted in Uncategorized | Tagged , | Leave a comment

Another point of view

A 2013 documentary, still its worth watching. TBH I enjoyed every second. Its free on YouTube with subtitles.

Posted in Uncategorized | Leave a comment