Skip to content

Instantly share code, notes, and snippets.

View paulp's full-sized avatar
🤫

Paul Phillips paulp

🤫
  • CAZ, Inc.
  • Cascadia Autonomous Zone
View GitHub Profile
sum by (namespace) (
kube_pod_status_phase{phase="Pending",namespace="<your_namespace>"} * on(pod) group_left
(time() - kube_pod_created{namespace="<your_namespace>"}) > 300
)
@paulp
paulp / mscala
Created January 16, 2023 06:45
mscala
#!/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"
@paulp
paulp / integer-division.z3
Created July 4, 2021 21:13 — forked from Rufflewind/integer-division.z3
Truncated integer division in Z3
(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)))
@paulp
paulp / coronasuggestions.txt
Created March 20, 2020 04:48
google's suggestions in the USA and the UK, sent through comm.
a levels
advice
advice uk
africa
airborne
alabama
alaska
america
and asthma
and children
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
instance Monad f => Monad (OptionalT f) where
f =<< x = OptionalT $ runOptionalT x >>= \case
Empty -> return Empty
Full a -> runOptionalT $ f a
instance Monad f => Monad (OptionalT f) where
f =<< x = OptionalT $ runOptionalT x >>= \case
Empty -> return Empty
Full a -> runOptionalT $ f a
@paulp
paulp / chrome-dns
Created August 15, 2018 23:23
Visibility into chrome's internal dns
#!/usr/bin/env bash
#
output () {
pup 'tbody[id="dns-view-cache-tbody"] tr json{}' \
| jq -r '.[].children[] | select(.tag == "td").text' \
| ag --nocolor --literal .
}
@paulp
paulp / lazylist.scala
Last active August 15, 2018 23:01
interesting LazyList evaluation semantics
% 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)
| }
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]]