2024年2月10日 星期六

notepad++ 8.6 開始中英文無法 1:2 等寬!

 如題,目前尚未找到解法,只好回去找舊版,測試發現 v8.5.8 以前都還可以用,v8.6 開始就死了,中英文無法等寬對齊。

abcdefghijkl
測試測試測試


測試用,這兩行應該要等長。

2020年11月6日 星期五

git bare repo 更新單一分支

 最近為了給某個 minor 出來的 git server 端加上另一個遠端的分支,碰上不少麻煩

最初

git remote add newRemote url

然後

git fetch newRemote

 把新遠端的東西抓下來,但這個遠端的東西只有這個 bare repo 自己知道,沒辦法提供給下游拉。

在 git branch 下面找半天,不論怎麼新建 branch 去追蹤新遠端上的分支都給我跳 fatal

雖然後來發現

git branch -t newBranch newRemote/newBranch

即使跳了 fatal: not tracking: ambiguous information for ref 之類的東西,但查一下 log 會發現根本就成功了

不過保險起見,後來都在 config 中加上了

[branch "newBranch"]
        remote = newRemote
        merge = refs/heads/newBranch

接著用

git fetch newRemote newBranch:newBranch

來更新這個 branch

2018年5月27日 星期日

弔祖母

  弔祖母  107/5/27
半載才逢外公薨
七天祖母加護中
時人不解祥和面
今日亡得駕鶴蹤

2018年5月3日 星期四

CentOS7 gdm 詭異死亡修復紀錄

107/05/03

上個月伺服器的 gdm 就離奇死亡了,推測是那次 yum repo 大爆炸好不容易修好後留下的後遺症

當時找半天找不到問題,去 /etc/gdm3/custom.conf 把 debug 打開看半天也看不出所以然

結果錯誤訊息在 /var/log/gdm/:0-greeter.log

一直說找不到 gdm-shell.session

最後是參考這篇 https://bugs.launchpad.net/ubuntu/+source/gdm3/+bug/1737279

修改 /etc/dconf/db/gdm.d/00-upstream-settings


[org/gnome/desktop/session]
session-name='gdm-shell'

改成

[org/gnome/desktop/session]
session-name='gnome-login'

然後

# dconf update

重新產生 cache 的 db 檔

最後重開 gdm

# systemctl restart gdm

2018年4月9日 星期一

網頁伺服器撞上 SELinux

還是碰到了這個問題,筆記一下解法

來源:
https://superuser.com/questions/882594/permission-denied-because-search-permissions-are-missing-on-a-component-of-the-p
https://blog.lysender.com/2015/07/centos-7-selinux-php-apache-cannot-writeaccess-file-no-matter-what/

查詢 selinux 的攔截紀錄
/var/log/audit/audit.log
被攔截時會看見的訊息
type=AVC msg=audit(1464350432.916:8222): avc:  denied  { getattr } for  pid=17526 comm="httpd" path="/var/www/app/index.html" dev="sda1" ino=42021595 scontext=system_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:var_t:s0 tclass=file
type=SYSCALL msg=audit(1464350432.916:8222): arch=c000003e syscall=4 success=no exit=-13 a0=7fde4e450d40 a1=7ffd05e79640 a2=7ffd05e79640 a3=7fde42e43792 items=0 ppid=17524 pid=17526 auid=4294967295 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=4294967295 comm="httpd" exe="/usr/sbin/httpd" subj=system_u:system_r:httpd_t:s0 key=(null)
設定存取權
chcon  --user system_u --type httpd_sys_content_t -Rv /your/html/path
查詢目錄的存取權
ls -laZ /var/www/
正常的情形
drwxr-xr-x. server server system_u:object_r:httpd_sys_content_t:s0 .
drwxr-xr-x. root   root   system_u:object_r:var_t:s0       ..
drwxr-xr-x. server server system_u:object_r:httpd_sys_script_exec_t:s0 cgi-bin
drwxr-xr-x. server server system_u:object_r:httpd_sys_content_t:s0 html
drwxrwxr-x. server server unconfined_u:object_r:var_t:s0   app

更新,對於需要被 php 寫入的目錄:
# Allow write only to specific dirs
chcon -t httpd_sys_rw_content_t -R your/html/path

httpd_unified 沒開的話似乎會分的更細,才會需要上面對寫入的處理,設定起來更麻煩,開起來以後只要通通給 httpd_sys_content_t ,網頁伺服器就可以完全存取了

否則你還會需要設定 httpd_sys_script_exec_t... 等權限種類,一種用途就多一個設定



113/1/25 追記 php 使用 curl 外聯被檔

最近把一個站移植到別地方想做測試站,結果所有 curl 要求都拿到空白,http code 拿到 0 ;有些是 curl 有當作 error , curl_errno($ch) 拿到 7 但是 curl_error($ch) 卻完全空白。

但這時候用指令直接執行 curl 卻又能正常取得內容。

結果找到最後也是 selinux 的問題,因為他有個設定值能阻擋網頁伺服器對外連線:

httpd_can_network_connect 

查詢設定值:

# getsebool httpd_can_network_connect

若顯示 off 就表示被設成阻擋。

改成開啟,允許對外連線:

# setsebool -P httpd_can_network_connect on

打開後終於可以收到東西了。


參考:

https://stackoverflow.com/questions/50807700/apache-cannot-make-outgoing-http-requests-using-curl

 


2017年11月4日 星期六

弔兵中

  弔兵中  106/9/17
昔年祖父花中現
近日外公冰裡藏
耄耋滿福應足去
飲食無味是何嘗

2016年5月28日 星期六

1050528單車環繞灣區一周


拖了好久總算是真的給他騎出去了,畢竟再不騎就快沒機會了

全路線:
1.Santa Clara -> Frement Central Park -> Oakland Chinatown -> Emeryville -> Bay Bridge -> West Oakland
(8:00 -> 10:30-11:30 -> 14:00-15:30 -> 16:00-16:20 -> 17:30 -> 17:55)


2.BART: West Oakland -> Embarcadero (16:02-18:14)

3.Embarcadero -> Target -> South San Francisco
(18:30 -> 18:50-20:20 -> 21:15)


4.Caltrain: South San Francisco -> Lawrence (21:31 -> 22:40)