Skip to content

Instantly share code, notes, and snippets.

View daviddahl's full-sized avatar
💭
burning the midnight oil

David Dahl daviddahl

💭
burning the midnight oil
View GitHub Profile
@daviddahl
daviddahl / gist:138d4f3fdcf6c939b43db1717f3a4264
Last active June 24, 2025 06:20
LLM.swift configuration analysis

Compute Graph Memory Allocation Fix

Problem Analysis

The 422MB allocation failure is happening because LLM.swift sets:

contextParams.n_ctx = UInt32(maxTokenCount)      // e.g., 2048
contextParams.n_batch = contextParams.n_ctx      // ALSO 2048!
@Codelaby
Codelaby / InfiniteScrollView.swift
Created February 13, 2025 15:50
InfiniteScrollView hack offset
import SwiftUI
// MARK: InfiniteScrollView
struct InfiniteScrollView<Content: View>: View {
@State private var scrollPosition: ScrollPosition = ScrollPosition(idType: Int.self)
@Binding var currentIndex: Int
var spacing: CGFloat = 10
var itemSize: CGSize
var count: Int = 0
@awni
awni / mlx_distributed_deepseek.md
Last active July 5, 2025 02:30
Run DeepSeek R1 or V3 with MLX Distributed

Setup

On every machine in the cluster install openmpi and mlx-lm:

conda install conda-forge::openmpi
pip install -U mlx-lm

Next download the pipeline parallel run script. Download it to the same path on every machine:

@veekaybee
veekaybee / normcore-llm.md
Last active July 6, 2025 13:30
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

@doctorzhivago
doctorzhivago / manage-db.js
Last active May 13, 2021 00:54
Establish an IPNS name that points to a file containing an OrbitDB address
const createClient = require('ipfs-http-client');
const OrbitDB = require('orbit-db');
require('buffer');
const toBuffer = require('it-to-buffer');
const LOG='orbit*';
// NOTE: This runs via node.js 14.x +
// This was only tested with a go-ipfs node running on the same
// device on port 5001
@emptyfuel
emptyfuel / UTTypeiOS14.swift
Last active December 24, 2023 15:38
Using UTType in Swift in Xcode 12 and iOS 14 related code from blog post on emptytheory.com at https://emptytheory.com/2020/09/29/better-uniform-type-identifiers-with-xcode-12/
//https://emptytheory.com/2020/09/29/better-uniform-type-identifiers-with-xcode-12/
import UniformTypeIdentifiers
//Show UTType properties for built-in type
UTType.pdf.printInfo()
//Show properties for looked up type
UTType.word.printInfo()
@djrobstep
djrobstep / orm.py
Last active January 28, 2022 17:32
orm.py: An ORM for the ORM haters
import inspect
import pprint
import textwrap
from collections.abc import Iterable
from dataclasses import asdict
from dataclasses import field as dataclass_field
from dataclasses import fields as dataclass_fields
from dataclasses import make_dataclass
import results
"""
Django ORM Optimization Tips
Caveats:
* Only use optimizations that obfuscate the code if you need to.
* Not all of these tips are hard and fast rules.
* Use your judgement to determine what improvements are appropriate for your code.
"""
# ---------------------------------------------------------------------------
@jimpick
jimpick / proof.json
Created October 31, 2018 17:36
ipfs-social-proof jimpick
{
"handle": "Jim Pick",
"ipfsId": "QmX7S4KLxVfhMT7BwsyA2GkKfWD7LPHgPdK75pzErgqBWG",
"proof": {
"message": {
"statement": "I am @jimpick on github.com",
"username": "@jimpick",
"service": "github.com"
},
"timestamp": 1541007329378,
@woowa-hsw0
woowa-hsw0 / assume_role.sh
Last active January 11, 2023 11:36
Start AWS CLI Session with MFA Enabled (+Yubikey)
#!/bin/bash
set -eu
umask 0022
if [[ $# -lt 1 ]]; then
echo "Usage: $0 role_name [AWS ACCOUNT NUMBER]" >&2
exit 1
fi