Skip to content

Instantly share code, notes, and snippets.

@axlan
axlan / dice_soundboard_webapp.py
Created March 2, 2024 06:23
I did a really quick proof of concept of playing different sound effects when rolling 1's and 20's. This is using QPython to run a web server that handles the web requests from the Pixels Dice app (https://gamewithpixels.com/).
#qpy:webapp:Hello QPython
#qpy://127.0.0.1:8080/
"""
This is a sample for qpython webapp
"""
import os
import time
import androidhelper
from bottle import Bottle, ServerAdapter
from bottle import run, debug, route, error, static_file, template, request
@axlan
axlan / case_maker.py
Created August 13, 2022 16:55
Python for copying script into format for objection.lol save files.
from enum import Enum, auto
frame = '''{{
"id": -1,
"iid": {iid},
"text": "{text}",
"poseId": {poseId},
"pairPoseId": null,
"bubbleType": 0,
"username": "{name}",
@axlan
axlan / generate_order.py
Last active February 11, 2022 08:53
A script for generating a MPC Fill order from a list of local files.
import xml.etree.ElementTree as ET
import shutil
import os
CARD_FILE_OUT = 'order_HLB.xml'
TYPE = '.png'
IMAGE_SOURCE = 'C:/Users/feros/Documents/HLB_Deck/'
@axlan
axlan / modify_cards.py
Created February 10, 2022 07:52
Python Script to Modify Card Conjurer Save
import json
CARD_FILE_IN = 'card_save.json'
CARD_FILE_OUT = 'card_save_fixed.json'
with open(CARD_FILE_IN, 'rb') as fd:
data = json.load(fd)
for i, card in enumerate(data):
card["data"]["bottomInfo"]["wizards"]["text"] = ''
@axlan
axlan / download_card_conjurer.py
Created February 9, 2022 07:35
Download Card Conjurer from Captured HAR
# Use chrome to capture a har file of the page load and save it as data/cardconjurer.com.har
# To run do cd data/local_site; python3 -m http.server
import base64
import json
import os
import pathlib
import re
import requests
@axlan
axlan / cpp_enum_gen.py
Last active December 16, 2021 00:14
Python script for generating string conversions for a C++ enums
import re
def get_enum_values(enum_str):
re_name_type = re.compile(r'^enum class (.+) : (.+) {')
re_name = re.compile(r'^enum .+ (.+) {')
re_key_value = re.compile(r'^ +(.+) = (.+),')
re_key = re.compile(r'^ +(.+),')
name = None
@axlan
axlan / roomba_local_check.py
Created March 27, 2021 06:49
A Python implementation of the local Roomba API for use as a check_mk local check
#!/usr/bin/env python3
# This script is based on http://www.richwhitehouse.com/index.php?postid=72
# which in turn was based on https://github.com/koalazak/dorita980 which is
# an actually decent node implementation
# While it can be used as a library function to query Roomba status,
# this script can also be used as a local check in check_mk
# https://docs.checkmk.com/latest/en/localchecks.html to make a server
# have a service monitoring a roomba. Outputs a string like:
@axlan
axlan / pi_hole_ctrl.py
Last active August 14, 2020 20:01
PiHole Web Admin Python Control
import re
import urllib.parse
import requests
class PiHoleControl():
headers = {'Content-type': 'application/x-www-form-urlencoded; charset=UTF-8'}
def __get_token(self):
@axlan
axlan / prosafe_control.py
Last active September 12, 2018 23:41
A python CLI for getting and updating the port status for a NetGear ProSAFE managed switch over it's web interface. Tested on a "JGS524Ev2 - 24-Port Gigabit ProSAFE Plus Switch" running firmware 2.6.0.24 . This interface is fairly fragile and any change to the web frontend is likely to break it.
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 21 11:02:21 2018
@author: axlan
"""
import requests
import sys
import re