Skip to content

Instantly share code, notes, and snippets.

bdragon / pod-logs.bash
Created Apr 29, 2021
Tail kubectl logs from multiple selected pods with colorized output.
View pod-logs.bash
set -euo pipefail
# Tail kubectl logs from multiple selected pods with colorized output.
function usage() {
local name="$(basename "${BASH_SOURCE[0]}")"
echo "Synopsis:"
echo -e "\t$name -n NAMESPACE -l SELECTOR [ -- KUBECTL_LOGS_ARGS ]\n"
from typing import Mapping, Optional, Set, Tuple
# Graph is just a mapping whose keys are vertices and values are sets of edges
# leaving keys.
graph: Mapping[str, Set[Tuple[str, str]]] = dict()
# All keys in graph are normalized using this function.
def key(s: str) -> str:
return s.lower().replace("_", "-")
View concat.go
package main
import (
// concat returns a slice of type t that contains the specified items.
// Each item is appended according to its type: if it has type t, it is
// appended; if it is a slice of values of type t, each of its elements
View monadic.rb
# == Library code ===========================================
class Result
def self.success(value)
new(nil, value)
def self.error(err)
new(err, nil)
View loan-payment-data.json
bdragon / object.extend.js
Created Aug 7, 2013
Inheritance model with support for inheriting static properties, prototype properties, and ECMAScript 5 getters/setters, as well as for calling "super". See
View object.extend.js
* Object.extend()
* @author Bryan Dragon
* @website
* @license MIT License
(function () {
'use strict';
var hasOwn = Object.prototype.hasOwnProperty
View mobile-viewport.js
* mobile-viewport.js
* Simple script to hide the address bar on iPhone and iPod (when not in fullscreen app mode).
(function () {
app = document.getElementById('myDomEl'),
ua = navigator.userAgent,
iphone = ~ua.indexOf('iPhone') || ~ua.indexOf('iPod'),