Skip to content

Instantly share code, notes, and snippets.

@bodil
bodil / main.ts
Created November 8, 2022 22:10
Add migration aliases to a Pleroma account
import generator, { OAuth } from "megalodon";
import PleromaAPI from "megalodon/lib/src/pleroma/api_client";
import { DEFAULT_UA } from "megalodon/lib/src/default";
import * as readline from "readline-sync";
async function main() {
const baseUrl = readline.question('URL of Pleroma instance (ex. "https://lol.camp"): ');
const registerClient = generator("pleroma", baseUrl);
const appData = await registerClient.registerApp("User Alias Editor", {});
@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`);
@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 / bool.rs
Last active February 28, 2021 03:50
Simple type level natural numbers in Rust
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub struct True;
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub struct False;
pub trait Bool {
fn new() -> Self;
}
impl Bool for True {
// 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 / 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

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 / 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'",

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

How to put a GNU/Linux installation on your Chromebook

DISCLAIMER: This could all quite plausibly brick your Chromebook, and I take no responsibility for any damage you might inflict on it or yourself. Follow along at your own risk.

Most Chromebooks can run some flavour of GNU/Linux using the Chrubuntu method, running off the kernel that comes with ChromeOS. I found, however, that the ChromeOS kernel didn’t play well with recent X.org versions, and would refuse to recover from suspend, and not deal very well at all with having an external screen attached to it.

I also wanted to replace ChromeOS entirely with Arch on my Chromebook, because only 16 gigabytes of eMMC isn’t very convenient for dual booting. To accomplish this, I needed an external installation medium.

First of all, you’ll need to get your Chromebook into developer mode if you haven’t already. This is model specific, although for most recent models holding the Escape and Reload keys while booting should do the trick. If not, ask Google.