Skip to content

Instantly share code, notes, and snippets.

View phryneas's full-sized avatar
🫖
418 I'm a teapot.

Lenz Weber-Tronic phryneas

🫖
418 I'm a teapot.
View GitHub Profile
@phryneas
phryneas / SSH+PAM+google authentificator: publickey OR password+OTP
Last active February 25, 2023 06:31
SSH+PAM+google authentificator: publickey OR password+OTP
# at least in deb/untu
sudo apt-get install libpam-google-authenticator
# for each user
google-authenticator
@phryneas
phryneas / replay-hashes.json
Last active April 1, 2022 11:10
Replay.io on NixOS
{
"replay": {
"url": "https://static.replay.io/downloads/linux-gecko-20220331-59d0a686993f-ffd8d6280276.tar.bz2",
"sha256": "0pf1ihxkx8dr1hn8v84sb8pgyg4xwpvjlk6jlp5bkpzp5zhyskqy"
},
"recordreplay-lib": {
"url": "https://static.replay.io/downloads/linux-recordreplay-ffd8d6280276.tgz",
"sha256": "1sif40b7zk5mxibqpncdv00yxp7kh6jl37jq12ggm36nswwr9l7g"
}
}
@phryneas
phryneas / fromParens.js
Created September 14, 2021 19:57
cassidoo-fromParens
/**
This brute forces all possible () combinations by interpreting the binary
representation of an increasing number with 0 as ( and 1 as ).
Works fine for n<15. For bigger n, the amount of results will be too big for memory.
*/
function fromParens(n) {
let ret = [],
targetLen = n * 2, // target string length
max = Math.pow(2, targetLen), // maximum number to look at
current, // current number
@phryneas
phryneas / .gitignore
Last active April 25, 2021 10:53
tsserver
node_modules
{
"name": "foofoo",
"version": "1.0.0",
"main": "index.js",
"author": "Lenz Weber",
"license": "MIT",
"dependencies": {
"@types/node": "^14.14.41",
"typescript": "^4.2.4"
}

Do not create union types with Redux Action Types. It's most likely an antipattern.

So, there is a long-standing TypeScript & Redux pattern of creating a union RootAction type that contains all your application's action types. Sometimes, you would also create a lot of reducer-specific sub-unions. I think that this has always been a crutch - and given the options we have today, it's most likely an antipattern. So let's look at why it was used, where it was used and what you can use instead.

Why was it used? A look at typed Reducers.

Classically, these action union types were created to use the Discriminating Union pattern.

@phryneas
phryneas / home-manager-module.nix
Last active June 14, 2020 09:02
vscode-liveshare-home-manager-nixos
{pkgs, lib, config, ...}:
with lib;
let
liveshareGist = builtins.fetchTarball {
url = "https://gist.github.com/phryneas/698996d24748d3ce7f61ef818949a28e/archive/3dbf12cd282ebcb6cacf40d466e4a519d4ce1dfe.tar.gz";
sha256 = "0mas9rnr6hn7yiivjs5xvnprhrqwac47nqfxh3vgmm67v982v83l";
};
livesharePkg = pkgs.callPackage liveshareGist {};
cfg = config.services.vsliveshare;
pkg = livesharePkg.override { enableDiagnosticsWorkaround = cfg.enableDiagnosticsWorkaround; };
@phryneas
phryneas / index.md
Last active April 24, 2020 16:11
api-documenter test

Home

API Reference

Packages

Package Description
@phryneas
phryneas / Retag-RTK-Tutorials.sh
Created February 7, 2020 17:40
Retag RTK Tutorials
#!/usr/bin/env bash
#remove all git tags
git tag | xargs git tag -d
#re-apply all git tags with commit name => tag name
git log --pretty=%s---%H | sed -re 's/[^a-zA-Z0-9-]/_/g;s/---/ /' | xargs -n2 git tag
git tag --format="%(objectname) => %(refname)"
@phryneas
phryneas / default.nix
Created December 12, 2018 11:36 — forked from ottidmes/default.nix
VS Code Live Share extension
# Baseed on previous attempts of others: https://github.com/NixOS/nixpkgs/issues/41189
{ lib, vscode-utils, autoPatchelfHook, bash, file, makeWrapper, dotnet-sdk
, curl, gcc, icu, libkrb5, libsecret, libunwind, libX11, lttng-ust, openssl, utillinux, zlib
, enableDiagnosticsWorkaround ? false, gccStdenv
}:
with lib;
let
# https://docs.microsoft.com/en-us/visualstudio/liveshare/reference/linux#install-prerequisites-manually