Skip to content

Instantly share code, notes, and snippets.

View malkitsingh's full-sized avatar
🎯
Focusing

Malkit Singh malkitsingh

🎯
Focusing
View GitHub Profile
@malkitsingh
malkitsingh / countries.json
Created October 21, 2016 09:45
Countries JSON
{"results":[{"id":"1","iso":"AF","name":"AFGHANISTAN","nicename":"Afghanistan","iso3":"AFG","numcode":"4","phonecode":"93"},{"id":"2","iso":"AL","name":"ALBANIA","nicename":"Albania","iso3":"ALB","numcode":"8","phonecode":"355"},{"id":"3","iso":"DZ","name":"ALGERIA","nicename":"Algeria","iso3":"DZA","numcode":"12","phonecode":"213"},{"id":"4","iso":"AS","name":"AMERICAN SAMOA","nicename":"American Samoa","iso3":"ASM","numcode":"16","phonecode":"1684"},{"id":"5","iso":"AD","name":"ANDORRA","nicename":"Andorra","iso3":"AND","numcode":"20","phonecode":"376"},{"id":"6","iso":"AO","name":"ANGOLA","nicename":"Angola","iso3":"AGO","numcode":"24","phonecode":"244"},{"id":"7","iso":"AI","name":"ANGUILLA","nicename":"Anguilla","iso3":"AIA","numcode":"660","phonecode":"1264"},{"id":"8","iso":"AQ","name":"ANTARCTICA","nicename":"Antarctica","iso3":null,"numcode":null,"phonecode":"0"},{"id":"9","iso":"AG","name":"ANTIGUA AND BARBUDA","nicename":"Antigua and Barbuda","iso3":"ATG","numcode":"28","phonecode":"1268"},{"id":"1
@malkitsingh
malkitsingh / Setting mongo db as a service.txt
Created November 30, 2016 14:46
Running Mondo DB as a Service
Make sure that you added you /bin directory to you system variable PATH
D:\mongodb\bin>mongod --remove
First I executed this command after opening command prompt as administrator:
D:\mongodb\bin>mongod --dbpath=D:\mongodb --logpath=D:\mongodb\log.txt --install
After that right there in the command prompt execute:
services.msc
@malkitsingh
malkitsingh / index.html
Created December 5, 2016 06:18
Connecting/Testing socket
<html>
<head>
<title>
Socket Testing
</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.6.0/socket.io.min.js"></script>
<script type="text/javascript">
@malkitsingh
malkitsingh / .htaccess
Created December 22, 2016 05:43
Running node app with proxy from any port and map to port 80
<VirtualHost IP:80>
ServerName xyz.com
ServerAlias www.xyz.com
DocumentRoot /var/www/xyz/data/www/xyz.com
ServerAdmin webmaster@xyz.com
DirectoryIndex index.html index.php
<!--------------- stuff which is placed in this file
ProxyRequests off
<Proxy *>
@malkitsingh
malkitsingh / info.txt
Created April 15, 2017 07:42
checking port in use and killing active process
For windows
first, find process id using his port
netstat -a -n -o | find "123456"
then, kill the process by id
taskkill /F /PID 3312
@malkitsingh
malkitsingh / info.txt
Created April 15, 2017 10:29
creating pem file from p12
openssl pkcs12 -in Certificates2.p12 -out pushcert.pem -nodes -clcerts
@malkitsingh
malkitsingh / ajenti installation on ubuntu
Created June 29, 2017 06:39
Installation guide to install ajenti on ubuntu
1. wget http://repo.ajenti.org/debian/key -O- | sudo apt-key add -
2. echo "deb http://repo.ajenti.org/ng/debian main main ubuntu" | sudo tee -a /etc/apt/sources.list
3. sudo apt-get update && sudo apt-get install ajenti
4. sudo service ajenti restart
5. access using https://your-ip:8000
@malkitsingh
malkitsingh / notes.js
Created January 19, 2018 06:19
some of node code snippets
// to upload file to s3 bucket.
var AWS = require('aws-sdk');
AWS.config = new AWS.Config();
AWS.config.accessKeyId = "XXX";
AWS.config.secretAccessKey = "XXXXX";
AWS.config.region = "ap-south-1";
var s3 = new AWS.S3();
@malkitsingh
malkitsingh / info.txt
Last active April 14, 2019 11:20
Setting Node.JS on Ubuntu
**Install Node.js**
cd ~
curl -sL https://deb.nodesource.com/setup_8.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt-get install nodejs
sudo apt-get install build-essential
**Install Nginx**
sudo apt-get update
@malkitsingh
malkitsingh / info.txt
Created September 4, 2019 09:21
Managing multiple sites from single server using Nginx
Short note on how to manage multiple sites with SSL from Nginx
make domainOne.com domainTwo.com file in
/etc/nginx/sites-available
Contents of domainOne.com will look like this once done
server {
server_name domainOne.com www.domainOne.com;