AWS | Boto3 | Python

This is an example about how to create your own python boto3 class and use it in your day-to-day work 😃. Please feel free to 👉📱message my twilio bot +447479275693. I will come back to you shortly 😃. import boto3 import os """how to use this classimport aws_modules.get_all_sg_rulessg_rule = aws_modules.get_all_sg_rules.sg(aws_account) # passing aws_account value to retrive all sg rulessg_rule_result = sg_rule.getSgRules()""" class sg: def init(req, aws_account): req.aws_account = aws_account def getSgRules(req): try: os.
Read more →

Google Spreadsheets Paper Test By Calling Google’s Spreadsheets API

I have made one post about doing paper test by using google app script. For a fully automated paper testing, you can use Google’s Spreadsheets API to track your paper test result. How to do it?

  1. Connect to Google’s Spreadsheets API There is a quickstart documentation. And I have posted mine: package main import ( "time" "encoding/json" "fmt" "io/ioutil" "log" "net/http" "os" "golang.org/x/net/context" "golang.org/x/oauth2" "golang.org/x/oauth2/google" "google.golang.org/api/sheets/v4" ) // Retrieve a token, saves the token, then returns the generated client.
Read more →

amazon s3

aws s3 cli is great! You can easily move your local files to your aws s3 buckets. However, sometimes it is not that easy to do simple tasks - like copy files where there is a whitespace in the file name, delete all versions of all files in a versioned s3 bucket and the difference between aws s3 sync and aws s3 cp –recursive . escape the whitespace in your file name When you have a long list of files that you need to upload to s3 bucket, it will be easy for you to loop it through if you have nice filenames that there are no whitespace.
Read more →

Google Spreadsheets Paper Test

I was inspired by the alpaca’s idea of using google spreadsheet as a test environment for auto algo trading. So I decided to make a version for bitcoin paper test trading. For alpaca’s stock version, you can find the details here. The google spreadsheet will look like this: I am using coinbase api to get the lastest Bitcoin price. And there is already one google app script class that you can use - Class UrlFetchApp.
Read more →

jq examples

jq is a command-line JSON processor to parse json format data. You can find the detailed documentation here. And you can try to play it online at jqplay.org. I am listing out few jq command line examples that I found quite useful for day-to-day work 😃. Let’s try jq with AWS resources api. // to parse and extract json data $ curl -s \ https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/index.json \ | jq .offers.AmazonEC2 { "offerCode": "AmazonEC2", "versionIndexUrl": "/offers/v1.
Read more →

Twilio Message Bot 📟

So you want a personal chatbot to handle your messages. Let’s build a easy twilio bot to handle and filter your incoming messages and calls - your personal virtual assistant 📟. Let’s start with a simple user case. I want to have a 📟 to recieve the SMS messages and send me a summary about who are contacting me, what messages have them sent and what are their contact numbers.
Read more →

Lambda Logshipper

How can you easily move your Cloudwatch logstream to another platform or log collector endpoints? The easiest way is to ship the Cloudwatch logstream through a socket client. This is an example of a small Golang lambda function to ship aws cloudwatch log stream to a tcp endpoint. you will need a socket client: func SocketClient(m []byte) { conn, err := net.Dial("tcp", "your_tcp_endpoint:your_port") defer conn.Close() if err != nil { fmt.
Read more →

Web Scraper | Golang

So you are interested in news and events and you want to track the latest news and headlines. And I guess you are familiar with the concept of RSS Rich Site Summary. Okay,😃Let’s start to build a simple Golang application to fetch the latest news and headlines with in a second. package main import ( "fmt" "github.com/mmcdole/gofeed" ) func feed(){ fp := gofeed.NewParser() feed, err := fp.ParseURL("http://feeds.reuters.com/reuters/UKTopNews") if err != nil { panic(err) } for _, item := range feed.
Read more →