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 / 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 / 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
@ShivKumarSaini
ShivKumarSaini / nodejs-ubuntu-bind-port-80.md
Created June 29, 2020 13:02 — forked from guifromrio/nodejs-ubuntu-bind-port-80.md
Allow Node.js to bind to privileged ports without root access on Ubuntu

How to: Allow Node to bind to port 80 without sudo

TL;DR

Only do this if you understand the consequences: all node programs will be able to bind on ports < 1024

sudo setcap 'cap_net_bind_service=+ep' /usr/local/bin/node

Important: your node location may vary. Use which node to find it, or use it directly in the command:

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096