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
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 / wmiscan.py
Created November 11, 2012 09:51
win32 wmi scanner
# Jeff Quast
# 11/10/05
#
# Program Purpose:
#
# Scan for machines on domain, and build a database
# of machines. Populate database with WMI data retrieved
# from host through parallel scanning. Dump successful
# retrievals to comma-delimited file for 3rd party import.
domain = 'zzz'
@jquast
jquast / gist:5873193
Created June 27, 2013 01:06
A command-line weather program ksh, netcat, and the telnet host rainmaker.wunderground.com. Would also be fine with bash.
#!/bin/ksh
# my weather program, using netcat as a telnet client.
set -e
hostport='rainmaker.wunderground.com 23'
if [ -z "$1" ]; then
read state?"2-letter U.S. State abbreviation? "
echo "Fetching airport codes for US State: '"${state}"'."
(echo; echo; echo 1; echo 3; echo $state; echo X; ) \
@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 / move-zone.sh
Created March 12, 2013 04:25
Solaris 10 zone migration script -- transfers a virtual machine to another physical host by ssh.
#!/bin/ksh
# contact@jeffquast.com
#
# move a zone by replicating a zfs container to a remote host,
# exporting and importing the zone configuration and attaching the container,
# then destroying the previous zone after the destination zone is verified.
#
# default containers are 'tank' or 'rootpool'
#
# references:
@jquast
jquast / ansirama.c
Created November 9, 2012 00:42
some silly C ansimation
#include <stdio.h>
#include <math.h>
/* modify speed if it runs too fast */
#define SPEED 20
#define FLAKES 128
#define FLIES 15
#define COLUMNS 80
#define ROWS 25
#define CENTER_X 40
@jquast
jquast / ansi-codes.php
Created November 14, 2012 02:42
ansi-codes.php ansi.php
<?php
// -rwxr--r-- 0 jeremy users 1982 Feb 12 2003 ansi-codes.php
// -rwxr--r-- 0 jeremy users 1166 Feb 13 2003 ansi.php
function ansi_decode($ansicodes){
$fontline="<font ";
$ansi=explode(";",$ansicodes[0]);
$attrib=0;
for($code=0;$code<count($ansi);$code++){
switch ($ansi[$code]) {
case 0:
@jquast
jquast / ncurses_pong.php
Created November 14, 2012 02:31
ncurses pong in php, -jbrenner
#! /usr/bin/env php
# $Id: pong.phps,v 1.2 2006/01/28 14:45:22 dingo Exp $
# imported via lynx -dump 2006 jdq, orig by theedge@efnet
<?php
/*
Jeremy Brenner 2005
*/
ncurses_init();
ncurses_timeout(0);
ncurses_cbreak();