Skip to content

Instantly share code, notes, and snippets.

View fzn0x's full-sized avatar
💻
Working from home

Fauzan fzn0x

💻
Working from home
View GitHub Profile
@fzn0x
fzn0x / readme.md
Created September 1, 2024 09:36
NIST standard for passwords

Apply NIST standard for passwords!

Screenshot 2024-09-01 163539

@fzn0x
fzn0x / afterSynchronousLoop.js
Created August 15, 2024 19:26
After Synchronous Loop inside the Event Loop
const afterSynchronousLoop =
queueMicrotask ||
setImmediate ||
(function () {
if (Promise) {
return function (fn) {
Promise.resolve().then(fn);
};
}
return function (fn) {
@fzn0x
fzn0x / QrCode.jsx
Created July 18, 2024 05:13
QrCode with Logo on Center
import { Box, Image } from "@chakra-ui/react";
import * as qrCode from "@zag-js/qr-code";
import { useMachine, normalizeProps } from "@zag-js/react";
import { useId } from "react";
// @ts-ignore-next-line
import YEYLogoChrome from "../../../assets/imgs/yey-logo-chrome-clear.png";
export default function QRCode() {
@fzn0x
fzn0x / bootloader.asm
Created July 12, 2024 23:29
Write my first OS - Hello World (part 1) - bootloader.asm
[ORG 0x7C00]
mov ah, 0x0E
mov al, 'H'
int 0x10
mov al, 'e'
int 0x10
mov al, 'l'
int 0x10
mov al, 'l'
@fzn0x
fzn0x / bitflip.js
Created July 12, 2024 19:41
Bit Flip - Bitnya ngeflip
function bitFlip(byte, bitPosition) {
// Membuat mask untuk bit flip
const mask = 1 << bitPosition;
return byte ^ mask;
}
function byteToBinaryString(byte) {
return byte.toString(2).padStart(8, "0");
}
wget https://gist.githubusercontent.com/ammarfaizi2/f55dbb7c918a660776c68c50319c7882/raw/1dd37e1fb96054b31f345381273e8a1702215002/ct.c;
gcc -O2 ct.c -o ct -lpthread;
./ct $(nproc);
2024-07-07-13-30-13_JyVhZy95.mp4
@fzn0x
fzn0x / app.module.ts
Created June 21, 2024 06:23
Generate Swagger from Nest Data Transfer Objects and Routes (@wait what?)
import { NestFactory } from '@nestjs/core';
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
import { AppModule } from './app.module.js';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
const config = new DocumentBuilder()
.setTitle('Minjem Buku Perpustakaan SMK TI Garuda Nusantara')
@fzn0x
fzn0x / hono_handler.ts
Created May 6, 2024 23:46
wip: dynamic handler types to enforce return value in Hono handlers
// Handler type when `next` is NOT provided and a response is expected
export type HandlerWithoutNext<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> =
(c: Context<E, P, I>) => R;
// Handler type when `next` is provided
export type HandlerWithNext<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> =
(c: Context<E, P, I>, next: Next) => void;
// Union type to combine both handler types
export type Handler<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = HandlerWithoutNext<E, P, I, R> | HandlerWithNext<E, P, I, R>;
@fzn0x
fzn0x / package.json
Created May 4, 2024 00:01
vitest-bun-hono
{
"name": "vitest-bun-hono",
"module": "index.ts",
"type": "module",
"devDependencies": {
"@types/bun": "latest"
},
"peerDependencies": {
"typescript": "^5.0.0"
},