Skip to content

Instantly share code, notes, and snippets.

View swetland's full-sized avatar

Brian Swetland swetland

View GitHub Profile
@swetland
swetland / krita.notes.txt
Last active January 7, 2024 16:45
Krita 5.1.x on Android
Menu / Settings / Configure Krita...
------------------------------------
General:
Window: Multi Document Mode: Sub Window (removes tab bar from top of canvas)
Tools: Enable Touch Painting: DISABLE
Tools: Tool Options Location: In Toolbar
Display: Misc: Hide Canvas Scrollbars: ENABLE (more space for canvas)
Canvas Input Settings:
Touch Gestures: Gesture / Three Finger Tap / Redo DELETE
@swetland
swetland / edit-lists.sh
Created November 17, 2022 09:35
a script to add mastodon follows to lists using madonctl
#!/bin/bash
# 1. Get and build madonctl from https://github.com/McKael/madonctl.git and login
#
# 2. set this to your server name, as local accounts are stored without @server.name:
SERVER="chaos.social"
#
# 3. Fetch account and list name->id maps:
# ./edit-lists.sh setup
#
Project Oberon RISC5 Architecture
---------------------------------
The various documents describing Project Oberon's RISC5 architecture
are not entirely in agreement with each other, and (maybe most critically)
not entirely in agreement with the verilog implementation of the CPU
is RISC.v. This document attempts to be the "most correct" version,
looking to the verilog implementation RISC.v as "most authoritative"
0. Processor Resources
####
#### building open source ice40 family toolchain
####
Updated April 2020
To allow for easily swapping of tools, every component is installed
into /work/app/{appname}/{bin,lib,include,share,...}
Your path will need entries for each /work/app/{appname}/bin
@swetland
swetland / letters.c
Created September 12, 2019 08:15
count occurrences of a-z in short phrases
// letters.c - 2019 - brian swetland
#include <ctype.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char** argv) {
char *x, line[256];
unsigned count[256];
unsigned extra, missing, n;
while ((x = fgets(line, sizeof(line), stdin)) != NULL) {
localparam SEL_REG_B_IR_B = 1'b0;
localparam SEL_REG_B_IR_C = 1'b1;
// Does Not Work
logic [2:0]de_regs_bsel = (de_sel_reg_b == SEL_REG_B_IR_C) ? de_ir_sel_c : de_ir_sel_b;
// Does Work
wire [2:0]de_regs_bsel = (de_sel_reg_b == SEL_REG_B_IR_C) ? de_ir_sel_c : de_ir_sel_b;
// Does Not Work
instruction formats constant encodings alu opcodes
----------------------- ------------------- --------------------
FED CBA 987 654 3210 000 add R = A + B
A fff bbb aaa ccc 0ooo 001 sub R = A - B
B sii iii aaa ccc 0ooo si6 siiiii 010 and R = A & B
C sii iii kkk ccc 0ooo si9 skkkiiiii 011 or R = A | B
D sii iii xjj jjj 0ooo si11 sjjjjjiiiii 100 xor R = A ^ B
E sii iii aaa mxx 0ooo si7 smiiiii 101 slt R = A < B
F sii iii aaa ccc 1fff si6 siiiii 110 sge R = A >= B
@swetland
swetland / subnautica-tips.md
Created February 19, 2018 15:18
Subnautica Tips

Subnautica Game Mechanics Tips

These are some things I wish I knew when I started. They're mostly about game mechanics that were non-obvious to me.

Check your Radio every now and again

Messages will arrive once it's repaired (triggered by time passing or actions you take), and they not only add to the flavor of the story and world, but they will often point you in useful directions to find new resources and story related stuff.

Explore Everywhere, Scan Everything, Build Everything

@swetland
swetland / device-tree-brain-damage.txt
Last active August 29, 2015 14:01
Device Tree Brain Damage
I've just had my first encounter with the wonders of "DeviceTree" and I am unimpressed...
- mandatory big-endian everything, regardless of target architecture
- incurs poinless byte swapping penalty on all major architectures
- byteswap macro noise in kernel source
- string matching for names and propertynames
- no good indication of missing/invalid properties, etc
- no way to sanity check except by visual inspection (good luck!)
- some strings are inline, some are in the stringtable
- data is untyped, so while the textual format sort of deals with arrays-of-bytes,
@swetland
swetland / refresh-user-ip.tcl
Created May 12, 2014 02:03
vivado: refresh user ip
# This assumes that your local IP cores are all in the "user" library
# and that they all live in ip/$name relative to your project directory
# (where myproject.xpr lives)
# load an IP core and bump its version number by 1
proc bump_ip_version { path } {
set fname "${path}/component.xml"
set core [ipx::open_core -set_current false $fname]
set version [get_property VERSION $core]
set parts [split $version "."]