Skip to content

Instantly share code, notes, and snippets.

View installing-windows-on-a-usb.txt
* USB device (actually, any storage device works) with an appropriate size for the OS
* A target computer capable of booting from the device
Before you start
* Don't run commands blindly
requinix / Show file checksums.pas
Created Dec 29, 2017
TES5Edit: Show file checksums
View Show file checksums.pas
Show file checksums.
Hotkey: Ctrl+Alt+C
unit ShowFileChecksums;
function Initialize: integer;
f, h: string;
requinix / anonymous-class-abuse.php
Created Sep 28, 2017
Global functions with (nearly) totally private shared data
View anonymous-class-abuse.php
Can I write global functions in PHP that share data between them, without also making that data
accessible to everyone else?
Global functions have a particular utility that is handy, even in an OOP codebase: it doesn't
require a fully-qualified class name/use statement and when in the root namespace the function will
be automatically resolved from any other namespace automatically (though prepending that slash is

It's actually pretty easy.


DAV ("Distributed Authoring and Versioning") is basically a way to share content between people in a central source. WebDAV is that applied over the internet. It's an older protocol but quite powerful - full CRUD support, plus fancier features like locking.

Windows, and probably Linux too, has built-in support for mounting WebDAV endpoints as "network locations" or virtual drives (eg, Z:). With full DAV support, you can edit files over the internet. There are three different levels/classes of support:

  1. Original WebDAV (RFC 2518)
  2. Locking
requinix / papyrus-skyrim.tmLanguage.json
Created Jul 19, 2017
VS Code syntax highlighting for Papyrus (Skyrim version)
View papyrus-skyrim.tmLanguage.json
"$schema": "",
"name": "Papyrus (Skyrim)",
"scopeName": "source.papyrus-skyrim",
"foldingStartMarker": "(?i)\\b(event|function|property|state)\\b",
"foldingStopMarker": "(?i)\\b(endevent|endfunction|endproperty|endstate)\\b",
"patterns": [
{ "include": "#comments" },
{ "include": "#events" },
{ "include": "#flags" },
requinix / oninit-ongamereload.txt
Created Apr 13, 2017
Skyrim: OnInit and OnGameReload sequence
View oninit-ongamereload.txt
Installation (first time running):
0. Quest variables and papyrus state set; SEQs are started and running
1. OnInit #1 - all quests whether they are SEQ or not
2. OnInit #2 - SEQs that are not run-once
Load Game (not first time running):
0. Quest variables, papyrus state, and running state restored
1. OnGameReload - quests that were running at time of save
View php-bug-74142.txt
LimitIterator_::rewind rewind at the beginning of the foreach...
> TestFilterIterator_::rewind ...and the inner iterator
> > ArrayIterator_::rewind ...and again. now testfilteriterator must look for the first accept()able value
> > ArrayIterator_::valid iterate on arrayiterator...
> > ArrayIterator_::current ...
> > ArrayIterator_::key ...
> > TestFilterIterator_::accept ...and test the first value it found
accept (call #1 on [0]=>'0')
> > ArrayIterator_::next value ('0') was not accepted
> > ArrayIterator_::valid continue iterating...

Good news is that it isn't so difficult to explain this. What's happening is array_map really has two modes of operation: one array and multiple arrays.

Using one array, (a) with $callback: keep array keys, transform value using $callback(value) (b) without $callback: return a copy of the array

array_map(function($value) { return $value; }, $array)
View parse_date_abbr_search.c
const static timelib_tz_lookup_table* abbr_search(const char *word, timelib_long gmtoffset, int isdst)
int abbr_found = 0, offset_found = 0;
const timelib_tz_lookup_table *tp, *abbr_found_elem = NULL, *offset_found_elem = NULL;
if (strcasecmp("utc", word) == 0 || strcasecmp("gmt", word) == 0) {
return timelib_timezone_utc;
for (tp = timelib_timezone_lookup; tp->name; tp++) {
requinix / wired-without-the-adblock-veil.userscript.js
Created Mar 14, 2016
UserScript: Wired with the adblock veil
View wired-without-the-adblock-veil.userscript.js
// ==UserScript==
// @name Wired without the adblock veil
// @namespace
// @version 0.9
// @author requinix
// @match*
// ==/UserScript==
/* jshint -W097 */
'use strict';
You can’t perform that action at this time.