Skip to content

Instantly share code, notes, and snippets.

View sadasant's full-sized avatar
🤘

Daniel Rodríguez sadasant

🤘
View GitHub Profile
@sadasant
sadasant / CMakeLists.txt
Created November 1, 2026 16:14
Reproduce an OpenCode retry loop and interrupt it with Qwen3.5-4B activation patching: CPU, llama.cpp, and Verifiers.
cmake_minimum_required(VERSION 3.16)
project(loop_lab_probe LANGUAGES CXX)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux" OR NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|amd64|AMD64)$")
message(FATAL_ERROR "This recipe supports Linux x86_64 CPU only.")
endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(LLAMA_DIR "${CMAKE_CURRENT_SOURCE_DIR}/.work/llama.cpp" CACHE PATH "Pinned llama.cpp source")
@sadasant
sadasant / README.md
Created October 29, 2026 19:14
Two agents, one filesystem: refusing, redirecting, and negotiating file access with the Linux kernel (6.14+)

Two agents, one filesystem

When two agents work on the same machine and in the same repository, either one may attempt to read, write, or delete the same files.

Each agent usually has guardrails, but those are private to its own harness and generally invisible to the other. A common way to avoid collisions is to give each agent its own worktree, folder, or VM. Those work, but they aren't perfect, so why not explore other options?

@sadasant
sadasant / _README.md
Last active August 30, 2023 17:33
Bash function for piping command outputs to OpenAI's GPT-4 model

This gpt() function reads input from the command line and then sends a formatted JSON object to the OpenAI API for the GPT-4 model. It properly escapes special characters and checks for the .env file containing the OpenAI API key.

Usage:

  • Load the function into your environment: source gpt.sh.
  • Make sure to have an .env file in the current directory with the OPENAI_API_KEY.
  • Pipe anything itno it, and also add a prompt, example:
git diff main | gpt "As a programmer, review this diff. Provide feedback only if necessary. Be brief"
@sadasant
sadasant / index.ts
Created June 26, 2020 19:06 — forked from willmtemple/index.ts
magic typescript function that returns its arguments' AST
// This uses my modified version of typescript from my branch github.com/willmtemple/typescript#fucking-parser
import * as ts from "typescript/built/local/typescript";
import * as fs from "fs";
import * as os from "os";
import { promisify } from "util";
const readFile = promisify(fs.readFile);
@sadasant
sadasant / computer_tips.md
Last active January 20, 2020 15:29
Computer tips to Jen Gentleman

Computer tips to Jen Gentleman.

For this Twitter thread: https://twitter.com/JenMsft/status/1218526323271823360

I've taken all of these from information I've found publicly available on the interner over the years. I haven't kept all of the sources.

I thought on adding more than bash-related stuff, but I ended up unconvinced. I hope some of this can be useful!

Index

Keybase proof

I hereby claim:

  • I am sadasant on github.
  • I am sadasant (https://keybase.io/sadasant) on keybase.
  • I have a public key ASDfYbR_Nx35Pf2hogjNpqwWYCLmlG-xy80sToPxSMk94go

To claim this, I am signing this object:

const S = require('sanctuary')
let objectMatches = object => S.allPass(
S.map(([k, v]) =>
S.pipe([
S.prop(k),
S.is(Function, v) ?
v :
S.is(RegExp, v) ?
S.test(v) :
@sadasant
sadasant / RunAProxyOnAmazonEC2VPC.md
Created April 14, 2017 13:35 — forked from webinista/RunAProxyOnAmazonEC2VPC.md
Create a proxy server on an Amazon EC2 (VPC) instance

This will create a proxy server in whatever your availability zone your VPC is in. For me, that's us-east-1b. For you, that may be something different. Steps 10+ should more or less work regardless of your provider since those steps cover the setup and configuration of TinyProxy.

  1. Click the Launch Instance button.
  2. Choose Ubuntu Server 14.04 LTS (HVM), SSD Volume Type. This isn't strictly necessary. If you choose another OS, check its documentation for how to install new packages.
  3. On the Choose an Instance Type screen, select t2.micro. It's Free Tier eligible.
  4. Click the Next: ... buttons until you reach the Configure Security Group screen.
    • You may wish to reduce the amount of storage on the Add Storage screen. This is optional.
    • You may wish to add a tag on the Tag Instance screen. This is also optional.
  5. On the Configure Security Group screen:
  • Select Create a new security group.
@sadasant
sadasant / foldWhile.mkd
Last active August 28, 2021 10:27
Recursive fold takeWhile (as in haskell)

Recursive fold takeWhile (as in haskell). Lazy evaluated!

  • Iterates depth-first every element of a nested data structure given as obj.
  • Runs only while the iterator fn returns true.
  • The fn iterator receives:
    • An accumulator, that by default is an array, but that can be defined as anything else in the third parameter given to foldWhile.
    • The next value iterated.
@sadasant
sadasant / DurandalHistoryCheckUrl
Created January 25, 2017 21:06
Duranda's History checkUrl fix
/**
* Checks the current URL to see if it has changed, and if it has, calls `loadUrl`, normalizing across the hidden iframe.
* @method checkUrl
* @return {boolean} Returns true/false from loading the url.
*/
function cleanFragment(s) {
return s
.replace(/%7E/g, "~")
.replace(/%21/g, "!")
.replace(/%2A/g, "*")