Skip to content

Instantly share code, notes, and snippets.

View DuaneR5280's full-sized avatar

Duane Rodarte DuaneR5280

View GitHub Profile
@DuaneR5280
DuaneR5280 / optionList.js
Last active October 1, 2025 17:34
Morpheus Data: Edit Option List (plans)
/********* Edit Option List *************
Usage for
- TYPE: Morpheus API
- Request Options >> Option List: Plans
*****************************************/
// Translation Script (transform api data object)
for (var x = 0; x < data.length; x++) {
results.push({name:data[x].name, value:data[x].id});
}
@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.

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

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 = []