Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
# Hacky script hacked together from the NixOS wiki, because NixOS doesn't actually sort out partitionting apparently.
set -euo pipefail
###############
# Setup partitions
parted /dev/sda -- mklabel gpt
@crertel
crertel / janky_stream.js
Created July 2, 2019 20:54
Gross streaming server hack
var http = require("http");
var express = require('express');
var fs = require("fs");
var app = express();
var files = [
[fs.readFileSync("./music/1.mp3"), 128 * 1024],
[fs.readFileSync("./music/2.mp3"), 64 * 1024],
];
@crertel
crertel / mastermind.el
Created May 21, 2019 19:35
Adventures in emacs-lisp doing a mastermind game
(require 'dash)
(setq kColors '( :red :green :blue :cyan :orange :yellow))
(defun make-random-color
(x)
"Picks a random color."
( nth (random ( length kColors) ) kColors ))
(defun make-sequence
@crertel
crertel / GeoChatClient
Created October 31, 2013 05:50
Simple example code for geo-based chatting.
$(function(){
ws = new WebSocket("ws://localhost:8080");
ws.onmessage = function(evt) {
if ($('#chat tbody tr:first').length > 0){
$('#chat tbody tr:first').before('<tr><td>' + evt.data + '</td></tr>');
} else {
$('#chat tbody').append('<tr><td>' + evt.data + '</td></tr>');
}
};