Skip to content

Instantly share code, notes, and snippets.

View radleta's full-sized avatar

Richard Adleta radleta

View GitHub Profile
@radleta
radleta / How CLAUDE.md Works in Claude Code.md
Last active September 20, 2025 06:53
How CLAUDE.md Works in Claude Code

How CLAUDE.md Works in Claude Code

This document explains the mechanics of how CLAUDE.md files function in Claude Code, based on empirical testing and research.

Key Findings

1. Session-Based Content Loading

  • All CLAUDE.md files are refreshed between sessions - both root and directory-specific files pick up changes when resuming
  • NOT refreshed during conversation - changes made during an active session aren't visible until a new conversation starts
  • Resuming a session loads updated content - exiting and resuming Claude Code will pick up all CLAUDE.md changes
@radleta
radleta / LogOffDiscUser.ps1
Created February 12, 2025 13:37
Logs off a disconnected user session from a remote server.
<#
.SYNOPSIS
Logs off a disconnected user session from a remote server.
.DESCRIPTION
This script retrieves the session list from a specified remote server,
parses the session information, and logs off the specified user if their
session is found to be disconnected.
.PARAMETER server
@radleta
radleta / ListRolesAndGroupsForUser.sql
Created March 27, 2020 13:57
List all the groups and permissions assigned to a user in SQL Server.
select
[principal_id]
, [name]
, [type_desc]
, is_member(name) as [is_member]
from [sys].[server_principals]
where [type] in ('R','G')
order by [is_member] desc,[type],[name]
Emoji Description Shortcut
Smiley (smile)
Big smile (laugh)
Heart (heart)
Kiss (kiss)
Sad (sad)
Smiley with tongue out (tongueout)
Winking (wink)
Crying (cry)
In love (inlove)
@radleta
radleta / CountTwoLevelReduce.js
Last active December 3, 2019 14:57
The map and reduce functions for Couchbase view to count the number of documents set to expire on a specific number of days from today by their key prefix with two levels.
function (keys, values, rereduce) {
var result = {};
if (rereduce) {
values.forEach(function (firstIndex) {
for (var firstKey in firstIndex) {
// try to get the result associated with this key
var firstResult = result[firstKey];
@radleta
radleta / Map.js
Last active December 2, 2019 15:58
The map and reduce functions for a Couchbase view to show the stats on the size of the documents in a bucket grouped by the key prefix when it is either an underscore or colon.
function (doc, meta) {
// calculate the size of the document
var size;
if (meta.type == "json") {
size = JSON.stringify(doc).length;
} else if (meta.type == "base64") {
size = decodeBase64(doc).length;
}
@radleta
radleta / Map.js
Last active November 26, 2019 19:40
The map and reduce functions for Couchbase View to count the prefix of a cache key separated with an underscore.
function (doc, meta) {
var firstSeparator = meta.id.indexOf('_');
if (firstSeparator > -1) {
var firstKeyPart = meta.id.substring(0, firstSeparator);
emit(firstKeyPart, null);
} else {
emit('n/a', null);
}
}
@radleta
radleta / IEnumerableExtensions.cs
Created November 18, 2019 14:00
Useful extensions for C#.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RichardAdleta
{
public static class IEnumerableExtensions
@radleta
radleta / AsyncLockCookie.cs
Created November 18, 2019 13:55
Ensures exclusive execution of an async method.
using Nito.AsyncEx;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace RichardAdleta
{
/// <summary>
/// The cookie that holds an <see cref="Lock"/> with an <see cref="Completed"/>. The <see cref="Intialized"/> property
/// is set when <see cref="Completed"/> is already initailized.
@radleta
radleta / AsyncTimer.cs
Created November 18, 2019 13:53
A thread safe wrapper for the Timer to ensure only one callback is executing at a time. This prevents long running callbacks from overlapping their execution. Also, provides a wrapper to ensure exceptions are properly logged when they are thrown from the callback.
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace RichardAdleta
{
/// <summary>
/// A thread safe wrapper for the <see cref="Timer"/> to ensure only one callback is executing at a time.