Skip to content

Instantly share code, notes, and snippets.

View MatthiasPortzel's full-sized avatar

Matthias MatthiasPortzel

View GitHub Profile
% Prolog doesn't have functions, per se. It has statements that are true.
% For example, addition(2, 2, 4) can be read as "two plus two is 4".
% And it doesn't return anything.
% It can sometimes be helpful to think of the third value as a return value,
% however, the power of Prolog is that the statements can be read both "forward" and "backward"
% Prolog is like a deduction machine.
% Given a list of facts, it will deduce the values of any variables (things that start with capital letters)

Making git diff and less work together nicely on Mac

For reference, some Less options we're going to be using:

  • -S, less doesn't wrap lines;
  • -F, less auto-exits if output less than a page
  • -R, less honors color control codes
  • -X, disables termcap. This is set by git by default, but it breaks scrolling for some reason
  1. Make sure you're using the most recent version of both software. (The versions that are compiled by Apple and included in macOS are non-standard.)
import express from "express";
import Turn from "node-turn";
//App serves user controlled HTML inside of a content security policy
//The app can run JS but shouldn't be able to "phone-home" to a remote server
//This is untrusted
const CODE = `<!DOCTYPE html>
<html>
<body>
@MatthiasPortzel
MatthiasPortzel / sandcastle-mac-iphone7-android.md
Last active April 2, 2024 12:32
A walkthrough of downloading Android on an iPhone 7 and getting setup

This tutorial is going to walk you through taking an unjailbroken iPhone 7, and a Mac, and installing Android on the phone using Project Sandcastle.

  • Download Project Sandcastle from here. We want the Android build.
  • This document follows the instructions under the Mac section of the README, but with more detail and extra setup help at the end.

Perform a Checkra1n jailbreak

  • Download Checkra1n from here.
  • Move the Checkra1n app to /Applications/Checkra1n.app (this is important later).
  • Connect your phone to the computer
  • Launch the checkra1n app, and perform the jailbreak as described.
function getAbnormalProps () {
var f = document.createElement("iframe");
f.src = "about:blank";
document.body.appendChild(f);
var normalProps = Object.keys(f.contentWindow);
var result = {};
Object.keys(window).filter(p => !normalProps.includes(p)).forEach(p => { result[p] = window[p]; });

Keybase proof

I hereby claim:

  • I am MatthiasSaihttam on github.
  • I am matthias1 (https://keybase.io/matthias1) on keybase.
  • I have a public key whose fingerprint is 7C97 9494 7C55 C478 FEFF 932C 154B 71C3 B6C7 7172

To claim this, I am signing this object:

@MatthiasPortzel
MatthiasPortzel / xi-syntax.md
Created April 13, 2019 04:36
An example of how to add syntax highlighting for new languages to xi-mac.
  1. To add, for example, TypeScript,
  2. Find a .sublime-syntax file for the language.
  3. Create a TypeScript folder in xi-mac/xi-editor/rust/syntect-plugin/syntect-resources/Packages/
  4. Place the .sublime-syntax file in that folder.
/xi-mac/xi-editor/rust/syntect-plugin/syntect-resources/Packages/TypeScript/TypeScript.sublime-syntax
  1. In xi-mac/xi-editor/rust/syntect-plugin/, run
@MatthiasPortzel
MatthiasPortzel / better-ka-voting-v2.js
Created September 6, 2018 00:00
KA voting script, this time without down-voting, hopefully for the KA extension.
(function () {
/* ---- Definitions and fetching information ---- */
const EXTENSION_ITEM_CLASSNAME = "m-better-voting";
let oldWrap = document.querySelector(".voting-wrap .discussion-meta-controls").firstChild;
//No voting wrap means we're looking at a child account program or a tutorial/offical video or program, contest, etc
if (!oldWrap || !oldWrap.innerText.includes("Vote")) {
return;
@MatthiasPortzel
MatthiasPortzel / KAUserList.json
Created January 12, 2018 04:49
A list of KA users and some basic info about them
[
{"username": "Butterflys4me", "kaid": "kaid_288875354292615286993893", "nickname": "Sasha B", "points": 5171599},
{"username": "JuzerShakir", "points": 5278769, "nickname": "Juzer Shakir", "kaid": "kaid_1019087183123970941813090"},
{"username": "furia.dhaval", "kaid": "kaid_1143531252016047271846752", "nickname": "Dhaval Furia", "points": 7861227},
{"username": "CaptainAmericaCivilWar2016", "kaid": "kaid_124058193188360295524990", "nickname": "David (TD)", "points": 0},
{"username": "kdgettelman", "points": 7063005, "nickname": "Lachesis", "kaid": "kaid_238644219424894610277990"},
{"username": "Thornclaw", "kaid": "kaid_449226918406096781851737", "nickname": "Roman Farchutdinov", "points": 6071563},
{"username": "versesvineyard", "kaid": "kaid_519084642615019393614658", "nickname": "jjv007", "points": 5924578},
{"username": "HeYamin", "points": 9742971, "nickname": "Benjamin", "kaid": "kaid_642616638457067013727525"},
{"username": "yagod", "points": 7122516, "nickname": "Yago", "kaid": "kaid_346165209013713
<!DOCTYPE html>
<!-- Taken from https://khanacademy.org/cs/i/5157014494511104, from pamela, from DillingerLee -->
<html>
<head>
<title>Processing.JS inside Webpages: Template</title>
</head>
<body>
<p align="center">