Skip to content

Instantly share code, notes, and snippets.

@sestok
sestok / shoot_the_man.py
Created April 5, 2024 00:32
Guess the number or the man will be shot in your terminal!
import random
from colorama import Fore, Style, init
init() # Initializes colorama
def draw_scenario(distance, attempts_left):
if attempts_left == 0:
print(Fore.RED + "\n💥 BANG! The man was shot." + Style.RESET_ALL)
else:
print("\nTwo men stand facing each other.")
@sestok
sestok / ecs.sh
Created March 11, 2023 11:07
Add a manually launched EC2 instance into ECS Cluster
#!/bin/bash
echo ECS_CLUSTER=ecs-cluster-name> /etc/ecs/ecs.config
AWSTemplateFormationVersion: "2010-09-09"
Transform: "AWS::Serverless-2016-10-31"
Description: AWS
Parameters:
pPrivateSubnetId1:
Description: AWS RDS Global DB subnet 1 Goupd Id
Type: String
pPrivateSubnetId2:
AWSTemplateFormatVersion: "2010-09-09"
Resources:
VPC:
Type: AWS::EC2::VPC
Properties:
CidrBlock: 10.0.0.0/16
EnableDnsHostnames: true
Tags:
- Key: Name
Value: !Sub 'VPC - ${AWS::StackName}'
@sestok
sestok / gist:b58e4dfcc788c718cbd66959fa749abf
Created August 26, 2022 18:36
Creating a Kubernetes Cluster on AWS with kops
curl -Lo kops https://github.com/kubernetes/kops/releases/download/$(curl -s https://api.github.com/repos/kubernetes/kops/releases/latest | grep tag_name | cut -d '"' -f 4)/kops-darwin-amd64
chmod +x ./kops
sudo mv ./kops /usr/local/bin/
@sestok
sestok / remove-listener.js
Created April 17, 2022 19:20
Avoid [Memory Leaks] in React by removing Listerners when unmounting components
useEffect(() => {
window.addEventListener("scroll", handleKeyUp);
return () => {
window.removeEventListener("scroll", handleKeyUp);
}
}, []);