Skip to content

Instantly share code, notes, and snippets.

UDEV [45295.283954] add /devices/pci0000:00/0000:00:14.0/usb1/1-8/1-8:1.0/bluetooth/hci0/hci0:3585 (bluetooth)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-8/1-8:1.0/bluetooth/hci0/hci0:3585
SUBSYSTEM=bluetooth
DEVTYPE=link
SEQNUM=13471
USEC_INITIALIZED=45295283681
SYSTEMD_ALIAS=/sys/subsystem/bluetooth/devices/hci0:3585
SYSTEMD_WANTS=bluetooth.target
SYSTEMD_USER_WANTS=bluetooth.target
@crides
crides / layout.py
Last active November 26, 2023 20:04
# Extracts QMK `info.json` layout data from kicad pcb
# You need to have the `pcbnew` module importable (should be installed when kicad is installed)
import re, pcbnew, json
from typing import Callable
from functools import reduce
kicad7 = pcbnew.Version().startswith("7")
if kicad7:
import cadquery as cq
slt_dist = (11.85 + 10.35) / 2
boss_len = (11.85 - 10.35) / 2
boss_d = 0.86
def make_slot():
slt_h, slt_d, slt_g, slt_t = 1.2, boss_d, 0.65, boss_len
slt_w = 1.5 # guessed
return (cq.Workplane("XZ").sketch()
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 display = Adafruit_SSD1306(128, 32, &Wire);
void setup() {
Wire.setPins(13, 16);
Serial.begin(115200);
@crides
crides / unzstd.rs
Created June 16, 2022 09:28
Decompress zstd into frames
use std::fs::File;
use std::io::{self, Read, Write, BufReader, Seek};
use zstd::Decoder;
fn main() {
let src = std::env::args().skip(1).next().unwrap();
let mut input = Some(File::open(src).unwrap());
let mut buf = Vec::with_capacity(100000000);
let mut prev = None;
void mlir_aie_configure_cores(aie_libxaie_ctx_t* ctx) {
XAieTile_CoreControl(&(ctx->TileInst[25][3]), XAIE_DISABLE, XAIE_ENABLE);
// Reset configuration
// Program Memory
for (int i=0x20000; i<=0x23FFF; i+=4) XAieGbl_Write32((&(ctx->TileInst[25][3]))->TileAddr+i, 0);
// TileDMA
for (int i=0x1D000; i<=0x1D1F8; i+=4) XAieGbl_Write32((&(ctx->TileInst[25][3]))->TileAddr+i, 0);
for (int i=0x1DE00; i<=0x1DE00; i+=4) XAieGbl_Write32((&(ctx->TileInst[25][3]))->TileAddr+i, 0);
for (int i=0x1DE08; i<=0x1DE08; i+=4) XAieGbl_Write32((&(ctx->TileInst[25][3]))->TileAddr+i, 0);
for (int i=0x1DE10; i<=0x1DE10; i+=4) XAieGbl_Write32((&(ctx->TileInst[25][3]))->TileAddr+i, 0);
import cadquery as cq, math, numpy as np
t_r, b_r = 10, 15
back_r, back_ba, back_h, back_l1, back_l2, back_ta = 45, 60, 45, 40, 30, 20
inner_t = 25
side = (
cq.Workplane()
.transformed(offset=(0, -b_r, 0)).circle(b_r).transformed(offset=(0, b_r - t_r, back_h)).circle(t_r).loft())
bot_end = (back_r * math.sin(math.pi / 3), back_r * (math.cos(math.pi / 3) - 1))
#
# ZMK
#
#
# Basic Keyboard Setup
#
CONFIG_ZMK_KEYBOARD_NAME="Fissure"
CONFIG_USB_DEVICE_PRODUCT="Fissure"
import cadquery as cq
imp = lambda f: cq.importers.importDXF(f"fusion-{f}.dxf", tol=1e-3).wires()
res = (
imp("Edge_Cuts").toPending().extrude(-1.8)
.faces("<Z").fillet(1.5)
.cut(imp("User_Eco1").toPending().extrude(-1))
.cut(imp("User_Eco2").toPending().extrude(-1.2))
.cut(imp("User_3").toPending().extrude(-1.8))
@crides
crides / gruvbox
Created January 2, 2022 22:54
Bash script to output the color in Gruvbox theme. Uses sharkdp/pastel
#!/usr/bin/bash
usage() {
echo "gruvbox ( light | dark ) <COLOR>"
exit 1
}
color() {
case "$1" in
red) c="cc241d";;