Skip to content

Instantly share code, notes, and snippets.

@gglnx
gglnx / GermanState.php
Created November 11, 2022 12:04
Field with enum as value type
<?php
/**
* German state
*/
enum GermanState: string
{
case BW = 'Baden-Württemberg';
case BY = 'Bayern';
case BE = 'Berlin';
<?php
/**
* @link http://craftcms.com/
* @copyright Copyright (c) Pixel & Tonic, Inc.
* @license http://craftcms.com/license
*/
namespace craft\behaviors;
use yii\base\Behavior;
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Berlin, 2021-03-17
OpenPGP Key Transition Statement
I have created a new OpenPGP key and will be transitioning away from
my old key. The old key has not been compromised and will continue to
be valid for some time, but I prefer all future correspondence to be
@gglnx
gglnx / README.md
Created February 12, 2021 22:30
Download all data request files from Amazon

Open the Privacy Central Data Request page.

Run this in your console

(await Promise.all(
    Array.from(document.querySelectorAll('[data-action="get-document-link-and-download"]'))
        .map(async ($el) => {
            const data = JSON.parse($el.dataset.getDocumentLinkAndDownload);
            const requestData = {
@gglnx
gglnx / LinkField.php
Created January 4, 2021 16:14
Add simple support for Link Field by Sebiastan Lenz to Feed Me
<?php
use Cake\Utility\Hash;
use craft\feedme\base\Field;
use craft\feedme\base\FieldInterface;
use craft\feedme\helpers\DataHelper;
/**
* Adds support for Link field by Sebastian Lenz to Feedme
*/
@gglnx
gglnx / message.txt
Created May 7, 2020 14:10
keys.pub proof
BEGIN MESSAGE.
aWtS9WGb8Nk0LNE i56ErQgPAtWkguw jClbULwAVbrHrRx S8J22xvsechjeKx
I9TzjcSUSNimV0s z3KWftQkgqvTCKq 6Xr2MZHgg4hCBQs TV4hQacnRRlsKUy
JNEASUA2pQBgglN bLadRI41kOzcOUk YSMtUKH8DfO1Zj0 TVI9mtgO3XRDFSM
2M4HieA9Bxkc9X3 Pmq9pETMl4ABhQU HWlIL.
END MESSAGE.
@gglnx
gglnx / containsMb4.php
Created December 20, 2019 12:49
containsMb4
<?php
// Download the bible from here: https://bereanbible.com/bsb.txt
ini_set('memory_limit', -1);
require_once 'helpers.php';
echo('Start: ' . convert(memory_get_usage()) . "\r\n");
@gglnx
gglnx / extract-chapters-from-m4a-as-psc.js
Created March 18, 2019 16:32
Extract chapter marks from M4A/MP4 files as Podlove Simple Chapters
#!/usr/bin/env node
'use strict';
const cheerio = require('cheerio');
const child_process = require('child_process');
const fs = require('fs');
const meow = require('meow');
const MP4Box = require('mp4box');
const path = require('path');
const tmp = require('tmp');
const groupBy = require('lodash.groupby');
@gglnx
gglnx / get-unicode-range-from-string.js
Created March 18, 2019 16:29
Get unicode-range (CSS) from string
const multirange = require('multi-integer-range').multirange;
// Helpers
const trimLeadingZero = (str) => str[0] === '0' ? str.slice(str.lastIndexOf('0') + 1) : str;
const formatCodePoint = (...values) => `U+${values.map(trimLeadingZero).map(s => s.toString(16)).join('-')}`;
const uniqs = (arrArg) => arrArg.filter((elem, pos, arr) => arr.indexOf(elem) == pos);
// String for translate
const string = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~¢£¥¨©«®´¸»ÄÖÜßäöüˆ˚˜–—‘’‚“”„…‹›€™';