Skip to content

Instantly share code, notes, and snippets.

View teohhanhui's full-sized avatar

Teoh Han Hui teohhanhui

View GitHub Profile
@teohhanhui
teohhanhui / passwordAuth.ts
Last active December 12, 2025 20:57
Port of https://docs.rs/password-auth/ using Web Crypto API + experimental Argon2 support: https://wicg.github.io/webcrypto-modern-algos/
import { Buffer } from 'node:buffer';
import { webcrypto as crypto } from 'node:crypto';
/**
* @see {@link https://datatracker.ietf.org/doc/html/rfc9106#section-3.1-2.2|RFC 9106}
*/
const SALT_LEN_BYTES: number = 16;
/**
* @see {@link https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html#argon2id|OWASP Password Storage Cheat Sheet}
@teohhanhui
teohhanhui / NOTES.md
Last active December 10, 2025 19:23
Fedora Asahi Remix setup notes

btrfs

Dynamic periodic reclaim

UUID=$(lsblk -dno UUID /dev/disk/by-label/fedora)
echo '1' | sudo tee -a /sys/fs/btrfs/$UUID/allocation/data/dynamic_reclaim
echo '1' | sudo tee -a /sys/fs/btrfs/$UUID/allocation/data/periodic_reclaim
sudo tee /etc/tmpfiles.d/btrfs.conf <<EOF
#Type Path Mode UID GID Age Content
This post links my 3Box profile to my Github account! Web3 social profiles by 3Box.
✅ did:3:bafyreib7kwhknhuo7ub422wgxrin52de6updss5x7ucc6qzt5k3lx4oo5a ✅
Create your profile today to start building social connection and trust online at https://3Box.io/
@teohhanhui
teohhanhui / OmnipayStripeGatewayConfigurationType.php
Last active June 26, 2019 14:10
Using Omnipay with Sylius (example using Stripe)
<?php
declare(strict_types=1);
namespace AppBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
@teohhanhui
teohhanhui / FilterManager.php
Created April 11, 2018 18:02
Fix SVG in LiipImagineBundle (use together with https://gist.github.com/teohhanhui/90bbc4a61888ad2e92a160d8459db300 to fix MIME type in Symfony)
<?php
declare(strict_types=1);
namespace AppBundle\Imagine\Filter;
use Liip\ImagineBundle\Binary\BinaryInterface;
use Liip\ImagineBundle\Imagine\Filter\FilterManager as BaseFilterManager;
use Liip\ImagineBundle\Model\Binary;
@teohhanhui
teohhanhui / AppKernel.php
Created April 11, 2018 17:55
Fix SVG mime type in Symfony
<?php
declare(strict_types=1);
use AppBundle\HttpFoundation\File\MimeType\ErrataMimeTypeGuesser;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser;
use Symfony\Component\HttpFoundation\File\MimeType\FileinfoMimeTypeGuesser;
use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser;
use Symfony\Component\HttpKernel\Kernel;

Keybase proof

I hereby claim:

  • I am teohhanhui on github.
  • I am teohhanhui (https://keybase.io/teohhanhui) on keybase.
  • I have a public key whose fingerprint is 400E 34DB 4EF8 84F6 DED1 5455 7297 83C9 6A30 C9B8

To claim this, I am signing this object: