Skip to content

Instantly share code, notes, and snippets.

View tassaron's full-sized avatar

Brianna Rainey tassaron

View GitHub Profile
//Referred link https://www.lunchbadger.com/tracking-the-performance-of-express-js-routes-and-middleware/
var express = require('express')
var uuid = require('uuid')
const bodyParser = require('body-parser');
const {
EventEmitter
} = require('events');
const profiles = new EventEmitter();
@tassaron
tassaron / increase_mastodon_char_limit_to_5000.patch
Last active June 4, 2023 21:14
Increase Mastodon v3.5.3 character limit: git apply --ignore-space-change --ignore-whitespace increase_mastodon_char_limit_to_5000.patch
diff --git a/app/javascript/mastodon/features/compose/components/compose_form.js b/app/javascript/mastodon/features/compose/components/compose_form.js
index 4620d1c43..bbc4b7edc 100644
--- a/app/javascript/mastodon/features/compose/components/compose_form.js
+++ b/app/javascript/mastodon/features/compose/components/compose_form.js
@@ -90,7 +90,7 @@ class ComposeForm extends ImmutablePureComponent {
const fulltext = this.getFulltextForCharacterCounting();
const isOnlyWhitespace = fulltext.length !== 0 && fulltext.trim().length === 0;
- return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > 500 || (isOnlyWhitespace && !anyMedia));
+ return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > 5000 || (isOnlyWhitespace && !anyMedia));
@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
@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 / .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 / 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 / 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 / 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 / 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 / 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 = {}