Skip to content

Instantly share code, notes, and snippets.

View khaliqgant's full-sized avatar
💯
👨🏿‍💻

Khaliq khaliqgant

💯
👨🏿‍💻
View GitHub Profile
@khaliqgant
khaliqgant / install.bash
Created June 6, 2024 17:46
[NPM Install Alias] Install a npm package under an alias #npm #javascript
npm install nango@npm:@nangohq/cli@0.0.1-2e8ad3b5da52183bc8d2644594adcc52e3d1ad83
Installs the package nangohq/cli@0.0.1... under the alias nango
@khaliqgant
khaliqgant / info.sheet
Created January 6, 2023 13:11
[Google Sheet Currency Converter] Convert From One Currency To Another #googlesheets #nocode
=C8*GOOGLEFINANCE("CURRENCY:ILSUSD")
@khaliqgant
khaliqgant / action.yaml
Created January 5, 2023 19:02
[Github Action Commit Message] Trigger Deploy With Commit Message #githubaction #devops
"contains(github.event.head_commit.message, 'deploy!')"
# https://stackoverflow.com/questions/63619329/github-action-get-commit-message
@khaliqgant
khaliqgant / files.bash
Created December 29, 2022 12:51
[Git Large Files In Repository] See large git files in a repository #git #cli
git rev-list --objects --all |
git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' |
sed -n 's/^blob //p' |
sort --numeric-sort --key=2 |
cut -c 1-12,41- |
$(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest
# source https://stackoverflow.com/questions/10622179/how-to-find-identify-large-commits-in-git-history
@khaliqgant
khaliqgant / resize.bash
Created December 29, 2022 09:59
[EC2 Resize Instance] Resize Root & Data Volume #ec2 #aws
# mount temp
sudo mount -o size=10M,rw,nodev,nosuid -t tmpfs tmpfs /tmp
# Resize root volume, find correct name by running lsblk
sudo growpart /dev/nvme0n1 1
sudo resize2fs /dev/root
# Resize data volume
sudo resize2fs /dev/nvme1n1
@khaliqgant
khaliqgant / snip.py
Created November 18, 2022 08:20
[Django Output Query] Output Raw Query From A Queryset #django #python
print(queryset.query)
@khaliqgant
khaliqgant / issue.sh
Last active October 26, 2022 06:49
[Github CLI Create Issue] Create An Issue Using The Github CLI #github #cli
gh issue create --title "My new issue" --body "Here are more details." --assignee @khaliqgant --project "Web Development Sprint"
# the cli only supports classic projects for now: https://github.com/cli/cli/issues/4547
# docs: https://cli.github.com/manual/gh_issue_create
@khaliqgant
khaliqgant / cp.bash
Created October 22, 2022 04:39
[AWS CLI S3] Copy Files From Bucket To Bucket With SSE #aws #cli
aws s3 cp --sse AES256 s3://my-bucket/image/p_2/1647967203002.jpg s3://images-production/p_3/1647967203002.jpg
@khaliqgant
khaliqgant / upgrade.bash
Created September 11, 2022 18:11
[Kubernetes Upgrade Certificates] Manually Upgrade Kubernetes Certs #kubernetes #infrastructure
# check expiration
kubeadm alpha certs check-expiration
kubeadm alpha certs renew all
cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
# https://stackoverflow.com/questions/49885636/kubernetes-expired-certificate
@khaliqgant
khaliqgant / kill.sql
Last active May 2, 2024 07:47
[Postgres Kill Process] Kill A Process In Postgres #database #postgres
SELECT * FROM pg_stat_activity WHERE state = 'active';
SELECT pg_cancel_backend(<PID>);
SELECT pg_terminate_backend(<PID>);
-- kill all active except active one
SELECT pg_terminate_backend(pid)
FROM pg_stat_activity