Skip to content

Instantly share code, notes, and snippets.

View csm10495's full-sized avatar

Charles Machalow csm10495

View GitHub Profile
@csm10495
csm10495 / locked_cookie_test.py
Last active April 5, 2024 21:33
POC that fetches cookies from a locked cookies file on Windows with Chromium based browsers
@csm10495
csm10495 / getStackFrame.py
Created October 15, 2016 05:29
A really speedy way to get the current stack frame in Python
'''
Brief:
This script demonstrates how to get the current stack frame in a way faster than using
inspect.stack()... which is really slow (like ~450 times slower than this solution in most cases)
If the fast solution won't work, will fall back to an inspect.stack() solution.
Author:
Charles Machalow
'''
@csm10495
csm10495 / executor_log_and_wait_ex.py
Created January 12, 2024 05:02
Example code to show a couple different ways to wait for futures to complete and still have the ability to log/print something out periodically while waiting for the futures to complete.
"""
Example code to show a couple different ways to wait for futures to complete and still have the ability
to log/print something out periodically while waiting for the futures to complete.
(C) - MIT License - 2024 - Charles Machalow
"""
from concurrent.futures import (
ThreadPoolExecutor,
as_completed,
@csm10495
csm10495 / snakeify_sample.py
Last active December 9, 2023 05:41
snakeify_sample.py - Sample code to convert logging to have snake-case aliases.
'''
Sample code to convert a module on import to snake_case from camelCase.
I wouldn't use this in production, but its kind of interesting to play with.
(C) 2023 - MIT License - Charles Machalow
'''
import inflection # pip install inflection
import inspect
import importlib
from typing import Any
@csm10495
csm10495 / weatherflow_listtener.py
Created October 21, 2023 18:30
weatherflow_listtener.py
"""
A simple script to listen to a local weatherflow UDP broadcast and print out any received data.
(C) Charles Machalow via the MIT License (2023) .. See https://opensource.org/license/mit/ for details.
"""
import json
import logging
from pprint import pformat
from socket import AF_INET, IPPROTO_UDP, SOCK_DGRAM, socket
# pip install rich
@csm10495
csm10495 / google_messages_archiver.js
Last active October 21, 2023 05:11
Google Messages Archiver
// ==UserScript==
// @name Google Messages Archiver
// @namespace Whatever
// @match https://messages.google.com/web/*
// @grant GM_log
// @author csm10495
// @description Run doIt() in the console to archive all conversations after the most recent 5.
// @version 0.1.0
// ==/UserScript==
@csm10495
csm10495 / Building OpenSSL 1.1.1(b) Notes
Last active September 18, 2023 07:50
Building OpenSSL 1.1.1(b) Notes (Windows)
Required: Visual Studio 2015 or 2017 (or probably later works)
Setup
1. Clone/download OpenSSL 1.1.1 source to a folder
2. Download / install Perl (They recommend Active perl)
I recommend using Chocolatey so for me: choco install activeperl
3. Ensure Perl is in the system path. (Choco appears to do this by default)
4. Download / install NASM
I recommend using Chocolatey so for me: choco install nasm
5. Ensure NASM is in the system path. (For me the directory to add was C:\Program Files\NASM)
@csm10495
csm10495 / cosmos2json.py
Created February 11, 2023 05:27
cosmos2json.py - A quick and dirty script to run queries against a cosmos db's container
'''
Simple script to do a simple query against a cosmosdb in azure
Can use it to dump a db to json.. if ya need that for some reason.
MIT License - Charles Machalow
# pip install azure-cosmos
# pip install azure-identity
'''
@csm10495
csm10495 / yt_crawler.py
Created December 11, 2021 22:28
Quick/Dirty YouTube video id crawler
'''
Small script that tries to recursively find youtube video ids starting from given urls.
MIT License - Charles Machalow
'''
import time
import re
from datetime import timedelta, datetime
from typing import List, Set
from requests_html import HTMLSession
import requests
@csm10495
csm10495 / airflow_start_via_helm.py
Last active December 10, 2021 05:28
Airflow from helm simple example
import base64
import os
import subprocess
def run_command(cmd):
print (f">{cmd}")
ret_code = subprocess.call(cmd, shell=True)
print (f'>> Return Code: {ret_code}')
return ret_code