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
| import sql, { config, ConnectionPool } from "mssql"; | |
| import dotenv from "dotenv"; | |
| import { DefaultAzureCredential } from "@azure/identity"; | |
| dotenv.config(); | |
| async function getConfig(): Promise<config> { | |
| const credential = new DefaultAzureCredential(); | |
| const tokenResponse = await credential.getToken("https://database.windows.net/.default"); |
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
| " =================================================== | |
| " Misc settings | |
| " =================================================== | |
| set tabstop=2 " Show existing tab with 2 spaces width | |
| set shiftwidth=2 " when indenting with '>', use 2spaces width | |
| set noswapfile " Disable swapfiles | |
| set autoread " Autoread external changes | |
| set number " Enable numbered lines |
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
| // Copyright (c) Microsoft. All rights reserved. | |
| using System.ComponentModel; | |
| using Microsoft.SemanticKernel; | |
| namespace Plugins; | |
| public class MathPlugin | |
| { | |
| [KernelFunction, Description("Take the square root of a number")] |
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
| using Microsoft.Extensions.DependencyInjection; | |
| using Microsoft.SemanticKernel; | |
| var kernelBuilder = Kernel.CreateBuilder() | |
| .AddOpenAIChatCompletion( | |
| modelId: "ollama-model-name" | |
| apiKey: "can-be-what-ever"); | |
| kernelBuilder.Services.ConfigureHttpClientDefaults(e => | |
| e.ConfigurePrimaryHttpMessagehandler(() => new ExampleRedirectHandler())); |
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
| open FSharp.Data | |
| open System.Globalization | |
| [<Literal>] | |
| let ResolutionFolder = __SOURCE_DIRECTORY__ | |
| // Schema can also be set to "" if you want it to auto generate | |
| // column names similar to: Column1, Column2 | |
| type TargetCSV = CsvProvider< | |
| "./test.csv", |
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
| using System.ComponentModel.DataAnnotations; | |
| namespace DotnetConsoles.Configuration.Api; | |
| public class ApiSettings | |
| { | |
| [Required, Url, MinLength(10), ] | |
| public string WebhookUrl { get; set; } = null!; | |
| [Required, MinLength(3)] |
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
| Get-ChildItem -Recurse -File | | |
| Group-Object Length | | |
| Where-Object { $_.Count -gt 1 } | | |
| select -ExpandProperty group | | |
| foreach { Get-FileHash -LiteralPath $_.FullName } | | |
| group -Property hash | | |
| where { $_.count -gt 1 } | | |
| select -ExpandProperty group |
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
| Get-ChildItem -Path HKLM:\System\Setup\Source* | ForEach-Object {Get-ItemProperty -Path Registry::$_} | Select-Object ProductName, ReleaseID, CurrentBuild, @{n="Install Date"; e={([DateTime]'1/1/1970').AddSeconds($_.InstallDate)}} | Sort-Object "Install Date" |
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
| func_gitprune() { | |
| echo 'Starting git prune' | |
| echo "Found $(git branch | wc -l) number of local branches" | |
| echo "Starts prune of origin branches...." | |
| git remote prune origin | |
| echo "Local branches which can be removed:" | |
| git branch -vv | grep 'origin/.*: gone]' | awk '{print $1}' |
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
| Network troubleshooting | |
| 1. Check /etc/sysctl.conf | |
| Specifically: | |
| * net.core.netdev_max_backlog | |
| * net.core.rmem_max | |
| * net.core.rmem_default | |
| Example values for default: | |
| * net.core.netdev_max_backlog = 1000 | |
| * net.core.rmem_max = 131071 | |
| * net.core.rmem_default = 163480 |
NewerOlder