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 | |
if [[ "$1" == '-h' ]] || [[ $# != 1 ]]; then | |
echo "Usage: $(basename "$0") <nodepool>" | |
echo | |
echo "<nodepool> can be a partial match to grep for, e.g. '2016-08-19'" | |
echo | |
echo "NOTE: Before draining all nodes in the old pool should be cordoned!" | |
exit 1; | |
fi |
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
kubectl --namespace kube-system get pod -l k8s-app=kube-dns -oname | \ | |
xargs -I% -n1 sh -c 'echo %; kubectl --namespace kube-system -ckubedns logs %; echo' |
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
(reduce | |
(fn [acc i] | |
(update-in | |
acc [i] | |
(fn [x y] (prn x y) (+ y (or x 0))) | |
(* 2 i))) | |
{} | |
[1 2 3 4 1]) |
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
use std::fs; | |
use std::io; | |
use std::path::PathBuf; | |
fn main() { | |
let dir = env!("DIR").to_string(); | |
println!("Looking in {}", dir); | |
let _ = loop_dir_contents(&dir); | |
} |
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
# Useful for installing kubectl in a docker image | |
curl -L -O https://storage.googleapis.com/kubernetes-release/release/v1.2.4/bin/linux/amd64/kubectl | |
# obtain the node name inside a pod | |
KUBERNETES_NODENAME=`kubectl get pods --namespace=${KUBERNETES_NAMESPACE} ${KUBERNETES_PODNAME} -o json | jq -r .spec.nodeName` |
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
val cost: Option[String] = Some("123") | |
val method: Option[String] = None | |
(cost, method) match { | |
case (Some(c), Some(m)) => Some(s"$c $m") | |
case (Some(c), None) => Some(s"$c") | |
case (None, Some(m)) => Some(s"$m") | |
case _ => None | |
} |
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 HouseBuilderAsync1 { | |
def circumference(d: Double): Future[Double] = Math.piSlow.map { _ * d } | |
def buildWindow(c: Double): Window = Window(c) | |
def buildHouse(window: Window): House = House(window) | |
} | |
object HouseControllerAsync1 { | |
import HouseBuilderAsync._ | |
circumference(10).map(buildWindow).map(buildHouse) | |
// scala.concurrent.Future[AsynsVsSync.House] = Success(House(Window(31.400000000000002))) | |
} |
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
(defn- ensure-min-vec-size [v size] | |
"Ensure v has at least size elements. Fill with `nil` if necessary." | |
(let [d (- size (count v))] | |
(if (> d 0) (into v (vec (repeat d nil))) v))) | |
(defn- find-or-create | |
"Build up nested path with possibly-numeric indices as vectors and other keys | |
as maps" | |
[m [k1 k2 & path]] | |
(let [ds (cond-> (get-in m [k1] (if (number? k2) (vec (repeat k2 nil)) {})) |
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
lazy val root = (project in file(".")). | |
settings( | |
name := "compiled-query", | |
version := "1.0", | |
scalaVersion := "2.11.7", | |
resolvers += "Sonatype OSS Snapshots" at | |
"https://oss.sonatype.org/content/repositories/snapshots", | |
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value, |
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
2015-12-29 19:41:09 | |
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.25-b02 mixed mode): | |
"Attach Listener" #11 daemon prio=9 os_prio=31 tid=0x00007f8d4b826800 nid=0x3a0b waiting on condition [0x0000000000000000] | |
java.lang.Thread.State: RUNNABLE | |
"Thread-0" #10 daemon prio=5 os_prio=31 tid=0x00007f8d4e8af800 nid=0x5703 waiting on condition [0x0000700001658000] | |
java.lang.Thread.State: TIMED_WAITING (sleeping) | |
at java.lang.Thread.sleep(Native Method) | |
at org.flatland.drip.Main.killAfterTimeout(Main.java:38) |