Skip to content

Instantly share code, notes, and snippets.

@TimKochDev
TimKochDev / dell-xps-9560-fan-control-fix.md
Created March 14, 2025 22:03
Fix fan issues on Dell XPS 9560 running Linux

System Specifications

  • Device: Dell XPS 9560 (2017)
  • BIOS: 1.31.0
  • Distribution: Ubuntu Server 24.04.2 LTS
  • Kernel: 6.8.0-55-generic
  • Usage: As home server. 24/7 for three months until now

Problem Definition

Fans didn't switch off completely anymore even when temperatur was below 30°C.

@TimKochDev
TimKochDev / react-authentication-with-keycloak.ts
Created December 6, 2024 10:48
React authentication with Keycloak and oidc-client-ts. Redirect directly to Keycloak's registration page
// Note:
// - @react-keycloak/web is deprecated
// - Keycloak doesn't want to support their official JS adapter keycloak-js (https://www.keycloak.org/2022/02/adapter-deprecation.html)
// oidcConfig.ts
import {
UserManager,
WebStorageStateStore,
Log,
UserManagerSettings,
@TimKochDev
TimKochDev / migrate-users-with-password-hashes-to-keycloak.js
Created October 4, 2024 16:49
Import users with password hashes to Keycloak. Watch your encodings.
// Before moving to Keycloak, I used the following code to generate user credentials
const crypto = require("crypto");
const salt = crypto.randomBytes(16).toString("hex");
const hash = crypto
.pbkdf2Sync(password, this.salt, 10000, 64, "sha512")
.toString("hex");
// HEADS UP: Even though the salt was created as random bytes and then converted to its hex representation,
// the hashing function interpreted it as UTF-8. So this yields the same hash as the following:
const sameHash = crypto
@TimKochDev
TimKochDev / register-fonts.ts
Last active May 9, 2024 19:35
PDF visual regression testing using Playwright (e.g. react-pdf)
// Just to show what I had to deal with. Do NOT copy. React-pdf encourages you to import font from CDN directly.
import LatoBold from "../../../assets/fonts/Lato-Bold.ttf";
import LatoLight from "../../../assets/fonts/Lato-Light.ttf";
import Lato from "../../../assets/fonts/Lato-Regular.ttf";
import openSansFont from "../../../assets/fonts/OpenSans-Light.ttf";
export const PDF_BOLD_FONT_NAME = "Lato Bold";
export const PDF_LIGHT_FONT_NAME = "Lato Light";