Skip to content

Instantly share code, notes, and snippets.

View bhalothia's full-sized avatar
🛠️
Building something cool. ;)

Virendra Singh Bhalothia bhalothia

🛠️
Building something cool. ;)
View GitHub Profile

I've been working with Apache Kafka for over 7 years. I inevitably find myself doing the same set of activities while I'm developing or working with someone else's system. Here's a set of Kafka productivity hacks for doing a few things way faster than you're probably doing them now. 🔥

Get the tools

@rdump
rdump / kubectl-multi-version-brews.md
Last active April 4, 2024 15:20
kubectl multi-version brews (kubernetes-cli formula)

kubectl multi-version brews

Applicability

The instructions below apply to older versions of Homebrew which still provide switch capability.

For current Homebrew, you'll likely need to keep Versions around, and build locally. Here's my versions repository https://github.com/rdump/homebrew-versions

MacPorts is now keeping versioned installations available as well, by default.

@darrenrogan
darrenrogan / AWS remove delete markers from S3
Created October 16, 2018 22:54
AWS CLI to remove delete markers (to enable the deletion of the S3 bucket)
aws s3api delete-objects --bucket bucket-name --delete "$(aws s3api list-object-versions --bucket "bucket_name" --output=json --query='{Objects: DeleteMarkers[].{Key:Key,VersionId:VersionId}}')"
@nathanmalishev
nathanmalishev / createAndExecuteRoles.yaml
Last active January 25, 2019 17:19
A set of policies, used to create an initial ci user
Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- 'cloudformation:CreateChangeSet'
- 'cloudformation:DescribeChangeSet'
- 'cloudformation:ExecuteChangeSet'
- 'cloudformation:DescribeStacks'
Resource:
- 'arn:aws:cloudformation:<region>:<account_no>:stack/<roles_permission_stack_name>/*'
@bwhaley
bwhaley / peer_routes.py
Last active October 6, 2021 17:18
A script to configure routes in in a VPC peering connection
# Quick script to configure routes for a VPC peering connection
# Searches a region for all peering connection and prompts to choose one
# Configures routes between the peered networks for all routing tables
# STS/AssumeRole not implemented cross-account peering. Instead,
# Choose accepter/requestor depending on which credentials are set in the environment
# Enter either IPv4 and IPv6 route destinations
# Example usage:
# ( Assuming boto credentials are configured)
# $ pip install boto3
# $ python3.6 peer_routes.py
@ivawzh
ivawzh / ALB-template.yaml
Created February 24, 2017 01:38
Stand alone ALB Cloudformation setup. For ECS service to consume.
Resources:
# ============================ Application Load Balancer ============================
LoadBalancer:
Type: AWS::ElasticLoadBalancingV2::LoadBalancer
Properties:
Name: !Ref AWS::StackName
Scheme: internet-facing
Subnets: !Split
@nmarley
nmarley / dec.py
Last active August 8, 2023 13:55
AWS KMS encryption/decryption using Python/Boto3
import boto3
import base64
if __name__ == '__main__':
session = boto3.session.Session()
kms = session.client('kms')
encrypted_password = 'AQECAHjgTiiE7TYRGp5Irf8jQ3HzlaQaHGYgsUJDaavnHcFm0gAAAGswaQYJKoZIhvcNAQcGoFwwWgIBADBVBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDDwxVQuG0oVwpkU7nQIBEIAoVGk1/wpserb+GVUOzE7PiL/Nr9fTDFKZfpKpF0ip2ct4B2q0Wn6ZZw=='
binary_data = base64.b64decode(encrypted_password)
import os
import boto.utils
import boto3
import requests
import datetime
import time
def get_contents(filename):
@vasanthk
vasanthk / System Design.md
Last active April 26, 2024 18:05
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?