關於網路那些事...

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

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

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 確認移除

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 指向子資料夾的部分,

Continue Reading

MAC 無法使用 git 狀況排解:xcrun: error: invalid active developer path...missing xcrun at:

在Mac 更新 cli 後發生 git 無法適用的情況 錯誤訊息: git ixcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun 解決方式: 輸入下方指令,安裝完成即可解決 xcode-select --install

Continue Reading

l5-repository Presenter 上手2

Presenter

前面提到,在 l5-repository 有兩種方式可以實作 Presenter

第一種,可以直接建立 Transformrer 並且設定他來操作 Presenter class 第二種,可以直接在 model 實作 Transform 的 interface,並且 use 預設的 Presenter ModelFractarPresenter,也能達到同樣的效果

開始使用 Presenter 之前,必須 Requires Fractal

Continue Reading

l5-repository 上手

安裝

composer require prettus/l5-repository

設定 ServiceProvider

如果是 >= laravel5.5 ,ServiceProvider 會自動設定好

其他版本

要在 config/app.php 增加

'providers' => [
    ...
    Prettus\Repository\Providers\RepositoryServiceProvider::class,
],

發布設定

設定完成多出一個設定檔: /config/repository.php

php artisan vendor:publish --provider "Prettus\Repository\Providers\RepositoryServiceProvider"

Continue Reading

DNS Resource Record (RR)

DNS Server

負責處理 DNS 相關服務

Zone File

每一個域名都會有相對應的檔案,稱為區域檔案(Zone File),每一個 Zone File 都可以各自設定類型(Resource Record, RR),底下則介紹一些 RR 及相關用法

SOA - Start Of Authority

在 zone file 一開始會進行 SOA 定義,

在 SOA 描述 name server, version … 等,並且指定要授權的主機及管理者信箱

Continue Reading