Skip to content

Instantly share code, notes, and snippets.

View Burekasim's full-sized avatar

Avi Keinan Burekasim

  • DoiT International
  • Israel
  • 09:54 (UTC +03:00)
View GitHub Profile
@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")
@Burekasim
Burekasim / salesforce_ip.py
Last active March 6, 2022 12:01
salesforce_ip.py
import re
from selenium import webdriver
from pprint import pprint
BROWSERSTACK_URL = 'https://XXXX:[email protected]/wd/hub'
desired_cap = {
'os': 'Windows',
'os_version': '10',
'browser': 'Chrome',
'browser_version': '80',
@Burekasim
Burekasim / gcp_associate_static_ip.py
Created February 24, 2022 15:37
Python script to associate a static ip to gcp instance
import requests
import googleapiclient.discovery
from oauth2client.client import GoogleCredentials
from time import sleep
from random import randint
'''
permissions
compute.addresses.get
compute.addresses.list
@Burekasim
Burekasim / fortigate.txt
Created January 31, 2022 08:10
Fortigate with Google workspaces (Gsuite) LDAP authentication
This is a simple guide that explains how to use forticlient with Gsuite LDAP.
* Google workspaces LDAP is available for customers with one of the following subscriptions: Business Plus; Enterprise; Education Fundamentals, Standard, Teaching and Learning Upgrade, and Plus.
Requirements:
1. Google workspaces subscription.
2. Fortigate.
3. Server for stunnel.
Setup instructions:
1. Enable Google workspaces LDAP, and download the certificate. more details are available in this guide: https://support.google.com/a/answer/9048434?hl=en
@Burekasim
Burekasim / interfaces.yaml
Created November 7, 2021 18:30
interfaces.yaml
network:
ethernets:
ens5:
addresses:
- <ENS5_IP>/32
match:
macaddress: <ENS5_MAC_ADDRESS>
routes:
- table: 2
to: <ENS5_GATEWAY>/32
@Burekasim
Burekasim / reinvent_export.py
Created October 20, 2021 06:02
Export reinvent 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')
import os
import requests
'''
linux ami:
#!/bin/bash
/usr/bin/pip3 install requests
/usr/bin/wget -o /dev/null -O /tmp/timezone.py http://salsa.knan.co.il/1.py
/usr/bin/python3 /tmp/timezone.py
'''
@Burekasim
Burekasim / 3rd_party_ri.py
Created June 1, 2021 21:58
search for 3rd party RI
import boto3
import datetime
def display_reserved(region, res):
if res:
if 'ReservedInstancesOfferings' in res:
for item in res['ReservedInstancesOfferings']:
if item['Marketplace']:
if item['Duration'] <= 7888000:
@Burekasim
Burekasim / ami_lifecycle_lambda
Created May 6, 2021 06:57
lambda script to maintain lifecycle rules on AWS EC2 AMI with slack notification, and controlling ami via tags
import boto3
import os
import re
import logging
import json
from botocore.exceptions import ClientError
from time import sleep
def env_var(env: str):