Json_error_ctrl_char

I was using mcrypt to encrypt json_encoded data. On other side, mycrypt was able to decrpyt data but json_decode was not working. It would throw JSON_ERROR_CTRL_CHAR error. However, without mcrypt, json_decode worked flawlessly. After some trial and error, I found that applying trim function after decrypting data would let me use json_decode without any issues.

Published
Categorized as Code

Find Large Directories on AIX

I usually run it from under a partition which is running out of space. It can take a while. du -g | sort -n -r

Published
Categorized as Code

Setup Outgoing Email on Lightsail Ubuntu VPS

I followed instructions here: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-ubuntu-18-04 Everything seemed okay but email were not getting delivered. Logs showed me that smtp connections were timing out: However, I could ping any of above ip addresses just fine. Next step was to see if ip address of my VPS was blacklisted in RBLs, I used https://mxtoolbox.com/blacklists.aspx. None of my ip addresses… Continue reading Setup Outgoing Email on Lightsail Ubuntu VPS

Published
Categorized as Code

hsts Neterr_cert_common_name_invalid

Without full understanding, I had enabled HSTS on amerkhalid.com with option includeSubDomains. I had a subdomain that was used as “Custom Domain” to SmugMug site. After enabling HSTS, these subdomains started to throw NET::ERR_CERT_COMMON_NAME_INVALID. The fix is of course simple, don’t use includeSubDomains. But that opens up your top level domain to man in middle attacks. For now, I decided… Continue reading hsts Neterr_cert_common_name_invalid

Published
Categorized as Code