This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require('axios').default; | |
const { setTimeout } = require('timers/promises'); | |
module.exports = async function (context, req) { | |
// Replace your_sub_domain with your Computer Vision's endpoint sub domain | |
const analyzeURL = | |
'https://your_sub_domain.cognitiveservices.azure.com/vision/v3.2/read/analyze'; | |
// Get imageURL from query string | |
// Example: https://raw.githubusercontent.com/Azure-Samples/cognitive-services-sample-data-files/master/ComputerVision/Images/printed_text.jpg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import boto3 | |
import json | |
def main(): | |
data = requests.get('https://dummyjson.com/products').json() | |
s3_client = boto3.client('s3') | |
s3_client.put_object(Body=json.dumps(data), Bucket='aws-glue', Key='products.json') | |
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# om namah shivaya | |
service: default | |
runtime: nodejs14 | |
instance_class: F1 | |
automatic_scaling: | |
min_instances: 0 | |
max_instances: 1 | |
target_cpu_utilization: 0.90 | |
handlers: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// om namah shivaya | |
// require scripts | |
const { promisify } = require('util'); | |
const redis = require('redis'); | |
const express = require('express'); | |
startService(); | |
async function startService() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
GCP_PROJECT_ID=rajchaudhary #replace rajchaudhary with your gcp project id | |
GCP_REGION=us-central1 #replace us-central1 with your gcp region | |
gcloud builds submit \ | |
--tag gcr.io/$GCP_PROJECT_ID/hello-redis | |
gcloud run deploy hello-redis \ | |
--allow-unauthenticated \ | |
--image gcr.io/$GCP_PROJECT_ID/hello-redis \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// om namah shivaya | |
// require scripts | |
const { promisify } = require('util'); | |
const redis = require('redis'); | |
const express = require('express'); | |
startService(); | |
async function startService() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
GCP_REGION=us-central1 #replace us-central1 with your gcp region | |
gcloud functions deploy hello-redis \ | |
--allow-unauthenticated \ | |
--entry-point main \ | |
--region $GCP_REGION \ | |
--runtime nodejs14 \ | |
--trigger-http \ | |
--vpc-connector hello-redis-vpc-connector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// om namah shivaya | |
const { promisify } = require('util'); | |
const redis = require('redis'); | |
// replace 127.0.0.1 with your redis instance ip | |
const redisHost = '127.0.0.1'; | |
const client = redis.createClient({ | |
host: redisHost, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# om namah shivaya | |
# directories | |
node_modules | |
# files | |
.dockerignore | |
.gitignore | |
.prettierrc | |
Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# om namah shivaya | |
# Use the official lightweight Node.js 14 image. | |
# https://hub.docker.com/_/node | |
FROM node:14-slim | |
# Create and change to the app directory. | |
WORKDIR /usr/src/app | |
# Copy application dependency manifests to the container image. |
NewerOlder