Skip to content

Instantly share code, notes, and snippets.

View Sleepful's full-sized avatar
🐢
boo 👻

Jose Vargas Sleepful

🐢
boo 👻
View GitHub Profile
@Sleepful
Sleepful / perspective-lazy-load.el
Created June 25, 2026 17:40
Per-perspective lazy-load for perspective.el on Emacs daemon
;; ── Per-perspective state files for Emacs daemon mode ──────────────
;; Requires: perspective, eglot
;;
;; Saves each perspective as var/perspectives/<name>.el.
;; Buffers open lazily — only the perspective you switch into loads files.
;; Unloaded perspectives appear dimmed in dashboard and load on click.
;; Works around perspectives not supporting daemon mode (issues #41, #194).
;; Tested on Emacs 30.2 + daemon + vtsls LSP.
;;
;; ── Key design decisions ────────────────────────────────────────────
Type Name Plan
+ ├─ aws:ecs:Cluster ecs-cluster-mymail create
+ ├─ awsx:ecr:Repository repo-mymail create
Type Name Plan
+ ├─ aws:ecs:Cluster ecs-cluster-mymail create
+ ├─ awsx:ecr:Repository repo-mymail create
Type Name Plan
+ │ ├─ aws:ecr:Repository repo-mymail create
+ │ └─ aws:ecr:LifecyclePolicy repo-mymail create
Type Name Plan

How to pick between Zig and Rust.

flowchart TD
    A(Do you want to `malloc`?) -->| yes |Zig
    A(Do you want to `malloc`?) -->| No |Rust
@Sleepful
Sleepful / tmux.sh
Last active July 2, 2023 05:47
FZF to select tmux windows and move them to another session. You may select multiple windows.
# this in your tmux config
bind M run-shell "source ~/.tmux/functions.sh && move_windows"
# this inside ~/.tmux/functions.sh
#!/bin/bash
#
function move_windows() {
windows=$(
{
"title": "swap numbers and shift+numbers",
"rules": [
{
"description": "swap numbers and shift+numbers",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "1",
@Sleepful
Sleepful / fhead.ex
Last active November 18, 2022 22:32
defmodule Fheads do
defp set_required(set, :built, :new), do: set
defp set_required(set, :built, :submit) do
type = get_field(set, :type)
assoc = get_field(set, type)
put_assoc(set, type, required: assoc.required)
end
# Re-usable outside of a changeset! :D
@Sleepful
Sleepful / case.ex
Last active November 18, 2022 21:45
defmodule CaseCondIf do
defp set_required(set) do
if !set.valid? do
set
else
state = get_field(set, :__meta__).state
IO.inspect(state)
stage = set.stage
# set_required(set, state, stage)
case {stage, state} do
defmodule WordBase.Classifier.Value do
@kinds [
%{string: "filter", atom: :Filter},
%{string: "word", atom: :Word}
]
@types [
%{string: "bool", atom: :Bool, db_type: :boolean},
%{string: "text", atom: :Text, db_type: :string},
%{string: "datetime", atom: :Datetime, db_type: :naive_datetime}
]
# the join tables, many_to_many between:
#
# - categories_type(s)
# - filter
#
# - categories_type(s)
# - word
#
# type(s) refer to: bool, text, multi, datetime
#
var nsp2 = io.of('/2');
nsp2.on('connection', socket => {
socket.on('change color', (color) => {
nsp2.broadcast.emit('change color', color)
}
var nsp3 = io.of('/3');
nsp3.on('connection', socket => {
socket.on('change color', (color) => {
nsp3.broadcast.emit('change color', color)