Skip to content

Instantly share code, notes, and snippets.

@jed
jed / jsx-runtime.js
Created September 23, 2024 01:06
minimum viable JSX-to-DOM implementation
export let Fragment = () => document.createDocumentFragment();
export let jsx = (node, { children = [], ...props }) =>
jsxs(node, { ...props, children });
export let jsxs = (node, { children, ...props }) => {
node =
typeof node === "function" ? node(props) : document.createElement(node);
for (let name in props) {
@Asano-Naoki
Asano-Naoki / appsscript.json
Last active February 9, 2025 15:53
document ai ocr
{
"timeZone": "Asia/Tokyo",
"dependencies": {
},
"exceptionLogging": "STACKDRIVER",
"runtimeVersion": "V8"
}
@tanaikech
tanaikech / submit.md
Last active April 26, 2025 05:48
Gemini-Powered Dynamic Pseudo-RAG for Efficient Script Generation

Gemini-Powered Dynamic Pseudo-RAG for Efficient Script Generation

Abstract

This report presents a method to optimize AI-generated scripts for processing costs using Gemini and Google Apps Script. By incorporating external knowledge from sources like StackOverflow, we demonstrate the effective generation of efficient scripts that minimize overhead while maintaining desired outcomes. This approach can be considered a dynamic pseudo-RAG technique.

Introduction

The proliferation of generative AI, exemplified by Google Gemini, has led to a surge in AI-generated scripts. This trend is evident in the growing number of questions on platforms like StackOverflow that involve AI-generated scripts. While this indicates a significant improvement in AI performance, it's crucial to note that AI-generated scripts may not always be optimized for processing costs, especially when the prompt fails to provide sufficient context.

@zellyn
zellyn / crdts-category-theory.md
Created September 3, 2024 20:53
Discussion with Claude about CRDTs and category theory

💬 Is a CvRDT basically a semigro...

human (Sep 3, 2024, 01:35 PM)

Is a CvRDT basically a semigroup?

assistant (Sep 3, 2024, 01:35 PM)

That's an insightful question that touches on the intersection of distributed systems and abstract algebra. Let's break this down:

@zellyn
zellyn / linear-types-claude-chat.md
Last active February 21, 2025 14:04
Chat with Claude about Linear Types

Understanding Linear Types: A Conceptual Explanation

human (Sep 3, 2024, 04:36 PM)

Can you ELI5 Linear Types? I'm particularly interested in:

  • a brief overview, detailed enough that I can "grok" them
  • examples of languages that have successfully implemented them and gained some real-world usage (if any)
  • how they might be incorporated into an otherwise simple language like Go or Hare

My current difficulty level is that I have a good conceptual overview-level understanding of Rust lifetimes, but haven't used them in anger. I deeply get the need, though: a C++ function that doesn't have a comment specifying what happens to ownership of the arguments is terrifying 🙂

@zellyn
zellyn / conversation.md
Created August 26, 2024 19:58
Conversation with Claude about terminating processes in the terminal. Converted to markdown using Simon Willison's excellent tool: https://observablehq.com/@simonw/convert-claude-json-to-markdown

Terminating Processes in the Terminal: Ctrl-C vs Ctrl-\

human (Aug 26, 2024, 03:54 PM)

When in my terminal, I've noticed that ctrl-\ seems to often work when ctrl-c won't. I used to use ctrl-z and then kill %+, but ctrl-\ appears to work in the same places that ctrl-z does. Can you explain to me what's going on? Why do they differ in when they work, and what signals are actually getting sent?

assistant (Aug 26, 2024, 03:54 PM)

You've made an astute observation about different ways to terminate processes in a Unix-like terminal. Let's break down what's happening with each of these commands and signals:

@tanaikech
tanaikech / submit.md
Last active April 26, 2025 05:42
A Versatile Approach to Uploading Files with Node.js: Integrating Gemini, Drive, YouTube, and Other APIs

A Versatile Approach to Uploading Files with Node.js: Integrating Gemini, Drive, YouTube, and Other APIs

Abstract

A script using resumable upload with file streams is proposed to enhance file handling within the Gemini Generative AI API for Node.js. This script allows uploading from web URLs and local storage, efficiently handles large files, and offers potential reusability with other Google APIs.

Description

The @google/generative-ai library provides a powerful way to interact with the Gemini Generative AI API using Node.js. This enables developers to programmatically generate creative text formats, translate languages, write different kinds of creative content, and answer your questions in an informative way, all powered by Gemini's advanced AI models. Ref

@tanaikech
tanaikech / submit.md
Created August 23, 2024 02:36
Expanding Gemini API's Capabilities: A Practical Solution for Web Content Summarization

Expanding Gemini API's Capabilities: A Practical Solution for Web Content Summarization

Abstract

This study proposes a workaround to address the Gemini API's current inability to directly process web content from URLs. By utilizing Google Apps Script, the method extracts relevant information from a specified URL and feeds it into the API for summarization. This approach offers a solution for generating comprehensive summaries from web-based content until the API's limitations are resolved.

Introduction

While Gemini API offers powerful text generation capabilities, it currently faces limitations in directly accessing and processing web content from URLs. When prompted to summarize an article at a specific URL like Summarize the article at the following URL. https://###, the API often returns an error message indicating its inability to retrieve the necessary information. This limitation arises from the API's current design, which may not be equipped to handle web requests and parse HTML content.

@tanaikech
tanaikech / submit.md
Created August 18, 2024 06:09
Leveraging GCP for Seamless Google Apps Script Log Export and Analysis with Gemini API

Leveraging GCP for Seamless Google Apps Script Log Export and Analysis with Gemini API

Abstract

Linking a Google Apps Script project to a GCP project enables you to export logs from the Class console to Logs Explorer for simplified analysis and debugging. By overcoming the limitations of in-script logging methods, this report outlines a method for exporting logs using the Cloud Logging API with Google Apps Script.

Introduction

While developing applications with Google Apps Script, the Class console is a valuable tool for debugging individual components. Ref However, a key limitation exists: by default, Google Apps Script projects on Google Drive are not linked to Google Cloud Platform (GCP) projects. In this unlinked scenario, logs from the Class console are only visible within the script editor, requiring manual copying for export.

Linking a Google Apps Script project to a GCP project unlocks the power of Logs Explorer. [Ref](https

@tanaikech
tanaikech / submit.md
Last active January 5, 2025 05:22
Uploading Multiple Files with Split Asynchronous Processes and Resumable Upload in Google Spreadsheets

Uploading Multiple Files with Split Asynchronous Processes and Resumable Upload in Google Spreadsheets

Overview

This sample script demonstrates uploading multiple files using split asynchronous processes with resumable upload. It leverages JavaScript and HTML within Google Spreadsheets.

Description

In my previous report, "Resumable Upload of Multiple Files with Asynchronous Process for Google Drive", I presented an approach for uploading files asynchronously.