Skip to content

Instantly share code, notes, and snippets.

@tluyben
tluyben / dump_server.js
Created August 5, 2025 12:46
little server to dump whatever is sent to it ; put in a dir, run node dump_server.js [port]
#!/usr/bin/env node
/**
* Test Dump Server
*
* Simple HTTP server that listens for POST requests and dumps the content to console.
* Useful for testing webhook functionality.
*
* Usage: node test_dump_server.js [port]
* Default port: 3000
@tluyben
tluyben / dev-indicator-remover.tsx
Created July 20, 2025 09:04
Remove the NextJS dev indicator
'use client';
import { useEffect } from 'react';
function removeNextJsDevIndicator(node: Node | ShadowRoot) {
if (!node) return;
// Try to remove the toast
const toast = (node as ShadowRoot | Document).querySelector?.('.nextjs-toast');
if (toast) {
@tluyben
tluyben / gist:1963331b906568cda67c4814b8ed8311
Created July 19, 2025 09:49
Get free models from OpenRouter as JSON
#!/usr/bin/env -S deno run --allow-net
/**
* Fetches all models from OpenRouter API and filters for free ones
* Run with: deno run --allow-net openrouter-free-models.js
*/
async function getFreeOpenRouterModels() {
try {
console.log('Fetching models from OpenRouter...');
@tluyben
tluyben / shmup-deepseek-v3.html
Created July 13, 2025 08:57
shmup deepseek v3
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Nemesis Shmup</title>
<style>
body {
margin: 0;
padding: 0;
background: #000;
@tluyben
tluyben / shump-sonnet-3-7.html
Created July 13, 2025 08:56
shmup sonnet 3.7
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Nemesis Horizontal Shmup</title>
<style>
* {
margin: 0;
padding: 0;
@tluyben
tluyben / tsx-import-validator.ts
Created April 13, 2025 13:40
Validate tsx files for imports you do or do not allow
import * as fs from "fs";
import * as path from "path";
import typescript from "typescript";
import { sync as globSync } from "glob";
interface LinterConfig {
allow: string[];
disallow: string[];
}
@tluyben
tluyben / getModels.js
Last active March 25, 2025 08:57
get openrouter models
const modelsData = Array.from(document.querySelectorAll('table.table-fixed tbody tr')).map(row => {
const modelLinkElement = row.querySelector('a.block.text-slate-11.underline');
const modelName = modelLinkElement ? modelLinkElement.textContent.trim() : '';
const modelHref = modelLinkElement ? modelLinkElement.getAttribute('href') : '';
const modelCode = row.querySelector('code.text-xs') ? row.querySelector('code.text-xs').textContent.trim() : '';
// Get price cells
const priceTds = row.querySelectorAll('td.text-center');
// Process prices: extract numeric value, convert to number * 100
function monitorAllNetworkTraffic(callback = null) {
// Store original methods
const originalFetch = window.fetch;
const originalXHROpen = XMLHttpRequest.prototype.open;
const originalXHRSend = XMLHttpRequest.prototype.send;
const originalXHRSetRequestHeader = XMLHttpRequest.prototype.setRequestHeader;
// Collection of all messages in order
const messageLog = [];
@tluyben
tluyben / convert-svg.js
Created February 9, 2025 14:01
Convert script for svg -> png
const sharp = require("sharp");
const fs = require("fs/promises");
const sizes = [16, 48, 128];
async function convertIcons() {
try {
await fs.mkdir("dist/assets", { recursive: true });
for (const size of sizes) {
@tluyben
tluyben / openroutercors.js
Created December 8, 2024 09:30
Open router cors test
// Paste this in your browser's console
async function testOpenRouter() {
const API_KEY = 'YOUR_API_KEY_HERE'; // Replace with your actual API key
try {
const response = await fetch('https://openrouter.ai/api/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json',