

Access JavaScript property case-insensitively
You can alternatively already provide the searchKey in lowercase. If you want it as a function: If the key can’t […]

How to read command line arguments in NodeJS?
Let’s assume you are passing a few values from the command line when you are running a node command. These […]

Sort the list of file names using ls command
To list only the file names using ls command we can pass -a option to it. You can sort the […]

Flatten an irregular list of lists in Python
Let’s say I would like to flatten an irregular list of lists. First approach is by using collections.Iterable where x […]

Split a list into evenly sized chunks in Python
where l is the list and n is the number of items in a chunk. Use xrange() instead of range() in the case of […]

Create a flat list out of a list of lists in Python
Let’s take a list of lists. To merge this lists to a flat list you can use the following ways. […]

Rename keys in an array of objects using JavaScript
I have an array of country objects. In this array I would like to replace the key name with country. […]

TypeError: ‘str’ object does not support item assignment – Python error – How to fix?
Python strings are immutable and they cannot be changed during the course of Python program execution. In Python, strings cannot […]

Warning: Each child in a list should have a unique “key” prop – How to fix this react error?
When creating a list in the UI from an array with JSX, you might get this error. To fix this […]

Kill all processes running on a port in Linux
To kill all processes running on the port 8080:

Update counter on click of button in React
In this example, the counter is updated every time the user clicks on the Update Counter button, the page is refreshed and […]














Generate random string with only numbers or alphabet in JavaScript
This is a simple approach to generate random string with either numbers or letters using a predefined set.

TypeError: Router.use() requires a middleware function but got a Object – How to fix this Express/Node.js error?
TypeError: Router.use() requires a middleware function but got a Object – How to fix this Express/Node.js error? You would typically […]

Append text to file in Go
Syntax Examples An example from Github.

Reading an array of N elements in C#
The first line contains N, the number of elements. The next line contains N space-separated integers.

Replace all occurrences of a string in Go
To replace all occurrences of a string in a string, we can use strings.ReplaceAll function. It returns a copy of […]




Select rowid along with all other columns from a table in Oracle database
To select rowid along with all other columns from a table, just use an alias and get the columns using […]

How to clear the Material UI text field Value in React?
To clear the Material UI text field Value in React, we can set the value property of the input to an empty […]

How to change the page title with JavaScript?
To change the page title with JavaScript, we can set the document.title property. This can be useful if you want to change […]

How to get the size of the database in PostgreSQL?
SELECT pg_size_pretty( pg_database_size('dbname') );

TypeError[ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension “.json” – How to fix ?
Since ES6 when you try to import JSON file you might face this error. To fix this error simple add […]

Kill all blocking objects in Oracle database
To list down all blocking objects with status as ‘is blocking’, we can run the following query. There is a […]

View processes list in tree format in Linux
pstree is a command that shows the running processes as a tree. It is used as a more visual alternative […]

Get home directory of logged in user in Shell
Using a built-in variable: Using a tilde:

Get current user in Shell
Using a built-in variable: Using a command:

Filter on all fields in an array of objects
We know how to filter on an array of objects on specific fields. In some cases we might want to […]

Get the number of processors in Linux and MacOS
This command queries the configured processor values using the getconf command. Example


How can the default node version be set using NVM?
To view the list of NVM installed in your machine: To make an NVM version default:

Round a decimal number to nearest decimal that is divisible by 5 in JavaScript
I would like to convert 1.2 to 1.5 and 1.7 to 2. This is basically rounding a decimal number to […]

Error: algorithms should be set – JWT Error – How to fix?
To fix the error – Error: algorithms should be set – just add the algorithms to the JWT constructor.

Play a Youtube video using pywhatkit in Python
The playonyt() function in pywhatkit module is used to play a Youtube video either from a URL or from a […]

SyntaxError: Cannot use import statement outside a module – How to fix this error in Node.js?
SyntaxError: Cannot use import statement outside a module – This error occurs when you use ES6 imports in your node.js […]

ER_CANNOT_RETRIEVE_RSA_KEY – error when connecting to MySQL with MariaDB npm package. How to fix?
When you connect to a MySQL Database with MariaDB npm package you might face this error. To fix this just […]

Calculate moving average of an array of numbers in JavaScript
Moving average is the average of the current element and the previous elements in an array. We can use the […]

Check if a variable is a date in JavaScript?
We can use these code snippets to determine if a variable is a date in JavaScript. instanceOf Object.prototype.toString.call()

How to filter an object by key in JavaScript?
We can use these code snippets to filter a JavaScript object their keys. Filter and reduce with Object.keys() Filter with […]

Convert HTML to Pug in Node.js
We can use the html2pug npm package to convert HTML to Pug in JavaScript / Node.js. The fragment option tells html2pug whether […]

Convert RGB to Hex in JavaScript
Convert RGB to Hex in JavaScript with the following code snippet.

Find the day of year from date in JavaScript
Find the day of year from date in JavaScript with the following code snippet.

Find the number of days between two days using JavaScript
Find the number of days between two days using JavaScript with this code snippet.

Shuffle an array in random order with JavaScript
Shuffle an array in random order with JavaScript with this code snippet.
Android Utility belt — Collection of dependencies for a greenfield project
[ Originally published at https://mahendranv.github.io/posts/android-gradle-deps-kit ] Starting an android project will bring in a new set of challenges 👀 aka […]
Curly hair, very fair, please share :)
Sort the list of file names using ls command
To list only the file names using ls command we can pass -a option to it. You can sort the […]
Flatten an irregular list of lists in Python
Let’s say I would like to flatten an irregular list of lists. First approach is by using collections.Iterable where x […]
Split a list into evenly sized chunks in Python
where l is the list and n is the number of items in a chunk. Use xrange() instead of range() in the case of […]
Create a flat list out of a list of lists in Python
Let’s take a list of lists. To merge this lists to a flat list you can use the following ways. […]
Rename keys in an array of objects using JavaScript
I have an array of country objects. In this array I would like to replace the key name with country. […]
TypeError: ‘str’ object does not support item assignment – Python error – How to fix?
Python strings are immutable and they cannot be changed during the course of Python program execution. In Python, strings cannot […]
Warning: Each child in a list should have a unique “key” prop – How to fix this react error?
When creating a list in the UI from an array with JSX, you might get this error. To fix this […]
Kill all processes running on a port in Linux
To kill all processes running on the port 8080: