Skip to content

Instantly share code, notes, and snippets.

@ljw1004
ljw1004 / ValueTask_GetNextByteAsync.cs
Created July 21, 2016 17:53
Simple example of async ValueTask
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
class Program
{
static void Main()
{
@ljw1004
ljw1004 / tuple_perf.cs
Created April 20, 2017 15:02
Perf comparison ValueTuple vs Tuple vs KeyValuePair
// TUPLE MICRO-BENCHMARKS, based on https://www.dotnetperls.com/tuple-keyvaluepair
//
// Tuples are generally fastest.
// ValueTuple is fastest in the particular case of GetHashCode.
// KeyValuePair is always worst.
//
//
// RAW RESULTS
// Numbers in milliseconds (lower is better)
//
@ljw1004
ljw1004 / you_are_not_right.sh
Last active August 7, 2025 19:18
A UserPromptSubmit hook for Claude Code to stop it saying "You're right"
#!/bin/bash
set -euo pipefail
trap 'echo "at line $LINENO, exit code $? from $BASH_COMMAND" >&2; exit 1' ERR
# This is a Claude Code hook to stop it saying "you are right".
#
# Installation:
# 1. Save this script and chmod +x it to make it executable.
# 2. Within Claude Code, /hooks / UserPromptSubmit > Add a new hook (this file)
#