Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Shiv Kumar ShivKumarSaini

🎯
Focusing
View GitHub Profile
View multiple-repository-and-identities-git-configuration.md

Setup multiple git identities & git user informations

/!\ Be very carrefull in your setup : any misconfiguration make all the git config to fail silently ! Go trought this guide step by step and it should be fine 😉

Setup multiple git ssh identities for git

  • Generate your SSH keys as per your git provider documentation.

  • Add each public SSH keys to your git providers acounts.

  • In your ~/.ssh/config, set each ssh key for each repository as in this exemple:

View coturn-installation-steps.md

Third-party libraries

If you are installing the coturn package in Debian, Ubuntu or Mint, or if you installing the "turnserver" port in FreeBSD, or if you are installing one of the supplied binaries in the "downloads" section of the project, then the OS and the third party packages are installed automatically. The instrudctions below are for those who are setting the TURN server from scratch.

Before installing and configuring the TURN server, the latest stable libevent library should be downloaded, built and installed:

$ wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz

As root, build and install the library with the usual:

$ tar xvfz libevent-2.0.21-stable.tar.gz

View gist:affbc6e04d1b05140dbbaf40a3f000d5
to check if the server works - https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice
stun:
stun.l.google.com:19302,
stun1.l.google.com:19302,
stun2.l.google.com:19302,
stun3.l.google.com:19302,
stun4.l.google.com:19302,
stun.ekiga.net,
stun.ideasip.com,
View self-signed-certificate-with-custom-ca.md

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

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:

@ShivKumarSaini
ShivKumarSaini / Installing MySQL.md
Last active May 6, 2020
All privileges to new user in MySQL
View Installing MySQL.md

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 / Angular script:
Last active Dec 6, 2019
File Download (Excel in this case) with Node Server and Angular 2+ App
View Angular script:
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');
}
);
View PM2 start with configurations
pm2 start --env=development_server --only=server-live
@ShivKumarSaini
ShivKumarSaini / distance.sql
Created Oct 23, 2018 — forked from Usse/distance.sql
MySQL calculate distance between two latitude/longitude coordinates
View distance.sql
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 / LICENCE SUBLIME TEXT
Created Jul 25, 2018
Sublime Text 3 Serial key build is 3176
View LICENCE SUBLIME TEXT
## 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 -----