Skip to content

Instantly share code, notes, and snippets.

View tunnckoCore's full-sized avatar
🔒
Fighting for freedom, security and privacy 🔐

Charlike Mike Reagent tunnckoCore

🔒
Fighting for freedom, security and privacy 🔐
View GitHub Profile
@tunnckoCore
tunnckoCore / auth-data.ts
Created June 3, 2025 20:44 — forked from transitive-bullshit/auth-data.ts
Example of how to use Drizzle Postgres as a storage adaptor with OpenAuth
import { jsonb, pgTable, text, timestamp } from 'drizzle-orm/pg-core'
// Simple key-value store of JSON data for OpenAuth-related state.
export const authData = pgTable('auth_data', {
// Example ID keys:
// "oauth:refresh\u001fuser:f99d3004946f9abb\u001f2cae301e-3fdc-40c4-8cda-83b25a616d06"
// "signing:key\u001ff001a516-838d-4c88-aa9e-719d8fc9d5a3"
// "email\[email protected]\u001fpassword"
// "encryption:key\u001f14d3c324-f9c7-4867-81a9-b0b77b0db0be"
id: text().primaryKey(),
@tunnckoCore
tunnckoCore / index.js
Last active April 25, 2025 02:34
comrades to ranks
async function fetchAndProcessComrades() {
const url = 'https://rawcdn.githack.com/NoMoreLabs/Call-Data-Comrades/refs/heads/main/metadata/call-data-comrades.json';
try {
const response = await fetch(url);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
@tunnckoCore
tunnckoCore / orpc-router-to-mcp-tools.ts
Created March 29, 2025 17:05
converting oRPC routers to MCP tools - beginning, it's buggy.. can't figure out how to provide the procedure's inputSchema as mcp tool schema... should be `inputSchema.shape` but.. it errors
interface McpToolResult {
content: Array<{ type: string; text: string }>;
isError?: boolean;
}
interface OrpcProcedureMeta {
meta?: {
tool_name?: string;
};
@tunnckoCore
tunnckoCore / ethscriptions-openapi.json
Created March 29, 2025 08:07
Ethscriptions OpenAPI spec - json format
{
"openapi": "3.0.1",
"info": {
"title": "Ethscriptions API V2",
"version": "v2",
"description": "## Overview\n\nWelcome to the Ethscriptions Indexer API docs!\n\nThis API enables you to learn everything about the ethscriptions protocol. All instances of the open source [Ethscriptions Indexer](https://github.com/0xFacet/ethscriptions-indexer) expose this API.\n\nIf you don't want to run your own instance of the indexer you can use ours for free using the base URL `https://api.ethscriptions.com/v2`.\n\n## Community and Support\n \nJoin our community on [GitHub](https://github.com/0xFacet/ethscriptions-indexer) and [Discord](https://discord.gg/ethscriptions) to contribute, get support, and share your experiences with the Ethscriptions Indexer.\n\n"
},
"paths": {
"/ethscription_transfers": {
"get": {
@tunnckoCore
tunnckoCore / readme.md
Last active January 28, 2025 01:00
ESIP-12 transfer ethscriptions through facet contracts

ESIP-9 transfer ethscriptions through facet contracts

  1. Create a facet transaction to a global/main/single facet-deployed contract (could be factory for creating L2 nft contracts)
  2. In facet data pass the ethscription ids, similar to how we do ESIP-5
  3. Ethscriptions indexers detects transactions to this facet contract, easily by just inspecting transaction's input calldata hex

Somethig like that

@tunnckoCore
tunnckoCore / string-validator.ts
Created January 5, 2025 19:01
typescript string validation with proper both compile-time and runtime checking
// eventually
// import type { StandardSchemaV1 } from '@standard-schema/spec';
// import { SchemaError } from '@standard-schema/utils';
// Utility types for length checking
type Length<T extends string, Counter extends number[] = []> = T extends `${string}${infer Tail}`
? Length<Tail, [...Counter, 0]>
: Counter['length'];
type Compare<
@tunnckoCore
tunnckoCore / ebert.json
Created January 3, 2025 21:37
ebert ethscriptions lunar surface and back journey
{
"name": "Ebert's Moon Mission",
"description": "Ebert was converted into an electromagnetic wave. He was then muonically beamed to the moon at the speed of light and returned to Earth's surface moments later. And yes...this actually happened. The voyage was made possible through the use of two radio telescopes, and with help from ham radio operators from across the world.",
"total_supply": "4",
"logo_image_uri": "https://white-glad-hare-157.mypinata.cloud/ipfs/QmZRXyQr8MwwEvUHME9KBdtP46QsxemuLX95DX2brQxpho",
"banner_image_uri": "https://white-glad-hare-157.mypinata.cloud/ipfs/QmW3XJUvdq1hoawim5f8oddZsFdQNBK7Rv7MZHf7UMxFDA",
"background_color": "#2457CA",
"twitter_link": "https://x.com/whoisebert",
"website_link": "https://whoisebert.xyz/",
"telegram_link": "https://t.me/whoisebert",
@tunnckoCore
tunnckoCore / README.md
Last active January 4, 2025 04:23
Get collection items and metadata (attributes) from Ordex API

Usage

import { fetchCollectionMeta, getCollectionMetdata } = './index.ts';

const collection = await fetchCollectionMeta('mickey-mouse');
collection.items = await getCollectionMetdata('mickey-mouse', (acc, item) => acc.concat(item));

console.log('mickey-mouse', collection);
@tunnckoCore
tunnckoCore / index.js
Last active November 22, 2024 20:34
Ordex Bulk Withdrawal - Unescrow
import { http, createPublicClient, createWalletClient } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
import { mainnet } from 'viem/chains';
export const publicClient = createPublicClient({
chain: mainnet,
transport: http(),
});
const ethscriptionIds = [
@tunnckoCore
tunnckoCore / a_readme.md
Last active November 3, 2024 01:46
zod cli parser

example defineCommand

import { z } from 'zod';

import { defineCommand } from './src/define-command.ts';
import { defineOptionsRaw } from './src/define-options.ts';

export const lint = defineCommand({
  name: 'lint',