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 / Makefile
Last active January 14, 2025 13:30
Test multiple versions of Package X against multiple versions of Package Y
##
## Test multiple versions of delta[1] against multiple versions of bat[2]
## and stop when there's a failure
##
## Tested with GNU Make 4.x on Linux; YMMV with macOS or BSD
##
## Author: Kevin Ernst <ernstki -at- mail.uc.edu>
## Source: https://gist.github.com/ernstki/7dbb17c42911708660dc3c4eee3c1002
## License: released to the public domain
##
@ernstki
ernstki / fc-reject.pl
Last active December 18, 2024 04:52
Easily disable fonts that aren't in your language, for Debian and derivatives (and possibly other Linux distros)
#!/usr/bin/env perl
##
## Usage: fc-reject.pl > ~/.config/fontconfig/conf.d/88-reject.conf
## Author: Kevin Ernst <ernstki -at- mail.uc.edu>
## License: MIT or CC-BY-SA-4.0, at your option
## Source: https://gist.github.com/ernstki/2ae279ad89888e4099c9852bf0ba5d11
##
use v5.12;
use warnings;
use autodie;
@ernstki
ernstki / flatpak-link
Last active November 23, 2024 19:16
Create symlinks in your ~/bin for Flatpak apps, with sensible names
@ernstki
ernstki / gitlapi
Last active November 23, 2024 18:48
Query GitLab v4 API endpoints with curl and jq; handles record pagination
#!/usr/bin/env bash
##
## Query a GitLab v4 API endpoint, with pagination
##
## Author: Kevin Ernst <ernstki -at- mail.uc.edu>
## License: ISC or WTFPL, at your discretion
## Date: 22 May 2024
## Requires: jq (https://github.com/jqlang/jq)
## Homepage: https://gist.github.com/ernstki/3707675c8a4ddb06d128154947c49e29
##
@ernstki
ernstki / Bash completion example.md
Last active November 23, 2024 18:24
Bash programmable completion example for "cuddled" options + arguments

Bash programmable completion for -nvalue / --name=value options

I was reading [an old debian-administration.org post][debadm] about [Bash programmable completion][pcomp], and I had the same question as this person:

I created a script and I use bash_completion, but I cannot figure out how to allow the completion of "--name=value1 --name=value2" (the "=" sign in the middle stop any other completion, and I tried to play with suffixes/prefixes without any success :s

@ernstki
ernstki / Classy .screenrc.md
Last active November 23, 2024 18:21
screenrc with a decent-looking caption / hardstatus line, including LSF job status

A classy .screenrc with LSF support

Screenshot of what you get

Here's a sensible .screenrc that does the following:

  • gives you a useful and hip-looking status line
  • tries really hard to enable 256 color support for programs that support it, like Vim
  • disables the visual bell and splash screen
  • remaps window #0 to be Ctrl+A, `, which feels more natural to me
@ernstki
ernstki / "Uncuddle" command line args.md
Last active November 23, 2024 18:20
Bash function to separate "cuddled" options like '-nvalue' or '--name=value'

"Uncuddle" arguments like -pVALUE, or --param=VALUE

Here's a Bash function that will separate option-value pairs where the option and value are glued together without an intervening space.

You give it:

  • a bunch of possible prefixes as arguments, like -p, --param=, and --parameter=
  • and as the last argument, the maybe-option-value-pair to be checked ($1 in the while (( $# )) loop below)

and it returns the VALUE part, or the empty string if there was no VALUE part (the option and argument were separate).

@ernstki
ernstki / !CHECKSUM_HOWTO.md
Last active November 23, 2024 18:19
How to create (and verify) checksums for NGS data

Hello, collaborators!

If you have the ability to do so, please compute SHA1 hashes for any files you intend to share with the Weirauch Lab. These hashes, or "checksums," are critical for verifying that we've received your data 100% intact and unmodified.

You will need to save these checksums into a file, then transmit or store that file alongside the original data. Instructions for macOS and Linux are directly below. For Windows, please follow the instructions in the "Generating checksums on Windows" section.

Generating checksums on Unix

Here is a one-liner that will do the job on a typical Unix/Linux system. macOS is also Unix, but if you are not familiar with the command line, see the section "Extra guidance for Mac users," below. If you use Windows and have Git Bash or Cygwin available, this method should also work for you.

@ernstki
ernstki / !PRETTY_PRINT_KEEPASS_XML.md
Last active November 23, 2024 18:19
Pretty-printing stylesheet for KeePass XML exports

Pretty-printing KeePass XML export files

First, create an XML export using [KeePass for Windows][kp]—not KeePassX, the export format is completely different.

Then add a line like:

@ernstki
ernstki / xhr_hook_example.js
Last active November 20, 2024 22:41
Boilerplat for a userscript that hooks into the XHR 'load' event, for handling lazy-loaded pages
// ==UserScript==
// @name XHR Hook Example
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Hook into XHR requests
// @match *://*/*
// @grant none
// ==/UserScript==
// source: