Skip to content

Instantly share code, notes, and snippets.

View kcchien's full-sized avatar

Kuang-Cheng Chien kcchien

  • King Steel Machinery Co., Ltd.
  • Taichung, Taiwan
View GitHub Profile
@kcchien
kcchien / DeployCloudFunctions.sh
Last active May 18, 2019 06:57
Scanning User-generated Content Using the Cloud Video Intelligence and Cloud Vision APIs - 5
# 部置GCStoPubsub function
gcloud beta functions deploy GCStoPubsub --stage-bucket gs://${STAGING_BUCKET_NAME} --trigger-topic ${UPLOAD_NOTIFICATION_TOPIC} --entry-point GCStoPubsub --runtime=nodejs6
# 部置visionAPI function
gcloud beta functions deploy visionAPI --stage-bucket gs://${STAGING_BUCKET_NAME} --trigger-topic visionapiservice --entry-point visionAPI --runtime=nodejs6
# 部置videoIntelligenceAPI function
gcloud beta functions deploy videoIntelligenceAPI --stage-bucket gs://${STAGING_BUCKET_NAME} --trigger-topic videointelligenceservice --entry-point videoIntelligenceAPI --timeout 540 --runtime=nodejs6
# 部置insertIntoBigQuery function
@kcchien
kcchien / EditJSONConfig.sh
Created May 18, 2019 04:30
Scanning User-generated Content Using the Cloud Video Intelligence and Cloud Vision APIs - 4
sed -i "s/\[PROJECT-ID\]/$PROJECT_ID/g" config.json
sed -i "s/\[FLAGGED_BUCKET_NAME\]/$FLAGGED_BUCKET_NAME/g" config.json
sed -i "s/\[FILTERED_BUCKET_NAME\]/$FILTERED_BUCKET_NAME/g" config.json
sed -i "s/\[DATASET_ID\]/$DATASET_ID/g" config.json
sed -i "s/\[TABLE_NAME\]/$TABLE_NAME/g" config.json
@kcchien
kcchien / CreatePubSubTopics.sh
Created May 18, 2019 04:18
Scanning User-generated Content Using the Cloud Video Intelligence and Cloud Vision APIs - 3
# 建立4個不同用途的Topics
gcloud pubsub topics create ${UPLOAD_NOTIFICATION_TOPIC}
gcloud pubsub topics create visionapiservice
gcloud pubsub topics create videointelligenceservice
gcloud pubsub topics create bqinsert
# 檢查Topics是否正確被建立
gcloud pubsub topics list
@kcchien
kcchien / CreateCloudStorageBuckets.sh
Created May 18, 2019 03:58
Scanning User-generated Content Using the Cloud Video Intelligence and Cloud Vision APIs - 2
gsutil mb gs://${IV_BUCKET_NAME}
gsutil mb gs://${FILTERED_BUCKET_NAME}
gsutil mb gs://${FLAGGED_BUCKET_NAME}
gsutil mb gs://${STAGING_BUCKET_NAME}
# 檢查一下是否有列出4個Bucket
gsutil ls
@kcchien
kcchien / Initializing.sh
Last active May 18, 2019 04:25
Scanning User-generated Content Using the Cloud Video Intelligence and Cloud Vision APIs - 1
# 取得專案ID
export PROJECT_ID=$(gcloud info --format='value(config.project)')
# Cloud Storage buckets的名稱
export IV_BUCKET_NAME=${PROJECT_ID}-upload
export FILTERED_BUCKET_NAME=${PROJECT_ID}-filtered
export FLAGGED_BUCKET_NAME=${PROJECT_ID}-flagged
export STAGING_BUCKET_NAME=${PROJECT_ID}-staging
# Cloud Pub/Sub topic環境變數
@kcchien
kcchien / buildVSCode.sh
Last active July 24, 2020 17:19
在 nVidia Jetson Nano 編譯與安裝 VSCode buildVSCode.sh : 編譯與安裝 product.json: 要記得先覆蓋原始碼裡的那一份
# 退出桌面模式,以節省記憶體,不然編譯到一半會有記憶體不足的狀況,造成失敗
# 你的畫面會進入Console 模式,是正常的
sudo systemctl isolate multi-user
# 準備建置原始碼
yarn
# 建置原始碼,這個會要花一些時間,約15~20分鐘
yarn run gulp vscode-linux-arm64-min
yarn run gulp vscode-linux-arm64-build-deb
@kcchien
kcchien / zpl-tcp.js
Last active October 11, 2023 21:38 — forked from gourneau/zpl-tcp.py
Printing ZPL over TCP/IP Example Python , Node.js 如何透過TCP/IP 直接送出ZPL檔到條碼機列印
const net = require('net'); // 引入網路 (Net) 模組
const HOST = '10.10.10.168';
const PORT = 9100;
let zpl = `
^XA
^FO150,40^BY3
^BCN,110,Y,N,N
^FD123456^FS
^XZ
@kcchien
kcchien / miniconda_on_rpi.md
Last active October 29, 2018 06:49 — forked from simoncos/miniconda_on_rpi.md
Install Miniconda 3 on Raspberry Pi 在樹莓派上安裝 Miniconda
@kcchien
kcchien / install_fcitx_ime.sh
Last active November 17, 2019 02:24
Elementary os 安裝中文輸入法 倉頡,酷音
# Reference
# https://ithelp.ithome.com.tw/articles/10192648
# https://sites.google.com/site/paothsungchen/selflearning/elementaryos/inputchinese
# Fcitx official https://fcitx-im.org/wiki/Fcitx
sudo apt install software-properties-common
# 移除 ibus 框架
sudo apt remove --purge $(sudo dpkg -l | grep ibus | awk '{print $2}' | grep ^ibus)
@kcchien
kcchien / install_driver.sh
Created October 21, 2018 06:05
Elementary os 安裝在 Macbook 上找不到無線網路的解法
# Reference http://www.linuxlinx.com/2016/08/fix-no-wireless-on-macbook-after.html
# Removing bcmwl-kernel-source package, then reboot.
sudo apt-get remove --purge bcmwl-kernel-source
sudo reboot
# Installing new broadcom firmware.
sudo apt-get install firmware-b43-installer
# Reaload package.