Skip to content

Instantly share code, notes, and snippets.

@requinix
requinix / oninit-ongamereload.txt
Created April 13, 2017 07:34
Skyrim: OnInit and OnGameReload sequence
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
@requinix
requinix / webdav-in-php.md
Created August 7, 2017 01:42
WebDAV in PHP

It's actually pretty easy.

Background

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
requinix / Show file checksums.pas
Created December 29, 2017 10:54
TES5Edit: Show file checksums
{
Show file checksums.
---
Hotkey: Ctrl+Alt+C
}
unit ShowFileChecksums;
function Initialize: integer;
var
f, h: string;
@requinix
requinix / installing-windows-on-a-usb.txt
Created April 4, 2020 01:08
Installing Windows on a USB
Requirements
============
* 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
requinix / anonymous-class-abuse.php
Created September 28, 2017 19:55
Global functions with (nearly) totally private shared data
<?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
@requinix
requinix / highlight_string_ex.php
Created February 24, 2021 05:53
Quick PHP code highlighter
<?php
function highlight_string_ex($string) {
static $COLORS = [
"comment" => "\e[32m%s\e[0m", // green
"constant" => "\e[93m%s\e[0m", // yellow
"function" => "\e[97m%s\e[0m", // white
"keyword" => "\e[94m%s\e[0m", // blue
"magic" => "\e[93m%s\e[0m", // yellow
"string" => "\e[95m%s\e[0m", // magenta
@requinix
requinix / batman-netplan.md
Last active August 11, 2023 03:34
batman-adv with Netplan on Ubuntu

Setting up B.A.T.M.A.N. on Ubuntu using Netplan instead of ifupdown

...is a lie

If you're here then I'm going to assume you already know about B.A.T.M.A.N and Netplan, and probably also about ifupdown (or at least /etc/network/interfaces).

Bad news: Netplan cannot currently (2023) set up batman-adv interfaces. Simply no support for it. This suggests that, in order to have batman-adv interfaces, you have to uninstall Netplan and switch back to ifupdown.

Good news: Netplan uses systemd-networkd under the hood, and it does have support. You'll bypass the Netplan configurations and write your own, but it's not too hard. So you can keep Netplan installed and managing your non-batman interfaces.