Skip to content

Instantly share code, notes, and snippets.

@ngxson
ngxson / FAQ.md
Last active April 11, 2025 16:27
convert ARM NEON to WASM SIMD prompt

Why did you do this?

Relax, I only have one Sunday to work on idea, literally my weekend project. So I tried Deepseek to see if it can help. Surprisingly, it works and it saves me another weekend...

What is your setup?

Just chat.deepseek.com (cost = free) with prompts adapted from this gist.

Does it work in one-shot or I have to prompt it multiple times?

@staticaland
staticaland / gptel.md
Last active February 2, 2025 23:52
How gptel works

Under the Hood: How gptel Manages LLM Conversations in Emacs

If you've used Emacs to interact with LLMs, you've probably encountered gptel. While it appears simple on the surface—just another chat interface—its internals reveal an elegant approach to managing LLM conversations that leverages Emacs' text property system. Let's dive into how it works.

Visual vs Actual: The Prefix Illusion

One of the first things you notice in a gptel chat buffer are the prefixes—typically "### " for user messages in Markdown mode or "*** " in Org mode. What's interesting is that these prefixes are purely cosmetic. They're stripped out before any API calls using a simple but effective mechanism:

(defsubst gptel--trim-prefixes (s)

Lima Cheatsheet for macOS

I stumbled on an incredible open source solution, Lima. In some ways, it has some of Hashicorp's Vagrant's resemblance, but in my opinion, it's so much superior in many ways as it doesn't use external dependencies such as Oracle's VirtualBox.

If you're used to docker on the command line but wanted to play with VMs rather than containers, then this is for you! No need to fuss with cloud-init as a user account (using your existing username in whoami) with a proper home directory would be auto-generated for you with full passwordless sudo privilege. SSH access to the VMs from the host is seamlessly integrated as well.

This quick guide is for those who need to set up virtual machines with modern Linux OSes (only few selected OSes are best supported) from scratch using only the command line. You can have a VM up and running within minutes from absolutely nothing.

NOTE: This was last tested using:

  • `lima
@ahyatt
ahyatt / llm-fill.el
Created September 15, 2024 15:54
Fill-in-the-middle with LLM function calling
(require 'llm)
(require 'llm-prompt)
(defvar llm-provider nil
"The LLM provider to use for misc functionality")
(llm-defprompt llm-context
"The user is currently in Emacs. The following is part of the buffer they are looking at, which is a {{mode}} buffer. Their cursor is marked with '{{cursor}}':
{{context}}")
@vjanssens
vjanssens / caddy.json
Last active October 21, 2024 12:39
lnav log definition for Caddy server
{
"$schema": "https://lnav.org/schemas/format-v1.schema.json",
"caddy": {
"title": "Caddy Server",
"description": "Caddy Server JSON access logs format",
"url": [
"https://caddyserver.com/docs/caddyfile/directives/log"
],
"json": true,
"timestamp-field": "ts",
@veekaybee
veekaybee / normcore-llm.md
Last active April 24, 2025 23:55
Normcore LLM Reads

Anti-hype LLM reading list

Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.

Foundational Concepts

Screenshot 2023-12-18 at 10 40 27 PM

Pre-Transformer Models

@MarkRoddy
MarkRoddy / parse_s3_access_logs.sql
Last active November 27, 2024 19:35
DuckDB: Query S3 Access Logs
/*
Usage: you'll want to search for the strings <bucket> and <prefix>, and insert the S3 bucket where your access
logs are being delivered. Use (or delete) <prefix> to filter to a subset of your logs.
*/
/*
These commented out configuration settings you can either run yourself in the REPL and source this file using
`.read parse_s3_access_logs.sql`, or you can uncomment them and supply values for yourself.
@andrewrk
andrewrk / build.zig
Created February 20, 2023 16:20
sprinkling a little zig into a C project to help with debugging
const std = @import("std");
pub fn build(b: *std.Build) void {
// Standard target options allows the person running `zig build` to choose
// what target to build for. Here we do not override the defaults, which
// means any target is allowed, and the default is native. Other options
// for restricting supported target set are available.
const target = b.standardTargetOptions(.{});
// Standard optimization options allow the person running `zig build` to select
@padajo
padajo / cognito-oidc-starter-template.yaml
Created October 21, 2022 17:41
A starter template for creating an OpenID Connect (OIDC) identity provider on Amazon Cognito using SAM/CloudFormation. This creates an identity provider and outputs the /.well-known/openid-configuration and /.well-known/jwks.json URLs for you in the Outputs.
AWSTemplateFormatVersion: "2010-09-09"
Description: >-
openid-connect-app
Testing creating an OpenID Identity Provider with Cognito
Transform:
- AWS::Serverless-2016-10-31
Resources:
@nrjdalal
nrjdalal / QEMU-Silicon-Mac-Virtualization.md
Last active March 14, 2025 09:02
Create Virtual Machines using QEMU on Silicon based Apple Macs

Install QEMU on Silicon based Apple Macs (June 2021)

Option 1 - Automatically

zsh -c "$(curl -fsSL https://raw.githubusercontent.com/nrjdalal/silicon-virtualizer/master/install-qemu.sh)"

Option 2 - Manually

  • Install Xcode command line tools

xcode-select --install