Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
screencapture -i ~/clipboard.png
IMAGE_BASE64=$(base64 -i ~/clipboard.png | tr -d '\n')
rm ~/clipboard.png
API_KEY="GEMINI_API_KEY_HERE"
MODEL="gemini-2.0-flash"
import { OpenAI } from "https://deno.land/x/[email protected]/mod.ts";
import { WebClient } from "npm:@slack/web-api";
export function parsePermalink(url: string) {
const u = new URL(url);
const [ , , channel, raw ] = u.pathname.split("/");
const ts = raw.startsWith("p")
? raw.slice(1).replace(/(\d{10})(\d{6})/, "$1.$2")
: raw;
return { channel, ts, maybeThread: u.searchParams.get("thread_ts") ?? undefined };
/* ─── floating navbar, hidden by default ─── */
#nav-bar {
opacity: 0;
pointer-events: none;
position: fixed !important;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 600px;
background: rgba(255,255,255,.95);
@huytd
huytd / raycast-bookmark-command.py
Created October 21, 2024 06:04
Use Gemini to generate bookmark, use in Raycast
#!/usr/bin/env python3
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Add a new bookmark in Obsidian
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 🔖
# @raycast.argument1 { "type": "text", "placeholder": "URL" }
.white-theme,
html[data-theme=light] {
--cl-white: #fff;
--cl-alabaster: #f9fafb;
--cl-blackhaze: #f5f6f8;
--cl-antiflash: #f2f3f5;
--cl-athens: #eef0f4;
--cl-gallery: #eeeff0;
--cl-fadedwhite: #ececec;
--cl-lilac: #e9e9e9;

Screenshots:

image image image
@huytd
huytd / tokyo-rs-simple-bot.js
Created October 12, 2023 07:50
Simple bot for tokyo-rs
const USERNAME = "rotate-bot";
const ws = require('ws');
const client = new ws(`wss://combat.sege.dev/socket?key=${USERNAME}&name=${USERNAME}`);
client.on('open', () => {
console.log('Connected!');
setInterval(() => {
client.send(JSON.stringify({
@huytd
huytd / hiccup.vim
Last active October 14, 2023 03:51
My latest Vim config in Lua
" Hiccup Theme for Vim
" Author: Huy Tran
" License: BSD 3 Clauses
" Put this file to: colors/hiccup.vim
highlight clear
if exists('syntax_on')
syntax reset
endif