Serverless Lambda Dynamodb API

This post is about how to terraform up a serverless, scalable and resilient lambda API. I am using the 2019nCov-api as an example. In addition, we will have a look at terraform’s built-in functions to make a more reusable modules for api gateway and lambdas. 前面几篇都是写dev的, 今天这篇来写云架构和terraform. 如何用AWS api gateway,lambda和dynamodb做一个轻巧,可扩展的适应性强的数据接口(p.s. serverless, scalable and resilient 这个我不知道该怎么翻, 反正就是这个☁️云架构精致,小巧且耐用) Use Case 用例 The use case is I want to build a simple API to allow user to retrieve coronavirus data.
Read more →

Map Data Visualization

This post is about what I have learned about visualizing data from 2019nCov-api. In order to visualize the data I will need to get the latitude-longitude reference. And I found two interesting APIs. Baidu Map vs Google Map. The coordinate systems is actually quite interesting. Baidu Maps uses a variant of web Mercator projection for slicing map data into tiles with an underlying latitude-longitude reference - BD-09 coordinate system while the Chinese government is using GCJ-02.
Read more →

COVID-19 API

The beginning of the year of rat is quite difficult for most Chinese people since the coronavirus outbreak. I have been checking the news about the progress of this outbreak. One day I watched the interview of a Chinese health official. She mentioned that there was one patient who has no idea that he has met anyone from Wuhan,the center of the outbreak. However, they used big data and found 3 people from Wuhan that have been in contact with him.
Read more →

Payment Gateway | Go | Stripe | Vault

In my previous posts, I have talked about how to build your own Google NLP API. You are a smart developer and you got a great idea 💡. You build an amazing API with useful functions. The only thing you are missing is a validated business case. I think the eaiset way to prove the use case is to put it in the market and see whether or not people are willing to pay for it.
Read more →

Go NLP API | Build Your Own

In my previous posts, I have talked about building a small backend server to handle HTTP POST request. We also have tried out the Google NLP and we dived into the topic of NLTK. Well, now we know how to create a Go function to handle HTTP request and we understand the idea of Natural language Processing. Why not building your own Google NLP API? Let’s now look at the key functions // Now we need to create a function to parse and tag all the data // There is a pre-built lib you can use - "gopkg.
Read more →

AWS Resources Visualizer | yUML | Boto3 | Python

This is an example about how to use aws boto3 with yUML to visualize your aws cloud resources. Please feel free to 👉📱message my twilio bot +447479275693.I will come back to you shortly 😃. In my last post, I have talked about how to play with aws boto3 api. During a usual dev-ish-ops day, sometimes I need to draw an aws network diagram. I have to log in to the console, click click click, and then copy-paste…hmmmm…It’s a little tiny bit boring and obviously, I want to automate it.
Read more →

Text Mining | NLTK | Python

In my previous posts, we have crawled some articles and news through RSS feed and HTML tags. We played with google’s nlp api and then as a developer without too much pocket money to play with. You end up looking for cheaper and better alternatives 👉nltk (natual language toolkit). Let’s break the sentence down and let your code to define how will it read 🤓 How about let the code understand your emotions and 👉 you to the grammar mistake you made.
Read more →

Text Mining | Google NLP | Python

So I have complained about the Google’s Spreadsheets API. After I crawled the news, I feel like I should do some text mining to break the sentences down and teach my algo to read the news. And I came across Google’s NLP API, Ha! I know I won’t like it but why not?

  1. let’s create a google-nlp class # Imports the Google Cloud client library from google.cloud import language from google.
Read more →

Web Scraper | Python

For the Golang version please check here. And here is a python version: """create a rss class to parse the rss feed url anf get the title and link """ import feedparser import os class rss: def init(req, url): req.url = url def fetchDetails(req): try: url = req.url last_etag = '' last_modified = '' title = '' link = '' row = '' result = [] feed = feedparser.parse(url) last_etag = feed.
Read more →

Export GCP Stackdriver Log With Filebeat

This is a bash script to configure GCP project to export logs by creating a Pub/Sub sink topic and let filebeat to subscribe to that sink topic by the filebeat google cloud module. #!/bin/sh # author: me 😃 # $ bash gcloud-admin.sh -h Required parameters: # -id|–project-id: gcloud project id # -svs|–svs-account: gcloud service account name to collect logs # Optional parameters: # -h|–help: Print this message readonly ARGS="$@" readonly dependencies=( "gcloud" ) processArgs(){ while [[ "$#" -gt 0 ]]; do key="$1" case "$key" in -h|–help) PRINT_HELP=true shift ;; -id|–project-id) PROJECT_ID="$2" shift ;; -svs|–svs-account) SVS_ACCOUNT="$2" shift ;; esac shift done } checkDependencies() { local unmet_dependencies=false for dependency in "${dependencies[@]}" ; do command -v "${dependency}" >/dev/null 2>&1 || { echo >&2 "${dependency}required"; unmet_dependencies=true } done if [ "${unmet_dependencies}" = true ] ; then echo "Please install unmet dependencies above before running.
Read more →