This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gc () { | |
local returnval=n | |
function ynprompt () { | |
read -r -p "Clone ${1}? [Y/n] " input | |
case $input in | |
[yY][eE][sS]|[yY]) | |
returnval=y | |
;; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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 = {} |
NewerOlder