Skip to content

Instantly share code, notes, and snippets.

View chmaynard's full-sized avatar
:octocat:
Dealing with unintended consequences

Craig H Maynard chmaynard

:octocat:
Dealing with unintended consequences
View GitHub Profile
@chmaynard
chmaynard / bash_history.sh
Last active May 29, 2023 23:50
bash interactive command history in an sqlite database
#------------------------------------------------------------------------------
#
# Record bash interactive command history in an sqlite database
# Requires: https://github.com/rcaloras/bash-preexec
# Usage: source $BASH_HOME/.bash_history.sh
#
#------------------------------------------------------------------------------
compress_bash_history()
{
@chmaynard
chmaynard / slugify.sh
Last active February 5, 2023 05:59
Bash slugify function
#------------------------------------------------------------------------------------------
# Slugify
#
# Usage: stdin -> slugify -> stdout
# Example: $ printf "%s\n" "FYI: 'Tacit Programming' is Cool!" | slugify
# Source: https://duncanlock.net/blog/2021/06/15/good-simple-bash-slugify-function/
#
# 1. Transliterate everything to ASCII
# 2. Strip out apostrophes
# 3. Replace non-alphanumeric runs with a dash
"\C-g": abort
"\C-x\C-g": abort
"\e\C-g": abort
"\C-j": accept-line
"\C-m": accept-line
# alias-expand-line (not bound)
# arrow-key-prefix (not bound)
# backward-byte (not bound)
"\C-b": backward-char
source 'https://rubygems.org'
gem 'jekyll'
gem 'json'
gem 'liquid', '4.0.3'
# gem 'openssl'
gem 'rake'
gem 'sassc'
gem 'webrick'