Skip to content

Instantly share code, notes, and snippets.

View chaichontat's full-sized avatar

Chaichontat Sriworarat chaichontat

View GitHub Profile
@chaichontat
chaichontat / extract.cjs
Last active June 27, 2024 16:04
Extract conversation from Anthropic console
console.log(
JSON.stringify(
Array.from(document.querySelectorAll('div[data-testid="editor"]')).reduce(
(acc, container) => {
acc[container.parentNode.getAttribute("data-testid")] = container.innerText;
return acc;
},
{}
),
null,
@chaichontat
chaichontat / init.sh
Last active August 13, 2025 14:55
Mac Startup
#!/bin/zsh
# exit when any command fails
set -e
# keep track of the last executed command
trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
# echo an error message before exiting
trap 'echo "\"${last_command}\" command filed with exit code $?."' EXIT
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
export LANG='en_US.UTF-8'
export LANGUAGE='en_US:en'
export LC_ALL='en_US.UTF-8'
@chaichontat
chaichontat / .p10k.zsh
Created July 18, 2021 18:24
Powerline10k config
# Generated by Powerlevel10k configuration wizard on 2021-05-25 at 23:18 EDT.
# Based on romkatv/powerlevel10k/config/p10k-lean.zsh, checksum 27204.
# Wizard options: nerdfont-complete + powerline, small icons, unicode, lean, 1 line,
# compact, few icons, concise, transient_prompt, instant_prompt=verbose.
# Type `p10k configure` to generate another config.
#
# Config for Powerlevel10k with lean prompt style. Type `p10k configure` to generate
# your own config based on it.
#
# Tip: Looking for a nice color? Here's a one-liner to print colormap.