Image for post
Image for post

PHP 8 is scheduled to release on November 26th, 2020. For a complete list of changes in PHP 8.0, see What’s new and changed in PHP 8.0

Add ondrej/php PPA repository

sudo add-apt-repository ppa:ondrej/php # Press enter when prompted.
sudo apt-get update

Install PHP 8.0 and extensions

sudo apt install php8.0-common php8.0-cli -y
sudo apt install php8.0-{bz2,curl,intl,mysql,readline,xml}
sudo apt install php8.0-fpm
sudo apt purge '^php7.4.*'

What is a blind index?

Blind indexing is an approach to securely search encrypted data with minimal information leakage.

Use case

Let’s say that you are building a platform which is going to store large amounts of personal information. Data such as SSN numbers, Aadhaar card or Pan card etc. You also need the ability to search through them to run validation checks etc.

Implementation

First you need to have your application and database servers running on different machines. You obvious don’t want your SALT keys and database to be on the same machine.

Let’s assume your table schema looks something like this (PostgreSQL):

CREATE TABLE users (    id SERIAL PRIMARY KEY,
first_name TEXT,
last_name TEXT,
ssn TEXT, /* encrypted */
ssn_bidx TEXT /* blind index…


Most developers prefer numerical primary keys because they auto increment, they are efficient to use and easy to generate. But that doesn’t mean that a primary key has to be a number.

What is a UUID:

UUID stands for Universally Unique Identifier. UUID is defined based on RFC 4122, “a Universally Unique Identifier (UUID) URN Namespace).

UUID is designed as a number that is unique globally in space and time. Two UUID values are expected to be distinct, even they are generated on two independent servers.

A UUID value is a 128-bit number represented as a UTF8 string of five hexadecimal numbers in the following format give…


Image for post
Image for post

It’s always a good practice to keep your database upgraded to the latest stable release. It helps in leveraging new features, keeping up security patches and other bug fixes.

Whenever we had to run a major version upgrade of our PostgreSQL database cluster, we had to take a complete dump. It becomes cumbersome specially when the database size is in terabytes.

Note: PostgreSQL minor version upgrades do not require a complete dump and restore. Only major versions require it.

Durning this process we need to make sure we have enough disk space to take a complete dump. Here AWS S3 comes in handy. …


One of my shell script was overlapping which resulted in 100% memory usage. So, I have written a validation that checks if the same shell script is running or not. If it’s not running it will continue to process further, otherwise exit. Below is the code snippet.

#!/bin/sh[ "$(pidof -x $(basename $0))" != $$ ] && exit## process further

Steps to resize NVMe volumes for Nitro Instances.

List information about all block devices on your machine.

ubuntu@localhost$ sudo lsblk
ubuntu@localhost$ sudo growpart /dev/nvme0n1 1
xfs_growfs /dev/nvme1n1
ubuntu@localhost$ sudo resize2fs /dev/nvme0n1p1
ubuntu@localhost$ df -h

Localized day of week :

#!/bin/sh
DOW=$(date +"%a")
echo $DOW
#!/bin/sh
LANG=C DOW=$(date +"%a")
echo $DOW

Image for post
Image for post

Recently I have moved a company from on-premise to AWS Cloud. They operate between 10 AM IST to 6 PM IST.

During business ours we upgrade our PostgreSQL RDS to db.t2.2xlarge because we have quite a heavy traffic and require more db connections to be able to run analytics & other reporting tools. We also set ec2auto-scaling to minimum 2 servers.

Reserved Instances:

This is really good approach to reduce costs IF you can predict how much infra you need to scale. We haven’t considered this because we didn’t wanted to commit for a year / we are not sure how we will scale. …


Rsync is a utility for efficiently transferring and synchronizing files across computer systems, by checking the timestamp and size of files.[3] It is commonly found on Unix-like systems and functions as both a file synchronization and file transfer program. The rsync algorithm is a type of delta encoding, and is used for minimizing network usage. Zlib may be used for additional data compression,[3] and SSH or stunnel can be used for data security.

Rsync is typically used for synchronizing files and directories between two different systems. For example, if the command rsync local-file user@remote-host:remote-file is run, rsync will use SSH to connect as user to remote-host.[4] …


Image for post
Image for post

I recently upgraded to Mac OS Mojave and Git started throwing error: Invalid active developer path

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
$ xcode-select — install

About

Mir Adnan

Product Lead at StegoSOC

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store