分類
方法

Bislama introduction from Air Vanuatu

In the late 19th century at the height of the practice of Blackbirding, thousands of Ni-Vanuatu were forced to work on plantations in Australia and Fiji. With several languages being spoken in these plantations, a form of pidgin English was developed, combining English vocabulary with grammatical structures typical of languages in the region. This early plantation pidgin is the origin not only of Bislama, but also of Tok Pisin of Papua New Guinea and Pijin of the Solomon Islands.

This pidgin started spreading over the Vanuatu archipelago at the turn of the 20th century, as the survivors of Blackbirding began to come back to their native islands. Knowledge of this pidgin would facilitate communication not only with European traders and settlers, but also between native populations of remote islands within the archipelago.

Ni-Vanuatu began to add their own words and pronunciation (today 95% of Bislama is based on English, with a few dozen French words and ‘island language’ thrown in).

Over the past century or so, Bislama has evolved to what is currently spoken and written in Vanuatu.

In order to understand Bislama, common advice is to throw in the words "long" and "blong" a few times every sentence and you'll just about have It.

For example,

Stoa kolosap long haos: The store next to the house.

Mi bin stap long ples ia bifo: I have stayed at this place before. Breakdown of the sentence:
- "Mi" means "I"
- "bin" is a past tense marker, indicating that the action happened in the past.
- "stap" means "staying" or "living."
- "long" is a preposition that means "in" or "at."
- "ples" means "place."
- "ia" is a demonstrative marker that can mean "this" or "that" depending on the context.
- "bifo" means "before" or "previously."

Mi stap long stoa: I am at the store.

Jea long haos: The chair in the house.

Buk blong mi: The book that belongs to me, my book

Man Amerika: Man from America, American.

Hemi woman blong saiens: She is a woman of science, she is a scientist.

Here's a few other phrases to get you going on your journey to discovering this fascinating and fun new language.

  • How much is that? Hamas long hem?
  • How much is this? Hamas long hemia?
  • Do you know..? Yu save (pronounced savvy)
  • I don’t know. Mi no save
  • This is broken Samting ia hemi bugarup or Samting ia i brok
  • The best Nambawan
  • How are you? Olsem wanem
  • I'm okay la oreat
  • Water Wota
  • Drinking water Freswota
  • Ocean Solwota
  • Full / too much Fulap
  • Thank you Tankyu
  • Thank you very much Tankyu tumas
  • My name is... Nem blong mi
  • What time does the plane land? Wanem taem plen ia lan?
  • Food/eat Kai Kai
  • Dictionary Diksonari

本文更新於 2023/02/20。

分類
程序

使用 Cloudflare Worker 中轉 HTTP 請求

Cloudflare Worker 可以方便的中轉 HTTP 請求,下面示例是我之前用過的,算是密碼保護的中轉特定請求。其中的 X_Custom_PSK 算是密碼,在 Settings > Variables 設置,這樣就只有我的程序可以請求。

addEventListener("fetch", event => {

  const psk = event.request.headers.get("X_Custom_PSK");
  if (psk === X_Custom_PSK) {
    event.respondWith(handleRequest(event.request));
  }else{
    const failed_response = new Response('Sorry, you have supplied an invalid key.', {
      status: 403,
    });
    event.respondWith(failed_response);
  }
})

async function handleRequest(request) {
  const resp = await fetch('https://domain.ltd/checkpoint/list', {
      method: 'POST',
      headers: {
          'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.3 Safari/537.36',
          'Accept': '*/*',
          'Accept-Language': 'zh-CN;q=0.8,zh;q=0.6,en-US;q=0.4,en;q=0.2',
          'Origin': 'https://domain.ltd',
          'DNT': '1',
          'Connection': 'keep-alive',
          'Referer': 'https://domain.ltd/',
          'Sec-Fetch-Dest': 'empty',
          'Sec-Fetch-Mode': 'cors',
          'Sec-Fetch-Site': 'cross-site'
      },
      body: new URLSearchParams({
          'page': '1',
          'pageSize': '10',
          'latitude': '22.5',
          'longitude': '114.0',
          'queryType': '0'
      })
  });
  return resp;
}

下面這個則是用一個 worker 代理多個網站。

addEventListener("fetch", event => {
  let url=new URL(event.request.url);
  if (event.request.url.indexOf('shaman')>-1){
      url.hostname="ft.shaman.eu.org";
  }else{
      url.hostname="www.rfi.fr";
  }  
  let request=new Request(url,event.request);
  event.respondWith(fetch(request));
});
分類
软件

Proton VPN stops network after suspend in Fedora

Proton VPN的免費用戶有日本、荷蘭和美國三個國家的節點可供使用,安卓用戶可以從 F-Driod 下載官方客戶端,Fedora 需要先在添加軟件源然後就可以方便安裝。使用的方便程度以及免費節點的速度都非常好。但是牆內直接是用不了的。

有一個問題是,在Fedora 中,連接着 Proton VPN 的時候 Suspend,然後喚醒的時候有機率會網絡不通,其實是 Proton VPN 異常關閉導致的。Proton VPN 生成了一個包含 ipv6leak 的連接,用來防止泄露 IP,但是異常關閉的時候,卻沒來得及刪除它,所以網絡都斷了。可以嘗試這樣解決:

#list all the links, find the link contains 'ipv6leak'
ip link
#remove the link
sudo ip link delete ipv6leakintrf0

值得一提的是,如果你同時有使用 NextDNS,DNS 也可能成爲網絡中斷假象的原因之一。測試辦法有兩個,一是使用 Tor 打開任意網頁,因爲 Tor 並不依賴系統的 DNS 設置,如果能上網證明本地 DNS 可能有問題。二是使用 dig 命令,如果運行 dig ft.shaman.eu.org 返回 no servers could be reached 但是運行 dig ft.shaman.eu.org @45.90.28.136( 牆內可用 114.114.114.114 )返回正確 IP 地址,則也證明 DNS 可能有問題。可嘗試重啓 NextDNS 來解決:

nextdns restart
分類
网站

使用 AWS S3 創建自有域名的靜態網站

對於普通流量不大的靜態站點,所需的 AWS 服務都是免費的,但是我要先提醒,AWS 的使用體驗真的很繁瑣,至少比在 VPS 中建立網站複雜多了。這裏只是大概記錄一下使用亞馬遜服務建立一個自有域名且啓用了 HTTPS 的靜態網站的步驟。

首先你要有一個亞馬遜服務的賬戶。然後在 S3 服務中建立一個 Bucket,如果你的網站是 abc.domain.ltd 那麼你的 Bucket 名字就可以叫 abc.domain.ltd 。要給予公共訪問權限,以及啓用 Static website hosting 。設置完成後在 Properties 選項卡的底部可以看到訪問這個靜態站點的 URL( 如:http://abc.domain.ltd.s3-website-us-east-1.amazonaws.com/ )。如果你往這個 Bucket 里上傳一個 index.html 文件,那麼應該可以通過 http://abc.domain.ltd.s3-website-us-east-1.amazonaws.com/index.html 訪問到。

第二步是通過 AWS Certificate Manager 申請或導入啓用 HTTPS 所需的證書。我沒有試過導入,所以這裏只介紹下申請。申請時我只填寫里二級域名,使用的 DNS 驗證方式。提交後可以看到需要添加的 CNAME DNS 記錄。如果域名在 Cloudflare 那麼直接新建一條 CNAME 記錄,填入 Host 和 Value 的值,過一小會兒就能看到證書頒發里。如果是在 Namecheap, 直接複製進去 Host 和 Value 值似乎不行,可以嘗試只輸入 Host 值的前兩部分(第二個點之前的字符,如:_904706782abb3d16301321f28db53e03.abc )以及不帶最後一個點的 Value(如:_0ba986089fff81c1b4f395a2ea75f42e.hkvuiqjoua.acm-validations.aws )。可以使用 dig 命令查看 DNS 記錄是否生效: dig _904706782abb3d16301321f28db53e03.abc.domain.ltd CNAME 如果生效了會在 ANSWER SECTION 看到前面設定的值。如果沒有生效或設置錯誤,會出現 status: NXDOMAIN 及 ANSWER: 0 字樣。

第三步是在 AWS CloudFront 里新建一個 Distribution,選擇需要的 Bucket 以及輸入要用域名 abc.domain.ltd。證書那裏選擇剛剛生成的證書。建立後會生成一個 Distribution domain name 類似d174updd62jl4k.cloudfront.net 。然後在 DNS 中再增加一條 CNAME 記錄,Host 是 abc,值是 d174updd62jl4k.cloudfront.net 。生效後就大功告成可以用 https://abc.domain.ltd 訪問了。如果你遇到 SSL_ERROR_NO_CYPHER_OVERLAP 報錯,可以嘗試在 Distribution 的 General 選項卡中找到 Alternate Domain Names 輸入框,輸入你的域名如 abc.domain.ltd ,待其生效後應該就可以了。

分類
软件

使用 Shelter 把老大哥的應用隔離起來

我在索尼手機上已經使用 Shelter 很久了,不用 Root,隔離應用,簡單有效。

把不常用的應用裝到『工作模式』,使用時打開,不用時凍結。即使需要給予那些應用一些敏感權限,但是工作模式有自己的通訊錄等資料,所以也無需太擔心。也可以設置自動凍結,但是我沒有試過。

掃描工作模式中新增的媒體

有一個問題是,當我從主要模式複製了照片到工作模式(如微信),但是從工作模式的應用里卻看不到那張照片(打開朋友圈里的相冊卻看不到這張照片)。這時需要觸發一下系統的媒體掃描,在沒有安裝額外應用的情況下,似乎只能通過重啓手機來觸發。但是好在有應用可裝,那就是 SD Scanner。把它安裝在工作模式,按一下 START RESCAN 就可以了。雖然這個應用的最後更新日期是 2017 年,但它在安卓 10 的系統上仍然能工作的很好。我沒有更新系統的手機,如果 SD Scanner 無法在更新系統的手機上使用,你可以嘗試下載一個叫 AZ MediaScaner 的閉源軟件,它是最近更新的,但是它有用戶跟蹤。

分類
软件

轉用 Visual Studio Code

之前無論是 PHP、Java 還是 Python,我都使用 Eclipse 這款開源的老編輯器。直到最近因爲種種原因切換到了 Visual Studio Code。

其中最重要的一點是,我的網絡成本增加,使用 Visual Studio Code 的遠程模式( Remote Development using SSH ),可以在服務器上編程與調試,節省了很多流量。遠程還有一個優點是網絡質量比本地更好,比如安裝編譯安卓應用所需的谷歌依賴,那些動輒上 GB 大小的依賴,再也不必考慮代理的問題。

我還是習慣於用 python -m venv project_venv 的方式建立項目專用的虛擬環境,VS Code 會自動識別項目中的虛擬環境,很方便。

代碼檢查與美化( linting )也是開箱即用。Eclipse 雖然可以自由配置多種 linter,但是我費了很多心力都不得其法。

在離開 Eclipse 前給他們捐了一點錢,我還是很樂意再用回去的,如果 Eclipse 能在日常編程體驗上追上其他編輯器。前不久還收到一個 Eclipse 用戶調查,我甚至看不懂他們新產品是做什麼的,可能我就快要被編程行業所淘汰了……

分類
软件

使用 Screen Stream 來分享安卓屏幕

Screen Stream 是一款由 Dmitriy Krivoruchko 開發的老牌(始於 2016 年)開源安卓屏幕共享軟件。使用方便,還支持中文,推薦有需要的朋友使用。

它主要是局域網共享屏幕,甲手機打開軟件,點擊開始即可。然後乙手機,在瀏覽器裏輸入甲手機的網址(或掃碼)就可以觀看了。就是這麼簡單!如果想要通過因特網分享屏幕,那麼你得確保你有公網 IP,使用方法是一樣的。

通過調教幀率和畫質,可以減輕手機網絡和性能消耗(少發一點熱)。通過設置安全選項,可以控制只通過 WiFi 網絡分享(即不通過手機網絡分享)或者只在本機分享(相當於是程序接口)。

通過服務器實現屏幕共享

由於沒有公網 IP,又想要分享屏幕給遠方親友,則可以通過服務器來實現。思路有很多,我有實現一個非常簡單辦法。對分享一方來說,可以通過 Termux 來把圖片 Post 到服務器,服務器收到圖片後展示出來即可。所用的 Termux 命令爲:

watch -n 3 "curl http://127.0.0.0.1:8080/stream.jpeg | curl -k -s -X POST --data-binary @- https://my.image.server/image_in"
#即每隔 3 秒,把圖片傳送到服務器一次

我的圖片服務是一個簡單的 Django 網站,免費部署在 pythonanywhere,等我有空了可以把代碼整理下發出來。我也測試過讓甲通過瀏覽器,用 Javascript 來把圖片轉發到服務器,Chrome 下是可以的,但是火狐裏網頁一到後臺,JS 就停止工作,搜了一下也沒找到火狐網頁保活的辦法。

理論上,把視頻流直接轉發到 Nginx,應該更加高效流暢,但是我沒有測試過。