Skip to content

Instantly share code, notes, and snippets.

@sheastrickland
sheastrickland / DbUp.csproj
Created April 29, 2014 06:28
DbUp Compile error for SQL scripts which are not embedded
<Target Name="AfterBuild">
<Message Text="@(Content)" Importance="high" Condition="%(Content.Extension) == '.sql'" />
<Error Condition="%(Content.Extension) == '.sql'" Text="Nothing should be marked as Content, check your scripts are marked as Embedded Resource" />
</Target>
@damianh
damianh / RequestIdMiddleware.cs
Created May 28, 2014 13:09
Owin Request Id middlware
namespace Owin
{
using System;
using System.Globalization;
using System.Threading;
using AppFunc = System.Func<System.Collections.Generic.IDictionary<string, object>, System.Threading.Tasks.Task>;
using MidFunc = System.Func<
System.Func<System.Collections.Generic.IDictionary<string, object>, System.Threading.Tasks.Task>,
System.Func<System.Collections.Generic.IDictionary<string, object>, System.Threading.Tasks.Task>
>;
var ClientSecret = "kSRsdf7rU323rf2ff2gfdssfdAnKI1mcOf98djfidIGx38="; // A key you add for your AAD app.
var ClientId = "17dfab36-1c33-4ffe-9ddd-533ddddfs378"; // The unique identifier for your AAD app..
var userObjectId = "12345667-1234-1234-1234-123412341234"; // LET'S SAY YOU WANNA GET A USER'S GROUPS... You'll need their ObjectId for querying later.
var authority = "https://login.microsoftonline.com/{tenant guid}/oauth2/authorize?api-version=1.0"; // This is the "OAuth Authorize" Endpoint for your AAD app.
var authContext = new AuthenticationContext(authority);
// Graph endpoint comes from Azure Portal "Graph Connection Endpoint"
var client = new ActiveDirectoryClient(new Uri("https://graph.windows.net/{tenant guid}"), () =>
using System;
using System.Linq;
using Conventional;
using Conventional.Conventions;
namespace ConventionTests
{
public class PropertyNamesOfTypeMustEndWith : ConventionSpecification
{
private readonly Type _type;
@AntonMiles
AntonMiles / dockerfile
Created July 15, 2017 15:04
Creating A .NET Windows Docker Container With Internal IIS SSL (From PFX File) and HTTPS Support
# The following won't work as-is, I use '<>' to denote variables you need to replace, including a name so you can keep them straight!
# A list of all of them, for searching follows.
# app_directory
# app_name
# ssl_password
# ssl_name
#base machine is meant to contain IIS as well as asp/.net requirements
FROM microsoft/aspnet
#Expose port 443 to allow incoming traffic over the default HTTPS port
@jongalloway
jongalloway / aspnetcore-one-hour-makeover.md
Last active April 30, 2022 08:24
ASP.NET Core One Hour Makeover
@sibu-github
sibu-github / convertToCamelCase.js
Last active February 7, 2019 01:16
convert a JSON keys to camel case
// convert a key string to camelcase
function toCamelCase(str) {
// when str is not define reuturn
if (!str) {
return str;
}
let letters = str.split("");
let idx = letters.indexOf("_");
while (idx > -1) {
@lizthegrey
lizthegrey / attributes.rb
Last active February 24, 2024 14:11
Hardening SSH with 2fa
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam'
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes'
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no'
@richlander
richlander / share-the-love.md
Last active July 20, 2021 16:53
.NET Core 3.0 -- Post Launch Blog Posts

.NET Core 3.0 -- Post Launch Blog Posts

We launched .NET Core 3.0! Go team! The super official blog post covered a lot of features, but none of them at depth. Many people will want to learn more about specific scenarios at features at much greater depth, with more guidance and better code samples.

The following is a list of proposed posts (with descriptive but prelimary titles) for us to write and publish during the rest of 2019.

Note: This tweet also has feedback.

Getting Started

// node --experimental-repl-await ./repl.js
// OLD API (See below for a newer one)
const repl = require('repl');
const playwright = require('playwright');
const config = {
headless: false,
args: [
// https://tink.uk/playing-with-the-accessibility-object-model-aom/
'--enable-blink-features=AccessibilityObjectModel',
],