This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env dotnet | |
| #:sdk [email protected] | |
| #:property PublishAot=false | |
| #:package [email protected] | |
| #pragma warning disable ASPIRECSHARPAPPS001 | |
| using Microsoft.Extensions.Configuration; | |
| // To specify password/secrets: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <Project> | |
| <ItemGroup> | |
| <None Include="README.md" Pack="true" PackagePath="\"/> | |
| </ItemGroup> | |
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env dotnet | |
| #:sdk Microsoft.NET.Sdk.Web | |
| var builder = WebApplication.CreateBuilder(args); | |
| using var app = builder.Build(); | |
| app.UseHttpsRedirection(); | |
| app.MapGet("/", () => "Hello from A").RequireHost("a.dev.localhost"); | |
| app.MapGet("/", () => "Hello from B").RequireHost("b.dev.localhost"); | |
| app.MapGet("/", () => "Hello from Prod"); | |
| app.Run(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env dotnet | |
| Console.WriteLine("Hello, World!"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env dotnet | |
| #:sdk Microsoft.NET.Sdk.WebAssembly | |
| #:property OverrideHtmlAssetPlaceholders=true | |
| #:property AllowUnsafeBlocks=true | |
| #:property PublishAot=false | |
| // dotnet run Program.cs | |
| using System.Diagnostics; | |
| using System.Runtime.InteropServices.JavaScript; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var n = 10; | |
| var fib = new List<long> { 0, 1, }; | |
| for (var i = 2; i < n; i++) | |
| fib.Add(fib[i - 1] + fib[i - 2]); | |
| Console.WriteLine($"Fibonacci sequence up to {n} terms:"); | |
| Console.WriteLine(string.Join(", ", fib)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env dotnet | |
| #:package [email protected] | |
| #:property OutputType=Library | |
| #:property NativeLib=Shared | |
| #:property RuntimeIdentifier=win-x64 | |
| #:property AllowUnsafeBlocks=true | |
| // dotnet publish .\script.cs -o bin | |
| // %windir%\system32\rundll32.exe bin\script.dll,EntryA "HelloWorld.xlsx" | |
| // start HelloWorld.xlsx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env dotnet | |
| #:sdk Microsoft.NET.Sdk | |
| #:property OutputType=WinExe | |
| #:property TargetFramework=net10.0-windows | |
| // This program can be scheduled using Windows Task Scheduler. | |
| // Below are some example `schtasks` CLI commands to register tasks for `nightcurtain.exe`. | |
| // | |
| // 1. Enable color filter every night at 10:00 PM | |
| // schtasks /Create /TN "NightCurtain_Enable" /TR "C:\Path\To\nightcurtain.exe enable" /SC DAILY /ST 22:00 /F |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <Query Kind="Statements"> | |
| <NuGetReference Prerelease="true">Microsoft.SemanticKernel.Connectors.Ollama</NuGetReference> | |
| <Namespace>Microsoft.SemanticKernel</Namespace> | |
| <Namespace>Microsoft.Extensions.DependencyInjection</Namespace> | |
| <Namespace>Microsoft.Extensions.Logging</Namespace> | |
| <Namespace>Microsoft.SemanticKernel.ChatCompletion</Namespace> | |
| <Namespace>Microsoft.SemanticKernel.Connectors.Ollama</Namespace> | |
| <Namespace>System.Text.Json.Serialization</Namespace> | |
| <Namespace>System.ComponentModel</Namespace> | |
| <Namespace>System.Threading.Tasks</Namespace> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Package Required: Microsoft.EntityFrameworkCore.Relational | |
| // In this example, I am using the EF Core driver (Pomelo.EntityFrameworkCore.MySql) from the Pomelo Foundation Project to generate DDL for MariaDB. | |
| // However, you can also use any other driver you want (Microsoft SQL Server, Sqlite, Oracle, etc.). | |
| using System.ComponentModel.DataAnnotations; | |
| using Microsoft.EntityFrameworkCore; | |
| using Pomelo.EntityFrameworkCore.MySql; | |
| using Pomelo.EntityFrameworkCore.MySql.Infrastructure; |
NewerOlder