Skip to content

Instantly share code, notes, and snippets.

View DanEdens's full-sized avatar
💭
Building a Test Kit!

Dan Edens DanEdens

💭
Building a Test Kit!
View GitHub Profile
@DanEdens
DanEdens / gist:4586c26f72cbccfc232cdee240824d1f
Created November 30, 2023 03:49
git commit as code prompt
for any thing that isn't code, Please respond as if writing a git commit messages. If a response must be longer then 4 sentences, please break it to into separate commits.
@DanEdens
DanEdens / WinSystemSnapshot.ps1
Created November 5, 2023 22:26
PowerShell script to capture a detailed Windows system snapshot. Collects event logs, installed apps, system info, services, disk space, network config, and user accounts. Consolidates into a master log.
# Define a directory for log files
$logDir = "$env:USERPROFILE\logs\"
$maxEvents = 500 # Number of most recent events to retrieve
if (-not (Test-Path $logDir)) {
New-Item -Path $logDir -ItemType Directory
}
# Function to extract and log events
@DanEdens
DanEdens / __main__.py
Last active July 7, 2023 17:26
simple-mqtt-server-agent
import os
import subprocess
import sys
# Define file directories
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
BIN_DIR = os.path.join(ROOT_DIR)
# Add directories to system path
sys.path.insert(0, ROOT_DIR)
@DanEdens
DanEdens / check_selenium_driver.py
Created June 25, 2023 23:38
install selenium drivers
def check_drivers_powershell():
import os
import subprocess
# Dictionary of web browser drivers and their download URLs
drivers = {
"Chrome": "https://chromedriver.storage.googleapis.com/latest/chromedriver_win32.zip",
"Firefox": "https://github.com/mozilla/geckodriver/releases/download/v0.29.1/geckodriver-v0.29.1-win64.zip",
"Edge": "https://msedgedriver.azureedge.net/LATEST_RELEASE_EDGE",
}
@DanEdens
DanEdens / .rc.cmd
Created June 19, 2023 02:22
Windows persistent aliases
@echo off
@REM autorun.reg
@prompt $m$p$g
@REM Windows Registry Editor Version 5.00
@REM [HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
@REM "Autorun"="%sourcefile%"
@DanEdens
DanEdens / toggleLocalRepo.cmd
Created June 16, 2023 16:51
Git repo Toggle. Will either re-Clone or autocommit and delete. I made this to be able to remove clutter without losing easy access to it. Includes sh and cmd versions
@echo off
setlocal
set repo_url=https://github.com/DanEdens/resume.git
set repo_folder=resume
if not exist "%repo_folder%" (
echo Cloning repository...
git clone "%repo_url%" "%repo_folder%"
cd "%repo_folder%"
@DanEdens
DanEdens / mqtt_handler.py
Created May 12, 2023 13:33
mqtt python logger
import errno
import logging
import os
from datetime import datetime
from pathlib import Path
import paho.mqtt.client as mqtt
import paho.mqtt.publish as publish
# Create utils specific fallback logger for Debugging debug mode
import errno
import html
import logging
import os
import platform
import re
import socket
import subprocess
import time
from datetime import datetime
@DanEdens
DanEdens / PageUtilities.py
Last active August 25, 2023 14:09
Selenium page utilities
import os
import time
from selenium.common import TimeoutException
from selenium.webdriver import ActionChains
from selenium.webdriver.remote.webelement import WebElement
from selenium.webdriver.support import expected_conditions as expect
from selenium.webdriver.support.wait import WebDriverWait
#import testKitUtils
@DanEdens
DanEdens / get.py
Created December 23, 2022 17:11
Get mqtt variable in python
import subprocess
def set_variable_from_mqtt_topic(name: str, awsip: str, awsport: str, topic: str) -> str:
"""
Subscribes to the specified MQTT topic and sets the value of the variable with the specified name to the value
received from the topic.
"""
# Replace any equals signs in the name with colons
name = name.replace("=", ":")