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
@n8henrie
n8henrie / mount-image.sh
Created May 6, 2019
Script to mount all partitions from an image file into a temporary directory
View mount-image.sh
#!/bin/bash
set -Eeuf -o pipefail
if [ ! "$(whoami)" = root ]; then
echo "Please run as root"
exit 1
fi
TMP="$(mktemp -d)"
@n8henrie
n8henrie / repair.sh
Last active Mar 22, 2019
Fix time machine backup
View repair.sh
#!/usr/bin/env bash
# http://tonylawrence.com/post/unix/fixing-corrupted-time-machine-backups/
set -euf -o pipefail
if [[ $(whoami) != 'root' ]]; then
echo "Please run as root" > /dev/stderr
exit 1
fi
@n8henrie
n8henrie / setup_linux.sh
Last active Nov 10, 2017
Set up basic Linux preferences and settings
View setup_linux.sh
#! /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 'https://gist.githubusercontent.com/n8henrie/c69de3e3c9d99668965473d1d315c855/raw' >> "${HOME}"/.inputrc
curl 'https://gist.githubusercontent.com/n8henrie/3e251bfe9ac9d5ce7421/raw' >> "${HOME}"/.vimrc
curl 'https://gist.githubusercontent.com/n8henrie/6cf7785d0ae025e706522e6e64c3fba2/raw' >> "${HOME}"/.bash_aliases
@n8henrie
n8henrie / .bashrc
Last active Apr 18, 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)
# http://unix.stackexchange.com/questions/40678/can-i-make-there-are-stopped-jobs-harder-to-kill
prompt_command() {
job_count=$(jobs | wc -l | tr -d ' ')
if [ $job_count -gt 0 ] ; then
prompt_job="[$job_count]"
@n8henrie
n8henrie / .bash_aliases
Created Nov 6, 2017
My basic bash_aliases for a Linux system
View .bash_aliases
aur_download() {
aur_url="https://aur.archlinux.org$(curl -s "https://aur.archlinux.org/packages/$1" | ack -o "(?<=href=\").*?tar.gz(?=\">)")"
echo "$aur_url"
read -p "Download the above url? [yn] " response
case $response in
[Yy])
wget "$aur_url"
echo "You still need to do the usual: tar -xvf; cd; makepkg -s; pacman -U;"
;;
*)
@n8henrie
n8henrie / get_opencv3.sh
Last active Jun 19, 2018
Download, build, and install opencv on Raspberry Pi 3
View get_opencv3.sh
#! /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}"
fi
done
@n8henrie
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
Desired=Unknown/Install/Remove/Purge/Hold
| 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
@n8henrie
n8henrie / 2017-09-07-raspbian-stretch-lite.txt
Created Sep 17, 2017
Default packages on fresh image of Raspbian Stretch Lite 2017-09-07 SHA-256: bd2c04b94154c9804cc1f3069d15e984c927b750056dd86b9d86a0ad4be97f12
View 2017-09-07-raspbian-stretch-lite.txt
Desired=Unknown/Install/Remove/Purge/Hold
| 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 alsa-utils 1.1.3-1 armhf Utilities for configuring and using ALSA
ii apt 1.4.7 armhf commandline package manager
ii apt-listchanges 3.10 all package change history notification tool
ii apt-transport-https 1.4.7 armhf https download transport for APT
@n8henrie
n8henrie / Average Internet Speed.ipynb
Last active Mar 28, 2019
My average internet speed over the last year or so
View Average Internet Speed.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@n8henrie
n8henrie / whois.py
Last active Apr 10, 2019
Python transliteration of whois tool, taken from http://code.activestate.com/recipes/577364-whois-client/
View whois.py
"""
Whois client for python
https://gist.github.com/n8henrie/dc55b8fb366710003b5d3c557dfc4469
transliteration of:
http://www.opensource.apple.com/source/adv_cmds/adv_cmds-138.1/whois/whois.c
The MIT License (MIT)
You can’t perform that action at this time.