Remove all entries that have a key ending in .comment:
echo '{"key": "value", "key.comment": "key comment"}' | \
jq '.|with_entries(select(.key|test(".\\.comment$")|not))'gives
| # Get logs for all pods with a given label | |
| kubectl logs -f -l app=my-app-label | |
| # Get pod labels | |
| kubectl get pods --show-labels | |
| # ^^^ can be messy, so if your app label is the name of the deployment, | |
| # just list the deployments | |
| kubectl get deployments |
| #!/usr/bin/env bash | |
| # convert from timestamp to epoch: 1626459360 | |
| date -d '2021-07-16 14:16:00' +%s | |
Remove all entries that have a key ending in .comment:
echo '{"key": "value", "key.comment": "key comment"}' | \
jq '.|with_entries(select(.key|test(".\\.comment$")|not))'gives
Given json data like
data='{
"message":"List of orders",
"data":[
{"siteNum":"70293591","siteName":"VIYA 4 TESTING RICHARD SUGG REQ RITM0288018","number":"9CMW3K","date":"2021-11-29T17:09:10-05:00","updateStatus":"noUpdateAvailable","features":[],"downloadStatus":"ok","accessRole":"owner"},
{"siteNum":"70180938","siteName":"Richard test","number":"9CPWF3","date":"2022-04-19T12:24:42-04:00","updateStatus":"noUpdateAvailable","features":[],"downloadStatus":"ok","accessRole":"owner"},
{"siteNum":"70180938","siteName":"testing viya 4 order","number":"09YYND","date":"2021-10-11T13:52:08-04:00","updateStatus":"noUpdateAvailable","features":[],"downloadStatus":"ok","accessRole":"user"},
{"siteNum":"70180938","siteName":"viya 4 test 6 - 04aug21","number":"09XZF5","date":"2021-08-04T13:51:49-04:00","updateStatus":"updateAvailable","features":[],"downloadStatus":"ok","accessRole":"user"}Enter a line of Bash starting with a # comment, then run !:q on the next line to see what that would be with proper Bash escaping applied.
❯ bash
bash-5.1$ # this' string" has! bad ()[] chars in it:
bash-5.1$ !:q
'# this'\'' string" has! bad ()[] chars in it:'
bash: # this' string" has! bad ()[] chars in it:: command not found
| #!/usr/bin/env python3 | |
| import docker | |
| import os | |
| import sys | |
| import base64 | |
| image = "registry.com/me/image:1.2.3" | |
| CWD = os.path.abspath(os.path.dirname(__file__)) | |
| # DOCKER_HOST=unix://var/run/docker.sock |
| #!/usr/bin/env python3 | |
| import os | |
| def get_newest(src_dir: str) -> str: | |
| """return the newest file or directory""" | |
| full_path = [src_dir + "/" + item for item in os.listdir(src_dir)] | |
| oldest = max(full_path, key=os.path.getctime) | |
| return os.path.basename(oldest) |
| import ( | |
| "embed" | |
| "html/template" | |
| "bytes" | |
| ) | |
| //go:embed templates/* | |
| var templateFS embed.FS | |
| func unescape(s string) template.HTML { |
| #!/usr/bin/env python3 | |
| import json | |
| import os | |
| import sys | |
| from collections import OrderedDict | |
| if len(sys.argv) != 4: | |
| sys.exit(f"Usage: {sys.argv[0]} <name> <prefix> <path-to-body-file>") |
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| "os/signal" | |
| "syscall" | |
| "time" | |
| ) |