在 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
Marketing, SEO, Web trends, Programming tutorial, Web design, and Life event...
這裡記錄在 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
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
簡記一些學習 Go 的技術方向
Gin https://github.com/gin-gonic/gin Echo https://echo.labstack.com/guide BeeGo https://beego.me/
https://github.com/gin-gonic/gin/issues/1305 example: https://github.com/gin-gonic/gin/issues/1305
類似 php vender 動套件管理工具: 透過 go mod init 會產生 go.mod
透過 Drone 來實現 Go CI/CD https://drone.io/
vim 的擴充 https://github.com/fatih/vim-go
https://www.gorillatoolkit.org/
Continue ReadingDDoS/Dos 攻擊通常可以用不同模式來達成,這裡介紹其中常見的 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 攻擊有以下做法:
在一次執行 yum 相關指令時,會爆出 Error: rpmdb open failed 錯誤 錯誤的原因是過去執行 yum install 或 update 過程中,可能有不正常中斷的情況發生,導致rpm 資料庫毀損。
Continue Reading這裡記錄如何在 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
在 EC2 進行 PHP 升級過程中,發生 xxx Packages excluded due to repository priority protections
此狀況發生原因是,啟用了 priorities ,讓 plugin 安裝會選擇高優先權的 packages
解決方式,可直接開啟 priorities.conf 將設定關閉即可
vim /etc/yum/pluginconf.d/priorities.conf
設定 enabled = 0
這裡記錄一下在 GCP 如何進行輪動更新的流程:
磁碟,以及“來源磁碟”選取實例在過去學習系統的影片為了避免被濫用,緊急情況下採用了 Vimeo 上架我們的線上學習影片,好處是可以直接針對影片設定允許IP及網域。
但最近前線反應在 Vimeo 上傳影片後,無法從後台同步回來。
後台檢查發現有 403 的錯誤,描述如下:
Continue Reading
Go 是現代化、速度相當快且擁有豐富的標準庫 透過 goroutine 併發非常有效率,單一線程可以執行多個 goroutine。 在設計併發架構最困難的部分在於如何確保多個併發進程、線程及groutine 不會同時針對同一資料進行操作。透過 Go 可以簡單地實現併發過程數據一致性。 Go 提倡組合(composition),而不是傳統繼承方式;因此,可直接多個類型組合成類型,並且引用這個類型就能使用整個組合的功能。 Go 在內存管理也處理得相當好,使用現代化的回收機制。
Continue Reading這裡指令皆使用 root 身分執行,若其他身分請使用 sudo
安裝環境為 CentOS 7 以上版本
這裡會介紹兩種安裝方式,第一種較為簡單,是直接透過 yum 安裝,另一種方式是直接下載安裝(推薦)
yum 安裝方式
# yum install golang
以下指令都是以 root 身分執行,其他用戶請加上 sudo
在Linux 設定用戶,並且開放 ssh 連線後,有時為了系統安全,需限制用戶僅能訪問指定目錄及指令
可以透過 chrooted 來進行設定
Continue Reading以下指令都是在 root 身分下執行,其他用戶身分請加上 sudo
在 CentOS 的 root email 可以直接查看 /var/sppl/mail/root 方式了解郵件內容
cat /var/spool/mail/root
Continue Reading
Linux 的用戶權限可以透過 usermod 設定,常用的命令包括
-aG 將用戶加入附屬群組
-c, --comment COMMENT new value of the GECOS field
-d, --home HOME_DIR 預設登入目錄 (new home directory for the user account)
-e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
-f, --inactive INACTIVE set password inactive after expiration
to INACTIVE
-g, --gid GROUP 修改用戶群組 (force use GROUP as new primary group)
-G, --groups GROUPS 修改用戶附屬群組 (new list of supplementary GROUPS)
-a, --append append the user to the supplemental GROUPS
mentioned by the -G option without removing
him/her from other groups
-h, --help display this help message and exit
-l, --login NEW_LOGIN new value of the login name
-L, --lock lock the user account
-m, --move-home move contents of the home directory to the
new location (use only with -d)
-o, --non-unique allow using duplicate (non-unique) UID
-p, --password PASSWORD use encrypted password for the new password
-R, --root CHROOT_DIR directory to chroot into
-s, --shell SHELL 設定用戶登入後的shell 版本 (new login shell for the user account)
-u, --uid UID new UID for the user account
-U, --unlock unlock the user account
-Z, --selinux-user SEUSER new SELinux user mapping for the user account
Continue Reading
Composer Git Hooks 可以讓你直接在 composer 設定進行管理 git hooks,透過這樣管理的好處在於,能避免每個開發者都有各自的git hooks 設定,透過 composer git hooks 能將所有開發者的 git hooks 統一納入版控。
Continue Reading這裡說明如何在 CentOS, Ubuntu 系統安裝 pecl
Continue Reading啟用 EPEL 以及 Remi Repository
$ yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm -y
$ yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
安裝 YUM-UTILS
Continue ReadingIn this article will showing how excute a phpunit for SQLite in laravel.
In here should prepare mysql and setting .env for database info.
First, create a hello model and use the -m options for generate a migration file
php artisan make:model Hello --m
Just need add name column in hello_table migration file:
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateHellosTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('hellos', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('hellos');
}
}
Excute artisan migrate command for generate table:
Continue ReadingMySql 主要的鎖可以分為幾種類型:
MyISAM與 InnoDB 都支援表級別與行級別鎖: X 鎖、 S 鎖
InnoDB的表級別鎖:IX鎖、IS 鎖
Continue Reading