Saturday, June 24, 2017

Alexa Skill: Word Helper

Word Helper

{
  "intents": [
    {
      "intent": "AMAZON.HelpIntent"
    },
    {
      "intent": "AMAZON.StopIntent"
    },
    {
      "intent": "AMAZON.CancelIntent"
    },
    {
      "intent": "WordHelperAddIntent",
      "slots": [
        {
          "name": "Word",
          "type": "AMAZON.Food"
        }
      ]
    },
    {
      "intent": "WordHelperGetIntent"
    },
    {
      "intent": "WordHelperDeleteIntent",
      "slots": [
        {
          "name": "Word",
          "type": "AMAZON.Food"
        }
      ]
    }
  ]
}

WordHelperAddIntent add {Word}
WordHelperAddIntent put {Word}
WordHelperAddIntent save {Word}
WordHelperDeleteIntent remove {Word}
WordHelperDeleteIntent delete {Word}
WordHelperGetIntent tell me a word
WordHelperGetIntent  give me a word
WordHelperGetIntent tell me something
WordHelperGetIntent give me something

Lambda Test:
use Alexa Intent - GetNewFact


Skill Test:
add bacon
put scrambled egg
save chocolate cake
tell me a word
give me something
remove chocolate cake
delete lemon juice


Ref:
Create a skill steps
Example: Skill with Lambda
How to Config intent with parameter
Skill NodeJS lambda example
Skill NodeJS project example
Skill Java project example
Slot Type reference


https://stackoverflow.com/questions/41358552/how-to-get-the-account-info-of-the-user-when-the-user-uses-an-alexa-skill

Sunday, June 18, 2017

AWS Pipeline简介


CodeCommit: 代码repository。只要有代码commit就会触发pipeline
CodeBuild: 选用python:2.7.12来编译代码,Python需要写buildspec.yml (Python例子),target files表示要copy到目标机器的文件
CodeDeploy: 配置要deploy的目标机器,在目标机器安装CodeDeploy agent,以及触发初始run







































CodeDeploy official
CodeDeploy other

Thursday, June 15, 2017

Python常用library

Linux
sudo apt-get install python2.7


SQLAlchemy: python最流行的ORM工具
Logging: http://www.jianshu.com/p/feb86c06c4f4
YAML: http://www.ruanyifeng.com/blog/2016/07/yaml.html

__init__: 双下划线为保留函数
__name: 私有函数/属性

person_1.py:

class Person:

   def __init__(self):
       self.__name = 'haha'#私有属性
       self.age = 22

   def __get_name(self):##私有方法
       return self.__name

   def get_age(self):
       return self.age

person = Person()
print person.get_age()
print person.__get_name()

不带self就是与object无关
def read_tag(file_name, tag, freq_cutoff=-1, init_dict=True):

Dictionary.read_tag(file_name, 'dialogue', freq_cutoff=freq_cutoff)

带self就是与object相关
def add_word(self, word):

dictionary.add_word(token)

继承:
http://www.cnblogs.com/feeland/p/4419121.html



Python语法

Wednesday, June 7, 2017

Squid反向代理简介 - Linux



sudo su
yum update
yum upgrade
yum -y install squid

vi /etc/squid/squid.conf

http_access allow all

sudo service squid stop
sudo service squid start

https://www.youtube.com/watch?v=BkjKINJIHsk