Skip to content

Instantly share code, notes, and snippets.

View aleclarson's full-sized avatar

Alec Larson aleclarson

View GitHub Profile
@aleclarson
aleclarson / theme.jsonc
Last active June 4, 2024 23:37
Beginner Pro theme for VSCode
{
"name": "Beginner Pro",
"type": "light",
"colors": {
// base color
"focusBorder": "#f2f4f700",
"foreground": "#000000",
"editor.background": "#f2f4f7",
"editor.foreground": "#000000",
"scrollbar.shadow": "#f2f4f7",
@aleclarson
aleclarson / x.shift-block.userscript.js
Created April 17, 2024 22:00
Shift+Click to Block – X.com
// ==UserScript==
// @name X.com ~ Shift+Click to Block
// @namespace http://tampermonkey.net/
// @version 2024-04-10
// @description Block the tweet under the cursor using the Shift key and click.
// @author Alec Larson
// @match https://twitter.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com
// @grant none
// ==/UserScript==
// ==UserScript==
// @name X.com ~ Shift+Click to Mute
// @namespace http://tampermonkey.net/
// @version 2024-04-10
// @description Mute the tweet under the cursor using the Shift key and click.
// @author Alec Larson
// @match https://twitter.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com
// @grant none
// ==/UserScript==
@aleclarson
aleclarson / verbose.log
Created April 10, 2024 03:55
astro + starlight: no loader for jsonc files
> www@0.0.1 astro ~/docs/www
> astro "dev" "--verbose"
2024-04-10T03:53:28.361Z astro:cli --verbose flag enabled! Enabling: DEBUG="astro:*,vite:*"
2024-04-10T03:53:28.361Z astro:cli Tip: Set the DEBUG env variable directly for more control. Example: "DEBUG=astro:*,vite:* astro build".
2024-04-10T03:53:28.820Z astro:telemetry [notify] last notified on 1712698445704
2024-04-10T03:53:29.395Z astro:Failed to load config with Node TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for ~/docs/www/node_modules/.pnpm/@astrojs+starlight@0.21.5_astro@4.5.17/node_modules/@astrojs/starlight/index.ts
at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:160:9)
at defaultGetFormat (node:internal/modules/esm/get_format:203:36)
// ==UserScript==
// @name Google AI Studio: Zen Mode
// @namespace http://tampermonkey.net/
// @version 0.3
// @description Expand the chat to fill the screen.
// @author Alec Larson
// @match https://aistudio.google.com/app/prompts/*
// @grant GM_addStyle
// ==/UserScript==
// ==UserScript==
// @name Gemini Finished Notification
// @namespace http://tampermonkey.net/
// @version 0.3
// @description Notify when Gemini is done loading a model response
// @author Claude 3
// @match https://aistudio.google.com/app/prompts/*
// @grant GM_notification
// @grant GM_getTab
// @grant GM_openInTab
@aleclarson
aleclarson / google-ai-studio-finished.userscript.js
Created April 7, 2024 20:16
Google AI Studio: Finished notification – Tampermonkey Userscript
// ==UserScript==
// @name Gemini Finished Notification
// @namespace http://tampermonkey.net/
// @version 0.3
// @description Notify when Gemini is done loading a model response
// @author Claude 3
// @match https://aistudio.google.com/app/prompts/*
// @grant GM_notification
// @grant GM_getTab
// @grant GM_openInTab
/**
* Taken from https://github.com/scrollback/juri
*
* Use of other URL-safe characters
*
* . Dot in strings
* _ Spaces in strings
*
* - Value: Start of negative number
* In numbers, negative exponent
@aleclarson
aleclarson / ky.d.ts
Created March 5, 2024 07:09
ky – TypeScript typings (bundled)
// Generated by dts-bundle-generator v9.3.1
export type Primitive = null | undefined | string | number | boolean | symbol | bigint;
export type LiteralUnion<LiteralType extends BaseType, BaseType extends Primitive> = LiteralType | (BaseType & {
_?: never;
});
export type BeforeRequestHook = (request: Request, options: NormalizedOptions) => Request | Response | void | Promise<Request | Response | void>;
export type BeforeRetryState = {
request: Request;
options: NormalizedOptions;
@aleclarson
aleclarson / index.mts
Created March 3, 2024 19:06
On-demand self-signed certificate
import * as fs from 'fs'
import * as path from 'path'
/**
* Read a locally cached certificate or generate a new one and save it.
*
* Generally, you want the `cacheDir` to be ignored by git.
*/
export async function getCertificate(cacheDir: string) {
const cachePath = path.join(cacheDir, '_cert.pem')