Skip to content

Instantly share code, notes, and snippets.

Nathan Henrie n8henrie

Block or report user

Report or block n8henrie

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
#!/usr/bin/env python3
import argparse
import sys
import typing as t
__author__ = "Benjamin Kane"
__version__ = "0.1.0"
__doc__ = f"""
Pretty-print simple Bash command from one line of stdin
n8henrie / congress.ipynb
Last active Dec 20, 2019
A quick look at congress bills in recent history by unified or divided congress
View congress.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python3
"""Send files to MacOS trash bin via applescript."""
import os
from pathlib import Path
import sys
import subprocess
from typing import Iterable, Union
def trash(paths: Iterable[Union[str, Path]]) -> int:
n8henrie /
Created May 6, 2019
Script to mount all partitions from an image file into a temporary directory
set -Eeuf -o pipefail
if [ ! "$(whoami)" = root ]; then
echo "Please run as root"
exit 1
TMP="$(mktemp -d)"
n8henrie /
Last active Apr 15, 2020
Fix time machine backup
#!/usr/bin/env bash
set -euf -o pipefail
set -x
if [[ $(whoami) != 'root' ]]; then
echo "Please run as root" > /dev/stderr
exit 1
n8henrie /
Last active Nov 10, 2017
Set up basic Linux preferences and settings
#! /bin/bash
echo '# Begin n8henrie settings' >> "${HOME}"/.inputrc
echo '" Begin n8henrie settings' >> "${HOME}"/.vimrc
echo '# Begin n8henrie settings' >> "${HOME}"/.bash_aliases
echo '# Begin n8henrie settings' >> "${HOME}"/.bashrc
curl '' >> "${HOME}"/.inputrc
curl '' >> "${HOME}"/.vimrc
curl '' >> "${HOME}"/.bash_aliases
n8henrie / .bashrc
Last active Oct 31, 2019
My basic .bashrc for Linux systems
View .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# Reset path (or else it gets longer each time this is sourced)
export PATH=$(getconf PATH)
prompt_command() {
job_count=$(jobs | wc -l | tr -d ' ')
if [ $job_count -gt 0 ] ; then
n8henrie / .bash_aliases
Created Nov 6, 2017
My basic bash_aliases for a Linux system
View .bash_aliases
aur_download() {
aur_url="$(curl -s "$1" | ack -o "(?<=href=\").*?tar.gz(?=\">)")"
echo "$aur_url"
read -p "Download the above url? [yn] " response
case $response in
wget "$aur_url"
echo "You still need to do the usual: tar -xvf; cd; makepkg -s; pacman -U;"
n8henrie /
Last active Jun 19, 2018
Download, build, and install opencv on Raspberry Pi 3
#! /bin/bash
set -euf -o pipefail
function cleanup {
for pid in "${opencv_download_pid:-''}" "${contrib_download_pid:-''}" "${pip_install_pid:-''}"; do
if [ -z "${pid}" ]; then
kill "${pid}"
n8henrie / 2017-09-07-raspbian-stretch.txt
Created Sep 17, 2017
Default packages on fresh image of Raspbian Stretch 2017-09-07 SHA-256: a64d742bc525b548f0435581fac5876b50a4e9ba1d1cd6433358b4ab6c7a770b
View 2017-09-07-raspbian-stretch.txt
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
ii adduser 3.115 all add and remove users and groups
ii adwaita-icon-theme 3.22.0-1+deb9u1 all default icon theme of GNOME
ii alacarte 3.11.91-2+rpi5 all easy GNOME menu editing tool
ii alsa-base 1.0.27+1 all dummy package to ease purging of obsolete conffiles
ii alsa-utils 1.1.3-1
You can’t perform that action at this time.