Search By Label
db.collection.find({ name: {$regex: "Match here"} })
find
method):db.collection.find({ description: { $exists: true, $ne: "" } })
$exists: true
: ensures the field exists.$ne: ""
: ensures the field is not an empty string.:%s/<string-to-replace>/<new-string>
to replace all matches with a new string.is
to check identity and ==
to check equality.value1
and value2
refer to an int
instance storing the value 1000
:value1 = 1000
value2 = value1
>>> value1 == value2
True
>>> value1 is value2
True
value1
and value2
refer to different int
instances, even if both store the same integer. Because the same value (integer) is stored ==
will be True
, that's why it's often called "value comparison". However is
will return False
because these are different objects:>>> value1 = 1000 >>> value2 = 1000
>>> value1 == value2 True >>> value1 is value2 False
import datetime help(datetime.datetime)
datetime
class within the datetime
module, including its methods and usage.import *
. It overrides the default of hiding everything that begins with an underscore.__all__
in a module, e.g. module.py
:__all__ = ['foo', 'Bar']
import *
from the module, only those names in the __all__
are imported:from module import * # imports foo and Bar
kubectl logs <pod-id> --previous
kubectl get pod celery-worker-5558fbffb-25dmw -o jsonpath="{.status.containerStatuses[0].lastState.terminated.reason}"
docker run -it <image_id> /bin/bash
Flask
applications.Blueprint
, routes, resource etc).thistuple = ("apple", "banana", "cherry") print(thistuple) // ('apple', 'banana', 'cherry')
kubectl create secret generic <secret-name> --from-file=key.json=gcloud_keys.json -n <namespace>
key.json
file from our local file gcloud_keys.json
kubectl describe secret <secret_name> -n <namespace>
kubectl get secret <secret_name> -n <namespace> -o jsonpath="{.data.key\.json}" | base64 --decode
-- Selecting and unnesting an array of integers SELECT unnest(ARRAY[1, 2]); -- Expands the array [1, 2] into individual rows