Skip to content

Instantly share code, notes, and snippets.

@retrontology
retrontology / upload_artifacts.py
Last active August 23, 2023 07:22
Python Script to be run with Jenkins to deploy new artifacts and delete old ones in a Bitbucket repository
import requests
import os
import re
BEARER = 'nope'
URL = 'https://api.bitbucket.org/2.0/repositories/retro42/freshtomato-arm/downloads'
ARTIFACT_DIR = f'{os.environ["WORKSPACE"]}/release/src-rt-6.x.4708/image/'
def main():
upload_artifacts()
@retrontology
retrontology / awsdyndns.py
Last active July 23, 2024 05:39
Python file for AWS DYNDNS Lambda
import json
import boto3
import ipaddress
SECRET='geturownsecret'
REQUIRED_PARAMS=[
'secret',
'domain',
'subdomain',
'ip'
@retrontology
retrontology / goonMidiPlayer.py
Last active May 2, 2023 04:38
Python script to play midi files on piano on SS13 Goonstation
import mido
from pynput import keyboard
from threading import Thread
from time import sleep
KEYMAP="1!2@34$5%6^78*9(0qQwWeErtTyYuiIoOpPasSdDfgGhHjJklLzZxcCvVbBnm"
MIDI_PORT='loopMIDI Port 0'
MIDDLE_C_OFFSET=36
def map_note_to_key(note, keymap=KEYMAP, offset=MIDDLE_C_OFFSET):
@retrontology
retrontology / dictObj.py
Last active February 21, 2022 08:12
A python class that recursively loads a dictionary into it's own instance attributes
class dictObj(object):
def __init__(self, inObj: dict = dict()):
self.__load__(inObj)
def __load__(self, inObj):
if inObj:
self.__clear__()
for obj in inObj:
if issubclass(type(inObj[obj]), (dictObj, dict)):
@retrontology
retrontology / finnhubWS.py
Last active January 23, 2022 20:56
Python class for a Finnhub websocket; moved to https://github.com/retrontology/finnhubDB
import websocket
from threading import Thread
import json
import logging
import finnhub
import time
import datetime
import requests
from bs4 import BeautifulSoup
import influxdb_client
@retrontology
retrontology / gennav.lua
Last active January 9, 2022 21:02
Script to generate navmesh files for all maps on a GMod server
-- UTIL
function expand(key) for k,v in pairs(key) do print("key", k, "value", v) end end
local function tablelength(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
@retrontology
retrontology / sup2srthook.py
Created December 13, 2021 13:37
Webhook that listens for new movies added to Plex, and if it contains PGS subtitles and no SRT subtitles, converts them to SRT.
from http.server import HTTPServer, BaseHTTPRequestHandler
from socketserver import ThreadingMixIn
import json
import requests
import xml.etree.ElementTree as ET
from threading import Thread
from subprocess import Popen
HOST='localhost'
PORT=3527
@retrontology
retrontology / wg.sh
Created December 7, 2021 00:55
Tomato Wireguard Server Shell Script
serverprivkey=/jffs/wg/server/private.key
clientpubkeydir=/jffs/wg/clients
wgaddress=192.168.3.1/24
devname=wg0
port=51820
allowedips=0.0.0.0/0
retry=10
usage="Usage: $0 up/down"
#!/usr/bin/env python
import subprocess
import json
import os
import argparse
ffmpegCommand = "ffmpeg"
conv_ratio = 2/3
@retrontology
retrontology / twitchcast.py
Last active February 13, 2021 10:51
Cast Twitch stream to Chromecast
#!/usr/bin/env python
import streamlink
import pychromecast
import re
import argparse
from simple_term_menu import TerminalMenu
def selectCCbyName(castname):