Skip to content

Instantly share code, notes, and snippets.

@jwise
jwise / README.md
Last active May 2, 2024 19:56
"single stage to orbit" LiteX software

This is a set of snippets to get LiteX to statically build software as part of the gateware build process. The goal is to have only a single SRAM, rather than wasting block RAM on a separate ROM and RAM partition, and to have a small chunk of code loaded in that RAM that is built as part of the gateware build process, but not necessarily the LiteX BIOS.

/* ported from humanshader.com; paste into shadertoy */
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
float x = fragCoord.x / iResolution.x * 70.0;
float y = (iResolution.y - fragCoord.y) / iResolution.y * 39.0;
float u = x - 36.0;
float v = 18.0 - y;
float h = u*u+v*v;
float R, G, B;
if (h < 200.0) {
@jwise
jwise / pbfsck.c
Created September 17, 2019 23:49
#include <stdint.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define FLAG_CLR_P(val, flag) (((val) & (flag)) == 0)
struct hdr {
uint16_t v_0x5001; /* 01 50 */
#include <unistd.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#define POLY 0x04C11DB7
uint32_t crc_table[256];
uint32_t update_crc_slow_1byte(uint32_t crc, uint32_t data) {
bcast() { adb shell am broadcast -a com.wahoofitness.bolt.buttons.$1_button.$2 ; }
bcast $1 down
bcast $1 up
bcast $1 pressed

Keybase proof

I hereby claim:

  • I am jwise on github.
  • I am jwise (https://keybase.io/jwise) on keybase.
  • I have a public key whose fingerprint is 4506 177A 4CB2 661A 3C35 75BA 9080 C092 EA80 E0B4

To claim this, I am signing this object:

KERNEL: kernel_link
DUMPFILE: dump.201310210007 [PARTIAL DUMP]
CPUS: 4
DATE: Mon Oct 21 00:06:20 2013
UPTIME: 00:01:07
LOAD AVERAGE: 0.89, 0.28, 0.10
TASKS: 411
NODENAME: moroso
RELEASE: 3.2.0-4-amd64
VERSION: #1 SMP Debian 3.2.46-1+deb7u1
@jwise
jwise / Example usage
Created October 16, 2011 03:40
A few short scripts to walk through Lua tables in GDB
(gdb) lua_globals L
(gdb) lua_gettype $rv
(gdb) lua_gettable $rv "string"
Walking node part...
Value at node idx 1 Key [STRING]: string -> value type 5 @ (TValue *)0x81012cc
(gdb) lua_gettype $rv
(gdb) lua_walktable $rv
Walking array part...
Walking node part...
Value at node idx 0 Key [STRING]: sub -> value type 6 @ (TValue*)0x8100160