關於網路那些事...

Marketing, SEO, Web trends, Programming tutorial, Web design, and Life event...

AudioCompare (base on Shazam ) 實測

下載AudioCompare

git clone https://github.com/charlesconnell/AudioCompare.git

進行比對

./audiomatch -f howareudoing.wav -f howareudo.wav
# MATCH howareudoing.wav howareudo.wav (39)

./audiomatch -f howareudoing.wav -f howsgoingtoday.wav
# MATCH howareudoing.wav howsgoingtoday.wav (13)

./audiomatch -f howareudoing.wav -f howareudoing.wav
# MATCH howareudoing.wav howareudoing.wav (112)

./audiomatch -f application.wav -f howareudo.wav
# NO MATCH

目前測試結果,準確性相當低

透過文字自動生成的音檔,可比對出匹配指數 但是透過實際發音的檔案,同樣唸法仍無法匹配出來

Continue Reading

解決 Mac - ERROR: No matching distribution found for MySQLdb

Mac - ERROR: No matching distribution found for MySQLdb

在 Mac 直接透過 brew 安裝 MySQLdb,會出現錯誤提示:No matching distribution found for MySQLdb

解決方式:

brew install mysql-connector-c  

pip install mysqlclient  

這時會出現錯誤,請前往

cd /usr/local/Cellar/mysql-connector-c/6.1.11/bin/  
cp  mysql_config mysql_config.bak #備份
chmod u+w mysql_config  
vi mysql_config  

將 114 行的 ```libs="$libs

接著再執行安裝就成功了

CVT2HUGO: -l "``` 改為 ```libs="$libs -lmysqlclient -lssl -lcrypto"```
pip install mysqlclient  

Continue Reading

CentOS7 安裝 ffmpeg

CentOS7 安裝 ffmpeg

安裝 EPEL 來使用其他 repo 資源

yum install -y epel-release

sudo rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

sudo rpm –import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro

sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm

yum repolist 

接著執行

yum install -y ffmpeg

查看版本

ffmpeg -version 

Continue Reading

[解決] CentOS7 - PocketSphinx 安裝過程狀況排解

##[解決] CentOS7 - PocketSphinx 安裝過程狀況排解

在安裝 PocketSphinx 過程中

pip install PocketSphinx

發生了安裝錯誤訊息:

error: command ‘swig’ failed with exit status

這部分處理很簡單,缺什麼安裝什麼:

先來安裝 swig

yum  install swig -y

接著再進行安裝,出現另一個錯誤:

**include <pulse/pulseaudio.h>

解決方式:

CVT2HUGO: error: command 'gcc' failed with exit status 1**
yum install python34-devel -y
yum install alsa-lib-devel alsa-utils

最後執行安裝~完成

pip install PocketSphinx

Continue Reading

解決 Python [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed

解決 Python [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed

最近在測試 wit.ai 語音辨識過程出現 CERTIFICATE_VERIFY_FAILED 錯誤,原因是 Python 3.6 之後的版本更改了 OpenSSL 協定,因此需要手動進行更新

Could not request results ; recognition connection failed: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056) Could not request results from Wit.ai service; recognition connection failed: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)

Continue Reading

CentOS7 安裝 PyAudio 發生錯誤[解決]

CentOS7 安裝 PyAudio 發生錯誤[解決]

執行

pip install PyAudio

如果出現以下次錯誤


Collecting PyAudio
  Downloading https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz
Building wheels for collected packages: PyAudio
  Building wheel for PyAudio (setup.py) ... error
  ERROR: Complete output from command /opt/rh/rh-python36/root/usr/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-aqdgoicv/PyAudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-3dqdycqf --python-tag cp36:
  ERROR: running bdist_wheel
  running build
  running build_py

原因在於,需要安裝 portaudio ,解決方式如下:

wget http://portaudio.com/archives/pa_stable_v190600_20161030.tgz
tar -xvf pa_stable_v190600_20161030.tgz
cd portaudio
./configure

接著在執行安裝,應該就會正常

pip install PyAudio

Continue Reading

CentOS7 安裝 Python3

CentOS7 安裝 Python3

在這裡紀錄如何在 CentOS7 安裝 Python3 ,主要透過 Software Collections(SCL)來安裝 python3

vim  /etc/yum.repos.d/CentOS-Base.repo

尋找 extras

Continue Reading

Command line 快捷鍵

Command Editing Shortcuts Ctrl + a – go to the start of the command line Ctrl + e – go to the end of the command line Ctrl + k – delete from cursor to the end of the command line Ctrl + u – delete from cursor to the start of the command line Ctrl + w – delete from cursor to start of word (i.e. delete backwards one word) Ctrl + y – paste word or text that was cut using one of the deletion shortcuts (such as the one above) after the cursor Ctrl + xx – move between start of command line and current cursor position (and back again) Alt + b – move backward one word (or go to start of word the cursor is currently on) Alt + f – move forward one word (or go to end of word the cursor is currently on) Alt + d – delete to end of word starting at cursor (whole word if cursor is at the beginning of word) Alt + c – capitalize to end of word starting at cursor (whole word if cursor is at the beginning of word) Alt + u – make uppercase from cursor to end of word Alt + l – make lowercase from cursor to end of word Alt + t – swap current word with previous Ctrl + f – move forward one character Ctrl + b – move backward one character Ctrl + d – delete character under the cursor Ctrl + h – delete character before the cursor Ctrl + t – swap character under cursor with the previous one Command Recall Shortcuts Ctrl + r – search the history backwards Ctrl + g – escape from history searching mode Ctrl + p – previous command in history (i.e. walk back through the command history) Ctrl + n – next command in history (i.e. walk forward through the command history) Alt + . – use the last word of the previous command Command Control Shortcuts Ctrl + l – clear the screen Ctrl + s – stops the output to the screen (for long running verbose command) Ctrl + q – allow output to the screen (if previously stopped using command above) Ctrl + c – terminate the command Ctrl + z – suspend/stop the command

Continue Reading

Golang - Gin router 基本介紹

Go - Gin router 基本介紹

這裡針對 Gin routers 進行基本介紹,後續會針對個部分進行探討。

Gin 基本的一個架構如下方代碼:

Continue Reading

Golang - Go Module 套件管理 & 初始化及安裝 gin

Go - go module 初始化及安裝 gin

Gin 是一個 Golang 網頁架構,具有相當好的效能,高於 httprouter 40 倍的速度,是一個兼具效能與實用的架構。

這裡首先會針對 go module 初始化 如何透過 Go Module 管理套件,以及說明如何透過 Go Module 安裝 gin 的流程。

Continue Reading

AWS 與 Google 語音辨識費用比較

AWS 與 Google 語音辨識費用比較

這裡找了一下 AWS 跟 Google 語音辨識的計費比較.

目前評估兩家換算的金額都很接近,

如果使用一次單字平台測驗,其中包括單字加上老師補充單字

以每次使用 30次及 60 次口說題,大致會花費 $NT 6~11 塊

AWS Google
產品名稱 Transcribe speech-to-text
網址 https://aws.amazon.com/tw/transcribe/ https://cloud.google.com/speech-to-text/pricing?hl=zh-tw
計費方式 0~15秒 0.18,之後每秒 0.012 每 15秒 0.06
測驗一個單字 0.18 0.18
單字平台(30次) 5.4 5.4
單字平台(60次) 10.8 10.8
單位 台幣

備註

中國區域語音辨識價格約略在 0.004 元/次 人民幣 驰声 http://www.chivox.com/englishoralevaluation/index.aspx 百度 http://ai.baidu.com/docs#/ASR-Pricing/top 讯飞 https://www.xfyun.cn/services/voicedictation

Continue Reading

Mac Install Vim 外掛 - NERDTree

Mac Install NERDTree

安裝 pathogen.vim

mkdir ~/.vim/autoload
mkdir ~/.vim/bundle
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim

開啟 vim ~/.vimrc 加入

execute pathogen#infect()

安裝 NEDRTree

cd ~/.vim/bundle
git clone https://github.com/scrooloose/nerdtree.git

可以先試著開啟 vim 並且輸入 :NERDTree

CVT2HUGO: 如果看到目錄就表示成功
:NERDTree

接著,將快捷鍵加入 vim ~/.vimrc

vim ~/.vimrc

設定 F5 為快捷鍵

nnoremap <silent> <F5> :NERDTreeToggle<CR>

o 開啟關閉的文件或目錄

t 在頁籤開啟

T 在後台頁籤開啟並且執行

p 到上層目錄

K 到第一節點

J 至最後節點

u 開啟上層目錄

m 顯示文件系統菜單(添加刪除移動操作)

q 關閉

Ctrl+ww cycle though all windows

Ctrl+wh takes you left a window

Ctrl+wj takes you down a window

Continue Reading

在 CentOS7 安裝 Protocol Buffer

這裡記錄在 CentOS7 安裝 Protocol Buffer 流程

sudo yum install autoconf automake libtool unzip gcc-c++ -y
git clone https://github.com/google/protobuf.git
cd protobuf
./autogen.sh
./configure
make
make install 
protoc --version

Continue Reading

Failed to decode response: zlib_decode(): data error 解法

Failed to decode response: zlib_decode(): data error 解法

composer clear-cache

把下方這段加到 composer.json

    "repositories": [
        {
            "type": "composer",
            "url": "https://packagist.org"
        },
        { "packagist": false }
    ],

執行

sudo composer update

Continue Reading

Golang 技術方向紀錄

簡記一些學習 Go 的技術方向

Web Framework

Gin https://github.com/gin-gonic/gin Echo https://echo.labstack.com/guide BeeGo https://beego.me/

Gin Websocket

https://github.com/gin-gonic/gin/issues/1305 example: https://github.com/gin-gonic/gin/issues/1305

go module

類似 php vender 動套件管理工具: 透過 go mod init 會產生 go.mod

Drone CI/CD

透過 Drone 來實現 Go CI/CD https://drone.io/

Vim go

vim 的擴充 https://github.com/fatih/vim-go

Go Package

https://godoc.org/

Go WebTool

https://www.gorillatoolkit.org/

Continue Reading

DDoS/Dos 之 SYN 攻擊

DDoS/Dos 之 SYN 攻擊

DDoS/Dos 攻擊通常可以用不同模式來達成,這裡介紹其中常見的 SYN 攻擊

SYN 攻擊

主機資源在 Client 端訪問時,通常會透過三次交握來溝通。主機第一次收到 Client 的 SYN 請求,會先處於 SYN_RCVD 的半連結狀態,並且發送封包給 Client 端進行第二次交握,Client 收到確認後,第三次才會正式攜帶參數及資料與主機溝通。而如果攻擊方透過 Client 端發送大量的偽造 IP 發送 SYN 封包給主機,每一個封包都會建立一個等待 Client 回覆確認,由於是偽造IP,因此 Server 端會持續的重複嘗試與 Client 溝通,直到主機設定的超時時間抵達才終止程序。當主機存在大量的半連結狀態連結時,並且這些連結都是隨機IP形式存在,超過主機可負荷的量就會讓主機掛掉。

檢視目前處遇 SYN_RCVD 狀態的連結方式:

netstat -n -p TCP | grep SYN_RECV

防止 SYN 攻擊有以下做法:

  • 適當的給予超時時間(SYN Timeout)
  • 容許大量的半連結狀態連結
  • 使用 SYN COOKIES 技術
  • 防火牆

Continue Reading

解決:Yum 執行發生 Error: rpmdb open failed 錯誤

解決:Yum 執行發生 Error: rpmdb open failed 錯誤

在一次執行 yum 相關指令時,會爆出 Error: rpmdb open failed 錯誤 錯誤的原因是過去執行 yum install 或 update 過程中,可能有不正常中斷的情況發生,導致rpm 資料庫毀損。

Continue Reading

EC2 安裝 composer

EC2 安裝 composer

這裡記錄如何在 AWS EC2 安裝 composer

cd ~
sudo curl -sS https://getcomposer.org/installer | sudo php
sudo mv composer.phar /usr/local/bin/composer
sudo ln -s /usr/local/bin/composer /usr/bin/composer
sudo componstall
composer -v

Continue Reading

解決 xxx Packages excluded due to repository priority protections

解決 xxx Packages excluded due to repository priority protections

在 EC2 進行 PHP 升級過程中,發生 xxx Packages excluded due to repository priority protections

此狀況發生原因是,啟用了 priorities ,讓 plugin 安裝會選擇高優先權的 packages

解決方式,可直接開啟 priorities.conf 將設定關閉即可

vim /etc/yum/pluginconf.d/priorities.conf

設定 enabled = 0

Continue Reading

GCP 輪動更新流程

GCP 輪動更新流程

這裡記錄一下在 GCP 如何進行輪動更新的流程:

建立映像檔

  1. Computer Engine > 映像檔 > 建立映像檔
  2. 輸入“名稱”、選取”來源“選項點選磁碟,以及“來源磁碟”選取實例
  3. 勾選讓執行個體繼續執行
  4. 輸入 “系列”、“說明”
  5. 點選建立

Continue Reading