main
  • About
  • Civil Engineering
    • Interview questions
    • Bridge design
  • Google Cloud
    • Code samples
    • kafka
    • Cloud Run
    • persistent disks
    • Spinnaker
    • Assessment questions
    • IAM
    • Cloud Storage
    • VPC
    • Cost optimization
    • Compute Engine
    • App Engine
    • Cloud Vision
    • Spanner
    • Cloud SQL
    • Solutions
      • Static IP - WIP
      • Network performance
      • Building a VPN
      • Build a streaming app
      • ML train with taxi data
    • Dataproc
    • Dataprep
    • BigTable
    • Cloud Fusion
    • Data flow
    • CloudFront
    • APIGEE
    • BigQuery
    • Cloud logging
    • Pubsub
    • Identity Aware Proxy
    • Data center migration
    • Deployment Manager
    • Kubeflow
    • Kubernetes Engine
    • Istio
    • Read the following
    • Storage for cloud shell
    • kms
    • kpt
    • Hybrid cloud with Anthos
    • helm
    • Architecture
    • terraform
    • Network
    • Data studio
    • Actions
    • Jenkins
  • Data Processing
    • Data Lake
    • Data ingestion
    • Data Cleaning - Deduplication
    • Data Cleaning - Transformation
    • Data cleaning - rule definition
    • ETL
  • Machine Learning
    • Tensorflow
    • Tensorflow tips
    • Keras
    • Scikit-learn
    • Machine learning uses
    • Working with Pytorch
    • Federated learning
  • AWS cloud
    • Billing
    • Decrease volume size of EC2
    • Run CVE search engine
    • DataSync
    • EC2 spot instances
  • Java
    • Java
    • NIO
    • System Design
      • Zero trust framework
    • Collections
  • Azure
    • Enterprise Scale
    • API
    • Resource group
    • Create an sql database
  • UBUNTU
    • No Release file
    • STRATO blockchain
    • iperf
    • Rsync
    • curl
    • Shell
    • FAQ - git
  • PH test
    • Syllabus
    • Opportunities
    • Aptitude test
  • Development
    • Course creation
    • web.dev
    • docfx template
  • npm
  • Docker Desktop
  • Nginx
  • English rules
  • Confluent
  • sanity theme
  • Java Native Interface tutorial
  • Putty
  • Personal website host
  • Google search SEO
  • Reading a textbook
  • DFCC Progress
  • STORAGE
    • Untitled
  • Services Definition
    • Cloud VPN and routing
  • Microservices design and Architecture
    • Untitled
  • Hybrid network architecture
    • Untitled
  • Deployment
    • Untitled
  • Reliability
    • Untitled
  • Security
    • Untitled
  • Maintenance and Monitoring
    • Peering
  • Archive
    • parse dml to markdown
Powered by GitBook
On this page
  • grep
  • jsonpath
  • Load testing
  • mkdir
  • Cert checking
  • openssl
  • Replacement

Was this helpful?

  1. UBUNTU

curl

How to use curl

PreviousRsyncNextShell

Last updated 4 years ago

Was this helpful?

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:

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

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

translation-request.json
{
  "q": "your_text_here",
  "target": "en"
}
ocr-response.json
"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

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.

https://cloud.google.com/speech-to-text/docs/samples/speech-transcribe-async-gcs
X.509 v3 certificate