Skip to content

Instantly share code, notes, and snippets.

View svrj's full-sized avatar

Jeremy Savor svrj

View GitHub Profile
@svrj
svrj / fetch_definitions.md
Last active December 5, 2024 14:46
api.dictionaryapi.dev usage with httpie

Simple output of 1 defintion per line of STDOUT

http https://api.dictionaryapi.dev/api/v2/entries/en/hello | jq '.[0]|.meanings[]|.definitions[]|.definition'

"\"Hello!\" or an equivalent greeting."
"To greet with \"hello\"."
"A greeting (salutation) said when meeting someone or acknowledging someone’s arrival or presence."
"A greeting used when answering the telephone."
"A call for response if it is not clear if anyone is present or listening, or if a telephone conversation may have been disconnected."
"Used sarcastically to imply that the person addressed or referred to has done something the speaker or writer considers to be foolish."
@svrj
svrj / keybase.md
Created August 13, 2024 13:22
Keybase identity

Keybase proof

I hereby claim:

  • I am svrj on github.
  • I am jeremy_savor (https://keybase.io/jeremy_savor) on keybase.
  • I have a public key whose fingerprint is 392C 1AF2 B1A7 CF99 E736 610C 5413 8968 E0ED EA2A

To claim this, I am signing this object:

@svrj
svrj / generate_qrs_with_checkletter.py
Created April 20, 2023 08:00
Generate QR Codes with a checkletter
from typing import List
import fire
from damm.alphabets import alphabet_order_21
from damm.checkdigit import is_checkletter_valid, key_to_checkletter
from damm.quasigroups import quasigroup_order_21
def generate_qrs_with_checkletter(
prefix: str, revision: str, serial_start: int, n_to_generate: int = 1
@svrj
svrj / demo.py
Created June 13, 2022 12:52
Qt Signaling with a logging Handler
import sys
import random
from PyQt5.QtWidgets import QApplication, QLabel, QPushButton, QLineEdit, QVBoxLayout, QWidget
from PyQt5.QtCore import Qt, QTimer, QObject, pyqtSignal
import logging
logging.basicConfig()
logger = logging.getLogger("tinkering")
logger.setLevel(logging.INFO)
@svrj
svrj / logging_decorator.py
Last active May 13, 2022 13:34
Use a decorator to add print/logging statements before invoking classes or functions
import inspect
def logging_decorator(thing):
if isinstance(thing, type):
def inner(*args, **kwargs):
for t in dir(thing):
if not t.startswith("__"):
_thing = getat
@svrj
svrj / gs_connection.mmd
Created April 6, 2022 15:06
GS Connection Flow
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@svrj
svrj / parse_fco_failures.py
Created October 12, 2021 07:41
Parsing/Counting FCO failures in SPT
from SigmaProductionTools.utils.configuration import conf
from SigmaProductionTools.utils.database import Database
import pathlib
def parse_result(result: dict, predicate) -> bool:
text = result["text"]
step_text = text.split("||")
found = False
@svrj
svrj / stream.py
Created June 3, 2021 14:10
Multiple Webcam Streaming
"""
Stream from connected USB Webcams (on Ubuntu 18.04)
During preliminary testing, there were issues when trying to stream from a USB
hub. It's important that each camera has a dedicated USB port rather than a connection
via a hub. Perhaps, it's actually a problem with the hub, and a better one could support
the data rate for multiple cameras?
"""
import cv2
import pathlib
@svrj
svrj / main.py
Created April 21, 2021 15:48
TPLink HS100 Control with Python (>=3.7)
"""
A little bit of background to controlling the hs100 without a phone: https://blog.georgovassilis.com/2016/05/07/controlling-the-tp-link-hs100-wi-fi-smart-plug/
"""
import asyncio
import kasa # https://github.com/python-kasa/python-kasa
import time
import sys
IP = "10.10.185.105"
@svrj
svrj / transparent_background.sh
Last active July 20, 2022 18:07
Make image background transparent
#!/bin/bash
### ####################################
### # Convert the given image background
### # to be transparent and save to new
### # location
### #
### # Example Usage:
### # Basic conversion:
### # > transparent_background path/to/image path/to/new_image
### #