Skip to content

Instantly share code, notes, and snippets.

@marnix
marnix / takeout-fix-exif.py
Created March 23, 2024 19:55
Add EXIF date-time from Google Photos takeout zip-file
#!/usr/bin/env python3
import shutil
import zipfile
import glob
import os.path
import json
import subprocess
from datetime import datetime, timezone
@marnix
marnix / README.md
Last active January 11, 2024 09:36
Userscript for Jira issue page updated notification

In your browser, install TamperMonkey or another Userscript manager browser extension.

Then you can simply go to https://gist.github.com/marnix/0d27e891be359afc69ba5b090b6607b1/raw/jira-issue-page-updated-notification.user.js, which should trigger the browser extension to install the latest version of this userscript. And you can also use the same URL for updating to newer versions (which I occasionally expect to release).

An identical copy is also published via Greasy Fork (https://greasyfork.org/en/scripts/462479-jira-issue-page-updated-notification).

@marnix
marnix / gen.zig
Created October 27, 2021 22:46
Generators in Zig: complete, simple, and no allocator needed.
const std = @import("std");
const assert = std.debug.assert;
pub fn IterOf(comptime Result: type) type {
return struct {
// Invariant: self._yield_frame != null or self._value == null
_value: ?Result = null,
_yield_frame: ?anyframe = undefined,
const _the_result_type = Result;
@marnix
marnix / Zig async semantics.md
Last active November 1, 2021 21:04
Zig async semantics

Zig async semantics

by Marnix Klooster (https://github.com/marnix); license: public domain (attribution appreciated); status: probably-incorrect draft

(TODO: Update with Protty's feedback on gist revision 33 or 38 on Discord, https://discord.com/channels/605571803288698900/605572581046747136/794993176779292693 and subsequent discussion.)

(TODO: After I have a version that I'm at least a bit happy with, consider g-w1's suggestion of a pull request to https://github.com/ziglang/zig-spec/blob/disorganized-spec-chunks/spec/disorganized_facts_about_zig.md .)

How does async (and the related suspend/resume and await) work? Here is my attempt to describe this in a language specification kind of way.

/** This reproduction scenario by Marnix Klooster is public domain. */
package marnix.experiment.bcfips;
import java.net.URL;
import java.security.KeyStore;
import java.security.Security;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
@marnix
marnix / arcperfdiff.nim
Created June 13, 2020 08:01
Reproduction scenario for nim --gc:arc performance difference
import memfiles
import streams
proc mmapStream(mmFileName: string): Stream =
return newMemMapFileStream(mmFileName)
iterator tokens(mmfile: Stream): string =
var i,j = 0
while not mmfile.atEnd():
let c = mmfile.readChar()
@marnix
marnix / df-at-exp.mm
Created September 27, 2019 13:12
Attempt at a mechanism for expanding definitions in Metamath
$[ set.mm $]
$( TO EXPAND THE FOLLOWING TWO AXIOMS ~ cat and ~ df-at WHICH TOGETHER MAKE UP ` HAtoms ` ...
@( Extend class notation with set of atoms on a Hilbert lattice. @)
cat @a class HAtoms @.
@{
@d x y @.
#lang racket
(require racket/include
syntax/parse/define
(for-syntax racket/syntax
racket/port
syntax/modread))
(define-simple-macro (require/sweet-exp-racket path)
#:with modname (generate-temporary #'path)
// ==UserScript==
// @name mm-calc
// @description Make `metamath /html' proofs look more like calculations. (License: public domain; initial author: Marnix Klooster <marnix.klooster@gmail.com>.)
// @version 3
// @grant none
// @include /^https?://.*\.metamath\.org(:\d+)?/[^/]*/[^/]*.html(#.*)?$/
// @require https://code.jquery.com/jquery-3.3.1.slim.min.js
// ==/UserScript==
// Mark all proof-like tables with class 'proof'
#!/usr/bin/env python2
## !!! WARNING: THIS CODE COULD VERY WELL REMOVE YOUR SYSTEM-WIDE
## plaitpy AND bda.basen PACKAGES !!!
# verify that we start with a clean slate: no plaitpy, no bda.basen
import os
assert not os.path.isfile('/usr/local/lib/python2.7/dist-packages/plaitpy/__init__.py')
try:
import plaitpy # this fails, as expected