2019年7月6日 星期六

讀<騎乘鐵公雞>雜感 2

文筆很好, 也有在思考, 不是一般的旅行文學.
真實反應了美國人的盲點 : 他都沒有想過, 天寒地凍時, 人們不多燒點煤炭, 反而在家裏穿大衣,  原因是貧窮? 而不是他以為的愚昧或被毛澤東洗腦?

忽然連想到 PTT 上現在很多言論都會把原因歸為 "洗腦"  : 如中國人XXX都是被他們習皇洗腦,   台灣那些誰誰誰會支持 XXX 都是因為 OOO 當政時的洗腦.

所以, 這是人類盲點的一致性 ? 簡易有效的推論. (->有效的可以繼續導向自己想要說的真正話題)

另, 明末皇宮裏就有地球儀了,  作者所說的 1850 中國人才知道地球是圓的不知是哪來的誤解.
不過, 話說, 同時在看一篇講明清庶民享樂生活的論文, 我才知道很多西洋物品在明清江南/閩廣一帶已經很流行, 並不需要穿越女去"發明"~~

2019年7月4日 星期四

台灣 vs 吉隆坡的行道樹 (讀騎乘鐵公雞雜感)

<騎乘鐵公雞>讀到第五章, 作者從上海坐火車到廣州, 提到中國"沒有古老的樹"

不確定這看法的正確性, 但確實勾起了 1997 去吉隆坡時, 對那裏高大的行道樹印象極深 -- 平平是都市裏的榕樹, 他們的怎麼長到這麼高的? 是因為氣候? 還是因為曾是英國殖民地? (對英國都市裏的樹印象也很深)

這作者這麼說, 我想了一下, 日本的行道樹也不算高, 去過的幾個中國城市...嗯, 好像是沒什麼大樹?

2019年6月3日 星期一

ubuntu 18.04 as wifi hotspot password problem

    理論上, ubuntu 16.04 以後只要用 network manager ui, 選 hotspot 即可建立, 簡單方便, 但我在16.04 就沒成功, 理由忘了, 18.04 還是沒成功, 理由是 password 認證都失敗
 
    google 到有人問, 但解法試了都不成

    回頭試著用目前 16.04 hostapd + dnsmasq 的做法, 也不行, 都能取得 ip , 但無法上網...

    改回試 network manager , google " change password  fail"
    一堆回答都叫你去 ui 改 -> 就不行啊, 然後找到有人說直接去改這裏的文字檔.
    /etc/NetworkManager/system-connections

    此人甚為好心, 把他自己的設定檔整個 PO 出來, 結果我看到一個不同的地方 :
    [wifi-security] 這個 section , 他多了三行
group=ccmp;
pairwise=ccmp;
proto=rsn;
   加上去之後,  reboot (不會重開 network manager ), 就可以了, 但如果手殘又去 network manager ui 裏按 save, 這三行會不見, 然後 password 又會失敗.

   可喜可賀, 這是 network manager ui 的 bug ?

** 一週後的 update ***
16.04 也可, 也是改這三行, 而且這三行在 16.04 上也有, 只是空白, 改了之後就 OK 了.
而且, 拿掉 hostapd + dnsmasq 及其設定後, 長久以來 firewall 不會自行啟動的問題一並解決了...

2019年6月2日 星期日

ubuntu 18.04 mpv live stream

雖然 16.04 活得很好, 但最近還是很努力的在想辦法搞定 18.04

常用功能遇到兩個問題:

1. mpv + youtube-dl 放 live stream 時 (主要是公視直播) 會停在大約五秒處, 有時停頓之後一兩分鐘會繼續, 有時完全停下.
   此問題在 16.04 和 19.04 都沒有, 我一度懷疑是 python 版本 (3.5, 3.6, 3.7 ), 但後來想到 youtube-dl 可以用 python 2, 試了之後才排除 python 的嫌疑

   google  到的資料很少, 但終於看到一個 keyword : ffmeg

   去抓了最近的 ffmpeg, compile + install 很簡單, youtube-dl 沒問題了, 但 mpv 還是不行
   仔細看看 log, 發現 mpv 自帶 ffmpeg -> 也是有問題的那版, 本想 mpv 也來 compile 一下, 不過發現 mpv 有現成的 deb 可裝, 裝好之後就 OK ~~


2. wifi hotspot
    革命尚未成功, 同志仍需努力...

2019年5月25日 星期六

mpv 硬解 ( in ubuntu 16.04 )

最近在試 4K 影片, 一直無法播,  後來發現是搞烏龍 : 抓來的影片其實是 8K ~~

不過在過程中也發現原來我一直都是用"軟解", 在播高畫質影片時, CPU 幾乎都是滿載.

G4600 內顯的 driver 在 Ubuntu 16.04 得另外裝,  intel 很機車, 還得裝它的 installer : intel-graphics-update-tool_2.0.2 ( 2.0.4 不能裝), 然後經由它再裝 driver.

最後在 mpv.conf 裏要設 hwdec=vaapi

然後 mpv 起來時就可以看到它說 "Using hardware decoding (vaapi)",
CPU usage 也降到二三十, 差好多~~

PS. ubuntu 18.04 不用這麼麻煩, G4600 在 2017 出現, 所以 18.04 版跟它很熟

2018年12月8日 星期六

Ubuntu 16.04 解 LCD 上的水平紋

一直以為是電腦不夠力, 或電視太爛

最近忽然想到來 google 一下, 才發現這是可以解決的

https://askubuntu.com/questions/945895/solution-to-intel-graphics-screen-tearing-flickering-causes-excessive-fan-use

加個 file : /usr/share/X11/xorg.conf.d/20-intel_flicker_fix.conf

內容:
Section "Device"
   Identifier  "Intel Graphics"
   Driver      "intel"
   Option      "TripleBuffer" "true"
   Option      "TearFree"     "true"
   Option      "DRI"          "false"
EndSection

就這樣~~

不過有趣的是, 加了重開機後, xrandr 顯示 screen name 變了, 變回和 Ubuntu 10.04 一樣 : HDMI1 而不是 HDMI-1

2019/03/23 update:
 DRI 要設為 "true"
 換了大電視, 之前沒看出的較小細紋現在看得一清二楚, 設成 ture 之後就解決了~~

2018年1月19日 星期五

Ubuntu 16.04 as wifi hotspot

忘了在哪裏看來的, 但最終這是唯一確定可用的設定, PC 和 RPI 3 皆可用

ubuntu 現在不用 eth0 wlan0 了, 而是用一串很詭異的名字, 要先用 ifconfig 看一下再去改

1.
/etc/dhcpcd.conf
  add denyinterfaces wlan0 (above any interface line)

2.
/etc/network/interfaces
  edit wlan0 setion as
   -------------------
allow-hotplug wlan0
iface wlan0 inet static
    address 172.24.1.1
    netmask 255.255.255.0
    network 172.24.1.0
    broadcast 172.24.1.255
   -------------------

3.
install/config hostapd
/etc/hostapd/hostapd.conf
-------------------------
#this is the name of the WiFi interface we configured above
interface=wlan0

# Use the nl80211 driver with the brcmfmac driver
driver=nl80211

# This is the name of the network
ssid=Pi3-AP

# Use the 2.4GHz band
hw_mode=g

# Use channel 6
channel=6

# Enable 802.11n
ieee80211n=1

# Enable WMM
wmm_enabled=1

# Enable 40MHz channels with 20ns guard interval
ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]

# Accept all MAC addresses
macaddr_acl=0

# Use WPA authentication
auth_algs=1

# Require clients to know the network name
ignore_broadcast_ssid=0

# Use WPA2
wpa=2

# Use a pre-shared key
wpa_key_mgmt=WPA-PSK

# The network passphrase
wpa_passphrase=raspberry

# Use AES, instead of TKIP
rsn_pairwise=CCMP
-------------------------
/etc/default/hostapd
  DAEMON_CONF="/etc/hostapd/hostapd.conf"

4.
install/config dnsmasq.conf
/etc/dnsmasq.conf  ( orig : /etc/dnsmasq.conf.orig)
-------------------------
interface=wlan0      # Use interface wlan0
listen-address=172.24.1.1 # Explicitly specify the address to listen on
bind-interfaces      # Bind to the interface to make sure we aren't sending things elsewhere
server=8.8.8.8       # Forward DNS requests to Google DNS
domain-needed        # Don't forward short names
bogus-priv           # Never forward addresses in the non-routed address spaces.
dhcp-range=172.24.1.50,172.24.1.150,12h # Assign IP addresses between 172.24.1.50 and 172.24.1.150 with a 12 hour lease time
-------------------------

5. IPV4 forwarding
/etc/sysctl.conf
  net.ipv4.ip_forward=1 (# mark/unmark)
command line :
-------------------------
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT

sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
------------------------
/etc/rc.local
  iptables-restore < /etc/iptables.ipv4.nat

6.
sudo service hostapd start
sudo service dnsmasq start