Skip to content

Instantly share code, notes, and snippets.

this.polyLine = new H.map.Polyline(
this.lineString, {style: {lineWidth: 4, strokeColor: "#62A8EA", lineDash: [4]}}
)
from dateutil.relativedelta import relativedelta
# def date_iter_periodicity(start_date, end_date, hold_days):
# date = start_date
# while date < end_date:
# yield (date), (date + datetime.timedelta(hold_days))
# date += datetime.timedelta(hold_days)
def date_iter_periodicity(start_date, end_date, interval):
date = start_date
while date < end_date:
def 獲利年數(data):
eps = data.get('稀釋每股盈餘合計', 4*10).fillna(0)
count = 0
for start, end in zip(range(0, 37, 4), range(4, 41, 4)):
if not (eps.iloc[start:end].empty):
count += eps.iloc[start:end].sum() > 0
return count
import configparser
import json
import logging
import time
from hashlib import md5
import requests
config = configparser.ConfigParser()
config.read('config.ini')
web: node src/index.js --log-file -
const {LineHandler} = require('bottender')
const olami = require('./nlp/Olami')
const helpMessage = 'Hi~ 本 Bot 是用 http://bit.ly/2uz7wY4 開源程式碼打造\n\n' +
'您可以問我\n' +
'天氣:「台北天氣如何」\n' +
'百科:「川普是誰」\n' +
'新聞:「今日新聞」\n' +
'音樂:「我想聽周杰倫的等你下課」;「播放告白氣球」;「播放動漫歌曲類型的歌」\n' +
'日曆:「現在時間」\n' +
const {LineHandler} = require('bottender')
const olami = require('./nlp/Olami')
exports.lineHandler = new LineHandler()
.onText(async context => {
const text = context.event.text
const userId = context._session.user.id
const reply = await olami.nli(text, userId)
await context.reply([reply.toLineMessage()])
}
module.exports = class Message {
constructor(data) {
this.data = data
}
toLineMessage() {
return this.data
}
toMessengerMessage() {
const config = require('../../config')
const axios = require('axios')
const md5 = require('md5')
const KKBOX = require('../api/KKBOX')
class Olami {
constructor(appKey = config.olami.appKey, appSecret = config.olami.appSectet, inputType = 1) {
this.URL = 'https://tw.olami.ai/cloudservice/api'
this.appKey = appKey
this.appSecret = appSecret
const config = require('../../config')
const axios = require('axios')
const md5 = require('md5')
class Olami {
constructor(appKey = config.olami.appKey, appSecret = config.olami.appSectet, inputType = 1) {
this.URL = 'https://tw.olami.ai/cloudservice/api'
this.appKey = appKey
this.appSecret = appSecret
this.inputType = inputType