Skip to content

Instantly share code, notes, and snippets.

View kkdai's full-sized avatar

Evan Lin kkdai

View GitHub Profile
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""xml2json.py Convert XML to JSON
Relies on ElementTree for the XML parsing. This is based on
pesterfish.py but uses a different XML->JSON mapping.
The XML->JSON mapping is described at
http://www.xml.com/pub/a/2006/05/31/converting-between-xml-and-json.html
@kkdai
kkdai / gemini-cf.go
Created April 12, 2024 13:16
LINE Bot Cloud Function - demo code in Go
package helloworld
import (
"context"
"fmt"
"net/http"
"io"
"log"
"os"
# package>=version
line-bot-sdk
requests
git+https://github.com/ozgur/python-firebase
google.generativeai
from linebot import LineBotApi, WebhookHandler
from linebot.models import TextSendMessage
import json
import os
from firebase import firebase
import google.generativeai as genai
# 使用環境變量讀取憑證
token = os.getenv('LINE_BOT_TOKEN')
@kkdai
kkdai / github-isssue-rag-langchain.ipynb
Last active February 21, 2024 03:36
Github Issues LangChain RAG Q&A 的 Colab
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kkdai
kkdai / devday2023.ipynb
Created November 8, 2023 16:04
devday2023.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import os
import sys
import aiohttp
from fastapi import Request, FastAPI, HTTPException
from langchain.chat_models import ChatOpenAI
from langchain.chains import ConversationChain
from langchain.memory import ConversationBufferWindowMemory
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
如何登入賣家中心?
①至賣家中心後台:<https://sellercenter.line.biz/giftshop> ,點選「登入ID」
②點選「使用LINE帳號登入」
③輸入帳號、密碼
• 電子郵件帳號:<XXX@l.ine> (前方代碼為廠商自訂,後方固定為@l.ine)
• 如無法順利登入可透過首頁上的「忘記密碼」來取得登入資訊。
無法登入賣家中心
賣家中心的網址2022/07改版後更新為: <https://sellercenter.line.biz/giftshop/>
func getPOIsFlexBubble(records ResponsePOI) []*linebot.BubbleContainer {
log.Println("getPOIsFlexBubble")
if len(records.Pois) == 0 {
log.Println("err1")
return nil
}
var columnList []*linebot.BubbleContainer
for _, result := range records.Pois {
log.Println("Add flex:", result.Name, result.CoverPhoto, result.PoiURL)