Skip to content

Instantly share code, notes, and snippets.

View Burekasim's full-sized avatar

Avi Keinan Burekasim

  • DoiT International
  • Israel
  • 10:00 (UTC +03:00)
View GitHub Profile
@Burekasim
Burekasim / route53-price-update-april8th.csv
Last active March 12, 2024 17:51
a csv table of the new pricing for domain renewals
TLD renewal price until April 8th Renewal price starting April 8th Price difference in USD price difference in %
com $13.00 $14.00 $1.00 7.69%
net $11.00 $15.00 $4.00 36.36%
org $12.00 $14.00 $2.00 16.67%
furniture $47.00 $114.00 $67.00 142.55%
creditcard $141.00 $179.00 $38.00 26.95%
reviews $22.00 $57.00 $35.00 159.09%
careers $35.00 $66.00 $31.00 88.57%
fm $92.00 $121.00 $29.00 31.52%
@Burekasim
Burekasim / CloudFormation-GrantAccessToBilling.json
Created July 17, 2023 15:39
CloudFormation Grant Access To Billing
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"ExternalAssumeRole": {
"Type": "AWS::IAM::Role",
"Properties": {
"RoleName": "DoiT-Billing-Access",
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
@Burekasim
Burekasim / ssm_ssh_wrapper.py
Created February 28, 2023 14:17
Simple (and convient) wrapper for AWS SSM - Connect to your EC2 instances with port 22 without annoying warning/erros
#!/usr/local/bin/python3
import argparse
import botocore.exceptions
import socket
import random
import shlex
import boto3
import json
import os
@Burekasim
Burekasim / assume_role.py
Created December 28, 2022 09:39
AWS Assume role python
# assume role to the new account
import boto3
sts_client = boto3.client('sts')
assume_account_id = '0123456789012'
assume_role_name = 'role_name'
role_session_name = 'check_cost_explorer_script'
assumed_role_object = sts_client.assume_role(
RoleArn=f'arn:aws:iam::{assume_account_id}:role/{assume_role_name}',
RoleSessionName=role_session_name
)
@Burekasim
Burekasim / associate_elastic_ip.py
Created December 25, 2022 16:16
associate elastic ip for ec2 instances
#!/usr/bin/python36
import boto3
import requests
import os
def ec2_associate_eip(aws_instance, region_name, tag_name, tag_value):
client = boto3.client('ec2', region_name=region_name)
eip_list = client.describe_addresses(Filters=[{'Name': f'tag:{tag_name}', 'Values': [tag_value]}])
free_eips = []
@Burekasim
Burekasim / Ses-to-s3.py
Created November 22, 2022 19:27
Ses to sns to lambda to s3
import boto3
import json
from datetime import datetime
import email
from email import policy
def print_with_timestamp(*args):
print(datetime.utcnow().isoformat(), *args)
@Burekasim
Burekasim / reinvent_export_2022.py
Created October 12, 2022 07:27
Export reinvent 2022 sessions to Google Calendar
from datetime import datetime
import json
import pytz
def return_day(timestamp: str, local_timezone: str):
return datetime.fromtimestamp(int(timestamp/1000)).astimezone(pytz.timezone(local_timezone)).strftime(
'%m/%d/%Y')
@Burekasim
Burekasim / ssm-ssh.py
Created September 14, 2022 08:14
ssm port forwarder wrapper
#!/usr/local/bin/python3
import argparse
import botocore.exceptions
import socket
import random
import shlex
import boto3
import json
import os
@Burekasim
Burekasim / pdf_merger.py
Created August 10, 2022 12:26
Pdf merger (Regina 2000)
import datetime
from PyPDF2 import PdfFileMerger
import os
def get_pdf_files_from_current_folder(current_folder: str):
output_list = []
for item in os.listdir(current_folder):
if item.endswith('.pdf'):
output_list.append(item)
@Burekasim
Burekasim / mfa-token.py
Created June 28, 2022 09:13
MFA aws cli token generation
#!/usr/local/bin/python3
import configparser
import boto3
import pyotp
import keyring
if __name__ == '__main__':
try:
# mfa-secret - the name of secret in MacOS keychain access
mfa_token_secret = keyring.get_password("mfa-secret", "mfa-secret")