Skip to content

Instantly share code, notes, and snippets.

View thunderpoot's full-sized avatar
💨

underwood thunderpoot

💨
View GitHub Profile
@thunderpoot
thunderpoot / loader.bas
Last active February 29, 2020 11:25
Loading bar in TeleBASIC
10 PRINT "Loading..." : PRINT : S% = 1 : E% = 60 : FOR T% = S% TO E%
20 SLEEP 0.1 : REM YOUR PROGRAM LOGIC HERE, ADJUST S% AND E% VALUES
30 MD = INT((T%/E%*100)/10) : ML = 10 - INT((T%/E%*100)/10) : P% = INT(T%/E%*100)
40 IF O% <> P% THEN GOTO 50 : ELSE IF P% <> 100 THEN NEXT T%
50 PRINT CHR$(27) "[A" "[" STRING$(MD, "#") STRING$(ML, " ") "] " STR$(P%) "%" : O% = P% : NEXT T%
60 PRINT CHR$(27) "[A" CHR$(27) "[18C" "Done"
@thunderpoot
thunderpoot / skipping_stones.pl
Last active November 1, 2020 23:14
In response to some Python someone posted somewhere
#!/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 / skipping_stones.py
Created November 2, 2020 17:46
...ported from Perl version
#!/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 / gifserver
Created January 29, 2021 20:29
a small telnet gif server using gif-for-cli and netcat
#!/bin/bash
if [ $# -eq 0 ]
then
echo "%usage: $0 <id> [options]"
exit
fi
echo "[$0] 🌶 Now servin' up hot GIFs!"
@thunderpoot
thunderpoot / findwords.pl
Last active March 2, 2025 12:45
Simple Perl script to find words containing only letters provided as argument
#!/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 / cc_fetch_page.py
Last active November 8, 2024 22:33
An example of fetching a page from Common Crawl using the Common Crawl Index
import requests
import json
# For parsing URLs:
from urllib.parse import quote_plus
# For parsing WARC records:
from warcio.archiveiterator import ArchiveIterator
# The URL of the Common Crawl Index server
@thunderpoot
thunderpoot / ghostbuster
Created January 30, 2024 22:39
Mosh: You have N detached Mosh sessions on this server
#!/bin/bash
# You know that really annoying message that pops up...
# Mosh: You have 3 detached Mosh sessions on this server, with PIDs:
# - mosh [2294539]
# - mosh [1874313]
# - mosh [2294805]
# I often find myself copying this list of PIDs in order to kill them manually
@thunderpoot
thunderpoot / describe_parquet.py
Last active March 2, 2025 12:45
Parquet Examples
import os
import pyarrow.parquet as pq
def describe_parquet(file_path):
file_size = os.path.getsize(file_path)
print(f"File Size: {file_size} bytes")
table = pq.read_table(file_path)
columns = table.column_names
@thunderpoot
thunderpoot / vinyl.py
Created July 11, 2024 22:37
Simple Python program to simulate playing a track at a different speed on a turntable
#!/usr/bin/env python3
# _ _
# __ __ (_) _ __ _ _ | | _ __ _ _
# \ \ / / | | | '_ \ | | | | | | | '_ \ | | | |
# \ V / | | | | | | | |_| | | | _ | |_) | | |_| |
# \_/ |_| |_| |_| \__, | |_| (_) | .__/ \__, |
# |___/ |_| |___/
# This command-line program allows you to change the playback speed of an
@thunderpoot
thunderpoot / cc-get-page.sh
Created October 23, 2024 20:11
A shell script to retrieve a single HTML page from a Common Crawl archive
#!/bin/bash
# This script retrieves WARC (Web ARChive) data from Common Crawl based on a specified URL.
# It fetches the metadata for the URL, downloads the relevant segment of the WARC file, and extracts the HTML content.
# The script can also fetch the latest crawl data from Common Crawl's collection info.
# It uses Python's warcio library to extract HTML content and can open the result in the user's default browser.
# Usage: ./script.sh [URL] [optional: crawl name]
# If no crawl name is provided, the latest crawl is automatically selected.