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 / 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 / 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:
@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 / pdfpagelink.txt
Created April 30, 2018 20:11
URL that opens a PDF to a specific page
@hackerb9
hackerb9 / ttest.bc
Created September 13, 2018 08:02
Example of performing Student's t-test using the GNU bc calculator. The heart of this is just the short function at the beginning, the rest is there to make using it easier. (For example, there's a t-table builtin to tell you if the means are significantly different.)
/* Student's t-test (Two Independent Samples) */
/* Implemented in GNU bc by hackerb9, 2018. */
/* Copyright assigned to FSF. */
/*
*
* µ₀ - µ₁
* t = ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
* ⎡ ⎤ ½
* ⎢ (ΣA² - (ΣA)²/n₀) + (ΣB² - (ΣB)²/n₁) ⎛ 1 1 ⎞ ⎥