This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| services: | |
| kafka: | |
| image: apache/kafka:3.9.1 | |
| container_name: kafka | |
| restart: unless-stopped | |
| ports: | |
| - "9092:9092" | |
| environment: | |
| KAFKA_NODE_ID: 1 | |
| KAFKA_PROCESS_ROLES: broker,controller |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ref | |
| const inputRef = useRef<HTMLInputElement>(null); | |
| <InputDebounce | |
| ref={inputRef} | |
| onChange={handleSearch} | |
| placeholder="Tìm kiếm..." | |
| delay={300} | |
| /> | |
| // Controlled component |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var session_id = self.crypto.randomUUID(); | |
| var lsd = require("LSD").token; | |
| var dtsg = require("DTSGInitialData").token; | |
| var uid = require("CurrentUserInitialData").USER_ID; | |
| var params = { | |
| "q":"loose weight", | |
| "countries[0]":"US", | |
| "count":30, | |
| "session_id":session_id, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Telegram Bot API base URL | |
| const TELEGRAM_API_BASE = 'https://api.telegram.org'; | |
| async function handleRequest(request) { | |
| const url = new URL(request.url); | |
| // Reconstruct the Telegram API URL | |
| const telegramUrl = `${TELEGRAM_API_BASE}${url.pathname}${url.search}`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import speakeasy from 'speakeasy'; | |
| import qrcode from 'qrcode'; | |
| /* | |
| Steps: | |
| 1. Generate a secret | |
| 2. Show a QR code for the user to scan in | |
| 3. Authenticate the token for the first time | |
| */ | |
| const generateSecret = (name?: string, issuer?: string) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import qrcode, { type QRCodeToBufferOptions, type QRCodeToDataURLOptions } from 'qrcode'; | |
| import { z } from 'zod'; | |
| import { Jimp } from 'jimp'; | |
| type PointOfInitMethod = 'static' | 'dynamic'; | |
| type QrCodeLogoOptions = { | |
| src: string; | |
| text?: string; | |
| backgroundColor?: string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Example to refresh tokens using https://github.com/auth0/node-jsonwebtoken | |
| * It was requested to be introduced at as part of the jsonwebtoken library, | |
| * since we feel it does not add too much value but it will add code to mantain | |
| * we won't include it. | |
| * | |
| * I create this gist just to help those who want to auto-refresh JWTs. | |
| */ | |
| const jwt = require('jsonwebtoken'); |