Skip to content

Instantly share code, notes, and snippets.

View ShivKumarSaini's full-sized avatar
🎯
Focusing

Shiv Kumar ShivKumarSaini

🎯
Focusing
  • IBM
View GitHub Profile
@ShivKumarSaini
ShivKumarSaini / Update_NodeJs_Version.md
Last active April 23, 2022 15:08
Updating node.js version on Linux machine

Update Node.js with NVM and keep packages

Usually when new version of Node.js comes out and you update it by just installing new and removing old one, all of your global NPM packages are gone. Here is how to update to new version of Node and reinstall packages:

Install/update NVM first

For Windows, use nvm setup from "https://github.com/coreybutler/nvm-windows/releases".

Go to URL "https://github.com/creationix/nvm" and follow install/update instructions.

@ShivKumarSaini
ShivKumarSaini / coloredConsoleMessages.md
Created February 14, 2018 09:19
Colored console messages

It is based on JS. Use below code syntax to produce colored messages in console windows:

  console.log('%chello', 'color:aqua');
@ShivKumarSaini
ShivKumarSaini / style.css
Last active April 9, 2018 11:44
Vertical allignment of text using CSS3
/**
Please have a look at this link:
>> https://stackoverflow.com/questions/79461/vertical-alignment-of-elements-in-a-div/45458436#45458436
*/
.immediate-parent-of-text-containing-div{
height: 50px; /* or any fixed height that suits you.*/
}
@ShivKumarSaini
ShivKumarSaini / Date Control.md
Last active April 10, 2018 10:40
Read/Write date value using ngModel in Input control.
@ShivKumarSaini
ShivKumarSaini / trial.md
Created July 12, 2018 07:26 — forked from satish-setty/trial.md
Beyond Compare 4 license for Linux Mint

Beyond Compare 4.x

Licensed to: ASIO Allsoftinone Quantity: 1 user Serial number: 1822-9597 License type: Pro Edition for Linux

First delete away trial mode:

sudo sed -i "s/keexjEP3t4Mue23hrnuPtY4TdcsqNiJL-5174TsUdLmJSIXKfG2NGPwBL6vnRPddT7tH29qpkneX63DO9ECSPE9rzY1zhThHERg8lHM9IBFT+rVuiY823aQJuqzxCKIE1bcDqM4wgW01FH6oCBP1G4ub01xmb4BGSUG6ZrjxWHJyNLyIlGvOhoY2HAYzEtzYGwxFZn2JZ66o4RONkXjX0DF9EzsdUef3UAS+JQ+fCYReLawdjEe6tXCv88GKaaPKWxCeaUL9PejICQgRQOLGOZtZQkLgAelrOtehxz5ANOOqCaJgy2mJLQVLM5SJ9Dli909c5ybvEhVmIC0dc9dWH+/N9KmiLVlKMU7RJqnE+WXEEPI1SgglmfmLc1yVH7dqBb9ehOoKG9UE+HAE1YvH1XX2XVGeEqYUY-Tsk7YBTz0WpSpoYyPgx6Iki5KLtQ5G-aKP9eysnkuOAkrvHU8bLbGtZteGwJarev03PhfCioJL4OSqsmQGEvDbHFEbNl1qJtdwEriR+VNZts9vNNLk7UGfeNwIiqpxjk4Mn09nmSd8FhM4ifvcaIbNCRoMPGl6KU12iseSe+w+1kFsLhX+OhQM8WXcWV10cGqBzQE9OqOLUcg9n0krrR3KrohstS9smTwEx9olyLYppvC0p5i7dAx2deWvM1ZxKNs0BvcXGukR+/g" /usr/lib/beyondcompare/BCompare
@ShivKumarSaini
ShivKumarSaini / LICENCE SUBLIME TEXT
Created July 25, 2018 07:25
Sublime Text 3 Serial key build is 3176
## Sublime Text 3 Serial key build is 3176
> * Added these lines into /etc/hosts
127.0.0.1 www.sublimetext.com
127.0.0.1 license.sublimehq.com
> * Used the license key
----- BEGIN LICENSE -----
@ShivKumarSaini
ShivKumarSaini / distance.sql
Created October 23, 2018 11:29 — forked from Usse/distance.sql
MySQL calculate distance between two latitude/longitude coordinates
CREATE FUNCTION `lat_lng_distance` (lat1 FLOAT, lng1 FLOAT, lat2 FLOAT, lng2 FLOAT)
RETURNS FLOAT
DETERMINISTIC
BEGIN
RETURN 6371 * 2 * ASIN(SQRT(
POWER(SIN((lat1 - abs(lat2)) * pi()/180 / 2),
2) + COS(lat1 * pi()/180 ) * COS(abs(lat2) *
pi()/180) * POWER(SIN((lng1 - lng2) *
pi()/180 / 2), 2) ));
END
@ShivKumarSaini
ShivKumarSaini / PM2 start with configurations
Created March 19, 2019 07:42
PM2 start with env config
pm2 start --env=development_server --only=server-live
@ShivKumarSaini
ShivKumarSaini / Angular script:
Last active December 6, 2019 11:19
File Download (Excel in this case) with Node Server and Angular 2+ App
this._httpService.get(<server url to download a file>
, {headers: new HttpHeaders({'Content-Type': 'application/octet-stream'}), responseType: 'blob'})
.subscribe(
(fileExcel) => {
fileExcel; // this is a blob.
},
(error) => {
console.log('err');
}
);
@ShivKumarSaini
ShivKumarSaini / Installing MySQL.md
Last active May 6, 2020 19:07
All privileges to new user in MySQL

Step 0: Remove/Purge:

In case, this is a re-installation, first remove previous version fully.

$ sudo apt-get remove --purge mysql*  
$ sudo apt-get purge mysql*  
$ sudo apt-get autoremove  
$ sudo apt-get autoclean  
$ sudo apt-get remove dbconfig-mysql