20190526

stupid computer tricks

https://stackoverflow.com/questions/235839/indent-multiple-lines-quickly-in-vi – with a lot of code to indent in one go, and when vim’s auto-indent isn’t totally broken in the current language mode, try going to the block to indent, and then type

=i{

neato link

https://www.telnetbbsguide.com/ – a searchable database of bulletin board systems, for when you’ve finally had your fill of port 80 nonsense.

20190523

neato tool

the ubuntu package debtree generates a dot digraph of dependencies for ubuntu packages. these can be useful for work breakdown structures, and identifying lower-level tools that might be worth learning.

debtree --show-all npm | dot -Tpdf >result.pdf ; fopen result.pdf

the above may give you a map of the dependencies that npm uses.

neato website

https://petergarner.net/notes/index.php?thisnote=20180202-Travels+with+a+Pi – setting up an rpi as a travel-safe portable

20190518

neato links

https://proseful.com/ – someone decided to write a minimal commercial blogging platform. that’s pretty cool; doesn’t look to be open source, and it seems to be using some compiled virtual dom library for some parts of its frontend.

https://arstechnica.com/science/2019/05/mass-grave-in-poland-embodies-the-violent-beginning-of-the-bronze-age/ – tech bloggers blog about bronze age mass grave found in Poland.

https://threejsfundamentals.org/threejs/lessons/threejs-fundamentals.html – three.js has released a new tutorial; this might be enough to get started on a vdom library for 3d objects along the lines of domchanger.

https://cdn-images-1.medium.com/max/1600/1*ooyoTtGkEfUYosK56_AWdw.jpeg – neato flowchart

20190516

stupid computer tricks

here’s an ecs simulation framework:

var ecs = {};
ecs._entity_counter = 0;
ecs.new_entity = function() { 
	ecs._entity_counter++;
	return ecs._entity_counter;
};
ecs.ComponentMap = function(ctor) { 
	this.entities = {};
	this.add = function(id) { 
		this.entities[id] = new ctor();
	};
	this.remove = function(id) { 
		delete this.entities[id];
	};
	this.get = function(id) { 
		return this.entities[id];
	};
};
ecs.component_intersect = function() { 
	var result = [];
	var ks = [];
	for(var i in arguments) { 
		var k = Object.keys(arguments[i].entities);
		ks.push(k);
	}
	result = ecs.intersection(ks);
	return result;
};
ecs.intersection = function() { 
	var result = [];
	var lists;
  	if(arguments.length === 1) {
		lists = arguments[0];
	} else {
		lists = arguments;
	}
	for(var i = 0; i < lists.length; i++) {
		var currentList = lists[i];
		for(var y = 0; y < currentList.length; y++) {
			var currentValue = currentList[y];
			if(result.indexOf(currentValue) === -1) {
				if(lists.filter(function(obj) { 
					return obj.indexOf(currentValue) == -1 
				}).length == 0) {
					result.push(currentValue);
				}
			}
		}
	}
	return result;
};

this expects the library user to implement systems_* methods, which mutate components in their ComponentMap objects.

app.system_updatePhysics = function(map) { 
	var entities = ecs.component_intersect(map.Positions,map.Velocities);
	for(var i in entities) { 
		var id = entities[i];
		var pos = map.Positions.get(id);
		var vel = map.Velocities.get(id);
		pos.x += vel.x;
		pos.y += vel.y;
	}
};

there are, clearly, flow control constructs that would make this nicer to work with.

20190514

neato link

https://ohshitgit.com/ – documentation of how to actually assemble the lego bricks that git spills on the floor next to your desktop.

now i just need one for mercurial.

subversion first, though, because wtf is it doing when you merge?

stupid computer tricks

here is a bit of code that might help to make phantomjs look like a real web browser to the site you’re visiting:

var app = {};
app.main = function() {
    app.page = require('webpage').create();
    app.page.customHeaders = {
      'User-Agent':'user-agent-cribbed-from-php'
    };
    app.page.open('your-test-url',app.return_main);
};
app.return_main = function(status) { 
    app.page.render('result.png',{'format':'png'});
    app.page.close();
};
app.main();

one may replace user-agent-cribbed-from-php with the browser’s UA string. this is available from print_r(getallheaders(),1)

one may replace your-test-url with the site to visit.

actually orchestrating phantomjs to navigate around a bunch of webpages is another exercise.

this does not do anything about the window.phantom object exposed in the page js, so adversarial sites can still do capabilities-based identification.

20190506

neato video

dying in the woods simulator

the long dark may soon be getting updates to graphics and game behaviour. the pain system looks fantastic.

follow-up – episode ii, aka, “man vs BEAAAAAAAAR” remains a pretty great boyfriend simulator on easy mode.

20190505

neato link

https://neilkakkar.com/Algorithms-to-live-by.html – practical applications of computer science concepts.

this list of algorithms and applications raises many uncomfortable questions about certain bits of public discourse. if the stated rate is high or low, the stopping time can be seriously overstated or understated, which can have a nonlinear impact on human suffering. unfortunately, there are also certain organizations which will attempt to destroy those who point out that the statistics that they cite for purely rhetorical reasons are lies.

20190502

neato link

https://blog.cr.yp.to/20190430-vectorize.html – an introduction to vectorization.

now a trick would be to translate this kind of language to an advertisement for peopleshader.com, which might allow people to vectorize their DMs, tech support guides and responses to forum posts. explaining what a shader is, or what they are useful for, is difficult, when pulling out of the context of computer graphics to the context of overwhelming social media.

neato link

https://writing.markchristian.org/2012/01/17/ridiculously-simple-string-formatting-in-javascript/ – ridiculously simple string formatting in javascript. replaces the object’s prototype .tostring method, so might mess with existing code, but being able to format the properties into a string with %propertyTags% in it is a pretty elegant solution.

neato link

https://learnforeverlearn.com/bandits/ – thompson sampling multi-armed bandit in javascript, with decent visualisation.

this could be mistaken for the fabled “expected utility maximizer” that economists and old-school ai researchers are sometimes on about. it may be interesting to network a bunch of these together, or attach different utilities to different lever pulls, to direct ad-hoc experimentation in new domains.