Skip to content

Instantly share code, notes, and snippets.

View dbeattie71's full-sized avatar

Derek Beattie dbeattie71

  • Nebraska
  • 15:40 (UTC -05:00)
View GitHub Profile
@dbeattie71
dbeattie71 / Program.cs
Created February 14, 2024 22:36 — forked from madcodemonkey/Program.cs
Generate SSRS report using WCF in .NET Core Application
using ServiceReference1;
using System;
using System.Collections.Generic;
using System.IO;
using System.ServiceModel;
using System.Threading.Tasks;
namespace SSRSSimple
{
class Program
public class AuthenticatingHandler<T> : DelegatingHandler where T : ISecurityTokenAccessor
{
private readonly Policy<HttpResponseMessage> _policy;
private readonly T _securityTokenAccessor;
private IAccessToken _accessToken;
private AuthenticationHeaderValue _authenticationHeader;
public AuthenticatingHandler(T securityTokenAccessor)
{
_securityTokenAccessor = securityTokenAccessor;
@dbeattie71
dbeattie71 / pipelinetest.cs
Created March 23, 2018 21:12 — forked from itn3000/pipelinetest.cs
System.IO.Pipelines tests
using System;
using System.Collections;
using System.Collections.Generic;
struct TestEnumerator<T> : IEnumerator<T>
{
ArraySegment<T> m_Segment;
public TestEnumerator(ref ArraySegment<T> seg)
{
m_Segment = seg;
}
@dbeattie71
dbeattie71 / Example1.cs
Created February 28, 2018 23:17 — forked from davidfowl/Example1.cs
How .NET Standard relates to .NET Platforms
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)
@dbeattie71
dbeattie71 / NntpDecompressingConnection.cs
Created December 8, 2017 20:07 — forked from keimpema/NntpDecompressingConnection.cs
A decompresing INntpConnection implementation (not very good)
using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Security;
using System.Net.Sockets;
using System.Threading;
using System.Threading.Tasks;
using ICSharpCode.SharpZipLib.Zip.Compression;
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
using Microsoft.Extensions.Logging;
public static class Coroutine {
public static void BeginExecute(IEnumerable<Promise> enumerable) {
MoveNext(enumerable.GetEnumerator());
}
static void MoveNext(IEnumerator<Promise> enumerator) {
if (enumerator.MoveNext()) {
var promise = enumerator.Current;
promise.Current = promise.Task();
promise.Current._CallBack = () => MoveNext(enumerator);
using System;
using System.Diagnostics;
using System.IO;
using System.IO.MemoryMappedFiles;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
namespace FileAnalyzer
{
public static unsafe class NativeRecord
using System;
using System.Diagnostics;
using System.IO;
using System.IO.MemoryMappedFiles;
namespace FileAnalyzer
{
public static unsafe class NativeRecord
{
private static readonly int[] DaysToMonth365 =
@dbeattie71
dbeattie71 / Dumper.cs
Created February 10, 2017 21:15 — forked from DTTerastar/Dumper.cs
Nice easy way of getting formatted C# like serialized text from object graphs. Nice to use for creating unit tests, or checking on intermediary values while debugging.
public static class DumperExtensions
{
public static string DumpToString(this object a, int maxDepth = 16, bool breakCircularRefs = false)
{
return new Dumper(a, maxDepth, breakCircularRefs).ToString();
}
public static T DumpToConsole<T>(this T a, int maxDepth = 16, bool breakCircularRefs = false)
{
Console.Out.WriteLine(DumpToString(a, maxDepth, breakCircularRefs));
@dbeattie71
dbeattie71 / DemoSetup.wixproj
Created January 9, 2017 16:49 — forked from dasMulli/DemoSetup.wixproj
Demo wix project to publish a self-contained .NET Core app
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>3.10</ProductVersion>
<ProjectGuid>91e4dc15-312a-4e90-bc1c-01de5dc99447</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>CoreConsoleAppSetup</OutputName>
<OutputType>Package</OutputType>