Skip to content

Instantly share code, notes, and snippets.

View kmatt's full-sized avatar
😐

Matt Keranen kmatt

😐
  • SE US
View GitHub Profile
@kmatt
kmatt / tigrc
Created July 3, 2024 02:18
Delta diffs in Tig
# View diffs using delta
# Via https://github.com/jonas/tig/issues/26#issuecomment-1923835137
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
kmatt / void-wsl.txt
Last active June 26, 2024 05:08
Install Void Linux on WSL2
# Based on https://gist.github.com/kmatt/71603170556ef8ffd14984af77ff10c5
# prompt ">" indicates Powershell commands
# prompt "$" are Linux shell commands
# https://docs.microsoft.com/en-us/windows/wsl/install-win10
> dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# install https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
@kmatt
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
kmatt / vimrc
Last active April 16, 2024 18:41
MYVIMRC
"Linux: curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
"PowerShell: iwr -useb https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |` 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
kmatt / dwm-install.sh
Last active March 19, 2024 10:37
Dwm simple install
# http://dwm.suckless.org/
# 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
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_SYSTEM_NAME Windows)
set(CMAKE_C_COMPILER C:/TDM-GCC-64/bin/gcc.exe)
@kmatt
kmatt / SQLAgentScripter.ps1
Created January 9, 2024 16:52 — forked from tcartwright/SQLAgentScripter.ps1
POWERSHELL: Generates SQL Server Agent objects to sql files
[cmdletbinding()]
Param(
[Parameter(Mandatory=$true)]
[string[]]$servers,
[ValidateScript({
if(-Not ($_ | Test-Path )) {
throw "Folder does not exist"
}
return $true
@kmatt
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
kmatt / pv_dump.sh
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
kmatt / zfsCommands.md
Created December 1, 2023 17:31 — forked from aaiezza/zfsCommands.md
ZFS

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

VDEV

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

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