Skip to content

Instantly share code, notes, and snippets.

@davidfowl
davidfowl / Example1.cs
Last active June 19, 2024 16:41
How .NET Standard relates to .NET Platforms
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)
kubectl get pods | grep Evicted | awk '{print $1}' | xargs kubectl delete pod
@zparnold
zparnold / one_liner.sh
Last active June 25, 2024 07:12
A simply script to delete all failed pods from Kubernetes
kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
@Daenyth
Daenyth / fs2EffectCursor.scala
Last active March 25, 2021 04:34
iterate through a cursor-based api (eg paging) into an fs2 stream / "loopEval"
def call[A, B](
a: A,
f: A => IO[(A, Option[B])],
n: (A, B) => IO[(A, Option[B])]
): Stream[IO, A] = {
def go(emit: A, next: B): Pull[IO, A, Unit] = {
Pull.output1(emit) >> Pull.eval(n(emit, next)).flatMap {
case (toEmit, Some(nxt)) => go(toEmit, nxt)
case (toEmit, _) => Pull.output1(toEmit) >> Pull.done
@lucianenache
lucianenache / FS2S3.scala
Last active December 23, 2019 19:00
Scala FS2 stream to AWS S3 example
// SBT
name := "delete"
scalaVersion := "2.12.7"
libraryDependencies ++= Vector(
"co.fs2" %% "fs2-core" % "1.0.0",
"com.amazonaws" % "aws-java-sdk-s3" % "1.11.442"
)