Skip to content

Instantly share code, notes, and snippets.

@hackerb9
hackerb9 / guest-account.sh
Last active March 5, 2016 01:43 — forked from pixline/guest-account.sh
/usr/sbin/guest-account script (debian version)
#!/bin/bash
# (C) 2008 Canonical Ltd.
# Author: Martin Pitt <martin.pitt@ubuntu.com>
# License: GPL v2 or later
# modified by David D Lowe and Thomas Detoux
# Debian 7 support by pixline <pixline@gmail.com>
# Cinnamon support by hackerb9 <hackerb9@gmail.com>
# 2016 major cleanup by hackerb9: cinnamon, debian 8, default extra groups, etc.
#
@hackerb9
hackerb9 / lsix
Created June 3, 2017 03:32
lsix: like 'ls' but shows images within a terminal using SIXEL graphics
#!/bin/bash
# lsix: like ls, but for images.
# Shows thumbnails of images with titles directly in terminal.
# Version 1.0
# hackerb9, June 2017
numcolors=16 # Number of colors in the palette, if TERM is not xterm
@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 / italicneep-kludge
Created June 5, 2017 11:48
How to kludge neep font to pretend to have italics
# Neep is the loveliest bitmap terminal font I've found so far with good Unicode coverage.
# Unfortunately, neep has no italics.
#
# As a quick workaround, one can use the terminus-oblique font as a replacement by using X fonts.alias.
sudo apt-get install xfonts-jmk xfonts-terminus-oblique
echo "-jmk-neep-medium-o-normal--20-180-75-75-c-100-iso10646-1 -xos4-terminus-bold-o-normal--20-200-72-72-c-100-iso10646-1" > local.alias
echo "-jmk-neep-medium-o-normal--15-140-75-75-c-80-iso10646-1 -xos4-terminus-bold-o-normal--14-140-72-72-c-80-iso10646-1" >> local.alias
sudo cp -i local.alias /etc/X11/fonts/misc/local.alias \
@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)
@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 / 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 / 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")))'
#!/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 / 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: