Skip to content

Instantly share code, notes, and snippets.

View iemcd's full-sized avatar

Ian McDougall iemcd

View GitHub Profile
@iemcd
iemcd / pdfmarker.pl
Created April 7, 2019 21:40
PDF Annotation Tools
#!/bin/perl
use strict;
use warnings;
use 5.22.3;
use List::Util qw( min max );
# Fields are: char, x1, y1, x2, y2, pp
open(my $table, "<", $ARGV[0]) or die "Can't open $ARGV[0]: $!";
@iemcd
iemcd / Ynn.toc.pdfmark
Created April 9, 2019 14:20
Ynn ToC in pdfmark
[ /Title (Contents)
/Page 3
/OUT pdfmark
[ /Title (Part 1: Introduction)
/Page 4
/Count -17
/OUT pdfmark
[ /Title (What Are The Gardens of Ynn?)
% Estimating the length & beam of boats from their tonnage.
% Ian McDougall
% 25 July 2019
clear all, close all, nfig=0;
% The Thames Measurement (TM) estimates the tonnage of a ship given its length (LOA) and beam in feet. It is intended for yachts.
function tons = TM(LOA,beam)
tons = ((LOA - beam).*beam.^2)/188;
endfunction
@iemcd
iemcd / 7d6.py
Created March 24, 2020 14:26
Partitioning Hands of Dice
#!/usr/bin/python3
import math
import numpy as np
#import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
def decrement(X):
if sum(X) == len(X): #this is a kludge to make the while loop stop
@iemcd
iemcd / dice_part.py
Created March 24, 2020 20:16
Partitioning Hands of Dice, Better
#!/usr/bin/python3
# Starting over, a little cleaner and a little better
# Ian McDougall, March 2020
import math
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
@iemcd
iemcd / thumbnailer
Created May 8, 2020 18:39
A script to run ffmepgthumbnailer on a cron job (needs arguments supplied)
#!/bin/bash
shopt -s nocasematch
function thumbnail
{
local FILE
for FILE in "$@"
do
# echo "$FILE"
@iemcd
iemcd / cbzclean
Last active May 8, 2020 19:57
A script to clean-up cbz and cbr files
#!/bin/bash
#TODO: evaluate using --store option for recompression
#TODO: fix case-sensitive match in basename (not an issue for me)
shopt -s nocaseglob
suffix='(clean)'
maxjobs=16
I install comictagger with:
`$ pip install --user comictagger`
Then I try:
`$ comictagger`
and I get:
`(process:6616): GLib-CRITICAL **: 19:16:12.048: g_hash_table_contains: assertion 'hash_table != NULL' failed`
`(process:6616): GLib-CRITICAL **: 19:16:12.048: g_hash_table_insert_internal: assertion 'hash_table != NULL' failed`
`Segmentation fault (core dumped)`
Confirmed that it happens on two computers, both running Mageia.
`$ python3 -q -X faulthandler .local/bin/comictagger`
@iemcd
iemcd / MagicSetEditor.desktop
Last active December 6, 2021 14:33
MSE breadcrumbs
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec=wine64 $HOME/.MSE/magicseteditor.exe
Name=Magic Set Editor
Comment=Magic: The Gathering Design Tool
Icon=MagicSetEditor
Categories=Development
@iemcd
iemcd / curve.py
Created December 17, 2021 12:03
MtG Curves
#!/usr/bin/python3
import math
n = 60
for n7 in range(0, math.ceil(n/7)+1):
n6max = n - n7
for n6 in range(n7+1, n6max+1):
n5max = n6max - n6