Skip to content

Instantly share code, notes, and snippets.

View sumitsahoo's full-sized avatar
👨‍💻
Architecting…

Sumit Sahoo sumitsahoo

👨‍💻
Architecting…
View GitHub Profile
@sumitsahoo
sumitsahoo / add-to-github.sh
Created September 4, 2025 07:33
Add existing repository to GitHub
#!/bin/bash
# ==============================================================================
# A simple script to link a local Git repository to a new remote on GitHub
# and push the initial 'main' branch.
#
# INSTRUCTIONS:
# 1. Make sure you have initialized a Git repository (`git init`).
# 2. Add and commit your files (`git add .` and `git commit -m "Initial commit"`).
# 3. Replace the URL with your own repository's URL.
@sumitsahoo
sumitsahoo / brew_upgrade.sh
Created September 2, 2025 07:55
Greedy Brew upgrade
brew update && brew upgrade --greedy && brew cleanup
@sumitsahoo
sumitsahoo / kill_transaction.sql
Created February 7, 2025 05:30
Kill a db transaction in PostgreSQL
-- Find in progress transactions
SELECT *
FROM pg_stat_activity
WHERE state = 'idle in transaction'
AND pid <> pg_backend_pid()
AND query LIKE '%<table_name>%';
-- Kill process
@sumitsahoo
sumitsahoo / react_https_guide_macos.md
Last active October 14, 2024 14:15
Run react app as HTTPS localhost

Make sure openssl is installed

brew install openssl

Generate cert and key

openssl req -x509 -newkey rsa:4096 -keyout cert.key -out cert.crt -sha256 -days 3650 -nodes -subj "/C=XX/ST=YOUR_STATE/L=YOUR_LOCATION/O=YOUR_COMPANY/OU=YOUR_ORG/CN=YOUR_DOMAIN"
@sumitsahoo
sumitsahoo / create_macos_usb.sh
Last active October 30, 2024 08:10
Create bootable macOS USB drive
# Change macOS image name and USB drive name
# USB formatted as Mac OS Extended (Journaled) and choose GUID Partition Map as the Scheme.
sudo /Applications/Install\ macOS\ Sequoia.app/Contents/Resources/createinstallmedia --volume /Volumes/Sequoia
# Press and hold power button for boot menu (Apple Silicon)
@sumitsahoo
sumitsahoo / load_env.sh
Created March 29, 2024 14:50
Load .env variables in zsh
set -a; source .env; set +a
@sumitsahoo
sumitsahoo / set_git_user.sh
Last active July 15, 2024 09:10
Set local git user name and email
git config --local user.name "Sumit Sahoo"
git config --local user.email "[email protected]"
@sumitsahoo
sumitsahoo / settings.json
Created May 28, 2023 15:23
Set VS Code terminal font
"terminal.integrated.fontSize": 13,
"terminal.integrated.fontFamily": "'MesloLGS NF','JetBrains Mono', Menlo, Monaco, 'Courier New', monospace",
@sumitsahoo
sumitsahoo / remove_dock_delay.sh
Last active May 19, 2023 17:49
Remove dock delay in macOS
# Remove delay
defaults write com.apple.dock autohide -bool true && defaults write com.apple.dock autohide-delay -float 0 && defaults write com.apple.dock autohide-time-modifier -float 0 && killall Dock
# Faster animation
# defaults write com.apple.dock autohide -bool true && defaults write com.apple.dock autohide-delay -float 0 && defaults write com.apple.dock autohide-time-modifier -float 0.65 && killall Dock
# Revert back
# defaults delete com.apple.dock autohide && defaults delete com.apple.dock autohide-delay && defaults delete com.apple.dock autohide-time-modifier && killall Dock
@sumitsahoo
sumitsahoo / delete_android_studio.sh
Last active July 28, 2021 17:12
Delete Android Studio (Mac)
# Deletes the Android Studio application
# Note that this may be different depending on what you named the application as, or whether you downloaded the preview version
rm -Rf /Applications/Android\ Studio.app
# Delete All Android Studio related preferences
# The asterisk here should target all folders/files beginning with the string before it
rm -Rf ~/Library/Preferences/AndroidStudio*
rm -Rf ~/Library/Preferences/Google/AndroidStudio*
# Deletes the Android Studio's plist file
rm -Rf ~/Library/Preferences/com.google.android.*
# Deletes the Android Emulator's plist file