Skip to content

Instantly share code, notes, and snippets.

@saedx1
saedx1 / qq
Created March 5, 2023 12:46
Quick (Q)commit (qq)
#!/bin/sh
## Usage: qq here is my commit message
## Note: you don't need to quote your commit message since we are using "$*"
## If you have untracked files, you can add those before running the script, or modify it to add them by default
git add -u
git commit -m "$*"
git push -u origin "$(git branch --show-current)"
@saedx1
saedx1 / clone.sh
Created February 5, 2023 22:54
Clone ECR Repositories Between Accounts
!#/bin/bash
## INPUT ENV VARS: SRC_ACCOUNT_PROFILE, DST_ACCOUNT_PROFILE, SRC_ECR_REGISTRY_URI, DST_ECR_REGISTRY_URI
for i in $(aws ecr describe-repositories --profile $SRC_ACCOUNT_PROFILE --query 'repositories[:].repositoryName' --output text)
do
echo "Started $i..."
echo "Creating $i..."
aws ecr create-repository --profile $DEST_ACCOUNT_PROFILE --repository-name $i
for j in $(aws ecr describe-images --profile $SRC_ACCOUNT_PROFILE --repository-name $i --query 'sort_by(imageDetails,& imagePushedAt)[:].imageTags[0]' --output text)
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CACHE_HOME="$HOME/.cache"
export XINITRC="${XDG_CONFIG_HOME}/x11/xinitrc"
export ZDOTDIR="${XDG_CONFIG_HOME}/zsh"
export HISTFILE="${XDG_DATA_HOME}/history"
export DOTNET_ROOT=$HOME/.dotnet
export PATH=$HOME/scripts:$PATH
#!/usr/bin/python
from datetime import datetime, timedelta
import json
from pathlib import Path
import os
import requests
def parse_time(txt):
@saedx1
saedx1 / stop_rds.sh
Created September 2, 2021 15:55
Stops all Running RDS Instances & Clusters in an AWS Region
export AWS_PAGER=""
export AWS_REGION="us-west-2"
output=$(aws rds describe-db-instances)
rds_instances=$(echo $output | jq -r '.DBInstances[] | select((.DBInstanceStatus == "available") and (.DBClusterIdentifier == null) ) | .DBInstanceIdentifier')
rds_clusters=$(echo $output | jq -r '.DBInstances[] | select((.DBInstanceStatus == "available") and (.DBClusterIdentifier != null) ) | .DBClusterIdentifier')
for x in $rds_instances; do
printf "Stopping RDS instance $x\n"
aws rds stop-db-instance --db-instance-identifier $x
@saedx1
saedx1 / language_switch.sh
Created August 3, 2021 12:50
switching keyboard layout/language
# This is the script I use to switch my keyboard layout in linux (artix). I then assign it to the keyboard shortcut I want.
# This example uses `ar` and `us`. You can add more than two and change those as well.
lang1=ar
lang2=us
(setxkbmap -query | grep -q "layout:\s\+$lang2") && setxkbmap $lang1 || setxkbmap $lang2
@saedx1
saedx1 / arm_1.py
Last active August 3, 2021 12:53
Association Rule Mining
import pandas as pd
# Load the dataset
movies = pd.read_csv("data/Movies.tsv", sep="\t")
ratings = pd.read_csv("data/Ratings.tsv", sep="\t")
#Create a mapping between id and title
idx2title = {int(row["movieId"]): row["title"] for _, row in movies.iterrows()}
title2idx = {j: i for i, j in idx2title.items()}