Skip to content

Instantly share code, notes, and snippets.

@Yappaholic
Yappaholic / 001-tablet.patch
Created August 26, 2025 07:12
Tablet patch for the Mangowc (DWL fork)
From a649365d12b236af9a096d37484cfc82168d28b2 Mon Sep 17 00:00:00 2001
From: Yappaholic <[email protected]>
Date: Tue, 26 Aug 2025 10:03:12 +0300
Subject: [PATCH] nothing
---
src/ext-protocol/all.h | 3 +-
src/ext-protocol/tablet.h | 220 ++++++++++++++++++++++++++++++++++++++
src/mango.c | 15 +++
3 files changed, 237 insertions(+), 1 deletion(-)
@wong2
wong2 / claude-code-tools.md
Last active September 21, 2025 10:54
Tools and system prompt of Claude Code

Task

Launch a new agent that has access to the following tools: Bash, Glob, Grep, LS, exit_plan_mode, Read, Edit, MultiEdit, Write, NotebookRead, NotebookEdit, WebFetch, TodoRead, TodoWrite, WebSearch. When you are searching for a keyword or file and are not confident that you will find the right match in the first few tries, use the Agent tool to perform the search for you.

When to use the Agent tool:

  • If you are searching for a keyword like "config" or "logger", or for questions like "which file does X?", the Agent tool is strongly recommended

When NOT to use the Agent tool:

  • If you want to read a specific file path, use the Read or Glob tool instead of the Agent tool, to find the match more quickly
  • If you are searching for a specific class definition like "class Foo", use the Glob tool instead, to find the match more quickly
  • If you are searching for code within a specific file or set of 2-3 files, use the Read tool instead of the Agent tool, to find the match more quickly
@aredden
aredden / pytorch_colormap.py
Last active May 21, 2023 01:33
Helper class for efficiently creating a torch.uint8 colormaped (H, W, 3) image (entirely on device) from a (H, W) float32 tensor
import torch
from einops import rearrange
_magma_table = [
(0.001462, 0.000466, 0.013866),
(0.002258, 0.001295, 0.018331),
(0.003279, 0.002305, 0.023708),
(0.004512, 0.003490, 0.029965),
(0.005950, 0.004843, 0.037130),
(0.007588, 0.006356, 0.044973),
@davidbegin
davidbegin / Voices.txt
Created December 19, 2022 00:07
List of AI Voice Options
ishowspeed
sonic-cd
norm-pf
merg
kevin-spencer-narrator
cobra-bubbles
aunt-grandma
eduardo
thomas-leokimvideo
diego
# Script for converting a HF Diffusers saved pipeline to a Stable Diffusion checkpoint.
# *Only* converts the UNet, VAE, and Text Encoder.
# Does not convert optimizer state or any other thing.
# Written by jachiam
import argparse
import os.path as osp
import torch
@PJUllrich
PJUllrich / big-o.md
Last active September 9, 2025 15:54
Big-O Time Complexities for Elixir Data Structures

Big-O Time Complexities for Elixir data structures

Map [1]

Operation Time Complexity
Access O(log n)
Search O(log n)
Insertion O(n) for <= 32 elements, O(log n) for > 32 elements [2]
Deletion O(n) for <= 32 elements, O(log n) for > 32 elements
@jerry73204
jerry73204 / tch-serde.rs
Created June 3, 2020 19:09
serde on tch-rs types example
use failure::Fallible;
use serde::{
de::Error as DeserializeError, ser::Error as SerializeError, Deserialize, Deserializer,
Serialize, Serializer,
};
use std::fs;
use tch::{Device, Kind, Tensor};
fn main() -> Fallible<()> {
let json = fs::read_to_string("example.json")?;
@atomkirk
atomkirk / cloud-files.md
Last active April 8, 2025 12:15
Storing files on S3 with Elixir

I have this abstraction in my application code called a "CloudFile". This is where I store in the database information about files on S3 and it gives me a resource for other resources to own. For example, a user would have an avatar_cloud_file_id. On the front-end, I would load this relationship and display the avatar with user.avatar_cloud_file.download_url

defmodule RL.CloudFile do
  use Ecto.Schema
  import Ecto.Changeset

  @timestamps_opts type: :utc_datetime_usec
@andersevenrud
andersevenrud / alacritty-tmux-vim_truecolor.md
Last active September 17, 2025 13:19
True Color (24-bit) and italics with alacritty + tmux + vim (neovim)

True Color (24-bit) and italics with alacritty + tmux + vim (neovim)

This should make True Color (24-bit) and italics work in your tmux session and vim/neovim when using Alacritty (and should be compatible with any other terminal emulator, including Kitty).

Testing colors

Running this script should look the same in tmux as without.

curl -s https://gist.githubusercontent.com/lifepillar/09a44b8cf0f9397465614e622979107f/raw/24-bit-color.sh >24-bit-color.sh
@atomkirk
atomkirk / endpoint.ex
Created February 23, 2018 16:50
raw body plug parser
plug Plug.Parsers,
parsers: [ZB.Parsers.RAWBODY, :urlencoded, :multipart, :json],
pass: ["*/*"],
json_decoder: Poison