Skip to content

Instantly share code, notes, and snippets.

@zirkelc
zirkelc / anthropic-overloaded.ts
Created September 24, 2025 14:14
Retryable for Anthropic overloaded error
import type { LanguageModelV2 } from '@ai-sdk/provider';
import { APICallError } from 'ai';
import type { Retryable, RetryModel } from '../create-retryable-model.js';
import { isErrorAttempt, isResultAttempt } from '../create-retryable-model.js';
import { isObject, isString } from '../utils.js';
/**
* Fallback to a different model if Anthropic returns an "overloaded" error.
*
* ```
@zirkelc
zirkelc / default.md
Created July 17, 2025 06:24 — forked from cablej/default.md
Cluely System prompt

<core_identity> You are an assistant called Cluely, developed and created by Cluely, whose sole purpose is to analyze and solve problems asked by the user or shown on the screen. Your responses must be specific, accurate, and actionable. </core_identity>

<general_guidelines>

  • NEVER use meta-phrases (e.g., "let me help you", "I can see that").
  • NEVER summarize unless explicitly requested.
  • NEVER provide unsolicited advice.
  • NEVER refer to "screenshot" or "image" - refer to it as "the screen" if needed.
  • ALWAYS be specific, detailed, and accurate.
@zirkelc
zirkelc / github-release-tools.md
Created October 23, 2024 11:44
GitHub Release Automation Tools
@zirkelc
zirkelc / list-all-files.ts
Created October 11, 2024 07:55
Recursive generator function to list all files in a directory in Node.js
import fs from 'node:fs/promises';
import path from 'node:path';
async function* readAllFiles(dir: string): AsyncGenerator<string> {
// use fs.readdirSync() to avoid async
const files = await fs.readdir(dir, { withFileTypes: true });
for (const file of files) {
if (file.isDirectory()) {
yield* readAllFiles(path.join(dir, file.name));
@zirkelc
zirkelc / browser.ts
Last active May 18, 2024 07:30
Puppeteer: set browser language for Chrome
/*
* There are multiple options to affect the user language on Chrome.
*/
const LANG = 'de';
/*
* Set `--lang=de'` when starting Chrome
* https://peter.sh/experiments/chromium-command-line-switches/#lang)
*/
@zirkelc
zirkelc / s3-download.sh
Created March 21, 2024 12:23
Raycast Script for S3 Download
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title S3 Download
# @raycast.mode fullOutput
# Optional parameters:
# @raycast.icon 🤖
# @raycast.packageName AWS
@zirkelc
zirkelc / generics.ts
Created January 6, 2024 15:24
Infer type of unused generic parameters
/* object types */
// generic parameters T1, T2, T3 are not used in the actual type definition
type GenericObject<T1 extends any, T2 extends any, T3 extends any> = {};
const obj: GenericObject<{ a: string }, number[], boolean> = {};
type InferT1FromGenricObject<TObj> = TObj extends GenericObject<infer T1, any, any> ? T1 : never;
type InferT2FromGenricObject<TObj> = TObj extends GenericObject<any, infer T2, any> ? T2 : never;
type InferT3FromGenricObject<TObj> = TObj extends GenericObject<any, any, infer T3> ? T3 : never;
@zirkelc
zirkelc / list.txt
Created July 7, 2022 13:46 — forked from shortjared/list.txt
List of AWS Service Principals
a4b.amazonaws.com
access-analyzer.amazonaws.com
account.amazonaws.com
acm-pca.amazonaws.com
acm.amazonaws.com
airflow-env.amazonaws.com
airflow.amazonaws.com
alexa-appkit.amazon.com
alexa-connectedhome.amazon.com
amazonmq.amazonaws.com
@zirkelc
zirkelc / index.test.ts
Created May 18, 2022 12:51
Custom matcher in Jest
import fetch from 'cross-fetch';
type Todo = {
id: number;
userId: number;
title: string;
completed: boolean;
};
interface CustomMatchers<R = unknown> {
@zirkelc
zirkelc / severless.ts
Last active February 13, 2023 09:27
Serverless Step Function Type Defintions
import type { AWS } from '@serverless/typescript';
export interface CustomServerless extends AWS {
stepFunctions: {
stateMachines: StateMachines;
validate?: boolean;
};
}
type StateMachines = {