Skip to content

Instantly share code, notes, and snippets.

View dogweather's full-sized avatar

Robert Shecter dogweather

View GitHub Profile
@dogweather
dogweather / output.txt
Created November 17, 2026 23:58
Peak delta RSS
bash-3.2$ ruby peak-delta-rss.rb
Ruby 4.0.9
=== ~100K chars, request 500 words ===
current before= 16384 after= 21056 delta= +4672 KB
lookahead before= 21056 after= 21136 delta= +80 KB
=== ~500K chars, request 200 words ===
current before= 21136 after= 44592 delta=+23456 KB
lookahead before= 44592 after= 44592 delta= +0 KB
@dogweather
dogweather / benchmark-ips.rb
Created November 17, 2026 23:56
Benchmark IPS
#!/usr/bin/env ruby
# frozen_string_literal: true
require "benchmark/ips"
# require "active_support/core_ext/string/filters" # optional
class String
def truncate_words_current(words_count, options = {})
sep = options[:separator] || /\s+/
sep = Regexp.escape(sep.to_s) unless Regexp === sep

Copilot Chat Conversation Export:

Getting started with repo contributions

@dogweather

I'd like to get started helping out with this repo. It's bee a while since I've done C++ coding, but I'm up for getting back into it. Please look for opportunities for initial contributions: refactoring, etc.

Copilot

@dogweather
dogweather / custom-wp-syntaxhighter.css
Created September 23, 2025 23:00
Custom CSS for the Wordpress.com SyntaxHighter
/* My best attempt at GitHub Gist CSS */
/* for the Wordpress Syntax Highlighter. */
div.line > code {
font-family:
ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
"Liberation Mono", monospace !important;
font-size: 0.7em !important;
font-weight: 400 !important;
line-height: 1.8em !important;
# Convert objects to XML
root = ET.Element("toc")
for title in toc.titles:
title_elem = ET.SubElement(root, "title")
title_elem.set("number", str(title.number))
title_elem.set("id", title.id)
title_elem.set("urn", title.urn)
title_elem.text = title.name
@dogweather
dogweather / Analysis-of-Linea.md
Last active August 28, 2025 19:47
Claude Code's Analysis of "Linea"
@dogweather
dogweather / redirect-sample.rb
Created April 12, 2024 20:10
Example of redirect code in Ruby, plus tests
elsif ors?
case param_id
when 'or', 'ors', 'ors_', 'ors_about'
return ORS_ROOT
when /^nrs_/
return NRS_ROOT + '/' + param_id
when /^tex\._/
return TEXAS_STATUTES_ROOT + '/' + param_id
@dogweather
dogweather / fixed.py
Created April 5, 2024 19:17
Fixed and Refactored Python code
board = ["R", "N", "B", "Q", "K", "B", "N", "R","P", "P", "P", "P", "P", "P", "P", "P"," ", " ", " ", " ", " ", " ", " ", " "," ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "," ", " ", " ", " ", " ", " ", " ", " ","p", "p", "p", "p", "p", "p", "p", "p","r", "n", "b", "q", "k", "b", "n", "r"]
def Print_board():
x = 0
y = 0
while y < 8:
print("\n")
while x < 8:
print(board[x] + " ", end="")
@dogweather
dogweather / parse_title.py
Last active December 31, 2023 21:31
My best Elixir in Python
def parse_title(dom: XmlResponse) -> Title:
name = pipe(
dom
, html.xpath("//TITLE-TEXT")
, text.titleize
)
number = pipe(
dom
, html.xpath("//TITLE-NUM")
, text.split(" ")
@dogweather
dogweather / worker.js
Last active December 1, 2023 15:52
CF Worker example: KV lookup and adding a customer header to a request
async function handleRequest(request) {
// Is the visitor in the VIP list?
let data = request.cf
let visitor_asn = data.asn
// Query the KV database
let network_name = await VIP_API_ASN.get(visitor_asn)
// Create the HTTP header value
let is_vip = (network_name !== null)