Skip to content

Instantly share code, notes, and snippets.

@hackerb9
hackerb9 / example.svg
Last active April 5, 2024 16:57
Extract vector images from funky PDF files
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hackerb9
hackerb9 / extract_cookies.sh
Last active March 31, 2024 17:04 — forked from spk/extract_cookies.sh
Extract cookies.sqlite to cookies.txt for use in wget or curl.
#!/bin/bash -e
# extract_cookies.sh:
#
# Convert from Firefox's cookies.sqlite format to Netscape cookies,
# which can then be used by wget and curl. (Why don't wget and curl
# just use libsqlite if it's installed?)
# USAGE:
#
# $ extract_cookies.sh > /tmp/cookies.txt
@hackerb9
hackerb9 / foo.png
Last active March 6, 2024 06:53
Example output from rembg
foo.png
@hackerb9
hackerb9 / bwtest.sh
Last active December 3, 2023 17:15
Busybox compatible simple speedtest that downloads a file to /dev/null. Useful for sshing into various routers and seeing where the bottleneck is.
#!/bin/sh
# Silly speed test just by downloading a file directly to /dev/null
# Useful on routers which only have busybox installed.
# ↄ⃝🄯 B9 2016, 2018, 2023. Creative Commons Zero.
# NOTA BENE: cachefly has worked for over a decade, however they may
# be getting tired of scripts like this. Starting February 2023, their
# 100mb.test file is empty and the 50mb.test file holds 100MB.
dotest() {
@hackerb9
hackerb9 / sixcat
Created June 3, 2017 03:36
sixcat: Like 'cat' but show images directly in the terminal using SIXEL graphics
#!/bin/bash
# sixcat: Use sixel graphics to show an image inside a terminal.
# sixgif: Use sixel graphics to play an animation inside a terminal.
# Version 1.0
# hackerb9, June 2017
# Sixel graphics are supported by terminals such as the DEC VT340 and
# emulators, such as 'xterm -ti vt340'.
@hackerb9
hackerb9 / bogodisk
Created August 1, 2021 05:19
A quick hack, no-frills disk speed test. Works with any mountable filesystem (SSD/SATA/IDE/tmpfs...). Just specify the directory you'd like to write the test file to -- defaults to /tmp. Uses 'dd' for a quick test (default is 64MB) and then tries hdparm to run a three second test of direct I/O (no filesystem). It's just a shell script, so this s…
#!/bin/bash -e
# Bogus disk speed tester by b9 2016-2021
# Well, not exactly bogus, but overly simplistic.
TMPDIR=/tmp # where to write the file
COUNT=64 # number of blocks
BS=1 # blocksize (in *MEGA*bytes)
total=$((COUNT*BS))
[ "$1" ] && TMPDIR="$1" # Usage: bogodisk [dir [count]]
#!/bin/bash
# XXX showanddelete hacked to show best view by default and to
# change the image every five seconds if no key pressed.
# Maximum number of seconds to wait for a response from the terminal
# after a an escape sequence query. Usually, terminals respond much
# faster than 0.1 seconds, but may need to be increased for slow links
# (e.g., RS232C, ssh).
TIMEOUT=0.1
@hackerb9
hackerb9 / silvery.png
Last active January 16, 2023 13:04
Freesound Logo, silvery SVG
silvery.png
@hackerb9
hackerb9 / duration.sh
Created December 9, 2017 11:37
Bourne shell functions to show informal English time spans
# Some handy informal duration functions in Bourne shell (bash is fine, too).
# duration(): given seconds, returns commonsense equivalent duration.
# ago(): given seconds from epoch, compares to current time.
# howlongago(): show how long ago a file or subdir was last modified.
# given a file, shows how long ago that file was updated.
# given a directory, recursively searches for most
# recently changed FILE (not directory)

RS-232 speed vs tokenization speed of TRS-80 Model 100

File is 16,197 bytes, ASCII BASIC.

Command Bits per second Time Effective bps
LOAD "COM:98N1ENN" 19200 58s 2793
LOAD "COM:88N1ENN" 9600 59s 2745
LOAD "COM:68N1ENN" 2400 78s 2076
LOAD "COM:48N1ENN" 600 270s 600