Skip to content

Instantly share code, notes, and snippets.

Installing Fresh (terminal version) on macOS without Homebrew or MacPorts

1. Find out which chip your Mac has

uname -m
  • arm64 means Apple Silicon (M1 or later). Use fresh-editor-aarch64-apple-darwin.tar.xz
  • x86_64 means Intel. Use fresh-editor-x86_64-apple-darwin.tar.xz
@sinelaw
sinelaw / gist:27d3800f8a8b2e013b4ebd73a038045e
Created September 22, 2026 15:46
github agent / AI related code lines
================================================================================
VS Code "AI & agents" — cloc, subtree by subtree
================================================================================
repo microsoft/vscode @ bf715befd589605be045505d0456e4246054566f (1.140.0)
cloc 1.98
flags --quiet --skip-uniqueness --force-lang=TypeScript,mts
--include-lang=TypeScript,JavaScript,Rust
--not-match-f='\.d\.ts$|\.min\.js$'
--exclude-dir=node_modules,out,out-build,.build,typings,vscode-dts,
fixtures,colorize-fixtures,dist,vendor
@sinelaw
sinelaw / AMP_INTEGRATION.md
Created December 15, 2025 20:37
A guide for integrating new editors with the AMP protocol, based on the `amp.nvim` implementation.

AMP Protocol Quick Reference

This document provides a guide for integrating new editors with the AMP protocol, based on the amp.nvim implementation.

Overview

The AMP integration is based on a WebSocket protocol. One editor acts as a server (in the case of amp.nvim, this is Neovim itself), and other tools or editor integrations act as clients.

A client connects to the server to send requests (like reading or editing a file) and receive responses and notifications (like when a file changes or the selection is updated).

@sinelaw
sinelaw / copy.py
Last active July 2, 2019 18:51
Parallel copy of a single file
import threading
import os
import sys
BLOCK_SIZE = 1024*1024
THREADS = 16
def write_range(source, target, start, amount, block_size):
with open(source, 'r') as source_file:
with open(target, 'r+') as target_file:
#!/bin/bash
set -eu
BRANCH_A="$1"
shift
BRANCH_B="$1"
shift
PATHS="$@"
BRANCH_A_COMMITS=$(mktemp)
ONLY_IN_BRANCH_A=$(mktemp)
BRANCH_B_COMMITS=$(mktemp)
@sinelaw
sinelaw / atomic.c
Created August 17, 2017 08:01
testing <stdatomic.h> on Intel cross-cacheline
#include <stdint.h>
#include <stdio.h>
#include <pthread.h>
#include <stdlib.h>
#include <stdatomic.h>
#define CACHELINE__BYTECOUNT (64)
struct Data {
uint8_t bytes[CACHELINE__BYTECOUNT - 4];
@sinelaw
sinelaw / git-unmerged-commits
Last active June 2, 2016 13:13
Given branch/ref (e.g. my_branch) and target (e.g. origin/master), lists commits in branch that have no "equivalent" ones in target (by author, date and message)
#!/bin/bash
set -eu
# Similar to git branch --merged but looks at commit author, date and
# subject, instead of hash.
#
# Given branch/ref (e.g. my_branch) and target (e.g. origin/master),
# lists commits in branch that have no "equivalent" ones in target (by
# author, date and message).
@sinelaw
sinelaw / binary.hs
Created February 3, 2016 08:39
Binary encode/decode of Fixed
-- run it like:
-- stack ghc --package criterion -- binary.hs -Wall -O2 && ./binary
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE BangPatterns #-}
module Main where
import Data.ByteString.Lazy (ByteString)
import Data.Binary
import Data.Fixed
/*jsl:option explicit*/
"use strict";
// /////////////////////////////////////////////////////////////////////
// // JQUERY EXTENSIONS
/* Removed this part.. */
/////////////////////////////////////////////////////////////////////
// STRING FORMATTING
@sinelaw
sinelaw / Parser.hs
Last active October 31, 2015 22:20
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE StandaloneDeriving #-}
-- |
module Main where
import Control.Applicative (Alternative(..), (<|>))
import Data.List (foldl', intercalate)
import Data.Monoid ((<>))