Skip to content

Instantly share code, notes, and snippets.

Avatar
💨

underwood thunderpoot

💨
View GitHub Profile
@thunderpoot
thunderpoot / findwords.pl
Last active May 12, 2023 23:30
Simple Perl script to find words containing only letters provided as argument
View findwords.pl
#!/usr/bin/env perl
# This script is useful when proofing with only some glyphs completed…
# Usage example:
# $ perl findwords.pl qwertyasdf
# Searching for words in /usr/share/dict/words containing only q, w, e, r, t, y, a, s, d, f
# westerwards
# afterstate
# aftertaste
@thunderpoot
thunderpoot / gifserver
Created January 29, 2021 20:29
a small telnet gif server using gif-for-cli and netcat
View gifserver
#!/bin/bash
if [ $# -eq 0 ]
then
echo "%usage: $0 <id> [options]"
exit
fi
echo "[$0] 🌶 Now servin' up hot GIFs!"
@thunderpoot
thunderpoot / bas.bas
Last active November 22, 2021 23:51
Program for running BASIC one-liners from the TH prompt
View bas.bas
0 rem bas.bas - by underwood
1 rem usage: bas <single line of BASIC code>
10 if left$(arg$,1) = " " then arg$ = mid$(arg$,1) : goto 10
20 if asc(left$(arg$,1)) > 47 and asc(left$(arg$,1)) < 58 then arg$ = mid$(arg$,1) : goto 10
21 rem strip leading spaces and line numbers
30 arg$ = "1 " + arg$
31 rem prepend our line with line number 1
@thunderpoot
thunderpoot / append.bas
Created November 14, 2020 12:33
append.bas - a program for appending text to files
View append.bas
10 if argv$(1) = "" or argv$(2) = "" then print "%usage: append <file> <data>" : end
20 open argv$(1), as #1
30 if eof(1) = -1 then goto 60
40 input# 1, dump$
50 goto 30
60 print# 1, argv$(2)
70 close #1
@thunderpoot
thunderpoot / skipping_stones.py
Created November 2, 2020 17:46
...ported from Perl version
View skipping_stones.py
#!/usr/bin/python
import random
import time
import sys
class Unbuffered( object ) :
def __init__( self, stream ) :
self.stream = stream
def write( self, data ) :
@thunderpoot
thunderpoot / skipping_stones.pl
Last active November 1, 2020 23:14
In response to some Python someone posted somewhere
View skipping_stones.pl
#!/usr/bin/perl
use strict;
use warnings;
use Time::HiRes 'usleep';
$|++; # force auto-flush (see perldoc perlvar)
my $distance = 1 + int(rand(49));
my @stones = ("_","-");
@thunderpoot
thunderpoot / blank-bbs.bas
Created September 7, 2020 18:35
A blank Telehack bbs with a rudimentary login
View blank-bbs.bas
0 rem settings ------------------------------------------------------
1 hostname$ = "myhost" : rem enter hostname in lowercase
2 admin$ = "admin" : rem administrator name in lowercase
3 backdoor$ = "default" : rem default password
4 allowguests = 1 : rem enable / disable guest access
5 zzz = 0.3 : rem global print timer
6 motd$ = "motd.txt" : rem load external motd file
9 rem ---------------------------------------------------------------
@thunderpoot
thunderpoot / lolcat.bas
Created August 26, 2020 14:21
"lolcat" style program for TeleBASIC
View lolcat.bas
10 if argv$(1) = "-h" then print "%usage: " + argv$(0) + " <string>" : end
20 if arg$ = "" then input "" ; in$ : goto 40
30 in$ = arg$
40 e$ = chr$(27)
50 def fnfg$(colour) = e$ + "[38;5;"+str$(colour)+"m"
60 r = 16 + int( rnd(215) )
70 if r + len(in$) > 231 then goto 60
80 for i = 1 to len(in$)
90 print fnfg$(r+i) ;
100 print mid$(in$,i,1);
@thunderpoot
thunderpoot / screen_functions.bas
Last active October 2, 2021 11:35
Locate without using locate, cls without using cls, various examples.
View screen_functions.bas
10 e$ = chr$(27)
20 def fnLocate$( y, x ) = chr$(27) + "[" + str$( y ) + ";" + str$( x ) + "f"
30 def fnCentre$(x$) = e$ + "[H" + e$ + "[" + str$(int(height/2)) + "B" + e$ + "[" + str$(int((width/2))-int(len(x$)/2)) + "C" + x$
40 def fnCls$(x$) = e$ + "[H" + e$ + "[J" + x$
50 print fnCls$( fnCentre$( "foo" ) )
60 print fnLocate$(10, 10) + "bar"
@thunderpoot
thunderpoot / cp.bas
Last active November 22, 2021 23:52
cp - copy files in telehack
View cp.bas
10 if len(argv$(1)) < 2 then gosub 160 : end
20 if argv$(2) = "" then gosub 160 end
30 if instr(dir$, argv$(1)) < 0 then print "%file not found" : end
40 myf$ = mid$(mid$(dir$, instr(dir$, argv$(1))),2)
50 myf$ = left$(myf$, instr(myf$, " "))
60 print " copy " + myf$ + " to " + argv$(2) "? y/N" ; : cont1$ = inkey$
70 print
80 if cont1$ <> "y" then end
90 gosub 180
100 gosub 210