Skip to content

Instantly share code, notes, and snippets.

View ernstki's full-sized avatar

Kevin Ernst ernstki

  • Earth, Sol
View GitHub Profile
@ernstki
ernstki / doclip.sh
Last active July 22, 2019 19:15
doclip - manipulate clipboard text easily from the command line (macOS and Linux)
#!/usr/bin/env bash
#
# Manipulate clipboard contents easily; optionally ensures a final newline is
# written to the output
#
# NB: If symlinked as 'reclip[.sh]', automatically re-copies to the clipboard
# (just as if you specified '-r')
#
# Author: Kevin Ernst <ernstki -at- mail.uc.edu>
# URL: https://gist.github.com/ernstki/a2e8237a0fdede6a8e553495b1d08301
@ernstki
ernstki / sshconfig.php
Last active November 1, 2020 15:33
GeSHi syntax for ~/.ssh/config
<?php
/*************************************************************************************
* sshconfig.php
* --------
* Author: Kevin Ernst (kevin.ernst -at- cchmc.org)
* Copyright: (c) 2017 Kevin Ernst
* Release Version: 1.0.9.1
* Date Started: 2017/12/01
*
* OpenSSH config file (~/.ssh/config) language file for GeSHi.
@ernstki
ernstki / relashify.sed
Created December 15, 2017 04:59
reslashify - a sed script to reverse slashes in pathnames (DOS <--> Unix)
#!/usr/bin/env sed -f
# replace all forward slashes only if there are no backslashes
# (i.e., convert Unix-style pathnames to DOS/Windows-style ones)
/\\/! s_/_\\_g
# branch (to the end) if any substitutions have been made at this point,
# to prevent the next pattern from undoing what the first one did
t
@ernstki
ernstki / test_titlecase.py
Last active July 22, 2019 19:03
titlecase - a Python AP-style title case capitalizer (works great with doclip.sh!)
#!/usr/bin/env python
# vim: fileencoding=utf-8
"""
Tests for titlecase.py
Invocation: python -m unittest test_titlecase.py
"""
import unittest
from titlecase import titlecase
@ernstki
ernstki / README.md
Last active May 9, 2025 09:41
List the ABI versions of all detected libc and libstdc++'s (GNU/Linux only)

Linker error messages related to libc and libstdc++

We run into the dreaded

/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.18' not found

error messages a lot around here. This article is an attempt to explain what's going on with that.

@ernstki
ernstki / dot-gitconfig-essentials.sh
Created April 24, 2018 21:12
.gitconfig essentials
# Use 'vimdiff' as the diff tool. See also git-diff(1)
# '-y' means don't prompt for every invocation
git config --global alias.vimdiff 'difftool -y -t vimdiff'
# A concise, formatted commit log
# Source: https://www.youtube.com/watch?v=W39CfI3-JFc
git config --global alias.lol 'log --graph --all --decorate --oneline'
# Colorize output (really helpful)
# Source: https://rogerdudler.github.io/git-guide/#hints
@ernstki
ernstki / dot-bashrc-essentials.sh
Last active May 1, 2024 14:19
Bash login essentials: stuff I always add to my login scripts, but never had all in one place
# .bashrc essentials
# copy and paste any parts that you need into your own ~/.bashrc
# you may get a nicer one by default from your *nix distro; uncomment this
# only if you have an ugly default "bash-x.y$" prompt string
#PROMPT="[\u@\h:\w]$ "
# trim the display of '\w' to just the last three path elements
PROMPT_DIRTRIM=3
@ernstki
ernstki / ffhist.py
Last active May 12, 2018 07:35
List, filter, and sort your Firefox profile's browsing history; requires Python 3.5 and the Click library (click.pocoo.org)
#!/usr/bin/env python
# coding: utf-8
#
# List, filter, and sort records from the SQLite database holding your Firefox
# profile's browsing history ('<profile>/places.sqlite#moz_places')
#
# In order to point this script at the correct Firefox profile, either use
# the '-p' option, or set an environment variable 'FFPROFILE' that is the
# complete path to the profile ('9ibBeri$h.default', for example)
#
@ernstki
ernstki / README.md
Last active May 19, 2023 19:06
Stop "Saved in parser cache with key" message from showing up in rendered page output; works with MediaWiki 1.30.x

Suppress MediaWiki parser cache key in rendered source

Stop messages like

<!-- Saved in parser cache with key wiki:pcache:idhash:9999-0!*!0!!en!*!* and timestamp 20180627230404 and revision id 9999
 -->

from appearing in the rendered page source for your MediaWiki articles.

@ernstki
ernstki / recase.sh
Last active July 22, 2019 19:04
recase - convert input (filename or standard input) to all upper-/lower-case
#!/bin/bash
#
# Re-case the input to all upper- / lower-case based on the name of the symlink
# that points to this script
#
# Author: Kevin Ernst <ernstki -at- mail.uc.edu>
# Date: 27 June 2018
#
ME=$(basename "$BASH_SOURCE")