Skip to content

Instantly share code, notes, and snippets.

View akumbhani66's full-sized avatar
🎯
Focusing

Ashvin Kumbhani akumbhani66

🎯
Focusing
View GitHub Profile
@akumbhani66
akumbhani66 / encrypt-decrypt.html
Created June 2, 2024 08:56
Encrypt the file before uploading it to AWS S3 and decrypt it after downloading it from aws s3.
<!DOCTYPE html>
<html>
<head>
<title>File Encryption/Decryption</title>
</head>
<body>
<h1>File Encryption/Decryption</h1>
@akumbhani66
akumbhani66 / change-author.sh
Created October 11, 2022 08:02
change author of commit
git config --global user.email abc@abc.com
git rebase -i --root
git commit --amend --reset-author --no-edit && git rebase --continue
git push -f
@akumbhani66
akumbhani66 / clone-all
Created September 4, 2022 06:48
clone all the repos under organization/username
#!/bin/bash
# Usage: clone_all_repos.sh [organization] <output directory>
# Make sure you set GITHUB_TOKEN. export GITHUB_TOKEN=my_github_token"
ORG=$1
PER_PAGE=100
GIT_OUTPUT_DIRECTORY=${2:-"/tmp/${ORG}_repos"}
if [ -z "$GITHUB_TOKEN" ]; then
sudo pkill -f nginx & wait $!
sudo systemctl start nginx
@akumbhani66
akumbhani66 / db-basic-operations.md
Last active February 25, 2021 07:41
A simple demo for database operation. In general and used GO for tooling.

Basic database Operations

  1. Migrations
  2. Seeders
  3. Scripts

Migrations

Why migrations?

To revise existing structure of table To add new DB Table > To Delete existing Table

@akumbhani66
akumbhani66 / dump-sql-to-tsv.sh
Created December 13, 2020 06:02
Dump entire db to tsv/csv
#!/bin/bash
host=host
uname=uname
pass=pwd
port=port
db=db
@akumbhani66
akumbhani66 / pm2-ecosystem.config.js
Created September 25, 2020 05:54
sample pm2 ecosystem config
module.exports = {
apps: [
{
name: 'node-server',
script: './bin/www',
error_file: './logs/err.log',
out_file: './logs/out.log',
time: true,
log_date_format: 'YYYY-MM-DD HH:mm Z',
watch: false,
#vim mysqlbackupS3.sh
#!/bin/bash
DB_NAME="faprod"
TSTAMP=$(date +"%d-%b-%Y-%H-%M-%S")
S3BUCKET="s3://sfo2.digitaloceanspaces.com"
#logging
LOG_ROOT="./dump.log"
#Dump of Mysql Database into S3\
echo "$(tput setaf 2)creating backup of database start at $TSTAMP" >> "$LOG_ROOT"
@akumbhani66
akumbhani66 / closure.js
Created July 29, 2020 08:09
Simple closure example
function getCounter() {
let counter = 0;
return function () {
counter = 1;
return function () {
return counter = 2;
}
}
}
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;