Skip to content

Instantly share code, notes, and snippets.

Avatar
🤫

Paul Phillips paulp

🤫
  • CAZ, Inc.
  • Cascadia Autonomous Zone
View GitHub Profile
View gist:0d6df08b163dc1f525145ea032c7faed
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
View 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 / oddity.txt
Created January 11, 2016 22:22
Whitespace Oddity
View oddity.txt
WHITESPACE ODDITY
by Paul Phillips, in eternal admiration of David Bowie, RIP
Bound Ctrl to Major mode
Bound Ctrl to Major mode
Read inputrc and set extdebug on
Bound Ctrl to Major mode (Ten, Nine, Eight, Seven, Six)
Connecting readline, options on (Five, Four, Three)
Check the syntax, may terminfo be with you (Two, One, Exec)
@paulp
paulp / integer-division.z3
Created July 4, 2021 21:13 — forked from Rufflewind/integer-division.z3
Truncated integer division in Z3
View integer-division.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 / The Signs of Soundness
Last active June 17, 2021 06:48
The Signs of Soundness
View The Signs of Soundness
Hello scala, my old friend
I've come to take you home again
Because a feature slowly creeping
left me plagued with doubts and weeping
and the version that was tagged in the repo
just has to go
it lacks the signs of soundness
On sleepless nights I hacked alone
applying ant and other tools of stone
@paulp
paulp / .gitignore
Created May 11, 2017 17:11
The price of having my home directory under revision control.
View .gitignore
#
*.history
*[-_]history
.CFUserTextEncoding
.DS_Store
.dropbox*
.eclipse
.localized
.lockfile
.viminfo
@paulp
paulp / coronasuggestions.txt
Created March 20, 2020 04:48
google's suggestions in the USA and the UK, sent through comm.
View coronasuggestions.txt
a levels
advice
advice uk
africa
airborne
alabama
alaska
america
and asthma
and children
View ummutable.scala
import scala.collection.mutable.ListBuffer
class Ummutable[T] private (buf: ListBuffer[T]) {
def this(xs: T*) = this(ListBuffer() ++= xs)
def append(ys: T*): this.type = { buf ++= ys ; this }
val xs: List[T] = buf.toIterable match { case xs: List[T] => xs }
override def toString = s"Ummutable(xs = ${xs mkString ", "})"
}
@paulp
paulp / sbt-new
Created January 2, 2017 17:57
a less messy sbt new
View sbt-new
#!/usr/bin/env bash
#
# Intercepting the output of 'sbt new' directly fails
# because it asks interactive questions so we can't process
# line by line. An apparent OSX-specific bug in egrep
# fails on lookbehind clauses so we use ag. Capturing
# the interactive output with script succeeds, but script
# uses \r\n to terminate lines so we can't match the
# filename with '.*' or we get
#
@paulp
paulp / gsdv.sh
Created January 24, 2018 02:28
Use google's verbatim search and date range restriction simultaneously
View gsdv.sh
#!/usr/bin/env bash
#
# Use google's date range and "verbatim" simultaneously
# Paul Phillips <psp@brb.fyi>
#
NAME="$(basename "$0")"
read -r -d '' USAGE << EOM
usage: $NAME [-s days] [-e days] [search terms]