Skip to content

Instantly share code, notes, and snippets.

View dipanshuchaubey's full-sized avatar
:octocat:

Dipanshu Chaubey dipanshuchaubey

:octocat:
View GitHub Profile
@dipanshuchaubey
dipanshuchaubey / setup_lamp_server.md
Last active March 5, 2024 14:28
How to setup LAMP server on Linux

Installing LAMP server on Linux

Step by step guide to install LAMP server on Linux.

Installation

Use the terminal to execute these commands

Install Apache

@dipanshuchaubey
dipanshuchaubey / install_mongodb_on_ubuntu.md
Created June 17, 2019 15:01
Step by step guide to install MongoDB on Ubuntu

Install MongoDB on Ubuntu

Step by step guide to install MongoDB on Ubuntu.

1 > Installing MongoDB

First update the packages

$ sudo apt-get update
@dipanshuchaubey
dipanshuchaubey / ssh.md
Last active January 26, 2020 10:02
SSH into VM Instance without Private key

Step 1

SSH into instance using private key or shell provided by the cloud service provider.

Step 2

If you want to create a new user than run

$ sudo adduser username
$ sudo addpasswd username
@dipanshuchaubey
dipanshuchaubey / mysql.md
Last active January 28, 2020 17:14
Import, Export MySQL Database from Console

Importing a Database

To import a sql database using terminal, use this command:

$ mysql -u username -p -h localhost DATABASE_NAME < file_name.sql

Exporting a Database

To export a database, use the following command:

@dipanshuchaubey
dipanshuchaubey / phpMyAdmin_on_custom_port.md
Created February 3, 2020 16:34
Run phpMyAdmin on a custom port

Run phpMyAdmin On Custom Port

1. Make a virtual host for phpmyadmin

In /etc/apache2/sites-available/ directory create a new file named phpmyadmin.conf

$ sudo nano phpmyadmin.conf
@dipanshuchaubey
dipanshuchaubey / reverse_proxy.md
Created March 5, 2020 14:50
Nginx Reverse Proxy

Nginx Reverse Proxy

Unlink default configs

First, unlink the default configuration which shows Nginx Welcome page on port 80 using the command

path /etc/nginx/sites-enabled

$ sudo unlink default

INSTALL DOCKER CE ON LINUX

Install Prerequisite Packages (optional)

$ sudo apt install apt-transport-https ca-certificates curl software-properties-common

Add Docker GPG Key

@dipanshuchaubey
dipanshuchaubey / github_webhooks.js
Last active May 18, 2021 17:06
How to setup Github Webhooks using Node.js
const crypto = require('crypto')
const express = require('express')
const bodyParser = require('body-parser')
const app = express()
// To include rawBody in req parameter
app.use(bodyParser.json({
verify: (req, res, buf) => {
req.rawBody = buf
/**
* This script will traverse your filesystem and convert all
* Images to desired format.
*
* REQUIRED PARAMETERS
* 1. Source directory path.
* (This is the path from where images will be converted)
* 2. Output format. 'default = .jpg'
**/
@dipanshuchaubey
dipanshuchaubey / mysql_remote_access.md
Created July 16, 2021 17:59
Allow Remote Access to MySQL

Allow Remote Access to MySQL

Edit Configurations

First thing that needs to be done is to allow connections from all hosts to MySQL. mysqld.cnf file needs to updated as follows.

$ sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf