Skip to content

Instantly share code, notes, and snippets.

View mkanenobu's full-sized avatar

Kanenobu Mitsuru mkanenobu

View GitHub Profile
# Enable VoiceOver Apple Script
do shell script "/System/Library/CoreServices/VoiceOver.app/Contents/MacOS/VoiceOverStarter"

手順

  1. File Watchersプラグインを入れる
  2. File WatchersにBiomeの設定を追加
  3. Actions on SaveでBiomeのFile Wathcers設定を有効化
  4. Actions on SaveのActivated on設定をAny saveに変更
  • 元の設定だと保存時ではなく変更時に走る

File WatcherのBiome設定

import type { ZodObject, ZodRawShape } from "zod";
import { zodToJsonSchema } from "zod-to-json-schema";
/**
* zod と zod-to-json-schema を使って型安全に completion 結果を得るコード
*/
export const createChatCompletionWithFunction = async <T extends ZodRawShape>(
messages: ChatCompletionRequestMessage[],
functionName: string,
schema: ZodObject<T>
export const datetimeWithTZ = <T extends ColumnBaseConfig>(
column: MySqlDateTimeString<T>
) =>
sql`DATE_FORMAT(${column}, '%Y-%m-%dT%TZ')`.mapWith((v) => new Date(v));
// example
// await db.select({ createdAt: datetimeWithTz(table.createdAt) }).from(table);
@mkanenobu
mkanenobu / get-meet-chat-bookmarklet.js
Last active January 24, 2022 22:01
Log google meet chat text.
var attribute = "data-sender-name";
// HACK
var getChatTextDoms = () =>
Array.prototype.slice
.call(document.querySelectorAll("*"))
.filter((el) => typeof el.attributes[attribute] !== "undefined");
var texts = getChatTextDoms();
{"lastUpload":"2021-06-17T10:22:47.838Z","extensionVersion":"v3.4.3"}
sed -e 's/\.[^\.]*$//'
@mkanenobu
mkanenobu / translate_in_new_tab.js
Last active April 24, 2020 05:02
send selection to Google Translate
// japanese to english
(function() {
var text = window.getSelection();
var url = "https://translate.google.co.jp/?hl=ja#view=home&op=translate&sl=ja&tl=en&text=" + text;
window.open(url);
})();
// compiled with Google Closure Compiler
// javascript:window.open("https://translate.google.co.jp/?hl=ja#view=home&op=translate&sl=ja&tl=en&text="+window.getSelection());
// english to japanese
@mkanenobu
mkanenobu / pbcopy
Created January 30, 2019 05:10
pbcopy for Cygwin, MSYS2
### append to .bashrc
alias pbcopy="iconv -f UTF-8 -t CP932 | /c/Windows/System32/clip.exe"