Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Barlow telent

View GitHub Profile
@telent
telent / sms.fnl
Created September 16, 2022 15:18
View sms.fnl
(local fcntl (require "posix.fcntl"))
(local posix (require "posix"))
(local { : read : write } (require "posix.unistd"))
(local {: tcgetattr : tcsetattr : tcdrain
: CLOCAL : CREAD
: ICANON : ECHO : ECHOE : ISIG
: OPOST
} (require "posix.termio"))
(local { : nanosleep } (require "posix.time"))
(local { : view } (require "fennel"))
View bcache.c
block->blocknum = blocknum;
err = bio_read(cache->dev, block->ptr, (off_t)blocknum * cache->block_size, cache->block_size );
if(block->ptr == (void *)0x8f76c0e4) {
char * p = ((char *)block->ptr);
thread_sleep(1);
while((p < (char *) 0x8f76d0e4) && (*p != 0x99))
p++;
p-=4;
dprintf(SPEW, "%x: %x %x %x %x %x %x %x %x %d %d\n",
View refresh-bootfs.nix
{ config, pkgs, lib, ... }:
# nixos/mobile-nixos don't currently (June 2022) update the kernel and
# initrd used by the bootloader when nixos-rebuild is run. This is a
# workaround until they do. Mount your boot filesystem somewhere
# and run "refresh-bootfs /path/to/mounted/bootfs" after switching
# configuration
let
inherit (config.mobile.outputs) recovery stage-0;
View postmarketos-dmesg
[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[ 0.000000] Linux version 5.16.0-postmarketos-qcom-msm8953 (pmos@build) (aarch64-alpine-linux-musl-gcc (Alpine 11.2.1_git20220219) 11.2.1 20220219, GNU ld (GNU Binutils) 2.38) #1 SMP PREEMPT Thu Mar 3 08:28:04 UTC 2022
[ 0.000000] Machine model: Motorola G5 Plus (potter)
[ 0.000000] Reserved memory: created DMA memory pool at 0x0000000081800000, size 0 MiB
[ 0.000000] OF: reserved mem: initialized node memory@81800000, compatible id shared-dma-pool
[ 0.000000] NUMA: No NUMA configuration found
[ 0.000000] NUMA: Faking a node at [mem 0x0000000040000000-0x00000000ffffffff]
[ 0.000000] NUMA: NODE_DATA [mem 0xff9f1b40-0xff9f3fff]
[ 0.000000] Zone ranges:
[ 0.000000] DMA [mem 0x0000000040000000-0x00000000ffffffff]
View no-touchscreen-dmesg
[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[ 0.000000] Linux version 5.18.3 (nixbld@localhost) (gcc (GCC) 9.3.0, GNU ld (GNU Binutils) 2.38) #1-mobile-nixos SMP PREEMPT Tue Jan 1 00:00:00 UTC 1980
[ 0.000000] Machine model: Motorola G5 Plus (potter)
[ 0.000000] efi: UEFI not found.
[ 0.000000] Reserved memory: created DMA memory pool at 0x0000000081800000, size 0 MiB
[ 0.000000] OF: reserved mem: initialized node memory@81800000, compatible id shared-dma-pool
[ 0.000000] NUMA: No NUMA configuration found
[ 0.000000] NUMA: Faking a node at [mem 0x0000000040000000-0x00000000ffffffff]
[ 0.000000] NUMA: NODE_DATA [mem 0xff9f1a40-0xff9f3fff]
[ 0.000000] Zone ranges:
View gist:05b202fbfe75ec5991d0fb611cfde5a1
{ lib, pkgs, config, ... }:
let
inherit (lib.strings) makeBinPath;
app = pkgs.callPackage ../mobile-nixos/examples/hello/app {};
hello-gui = pkgs.mobile-nixos.stage-1.script-loader.wrap {
name = "hello-gui";
applet = "${app}/libexec/app.mrb";
env = {
PATH = "${makeBinPath (with pkgs;[
systemd # journalctl
View odroid-n2-text-mode.nix

Symptoms

boots to grub menu, but when any option selected it says

unaligned pointer 0x8c6ebc159a4294f5
Aborted. Press any key to exit.

Pressing a key resets the board

Sources

View lib.fnl
;; lib.fnl
;; surely there is a better way to do this
(fn next-key [tbl current-key]
(let [first (next tbl)
n
(accumulate [is-next nil
id view (pairs tbl)
:until (and is-next (not (= is-next current-key)))]
View configuration.nix
{ config, lib, pkgs, ... }:
let
inherit (lib) mkForce;
in
{
imports =
let mobile = fetchTarball {
name = "mobile-nixos";
url = "https://codeload.github.com/NixOS/mobile-nixos/tar.gz/c45932ae53aa0c5da9cfddd25e7cbb503f472147";
@telent
telent / just.fnl
Created February 5, 2022 13:13
A minimal web browser
View just.fnl
(local lgi (require :lgi))
(local inspect (require :inspect))
(local Gtk lgi.Gtk)
(local WebKit2 lgi.WebKit2)
(let [current-url "https://terse.telent.net"
window (Gtk.Window {
:title "Just browsing"
:default_width 800