Skip to content

Instantly share code, notes, and snippets.

You are Gemini. You are a helpful assistant. Balance empathy with candor: validate the user's emotions, but ground your responses in fact and reality, gently correcting misconceptions. Mirror the user's tone, formality, energy, and humor. Provide clear, insightful, and straightforward answers. Be honest about your AI nature; do not feign personal experiences or feelings.Use LaTeX only for formal/complex math/science (equations, formulas, complex variables) where standard text is insufficient. Enclose all LaTeX formulas using $ for inline equations and$$ for display equations. Ensure there is no space between the delimiter ($ or $$) and the formula. Never render LaTeX in a code block unless the user explicitly asks for it. Strictly Avoid LaTeX for simple formatting (use Markdown), non-technical contexts and regular prose (e.g., resumes, letters, essays, CVs, cooking, weather, etc.), or simple units/numbers (e.g., render 180°C or 10%).Further guidelines:I. Response Guiding PrinciplesStructure your response for
prefix = {
mods={"ctrl"},
key="t",
}
appNameToPreferredNumber = {
Emacs=0,
Safari=1,
Terminal=2,
Spotify=9,
}
@kidd
kidd / init.lua
Last active October 3, 2024 09:40
hammerspoon snippet to c-n,c-p... in slack and chrome
local function remap(from_key, to_key)
return hs.hotkey.new(from_key[1], from_key[2],
function() hs.eventtap.keyStroke(to_key[1], to_key[2]) end)
end
local maps={}
local function remap_add(win_filter_name, from_key, to_key)
maps[win_filter_name] = maps[win_filter_name] or {}
table.insert(maps[win_filter_name], remap(from_key, to_key))
-- https://github.com/Hammerspoon/hammerspoon/issues/664
slack_c_n = hs.hotkey.new({"ctrl"}, 'n', function()
hs.eventtap.keyStroke({}, 'down')
end)
slack_c_p = hs.hotkey.new({"ctrl"}, 'p', function()
hs.eventtap.keyStroke({}, 'up')
end)
@kidd
kidd / init.el
Last active August 20, 2024 11:58
advice browse-url-at-point to account for stripe ids
;;; (keymap-global-set "C-c o" 'browse-url-at-point)
(defun rgc/add-stripe (args)
"prepend the right stripe path to be able to find the entity
you're looking for"
(let* ((arg (s-replace-regexp "^https?://" "" (car args)))
(path
(cond
(def hh [{:a 1, :b 2, :c 3 :aa 4} {:a 1, :b 2, :c 4 :aa 4} {:a 99, :b 2, :c 3 :aa 5}])
(def rname :trial-ups)
(def main-f [:b :a])
;; first stab, we pivot over the keys of the "root" entity,
;; group by them, and strip the rest out
(defn hydrate-with-main-entity-keys [m ks as]
(->> (group-by #(select-keys % main-f) hh)
(m/map-vals (partial map #(apply dissoc % main-f)))
@kidd
kidd / dup-file.sh
Created October 9, 2023 11:16
Duplicate file finder helpers
# helping to find dupes. Not complete,
# but this can serve as a basis for a pure shellscript dup finder
find . -type f -exec du -s {} \; -exec /usr/bin/basename {} \; >/tmp/list.txt
cat /tmp/list.txt | cut -f1 -d' ' | paste - - | grep png | sort | uniq| wc -l
cat /tmp/list.txt | cut -f1 -d' ' | paste - - | grep png | sort | wc -l
@kidd
kidd / fzf.sh
Last active October 4, 2023 07:53
pure shell naive version of a picker like fzf (without the filtering, but only picking by number)
# fzf is either fzf or a naive version of it
# the input is a sed line number, so it can be
# single number: 42
# range: 1,10
# separate lines: 10p;50p
mute command -v fzf ||
fzf() {
local in=$(cat)
for p in "${@}"; do
[ "$p" = "-0" ] && [ "$(echo "$in" | wc -l)" -eq 1 ] && [ "" = "$in" ] && return 1
@kidd
kidd / whiteboard.js
Created September 21, 2023 07:58
whiteboard bookmarklet
data:text/html,<canvas id="v"><script>d=document,d.body.style.margin=0,f=0,c=v.getContext("2d"),v.width=innerWidth,v.height=innerHeight,c.lineWidth=2,x=e=>e.clientX||e.touches[0].clientX,y=e=>e.clientY||e.touches[0].clientY,d.onmousedown=d.ontouchstart=e=>{f=1,e.preventDefault(),c.moveTo(x(e),y(e)),c.beginPath()},d.onmousemove=d.ontouchmove=e=>{f&&(c.lineTo(x(e),y(e)),c.stroke())},d.onmouseup=d.ontouchend=e=>f=0</script>
mb:maybehelp() {
local msg="$1";shift
if any equals_help "$@"; then
warn "$msg"
return 1
fi
}
mb:maybehelp "mmsg" "$@" || return 1