Skip to content

Instantly share code, notes, and snippets.

mikeslattery / .vimrc
Last active Nov 15, 2021
NVim settings for Vim
View .vimrc
" This .vimrc sets NeoVim's defaults for Vim
" then it loads NeoVim's init.vim
" Windows gVim is not supported.
" Vim 7 options that differ
set nocompatible
mikeslattery /
Last active Oct 17, 2021
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 Oct 25, 2021
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 May 24, 2021
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 Aug 1, 2020
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 Apr 30, 2020
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
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}"
mikeslattery /
Last active May 24, 2021
Monitor memory use of all running java applications
# Display memory useage of all running java processes
pidof java | xargs -r ps -f
echo ''
echo $'PID\t% MEM\tTMEM\tGC Time'
while true; do
for pid in $(pidof java); do
echo -n "$pid "
// Usage: dot -Tpdf -o tunic-uml.pdf; xdg-open tunic-uml.pdf
digraph G {
Presenter -> View;
View [shape=box];
Presenter -> Service;
Service -> System;
mikeslattery / notify-send.ps1
Last active Feb 20, 2020
Windows Notification Toast
View notify-send.ps1
function notify($notificationTitle) {
$app = '{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WindowsPowerShell\v1.0\powershell.exe'
[void][Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]
# Fetch empty template
$templateType = [Windows.UI.Notifications.ToastTemplateType]::ToastText01
$template = [xml]([Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent($templateType).getXml())
#Convert to .NET type for XML manipuration