curl
How to use curl
curl -s -X POST -H "Content-Type: application/json" --data-binary @gsc-request.json \
"https://speech.googleapis.com/v1/speech:recognize?key=${API_KEY}" > task4-gcs.result
Example api doc: https://cloud.google.com/speech-to-text/docs/samples/speech-transcribe-async-gcs
curl http://download.tensorflow.org/example_images/flower_photos.tgz \
| tar xz
curl -ks https://`kubectl get svc frontend -o=jsonpath="{.status.loadBalancer.ingress[0].ip}"`
curl -sLO https://github.com/kubernetes/kops/releases/download/$(curl -s https://api.github.com/repos/kubernetes/kops/releases/latest | grep tag_name | cut -d '"' -f 4)/kops-linux-amd64
chmod +x kops-linux-amd64
mv kops-linux-amd64 $WORK_DIR/bin/kops
for ((i=1;i<=10;i++)); do echo total_time: $(echo "`curl -s -o /dev/null -w '1000*%{time_total}\n' -s http://35.232.156.42`" | bc); done
#output
total_time: 203.000
total_time: 199.000
total_time: 199.000
total_time: 199.000
total_time: 200.000
total_time: 199.000
total_time: 199.000
total_time: 199.000
total_time: 206.000
total_time: 200.000
grep
$ kubectl get pods | grep hello-
hello-687bb4b8f4-2fxwb 1/1 Running 0 20s
hello-687bb4b8f4-8q2sc 1/1 Running 0 11m
hello-687bb4b8f4-f4qnm 1/1 Running 0 11m
hello-687bb4b8f4-rmvkh 1/1 Running 0 20s
hello-687bb4b8f4-sh268 1/1 Running 0 11m
$ kubectl get pods | grep hello- | wc -l
5
jsonpath
kubectl get pods -o jsonpath --template='{range .items[*]}{.metadata.name}{"\t"}{"\t"}{.spec.containers[0].image}{"\n"}{end}'
curl -ks https://`kubectl get svc frontend -o=jsonpath="{.status.loadBalancer.ingress[0].ip}"`/version
Load testing
kubectl run -i --tty load-generator --rm --image=busybox --restart=Never -- /bin/sh -c "while sleep 0.01; do wget -q -O- http://php-apache; done"
mkdir
~ $ mkdir demo-directory && $_
~/demo-directory $
Cert checking
# find <directory-name>
find ../02_ingest/ -type f -exec sed -i "s/curl /curl -k /" {} \;
openssl
X.509 v3 certificate and encoded in base64. A 2048-bit RSA key pair and wraps the public key in a self-signed certificate that is valid for 365 days with openssl.
openssl req -x509 -nodes -newkey rsa:2048 -days 365 \
-keyout /path/to/private_key.pem \
-out /path/to/public_key.pem \
-subj "/CN=unused"
Replacement
{
"q": "your_text_here",
"target": "en"
}
"text": "A LE BIEN PUBLIC\nles dĂ©pĂȘches\nPour Obama,\nla moutarde\nest\nde Dijon\n"
STR=$(jq .responses[0].textAnnotations[0].description ocr-response.json) && STR="${STR//\"}" && sed -i "s|your_text_here|$STR|g" translation-request.json
Last updated
Was this helpful?