Skip to content

Instantly share code, notes, and snippets.

View jquast's full-sized avatar
🐡
I may be slow to respond.

Jeff Quast jquast

🐡
I may be slow to respond.
View GitHub Profile
#!/usr/bin/env python
#-u
# Python 2.4+ required
# by contact@jeffquast.com
# This utility creates a multiplexing i/o pipe between a master process
# and multiple child processes. The master process reads in one input file
# and delegates equal chunks of those files into each child process.
#
# The child process script may be a binary program, too. so long as it
import blessed
import os, glob
import math
# TODO:
# - fast in-memory string compression of output
# - run at ~some fps, index into frames by rtt /2 use terminal query
import asyncio, telnetlib3
class MyTelnetServer(telnetlib3.TelnetServer):
def on_naws(self, rows, cols):
#### note: I wouldn't recommend using the python library of libchafa, at least, at the time of authoriship,
### it segfaulted every ~100 calls. I would suggest to use subprocess.Popen family of calls to the 'chafa'
### CLI utility, instead.
# TODO: calibration of FONT_RATIO:
import os
# ".. make a perfect circle ..."
import blessed
from chafa import *
public class ChessPiece {
String kind;
Position pos;
ChessPiece next;
ChessPiece(String kind, int xpos, int ypos)
{
this.kind = kind;
this.pos = new Position(xpos, ypos);
next = null;
@jquast
jquast / pizza_shop.py
Created August 16, 2022 21:55
how to drain the world's economy in less than one year
# inspired by https://www.theverge.com/2020/5/18/21262316/doordash-pizza-profits-venture-capital-the-margins-ranjan-roy
import math
starting_cash = 16
cost_to_order = 16
doordash_pays = 24
cost_of_pizza = 4
cash = starting_cash
@jquast
jquast / rfile.sh
Created March 2, 2022 20:44
zsh or bash function to show most recently modified file in current folder, or folder given
function rfile {
base=''
[ -n "${1}" ] && base="$1"/
ls -1rt ${1:-} | tac \
| while read f
do [ -f "${base}$f" ] && echo ${base}$f && break
done
}
import os
import time
import slack
import random
client = slack.WebClient(token=os.environ['SLACK_BOT_TOKEN'])
#response = client.chat_postMessage(
# channel=' #adam-test-channel',
# text="Hello world!")
@jquast
jquast / bytesize.sh
Created August 6, 2021 15:16
bytesize.sh
#!/bin/ksh
awk -v scale=$1 -v precision=$2 '
BEGIN {
# f_bytes and b_bytes, forwards and backwards for up and down-scaling
f_bytes="B K M G T P E Z"
b_bytes="Z E P T G M K B"
usage=0 # flipped on error condition, exit with usage
if ((scale == "-h") || (scale == "--help"))
usage=1
@jquast
jquast / ChessPiece.java
Created May 27, 2021 17:08
ChessPiece.java
public class ChessPiece {
String kind;
Position pos;
ChessPiece next;
ChessPiece(String kind, int xpos, int ypos)
{
this.kind = kind;
this.pos = new Position(xpos, ypos);
next = null;
@jquast
jquast / data.json
Created June 8, 2020 04:40
Uncide characters, new wide, by version
{
"5.1.0": [
12752,
12753,
12754,
12755,
12756,
12757,
12758,
12759,