Source code of snippets included as screenshots at https://mannymon.medium.com/processing-kubectl-yaml-output-with-yq-bf0dc98ddeab
This file contains hidden or 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 | |
kubectl get pods --all-namespaces -o json | jq '[ | |
.items[] | ( | |
{ | |
namespace: .metadata.namespace, | |
pod: .metadata.name, | |
statuses: ( | |
[ | |
.status.containerStatuses[] | { name, ready, restartCount } |
This file contains hidden or 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/sbin/nginx -c /etc/nginx/endpoints/nginx.conf -T | |
# configuration file /etc/nginx/endpoints/nginx.conf: | |
# Auto-generated by start_esp | |
# Copyright 2017 Google Inc. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Moment Timezone Examples</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.13/moment-timezone.min.js"></script> | |
<style id="jsbin-css"> | |
html, body { |
This file contains hidden or 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
function parseQueryString(qs) { | |
return ( | |
qs.slice(1).split('&') | |
.map((pair) => { | |
const [key, value] = pair.split('='); | |
let transformedValue = decodeURIComponent(value); | |
if (/^[{|\]]/.test(transformedValue)) { | |
transformedValue = JSON.parse(transformedValue); | |
} | |
return { key: key, value: transformedValue }; |
This file contains hidden or 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
var firstPartyHostnamePattern = /^(?:.*)(?:nytimes\.com|nyt\.com|nyt\.net)$/; | |
// filter out 1st party resources | |
var thirdPartyResources = window.performance.getEntriesByType('resource').filter(function (entry){ | |
var url = new URL(entry.name); | |
return !firstPartyHostnamePattern.test(url.hostname); | |
}); | |
// reduce to unique host names | |
var thirdPartyHostnames = thirdPartyResources.map(function (entry){ |
This file contains hidden or 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
javascript:!function(a,b){function c(){let b="production";const c=a.location.hostname,d=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;return(/local/.test(c)||d.test(c))&&(b="local"),/dev/.test(c)&&(b="development"),/stg/.test(c)&&(b="staging"),b}function d(){let a="article";const c=b.querySelector('meta[name="PT"]');return c&&c.getAttribute("content")&&/blog/i.test(c.getAttribute("content"))&&(a="blogpost"),a}function e(){let a="";const c=b.querySelector('meta[name="articleid"]');return c&&c.getAttribute("content")&&/\d{13,19}/.test(c.getAttribute("content"))&&(a=c.getAttribute("content")),a}function f(){const a=d(),b=e(),c=`/hybrid/${a}/${b}.html`;return c}function g(){const a={local:"local.sbx.nytimes.com",development:"mobile.dev.nytimes.com",staging:"mobile.stg.nytimes.com",production:"mobile.nytimes.com"},b=c();return a[b]}function h(){const a={local:"http:",development:"https:",staging:"ht |
This file contains hidden or 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
git status --porcelain | grep -v -E 'docs|lib' | awk '{print $2}' | xargs git diff |
I hereby claim:
- I am montmanu on github.
- I am montmanu (https://keybase.io/montmanu) on keybase.
- I have a public key ASDvEVsg23x4DW9iMJEIYrWr3nwJnkQHkcmEFyIzbVzUkgo
To claim this, I am signing this object:
NewerOlder