Skip to content

Instantly share code, notes, and snippets.

@tanaikech
tanaikech / submit.md
Created January 31, 2024 01:55
Semantic Search using Corpus of Gemini API with Google Apps Script

Semantic Search using Corpus of Gemini API with Google Apps Script

Description

In the current stage, v1beta of Gemini API can use the corpora. Ref When the corpora are used, the values can be searched with the semantic search. In the current stage, 5 corpora can be created in a single project. And, each corpus can have 10,000 documents and 1,000,000 chunks. In this report, I would like to introduce a method for achieving the semantic search using the corpora with Google Apps Script.

Usage

@OrionReed
OrionReed / DOM3D.js
Last active March 28, 2024 12:34
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@matthewsuan
matthewsuan / axios.js
Last active March 28, 2024 12:36
Axios request queue-like that limits number of requests at any given time
import axios from 'axios'
const MAX_REQUESTS_COUNT = 5
const INTERVAL_MS = 10
let PENDING_REQUESTS = 0
// create new axios instance
const api = axios.create({})
/**
@0x1306a94
0x1306a94 / swift_macro_not_use_spm.md
Last active March 28, 2024 12:35
Swift Macro does not use SPM integration

Swift Macro 不使用 Swift Package Manager如何集成

  • Swift Macro分为两部分,一部分为宏的具体实现(编译器插件),一部分为Macro Lib用于导出宏定义以及所需要的附属代码,这里说的不使用SPM指的是编译器插件这部分
  • 仔细观察Xcode使用SPM集成Macro时,在编译命令中通过-load-plugin-executable参数指定了对应宏实现的插件可执行文件路径
  • 同时在swift源码中也找到了相关参数TypeCheckMacros.cpp TypeCheckMacros.cpp
  • swift源码中可得知,宏实现插件即可以是动态库(dylib)也可以是可执行文件
  • 系统内置的宏实现是通过 -plugin-path <dylib path> 加载
  • 内置的宏实现动态库在Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/Lib/swift/host/plugins
具体步骤
  • 编写宏实现代码,这一步可以通过SPM也可以直接通过Xcode创建命令行程序项目,完成宏实现代码编写
@mrflip
mrflip / BasicInstructions.md
Last active March 28, 2024 12:34
Running debezium and kafka connect locally with homebrew

Running Debezium / Kafka Connect locally with homebrew

Initial setup

  • Install all the things: brew install kafka zookeeper maven openjdk
  • Make a directory for plugins: mkdir -p /usr/local/share/kafka/plugins
  • Edit the file /usr/local/etc/kafka/connect-standalone.properties and uncomment the line setting up a plugin path: plugin.path=/usr/local/share/java,/usr/local/share/kafka/plugins,/opt/connectors
  • Start all the things: brew services start zookeeper and brew services start kafka
@d7samurai
d7samurai / .readme.md
Last active March 28, 2024 12:34
Minimal D3D11

Minimal D3D11

Minimal D3D11 reference implementation: An uncluttered Direct3D 11 setup + basic rendering primer and API familiarizer. Complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion that should be easy to follow from the code alone. ~200 LOC. No modern C++, OOP or (other) obscuring cruft. View on YouTube

hollowcube

Also check out Minimal D3D11 pt2, reconfigured for instanced rendering and with a smaller, tighter, simplified overall code structure, or Minimal D3D11 pt3, with shadowmapping + showcasing a range of alternative setup and rendering techniques.