Skip to content

Instantly share code, notes, and snippets.

View TOGoS's full-sized avatar
🏠
Working from home

Dan Stevens TOGoS

🏠
Working from home
View GitHub Profile
@TOGoS
TOGoS / makeparse.php
Created July 17, 2023 15:33
A simplistic, incomplete Makefile parser in PHP
<?php
// Unecessary yak shaving as part of PHPXMLEmitter, 2023-07-11
function readLogicalLine($stream, &$lineNumber) {
$ll = false;
while( ($line = fgets($stream)) !== false ) {
++$lineNumber;
if( $ll === false ) $ll = '';
if( preg_match('/^(.*?) (\\\\)?\r?\n?$/x', $line, $bif) ) {

When I talk about ownership, I’m primarily talking about ownership of shared resources (such as roads or sewers or parks) of the means of production (such as a farm or a factory), also known as ‘capital’.

Ownership of the means of production and control over the surplus product generated by their operation is the fundamental factor in delineating different modes of production.

@TOGoS
TOGoS / rosa-citizens-assembly.org
Last active April 11, 2019 01:52
How did that whole citizens' assembly thing in Ireland work?

People on WORT talking about XR mentioned the Citizens’ Assembly in Ireland

And I wanted to look deeper into how that worked.

WORT show: https://www.wortfm.org/extinction-rebellion-climate-justice-activism-in-england/

tl;dr:

  • I’m still not sure how that led to the repeal of the 8th amendment.
  • CWI (Socialist Party in Ireland)’s role was to create ROSA and run a campaign to get people to support ‘Yes’ (on repeal);
@TOGoS
TOGoS / gimme-a-basic-railroad.lua
Last active February 18, 2019 00:11
Salvage some railroad equipment from your crashed ship
--[[ Want to start Factorio with enough gear to make a super basic railroad? Run this script! ]]
game.player.insert{name="rail", count=300}
game.player.insert{name="locomotive", count=1}
game.player.insert{name="cargo-wagon", count=1}
game.player.insert{name="train-stop", count=3}
@TOGoS
TOGoS / illumination-recommendations.sql
Last active June 26, 2018 06:46
Query to find illumination values and resulting recommendations
SELECT
room.evaluationid,
room.roomnumber,
-- feature.featurenumber,
count(distinct feature.featurenumber) as featurecount,
otreport.id AS otreportid,
attr.id AS attributeid,
attr.title as attributetitle,
risk.entityid AS riskid,
risk.title AS risktitle,
@TOGoS
TOGoS / programmable-noise.md
Created February 2, 2018 22:59
Factorio programmable noise overview

Factorio Programmable Noise

Terrain generation is based on a coherent noise function invented by Cube which is referred to as 'Factorio basis noise'.

Sampling a single factorio basis noise function results in a uniform bumpy texture. More interesting textures can be defined by adding together multiple iterations of the basis noise at different scales to make 'multi-octave noise'. Small scales (high frequency, low amplitude) create small features

module TOGoS
# Encodes and decodes strings to/from RFC-3548 Base32 (see http://tools.ietf.org/html/rfc3548)
# Based on code found at
# http://bitcollider.cvs.sourceforge.net/bitcollider/jbitcollider/plugins/org.bitpedia.collider.core/src/org/bitpedia/util/Base32.java?view=markup
module Base32
BASE32_CHARSET = [
?A, ?B, ?C, ?D, ?E, ?F, ?G, ?H, ?I, ?J, ?K, ?L, ?M, ?N, ?O, ?P,
?Q, ?R, ?S, ?T, ?U, ?V, ?W, ?X, ?Y, ?Z, ?2, ?3, ?4, ?5, ?6, ?7
]
BASE32_LOOKUP = [
@TOGoS
TOGoS / BloomFilter.d
Created September 18, 2012 23:03
Bloom Filter in D
import std.format;
import std.string;
import std.stdio;
class BloomFilter {
const int bitCount;
ubyte[] data;
this( uint bitCount, ubyte[] data ) {
assert( bitCount < uint.max );
@TOGoS
TOGoS / PriorityQueue.d
Created August 20, 2012 22:45
Generic priority queue in D
template PriorityQueue(ItemType,ItemType DefaultItem) {
class PriorityQueue {
ItemType[] items;
void swap( int i1, int i2 ) {
auto j = items[i1];
items[i1] = items[i2];
items[i2] = j;
}