Skip to content

Instantly share code, notes, and snippets.

View rfinnie's full-sized avatar

Ryan Finnie rfinnie

View GitHub Profile

alias: SCE Tariff (Winter) description: "" trigger:

  • platform: time at: "08:00:00" variables: tariff: superoffpeak
  • platform: time at: "16:00:00"
# Mastodon OAuth 2.0 API authentication
# Ryan Finnie <ryan@finnie.org>
# When you create an application through the Development section of Mastodon,
# it gives you three items: client key, client secret and access token (the
# latter which can be regenerated in the UI). You can use the access token
# directly, sending the header "Authorization: Bearer ${ACCESS_TOKEN}" with
# API requests, or you may initiate an OAuth 2.0 workflow to generate a
# per-session token.
#!/usr/bin/env python3
import os
import pathlib
import random
import subprocess
import sys
import tempfile
import yaml
#!/usr/bin/env python3
import datetime
from pathlib import Path
import re
import sys
import types
import xml.etree.ElementTree as ET
from natsort import natsorted
@rfinnie
rfinnie / README.md
Last active December 6, 2021 04:15
Check templates
#!/usr/bin/env python3
import random
from xkcdpass.xkcd_password import choose_words, generate_wordlist
segments = [
x.capitalize()
for x in choose_words(generate_wordlist(min_length=5, max_length=9), 2)
import yaml
class YamlEdit:
def __init__(self, filename):
self.filename = filename
def __enter__(self):
with open(self.filename) as f:
self.yaml_obj = yaml.safe_load(f)
8 RANDOMIZE
14 LET X=INT(RND(X)*39)+1
18 LET Y=INT(RND(X)*24)+1
30 PRINT "MISS CLEO HAS PUT EMAD IN A MINDJAIL,"
47 PRINT "WHICH IS A PRISON FOR YOUR MIND."
60 PRINT "IT IS YOUR JOB TO GET HIM OUT!"
69 PRINT ""
85 IF Y = 1 GOTO 594
104 IF Y = 25 GOTO 612
111 IF X = 1 GOTO 637
{
"platforms" : [
{
"platform_id" : 1,
"platform_name" : "Linux"
},
{
"platform_id" : 2,
"platform_name" : "DOS"
},
@rfinnie
rfinnie / logger.py
Created March 11, 2021 04:06
Python logging precursor, circa 2001
#!/usr/bin/env python
"""A centralized abstraction layer for logging via facilities.
log = LogObj()
log.nothing = Nolog()
log.debug = File(file='debuglog.txt', flags='w', bufsize=0, longlog=1)
log.info = File(sys.stdout)
log.info.deps.append('debug')
log.error = Syslog(LOG_LOCAL5|LOG_ERR)