Skip to content

Instantly share code, notes, and snippets.

View paulvanbladel's full-sized avatar

paul van bladel paulvanbladel

View GitHub Profile
@karenpayneoregon
karenpayneoregon / Create1.bat
Last active April 16, 2024 18:03
Provides a Windows batch file to generate a Visual Studio solution with benefits
@echo off
:: ------------------------------------------------------------
:: create a solution with a razor pages project and a class library
:: add Serilog packages and EF Core
:: add virtualization folders
:: add a readme.md file
:: NOTE that the Nuget packages are the latest versions as of 07-2023
:: ------------------------------------------------------------
md RazorSolution
@karenpayneoregon
karenpayneoregon / Program.cs
Last active January 18, 2024 05:58
Get all pages
public class Program
{
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
SetupLogging.Development();
builder.Services.AddRazorPages(op =>
{
*****OBJECTIVE*****
Develop World Peace and Harmony that improves the Quality of life for humans, animals and our planet
Initial task: Develop a task list
*****TASK LIST*****
1: Develop a task list
*****NEXT TASK*****
1: Develop a task list
*****OBJECTIVE*****
Develop World Peace and Harmony that improves the Quality of life for humans, animals and our planet
from langchain.llms import Anthropic
from langchain.agents import load_tools, initialize_agent
from langchain.tools import AIPluginTool
PREFIX = """\n\nHuman: Answer the following questions as best you can. You have access to the following tools:"""
SUFFIX = """Begin!
Question: {input}
\n\nAssistant:
Thought:{agent_scratchpad}"""
@rain-1
rain-1 / LLM.md
Last active May 5, 2024 07:13
LLM Introduction: Learn Language Models

Purpose

Bootstrap knowledge of LLMs ASAP. With a bias/focus to GPT.

Avoid being a link dump. Try to provide only valuable well tuned information.

Prelude

Neural network links before starting with transformers.

@akhansari
akhansari / EsBankAccount.cs
Last active March 9, 2024 08:53
C# prototype of the Decider pattern. (F# version: https://github.com/akhansari/EsBankAccount)
namespace EsBankAccount.Account;
using Events = IReadOnlyCollection<IEvent>;
public record Transaction(decimal Amount, DateTime Date);
// events
public interface IEvent { } // used to mimic a discriminated union
public record Deposited(Transaction Transaction) : IEvent;
public record Withdrawn(Transaction Transaction) : IEvent;
using System;
using System.Threading.Tasks;
namespace System.Collections.Concurrent
{
public static class ConcurrentDictionaryExtensions
{
/// <summary>
/// Provides an alternative to <see cref="ConcurrentDictionary{TKey, TValue}.GetOrAdd(TKey, Func{TKey, TValue})"/> that disposes values that implement <see cref="IDisposable"/>.
/// </summary>
@enijburg
enijburg / CreateAppInAAD.ps1
Last active October 13, 2023 08:55
Add App registration to Azure Active Directory (AAD) through CLI
#The display name of the application.
$appName = "BlazorTest1"
#Space-separated URIs to which Azure AD will redirect in response to an OAuth 2.0 request. The value does not need to be a physical endpoint, but must be a valid URI.
$replyUrl = "https://localhost:44324/authentication/login-callback"
#Get the appId of Microsoft Graph
$graphId = az ad sp list --query "[?appDisplayName=='Microsoft Graph'].appId | [0]" --all
#Get the id of the User.Read permission in the Graph
$userRead = az ad sp show --id $graphId --query "oauth2Permissions[?value=='User.Read'].id | [0]"
@SteveSandersonMS
SteveSandersonMS / blazor-auth.md
Created June 11, 2019 10:49
Blazor authentication and authorization

Authentication and Authorization

Authentication means determining who a particular user is. Authorization means applying rules about what they can do. Blazor contains features for handling both aspects of this.

It worth remembering how the overall goals differ between server-side Blazor and client-side Blazor:

  • Server-side Blazor applications run on the server. As such, correctly-implemented authorization checks are both how you determine which UI options to show (e.g., which menu entries are available to a certain user) and where you actually enforce access rules.
  • Client-side Blazor applications run on the client. As such, authorization is only used as a way of determining what UI options to show (e.g., which menu entries). The actual enforcement of authorization rules must be implemented on whatever backend server your application operates on, since any client-side checks can be modified or bypassed.

Authentication-enabled templates for Server-Side Blazor