Skip to content

Instantly share code, notes, and snippets.

View tassaron's full-sized avatar

Brianna Rainey tassaron

View GitHub Profile
@tassaron
tassaron / component-outline.md
Last active July 28, 2017 12:04
How a Component Works

How a Component Works

Definition

All components must inherit from the Component base class, which is a type of QObject. The class must have the following attributes (as class variables):

  1. name

  2. version (a string such as '1.0.0')

The major version is used to determine preset compatibility, i.e., presets created for version 1.0.0 will work with 1.1.2 but not 2.0.0.

@tassaron
tassaron / backup-mc.sh
Last active September 15, 2024 22:34
SSH copy and unzip the latest Bedrock Dedicated Server backup created by TapeWerm's MCscripts
# Install unzip. Put your IP on next line. Voila!
IP=
PORT=22
BACKUP_DIR=~/MCbackups
time="$1"
if [ -z "$1" ]; then
time=04-05
fi
@tassaron
tassaron / assume_quotes.py
Created October 22, 2020 05:08
A pointless function that lets you ignore putting quotes around one-word strings
"""
A pointless function that lets you ignore putting quotes around one-word strings
Not sure why I wrote this, but eval() is fun... right?
Input: "{cats: 3, dogs: [id, print]}"
Output: {'cats': 3, 'dogs': ['id', 'print']}
"""
def assume_quotes(data):
context_globals = {"__builtins__": {}}
context_locals = {}
@tassaron
tassaron / all-fields-wtforms-as-dict.py
Created November 2, 2020 14:02
get all data from fields in a WTForm as dict
"""
It took me hours to figure out that iterating over fields
in a WTForm has unintuitive behaviour if you use `continue`
"""
# This works as expected
for field in form._fields:
data[field] = form._fields[field].data
del data["csrf_token"]
@tassaron
tassaron / backup-stardew.sh
Last active January 24, 2021 18:32
Backup local Stardew Valley save files
#USER=username
#PLATFORM=linux
print_help() {
echo "Edit USER and PLATFORM variables in this file:"
echo "$0"
echo
echo "USER should be your system username"
echo "PLATFORM must be 'linux' or 'wsl'"
exit
@tassaron
tassaron / mkwallpaper.sh
Last active February 8, 2021 18:00
wallpaper crop, resizer and watermark using ImageMagick
#!/bin/bash
# wallpaper resizer and watermarker script
#=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~==~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~#
# by tassaron on march 5 2017
# updated 2017-05-04, 2018-09-21, 2021-02-01
#
#=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~==~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~#
# EDIT THESE VALUES
TMP_DIR="/tmp/mkwallpaper"
@tassaron
tassaron / plasma-backlight.sh
Last active May 8, 2024 08:58
set KDE Plasma backlight brightness using dbus with a bash script
#!/bin/bash
# Set this to 1 to reset the backlight to 100% after execution
TEST_MODE=0
DBUS_SERVICE="local.org_kde_powerdevil"
DBUS_PATH="/org/kde/Solid/PowerManagement/Actions/BrightnessControl"
MAX_BRIGHTNESS=$(qdbus $DBUS_SERVICE $DBUS_PATH brightnessMax)
@tassaron
tassaron / .tmux.conf
Last active May 20, 2022 02:03
my tmux configuration
# Tmux configuration
set -g default-terminal "screen-256color"
set -g mouse on
# Alternative shells for bugtesting
#set -g default-shell "$HOME/code/bash/bash-3.2.57/bash"
#set -g default-shell /usr/bin/zsh
# Change prefix to nest inside another session
#unbind C-b
@tassaron
tassaron / git-clone.sh
Created February 10, 2022 18:28
script to make cloning my own repos faster
function gc () {
local returnval=n
function ynprompt () {
read -r -p "Clone ${1}? [Y/n] " input
case $input in
[yY][eE][sS]|[yY])
returnval=y
;;
@tassaron
tassaron / jsonify-mastodon.py
Last active March 23, 2022 01:41
turn Mastodon posts into paginated json
#! /usr/bin/env python3
from mastodon import Mastodon
import os
import json
import sys
from typing import Tuple, List
import datetime
"""
This script looks for posts tagged #blog by the USER_ID on INSTANCE_URL