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 / sql_store_data.py
Created December 23, 2022 17:10
store_sql_data
import sqlite3
def store_data(device, version, results_url, ticket_key, timestamp, test_name, test_config):
conn = sqlite3.connect('tests.db')
c = conn.cursor()
c.execute('CREATE TABLE IF NOT EXISTS tests (device text, version text, results_url text, ticket_key text, timestamp text, test_name text, test_config text)')
c.execute('INSERT INTO tests (device, version, results_url, ticket_key, timestamp, test_name, test_config) VALUES (?, ?, ?, ?, ?, ?, ?)', (device, version, results_url, ticket_key, timestamp, test_name, test_config))
conn.commit()
@DanEdens
DanEdens / heygpt.py
Created December 23, 2022 17:05
python ask chatgpt with screenshot
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
# Start a new webdriver instance
driver = webdriver.Firefox()
# Navigate to the page with the text field
driver.get('http://www.example.com/chatgpt')
# Find the text field element on the page
@DanEdens
DanEdens / fet.py
Created December 23, 2022 17:03
get file from mqtt in python
import os
import subprocess
def subscribe_to_mqtt_topic(
topic: str, path: str, awsip: str=os.getenv("AWSIP"),
awsport: str=os.getenv("AWSPORT")) -> str:
"""
Subscribes to the MQTT topic with the specified name and writes the received messages to a file with the same name.
Returns the file path of the created file.
"""
@DanEdens
DanEdens / Install-apache-maven.bat
Created December 23, 2022 17:02
Install-apache-maven-windows
@echo off
echo Installing Apache Maven...
rem Set the Maven version to install
set MAVEN_VERSION=3.6.3
rem Set the installation directory for Maven
set MAVEN_INSTALL_DIR=C:\Program Files\Apache\maven
@DanEdens
DanEdens / gist:9d257f82e62072469ebebbe3e3e21b51
Last active December 9, 2022 20:36
.git/hooks/post-commit
#!/bin/sh
# Exit immediately if any command returns a non-zero exit code
set -e
# Check if the current directory is a git repository
if ! git rev-parse --git-dir > /dev/null 2>&1; then
printf "Error: current directory is not a git repository\n"
exit 1
@DanEdens
DanEdens / LGS_script_template.lua
Created November 4, 2022 12:57 — forked from Egor-Skriptunoff/LGS_script_template.lua
Template script file for Logitech Gaming Software
---------------------------------------------------------------------------------------------
-- LGS_script_template.lua
---------------------------------------------------------------------------------------------
-- Version: 2019-04-19
-- Author: Egor Skriptunoff
--
--
-- This is a template for "Logitech Gaming Software" script file.
-- Four useful features are implemented here:
--
@DanEdens
DanEdens / #_overview.md
Created August 11, 2022 15:31 — forked from doytsujin/#_overview.md
Sample Terraform codes for Azure Container Apps with Dapr
@DanEdens
DanEdens / getlinks.js
Created August 11, 2022 15:27
console command to extract links on page
@DanEdens
DanEdens / .profile
Created September 7, 2021 14:29
check_wsl2_otherwise_get_mqtt-stored_DISPLAY
if grep -qEi "(Microsoft|WSL)" /proc/version &> /dev/null ; then
echo WSL2 detected. Using Local \$DISPLAY. $DISPLAY
export DISPLAY=$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}'):0.0
else
echo Using Ghost\'s \$DISPLAY: $DISPLAY
export DISPLAY=$(mosquitto_sub -h $AWSIP -p $AWSPORT -t status/ghost/IP -C 1):0.0
fi
adb kill-server && adb tcpip 5555 && sleep 5 && adb shell ip route | awk '{print $9}' | xargs adb connect