Skip to content

Instantly share code, notes, and snippets.

View gtarun's full-sized avatar
💭
Busy changing the world

Tarun Gupta gtarun

💭
Busy changing the world
View GitHub Profile
@gtarun
gtarun / README.md
Created September 7, 2023 10:15 — forked from piyushgarg-dev/README.md
Kafka Crash Course
@gtarun
gtarun / index.js
Created January 19, 2021 09:17
OG_JWT.md
const TOKEN_SECRET="7bc78545b1a3923cc1e1e19523fd5c3f20b409509";
const jwt = require("jsonwebtoken");
const request = require("request");
let usernam = "gtarun";
let token = jwt.sign(username, TOKEN_SECRET, { expiresIn: '1800s' });
// Make an HTTP POST request
@gtarun
gtarun / dos.cmd
Created April 16, 2020 11:31
DDOS attack prevention
sudo apt-get install libapache2-mod-evasive
# edit Config
sudo nano /etc/apache2/mods-available/evasive.conf
sudo mkdir /var/log/mod_evasive
sudo chown :www-data /var/log/mod_evasive
sudo chmod 771 /var/log/mod_evasive
a2enmod evasive
# Redis configuration file example.
#
# Note that in order to read the configuration file, Redis must be
# started with the file path as first argument:
#
# ./redis-server /path/to/redis.conf
# Note on units: when memory size is needed, it is possible to specify
# it in the usual form of 1k 5GB 4M and so forth:
#
@gtarun
gtarun / node-setup-pm2-nginx.md
Last active August 8, 2018 05:55 — forked from tomysmile/node-setup-pm2-nginx.md
Setup NodeJS Production with PM2, Nginx in Ubuntu 16.04

How To Set Up a Node.js Application for Production on Ubuntu 16.04

with PM2 & Nginx

Create User

as a root, run below commands on server:

# adduser tomy
@gtarun
gtarun / heroku_config.txt
Last active August 7, 2023 21:55
Heroku copy config vars from one app to another app
FYI much quicker to set them all in one heroku config:set a=b c=d etc
If you prefer a manual review and you do have bash/zsh:
heroku config -s -a source-heroku-app > config.txt
Now review config.txt and remove any unwanted config lines
cat config.txt | tr '\n' ' ' | xargs heroku config:set -a target-heroku-app
@gtarun
gtarun / MANUAL.md
Created April 6, 2018 07:24 — forked from s-lyn/MANUAL.md
Deploy nodejs app with gitlab.com and pm2

Deploy nodejs app with gitlab.com and pm2

This manual is about setting up an automatic deploy workflow using nodejs, PM2, nginx and GitLab CI. It is tested on:

  • Target server: Ubuntu 16.04 x64. This is suitable for Ubuntu 14.x.
  • Windows 10 on my PC to work.
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
@gtarun
gtarun / nginx.conf
Created August 9, 2017 17:46 — forked from turtlesoupy/nginx.conf
node.js upstream nginx config
http {
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m;
proxy_temp_path /var/tmp;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_comp_level 6;
@gtarun
gtarun / swagger.yml
Created June 19, 2017 12:59
og-public-api
swagger: "2.0"
info:
version: v1
title: Outgrow Public API
host: api.outgrow.co
basePath: /api/v1
schemes:
- https
- http
consumes: