Skip to content

Instantly share code, notes, and snippets.

@jsl
jsl / rpotd_anthropic.md
Created October 22, 2026 10:30
Routing Policy of the Day - Anthropic

Subagent routing (owner policy, 2026-10-22)

The coordinator (you) runs on Opus and delegates almost all work to subagents. Pick each subagent's model and effort by what the task needs:

Model and effort Use it for
Sonnet 5.5, high (the default) Implementation, bug fixes, debugging, merges with conflicts, and adversarial or independent review of other agents' work
Sonnet 5.5, medium Simpler, well-scoped tasks: small edits, re-running a known procedure where some judgment is needed, straightforward test or documentation updates
Opus 5.5, medium Design, specification and high-level reasoning: architecture or engine design, choosing between approaches, writing a spec or proposal
Haiku Purely mechanical work: running a fixed command list and reporting
@jsl
jsl / memoization_complexity.rb
Last active August 3, 2017 18:05
Memoization: premature optimization is the root of (at least some) evil
require 'minitest/autorun'
# Many Ruby programmers have a tendency to use memoization too frequently.
# Memoization, when used correctly, can add value to some code by making it
# faster. However, we should remember that pure functions - ones that only rely
# on inputs to produce their result are the simplest. Memoizing, where we save
# state in the form of calculated results, makes our functions impure, and we
# have to be careful that we're not introducing bugs.
describe "how memoization adds extra complexity, and why it should usually be avoided" do
diff --git a/src/Data/Diffusion/Common.hs b/src/Data/Diffusion/Common.hs
index a86307a..a8d1850 100644
--- a/src/Data/Diffusion/Common.hs
+++ b/src/Data/Diffusion/Common.hs
@@ -18,6 +18,8 @@ import Data.Hashable (Hashable())
import Data.Typeable (Typeable())
import Data.Binary (Binary())
import Control.DeepSeq (NFData)
+import Data.List (find)
+import Data.List (isPrefixOf)
@jsl
jsl / trendnet.md
Last active February 1, 2016 00:32
Using Curl to scan to preset positions in a Trendnet TV-IP6721PI

Repositioning your Trendnet TV-IP6721PI using Curl

It's easy to drive your TrendNet camera using curl. This is how you can make it scan to different preset positions.

Note that Curl must be used in Digest mode.

Assuming you have a ~/.netrc file containing your device username and password, first fetch the preset elements (look for the xml section).

curl --digest -n http://camera.local/eng/liveView.cgi
#!/usr/bin/env sh
GHC_VERSION_STRING=`ghc --version 2> /dev/null`
if [ $? -ne 0 ]
then
echo "Unable to obtain GHC version!"
exit 1
fi
@jsl
jsl / gist:6307960c0cbcd5e01b9e
Created November 20, 2014 16:50
Script for gathering data from Meetup
#!/usr/bin/env ruby
require 'rmeetup'
require 'chronic'
puts "Must define meetup url name as ARGV[0]!" if ARGV[0].nil?
CLIENT = RMeetup::Client.new do |config|
config.api_key = "XXXXXXXXX"
end
@jsl
jsl / gist:995ccbe928e50635a5d4
Created August 12, 2014 03:51
Ruby generated file from Idris -> Ruby backend
#!/usr/bin/env ruby
# Example generated from https://github.com/edwinb/idris-demos/blob/master/RLE/rle-vect.idr.
class I_VM
attr_accessor :valstack, :valstack_top, :valstack_base, :ret, :callstack
def initialize()
@valstack = []
@valstack_top = 0
@valstack_base = 0
@jsl
jsl / fix_osx_build.patch
Created February 16, 2014 16:01
Fix HaXml build on OS X
1 patch for repository http://code.haskell.org/HaXml:
Sun Feb 16 10:47:50 ECT 2014 Justin Leitgeb <justin@stackbuilders.com>
* Fix compilation on Mac OS X
The build of HaXml is currently broken on Mac OS X. Since a lot of packages
depend on HaXml this is quite inconvenient. Below is a description of the
problem that was previously posted to Stack Overflow:
http://stackoverflow.com/questions/20497348/haxml-installation-issues-on-os-x-10-9-mavericks
@jsl
jsl / replacer.rb
Last active August 29, 2015 13:56
Dictionary Replacer
require 'minitest/autorun'
require 'stringio'
class DictionaryReplacer
MARK = '$'
ESCAPE = '\\'
def initialize(to_replace, dictionary)
@to_replace = StringIO.new(to_replace)