Skip to content

Instantly share code, notes, and snippets.

View stephenpatten's full-sized avatar

Stephen Patten stephenpatten

View GitHub Profile
@nrbray
nrbray / find_gits
Last active March 30, 2021 17:12
Find git repositories having a workdir - a wrapper arround find $ARGV[0] 'HEAD', modified from locate -br '^HEAD$'
#!/usr/bin/perl
# Copyright 2012, Dee Newcum. License: GPL v3.
# NRB: Original at <https://github.com/DeeNewcum/dotfiles/blob/master/bin/lsgit>
# NRB: Modified 2019-09-04, Nigel Bray [NRB]
# NRB: Forked at <https://gist.github.com/nrbray/a0ae8ec59d1fd1ae03e2947368096d2e>
# NRB: Alternative described at <https://stackoverflow.com/a/2778066/9113089> <https://pypi.org/project/uncommitted/>
# A wrapper around:
# ```` locate -br '^HEAD$'````
@damianh
damianh / CookieMessageHandler.cs
Created April 28, 2018 11:43
HttpMessageHandler for dealing with cookies in requests.
public class CookieMessageHandler : DelegatingHandler
{
private readonly CookieContainer _cookies = new CookieContainer();
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
request.Headers.Add("Cookie", _cookies.GetCookieHeader(request.RequestUri));
var response = await base.SendAsync(request, cancellationToken).ConfigureAwait(false);
Initialize the logger in the constructor:
class SomethingAbstract
{
protected ILogger Log { get; }
protected SomethingAbstract()
{
Log = Log.ForContext(GetType());
}
@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.*;
@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;
@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
{
@magnetikonline
magnetikonline / README.md
Last active January 29, 2025 06:06
NSSM - the Non-Sucking Service Manager cheatsheet.
@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;
@Chaser324
Chaser324 / GitHub-Forking.md
Last active April 20, 2025 17:10
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

@EdCharbeneau
EdCharbeneau / Enable-Transformations.md
Last active May 6, 2024 11: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