Skip to content

Instantly share code, notes, and snippets.

View amzar96's full-sized avatar
😍
WFH

Amzar amzar96

😍
WFH
View GitHub Profile
@amzar96
amzar96 / README.md
Last active October 17, 2024 01:58
text to comma-separated string converter (sh file)

Text to Comma-Separated String Converter

Setup

  1. Ensure Python is installed on your system.
  2. Save convert-text-list.py and convert-to-list.sh in the same directory.
  3. Make the bash script executable:
    chmod +x convert-to-list.sh
    
@amzar96
amzar96 / .zshrc
Created September 23, 2024 04:55
Display current AWS SSO account name in zsh prompt
function awslogin() {
local profile_name=$1
aws sso login --profile $profile_name
export AWS_PROFILE_NAME=$profile_name
echo change the AWS_PROFILE_NAME to $profile_name
}
RPROMPT='%{$fg[cyan]%}%* %{$fg[yellow]%}($AWS_PROFILE_NAME)%{$reset_color%}'
@amzar96
amzar96 / s3-download.sh
Created May 16, 2024 06:22
Download S3 using CLI
datelist=('20240501' '20240502' '20240503' '20240504')
for date in "${datelist[@]}"; do
mkdir -p "/Users/mohdamzar96/Downloads/$date"
aws s3 sync "s3://bucket-name/by-date/$date/" "/Users/mohdamzar96/Downloads/$date"
done
@amzar96
amzar96 / restart-podman.sh
Created May 16, 2024 04:12
Restart podman
unset SSH_AUTH_SOC && \
podman machine stop && \
podman machine set --cpus 4 --memory 3048 && \
podman machine start && \
podman image ls
@amzar96
amzar96 / views.py
Created December 5, 2023 01:09
Pagination with Django Ninja
'''
Credit to https://github.com/vitalik/django-ninja/issues/104#issuecomment-805939752 🔥
python '3.11.6'
django '4.2.7'
ninja '1.0.1'
pydantic '2.5.2'
'''
from ninja import Router
@amzar96
amzar96 / main.tf
Created September 14, 2023 18:18
Terraform - S3 Creation
terraform {
cloud {
organization = "xxxx"
workspaces {
name = "s3-creation"
}
}