I hereby claim:
- I am avalonv on github.
- I am avalonv (https://keybase.io/avalonv) on keybase.
- I have a public key whose fingerprint is DCF0 7B5B 87E4 69AC 92BF 1C73 30B4 F510 8035 40DA
To claim this, I am signing this object:
from PIL import ImageFont | |
import csv | |
width = 1000000 | |
csvpath = 'quotes.csv' | |
fntname = 'bookerly.ttf' | |
fntsize = 50 | |
def wrap_lines(text:str, font:ImageFont.FreeTypeFont, line_length:int): | |
# arigatou https://stackoverflow.com/a/67203353/8225672 |
#!/usr/bin/python3 | |
# this will TRY to replace a set of unicode characters with a corresponding set | |
# of usa-ascii ones. requires unidecode (https://github.com/avian2/unidecode), | |
# run 'pip3 install unidecode' to install. | |
# useful for translating mathematical symbols commonly found in PDFs into | |
# plain ascii ones, NOT recommended for transliterating text that doesn't use | |
# the latin alphabet, though it can still spot instances of that text for you. | |
# there's no gurantee the replacements it suggests will be accurate, so you | |
# should carefully inspect the suggestion for each individual line before | |
# writing. |
from PIL import Image, ImageFont, ImageDraw | |
def fit_textbox(length:int, height:int, text:str, fontname:str, fmin=15, fmax=40): | |
# this will dynamically wrap and scale text with a font size that can fill | |
# a given textbox, both length and height wise. manually setting fmin and | |
# fmax is recommended when working with larger batches of text. | |
# returns wrapped text and a ImageFont.FreeTypeFont object | |
def get_wrapped_text(text:str, font:ImageFont.FreeTypeFont, line_length:int): | |
# adapted from Chris Collett https://stackoverflow.com/a/67203353/8225672 | |
lines = [''] |
#/usr/bin/env bash | |
# usage: tesseract-dl.sh {copy/edit} {lang} https://example.com/image.png | |
# with no options specified it prints to STDOUT | |
which tesseract 1>/dev/null || alias tesseract='tesseract-ocr' # the binary name varies | |
image=$(mktemp --suffix tesseract-image) | |
outfile=$(mktemp --suffix tesseract.txt) | |
if [[ "$1" == "copy" ]]; then | |
subcommand="xclip -i $outfile" # replace with your clipboard manager of choice |
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/env bash | |
# toggle sticky for focused window | |
# requires xdotool | |
state=enabled | |
mywindow=$(xdotool getactivewindow) | |
if [[ $state == 'enabled' ]]; then | |
i3-msg "[id=$mywindow] sticky disable" | |
sed -i '5s/.*/state=disabled/' $0 | |
else |