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 / ratherlie.txt
Created April 2, 2025 06:24
I rather lie than to lose you girl
.-. .----. -. / .... ... --.. .. .-. -- - / .-- --.. -- --.. / .--. --.. - ...- --. / -- .-.. -.. -.-.-- / --- ...- --. .----. .... / -..- --- --.. .-. -. / .-. --. / -.-- ...- ..- .-.. .. ...- / .-. --. .----. .... / - .-.. -- ...- / # # # / ... --. --. -.- .... ---... -..-. -..-. --- .-. -- .--. .-.-.- .-- --.. -- --.. .-.-.- .-. .-- -..-. .-- --.. -- --.. .--. --.. - ...- --. ..--.. -..- -...- .... -.- --.. --... -..- ... --.- -.. ....- .-... .. -...- .-. --- .... -... -.- --.- .-... .-.. .. .-- ...- .. .-. .-- -...- ..--- ----- ..--- ..... ----- ....- ----- ..--- .---- ----- .---- ..--- .---- ....- ...-- ----. ----. .---- .---- ..... ----- .---- ----- ...-- ----- ----- .---- -.... -.... ...-- ..... .---- --... .---- ..... ---.. .---- ...-- ...-- ...-- ...--
.-. .----. -. / .... ... --.. .. .-. -- - / .-- --.. -- --.. / .--. --.. - ...- --. / -- .-.. -.. -.-.-- / --- ...- --. .----. .... / -..- --- --.. .-. -. / .-. --. / -.-- ...- ..- .-.. .. ...- / .-. --. .----. .... / - .-.. -- ...- / # # # / ... --.
jkrel://tqpb.bpgi.qf/uyctsiivr?r=lmmcdup3p&z=qnJWEc&wzfvpXw=20250326101214951815010300166351714606009
How RAG Works:
RAG consists of two main components:
Retriever:
The retriever is responsible for fetching relevant documents or passages from a knowledge base (e.g., Wikipedia, a database, or a custom corpus).
It does not fetch from the generative model itself. Instead, it uses a separate mechanism (e.g., dense retrieval like DPR or sparse retrieval like BM25) to search through a large collection of documents.
Generator:
@fzn0x
fzn0x / index.js
Created October 9, 2024 04:26
Example code for Generating images with hugging face stabilityai/stable-diffusion-2
import { HfInference } from "@huggingface/inference";
import fs from "fs";
const inference = new HfInference("HF_TOKEN");
async function saveBlobToFile(blob, filePath) {
// Convert the blob to a buffer
const arrayBuffer = await blob.arrayBuffer();
// Write the buffer to a file
@fzn0x
fzn0x / vite.js
Created September 23, 2024 16:11
Creating server proxy to localhost with vite
server: {
proxy: {
"/image": {
target: "https://_.s3.ap-southeast-1.amazonaws.com",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/image/, ""),
},
},
},
@fzn0x
fzn0x / script.js
Created September 23, 2024 16:04
Fix issue with tainted canvas with huge data
// Fix issue for huge base64 image
const compressImageFromUrl = (url, quality = 0.7) => {
const img = new Image();
img.crossOrigin = "anonymous";
img.src = "/image/" + (url || "").split("/").pop();
img.onload = () => {
const canvas = document.createElement("canvas");
const ctx = canvas.getContext("2d");
@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() {