This file contains hidden or 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
| apiVersion: v1 | |
| items: | |
| - apiVersion: rbac.authorization.k8s.io/v1alpha1 | |
| kind: ClusterRoleBinding | |
| metadata: | |
| creationTimestamp: 2017-02-23T00:03:51Z | |
| name: cluster-admin | |
| namespace: "" | |
| resourceVersion: "35" | |
| selfLink: /apis/rbac.authorization.k8s.io/v1alpha1/clusterrolebindingscluster-admin |
This file contains hidden or 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
| 'use strict' | |
| const projectId = process.env.DF_PROJECT_ID; | |
| const dialogflow = require('dialogflow'); | |
| const Users = require('./users.js'); | |
| const restRequest = require('./restRequest.js'); | |
| class AI { | |
| constructor() { | |
| console.log('dialogflow:project_id:' + projectId); |
This file contains hidden or 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
| 'use strict' | |
| const express = require('express'); | |
| const Linebot = require('./linebot.js'); | |
| const app = express(); | |
| const linebot = new Linebot(); | |
| //const ai = new AI(); |
This file contains hidden or 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
| apiVersion: v1 | |
| kind: Service | |
| metadata: | |
| name: line-bot-service | |
| spec: | |
| type: NodePort | |
| ports: | |
| - name: http | |
| port: 8100 | |
| targetPort: 8100 |
This file contains hidden or 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
| kind: Ingress | |
| metadata: | |
| name: fanout-ingress | |
| annotations: | |
| kubernetes.io/ingress.global-static-ip-name: -ip | |
| ingress.kubernetes.io/rewrite-target: / | |
| kubernetes.io/ingress.allow-http: "false" | |
| spec: | |
| tls: | |
| - hosts: |
This file contains hidden or 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
| metadata: | |
| name: elasticsearch | |
| spec: | |
| serviceName: elasticsearch-service | |
| replicas: 1 | |
| template: | |
| metadata: | |
| labels: | |
| role: elasticsearch | |
| spec: |
This file contains hidden or 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
| function ElkfetchData(elasticsearch, coin_type) { | |
| let query_body = { | |
| "query": { | |
| "function_score": { | |
| "query": { | |
| "multi_match": { | |
| "query": coin_type, | |
| "operator": "and", | |
| "fields": ["title", "content"] | |
| } |
This file contains hidden or 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
| from jpy_currency.items import ArticleItem | |
| from scrapy.utils.markup import remove_tags | |
| class ArticleSpider(scrapy.Spider): | |
| name = "articleSpider" | |
| def start_requests(self): | |
| print('start request currency news') | |
| urls = ['news web site'] | |
| for url in urls: |
This file contains hidden or 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
| def saveToELK(item): | |
| if Utility.elk is None: | |
| Utility.elk = Elasticsearch(hosts= 'elasticsearch') | |
| # 檢查如果沒有這個 index 則新增 | |
| if Utility.elk.indices.exists(index='article') is not True: | |
| res = Utility.elk.indices.create(index="article", body={ | |
| "mappings": { | |
| "article": { | |
| "properties": { | |
| "title": { |
This file contains hidden or 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
| public class WordCount { | |
| public Topology createTopology(){ | |
| StreamsBuilder builder = new StreamsBuilder(); | |
| // 監聽 Kafka 裡 topic 為 word-count-input 收到的資料 | |
| KStream<String, String> textLines = builder.stream("word-count-input"); | |
| KTable<String, Long> wordCounts = textLines | |
| // 查看收到的資料值 | |
| .peek((key, value) -> System.out.println(value)) | |
| // 資料值轉成小寫 | |
| .mapValues(textLine -> textLine.toLowerCase()) |
NewerOlder