Skip to content

Instantly share code, notes, and snippets.

@justengel
justengel / keep_awake.py
Last active August 18, 2020 17:39
Keep windows 10 awake while this script is running.
"""Keep windows awake.
Build an executable with "pyinstaller ./keep_awake.py --noconsole --onefile"
Prevent OS sleep/hibernate in windows
* Derived from: https://stackoverflow.com/a/57647169/1965288
* code from: https://github.com/h3llrais3r/Deluge-PreventSuspendPlus/blob/master/preventsuspendplus/core.py
* API documentation: https://msdn.microsoft.com/en-us/library/windows/desktop/aa373208(v=vs.85).aspx
@justengel
justengel / async_serial_logger.py
Last active August 19, 2020 17:03
Asyncio serial port logger. This works, but has not been tested for efficiency.
"""Asyncio serial port logger.
Requirements:
* pyserial
* pyserial-asyncio
* aiofiles
"""
import os
@justengel
justengel / ssh_tools.py
Last active March 24, 2023 13:49
Quickly change a ssh config HostName as well as reading and configuring the .ssh/config file.
#!/usr/bin/env python
"""
Quickly change a ssh config HostName as well as reading and configuring the .ssh/config file.
Also supports syncing a pycharm http client env file.
"""
import fire
import shlex
@justengel
justengel / screen_print.py
Last active October 5, 2023 02:51
Replace print with a new terminal buffer screen
import sys
import builtins
import time
import warnings
from functools import wraps
def skip_without_screen(func):
@wraps(func)
def decorated(*args, **kwargs):
@justengel
justengel / find_prices.py
Created October 5, 2023 00:14
Check prices and report on the cheapest price found
"""
Check and store the prices of an item.
Create a find_prices.json file and run daily to see if prices changed.
..code-block:: json
{
"Coffee Maker": {
"Vendor": {