Skip to content

Instantly share code, notes, and snippets.

View rams3sh's full-sized avatar

Ram rams3sh

View GitHub Profile
@rams3sh
rams3sh / rds_log_downloader.py
Last active February 16, 2024 05:19
Basic python script that supports downloading the RDS logs and solves the partial download issue faced in boto and CLI. Issue Ref: https://github.com/aws/aws-cli/issues/2268
"""
Craft a web request to the AWS rest API and hit an endpoint that actually works but isn't supported in the boto3 or AWS CLI
Based on https://gist.github.com/andrewmackett/5f73bdd29aeed4728ecaace53abbe49b
Usage :- python3 rds_log_downloader.py --region <region> --db <db_name> --logfile <log_file_to_download> --output <output_file_path>
Note:-
The above command also supports profile. You can pass profile name using --profile or -p paramater. It's an optional parameter though.
@rams3sh
rams3sh / aws_regex_cheat_sheet
Last active February 28, 2024 14:06
Common AWS Related Regex (AWS)
ARN Base Pattern :-
arn:<aws_parition>:<aws_service>:[<aws_region>]:<account_id>:<root | resource_type>:/<resource_name>[/<sub_resource_names>...]
i. <aws_partition>
Regex - (aws|aws-us-gov|aws-cn)
ii. <aws_service> - No fixed pattern
iii. <aws_region> - No fixed pattern
Most of the regions occur in combination of 2 letter followed by "-" followed by a combination of direction based word , followed by a "-" and then a digit.
@rams3sh
rams3sh / image2rgb.py
Created July 3, 2018 12:16
image2rgb - Extracts rgb values from a given image and outputs in same height x width format.
#Source : https://stackoverflow.com/a/33630650
import Image
photo = Image.open('art.png') #your image
photo = photo.convert('RGB')
width = photo.size[0] #define W and H
height = photo.size[1]
widthtext=""
for y in range(0, height): #each pixel has coordinates
@rams3sh
rams3sh / tweet_parser.py
Created July 2, 2018 05:39
Tweet Parse using Selenium without Twitter API. Solves the problem of not being able to retrieve the entire set of tweets for an account due to scrolling issue.
#Depends on selenium package for python, selenium chrome driver, google-chrome / chrome browser
import os
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
import selenium.webdriver.support.ui as ui
from selenium.webdriver.common.by import By
#Download Chromium Driver for Selenium and place it in class path before executing this program (Link :- https://www.seleniumhq.org/download/)