Skip to content

Instantly share code, notes, and snippets.

View janispritzkau's full-sized avatar

Janis Pritzkau janispritzkau

  • Germany
  • 07:36 (UTC +01:00)
View GitHub Profile
@janispritzkau
janispritzkau / sungrow_sh10rt_modbus.yaml
Created August 9, 2022 09:48
Modbus Registers for Sungrow SH10RT Hybrid Inverter
input_registers:
- name: protocol_number
data_type: uint32
address: 4950
- name: protocol_version
data_type: uint32
address: 4952
- name: arm_software_version
data_type: string
address: 4954
@janispritzkau
janispritzkau / README.md
Last active February 19, 2026 19:58
(Remote) HTTP reader for yauzl-promise (ZIP)

Ideal for extracting a couple of files from a massive ZIP archive without downloading it.

Usage:

const url = "<URL to a zip archive>";
const reader = await RemoteReader.open(url);
const zip = await yauzl.fromReader(reader, reader.totalSize);

for await (const entry of zip) {
@janispritzkau
janispritzkau / README.md
Last active October 12, 2025 12:44
A Tailwind CSS theme inspired by Material 3 design tokens.
<div class="m-6 w-xl rounded-xl bg-surface/90 p-6 text-on-surface shadow-xl ring ring-outline-muted">
  <h1 class="text-xl font-bold">Example</h1>

  <p class="mt-2 mb-4 text-on-surface-muted">
    My go-to Tailwind theme, which I developed by copying and pasting it into every new project
    and gradually refining it.
  </p>

 <span class="inline-block rounded-md bg-red-container px-1 font-medium text-red-on-surface"></span>
@janispritzkau
janispritzkau / README.md
Last active October 12, 2025 12:19
`on-bg` utility for Tailwind CSS emulating Material 3 state layers.
<button class="
  rounded-lg border-outline-subtle bg-container state-button p-4 text-start
  hover:on-bg-on-surface/hover active:on-bg-on-surface/active
">
@janispritzkau
janispritzkau / vite-subset-icons-plugin.ts
Last active November 3, 2024 19:28
Material Symbols subset font plugin for Vite (reduces bundle size from megabytes to kilobytes)
import { readFile } from "node:fs/promises";
import { relative } from "node:path";
import { Minimatch } from "minimatch";
import subsetFont from "subset-font";
import { Plugin } from "vite";
export interface SubsetOptions {
codepointsPath: string;
iconsGlob: string;
@janispritzkau
janispritzkau / tailwind.config.ts
Created November 26, 2023 11:20
Tailwind Material Symbols Background Image SVG Plugin
import { Config } from "tailwindcss";
import plugin from "tailwindcss/plugin";
import { readFileSync, readdirSync } from "fs";
import { dirname, join } from "path";
export default {
// ...
plugins: [
plugin(({ addBase, theme }) => {
const colors = flattenColorPalette(theme("colors"));
@janispritzkau
janispritzkau / tailwind.config.js
Created November 23, 2023 18:04
Tailwind Config with Desaturated Grays using OKLCH
import { formatHex, oklch } from "culori";
import type { Config } from "tailwindcss";
import { gray } from "tailwindcss/colors";
export default {
content: ["index.html", "./src/**/*.{ts,tsx,vue}"],
theme: {
extend: {
colors: {
gray: Object.fromEntries(
@janispritzkau
janispritzkau / webgl-example.js
Last active June 15, 2023 08:35
Simple WebGL example with basic error handling
const canvas = document.querySelector("canvas")
canvas.width = 800, canvas.height = 600
canvas.style.width = `${canvas.width / devicePixelRatio}px`
const gl = canvas.getContext("webgl")
const vertexShader = gl.createShader(gl.VERTEX_SHADER)
const fragmentShader = gl.createShader(gl.FRAGMENT_SHADER)
gl.shaderSource(vertexShader, `
@janispritzkau
janispritzkau / git_merge_unrelated_histories.md
Last active June 15, 2023 08:34
Merge unrelated histories in Git
  1. git checkout <original_branch>
  2. git merge <new_branch> --allow-unrelated-histories
  3. git checkout next . --force --no-overlay
  4. git commit --no-edit
@janispritzkau
janispritzkau / auth.ts
Last active June 9, 2023 14:38
Minecraft Microsoft/Mojang Account Authentication (JavaScript)
export const MSAL_OAUTH_URL =
"https://login.microsoftonline.com/consumers/oauth2/v2.0";
export const MSAL_OAUTH_DEVICE_AUTHORIZATION_ENDPOINT =
`${MSAL_OAUTH_URL}/devicecode`;
export const MSAL_OAUTH_TOKEN_ENDPOINT = `${MSAL_OAUTH_URL}/token`;
export const XBOX_AUTH_ENDPOINT =
"https://user.auth.xboxlive.com/user/authenticate";