View gist:0d6df08b163dc1f525145ea032c7faed
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 | |
) |
View mscala
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 <psp@brb.fyi> | |
set -euo pipefail | |
declare SCALA2_VERSION="2.13.10" | |
declare SCALA3_VERSION="3.2.0" | |
declare AMM_VERSION="2.5.5" |
View integer-division.z3
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))) |
View coronasuggestions.txt
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 |
View app.hs
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 |
View monad.hs
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 |
View gist:244846ffa026ac7bfed3bf57ea0398db
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 |
View chrome-dns
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 . | |
} | |
View lazylist.scala
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) | |
| } |
View types.scala
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