Wednesday, October 4, 2017

Mastering Python Networking Book Charity Donation Tracking

This is the place where I keep track of the charity donations from the royalty proceeds of my book, Mastering Python Networking (, by Packt Publishing.

Please note that I plan to donate 100% of the proceeds to charity, but would like to research the charity projects first before my donation so the proceeds might not be donated at the same time I received them.


June 2017

- SmileTrain (
- Tzu Chi Foundation (

August 2017

- Tzu Chi Foundation (
- Python Software Foundation (

September 2017

- Lake Washington Schools Foundation Pantry Pack (
- 21 US Virgin Island Relief Fund (
- Tzu Chi Foundation (

October 2017

- PyLadies (

November 2017


December 2017


January 2018


Thursday, July 6, 2017

Mastering Python Networking Book Q&A

It has been an incredible last few months for personal and professional growth in writing and publishing my first book, Mastering Python Networking ( Link), by Packt Publishing. Packt has a wonderful supporting team for the book, from content editing, copy editing, to graphic design. It has been a great book publishing learning experience for me.

For those who were curious about the experience, background story, and other aspects of the book, I have put together this list of Q&A's based on what people have asked me. I will add to the list when new questions arises.


Q. What is the motivation for the book? 

A. When I was writing about the book, I try to answer the question of, "If I am a network engineer trying to learn about automation and SDN, what would I need to know?" In other words, this is the book I wish I had a few years ago when I started down the network automation and SDN path. I hope to help others to avoid the mistakes I made and shorten the learning curve.

Q. How did you get the opportunity from Packt Publishing? 

A. This blog! I think the OpenFlow Tutorial entry along with some of the other work I have done for InternetworkExpert opened the door for me on this one.

Q. What is the book about? 

A. You can read the book description here. Basically it is about how to automate network tasks with Python packages.

Q. Where can I get the book? 

A. I am glad you asked! You can get the book here on Packt website or Amazon.

Q. Can I take a look at the book first before purchase? 

A. Sure! This book is part of the Packt subscription library that you can start a 30-day free trial for.

Q. Where can I get the code used in the book? 

A. You can get the code from the book page as well as the Packt GitHub repository.

Q. What are you doing with the money from the book? 

A. All royalties from the book will be donated to charity, although I have not decided where yet.

Q. Are you interested in writing more books? 

A. Absolutely! But I need to take a break first to recharge. :)

Tuesday, June 27, 2017

Scalable Text SMS System

I worked in a corporate telecommunication group for a while. I had a passion for Voice over IP (VoIP) technology, in fact, I had two US Patents that was filed and later on granted while with the technology. It is extremely difficult to build a scalable telecom network, especially dealing with local regulations, circuits, servers, hardwares and making all of them work together. Once you get the initial system up and running, you will need to repeat and rinse as you grow.

That is why it was so exciting to see a service like Twilio that simplified all the backends for you and reduce the service to API calls. With them doing the heavy lifting, you can now incorporate AWS API Gateway and Lambda to scale out your SMS Text notification service really easily. Check out my guest blog on the Twilio site:

As always, happy coding!

Tuesday, November 22, 2016

LittleBits Summer Event

If you have read my other blog post about LittleBits, you know I am pretty bullish about the kids-maker-movement. I do think LittleBits need more use cases and need to branch our and start making an effort to work with other devices instead of having a closed ecosystem. But kudos to them for developing a nice product that is very kids-friendly and easy to learn.

My 2015 Hackathon project at Microsoft actually had to do with LittleBits and Raspberry Pi 3 running Windows 10 Core, which won the 3rd place in the Teachers/Students/School category. That was actually the highlight of my summer that year. My goal, to whoever was willing to stop and listen at my booth, was to introduce this tool to the Microsoft Store and host kids summer camp to learn about electronics. To me, this is a great way to keep re-use the kits and benefit as much kids as possible without needing the parents to shell out an arm and a leg for LittleBits kits only to have the kids get bored after a week.

Which was why I was super excited to learn that Microsoft Store is now carrying the LittleBits kits at the store.

Maybe somebody was listening and this was the first step to carry out the idea I proposed? One can only hope... :)

Happy Coding!

Tuesday, November 15, 2016

Voice User Interface with Alexa - First Impression

It is so weird when a product works better in real life than from marketing hype. The last time I think this happened was with iPod and iPhone, it was simply something you have to get your hands on in order to appreciate the device. For me, my concern with iPod was the ease of user interface; with iPhone, how a small screen can conduct what a big screen used to do. Obviously both of the products were wildly successful and solved those two questions way ahead of me.

The biggest question on Alexa for me was this:

"Who needs a voice interface when we have virtual reality, Kinect, and a super computer that fits in your palm?" 

I thought it was going to another 10-inch Kindle that sounds ok but quickly goes away. But I think I was wrong about it. Here is the story behind it.

I am a fan of StraTechery, both the blog and Podcast. They were consistently bullish on Amazon, in particular Echo as a device and Alexa as a platform. So I thought, what the heck, I will give it a try. I was surprised at how easy it was to get started, how much Amazon has thrown its resources behind it. Even without a device, you can use EchoSim to simulate an voice controlled device and tied it to the back end.

As I read more about the use case, I think I am gradually beginning to think of it as a valid additional option. Here are what I think they do that is different:

1. You don't always have a phone with you at home, and Echo is precisely a home-based device.
2. It is hands-free, so you can operate it when you are busy with your hands and just want a quick answer. If you pay attention, you will be surprised how many times at home you just want a quick answer without pulling out your phone.
3. It is less tech than a phone. I stare at a computer screen most of the day and a phone screen the rest of the time. I treasure the time I can stay away from it while still getting the information I needed.

But even as I am turning from a non-believer into a curious party, the whole process of building my first app was still prove to be pretty difficult. In particular, I don't understand Amazon Lambda and that was suppose to be the 'easy' option to tie in the voice skill to AWS.

Stay tune for my next blog post about how I eventually was able to build my first "Hello World" app on Alexa.

ps. What does it have to do with Python and Network Engineering? Probably very little besides you can write network and Python-related apps down the line. But hay, all things starts with a little curiosity! :)

Happy Coding!

Tuesday, November 1, 2016

My New Favorite Chrome Extension - Momentum

Chrome extensions are pretty awesome, with Google's announcement for end of support for Chrome Apps, Chrome extensions will have greater importance to the game. 

I discovered Momentum earlier today when I was watching a YouTube video of Google Hangout. When he switch to a new tab, I saw this beautiful page that read "What is Your Main Focus for Today?". Which instinctively I asked myself "What IS my main focus for today?" So I pause the video and went on Google Web Store and found Momentum. 

What was a pleasant surprise is that besides the picture and weather information, you can input your own task items, cross it out, add a new item, etc. All without logging in. 

I enjoyed being reminded of my main focus everyday with inspirational quotes and beautiful images in the background. I hope you do too! 

Happy Coding! :)

Tuesday, October 11, 2016

Combine Facebook API with Twitter Bot

It has been a while since I last looked at Facebook Graph API. I had a small project that would benefit from crawling a Facebook group, here is what I want to do:

1. Crawl a Facebook group for feed periodically.
2. Parse out the Feeds for a particular person.
3. Tweet to me when that happens.

For #1 and #3, I have already done that before with Twython and AWS Lambda in this post. So I just need to figure out how to crawl Facebook group. Here were the steps I took:

1. Create a Facebook App ID and get App secret. This is pretty easy and self-explanatory.

2. Use the Facebook Graph API Page and Documentation to find the right URI to get the feed that you want. This was the most time consuming as Facebook changes access rights from version to version, and there are differences between App Token and User Token. What I finally found was using the User Token for version 2.2 (latest was 2.7) was what I needed.

Here is the curl example. You can get the group ID from going directly to the Facebook group and looking at the URI. The feed limit is just to speed up the response:

○ → curl -i -X GET \

>  "<facebook group ID>?fields=feed.limit(10)&access_token=<token>" 

3. The user token is only good for about an hour, you can make it a 60 day long term token. Here was the Facebook LInk, but I find this instruction to be much easier. 

4. Now that I have the feed, I just need to parse it out for message, creation time, and other fields that I wanted and fill in what I did before for Twitter bot and upload to Lambda. One thing that I did wrong was previously using update_status which spammed all of my followers, so I switched to direct_message. Here is the code: 

import requests, pprint, json, re, datetime
from twython import Twython
from twython.exceptions import TwythonError

with open('credentials.json') as f:
  credentials = json.loads(

client = Twython(credentials["consumer_key"],

url = "<group>?fields=feed.limit(50)&access_token=<long term access token>"

def lambda_handler(event, context):
    r = requests.get(url)
    for i in r.json()['feed']['data']:
        if i['from']['id'] == '<some user ID>':
            if'shirt', i['message']):
                name = (i['from']['name'])
                createdTime = (i['created_time'])
                message = (i['message'])
                text = <your text>
                client.send_direct_message(screen_name="<some user>", text = text)

Thanks for reading. Happy Coding!