Skip to content

Instantly share code, notes, and snippets.

@hackerb9
hackerb9 / gist:dfce5c08f358697240c24867491d1776
Created August 30, 2018 11:46
Sum of Factors (brainteaser)
#!/usr/bin/python3
# Sum of Factors. hackerb9 2018.
# This is a generalization of a certain type of numeric logic puzzle
# that gives you a hint by telling you that the previous hints were
# insufficient: that is, you now know that the answer is one that
# could be arrived at two different ways. Here's an example, as told
# by Jim Fixx in the 1970's:
############################################
@hackerb9
hackerb9 / pdfpagelink.txt
Created April 30, 2018 20:11
URL that opens a PDF to a specific page
@hackerb9
hackerb9 / silvery.png
Last active January 16, 2023 13:04
Freesound Logo, silvery SVG
silvery.png
@hackerb9
hackerb9 / gst
Created April 26, 2018 22:31
testing gist script
#!/bin/bash
# gist.sh from https://github.com/kathawala/gist
# A bash script meant to take in user input, craft an API call to Github's Gist
# API and send the request, with content and filename filled in by the user
#Sends error on script failure
set -o errexit
USER=-uhackerb9
@hackerb9
hackerb9 / transparentxterm.ds
Created March 12, 2018 10:30
Devilspie recipe to make all xterms slightly transparent
;;; -*- lisp -*-
;; Just for fun, playing around with making all my xterms lightly transparent.
;; NB: This makes titlebar and text transparent, too.
(if (is (window_class) "XTerm")
(spawn_async
(str "xprop -id " (window_xid)
" -f _NET_WM_WINDOW_OPACITY 32c"
" -set _NET_WM_WINDOW_OPACITY 0xf8000000")))
;; Example:
#!/bin/bash
# Watch files in the current working directory (or given argument)
# display how much a file has grown in the last second (or so)
# B9 2018
if [ -d "$1" ]; then
cd "$1"
shift
fi
@hackerb9
hackerb9 / nonraspbian
Created December 10, 2017 12:43
Find unofficial packages installed on a Raspberry Pi running Raspbian
#!/bin/sh
# nonraspbian -
#
# Find packages installed on my Pi which aren't from the official
# Raspberry Pi repositories.
aptitude search '?narrow(?installed,!?or(?origin("Raspberry Pi Foundation"),?origin("Raspbian")))'
@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)
@hackerb9
hackerb9 / extract_cookies.sh
Last active December 2, 2025 08:45 — 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 / opticalsizes.txt
Last active July 28, 2017 23:37
What fontsizes are "opticals" designed for?
Caption: -. point
Regular: -. point
Subhead: -. point
Display: -+ point
(For Adobe WarnockPro Opticals)