Skip to content

Instantly share code, notes, and snippets.

View tomhawkin's full-sized avatar

Tom Hawkin tomhawkin

View GitHub Profile
@tomhawkin
tomhawkin / Program.cs
Created February 13, 2026 18:08
C# port of MicroGPT
// This is a C# port of @karpathy microgpt python script (https://gist.github.com/karpathy/8627fe009c40f57531cb18360106ce95)
// It's the closest I could get using C#.
// Use with caution as it could be wrong, but it does seem to get similar outputs
namespace MicroGpt;
public class Value(double data, Value[]? children = null)
{
private readonly Value[] _children = children ?? [];
private Action _backward = () => { };
@tomhawkin
tomhawkin / GetDatasourceLocationWithQuery
Created June 1, 2015 15:44
A modified GetDatasourceLocationWithQuery class to enable Sitecore components to have datasources with relative paths to a folder in sitecore and a modified TreelistWithRelativePathsAndQuery class to enable relative paths in tree lists
// --------------------------------------------------------------------------------------------------------------------
// <summary>
// adds the the default query functionality to also get items under the current item by using './'
// or gets items relative to the root of the current site with 'fromroot:
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Site.Website.Processors
{
using System.Linq;
@tomhawkin
tomhawkin / .New Relic Processor
Created June 1, 2015 09:31
Sitecore New Relic Monitoring
// --------------------------------------------------------------------------------------------------------------------
// <summary>
// New Relic Http Module.
// Fixes the naming of (web) transactions in the New Relic dashboard.
// And fixes IIS request logging.
// original code taken from https://marketplace.sitecore.net/Modules/N/New_Relic.aspx?sc_lang=en
// but fixed to use the template name to identify items due to the new relic transaction limit being
// hit when using this with urls as the transaction name in large solutions
// </summary>
// --------------------------------------------------------------------------------------------------------------------
## Intro: Simple powershell script to install MongoDb as a service
## Note : These scripts require local admin priviliges!
$serviceName = "MongoDbTestService" #this is the name that windows uses to reference the service
$serviceDisplayName = "MongoDb - Test Service"
$port = "27017"
$projectName = "TestService"
$mongoDataDirectory = "C:\MongoDbData"
$mongodPath = "C:\MongoDB\bin"
$useAuth = $false