Skip to content

Instantly share code, notes, and snippets.

View checkaayush's full-sized avatar

Aayush Sarva checkaayush

View GitHub Profile
@checkaayush
checkaayush / mongodb_setting_up_a_replica_set.md
Last active December 6, 2017 08:22 — forked from leommoore/mongodb_setting_up_a_replica_set.md
MongoDB - Setting up a Replica Set

MongoDB - Setting up a Replica Set

cd \mongodbdir\

mkdir db1
mkdir db2
mkdir db3

Primary

mongod --dbpath ./db1 --port 30000 --replSet "demo"

@checkaayush
checkaayush / Postman.desktop
Created November 14, 2017 11:08 — forked from aviskase/Postman.desktop
Install Postman
[Desktop Entry]
Encoding=UTF-8
Name=Postman
Exec=postman
Icon=/opt/Postman/resources/app/assets/icon.png
Terminal=false
Type=Application
Categories=Development;
@checkaayush
checkaayush / vscodeUserSettings.json
Last active January 17, 2018 09:31
My VSCode User Settings
{
"editor.tabSize": 2,
"workbench.colorTheme": "Monokai",
"editor.fontFamily": "'DejaVu Sans Mono', 'Courier New', monospace, 'Droid Sans Fallback'",
"window.zoomLevel": 0,
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
@checkaayush
checkaayush / Makefile
Last active May 30, 2019 10:54
Makefile to setup MongoDB Replica Set for development
# Setup local MongoDB Replica Set for development.
DB_ROOT ?= /tmp
DB1_PATH ?= ${DB_ROOT}/db1
DB2_PATH ?= ${DB_ROOT}/db2
DB3_PATH ?= ${DB_ROOT}/db3
DB1_PORT ?= 30000
DB2_PORT ?= 40000
DB3_PORT ?= 50000
@checkaayush
checkaayush / pm2-ubuntu.service
Created January 23, 2018 10:43
PM2 systemd script
[Unit]
Description=PM2 process manager
Documentation=https://pm2.keymetrics.io/
After=network.target
[Service]
Type=forking
User=ubuntu
LimitNOFILE=infinity
LimitNPROC=infinity
@checkaayush
checkaayush / setup.py
Last active March 28, 2018 13:24
Sample setup.py
# Reference: https://github.com/pypa/sampleproject/blob/master/setup.py
from setuptools import setup, find_packages
def requirements():
"""Returns packages required by current project."""
reqs = []
with open('requirements.txt', 'r') as f:
for line in f:
@checkaayush
checkaayush / Dockerfile
Created March 30, 2018 15:12
Dockerfile for Python Hug Based Applications served using gunicorn
FROM python:3.6-slim
LABEL maintainer="Aayush Sarva" email="[email protected]"
WORKDIR /usr/src/app
COPY ./requirements.txt /usr/src/app
RUN pip install --no-cache-dir -r requirements.txt
COPY . /usr/src/app
EXPOSE 5000
CMD gunicorn -b :5000 --timeout 300 <path_to_hug_api>:__hug_wsgi__
@checkaayush
checkaayush / .gitignore
Created April 2, 2018 10:54
Python project .gitignore file
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
@checkaayush
checkaayush / server.go
Created October 24, 2018 07:58
Simple HTTP API in Golang
package main
import (
"fmt"
"log"
"net/http"
"os"
)
// main starts an HTTP server listening on $PORT which dispatches to request handlers.
@checkaayush
checkaayush / myip.go
Last active November 25, 2018 12:06
Get your public and private IP addresses with one command
// Utility to get your public and private IP addresses
// Usage:
// 1. Run: go build -o myip myip.go
// 2. Add the executable myip to your PATH
// 3. Run: myip
package main
import (
"fmt"