Skip to content

Instantly share code, notes, and snippets.

View claytonjroberts's full-sized avatar

Clayton J Roberts claytonjroberts

View GitHub Profile
@claytonjroberts
claytonjroberts / dict_list_permutations.py
Last active August 24, 2023 18:01
Python 3: Permutations of a dict of lists into a list of dicts
"""Get all combinations of values of a dictionary and return a list of dictionaries"""
import itertools
d = {1: [1, 2, 3, 4], 2: [5, 6], 3: [7]}
final = [
{k: v for k, v in zip(sorted(d.keys()), list_prod_value)}
for list_prod_value in itertools.product(*(d[k] for k in sorted(d.keys())))
]
@claytonjroberts
claytonjroberts / config.conf
Created December 22, 2021 06:07
Neofetch Config
# See this wiki page for more info:
# https://github.com/dylanaraps/neofetch/wiki/Customizing-Info
print_info() {
info title
info underline
info "OS............" distro
info "Host.........." model
info "Kernel........" kernel
info "Uptime........" uptime
@claytonjroberts
claytonjroberts / minestone.stonescript.txt
Created August 26, 2023 07:52
Stone Script RPG Script
// ---------------------------------------------
// --- DEBUG
// ---------------------------------------------
var debug = true
var global_name_loadout
?debug
>`0,0,Loadout.....: @global_name_loadout@
>`0,1,Foe.........: @foe.name@
@claytonjroberts
claytonjroberts / it_assassin.py
Last active August 28, 2023 23:40
IT Process Terminator
"""Code for continous termination of IT processes.
Designed for processes that are automatically uploaded to
a MacOS computer by means of serial number.
"""
import psutil
import time
import re
import datetime as dt
@claytonjroberts
claytonjroberts / typer_extensions.py
Last active August 30, 2023 17:51
Python Typer Extensions
"""Extensions for the Typer CLI."""
from typing import Optional
import typer
def command_category(command_category: str):
"""Modify the docstring of a function to mark it as a test command.