Skip to content

Instantly share code, notes, and snippets.

@kotarou3
kotarou3 / singleprocesshack.diff
Last active June 1, 2021 08:27
Pokemon Showdown single process hack
diff --git a/battle-engine.js b/battle-engine.js
index a8d1d27..4cb79c9 100644
--- a/battle-engine.js
+++ b/battle-engine.js
@@ -20,9 +20,9 @@ if (!('existsSync' in fs)) {
global.config = require('./config/config.js');
// graceful crash - allow current battles to finish before restarting
-process.on('uncaughtException', function (err) {
+/*process.on('uncaughtException', function (err) {
@kotarou3
kotarou3 / 0001-Hack-in-C++-support.patch
Last active March 6, 2017 08:38
For COMP9242 16s2
From 16fb4aa41e1ac236cf1f57747b70ab650292658d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=B0=8F=E5=A4=AA?= <nospam@kota.moe>
Date: Thu, 4 Aug 2016 21:55:53 +1000
Subject: [PATCH] Hack in C++ support
Also via a unusual method to update the musl version without creating a huge
diff that give won't accept.
musl needed to be updated because libc++ depends on a newer one than the one
provided.
剕 [あしきり] /(n) (arch) (See 五刑) cutting off the leg at the knee (form of punishment in ancient China)/EntL2542150/
劓 [はなきり] /(n) (arch) (See 五刑) cutting off the nose (form of punishment in ancient China)/EntL2542140/
匜;半挿 [はそう;はぞう] /(n) (1) (esp. ) wide-mouthed ceramic vessel having a small hole in its spherical base (into which bamboo was probably inserted to pour liquids)/(2) (See 半挿・はんぞう・1) teapot-like object made typically of lacquerware and used to pour hot and cold liquids/EntL2791750/
噯;噯気;噫気;噯木(iK) [おくび(噯,噯気);あいき(噯気,噫気,噯木)] /(n) (uk) belch/eructation/burp/EntL2007450X/
垜;安土;堋 [あずち] /(n) mound on which targets are placed (in archery)/firing mound/EntL2542010/
杮;木屑;柿(iK) [こけら] /(n) (1) chopped wood/wood chips/(2) (abbr) (See こけら板) thin shingles/EntL2097450/
棈;阿部槙(ateji) [あべまき;アベマキ] /(n) (uk) Chinese cork oak (Quercus variabilis)/EntL2827052/
楣;目草 [まぐさ] /(n) (uk) {archit} (See 蹴放し) lintel (lacking the grooves needed for a sliding door)/EntL2056390X/
氐 [てい] /(n) (1) Di (ancient Chinese ethnic group)/(2) {as
@kotarou3
kotarou3 / timetable-formatter.js
Last active July 20, 2016 19:26
Format UNSW timetable for conversion to PDF
let printoutHeight = 18; // In centimetres
function xpath(node, path) {
let elems = document.evaluate(path, node, null, XPathResult.ANY_TYPE, null);
let elem;
let result = [];
while (elem = elems.iterateNext())
result.push(elem);
return result;

ARM compared with AVR

Disclaimer

This document will be based on the ARMv8-A architecture, mainly focusing on AArch64, and comparing it to ATmega2560's megaAVR architecture.
Thus "ARM" will be used to mean "ARMv8-A AArch64" and "AVR" as "megaAVR".

Microarchitectural details for ARM are taken from the Cortex-A57.

Overview

Focusing on the differences between ARM and AVR, ARM has:

#!/usr/bin/nodejs
"use strict";
require("prfun/smash");
const co = require("co");
const execFile = Promise.guard(
require("os").cpus().length + 1,
(cmd, args) => require("mz/child_process").execFile(cmd, args, {maxBuffer: 100 * 1024 * 1024})
);
const fs = require("mz/fs");
@kotarou3
kotarou3 / examine-middlewares.js
Created February 3, 2016 07:39
Scripts to help with examining middlewares
function examineMiddlewares(middlewares) {
"use strict";
let results = [];
for (let middleware of middlewares) {
let script = %FunctionGetScript(middleware);
let position = %FunctionGetScriptSourcePosition(middleware);
let line = script.source.slice(0, position).split("\n").length - 1;
let source = %FunctionGetSourceCode(middleware);
level2:ach3sa6F
@kotarou3
kotarou3 / gist:5544626
Created May 9, 2013 00:08
Open and completely unfiltered ports for the NSW DET network. These all happen to be POP or IMAP ports for some reason. You can access any address with these ports open, even ones that are meant to be blocked.
109
110
143
993
995
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/select.h>
#include <sys/time.h>
#include <netinet/in.h>