Skip to content

Instantly share code, notes, and snippets.

View stephenpatten's full-sized avatar

Stephen Patten stephenpatten

View GitHub Profile
@jboner
jboner / latency.txt
Last active May 10, 2026 17:58
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@bryanbarnard
bryanbarnard / SimpleHttpClient.cs
Created December 23, 2013 19:15
Simple C# .NET 4.5 HTTPClient Request Using Basic Auth and Proxy
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;
using System.Net;
namespace HTTP_Test
@EdCharbeneau
EdCharbeneau / Enable-Transformations.md
Last active September 19, 2025 10:44
How to enable transformations on build with Visual Studio

#Transform web.config on build

  1. Unload the project
  2. Edit .csproj
  3. Append figure 1 to the end of the file just before </Project>; v12.0 my change depending on your version of Visual Studio
  4. Save .csproj and reload
  5. Open configuration manager
  6. Add a new Configuration Name: Base. Copy settings from: Release
  7. Copy the contents of your web.config
  8. Right click Web.Config > Add Config Transformation
@Chaser324
Chaser324 / GitHub-Forking.md
Last active April 24, 2026 14:43
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

@sachin-handiekar
sachin-handiekar / SecureLoggingUtil.java
Last active October 5, 2020 14:47
Masking Sensitive Information in CXF Logging Interceptor for incoming/outgoing SOAP request. (http://www.sachinhandiekar.com/2014/11/cxf-logging-interceptor-masking.html)
package com.sachinhandiekar.examples.cxf.logging;
import java.io.ByteArrayInputStream;
import java.io.StringWriter;
import java.util.Arrays;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
@magnetikonline
magnetikonline / README.md
Last active April 28, 2026 11:29
NSSM - the Non-Sucking Service Manager cheatsheet.
@janpieterz
janpieterz / Program.cs
Created March 4, 2015 13:03
Serilog and Topshelf
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Serilog;
using Serilog.Extras.Topshelf;
using Topshelf;
using Topshelf.Logging;
namespace ConsoleApplication1
{
@jasonmitchell
jasonmitchell / AutofacValidatorFactory.cs
Last active March 14, 2023 05:24
Integrating Fluent Validation with Web API using Autofac. Full example: https://github.com/jasonmitchell/fluentvalidation-webapi-autofac
using System;
using Autofac;
using FluentValidation;
namespace Sample.Web.Infrastructure
{
public class AutofacValidatorFactory : ValidatorFactoryBase
{
private readonly IComponentContext _context;
@rickx1
rickx1 / CEAPIStreams.java
Last active May 30, 2020 13:11
Stream support for the FileNet Content Engine Java API. The GenerateCode.java file is used to generate the most part of the CEAPIStreams.java file. See http://ecmdeveloper.com/contentengine/java-8-ceapi/ for details.
package com.ecmdeveloper.jace.streams;
import java.util.Date;
import java.util.Iterator;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import com.filenet.api.admin.*;
import com.filenet.api.events.*;
import com.filenet.api.core.*;
Initialize the logger in the constructor:
class SomethingAbstract
{
protected ILogger Log { get; }
protected SomethingAbstract()
{
Log = Log.ForContext(GetType());
}