Update the command/args:
command: [ "/bin/sh", "-c", "--" ]
args: [ "while true; do sleep 30; done;" ]
Run a command
kubectl exec my-pod -c my-container -- ls /
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
# based on the "patch deployment" strategy in this comment: | |
# https://github.com/kubernetes/kubernetes/issues/13488#issuecomment-372532659 | |
# requires jq | |
# $1 is a valid namespace | |
function refresh-all-pods() { | |
echo | |
DEPLOYMENT_LIST=$(kubectl -n $1 get deployment -o json|jq -r .items[].metadata.name) | |
echo "Refreshing pods in all Deployments" | |
for deployment_name in $DEPLOYMENT_LIST ; do |
Update the command/args:
command: [ "/bin/sh", "-c", "--" ]
args: [ "while true; do sleep 30; done;" ]
Run a command
kubectl exec my-pod -c my-container -- ls /
# https://edunham.net/2015/01/29/vim_open_file_with_cursor_at_the_end.html | |
vim "+normal G$" file.txt | |
# or in edit mode: | |
vim "+normal G$" +startinsert file.txt |
<?php | |
// Turn on all error reporting so we can see if anything goes wrong | |
ini_set('display_errors', 1); | |
ini_set('display_startup_errors', 1); | |
error_reporting(-1); | |
// Relative path to your wp-config.php file (to connect to the database) | |
require '../wp-config.php'; | |
require './frontmatter.php'; // Parses YAML frontmatter - https://github.com/Modularr/YAML-FrontMatter | |
require './Parsedown.php'; // Markdown parser - https://github.com/erusev/parsedown |
WITH_NEWLINE="line with newline | |
" | |
WITHOUT_NEWLINE="line without newline" | |
echo $WITH_NEWLINE | |
echo $WITHOUT_NEWLINE | |
echo "The above have matching newlines- you would expect that they should not" | |
echo "${WITH_NEWLINE}" | |
echo "${WITHOUT_NEWLINE}" |
Crafting bash functions that exit on errors: | |
function name {( set -e | |
do stuff... | |
)} | |
The (...) creates a subshell, and the "set -e" prefix causes an exit on any | |
nonzero exit codes of the included commands. | |
https://stackoverflow.com/a/58964551/90442 |
There doesn't seem to be a gcloud method for querying firestore. | |
``` | |
ACCESS_TOKEN=$(gcloud auth application-default print-access-token) | |
``` | |
Make a request to Firestore API: Once you have your access token, you can make a GET request to the Firestore REST API to retrieve a document. The URL for the request should be in the following format: | |
https://firestore.googleapis.com/v1/projects/{project-id}/databases/(default)/documents/{collection-id}/{document-id} | |