Skip to content

Instantly share code, notes, and snippets.

View kmatt's full-sized avatar

Matt Keranen kmatt

  • SE US
View GitHub Profile
kmatt / tigrc
Created July 3, 2024 02:18
Delta diffs in Tig
# View diffs using delta
# Via
bind diff D >sh -c "git show %(commit) | delta --paging always"
bind diff S >sh -c "git show %(commit) | delta --paging always --side-by-side"
bind stage D >sh -c "git diff HEAD -- %(file) | delta --paging always"
bind stage S >sh -c "git diff HEAD -- %(file) | delta --paging always --side-by-side"
bind status D >sh -c "git diff HEAD -- %(file) | delta --paging always"
bind status S >sh -c "git diff HEAD -- %(file) | delta --paging always --side-by-side"
kmatt / void-wsl.txt
Last active June 26, 2024 05:08
Install Void Linux on WSL2
# Based on
# prompt ">" indicates Powershell commands
# prompt "$" are Linux shell commands
> dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# install
kmatt / tmux.conf
Created April 30, 2024 14:46
Multiple timezones in tmux status bar
set-option -g status-right '#{client_tty} (#(TZ=US/Mountain date +%%H:%%M)MT #(TZ=UTC date +%%H:%%M)Z) %Y-%m-%d %H:%M'
kmatt / vimrc
Last active April 16, 2024 18:41
"Linux: curl -fLo ~/.vim/autoload/plug.vim --create-dirs
"PowerShell: iwr -useb |` ni $HOME/vimfiles/autoload/plug.vim -Force
let g:pymode_python = 'python3'
let g:python3_host_prog = expand('C:\Users\mkeranen\Python\Python310\python.exe')
call plug#begin()
Plug 'mattn/vim-gist'
Plug 'mattn/webapi-vim'
kmatt /
Last active March 19, 2024 10:37
Dwm simple install
# s/dnf/rpm-ostree/ for Silverblue
# Xorg requirements
sudo dnf install xorg-x11-server-Xorg xorg-x11-drv-evdev xorg-x11-xinit xorg-x11-xinit-session xterm lightdm
# Build deps
sudo dnf install git make automake gcc gcc-c++
sudo dnf install libX11-devel libXft-devel libXinerama-devel libXrandr-devel
kmatt / TDM.cmake
Created March 1, 2024 01:42
TDM-GCC and cmake on Windows notes
# To configure for MinGW instead of nmake
# C:\TDM-GCC-64\mingwvars.bat
# cmake . -G "MinGw Makefiles"
# Makefile: cmake ... -DCMAKE_TOOLCHAIN_FILE=TDM.cmake
set(CMAKE_C_COMPILER C:/TDM-GCC-64/bin/gcc.exe)
kmatt / SQLAgentScripter.ps1
Created January 9, 2024 16:52 — forked from tcartwright/SQLAgentScripter.ps1
POWERSHELL: Generates SQL Server Agent objects to sql files
if(-Not ($_ | Test-Path )) {
throw "Folder does not exist"
return $true
kmatt / delay_pg_restore_matviews
Last active January 4, 2024 18:17
Delay materialized view refresh during pg_restore
pg_dump database -Fc backup.dump
pg_restore -l backup.dump | sed '/MATERIALIZED VIEW DATA/d' > restore.lst
pg_restore -L restore.lst -d database backup.dump
pg_restore -l backup.dump | grep 'MATERIALIZED VIEW DATA' > refresh.lst
pg_restore -L refresh.lst -d database backup.dump
kmatt /
Created May 24, 2012 20:07
Monitoring dump and restore with pv
# dump
pg_dump testdb | pv -c -s $(psql -tc "SELECT pg_database_size('testdb')") -N dump | gzip > testdb.sql.gz
# restore
pv testdb_20120501.sql.gz | zcat | psql testdb
kmatt /
Created December 1, 2023 17:31 — forked from aaiezza/

Here are some helpful commands for managing ZFS and ZPool on Ubuntu


Useful for populating /etc/zfs/vdev_id.conf:

printDisks() {
    for i in /dev/sd[b-i]; do
        fdisk -l $i