Skip to content

Instantly share code, notes, and snippets.

View nathggns's full-sized avatar

Nate Higgins nathggns

View GitHub Profile
@nathggns
nathggns / edit_artefact_schema_check.py
Created March 4, 2026 09:15
edit_artefact schema conformance eval for #2125
#!/usr/bin/env python3
"""
Measure how often the edit_artefact prompt produces output that _normalize_diffs can parse.
Runs the prompt N times in parallel with the exact inputs from the #2125 bug report trace,
then checks each output for JSON validity and schema conformance.
Usage:
uv run python -m evals.scripts.edit_artefact_schema_check [--runs N]
"""
@nathggns
nathggns / keybase.md
Created December 9, 2019 16:09
keybase proof

Keybase proof

I hereby claim:

  • I am nathggns on github.
  • I am nathggns (https://keybase.io/nathggns) on keybase.
  • I have a public key ASBV3YWIoDIwLrDm90x-rjghaPiWU0bk6khGxpp-uFKAHAo

To claim this, I am signing this object:

@nathggns
nathggns / README.md
Created April 4, 2019 15:57
Break into Twitter's A/B test of their new website

Twitter has started testing a new desktop website based on their mobile website that should be a faster experience.

If you're not lucky enough to be included in this A/B test, you can "break" into it by setting the rweb_optin cookie to on.

You can do that by pasting the following URL into your browser's address bar while you're logged-in on https://twitter.com.

javascript:document.cookie%3D'rweb_optin%3Don%3B%20expires%3D01%2F12%2F2019%3B%20path%3D%2F%3B'%3Bwindow.location.reload()%3B
@nathggns
nathggns / mock.ts
Last active September 22, 2018 13:52
type JestFNs<T> = { [P in keyof T]: jest.MockInstance<any> };
type Mocked<T> = JestFNs<T> & { reset(): void };
export type Mock<T> = T & { mock: Mocked<T> };
export default function mock<T extends any>(
inst: Partial<T> = {} as any
): Mock<T> {
const target = {} as any;
const proxy = new Proxy(target, {
get(target: any, key: string) {
@nathggns
nathggns / union.pl
Created August 22, 2017 21:52
Prolog to create union of two lists without unifying non-ground terms
myUMember(X, [Y|T]) :- X == Y; myUMember(X, T).
myU([X|Y],Z,W) :-
myUMember(X,Z),
!,
myU(Y,Z,W).
myU([X|Y],Z,[X|W]) :- myU(Y,Z,W).
myU([],Z,Z).
@nathggns
nathggns / bridge.js
Created July 18, 2017 19:39
Applescript (JXA) code to get a list of notifications
#!/usr/bin/env osascript -l JavaScript
const NC_HIDDEN_POSITION = [99999, 99999];
class NotificationCenterBridge {
constructor() {
this.systemEvents = Application('System Events');
this.uiServer = this.systemEvents.applicationProcesses.byName('SystemUIServer');
this.notificationCentre = this.systemEvents.processes.byName('Notification Center');
this.notificationTable = this.notificationCentre.windows.byName('NotificationTableWindow');
@nathggns
nathggns / results2017.json
Last active June 14, 2017 22:50
Results of the 2017 UK General Election scraped from BBC.
{
"Aberavon": [
{
"name": "(LAB)",
"votes": 22662,
"share": 68.1
},
{
"name": "(CON)",
"votes": 5901,
@nathggns
nathggns / README.md
Last active December 16, 2016 19:45
Two implementations of quick sort in C

Included in this gist are two C implementations of Quicksort. One designed to work with pointers, and one with arrays.

These were created for educational purposes and should not be used in production. Any suggestions on improvements would be vastly appreciated.

TodoMVC React

@nathggns
nathggns / enum.babel.js
Created August 4, 2015 14:51
Mini enum-like solution. Probably not all that useful;
import { invert, assign, object } from 'lodash';
class Enum {
// Should probably look into using a Symbol for this instead??
static privateKey = '_private';
constructor(map) {
const inverted = invert(map);
const keys = Object.keys(map);