Skip to content

Instantly share code, notes, and snippets.

View darighost's full-sized avatar
🦊
sh.open(you.laptop, "cool network!);

darigo darighost

🦊
sh.open(you.laptop, "cool network!);
View GitHub Profile
@darighost
darighost / sleep-sort.hoon
Created July 12, 2024 03:55
Sleep sort with Gall agent & Behn
/+ default-agent, dbug
|%
+$ versioned-state
$% state-0
==
+$ state-0
$: [%0 length=@ud values=(list @)]
==
+$ card card:agent:gall
--
@darighost
darighost / merge.hoon
Created July 11, 2024 06:01
Merge sort in Hoon
|%
++ merge
|= [a=(list @) b=(list @)]
^- (list @)
=| c=(list @)
|-
=/ empty-a =(0 (lent a))
=/ empty-b =(0 (lent b))
?: ?|(empty-a empty-b)
:(weld c a b)
@darighost
darighost / beauty-sort.hoon
Created July 10, 2024 19:28
Sorting algorithm in Lacanian algebra transposed to Hoon
|= $:
objects=(list *)
$= eye-of-the-beholder
:: im not mormon, but im not going
:: to ignore that their theology
:: is trivially proven correct by
:: any reasonable reading of Lacan.
$-([* ?(%mormon-god %love %want %gross)])
=/ buckets
$:
@darighost
darighost / chud.md
Last active June 17, 2024 00:41
Chud Stack: a web app pattern for hopeless IT workers (and their families)

TL;DR too poor for DO droplet so my website's guestbook went offline, gonna use Urbit as a free backend instead. It worked, you can sign my guestbook here: darigo.su/33chan. Chud stack stands for Css/Htmx ~ Urbit Database

It's 4:33 AM and I'm wide awake, checking my email after a long night working on my grant from the Urbit Foundation.

Screenshot 2024-06-15 at 10 03 06 p m

Is my balance still overdraft, then? Thank God, I am alive. How can I cry[^situation] over cashmoney, when the living Christ breathes every suchness into being? No thanks, billing support. Besides, why the fuck did I learn to program on Urbit if not to use it as a free personal forever cloud server?

So that's what I did.

@darighost
darighost / eleganterRestoreIp.ts
Last active May 11, 2024 20:56
Restore IP coding challenge (fun with Pancho)
function* restore(raw: string, ip = ''): Generator {
if (raw.length === 0)
yield ip.slice(1);
for (const i of [0, 1, 2]) {
const octet = raw.slice(0, i+1);
if (i >= raw.length
|| Number(octet) > 255
|| ip.split('.').length > 4
|| octet.length > 1 && octet[0] === '0'
) continue;
@darighost
darighost / qsort.hoon
Last active November 14, 2023 04:57
Quicksort in Hoon!
|= l=(list @ud)
^- (list @ud)
?: =(0 (lent l))
~
=/ pivot (snag 0 l)
=/ rest (slag 1 l)
=/ less (skim rest |=(a=@ (lte a pivot)))
=/ more (skim rest |=(a=@ (gth a pivot)))
:(weld $(l less) ~[pivot] $(l more))
@darighost
darighost / hash_map.py
Created October 17, 2023 19:51
Implementing hash maps with daughter!
class HashMap:
def __init__(self, size=10_000):
self.size = size
self.values = [None] * self.size
def _char_to_number(self, c):
return ord(c) - 97
def _hash(self, string):
result = 0
@darighost
darighost / von_nuemann_vm.ts
Created October 15, 2023 06:35
Pancho triggering my autism
const MEMORY_SIZE = 1_000_000;
type Memory = any[]
type registerName = 'stackPointer'
| 'instructionPointer'
| 'returnValue'
| 'general';
interface Processor {
halted: boolean;
@darighost
darighost / nonsense_linked_list.py
Created October 12, 2023 19:00
Daughter was mad and made a bunch of nonsense during her Python homework lol
def linked_lists(node):
next_node = None
ll = []
# loop somehow
next_node = linked_lists(node)
ll.append(next_node)
next_node = None
@darighost
darighost / urbsec.md
Created October 12, 2023 06:05
Who pwns the stars?

A proposal for app sec on Urbit

TL;DR: apps should run on moons and their access to each other's data managed by a server running on your ship.

Right now, an "app" on Urbit is more like a desktop environment. Apps have access to all of your data, and manage your interaction with your Urbit. Basically, the TempleOS security model.

But in the words of ~wicdev-wisryt, Urbit is eminently securable (X).

Other proposals have been proffered, typically requiring a VM application to run on top of Urbit, which you would run apps inside of.