Skip to content

Instantly share code, notes, and snippets.

John Karahalis openjck

View GitHub Profile
View apply-graph-paper-app-template-updates
#!/usr/bin/env bash
# Overwrite files in the current directory with files from the graph-paper app
# template
APP_TEMPLATE_FILES_DIR=$(mktemp --directory)
npx degit graph-paper-org/app-template "$APP_TEMPLATE_FILES_DIR"
rsync \
@openjck
openjck / .bashrc
Created May 7, 2020
reuse-completions: Use Bash auto-completions for custom commands
View .bashrc
# Use auto-completions of the first command as auto-completions for the second
# command. For example, if we were to do the following:
#
# alias g="git"
# reuse-completions git g
#
# ...then we would be able to type "g b<tab>" and "branch" would be among the
# suggestions.
function reuse-completions() {
local ORIGINAL_COMMAND=$1
@openjck
openjck / .bashrc
Last active Apr 21, 2020
cdv: Like cd, but immediately runs ls after being called
View .bashrc
# cdv: cd with visibility
#
# Change the shell working directory and immediately list directory contents.
# Takes the same arguments as cd.
#
# This would not work properly if it were a shell script. Shell scripts are
# executed in subshells, where "cd" does not affect the shell that called the
# script.
function cdv() {
if cd "$@"; then
@openjck
openjck / .bashrc
Last active Apr 19, 2020
Bash function to cd to the root of a Git project, if possible
View .bashrc
# If we are in a project, cd to the root of the project.
#
# This would not work properly if it were a shell script. Scripts are executed
# in subshells, where "cd" does not effect the shell that called the script.
#
# https://stackoverflow.com/a/957978/4297741
function cd-project-root() {
local PROJECT_ROOT
PROJECT_ROOT=$(git rev-parse --show-toplevel 2> /dev/null)
@openjck
openjck / .bashrc
Created Apr 11, 2020
Always use a pager with rg
View .bashrc
# Drop this into ~/.bashrc to always use a pager with rg.
function rg() {
command rg --pretty "$@" | less --RAW-CONTROL-CHARS
}
@openjck
openjck / .gitconfig
Last active Apr 7, 2020 — forked from huytd/.gitconfig
Configure Git to use Neovim as the difftool and mergetool
View .gitconfig
# Configure Git to use Neovim as the difftool and mergetool. This is a simpler
# version of the following recommendation:
#
# https://gist.github.com/huytd/78c676a797f81eb08cdedf5400e1b6a3
#
# The [diff] section is not required. If it's omitted, Git will use the
# mergetool as the difftool. I like to include the [diff] section to be
# explicit.
#
# If you prefer, you can replace all instances of "vimdiff" with "vimdiff2" or
View keybase.md

Keybase proof

I hereby claim:

  • I am openjck on github.
  • I am johnkarahalis (https://keybase.io/johnkarahalis) on keybase.
  • I have a public key whose fingerprint is F941 FEA9 729E 1040 6829 CE96 357D 0C1B 6454 146A

To claim this, I am signing this object:

@openjck
openjck / metrics-graphics-#783.html
Last active Dec 22, 2017
HTML document demonstrating the issue described in metricsgraphics/metrics-graphics#783
View metrics-graphics-#783.html
<!doctype html>
<html lang="en-US" dir="ltr">
<head>
<meta charset="utf-8" />
<title>Example</title>
<link href="https://rawgit.com/mozilla/metrics-graphics/b363d82c229fba6a280c9782b8154aad0ac901e7/dist/metricsgraphics.css" rel="stylesheet" />
</head>
<body>
<div id="target"></div>
@openjck
openjck / metrics-graphics-#764.html
Last active Aug 8, 2017
HTML document demonstrating the issue described in metricsgraphics/metrics-graphics#764
View metrics-graphics-#764.html
<!doctype html>
<html lang="en-US" dir="ltr">
<head>
<meta charset="utf-8" />
<title>Example</title>
<link href="https://rawgit.com/mozilla/metrics-graphics/4722d8a7aaaea604a942f6b39bd169b9bfa815fb/dist/metricsgraphics.css" rel="stylesheet" />
</head>
<body>
<div id="target"></div>
@openjck
openjck / bookmarklet-remove-wikipedia-pictures.js
Last active Mar 8, 2016
Simple bookmarket to remove pictures in Wikipedia articles
View bookmarklet-remove-wikipedia-pictures.js
javascript:(function(){$('#mw-content-text .thumb, #mw-content-text img').remove();})();
You can’t perform that action at this time.