Skip to content

Instantly share code, notes, and snippets.

View janispritzkau's full-sized avatar

Janis Pritzkau janispritzkau

View GitHub Profile
@janispritzkau
janispritzkau / rsa.ts
Last active November 14, 2022 17:50
Deno RSA encryption and signing with PKCS1 padding in TypeScript
import * as base64url from "https://deno.land/std@0.164.0/encoding/base64url.ts";
export interface RsaPrivateKey {
n: bigint;
e: bigint;
d: bigint;
p: bigint;
q: bigint;
dp: bigint;
dq: bigint;
abstract class Property<T = unknown> {
#values: readonly T[];
constructor(public name: string, values: readonly T[]) {
this.#values = Object.freeze(values);
}
get possibleValues(): readonly T[] {
return this.#values;
}
@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 / 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 / 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"));