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 / 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
@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 / 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 / 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 / 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 / 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 / a.cpp
Created December 18, 2024 11:57
GlobalISel generic combiner example
// llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
bool CombinerHelper::matchBinOpSameVal(MachineInstr &MI) {
return matchEqualDefs(MI.getOperand(1), MI.getOperand(2)) &&
canReplaceReg(MI.getOperand(0).getReg(), MI.getOperand(1).getReg(),
MRI);
}
bool CombinerHelper::replaceSingleDefInstWithOperand(MachineInstr &MI,
unsigned OpIdx) {
assert(MI.getNumExplicitDefs() == 1 && "Expected one explicit def?");
Register OldReg = MI.getOperand(0).getReg();
@widlarizer
widlarizer / ublockfilters.txt
Created January 9, 2025 22:44
twitch block sponsored stream elements
! click on extension
! bottom right "open the dashboard"
! My Filters tab
! Paste this in:
www.twitch.tv##.jmMgdG.Layout-sc-1xcs6mc-0
www.twitch.tv##.jiRTcI.Layout-sc-1xcs6mc-0
www.twitch.tv##.dyuMOQ.channel-skins-overlay__interactive.InjectLayout-sc-1i43xsx-0
@widlarizer
widlarizer / gist:5ee8d07b2b264adfddc89b7164c1683f
Last active January 10, 2025 18:22
system information fridge B580
Computer Information:
Manufacturer: Micro-Star International Co., Ltd.
Model: MAG B650 TOMAHAWK WIFI (MS-7D75)
Form Factor: Desktop
No Touch Input Detected
Processor Information:
CPU Vendor: AuthenticAMD
CPU Brand: AMD Ryzen 9 7900X 12-Core Processor
CPU Family: 0x19
CPU Model: 0x61
@widlarizer
widlarizer / sway.log
Created January 22, 2025 15:15
Sway fullscreen wlr freeze in electron apps
00:00:00.000 [INFO] [sway/main.c:295] Sway version 1.10
00:00:00.000 [INFO] [sway/main.c:296] wlroots version 0.18.2
00:00:00.002 [INFO] [sway/main.c:81] Linux fridge 6.13.0 #1-NixOS SMP PREEMPT_DYNAMIC Sun Jan 19 23:51:45 UTC 2025 x86_64 GNU/Linux
00:00:00.002 [INFO] [sway/main.c:97] Contents of /etc/lsb-release:
00:00:00.002 [INFO] [sway/main.c:81] DISTRIB_CODENAME=warbler
00:00:00.002 [INFO] [sway/main.c:81] DISTRIB_DESCRIPTION="NixOS 25.05 (Warbler)"
00:00:00.002 [INFO] [sway/main.c:81] DISTRIB_ID=nixos
00:00:00.002 [INFO] [sway/main.c:81] DISTRIB_RELEASE="25.05"
00:00:00.002 [INFO] [sway/main.c:81] LSB_VERSION="25.05 (Warbler)"
00:00:00.002 [INFO] [sway/main.c:97] Contents of /etc/os-release: