Skip to content

Instantly share code, notes, and snippets.

View MarneeDear's full-sized avatar
📻
You can't stop the signal.

Marnee Dearman (KG7SIO) MarneeDear

📻
You can't stop the signal.
View GitHub Profile
@MarneeDear
MarneeDear / Explanations.md
Created March 19, 2020 21:23
Understanding AspNetCore 3.0 vs AspNetCore 2.x

afaik, almost all of Microsofr.AspNetCore.* assemblies will live within Microsoft.NET.Sdk.Web, unfortunately the Microsoft.Extensions.* packages still live as separate nuget.

that's normal
Msft.Extensions.* were always separated from Msft.AspNetCore.* because they are "USED" by AspNetCore but are not part of it : DependencyInjection / Logging / Configurations / Options are good examples.
See how they are targeting netstandard2.0 you can use it in your old stack like Owin / Xamarin ... (kinda great for Logging / Options)

I'm still seeing app the Microsoft.AspNetCore packages on nuget are 2.2

@MarneeDear
MarneeDear / luhn.fsx
Last active May 10, 2019 01:32
Luhn Aglorithm in F#
// C# example on Wikipedia here https://en.wikipedia.org/wiki/Luhn_algorithm#C#
//Find exmaple credit card numbers here https://www.freeformatter.com/credit-card-number-generator-validator.html
let ccNbr = "5181789570841591" //Master Card
let digits = (string ccNbr).ToCharArray() |> Array.rev
printfn "%A" digits
let mutable sum = 0
//let mutable n =
let mutable alternate = false
for d in digits do //i in [0 .. digits.Length - 1] do
let mutable tmp = int (d.ToString())
(*
Am I doing this right?
*)
//How to do setup custom DataProtectorTokenProvider options?
//The guide talks about how to do this for the email token
//https://docs.microsoft.com/en-us/aspnet/core/security/authentication/accconfirm?view=aspnetcore-2.2&tabs=visual-studio#change-the-email-token-lifespan
//The C# version from the ASPNET guide linked above
public class CustomEmailConfirmationTokenProvider<TUser>
@MarneeDear
MarneeDear / dataProtectionSercicesConfig.fs
Last active April 19, 2019 17:38
Configure DataProtectionTokenProviderOptions in F# (using Saturn)
//How do I configure the DataProtectionTokenProviderOptions in F#?
//Following the guide here: https://docs.microsoft.com/en-us/aspnet/core/security/authentication/accconfirm?view=aspnetcore-2.2&tabs=visual-studio#change-email-and-activity-timeout
//This is the code in C#
public void ConfigureServices(IServiceCollection services)
{
services.Configure<DataProtectionTokenProviderOptions>(o =>
o.TokenLifespan = TimeSpan.FromHours(3));
}
//In my MVC apps I put this in the Startup.Auth file
//Inside
//public void ConfigureAuth(IAppBuilder app)
var edsClient =
new DirectoryServices.EdsClient(appSettings["Eds.Server.Url"], appSettings["Eds.Username"],
appSettings["Eds.Password"]) as Interfaces.IEdsClient;
var casOptions = new CasAuthenticationOptions
{
@MarneeDear
MarneeDear / Event-stream based GraphQL subscriptions.md
Created June 15, 2017 21:20 — forked from OlegIlyenko/Event-stream based GraphQL subscriptions.md
Event-stream based GraphQL subscriptions for real-time updates

In this gist I would like to describe an idea for GraphQL subscriptions. It was inspired by conversations about subscriptions in the GraphQL slack channel and different GH issues, like #89 and #411.

Conceptual Model

At the moment GraphQL allows 2 types of queries:

  • query
  • mutation

Reference implementation also adds the third type: subscription. It does not have any semantics yet, so here I would like to propose one possible semantics interpretation and the reasoning behind it.

Data Science Meetup: The Github Graph

@MarneeDear
MarneeDear / graph_gist_template.adoc
Created January 27, 2017 05:49 — forked from jexp/graph_gist_template.adoc
CHANGEME: GraphGist Template. Fork to make your own, view source to see instruction comments

REPLACEME: TITLE OF YOUR GRAPHGIST

Introduction

@MarneeDear
MarneeDear / py2neo_nodes_rels.py
Last active February 1, 2018 16:59
py2neo v3 create nodes and relationships
from py2neo import Node, Graph, Relationship, PropertyDict
from db.types import GraphLabel, GraphRelationship
graph_url = 'http://localhost:7474/db/data/'
graph_db = Graph(graph_url)
# delete everything
graph_db.delete_all()
@MarneeDear
MarneeDear / gist:5a9ff0c9185f1dbfa9f7
Last active August 29, 2015 14:20
Find CQs for a date
Find CQs for a date
match (d:Day {day:1})<-[on:ON]-(cq:CQ)<-[s:SENT]-(u:USER)
return d, on, cq, s, u
Get the full calendar graph
match (calendar)-[:YEAR]->(y)-[:MONTH]->(m)-[:DAY]->(d:Day {day:1})<-[on:ON]-(cq:CQ)<-[s:SENT]-(u:USER)
return u, s, cq, on, d, m, y, calendar