Skip to content

Instantly share code, notes, and snippets.

View Sothatsit's full-sized avatar
🎲
Just solved the Royal Game of Ur

Padraig X. Lamont Sothatsit

🎲
Just solved the Royal Game of Ur
View GitHub Profile

You are an AI assistant tasked with implementing features based on a planning specification document. Your goal is to execute the implementation following the roadmap and requirements laid out in the specification.

Core Principles

  1. Follow the Plan: The specification is your north star. Implement features according to the roadmap and requirements provided.

  2. Maintain Quality: Write production-ready code that follows project conventions and best practices mentioned in the specification.

  3. Be Systematic: Work through the implementation stages methodically, completing each stage before moving to the next.

You are an AI assistant tasked with creating well-structured planning specification documents for feature requests, bug reports, or improvement ideas. Your goal is to turn the provided feature description into a comprehensive specification document that follows best practices and project conventions.

Here is the feature description for you to create the specification document for: <feature_description> #$ARGUMENTS </feature_description>

Here are the steps you need to take to produce the specification document: FOLLOW ALL STEPS. Make a todo list and ultrathink:

@Sothatsit
Sothatsit / Clamp.java
Last active July 6, 2022 06:49
Clamp Java floats and doubles, and correctly consider -0.0 and +0.0
/**
* An over-the-top implementation of clamp that correctly
* considers -0.0 and +0.0 bounds for floating point numbers.
*
* @author Padraig Lamont, 2021
*/
public class Clamp {
// Use raw bit-wise conversions on guaranteed non-NaN values.
private static final long negativeZeroFloatBits = Float.floatToRawIntBits(-0.0f);
@Sothatsit
Sothatsit / fix_usb.sh
Created July 30, 2021 06:43
Reset all USB devices, and move all dangling audio streams to re-connected external Schitt Modi DAC.
#!/bin/bash
if [[ $EUID != 0 ]] ; then
echo This must be run as root!
exit 1
fi
# Reset USB devices.
for xhci in /sys/bus/pci/drivers/?hci_hcd ; do
@Sothatsit
Sothatsit / IntArrayDiff.java
Created January 12, 2018 08:33
I tried to make an array diff function. It doesn't work very fast when the arrays get large...
public static void main(String[] args) {
System.out.println("\nchange");
diff(new int[] {1, 1, 1, 4, 5},
new int[] {1, 1, 1, 6, 5});
System.out.println("\nadd");
diff(new int[] {1, 1, 1, 4, 5},
new int[] {1, 1, 1, 6, 4, 5, 4, 5, 6});
System.out.println("\nremove");