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 | |
fswatch -l 1 -o ./**/*.go --event=Updated | while read -r; do | |
clear | |
output=$(go test ./... 2>&1) | |
if echo "$output" | grep -- '- FAIL' > /dev/null; then | |
echo -e "\e[31m$(echo "$output" | awk '/--- FAIL/,/Test:/')\e[0m" | |
elif [ -z "$output" ]; then | |
echo -e "\e[31mBUILD FAILED\e[0m" | |
else | |
echo -e "\e[32mPASS\e[0m" |
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
package log | |
import ( | |
"context" | |
"log/slog" | |
"os" | |
"github.com/covalenthq/lumberjack" | |
slogmulti "github.com/samber/slog-multi" | |
"go.opentelemetry.io/otel/trace" |
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 |
NewerOlder