Skip to content

Instantly share code, notes, and snippets.

View b4.c
#include<stdio.h>
//-- macros ---
#define I int // I = any int
#define A int // A = specifically an address in vm's ram
#define B int // B = int used as boolean
#define C char // C = char type
#define U8 char // U8= 8 bits
#define V void // V = void
View IntListAsNum.hs
{-# Language FlexibleInstances, ConstraintKinds #-}
module IntListAsNum where
-- IntList :: Num implementation
--
-- At the GHCi prompt the expression "take 5 10" yields
-- the strange error message:
--
-- No instance for (Num [a0]) arising from a use of ‘it’
-- In a stmt of an interactive GHCi command: print it
@tangentstorm
tangentstorm / proof
Last active Aug 29, 2015
a proof language (embedded in nial)
View proof
r0 := ("^^>^* (ph 'exponent rule')
(("$x "^ "$y) "^ "$z)
"= (("$x "^ ("$y "* "$z))))
r1 := ("xy>yx (ph 'commutative rule for *')
("x "* "y)
"= ("y "* "x))
@tangentstorm
tangentstorm / paging.md
Created Nov 14, 2014
(probably not paging) a wild guess about what i think paging might be
View paging.md

Most modern operating systems allow running many programs simultaneously.

There's no way to know how much ram a particular program will need, since this might depend on user actions (like opening a file). This means there's no way for the operating system to allocate a fixed chunk of ram for each process.

Since the amount of ram required by a process may change over time, you might want to leave lots of room for each process to grow.

On the other hand, RAM is a limited resource on a computer, so you want to pack the processes together tightly in ram.

View program-composition.org

“Here’s an example. In one integer variable x , the specification x′=x ∨ x′=x+1 says that the final value of x is either the same as the initial value or one greater. Let’s compose it with itself.

   x′=x ∨ x′=x+1 . x′=x ∨ x′=x+1
= ∃x′′· (x′′=x ∨ x′′=x+1) ∧ (x′=x′′ ∨ x′=x′′+1) 
 distribute ∧ over ∨
= ∃x′′· x′′=x ∧ x′=x′′ ∨ x′′=x+1 ∧ x′=x′′ ∨ x′′=x ∧ x′=x′′+1 ∨ x′′=x+1 ∧ x′=x′′+1   
 distribute ∃ over ∨
= (∃x′′· x′′=x ∧ x′=x′′) ∨ (∃x′′· x′′=x+1 ∧ x′=x′′) ∨ (∃x′′· x′′=x ∧ x′=x′′+1) ∨ (∃x′′· x′′=x+1 ∧ x′=x′′+1) 
 One Point, 4 times
View doctest.ijs
NB. doctest
NB. unicode box chars. (j magically translates these to unicode for display)
uboxch=: [: (9!:7) (a.{~16 17 18 19 20 21 22 23 24 25 26)"_
aboxch =: 16 26 17 18 25 22 23 24 19 20 21
NB. ┌ ─ ┬ ┐ │ └ ┴ ┘ ├ ┼ ┤
uboxch =: 9484 9472 9516 9488 9474 9492 9524 9496 9500 9532 9508
forcerank =: ,@] $~ -@[ {.!.1 [: $ ]
View exponents.thy
theory Exponents
imports Main
begin
lemma rMulComm: "(a*b ::int) = (b*a ::int)"
by (rule Groups.ab_semigroup_mult_class.mult.commute)
lemma rExpMul: "((a^b)^c ::int) = (a^(b*c) ::int)"
by (rule Int.zpower_zpower)
View gist:3449f2372fc4843c8313
blit ~:/\^:(<32) ]32$1
▛▛▛▛▛▛▛▛▛▛▛▛▛▛▛▛
▛ ▛ ▛ ▛ ▛ ▛ ▛ ▛
▛▛ ▛▛ ▛▛ ▛▛
▛ ▛ ▛ ▛
▛▛▛▛ ▛▛▛▛
▛ ▛ ▛ ▛
▛▛ ▛▛
▛ ▛
▛▛▛▛▛▛▛▛
View gist:0c4052c492db4061a96e
23:51:07 j-bot tangentstorm: |▝▟▝▟▝▟▝▟▝▟▝▟▝▟▝▟▝▟▝▟▝▟▝▟▝▟▝▟▝▟▝▟|
23:51:07 j-bot tangentstorm: | ▝▄▟ ▝▄▟ ▝▄▟ ▝▄▟ ▝▄▟ ▝▄▟ ▝▄▟ ▝▄▟|
23:51:07 j-bot tangentstorm: | ▝▟ ▝▟ ▝▟ ▝▟ ▝▟ ▝▟ ▝▟ ▝▟|
23:51:07 j-bot tangentstorm: | ▝▄▄▄▟ ▝▄▄▄▟ ▝▄▄▄▟ ▝▄▄▄▟|
23:51:28 tangentstorm neat, huh?
23:52:21 tangentstorm the sierpinski pattern continues until it makes a 64x64 grid.
23:52:32 tangentstorm if i'd used 7 variables, it would be 128*128.. and so on.
23:52:58 tangentstorm here is the derivative of each line.
23:53:04 tangentstorm oh that sucks. :/
23:53:18 tangentstorm [ pb bd a,b,(a and b),c,(c and a),(c and b),(c and b and a),d
View minij.js
var ometajs_ = require("ometajs");var AbstractGrammar = ometajs_.grammars.AbstractGrammar;var BSJSParser = ometajs_.grammars.BSJSParser;var BSJSIdentity = ometajs_.grammars.BSJSIdentity;var BSJSTranslator = ometajs_.grammars.BSJSTranslator;// mini-j interpreter
// just enough j to handle simple boolean expressions
int = function (s) { return parseInt(s,10); }
ints = function (s) { return s.split(" ").map(int); }
var minij = function minij(source, opts) {AbstractGrammar.call(this, source, opts)};minij.grammarName = "minij";minij.match = AbstractGrammar.match;minij.matchAll = AbstractGrammar.matchAll;exports.minij = minij;require("util").inherits(minij, AbstractGrammar);minij.prototype["j"] = function $j() {return (this._rule("bits",false,[],null,this["bits"]))};
minij.prototype["bits"] = function $bits() {return (this._atomic(function() {var bs;return this._list(function() {return this._rule("bit",false,[],null,this["bit"]) && this._many(function() { return this._atomic(function() { return (this._many(funct
You can’t perform that action at this time.