Skip to content

Instantly share code, notes, and snippets.

View 247software-sanket-gandhi's full-sized avatar
👨‍💻

Sanket Gandhi 247software-sanket-gandhi

👨‍💻
View GitHub Profile
@247software-sanket-gandhi
247software-sanket-gandhi / batch_export.sh
Created April 1, 2023 13:32 — forked from EyalAr/batch_export.sh
Shell script to easily export mongo collections into JSON files
#!/usr/bin/env bash
#https://gist.github.com/EyalAr/67791f51fce51ed55594
COLLECTIONS=()
HOST="127.0.0.1"
PORT="27017"
DB=
if [ -n "$1" -a "$1" = "--help" ]
@247software-sanket-gandhi
247software-sanket-gandhi / mongoexport.sh
Created April 1, 2023 13:31
Mongo exports all collections of a database into JSON
#!/bin/bash
HOST="127.0.0.1"
PORT="27017"
DB_NAME="dev"
# get a list of all collections in the database
collections=$(mongosh --host $HOST:$PORT --eval "db.getCollectionNames().join('\n')" --quiet $DB_NAME)
echo $collection
@247software-sanket-gandhi
247software-sanket-gandhi / es-cheat-sheet.md
Created February 2, 2021 14:44 — forked from fdv/es-cheat-sheet.md
An ElasticSearch management cheat sheet

These are the snippets I use most of the time when administrating my ES cluster

To be updated

Settings to change before you do something

Before restarting a data node

curl -XPUT 'http://escluster:9200/_cluster/settings' -d '{
@247software-sanket-gandhi
247software-sanket-gandhi / Myapp.php
Created September 2, 2020 17:53 — forked from stevethomas/Myapp.php
Example of how to extend Lumen monolog implementation for New Relic and potentially other handlers
<?php namespace Foo;
// app/Myapp.php
use Monolog\Logger;
use Laravel\Lumen\Application;
use Monolog\Handler\StreamHandler;
use Monolog\Formatter\LineFormatter;
use Monolog\Handler\NewRelicHandler;
class Myapp extends Application
@247software-sanket-gandhi
247software-sanket-gandhi / php-nginx.md
Last active August 3, 2024 07:17
Ubuntu 18.04 - Install PHP 7.2, PHP-FPM 7.2, Nginx

Install NGINX

# Install software-properties-common package to give us add-apt-repository package
sudo apt-get install -y software-properties-common

# Install latest nginx version from community maintained ppa
sudo add-apt-repository ppa:nginx/stable

# Update packages after adding ppa
@247software-sanket-gandhi
247software-sanket-gandhi / openssh-7.3.sh
Created August 12, 2019 14:41 — forked from stefansundin/openssh-7.3.sh
Install OpenSSH 7.3 in Ubuntu 16.04
$ ssh -V
OpenSSH_7.2p2 Ubuntu-4ubuntu2.1, OpenSSL 1.0.2g 1 Mar 2016
wget https://launchpadlibrarian.net/277739251/openssh-client_7.3p1-1_amd64.deb
wget https://launchpadlibrarian.net/298453050/libgssapi-krb5-2_1.14.3+dfsg-2ubuntu1_amd64.deb
wget https://launchpadlibrarian.net/298453058/libkrb5-3_1.14.3+dfsg-2ubuntu1_amd64.deb
wget https://launchpadlibrarian.net/298453060/libkrb5support0_1.14.3+dfsg-2ubuntu1_amd64.deb
sudo dpkg -i libkrb5support0_1.14.3+dfsg-2ubuntu1_amd64.deb
sudo dpkg -i libkrb5-3_1.14.3+dfsg-2ubuntu1_amd64.deb
sudo dpkg -i libgssapi-krb5-2_1.14.3+dfsg-2ubuntu1_amd64.deb
@247software-sanket-gandhi
247software-sanket-gandhi / php7-3.md
Last active January 4, 2020 07:30
Ubuntu 16.04 - Install PHP 7.3, PHP-FPM 7.3
# Add PHP 7.3 PPA

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update

# Install PHP 7.3 with basic modules 
sudo apt-get install php7.3 php7.3-cli php7.3-common php-pear php7.3-curl php7.3-dev php7.3-gd php7.3-mbstring php7.3-zip php7.3-mysql php7.3-xml php7.3-fpm libapache2-mod-php7.3 php7.3-imagick php7.3-recode php7.3-tidy php7.3-xmlrpc php7.3-intl
@247software-sanket-gandhi
247software-sanket-gandhi / install.sh
Created October 24, 2018 12:47 — forked from anhldbk/install.sh
Install Kong API Gateway on Ubuntu
sudo apt-get install netcat openssl libpcre3 dnsmasq procps perl
# for ubuntu 16.04 (xenial)
sudo apt-get -y install postgresql postgresql-contrib phppgadmin
sudo -i -u postgres
psql
CREATE USER kong; CREATE DATABASE kong OWNER kong;
ALTER USER kong WITH password 'kong';

Folder Structure

Motivations

  • Clear feature ownership
  • Module usage predictibility (refactoring, maintainence, you know what's shared, what's not, prevents accidental regressions, avoids huge directories of not-actually-reusable modules, etc)