This file contains 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
curl -s https://api.github.com/repos/docker/compose/releases/latest | grep browser_download_url | grep -i "$(uname -s)-$(uname -m)" | cut -d '"' -f 4 | head -n 1 | xargs curl -L -o /usr/local/bin/docker-compose | |
chmod +x /usr/local/bin/docker-compose |
This file contains 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
#r "nuget: Confluent.Kafka" | |
#r "nuget: System.Text.Json" | |
open Confluent.Kafka | |
open System | |
open System.Text.Json | |
open System.Threading.Tasks | |
open Confluent.Kafka.Admin | |
let server = "localhost:9092" |
This file contains 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
#r "nuget: PacketDotNet" | |
#r "nuget: SharpPcap" | |
open PacketDotNet | |
open SharpPcap | |
open System.Net.NetworkInformation | |
open System.Net | |
open System.IO | |
let deviceName = "eth0" |
This file contains 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
#r "nuget:BenchmarkDotNet" | |
open BenchmarkDotNet.Running | |
open BenchmarkDotNet.Attributes | |
[<InProcessAttribute true; MemoryDiagnoser>] | |
type Runner() = | |
[<Benchmark>] | |
member _.Test1() = "test1" |
This file contains 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
let dedupe source = | |
seq { | |
let mutable previous = ValueNone | |
for item in source do | |
match previous with | |
| ValueSome x when x = item -> () | |
| _ -> yield item | |
previous <- ValueSome item | |
} |
This file contains 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
#!/bin/bash | |
while IFS=, read -r col1 ; do | |
echo "$col1" | |
done <"$1" |
This file contains 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 Microsoft.Extensions.Logging.Console | |
open Microsoft.Extensions.Options | |
type OptionsMonitor<'T>(options) = | |
interface IOptionsMonitor<'T> with | |
member _.CurrentValue = options | |
member _.Get _ = options | |
member _.OnChange _ = { new IDisposable with member _.Dispose() = () } | |
let loggerProvider = new ConsoleLoggerProvider(OptionsMonitor(ConsoleLoggerOptions(FormatterName = "Json"))) |
This file contains 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
module Json | |
open Microsoft.FSharpLu.Json | |
open Newtonsoft.Json | |
open Newtonsoft.Json.Serialization | |
open Newtonsoft.Json.Converters | |
let private compactJsonSerializerSettings = | |
let settings = Compact.TupleAsArraySettings.settings |
This file contains 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
#r "nuget: Azure.Data.Tables" | |
#r "nuget: FSharp.Control.FusionTasks" | |
open Azure.Data.Tables | |
let connectionString = | |
"DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;" | |
let tableName = "test" | |
let tableClient = TableClient(connectionString, tableName) |
This file contains 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
app.Use(async (ctx, next) => | |
{ | |
var apiKey = Environment.GetEnvironmentVariable("APIKEY"); | |
var apiKeyHeader = ctx.Request.Headers["X-API-KEY"].ToString(); | |
var apiKeyQuery = ctx.Request.Query["apikey"].ToString(); | |
var providedApiKey = String.IsNullOrEmpty(apiKeyHeader) ? apiKeyQuery : apiKeyHeader; | |
var authorized = String.IsNullOrEmpty(apiKey) ? false : apiKey == providedApiKey; | |
if (authorized) | |
{ | |
await next(); |
NewerOlder