Skip to content

Instantly share code, notes, and snippets.

View hayderimran7's full-sized avatar

Imran Hayder hayderimran7

View GitHub Profile
@hayderimran7
hayderimran7 / disable.sh
Created April 6, 2023 05:20 — forked from mtunjic/disable.sh
Disable bunch of #$!@ in Catalina
#!/bin/bash
# IMPORTANT: Don't forget to logout from your Apple ID in the settings before running it!
# IMPORTANT: You will need to run this script from Recovery. In fact, macOS Catalina brings read-only filesystem which prevent this script from working from the main OS.
# This script needs to be run from the volume you wish to use.
# E.g. run it like this: cd /Volumes/Macintosh\ HD && sh /Volumes/Macintosh\ HD/Users/sabri/Desktop/disable.sh
# WARNING: It might disable things that you may not like. Please double check the services in the TODISABLE vars.
# Get active services: launchctl list | grep -v "\-\t0"
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents
@hayderimran7
hayderimran7 / python-regex.md
Created April 2, 2023 18:49
python regexes

python regex

chap1 : intro to regex

  • regex: Regular expressions are text patterns that define the form a text string should have.
    • useful for email checking patern
    • matching word "color" and "colour"
    • extra specific info like postal code LOL: "Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems."
@hayderimran7
hayderimran7 / Linux.md
Created April 2, 2023 18:48 — forked from borg-z/Linux.md
My linux snippets for RHCSA

AWK

Get users with uid > 1000

awk -F'[/:]' '{if ($3 >= 1000 && $3 != 65534) print $1}' /etc/passwd

Grep

Links:

@hayderimran7
hayderimran7 / admin_sys.md
Created April 2, 2023 18:38 — forked from raphaellarrinaga/admin_sys.md
Bash & admin sys commands

get ocid

/(ocid.*([a-z 0-9]{60})+)/

get part after ocid

/[a-z 0-9]{60}\.(.*)/
@hayderimran7
hayderimran7 / oci-cli-query-examples.md
Created March 31, 2023 18:05
OCI CLI filter results with query

"geting all policies in given tenancy with no freeform tags

policies=$(oci --profile BOAT-OC1 iam policy list --all -c $C --query 'data[?length("freeform-tags")==`0`].name'| jq -r "@sh" )

find number of total policies in compartment

oci --profile BOAT-OC1 iam policy list --all -c $C --query 'data.length(@)'

get list of all compartments

#################################
# Running Jenkins In Kubernetes #
# Tutorial And Review #
# https://youtu.be/2Kc3fUJANAc #
#################################
# Referenced videos:
# - GitHub CLI - How to manage repositories more efficiently: https://youtu.be/BII6ZY2Rnlc
# - Kaniko - Building Container Images In Kubernetes Without Docker: https://youtu.be/EgwVQN6GNJg
# - Kustomize - How to Simplify Kubernetes Configuration Management: https://youtu.be/Twtbg6LFnAg
@hayderimran7
hayderimran7 / FB-PE-InterviewTips.md
Created December 17, 2020 21:13 — forked from ameenkhan07/FB-PE-InterviewTips.md
Facebook Production Engineering Interview

What to Expect and Tips

• 45-minute systems interview, focus on responding to real world problems with an unhealthy service, such as a web server or database. The interview will start off at a high level troubleshooting a likely scenario, dig deeper to find the cause and some possible solutions for it. The goal is to probe your knowledge of systems at scale and under load, so keep in mind the challenges of the Facebook environment.
• Focus on things such as tooling, memory management and unix process lifecycle.

Systems

More specifically, linux troubleshooting and debugging. Understanding things like memory, io, cpu, shell, memory etc. would be pretty helpful. Knowing how to actually write a unix shell would also be a good idea. What tools might you use to debug something? On another note, this interview will likely push your boundaries of what you know (and how to implement it).

Design/Architecture 

Interview is all about taking an ambiguous question of how you might build a system and letting

@hayderimran7
hayderimran7 / deploy.md
Last active September 23, 2021 02:56
Automatically deploy GoDaddy External Secrets Controller for SSM/Secrets Manager in K8s with IAM role for service account
#!/bin/bash -xe
## SET BASIC VARIABLES
EKS_CLUSTER="dev-cluster"
IAM_ROLE_NAME=eksctl-$EKS_CLUSTER-iamserviceaccount-role
EXTERNAL_SECRETS_POLICY="kube-external-secrets"
#### CREATE POLICY TO ACCESS SSM/Secrets Manager
cat << EOF > policy.json
{
@hayderimran7
hayderimran7 / iam_role_jq_jmesqmatching.md
Last active November 21, 2023 07:36
get IAM Role matching a name using jq and aws cli

Intro

To use aws cli, its common to invoke built-in features like --filters and --query however they aren't avaiable for all the commands.

for my use case i wanted to get a role matching a name, i.e. regex pattern . that was very easy using jq

one-liner to get Role ARN of a role macthing name

if i want to get a role matching name eksctl-dev-cluster-addon-iamserviceaccount then to get ARN of that role is simply doing