關於網路那些事...

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

fx - 在命令列檢視 json (command line json viewer) 的開發者工具

在前後端分離架構中,需要頻繁的測試及查看 json ,通常都會透過 postman, insomnia 來輔助開發

這裡要介紹的是在 Command-Line 可直接檢視 json 的套件 fx

Continue Reading

How to download all files from Google Cloud Storage.

How to back up GCP Storage file and folder to local?

Here I’m using gsutil tool command line tool to download all file to local.

Continue Reading

解決,Laravel - getMimeType 取得檔案類型遇到 The file "" does not exist

在開發上傳檔案套件過程,原本測試圖片上傳功能都正常

但是當上傳 pdf, video 時,卻遇到 getMimeType 發生 The file "" does not exist 的錯誤

查詢原因,原來是在 php 原始設定的最大上傳限制設定太低

因此,開啟 php.ini 設定 upload_max_filesize 調整為 10Mb 即可正常上傳

Continue Reading

資料搬遷,從GCP Storage 遷移到阿里雲儲存(OSS)

通常在建構系統中,擴充新服務,在遷移過程,有時會需要將雲端資料進行搬移

最近剛好一個系統需要將GCP上面的Storage資料遷移到阿里雲OSS

在這裡做一個紀錄

Continue Reading

Laravel - 上傳檔案至阿里雲 OSS 空間

這裡記錄如何使用 Laravel 的 storage 上傳檔案到 ali-oss

這裡所使用的 Laravel 版本:5.7.12

Continue Reading

Git 的好幫手 - Tig 讓你在cli將版控可視化

Tig 其實就是將 Git 到過來念的單字,這個工具

他將許多Git的功能,處理成更加直觀及快捷的交互操作

透過 Tig 可以很方便的讓我們直接在 cli 查看 git log, diff, blame…等

這裡將從安裝到一步步介紹用法

Continue Reading

更新 nodeJS 至最新版

方法一、更新 nodejs 至最新版

更新方式

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

Continue Reading

Git stash 暫存指令,解決Git代碼衝突

有時在 pull 過程,偶爾都會遇到 Git 發生衝突的狀況

commit your changes or stash them before you can merge.

或者,在我們開發某個新feat功能,需要先處理一些修改再返回繼續開發時,

這時,就可以透過 git stash 暫存指令將目前開發內容暫存起來

先將新增的內容 pull 下來,或等我們狀況處理完畢,再將暫存內容取回

用法如下:

Continue Reading

修復,阿里雲 RHSA-2017:3263: curl security update

在阿里雲 ECS 默認的安裝環境,看到 安全警示 RHSA-2017:3263: curl security update

阿里雲的 centOS 7.4 預設的 curl 及 libcurl 不是最新版本,存在漏洞問題

修復該漏洞的方式:

Continue Reading

解決,ssh add 出現 Could not open a connection to your authentication agent.

當執行 ssh-add 時

ssh-add ~/.ssh/<private_key_file>

如果出現錯誤訊息: Could not open a connection to your authentication agent.

執行進入 ssh bash ,就能正執行 ssh-add

ssh-agent bash

ssh-add ~/.ssh/<private_key_file>

Continue Reading

阿里雲設置 ssh key 至 bitbucket 流程簡記

阿里雲設置 ssh key 至 bitbucket 流程簡記

設定 ssh key 到 bitbucket

ssh-keygen -f ~/.ssh/your_custom_name -C "youremail@emailhost.com"

Continue Reading

Git - 在新的 repository 保留過去歷史 commit log 紀錄,及同時連結多個 remote 作法

針對一些需求,要將舊有專案作為基礎來進行重構或者修整,讓新專案可以使用

最簡單的做法就是直接將 .git 刪除,再將所有專案一次加入新的 repository

但是過去專案執行過程所保留的紀錄,在遇到一些問題時,至少還有歷史 commit log 可以參考

保留原本的 git log 在新的 repository 延續使用方式:

查看目前 remote

查詢目前專案的 remote repository

git remote -v

Continue Reading

檔案權限列表

權限

r : 讀取 w : 寫入 x : 執行

權限角色

擁有者(u), 群組(g), 其他使用者(o)

所有使用者(a)

權限與數值關係

權限數字 數值相加 權限表示
0 0+0+0
1 0+0+1 –x
2 0+2+0 -w-
3 0+2+1 -wx
4 4+0+0 r–
5 4+0+1 r-x
6 4+2+0 rw-
7 4+2+1 rwx

檔案型態

檔案型態 說明
d 目錄
- 檔案
l 連結檔
b 儲存的周邊設備
c 序列設備

常見格式

目錄 777 drwx rwx rwx

檔案 755 -rwx r-x r-x

檔案 644 -rw- r– r–

Continue Reading

解決,Docker ERROR: Bad response form Docker engine

在Mac安裝新版本 OS 之後,出現了 docker-compose 無法正常 up 的情況

解決方式:

開啟 docker premerence

點選 Reset > Reset to factory default

接著需要重新登入 Docker

再次啟動之後,再透過 up 重新載入 images ,完成啟動

完成

Continue Reading

MacOS 升級後,出現的 xcrun: error: invalid active developer path (/Library/...), missing xcrun at: /Library/Developer/.../bin/xcrun 錯誤

最近Mac升級了 OS 之後

git 使用時會出現錯誤訊息

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

解決方法:

重裝 xcode

xcode-select --install

問題應該就會解決

如果還是不行,可以試試

sudo xcode-select -switch /

Continue Reading

阿里雲, mac iterm2 ssh 登入

直接透過 ssh 最基本的連線方式,連接到阿里雲

首先,取得阿里雲實例的公網IP

然後透過 ssh 直接進行連線,及輸入密碼

Continue Reading

CentOS 遠程建立 Docker & Docker-compose

添加 yum

yum install epel-release –y
yum clean all
yum list

移除舊版,安裝新版本

sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine

確認移除

docker info

安裝必要的 repository

sudo yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2

使用 stable repository

sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

啟用 edge (可自行決定是否啟用)

sudo yum-config-manager --enable docker-ce-edge

(若不想啟用 edge,也可以直接關閉):

sudo yum-config-manager --disable docker-ce-edge

安裝新版本

sudo yum install docker-ce

檢查安裝結果

docker info

啟動/關閉

sudo systemctl start docker     #運行Docker守護進程
sudo systemctl stop docker      #停止Docker守護進程
sudo systemctl restart docker   #重啟Docker守護進程

安裝 Docker-compose

sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

添加權限

Continue Reading

Laravel Telescope

Laravel Telescope

Laravel Telescope 是一個全面監控的 debug 助理,是由 Laravel 開發團隊所推出的一項功能,支援 Laravel 5.7.7 以上的版本。

其中包括以下的項目都包含在 watcher :

Continue Reading

SSO (Single Sign On) 單點登入及跨域驗證方式

跨域驗證本身存在著許多風險,其中最知名的中間人攻擊Man-in-the-middle attack (MitM attacks),透過劫持 wifi 傳輸過程中所訪問的router ,解析其中的憑證,就能來偽裝用戶進行登入。

若採用 SSL及可防止網路請求被攔截,

針對單一單入即可在不同 Domain 做跨域驗證的做法,最知名的就是 Single sign on (sso)

Continue Reading

如何將主 DNS子網域point到另一個網域子資料夾

設定主網域指向 B 網域

在主網域的 DNS A-record ( 如果用 IPv6 則設定 AAAA-record ) 指向到另一個網域的IP

注意,DNS 只能指向 IP ,無法指向該IP的子資料夾

另一個網域的主伺服器設定請求轉導

當主 DNS point 到另一個子網域後,另一個子網域本身應該要 point 到一台主機

則需要在這一台主機進行設定 Virtual hosting

來對於子網域的 redirect/equate 指向子資料夾的部分,

例如,由 subdoname.A.com 請求過來時,會透過這個方式: ${DocumentRoot of B.com}/folder ,會提供 folder 內容

https://vlemon.com/blog/google-cloud-platform/how-to-create-sub-domain-in-google-cloud-compute-engine/

Continue Reading