Skip to content

Instantly share code, notes, and snippets.

View i-e-b's full-sized avatar
🤔
Thinking

Iain Ballard i-e-b

🤔
Thinking
View GitHub Profile
[Test]
public void tiny_crypto()
{
var key = new byte[] { 55, 167, 44, 86, 217 };
var secretMessage = "This is the input text";
var input = Encoding.UTF8.GetBytes(secretMessage);
var encrypted = Encode(input, key);
@i-e-b
i-e-b / time.md
Created September 12, 2022 09:28
time

maybe the wavefunction oscilates through time, taking alternate paths, until it gets stuck somewhere. Maybe this getting stuck loses information locally. That would seem to give a mechanism for collapse and directionality of time.

@i-e-b
i-e-b / Lisp and Forth?.md
Created September 12, 2022 08:22
Stalisp

Forth and List based on a 'fundamental container type'. Forth -> stack, Lisp -> linked-list. We take as the fundamental container type a list/stack hybrid. Anything in a list is data. Anything outside is a function call.

Motivational example

  (4) (1 2) + *    # 12
  (4 1 2) + *      # same
 
@i-e-b
i-e-b / bits.md
Created August 17, 2022 17:49
Giditdun
  • "pipes" cover stream (read+write)

  • "cursor" over pipe to push & pull data (byte-wise, bit-wise, and broader types all mixed)

  • all types serialisable.

  • base is name(param) like lisp (similar to MECS)

  • special math mode

  • types are numeric (incl arbitrary), hash-map, vector, matrix. Everything on top of that

  • storage is scope, or mem-db

  • gc is at end of scope, special 'lift' if something survives scope.

@i-e-b
i-e-b / wordless.txt
Last active August 24, 2022 08:37
Thinking out loud
// No keywords?
my.thing { // a namespace
// proc head
procname =>
inParam1 <- (u8) // a byte list
inParam2 <- "" // a string
{
// proc body
@i-e-b
i-e-b / ConsoleWritePixel.cs
Created June 22, 2022 10:27
Write colors to dotnet console
static int[] cColors = { 0x000000, 0x000080, 0x008000, 0x008080, 0x800000, 0x800080, 0x808000, 0xC0C0C0, 0x808080, 0x0000FF, 0x00FF00, 0x00FFFF, 0xFF0000, 0xFF00FF, 0xFFFF00, 0xFFFFFF };
/// <summary>
/// By Antonín Lejsek https://stackoverflow.com/a/33715138/423033
/// </summary>
/// <param name="cValue"></param>
public static void ConsoleWritePixel(Color cValue)
{
Color[] cTable = cColors.Select(Color.FromArgb).ToArray();
char[] rList = { (char)9617, (char)9618, (char)9619, (char)9608 }; // 0, 1/4, 2/4, 3/4, 4/4
@i-e-b
i-e-b / QR Code Block and Word details.csv
Created May 27, 2022 09:17
QR Code Block and Word details
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 9 columns, instead of 7. in line 7.
version, errorCorrectionLevel, totalDataCodewords, eccPerBlock, blocksInGroup1, codewordsInGroup1, blocksInGroup2, codewordsInGroup2,
1, L, 19, 7, 1, 19, 0, 0,
1, M, 16, 10, 1, 16, 0, 0,
1, Q, 13, 13, 1, 13, 0, 0,
1, H, 9, 17, 1, 9, 0, 0,
2, L, 34, 10, 1, 34, 0, 0,
2, M, 28, 16, 1, 28, 0, 0,
2, Q, 22, 22, 1, 22,
@i-e-b
i-e-b / cookie_helper.js
Created March 29, 2022 14:19
Read and write cookies
@i-e-b
i-e-b / favicon.ico
Created August 27, 2021 12:02
Very small svg favicon for test servers
<?xml version="1.0" encoding="UTF-8"?><svg version="1.1" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg"><circle cx="24" cy="24" r="18" fill="#5b86bf"/></svg>
@i-e-b
i-e-b / CopyS3ChunkedStream.cs
Created July 30, 2021 10:07
Handles the slightly odd version of chunked HTTP/1.1 that the S3 SDK uses, but .Net does not handle correctly.
/// <summary>
/// Handles the slightly odd version of chunked HTTP/1.1
/// that the S3 SDK uses, but .Net does not handle correctly.
/// </summary>
private static async Task CopyS3ChunkedStream(Stream input, Stream output)
{
// If this is a 'chunk-signature' stream, we expect to see
// - an ascii string hex number (e.g. 5E24) -- this is the chunk length
// - the string ";chunk-signature="
// - a 64-char SHA256 hash check-sum (e.g. "e2617d7cf2c7c91a3b650b16726847b39a6f333577df6617ecd7267e66631df1")