Skip to content

Instantly share code, notes, and snippets.

View fahadahammed's full-sized avatar
🎯
Focusing on Learning...

Fahad Ahammed fahadahammed

🎯
Focusing on Learning...
View GitHub Profile
@fahadahammed
fahadahammed / postman-linux-installer.sh
Created November 11, 2022 09:05
Install POSTMAN in linux Desktop
#!/bin/bash
#
# C: Fahad Ahammed
# Purpose: Install POSTMAN in linux Desktop
# D: 2022-11-11 14-36
#
if [ -z "$1" ]
then
read -p "Give the install directory:" INSTALL_DIRECTORY
@fahadahammed
fahadahammed / ssm_parameters_export_import.sh
Created September 27, 2022 14:43
AWS SSM Parameters Export and Import
#!/usr/bin/bash
#
# C: Fahad Ahammed
# N: AWS SSM Parameters Export and Import
# D: Tue Sep 27 08:18:05 PM +06 2022
aws_region="eu-west-1"
aws_profile="my_aws_profile"
whattodo=$1
{
"meta": {
"version": "1",
"type": "dashboard",
"name": "Temperature & Humidity via DHT22 Sensor-Template",
"description": "template created from dashboard: Temperature & Humidity via DHT22 Sensor"
},
"content": {
"data": {
"type": "dashboard",
---
# Source: opensearch/templates/networkpolicy.yaml
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: opensearch-cluster-master-opensearch-net
labels:
helm.sh/chart: opensearch-1.5.3
app.kubernetes.io/name: opensearch
app.kubernetes.io/instance: RELEASE-NAME
import boto3
ec2 = boto3.resource('ec2')
print("ID\tName\tInstanceType\tPublicIP\tState\t")
for instance in ec2.instances.all():
try:
InstanceName = [tag['Value'] for tag in instance.tags if tag['Key'] == 'Name'][0]
except Exception as ex:
InstanceName = None
rtrn = f"{instance.id}\t{InstanceName}\t{instance.instance_type}\t{instance.public_ip_address}\t{instance.state['Name']}\t"
print(rtrn)
# Project TrafficLoader is developed by Fahad Ahammed on 3/7/20, 11:12 AM.
#
# Last modified at 3/7/20, 11:10 AM.
#
# Github: fahadahammed
# Email: obak.krondon@gmail.com
#
# Copyright (c) 2020. All rights reserved.
from flask import Flask, request
def chunker(min_id, max_id, chunk_size):
list_of_number = list(range(min_id, max_id + 1))
"""Yield successive n-sized chunks from lst."""
for _oi in range(0, len(list_of_number), chunk_size):
yield list_of_number[_oi:_oi + chunk_size]
# Let you have 100 data in a list or tuple or array,
# But you want to use that data by chunk like 5 at a time or 10 at a time.
# This function will do that for you.
tmpFile="/tmp/jenkinsgitlabrokomarifilechanges.txt"
# All the files that changed in this build trigger to a temporary file
git diff --name-only $GIT_PREVIOUS_COMMIT $GIT_COMMIT > $tmpFile
# Which file extension to catch
to_find=".js .scss .css"
count=0
for i in $(echo $to_find | sed 's| |\n|g');
# Common Elements of list1 and list2
def common_elements(list1, list2):
return list(set(list1) & set(list2))
# minimumNumber
@timeit_wrapper
def minimumNumber(n, password):
password=str(password.strip())
# Return the minimum number of characters to make the password strong
numbers = "0123456789"
#!/usr/bin/python3
# Script Name: time_it.py
# Description: A function to calculate the execution time of functions or methods.
# Creator: Fahad Ahammed
# Date: 2020-01-06_13-12-47
import functools
import time
import logging
def time_it_up(func):