This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Verifying that +tomhale is my blockchain ID. https://onename.com/tomhale |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NO LONGER UPDATED | |
# Merged into: https://gist.github.com/HaleTom/631efef6fb6ae86618128647dc887aee | |
################## | |
# Set the prompt # | |
################## | |
# Select git info displayed, see /usr/lib/git-core/git-sh-prompt for more | |
export GIT_PS1_SHOWDIRTYSTATE=1 # '*'=unstaged, '+'=staged | |
export GIT_PS1_SHOWSTASHSTATE=1 # '$'=stashed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Print the name of the git repository's working tree's root directory | |
# Search for 'Tom Hale' in http://stackoverflow.com/questions/957928/is-there-a-way-to-get-the-git-root-directory-in-one-command | |
# Or, shorter: | |
# (root=$(git rev-parse --git-dir)/ && cd ${root%%/.git/*} && git rev-parse && pwd) | |
# but this doesn't cover external $GIT_DIRs which are named other than .git | |
function git_root { | |
local root first_commit | |
# git displays its own error if not in a repository | |
root=$(git rev-parse --show-toplevel) || return | |
if [[ -n $root ]]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# System-wide .bashrc file for interactive bash(1) shells. | |
# To enable the settings / commands in this file for login shells as well, | |
# this file has to be sourced in /etc/profile. | |
# If not running interactively, don't do anything | |
[ -z "$PS1" ] && return | |
# don't put duplicate lines or lines starting with space in the history. | |
# See bash(1) for more options |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: gem-patch | |
# Code updates: https://gist.github.com/HaleTom/275f28403828b9b9b93d313990fc94f4 | |
# Features: | |
# Work around `patch` returning non-zero if some patch hunks are already applied | |
# Apply all patches in $patch_dir (in order) to their corresponding gem(s) | |
# Build a gem only after all patches have been applied | |
# Only build the gem if it was patched |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Functions to be sourced by .bashrc | |
# | |
# Ensure that ones to be accessed outside of .bashrc are added | |
# to the 'export' line at the very end. | |
# The absolute directory name of a file(s) or directory(s) | |
function abs_dirname { | |
for _ in $(eval echo "{1..$#}"); do | |
(cd "${dir:="$(dirname "$1")"}" && pwd || exit 1 ) | |
[[ $? -ne 0 ]] && return 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Tom Hale, 2016. MIT Licence. | |
# Print out 256 colours, with each number printed in its corresponding colour | |
# See http://askubuntu.com/questions/821157/print-a-256-color-test-pattern-in-the-terminal/821163#821163 | |
set -eu # Fail on errors or undeclared variables | |
printable_colours=256 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -eu | |
# Quote a single- or multi-line string for use in git's aliases | |
# Copyright (c) 2016 Tom Hale under https://en.wikipedia.org/wiki/MIT_License | |
quote() { | |
printf %s "$1" | sed -r 's/(["\\])/\\\1/g'; | |
} | |
IFS=$(printf '\n') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -eu | |
table_to_update=./compatible_table | |
source_extract=./option_extract | |
function get_decorated_options { | |
# option_extract > while read -r option; | |
while read -r line; do | |
name=$(printf %s "$line" | sed -rn 's/^\s*\{\s*"(\w+).*/\1/p') | |
# Get decoration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Safely backup the pacman databases to enable reversal of system upgrade. | |
# Use pacman -b <backupdirectory> to use the saved databses | |
# Latest version: https://gist.github.com/HaleTom/9dbffaf3369b86ca272ffe6a61a36aba | |
set -euo pipefail; shopt -s failglob # safe mode | |
db_lock=/var/lib/pacman/db.lck |
OlderNewer