Skip to content

Instantly share code, notes, and snippets.

View anilshrish's full-sized avatar
🎯
Focusing

Anil Shrish anilshrish

🎯
Focusing
View GitHub Profile
@anilshrish
anilshrish / tmux-cheatsheet.markdown
Created February 13, 2022 17:05 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@anilshrish
anilshrish / Main.tf
Created November 17, 2020 12:43 — forked from PrashantBhatasana/Main.tf
Terraform -  AWS VPC with Private, Public Subnets with NAT
/*==== The VPC ======*/
resource "aws_vpc" "vpc" {
cidr_block = "${var.vpc_cidr}"
enable_dns_hostnames = true
enable_dns_support = true
tags = {
Name = "${var.environment}-vpc"
Environment = "${var.environment}"
}
}
@anilshrish
anilshrish / git_migrate_repo.md
Created November 4, 2020 11:23
git migrate repo | migrate git repo to AWS codecommit

Clone git repo

git clone --mirror https://github.com/miztiik/lex-faq-bot.git __tmp
cd  __tmp

Git push to repo1

git push https://github.com/anilshrish/lex-faq-bot1.git --all
git push https://github.com/anilshrish/lex-faq-bot1.git --tags
@anilshrish
anilshrish / networking.ipynb
Last active July 22, 2020 07:01
Networking - using python to find ips in CIDR and find CIDR for IP ranges
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@anilshrish
anilshrish / superset.sql
Last active July 7, 2020 07:51
Apache Superset - assign user role through DB
-- # users table
SELECT * FROM ab_user;
-- # role table
SELECT * FROM ab_role;
-- # user and role mapping
SELECT * FROM ab_user_role;
-- # update role_id for user
@anilshrish
anilshrish / terraform_duplicate.sh
Created July 2, 2020 15:08
terraform duplicate the infrastructure
#!/bin/bash
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
alias gsed=sed
fi
NEW_PATTERN="_v2"
# find . -type f -exec gsed -i '/^data /s/" {/_v2" {/' {} +
# find . -type f -exec gsed -i '/^resource /s/" {/_v2" {/' {} +
find . -type f -exec gsed -i "/^data /s/\" {/${NEW_PATTERN}\" {/" {} +
@anilshrish
anilshrish / teams-chat-post.sh
Created May 19, 2020 08:12 — forked from chusiang/teams-chat-post.sh
Post a message to Microsoft Teams with bash script.
#!/bin/sh
# =============================================================================
# Author: Chu-Siang Lai / chusiang (at) drx.tw
# Filename: teams-chat-post.sh
# Modified: 2018-03-28 15:04
# Description: Post a message to Microsoft Teams.
# Reference:
#
# - https://gist.github.com/chusiang/895f6406fbf9285c58ad0a3ace13d025
#

mdadm

Glossary:

  • md: multiple devices
command description
cat /proc/mdstat show status of all raids
mdadm --detail /dev/md0 detailed status of raid md0
@anilshrish
anilshrish / retry.py
Created April 8, 2020 10:55 — forked from FBosler/retry.py
retry.py
from functools import wraps
import time
import logging
import random
logger = logging.getLogger(__name__)
def retry(exceptions, total_tries=4, initial_wait=0.5, backoff_factor=2, logger=None):
"""