Skip to content

Instantly share code, notes, and snippets.

@bodil
bodil / wat.ts
Created January 16, 2014 22:36
Don't.
/**
* Magic version of Rx.Observable.sync() that allows for adding more
* Observables to the input feed while processing.
*
* Needs a more descriptive name maybe.
*/
function wat<T,U>(initialState: T, initialFeeds: Rx.IObservable<U>[], iterator: (state: T, e: U) => StateChange<T,U>): any {
var sub = new Rx.BehaviorSubject(initialState);
var state = initialState;

Notes: Arch Linux on Chromebook Pixel 2015

To install another OS, follow the instructions at https://www.chromium.org/chromium-os/developer-information-for-chrome-os-devices/chromebook-pixel-2015 to enable developer mode, after which you should be able to hit Ctrl+L on the boot screen to launch SeaBIOS, which will boot external media (BIOS only, not GPT). You’ll be able to boot the Arch installation image from a USB stick using this.

Currently, I’ve got GRUB running off an SD card, which I boot using SeaBIOS. My system is installed on the internal drive, but GRUB won’t work from there. My technique at https://gist.github.com/bodil/b14a398189e5643ee03e has so far failed to yield a booting kernel on the internal drive, which is somewhat annoying, but as I keep the SD card permanently inserted anyway, it hasn’t been bothersome.

Arch has a wiki page on the Pixel 2015: https://wiki.archlinux.org/index.php/Chromebook_Pixel_2

The stock kernel (as of 4.0.5) lacks support for some h

// Largely copied (with some modernisation applied) from:
// https://github.com/reem/rust-lazy/blob/master/src/single.rs
use std::cell::UnsafeCell;
use std::ptr;
use std::ops::{Deref, DerefMut};
use self::Inner::{Evaluated, EvaluationInProgress, Unevaluated};
pub trait Invoke<A = (), R = ()> {
@bodil
bodil / package.json
Last active September 21, 2017 13:18
Who needs Pulp anyway?
{
"name": "lol",
"version": "1.0.0",
"main": "index.js",
"config": {
"main": "Main",
"testMain": "Test.Main"
},
"scripts": {
"compile": "psc -c -f 'src/**/*.js' -f 'bower_components/purescript-*/src/**/*.js' 'src/**/*.purs' 'bower_components/purescript-*/src/**/*.purs'",

Keybase proof

I hereby claim:

  • I am bodil on github.
  • I am bodil (https://keybase.io/bodil) on keybase.
  • I have a public key ASAhOfE9MM6Kez7pDhD-sZvig7dr5jTYIwXBtuMHS32ZtQo

To claim this, I am signing this object:

@bodil
bodil / fix-my-stupid-folio.service
Created November 24, 2016 15:05
Hacks for Linux kernel glitches on the HP Elitebook Folio G1
[Unit]
Description=HP Elitebook Folio G1 fixes
[Service]
ExecStart=/sbin/fix-my-stupid-folio
[Install]
WantedBy=basic.target
@bodil
bodil / electric_wadleroo.rs
Last active January 28, 2019 22:52
Who needs higher kinded types anyway
trait Higher<A, B> {
type Target;
}
trait Higher3<A, B, C> {
type Target2;
type Target3;
}
impl<A, B> Higher<A, B> for Option<A> {
@bodil
bodil / hindley-milner.clj
Last active August 12, 2019 18:08
Port of http://dysphoria.net/code/hindley-milner/HindleyMilner.scala to 100% pure Clojure code, complete with state monad hell. Originally based on Luca Cardelli's paper "Basic Polymorphic Typechecking" http://lucacardelli.name/Papers/BasicTypechecking.A4.pdf
;;; Clojure port of http://dysphoria.net/code/hindley-milner/HindleyMilner.scala
(ns hindley-milner
(:require [clojure.string :as str]))
(declare occurs-in? occurs-in-type?)
(defn map-state
"Evaluate a list of state monad values in sequence, producing
a list of the results of each evaluation."
@bodil
bodil / tween.ts
Created May 27, 2014 16:29
Tween.js + Bacon.js === <3
///<reference path="dts/tween.js.d.ts" />
///<amd-dependency path="tween" />
import b = require("./bacon");
import graph = require("./graph");
import ev = require("./events");
module TweenEffects {
var Tween = require("tween.js").Tween;
@bodil
bodil / init.ts
Created August 12, 2019 17:34
Snapshot of my vscode-use-package setup
import * as vscode from "vscode";
import { initUsePackage, usePackage, configSet } from "vscode-use-package";
import * as nav from "./nav";
import * as js from "./js";
import * as rust from "./rust";
export function init(context: vscode.ExtensionContext) {
console.log(`HELLO FROM INIT SCRIPT`);