Skip to content

Instantly share code, notes, and snippets.

@DuaneR5280
DuaneR5280 / table_extract.py
Last active June 9, 2024 13:54
Extract Table from HTML element
def table_extract(table):
"""
Extracts data from a table in an HTML document.
Args:
table (HTML element): The table element to extract data from.
Returns:
list of dict: A list of dictionaries, where each dictionary represents a row in the table.
The keys of the dictionaries are the headers of the table, and the values are the cell values.
Note: These are based on Linuxserver.io images
1. We need to create a 90-config file that will download a docker binary so that lidarr can call commands in a different container
-----------------------------90-config----------------------------------
#!/usr/bin/with-contenv bash
DOCKERVERSION=20.10.9
curl -fsSLO https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKERVERSION}.tgz \
&& tar xzvf docker-${DOCKERVERSION}.tgz --strip 1 \

Creepmas Movie List

List of scary movies involving Christmas. Based on reddit list @ The Ultimate List of Creepmas Movies. So far.

  • A Christmas Carol
  • A Cadaver Christmas (2011)
  • A Christmas Horror Story (2015)
  • A Christmas Tale (2005)
  • All the Creatures Were Stirring (2018)
  • All Through the House (2015)
@DuaneR5280
DuaneR5280 / DDE_CLIENT.py
Created January 4, 2022 16:11
A DDE Client using ctypes for Windows. Unlike the pywin32 implementation this code supports advice requests.
#!/usr/bin/env python
# Send DDE Execute command to running program
# https://code.activestate.com/recipes/577654-dde-client/
from ctypes import POINTER, WINFUNCTYPE, c_char_p, c_void_p, c_int, c_ulong, c_char_p
from ctypes.wintypes import BOOL, DWORD, BYTE, INT, LPCWSTR, UINT, ULONG
# DECLARE_HANDLE(name) typedef void *name;
HCONV = c_void_p # = DECLARE_HANDLE(HCONV)
HDDEDATA = c_void_p # = DECLARE_HANDLE(HDDEDATA)
@DuaneR5280
DuaneR5280 / sorted_dict.py
Last active December 15, 2021 23:57
Sort python dictionary by key
from pprint import pprint
SM = {
"instagram": r"instagram.com",
"facebook": r"facebook.com",
"twitter": r"twitter.com",
"youtube": r"youtube.com",
"snapchat": r"snapchat.com"
}
@DuaneR5280
DuaneR5280 / sort_json.py
Last active February 15, 2021 16:40
Script to open and sort JSON file by Key "name" value. Save to new JSON file with sorted_ prefix
# Script to sort json file by Key "name" value
import json
from pathlib import Path
def write_json(data, filename):
"""Write new JSON file
Args:
data (dict): Dict data to write to JSON file
@DuaneR5280
DuaneR5280 / ombi_scrub.py
Last active July 22, 2020 14:17
A python script to remove all available movies from ombi requests
# Delete ombi movie & tv requests if the movie is available
import os
import requests
# Ombi api key
API_KEY = os.environ["API_KEY"] # Replace with your api key from ombi
# Start requests session
s = requests.session()
s.headers.update({"ApiKey": API_KEY})

Backup database

# Connect to contaner shell
docker exec -it container_name /bin/bash
# create backup tar file
pg_dump -U postgres -W -F t postgres > /bb_backup.tar
# empty password
# copy file from container
docker cp container_name:file_name.tar . # note . at the end for file location
from requests_html import HTMLSession
import json
session = HTMLSession()
server_ip = '' # input server ip address. Add port if necessary
endpoints = {
"children": f"http://{server_ip}/api/children/",
"changes": f"http://{server_ip}/api/changes/",
@DuaneR5280
DuaneR5280 / plex_cleanup.py
Created January 16, 2020 22:40 — forked from d8ahazard/plex_cleanup.py
A utility for cleaning Plex collections and identifying orphaned media.
import os
import pathlib
import sqlite3
target_path = ""
movie_list = []
tv_list = []
collection_list = []