Skip to content

Instantly share code, notes, and snippets.

View clarkmcc's full-sized avatar

Clark McCauley clarkmcc

View GitHub Profile

Keybase proof

I hereby claim:

  • I am clarkmcc on github.
  • I am shardblade (https://keybase.io/shardblade) on keybase.
  • I have a public key whose fingerprint is 2E6B 9202 AFE9 1B1B 1D9A 024C AA8A FADB 0CC6 2973

To claim this, I am signing this object:

@clarkmcc
clarkmcc / use-query-params.ts
Created May 3, 2022 14:45
A React hook to store and retrieve JSON values to the query parameters using React Router v6
import { useSearchParams } from "react-router-dom";
import { useCallback, useEffect } from "react";
import { isFunction } from "lodash";
/**
* Setter represents a type that can be passed to the setter function returned
* from this hook. It can either accept a value to set, or a callback function
* with access to the current value.
*
* @example
@clarkmcc
clarkmcc / model.rs
Created May 20, 2023 03:58
In trying to wrap my head around the basics of machine learning, this example really helped me to get a small taste for how machine learning frameworks like TensorFlow work their magic under the hood.
use rand::random;
/// In this example, we'll attempt to train a single-neuron model to fit
/// a linear line. The slope of this line is 2, and can by expressed by
/// the equation y = 2x. We'll use gradient descent to find the slope of
/// the line, and then we'll use the slope to predict the output for
/// a given input.
///
/// The model won't be able to perfectly fit the line, but it will be
/// able to get very close. The idea here is we want the model to be
@clarkmcc
clarkmcc / scale-tensorflow-rust.go
Created October 16, 2023 13:35
Decoding and running a Scale function
sf := new(scalefunc.Schema)
err := sf.Decode(model)
if err != nil {
panic(err)
}
s, err := scale.New(scale.NewConfig(signature.New).WithFunction(sf))
if err != nil {
panic(err)
}
instance, err := s.Instance()
@clarkmcc
clarkmcc / openapi.yaml
Created July 22, 2024 20:16
HP SDS JetAdvantage Management Connector OpenAPI Spec
swagger: '2.0'
info:
version: v1
title: HP JetAdvantage Management Connector
host: 'localhost:12350'
schemes:
- http
paths:
'/api/credentials/{deviceId}':
get:
@clarkmcc
clarkmcc / statusline.sh
Created June 2, 2026 21:30
Claude statusline
#!/usr/bin/env bash
# ~/.claude/statusline.sh
# Claude Code status line — polished dev-tool aesthetic
input=$(cat)
# ── Parse JSON fields ────────────────────────────────────────────────────────
cwd=$(echo "$input" | jq -r '.workspace.current_dir // .cwd // ""')
model=$(echo "$input" | jq -r '.model.display_name // ""')
used_pct=$(echo "$input" | jq -r '.context_window.used_percentage // empty')