Skip to content

Instantly share code, notes, and snippets.

@aaronhoffman
aaronhoffman / Program.cs
Last active April 26, 2018 12:23
Custom Azure WebJob TraceWriter For SQL Server
static void Main()
{
var config = new JobHostConfiguration();
// Log Console.Out to SQL using custom TraceWriter
// Note: Need to update default Microsoft.Azure.WebJobs package for config.Tracing.Tracers to be exposed/available
config.Tracing.Tracers.Add(new SqlTraceWriter(
TraceLevel.Info,
"{{SqlConnectionString}}",
"{{LogTableName}}"));
@epixoip
epixoip / 8x1080.md
Last active March 20, 2024 17:14
8x Nvidia GTX 1080 Hashcat Benchmarks

String interpolation

var x = 1;

// same as string.Format("A {0} B", x) 
var y1 = $"A {x} B"; // y == "A 1 B"

// $@ for multiline
var y2 = $@"A
public class EmtpyStatementRemoval : CSharpSyntaxRewriter
{
public override SyntaxNode VisitEmptyStatement(EmptyStatementSyntax node)
{
//Simply remove all Empty Statements
return null;
}
}
public static void Main(string[] args)
@contensis
contensis / mime_type_configuration.xml
Last active October 1, 2020 08:29
How to configure MIME types within web.config.
<?xml version="1.0"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".vtt" mimeType="text/vtt" />
<mimeMap fileExtension=".srt" mimeType="text/srt" />
<mimeMap fileExtension=".aac" mimeType="audio/aac" />
<mimeMap fileExtension=".oga" mimeType="audio/ogg" />
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
<mimeMap fileExtension=".webm" mimeType="video/webm" />
@richardkundl
richardkundl / BloomFilter.cs
Created January 7, 2014 14:29
Bloom filter implementation in c#.
namespace BloomFilter
{
using System;
using System.Collections;
/// <summary>
/// Bloom filter.
/// </summary>
/// <typeparam name="T">Item type </typeparam>
public class Filter<T>
using System.Collections.Generic;
using System.Drawing;
using MonoTouch.CoreAnimation;
using MonoTouch.CoreGraphics;
using MonoTouch.Foundation;
using MonoTouch.ImageIO;
using MonoTouch.UIKit;
namespace PuppyKittyOverflow.Touch
{
// <copyright file="LeastRecentlyUsedCache.cs" company="http://www.sinbadsoft.com">
// Copyright (c) Chaker Nakhli 2013
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
// License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
// applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
// governing permissions and limitations under the License.
// </copyright>
// <author>Chaker Nakhli</author>
// <email>Chaker.Nakhli@sinbadsoft.com</email>
@jamietre
jamietre / MethodInfoExtensions
Last active January 7, 2023 06:20
GetSignature extension for PropertyInfo and MethodInfo: returns the detailed method/property signature by reflection
public static class MethodInfoExtensions
{
/// <summary>
/// Return the method signature as a string.
/// </summary>
///
/// <param name="property">
/// The property to act on.
/// </param>
///
@CodesInChaos
CodesInChaos / ArrayHelpers.cs
Created July 25, 2012 12:43
Base58 encoding in C# (Used for BitCoin addresses)
using System;
using System.Diagnostics.Contracts;
using System.Linq;
namespace Merkator.Tools
{
public class ArrayHelpers
{
public static T[] ConcatArrays<T>(params T[][] arrays)
{