Skip to content

Instantly share code, notes, and snippets.

mikeslattery / briefmarks.lua
Last active January 19, 2024 17:44
which_key.nvim extension to limit how many marks are shown.
View briefmarks.lua
local M = {}
This extends which-key/plugins/marks.lua with these changes:
* Only show subset of marks
* Letters
* ^ . '
mikeslattery /
Last active November 16, 2023 21:11
AI Webcam to html
# Takes a photo and converts to a project text artifact.
# Just experimental for now.
set -euo pipefail
THISDIR="$(dirname "$0")"
#shellcheck disable=SC1091
source "$THISDIR/.env"
mikeslattery / git-syncr
Last active February 25, 2024 20:23
Git Directory Synchronizer
View git-syncr
help() { cat<<HELP
git-syncr - git worktree synchronizer
Usage: git syncr <command>
create <path> [<branch>]
Create new worktree at <path> forked from current directory.
mikeslattery / .vimrc
Last active February 23, 2023 20:19
Beginner's Minimal Vim Config
View .vimrc
" This is a beginners .vimrc or init.vim file
" with sane defaults so you can be productive at the start.
" Not designed to work with Neovim.
" Sane defaults.
source $VIMRUNTIME/defaults.vim
set mouse=a " Enable mouse
set clipboard+=unnamed,unnamedplus " Use desktop's clipboard
set hidden " Allow switch buffers if current not saved
set noswapfile autoread " Swap file annoyance. Use git.
mikeslattery /
Last active October 17, 2021 13:26
An attempt at an airplay client
# Screen cast your desktop to Apple TV (airplay).
# Usage: airplay-client <server-address> <local-address>
# Untested. Likely doesn't work. Airplay V1 only.
if [[ "$SERVER_PORT" == "7000" ]]; then
# We are the cgi script.
echo 'Content-Type: video/h264'
mikeslattery /
Last active January 26, 2024 14:02
How to loosely integrate IdeaVim and gVim

This will allow you to switch between a Jetbrains IDE and gVim at the same file/line/column by hitting <leader>i. Hit <leader><leader>i to start gVim (once).

I've also done this with terminal Vim, but it's much more complex and varies depending on your environment (OS, DE, multiplexers, terminal).


Install gVim and the IdeaVim plugin

In IDE: Settings > Build,Execution,Deployment > check "Allow unsigned requests"

mikeslattery /
Last active April 27, 2023 12:11
Convert shell history or CLI args into ~/.ssh/config format.
ssh2append() {
ssh -G "$@" | sed -n 's/^hostname /Host /p'
comm -23 <(ssh -G "$@" 2>/dev/null | sort) <(ssh -G . 2>/dev/null | sort) | sed 's/^/ /'
# This loop+if is for remote command, -N, -W as -G lacks support
while getopts '1246AaCfGgKkMNnqsTtVvXxYyB:b:c:D:E:e:F:I:i:J:L:l:m:O:o:p:Q:R:S:W:w:' opt; do
#shellcheck disable=SC2254
case "$opt" in
mikeslattery /
Last active August 1, 2020 02:12
Markdown to Clipboard
# Converts markdown format to clipboard in html format.
# Requres Wayland, pandoc, and wl-clipboard.
# Usage:
# rt-clip - Copy from stdin
# rt-clip <file> Copy from a file
# rt-clip Copy from clipbaord
if [[ "$1" == "-" ]]; then shift; cat
mikeslattery /
Created April 30, 2020 15:37
Create a temporary Alpine chroo
# Create and launch an alpine chroot
# If /tmp is not tmpfs, change this to /dev/shm
set -eu
if ! [ -f $rootfs/etc/resolv.conf ]; then
if ! [ -f ~/Downloads/alpine.tar.gz ]; then
curl -Lf -o ~/Downloads/alpine.tar.gz
mikeslattery / init.gradle
Last active May 1, 2020 19:17
Build gradle projects to RAM
View init.gradle
// This goes in ~/.gradle/init.d/tmpfs.gradle
def ramdir='/tmp/gradle'
gradle.projectsLoaded {
rootProject.allprojects {
buildDir = "${ramdir}${project.path}/build"
//println "${}.buildDir = ${buildDir}"