自架Git Server

參考網址:https://hackmd.io/@JohnnyTsai/ry3xUAAKD

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install openssh-server
sudo service ssh restart

# 安裝 git
sudo apt-get install git-core

# 新增專用群組 gitgroup
sudo groupadd gitgroup

# 新增 gituser 並指定成 gitgroup & 設定密碼
sudo useradd -s /bin/bash -g gitgroup -m -d /home/gituser gituser
sudo passwd gituser

# 建立 git repository資料位置
sudo mkdir -p /opt/gitRepository
# 變更擁有者,主要是為了指定群組
sudo chown gituser:gitgroup -R /opt/gitRepository
sudo chgrp -R gitgroup /opt/gitRepository

#切換到 gituser 帳號
# 建立專案資料夾並初始化
cd /opt/gitRepository
mkdir project_name.git
cd project_name.git
git init --bare --shared

#推送本地專案到遠端倉庫
git remote add origin gituser@localhost:/opt/gitRepository/project_name.git

git push -u origin master

 

發表於 Linux系統 | 發表迴響

[anydesk]端口和白名單

參考網址:https://support.anydesk.com/zh-tw/knowledge/firewall

AnyDesk 客戶端使用 TCP 端口 80443 和 6568 建立連接。 但是,只要打開其中一個就足夠了。

AnyDesk 的“發現”功能使用 50001–50003 範圍內的空閒端口和 IP 239.255.102.18 作為通信的默認值。

可能有必要將 AnyDesk 列入防火牆或其他網絡流量監控軟件的白名單,但需要例外:“*.net.anydesk.com

發表於 軟體使用 | 發表迴響

[ubuntu]用指令設定終端機顯示中文訊息

參考網址:阿舍

首先,可以先用 locale 指令確認一下目前使用的語系為何,預設的情況下,應該會看到像下面這樣,所有的語系設定都是 en_US.UTF-8 的。

 

$ locale 

LANG=en_US.UTF-8 

LANGUAGE= 

LC_CTYPE="en_US.UTF-8" 

LC_NUMERIC="en_US.UTF-8" 

LC_TIME="en_US.UTF-8" 

LC_COLLATE="en_US.UTF-8" 

LC_MONETARY="en_US.UTF-8" 

LC_MESSAGES="en_US.UTF-8" 

LC_PAPER="en_US.UTF-8" 

LC_NAME="en_US.UTF-8" 

LC_ADDRESS="en_US.UTF-8" 

LC_TELEPHONE="en_US.UTF-8" 

LC_MEASUREMENT="en_US.UTF-8" 

LC_IDENTIFICATION="en_US.UTF-8" 

LC_ALL=

確定沒有設定成中文後,接下來,阿舍就要把 Ubuntu 的語系來改成中文了,台灣的正體中文使用的語系代碼是「zh_TW」,所以,操作步驟的指令們就是下面這樣。

sudo locale-gen zh_TW 

sudo locale-gen zh_TW.UTF-8 

sudo dpkg-reconfigure locales 

sudo update-locale LANG="zh_TW.UTF-8" LANGUAGE="zh_TW"

上面的指令都跑完後,用 locale 指令來看的話,語系還會是原來的 en_US.UTF-8,會這樣,是因為要語系環境變數要登出再登入才會變更哩 ! 因此,設定完成後,請先登出再登入,再用 locale 指令來看,應該就會是 zh_TW.UTF-8 了哩 !

 

發表於 Linux系統, 程式設計 | 發表迴響

[html]一個方便使用的網頁瀏覽統計工具

參考網址:https://whos.amung.us/stats/

發表於 程式設計 | 發表迴響

[無線路由器]雙WAN功能

參考網址:https://www.asus.com/tw/support/faq/1011719/

https://www.asus.com/tw/support/faq/1050116/

如何在雙WAN路由器上設定網路備援功能?

發表於 硬體維修 | 發表迴響

[教學]如何去除手機App 以及網頁中的廣告|Adguard|Hosts Go

參考網址:https://www.youtube.com/watch?v=cTKwwHrwhRY

私人DNS dns.adguard.com

發表於 ANDROID, 軟體使用 | 發表迴響

[windows]將 Windows 自動更新暫停到 2051 年 12 月 31 日 – Windows Update Killer

參考網址:將 Windows 自動更新暫停到 2051 年 12 月 31 日 – Windows Update Killer | UNIKO's Hardware

下載

Releases · Aetherinox/windows-update-killer

由於 Windows 10 和 Windows 11 家用版不提供關閉自動更新的功能,最多透過暫停更新去延長下次進行更新的時間,使用者只能依賴其他方式去避免更新。先前分享過 StopUpdates10 與 Windows Update Blocker 兩款自動更新關閉工具,考量到有些人不想使用第三方工具,因此分享國外網友製作的登錄檔,使用後可以暫停更新至 2051 年 12 月 31 日喔!
如果沒使用登錄檔,家用版最多暫停 5 週。

發表於 Windows系統 | 發表迴響

[excel]秩序冊出場序版面產生器

參考網址:李坦闊老師FB https://www.facebook.com/tancle.taiwan
下載點 http://bit.ly/3gjxD0S
使用教學 影片說明 https://youtu.be/Qj-HtxSDvM0
本系統是在Fb社團「Excel 函數教學 & 討論」發問,由「陳鴻儒」先生撰寫原始碼,「閃鈴教室」做些微修改後,無償提供大眾使用。

發表於 Windows系統, 程式設計 | 發表迴響

[php]php 8 How to solve this error? strlen(): Passing null to parameter #1 ($string) of type string is deprecated in

參考網址:question2answer

Before PHP 8.1:

echo strlen(null); // No deprecation notice is shown up.
// -> 0

As of PHP 8.1:

echo strlen(null); // Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in ... on line ...
// -> 0

Solution

The RFC describing this issue is really helpful for possible resolutions and I highly recommend reviewing it. As of Question2Answer, the official resolution was to make use of the Null Coalescing Operator (??) when possible; here is an example from GitHub, which replaces:

if (strlen($error )) {...}

with this:

if (strlen($error ?? '')) {...}

This effectively fixes the issue.

 

合併運算子(??)
php7開始支援
PHP 7 新特性二Null coalescing operator(空合并运算符)
空值合併運算子

如要相容於php5.6得改掉「??」
 

https://github.com/tad0616/tadnews/commit/master
修正PHP5.x會出錯的問題
$result['of_ncsn'][$ncsn] = $page['of_ncsn'] ?? $the_ncsn;
$result['of_ncsn'][$ncsn] = isset($page['of_ncsn']) ? $page['of_ncsn'] : $the_ncsn;

 

發表於 程式設計 | 發表迴響

[php][ajax]一個不錯的table界面

參考網址:https://datatables.net/

網路閒晃,意外發現。

Add advanced interaction controls to your HTML tables the free & easy way

發表於 軟體使用 | 發表迴響