Skip to content

Instantly share code, notes, and snippets.

View shivanshs9's full-sized avatar
🔥
Unlimited Code Works! ⚔️

Shivansh Saini shivanshs9

🔥
Unlimited Code Works! ⚔️
View GitHub Profile
@shivanshs9
shivanshs9 / rename-database.sql
Created April 16, 2020 11:15
Rename MySQL Database
DROP PROCEDURE IF EXISTS moveTables;
DROP PROCEDURE IF EXISTS renameDatabase;
DELIMITER $$
CREATE PROCEDURE moveTables(_schemaName varchar(100), _newSchemaName varchar(100))
BEGIN
DECLARE done INT DEFAULT FALSE;
DECLARE table_name VARCHAR(64);
DECLARE table_cursor CURSOR FOR SELECT information_schema.tables.table_name FROM information_schema.tables
WHERE information_schema.tables.table_schema = _schemaName;
@shivanshs9
shivanshs9 / gh_migrate_init.sh
Created September 1, 2023 10:31
Bitbucket to Github migration
#!/bin/bash
# How to use?
## bash gh_migrate_init.sh competition-service
GITHUB_ORG="coindcx-app"
JIRA="IDOPS-153"
SOURCE_FOLDER="coindcx-api-help"
prepare_repo() {
{
"description": "TheFaker NFT minted for DCX training",
"external_url": "https://shivanshs9.me",
"image": "https://avatars.githubusercontent.com/u/8217199?v=4",
"name": "TheFaker",
"attributes": []
}
@shivanshs9
shivanshs9 / caddyl4.Dockerfile
Last active December 31, 2023 15:32
Bastion for private EKS with Caddy reverse proxy
# syntax=docker/dockerfile:1
FROM golang:1.21-alpine AS builder
RUN apk add --no-cache git ca-certificates
RUN go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
RUN xcaddy build --with github.com/mholt/caddy-l4 --output /usr/bin/caddy && chmod +x /usr/bin/caddy
FROM alpine:3.15
RUN apk add --no-cache ca-certificates mailcap
RUN apk add bash
#!/bin/bash
set -e
# Function to display help
display_help() {
echo "Usage: $0 [options] org repo"
echo "Options:"
echo " -d, --default-branch BRANCH Set the default branch for the repository"
echo " -t, --teams TEAMS Set repository access permissions for specified teams"
echo " -j, --rule-json JSON Set ruleset for the repository"
@shivanshs9
shivanshs9 / gh_pr.sh
Created March 5, 2024 06:22
Approve/Raise/Check a Github PR
#!/bin/bash
set -e
# Function to display help
display_help() {
echo "Usage: $0 [command] [args]"
echo "Command:"
echo " approve Approves the specified PR in format of URL"
echo " create Creates a new PR from specified args"
echo "Options:"