Skip to content

Instantly share code, notes, and snippets.

View Zegnat's full-sized avatar

Martijn van der Ven Zegnat

View GitHub Profile
GET http://localhost:7331/test
An unhandler error occured: TypeError: /Users/martijn/Source/thumbswise/src/routes/test.tsx: Duplicate declaration "createRouteData"
> 1 | import { createRouteData, useRouteData } from "solid-start";
| ^^^^^^^^^^^^^^^
2 | import { createServerData$ } from "solid-start/server";
3 |
4 | export function routeData() {
Zegnat / index.php
Created September 4, 2022 12:14
IndieAuth Ticket Auth testing page, created July 2021
<?php declare(strict_types = 1);
define('MINTOKEN_SQLITE_PATH', 'tokens.db'); // Created with schema.sql
// Support functions. Mostly stripped from other projects.
if (!file_exists(MINTOKEN_SQLITE_PATH)) {
header('HTTP/1.1 500 Internal Server Error');
header('Content-Type: text/plain;charset=UTF-8');
exit('The token endpoint is not ready for use.');
Zegnat / GeminiStreamWrapper.php
Created August 15, 2021 19:20
Add gemini:// support for file_get_contents(). Will turn into proper repo with Composer support later.
<?php declare(strict_types=1);
namespace Zegnat\Gemini;
* @see
final class GeminiStreamWrapper {
/** @var resource $context if a stream context was provided it will be set here, even before __construct */
public $context;
Zegnat / background.js
Created January 6, 2021 16:57
Swapping between two browser context menus depending on the amount of selected tabs.
let single = true
const menus = {
single: browser.menus.create({
contexts: ['tab'],
title: '&Close Tab'
selection: browser.menus.create({
contexts: ['tab'],
title: '&Close Tabs',
Zegnat / yt.html
Last active November 8, 2020 19:55
I keep forgetting how I can do sleek YouTube embeds. Here is one from a project. Still tweaking.
Embedded Youtube player that combines:
Other things I am still thinking of adding:
Zegnat / cal.php
Created November 5, 2020 15:23
Quicky to plain text calendar generation
$tz = new DateTimeZone('UTC');
$now = (new DateTimeImmutable('now', $tz))->setTime(12, 0, 0, 0);
$start = filter_input(INPUT_GET, 'start', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '@\d{4,}-\d\d-\d\d@']]);
$end = filter_input(INPUT_GET, 'end', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '@\d{4,}-\d\d-\d\d@']]);
if (
is_string($start) &&
($startParts = array_map('intval', explode('-', $start))) &&
Zegnat /
Last active March 14, 2019 12:44
Simple script for accessing the contents of an encrypted andOTP backup.

andOTP Decrypt

Simple script for accessing the contents of an encrypted andOTP backup. As long as Sodium is available this does not require any dependencies outside of PHP.

This was written as a replacement for [asmw/andOTP-decrypt][], which I found a little annoying to get going and depends on several external packages. (Hold! Was PHP easier than Python here? Oh my!)


To decrypt and write to a JSON file:

Zegnat / Innertext.php
Last active October 19, 2018 08:33
🏃🐉 Run. Here be dragons.
namespace Zegnat\Innertext;
class Innertext
const LF = "\n";
const CRLF = "\r\n";
Zegnat / authdiag.php
Last active August 7, 2018 15:50
Upload to a web server on an accessible path. Navigate to it in the browser. Copy the URL from the address bar and paste it in the form. Run the test to see if your server gets Authorization headers!
ini_set('display_errors', 1);
$auth = filter_input(
array('options' => array('regexp' => '@^authtest_\d+$@'))
Zegnat / martijnsclock.1s.php
Created May 15, 2018 21:08
BitBar ( plugin for a variable drop-down of time zones. Also does unix epoch time, and copying of ISO timestamps to the clipboard.
$now = new \DateTimeImmutable(null, new \DateTimeZone('UTC'));
$copy = getopt('c:');
if (count($copy) > 0) {
// Make sure to use the local /bin/echo executable, exec() runs sh and native echo
// may not do what you expect.
exec('/bin/echo -n ' . escapeshellarg($copy['c']) . ' | pbcopy', $devnull, $status);