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
sum by (namespace) ( | |
kube_pod_status_phase{phase="Pending",namespace="<your_namespace>"} * on(pod) group_left | |
(time() - kube_pod_created{namespace="<your_namespace>"}) > 300 | |
) |
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
#!/usr/bin/env bash | |
# | |
# scala runner which can handle lots of variation automatically | |
# Paul Phillips <[email protected]> | |
set -euo pipefail | |
declare SCALA2_VERSION="2.13.10" | |
declare SCALA3_VERSION="3.2.0" | |
declare AMM_VERSION="2.5.5" |
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
(declare-fun a () Int) | |
(declare-fun b () Int) | |
(declare-fun c () Int) | |
;; (assert (= a (div -7 -3))) | |
;; (assert (= b (div 7 -3))) | |
;; (assert (= c (div -7 3))) | |
;; (assert (= a (mod -7 -3))) | |
;; (assert (= b (mod 7 -3))) | |
;; (assert (= c (mod -7 3))) |
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
a levels | |
advice | |
advice uk | |
africa | |
airborne | |
alabama | |
alaska | |
america | |
and asthma | |
and children |
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
instance Monad f => Applicative (OptionalT f) where | |
pure = OptionalT . pure . Full | |
mf <*> ma = OptionalT $ do | |
optf <- runOptionalT mf | |
case optf of | |
Empty -> return Empty | |
Full f -> do | |
opta <- runOptionalT ma | |
return $ f <$> opta |
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
instance Monad f => Monad (OptionalT f) where | |
f =<< x = OptionalT $ runOptionalT x >>= \case | |
Empty -> return Empty | |
Full a -> runOptionalT $ f a |
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
instance Monad f => Monad (OptionalT f) where | |
f =<< x = OptionalT $ runOptionalT x >>= \case | |
Empty -> return Empty | |
Full a -> runOptionalT $ f a |
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
#!/usr/bin/env bash | |
# | |
output () { | |
pup 'tbody[id="dns-view-cache-tbody"] tr json{}' \ | |
| jq -r '.[].children[] | select(.tag == "td").text' \ | |
| ag --nocolor --literal . | |
} | |
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
% mscala -v 2.13.0-M4 | |
Welcome to Scala 2.13.0-M4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_181). | |
Type in expressions for evaluation. Or try :help. | |
scala> val counter = { | |
| var count = 0 | |
| () => { | |
| val res = try "x" + count finally count = count + 1 | |
| try res finally println(res) | |
| } |
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
object ttypes { | |
type ->[+A, +B] = (A, B) | |
type PairOf[+A] = A -> A | |
type SumOf[+A] = A \/ A | |
trait Interpret[T[_[_]]] { | |
type ^[Outer[_], Inner[_]] = Outer[T[Inner]] | |
trait Transform[F[_], G[_]] { | |
type FTF = F[T[F]] |
NewerOlder