Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
# verify-claude.sh — Verify Claude Code is signed by Anthropic, then clear
# the quarantine xattr that triggers Gatekeeper after each `brew upgrade`.
#
# macOS code signing pins identity via the Apple-issued Team ID, which is
# bound to a Developer ID certificate. Bundle IDs are not authoritative —
# anyone can claim `com.anthropic.claude-code`, but only Anthropic has
# Team ID Q6L2SF6YDW.
#
# Steps:
@dfa1
dfa1 / git-autosquash
Last active March 21, 2020 19:24
inattentively squash all commits of a topic branch (i.e. no need to open an editor as in rebase -i)
#!/bin/bash
set -euo pipefail
target_branch=$1
current_branch=$(git rev-parse --abbrev-ref head)
squash_branch=${current_branch}_work
git checkout -B ${squash_branch} ${target_branch}
git merge --squash ${current_branch}
git commit -am "squashed"
git checkout ${current_branch}
git reset --hard ${squash_branch}
import java.util.function.Predicate;
public class Refined<T> {
private final T value;
public Refined(Predicate<T> validator, T value) {
if (!validator.test(value)) {
throw new IllegalArgumentException("invalid value");
}
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
import java.util.concurrent.ArrayBlockingQueue;