Skip to content

Instantly share code, notes, and snippets.

View hidao80's full-sized avatar

hidao hidao80

View GitHub Profile
@woxtu
woxtu / ocr.js
Last active May 3, 2024 04:45 — forked from doraTeX/ocr.sh
A JavaScript (JXA) to perform OCR on images/PDFs using macOS built-in OCR engine
#!/usr/bin/osascript -l JavaScript
ObjC.import("stdlib");
ObjC.import("AppKit");
ObjC.import("PDFKit");
ObjC.import("Vision");
const scriptName = $.NSProcessInfo.processInfo.arguments.objectAtIndex(3).lastPathComponent.js;
console.error = (obj) => {
@woxtu
woxtu / gist:6b214ea9cef53e246beb9fc31c5295fe
Last active October 9, 2022 14:38
Qiitadon 新着 読み上げ ブックマークレット
(() => {
ws = new WebSocket("wss://streaming.qiitadon.com:4000/api/v1/streaming/?stream=public:local");
ws.addEventListener("message", (ev) => {
const { event, payload } = JSON.parse(ev.data);
if (event === "update") {
const status = JSON.parse(payload);
speechSynthesis.cancel();
speechSynthesis.speak(new SpeechSynthesisUtterance(status.account.display_name || status.account.username));
speechSynthesis.speak(new SpeechSynthesisUtterance(status.content.replace(/<\/?[^>]+(>|$)/g, "")));
}