Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View mshroyer's full-sized avatar

Mark Shroyer mshroyer

View GitHub Profile
"""
Make a Python .pth file so external Pythons can use QGIS's packages and extensions
"""
import os
from pathlib import Path
import sys
if sys.platform == "win32":
import win32api
#!/bin/sh
# Updates a replica of the ds1 dataset.
#
# Ideally we'd use bookmarks instead of snapshots to track the starting point
# of incremental sends, but OpenZFS 2.0.0 doesn't support sending multiple
# datasets from the same bookmark (and I don't feel like rewriting all of the
# functionality of zfs send -R).
#
# Usage: update_ds1_replica <dest_pool>
#include <fcntl.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define REPORT_BLOCKS 1024
#define BLOCK_SIZE 65536
#define SUB_BLOCK_SIZE 8192
% doas ./bdcmp /dev/zvol/tank/ds1/backup/pump-vol-a /dev/zvol/tank/ds1/backup/pump-vol-b
block number: 16384000
Total blocks counted: 16384000
Differing blocks: 78727 # 64k blocks; total size ~4.8 GB
Differing sub-blocks: 421058 # 8k sub-blocks; total size ~3.2 GB
pilgrim# zfs list -o space tank/ds1/backup/pump-vol
NAME AVAIL USED USEDSNAP USEDDS USEDREFRESERV USEDCHILD
tank/ds1/backup/pump-vol 8.41T 1.38T 186G 259G 966G 0B
pilgrim# zfs list -t snapshot -r tank/ds1/backup/pump-vol
NAME USED AVAIL REFER MOUNTPOINT
\# [...]
tank/ds1/backup/pump-vol@autosnap_2022-03-15_00:00:00_daily 20.4G - 255G -
tank/ds1/backup/pump-vol@autosnap_2022-03-16_00:00:00_daily 18.0G - 256G -
tank/ds1/backup/pump-vol@autosnap_2022-03-17_00:00:00_daily 24.3G - 256G -

Keybase proof

I hereby claim:

  • I am mshroyer on github.
  • I am mshroyer (https://keybase.io/mshroyer) on keybase.
  • I have a public key ASA2h00MxaCBoqlksCoSazZI054vW-doxongnIjItzytfAo

To claim this, I am signing this object:

#!/bin/sh
# From Arch Linux wiki
#xmodmap -e "pointer = 1 8 3 4 5 6 7 2 9 10 11 12 13"
# Based on https://help.ubuntu.com/community/Logitech_Marblemouse_USB, but
# with modifications to the button map and inverted axes for scrolling.
xinput set-button-map "Logitech USB Trackball" 1 8 3 4 5 6 7 2 9
xinput set-int-prop "Logitech USB Trackball" "Evdev Wheel Emulation Button" 8 8
xinput set-int-prop "Logitech USB Trackball" "Evdev Wheel Emulation" 8 1
#include "ti86asm.inc"
; ===========================
; Emblem 86 version 1.1 gamma
; ===========================
; Mark's new label
; This is an 86 assembly program that allows users to draw a custom emblem for
; their calculators (on-calc) and install it in a user-interrupt routine so that
; it will be constantly present in the upper-right corners of their screens.
@mshroyer
mshroyer / keybase.md
Created May 26, 2017 06:13
Keybase verification

Keybase proof

I hereby claim:

  • I am mshroyer on github.
  • I am mshroyer (https://keybase.io/mshroyer) on keybase.
  • I have a public key ASBE2vOmDs6o0yxIi8V0LhJEAoCtkDuXe3QqM8VJPib5hQo

To claim this, I am signing this object:

@mshroyer
mshroyer / icalendar_todos.py
Created December 28, 2016 16:46
Extract plaintext TODOs from Remember the Milk (RTM) iCalendar export
#!/usr/bin/env python3
import argparse
import functools
import icalendar
import operator
import re
TAGS_PATTERN = re.compile(r'Tags: ([\w\d]+(?:, [\w\d]+)*)')