Skip to content

Instantly share code, notes, and snippets.

View anilahir's full-sized avatar
🏠
Working from home

Anil Ahir anilahir

🏠
Working from home
View GitHub Profile
@anilahir
anilahir / mysql-docker.sh
Created August 14, 2021 05:43 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@anilahir
anilahir / DOCKER_COMPOSE.md
Created August 14, 2021 05:42 — forked from GabrielCzar/DOCKER_COMPOSE.md
Docker compose samples

Scripts to run specific services

@anilahir
anilahir / gist:3ac58e570106d919cedb5a5928d27bf4
Created June 26, 2021 06:00 — forked from jtdp/gist:5443297
See changes before pulling from remote git repository
# fetch the changes from the remote
git fetch origin
# show commit logs of changes
git log master..origin/master
# show diffs of changes
git diff master..origin/master
# apply the changes by merge..

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@anilahir
anilahir / drop-caches.sh
Created December 11, 2020 07:23
Ubuntu : clear ram-cache and swap
#!/bin/bash
su -c "sync; echo 3 > /proc/sys/vm/drop_caches && printf '\n%s\n' 'Ram-cache Cleared'" root
# su -c "sync; echo 3 > /proc/sys/vm/drop_caches && swapoff -a && swapon -a && printf '\n%s\n' 'Ram-cache and Swap Cleared'" root
@anilahir
anilahir / Robo3T-Installation-Menu.sh
Created December 11, 2020 07:16 — forked from chetanppatil/Robo3T-Installation-Menu.sh
robomongo 3t installtion and creating shortcut
#!/bin/bash
cd /tmp || exit
echo "Downloading Robomongo ..."
wget -q https://download.studio3t.com/robomongo/linux/robo3t-1.4.2-linux-x86_64-8650949.tar.gz
tar -xzf robo3t-1.4.2-linux-x86_64-8650949.tar.gz
rm robo3t-1.4.2-linux-x86_64-8650949.tar.gz
echo "Installing to opt..."
if [ -d "/opt/RoboMongo" ];then
sudo rm -rf /opt/RoboMongo
@anilahir
anilahir / webhook.gs
Last active December 4, 2020 07:24 — forked from lifehome/webhook.gs
Google Forms + Webhook : JSON example
var POST_URL = "http://localhost:3000";
function onFormSubmit(e) {
var data = {
"form": {
"id": e.source.getId(),
"title": e.source.getTitle() ? e.source.getTitle() : "Untitled Form",
"is_private": e.source.requiresLogin(),
"is_published": e.source.isAcceptingResponses(),
@anilahir
anilahir / terminal-git-branch-name.md
Created November 11, 2020 10:08 — forked from joseluisq/terminal-git-branch-name.md
Add Git Branch Name to Terminal Prompt (Linux/Mac)

Add Git Branch Name to Terminal Prompt (Linux/Mac)

image

Open ~/.bash_profile in your favorite editor and add the following content to the bottom.

# Git branch in prompt.

parse_git_branch() {
@anilahir
anilahir / PostgreSQL.md
Created October 12, 2020 15:30
PostgreSQL Installation & User Setup

Installation:

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install postgresql

Setup User:

@anilahir
anilahir / fail2ban.md
Created December 27, 2019 12:31
Fail2ban setup example
Fail2ban setup:
sudo apt install fail2ban -y
cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
systemctl start fail2ban (status|stop|restart)
systemctl enable fail2ban
fail2ban-client status
fail2ban-client status nginx-4xx

# Ban IP: