Skip to content

Instantly share code, notes, and snippets.

View widlarizer's full-sized avatar
💭
Distracted

Emil J widlarizer

💭
Distracted
View GitHub Profile
@widlarizer
widlarizer / macc.md
Created April 10, 2024 22:19
big $macc with fries

Big $macc with fries

Oddities of the yosys $macc cell. To all "losses" in modifications, add in your head the necessity of creating a v2 cell with compatibility wrapping of some kind.

Factor length field has variable bit length

Length of the factor length fields, known as variable num_bits in docs and code, is recorded in the CONFIG parameter and capped at effectively 15. We can set it to const 16 for example, simplifying CONFIG parsing.

Gains: simplifies from_cell, to_cell, simlib.v,

@widlarizer
widlarizer / run.py
Last active March 8, 2024 14:34
Python r function: run commands even easier than in bash
import subprocess, functools
# Do you often use Python in place of bash?
# Do you want to simply just run thing and get output?
# Here's a wrapper function for automating whatever you'd like.
# Use shell=True and you can use pipes and env vars!
# Throw in a string! Throw in an arg list! Throw in a pathlib.Path maybe!
# Use it everywhere! 3 bazillion devices run r('foo')!
r = functools.partial(subprocess.check_output, text=True)
@widlarizer
widlarizer / atomic_operations.md
Last active March 7, 2024 11:01
Atomic language features comparison

Atomic language features comparison - a compiler developer's point of view

Languages explained

  • made up by Intel for the Itanium ABI
  • legacy
  • all sequentially consistent
  • operate on arbitrary integer-based types
@widlarizer
widlarizer / 2b.lisp
Created December 3, 2023 10:51
AoC 2023
(require 'asdf)
(require 'alexandria)
(require 'cl-ppcre)
(defparameter inp "467..114..
...*......
..35..633.
......#...
617*......
.....+.58.
..592.....
@widlarizer
widlarizer / 1b.lisp
Created December 1, 2023 17:57
AoC 23
(ql:quickload :cl-ppcre)
(ql:quickload "split-sequence")
(ql:quickload :alexandria)
; (load "inp.lisp")
(defvar inp "two1nine
eightwothree
abcone2threexyz
xtwone3four
@widlarizer
widlarizer / pandoc-svg.py
Last active January 5, 2023 13:14 — forked from jeromerobert/pandoc-svg.py
Pandoc filter to create PDF files from SVG
#! /usr/bin/env python
"""
Pandoc filter to convert svg files to pdf as suggested at:
https://github.com/jgm/pandoc/issues/265#issuecomment-27317316
"""
__author__ = "Jerome Robert, Emil J. Tywoniak"
import mimetypes
import subprocess