Skip to content

Instantly share code, notes, and snippets.

View alancnet's full-sized avatar
🧙
Making the magic happen

alancnet

🧙
Making the magic happen
View GitHub Profile
@alancnet
alancnet / self-installing-service.sh
Created January 18, 2024 19:31
Self installing service
#!/bin/bash -e
SERVICE_NAME="self-installing-service"
SERVICE_DESCRIPTION="A self installing service bash script"
SELF_FILE=$(readlink -f $0)
SELF_DIR=$(dirname $SELF_FILE)
SELF_FILENAME=$(basename $SELF_FILE)
SERVICE_CONFIG="/etc/systemd/system/${SERVICE_NAME}.service"
SERVICE_FILENAME=$(basename $SERVICE_CONFIG)
@alancnet
alancnet / ucot.md
Created September 27, 2023 00:44
Unified Conscious Observer Theory (UCOT)

Unified Conscious Observer Theory (UCOT)

Abstract

The Unified Conscious Observer Theory (UCOT) proposes a novel framework that unifies quantum mechanics, cosmology, and the emergence of intelligent life. It posits that the universe originates from a singularity during the Big Bang, initiating a universal von Neumann-Wigner chain. This chain serves as a single, all-encompassing wavefunction that remains uncollapsed until the emergence of conscious observers, fulfilling the universe's inherent "purpose."

Key Concepts

The Big Bang

class WebError extends Error {
constructor(message, statusCode = 500, data = null) {
super(message)
this.statusCode = statusCode
}
}
class BadRequest extends WebError {
constructor(message = 'Bad Request', statusCode = 400, data = null) {
super(message, statusCode, data)
@alancnet
alancnet / Result
Created February 12, 2019 23:50
Rooms with Treasure or Monsters
Room 1
Area 1: Treasure
Area 2: Monsters
Area 3: Monsters
Area 4: Monsters
Area 5: Monsters
Area 6: Treasure
Area 7: Treasure
Area 8: Treasure
Area 9: Monsters
$fn = 1000;
translate([1,0,0]) rotate([0,-90,0]) {
translate([0,-.5/$fn,0]) cube([1,1/$fn,1]);
intersection() {
union() {
for (i = [0:2/$fn:0.5])
translate([i,0,0])
cylinder(1, i, 0);
for (i = [0:2/$fn:.5])
translate([.5 + i,0,0])
@alancnet
alancnet / table.js
Created November 12, 2018 21:59
Table WIP
const matchStart = (s1, s2) => {
const l = Math.max(s1.length, s2.length)
for (let i = 0; i < l; i++) {
if (s1[i] !== s2[i]) return i
}
return l
}
class Table {
constructor() {
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDCWAJy9FWNgHvWEqof5iEk5v1c7ul0SSuOPdsZ3xJ8bX8uUY4AJCSrtj56mya8WNCn4rlbmrtdaQiv6dzzrCXYXvmnA9/AT1PCtTzqRC5gi27prG2URneObHcA0xFAU8CrmhPqU26go+fN5u2ZbS+YKCQXQwSItkmZTwMTg0xn2JXHjpDl/4AEKSc8upEjGS6IzETfUa7xiPPb0F4EHxJpJ0eQJCU2fJRHxthRS/Ex66XQyCOmC5Cc6tMlnTYybhhBH5WkkZ9x7wZ/pronmkj/2M2SYs5GPlrxLwISd51O/+o+4MEYASNblIdEJCq/+fBcZtEE4AFRy/5/pEcW3M3V alco@alco-asus
function helloWorld()
print("Hello World")
end
helloWorld()
@alancnet
alancnet / HashSetFile.scala
Created September 28, 2016 23:51
HashSet implemented against a file system.
import java.io.{File, RandomAccessFile}
class HashSetFile(file: File, modulus: Int = 32) {
val raf = new RandomAccessFile(file, "rw")
def filePosition = raf.getFilePointer
def fileLength = raf.length
val bytesInLong = java.lang.Long.BYTES
val indexesStart = bytesInLong
val start = System.currentTimeMillis()
if (fileLength == 0) {
@alancnet
alancnet / RandomAccessFileHashSet.scala
Created September 28, 2016 23:42
A slow, super large heirarchial hash set thing using files.
import java.io.{File, RandomAccessFile}
class RandomAccessFileHashSet(file: File) {
val raf = new RandomAccessFile(file, "rw")
def filePosition = raf.getFilePointer
def fileLength = raf.length
var recordCount: Long = 0L
raf.writeLong(recordCount)
val hashStart = filePosition