2022年11月27日 星期日

easyforth , easy6502

easyforth , easy6502

這兩個都是javascript github 的project,
是非常優秀的0安裝,連得上網頁,就可線上的互動學習課程.

easyforth 從堆疊,變數,定義,迴圈等,最後實作一個打start 就能玩的貪食蛇.

easy6502 甚至assemble,step,disasm,monitor data memory 都有做.

http://skilldrick.github.io/easyforth/
http://skilldrick.github.io/easy6502/

https://github.com/skilldrick/easyforth

2022年11月24日 星期四

解決 snap store 的 notepad++ Icon/menubar 太小的問題

How to make notepad++ Icon/menu bar more large.
### 先備份一次原始的 user.reg, 而且只要備份一次 .
#### Method 1: 方法一
$ cp ~/snap/notepad-plus-plus/common/.wine/user.reg \
~/snap/notepad-plus-plus/common/.wine/user.reg_org
$ winecfg     ### to graphics tab , adjust a desired dpi, <apply>, <ok>
$ cp ~/.wine/user.reg  ~/snap/notepad-plus-plus/common/.wine/



#### Method 2: 方法二
# edit  your  ~/snap/notepad-plus-plus/common/.wine/user.reg
# 在該兩個 section  有找到 LogPixels 則直接改值,沒找到,則需添加.
# 若值 0A8 表示168 dpi, 090 表示  144dpi, 060 表示 96 dpi

[Control Panel\\Desktop] 1662713654
"LogPixels"=dword:00000090

[Software\\Wine\\Fonts] 1669332241
"LogPixels"=dword:00000090





ubuntu 18.04,22.04 設置 hinet pppoe 連線的 script file

設置 hinet pppoe 連線的 script file

以下 紅色 Hinet 為連線名稱,使用者名,及密碼,請修正.
兩條虛線間,存成 hinet_pppoe.sh
然後 $ chmod +x hinet_pppoe.sh
$ ./hinet_pppoe.sh
-------
LINK_NAME="Hinet"

echo Build a internet pppoe to ${LINK_NAME}

nmcli connection delete ${LINK_NAME}

echo nmcli con edit type pppoe con-name ${LINK_NAME}
echo -e \
"set pppoe.username 1234567@hinet.net\n"\
"set pppoe.password xxxxxxx\n"\
"print pppoe\n"\
"save\n"\
"yes\n"\
"quit\n" | nmcli con edit type pppoe con-name ${LINK_NAME}

nmcli connection show
nmcli dev status

echo You can delete by command: $ nmcli connection delete ${LINK_NAME}

---------

2022年11月15日 星期二

lazarus freePascal install and cross compile, on Host 64bit linux ,and cross to build win32 program

 *** My host is  linux ubuntu 18.04 64bit, 
*** target is to build linux 64bit  , and cross build win32 program
* download and install 3 packages : fpc-src, fpc-laz and lazarus-project


fpc-src_3.2.2-210709_amd64.deb
fpc-laz_3.2.2-210709_amd64.deb
lazarus-project_2.2.4-0_amd64.deb


* install 
$ sudo dpkg -i fpc-src_3.2.2-210709_amd64.deb
$ sudo dpkg -i fpc-laz_3.2.2-210709_amd64.deb
sudo apt install ./lazarus-project_2.2.4-0_amd64.deb
* check if successful
$ apt-cache policy fpc-src fpc-laz lazarus-project
** not need if you want remove 
** $ apt remove fpc-src fpc-laz lazarus-project


* How to build win32 exe file from  linux 64bit host
[00.] copy /usr/share/fpcsrc/3.2.2 to your ~/fpcsrc/3.2.2
[01.] cd ~/fpcsrc/3.2.2
[02.] make clean all OS_TARGET=win32 CPU_TARGET=i386
[03.] sudo make crossinstall OS_TARGET=win32 CPU_TARGET=i386 INSTALL_PREFIX=/usr
[04.] sudo ln -sf /usr/lib/fpc/3.2.2/ppcross386 /usr/bin/ppcross386
[05.] launch lazarus ,open a hello project,
     project options -- compiler options -- config and target
Target OS(-T) Win32
Target Cpu(-P) i386
Target processor 386/486(-cp80386)
[06.] Run -- clean up and build 



*** below is for 64bit host , to gen linux 32bit code

---- gedit i386-linux-ld ---
#!/bin/bash
# name this file /usr/bin/i386-linux-ld
ld -A elf32-i386 $@
----^^ and save to disk

----make file i386-linux-as ---
#!/bin/bash
# name this file /usr/bin/i386-linux-as
as --32 $@
----^^

* copy above 2 bash file to /usr/bin/ , and let it as exe file
$ chmod +x i386-linux-as
$ chmod +x i386-linux-ld

01. cd ~/fpcsrc/3.2.2
02. make clean all OS_TARGET=linux CPU_TARGET=i386
03. sudo make crossinstall OS_TARGET=linux CPU_TARGET=i386 INSTALL_PREFIX=/usr

2022年11月11日 星期五

Build Eclipse 32bit C/C++ projects on a 64-bit system

 [] In eclips project explorer,Add extra "-m32" for both compiler and linker

Project->Properties --> C/C++ Build --> Settings 

-->Tool settings 

  -->gcc c compiler --> command: gcc -m32

  -->gcc c linker --> command: gcc -m32


[] extra Required Packages: add some as you need

Installing the following packages enabled standard C/C++ library calls to work. If other libraries are used within the code, additional 32-bit packages might have to be installed. Installation via Linux Mint, based on Ubuntu, is via the standard apt-get install command.

$sudo apt-get install g++-multilib lib32gcc1 libc6-i386 lib32z1 lib32stdc++6

$sudo apt-get install lib32asound2 lib32ncurses5 lib32gomp1 lib32z1-dev lib32bz2-dev

This might also be required if the code still does not compile:

$sudo apt-get install ia32-libs-gtk

After adding the suggested package libc6-dbg, the error still occurred. Installing the 32-bit version of the package fixed the error:

$sudo apt-get install libc6-dbg:i386

[]rember clean project befor first time compile new bitwidth-archecture


2022年11月10日 星期四

[光想不作狂想曲] 狂想目標:wpwf

 [光想不作狂想曲]

狂想目標:wpwf (where python where forth),熟練 chipforth assembly code

[考慮點]:

python is open source,

build-in in linux,and easy get at mac,windows,etc

算是主流 interpreter,可吸引學生作專題寫報告,然後誤入符途,而終生不悔。

[回顧]:

想想入符半個甲子,除了用forth寫了一個 華容道的人機界面,和用forth 寫了一個 nec 4bit cpu simulator,就是玩玩meta 最佳化,追新系統的forth(dos->win->linux).也買過 rtx2000的,和 mpu f21 cpu 的kit board,除了跑跑 benchmark,試一試機車超跑,還真的沒用forth 幹過正事。


[緣起]:剛才看到網路上有人寫了 小hack/discompile/python

看了 opcode.h 似乎沒用完,夠塞 32+2個指令,這+2可能是 >forth 和 >python

這32個指令,可以塞 chipforth的指令集 如mup21,或 greenArray F18A

可能還需堆叠 to tuple 或 array 的資料交換機制。

https://blog.techbridge.cc/2017/12/01/pycon-2017-huan-le-xue-python-wei-yuan-zu-ma-byte-code/

又查了opcode

https://github.com/enthought/Python-2.7.3/blob/master/Include/opcode.h


[尾聲]:狂想永遠在實現前發生,雖然只會被厝邊頭尾,親朋好友,唸說 光說不作。


2021年12月18日 星期六

fontforge 用script 簡繁字型取代

#!/usr/bin/fontforge
#
#     ./fontforge2.script  source.ttf 
# 會生成一個轉換完的 tmp.ttf 

if ($argc ==2 )
Open($argv[1])
endif

#萬
Select(0x842c)
CopyReference()
#万
Select(0x4e07)
Paste()
#專
Select(0x5c08)
CopyReference()
#专
Select(0x4e13)
Paste()
#業
Select(0x696d)
CopyReference()
#业
Select(0x4e1a)
Paste()

Generate('tmp.ttf')

2021年12月4日 星期六

千字文

千字文(繁體字版)
敕員外散騎侍郎周興嗣 次韻

天地玄黃,宇宙洪荒。
日月盈昃,辰宿列張。
寒來暑往,秋收冬藏。
閏餘成歲,律呂調陽。
雲騰致雨,露結為霜。
金生麗水,玉出崑崗。
劍號巨闕,珠稱夜光。
果珍李柰,菜重芥薑。
海鹹河淡,鱗潛羽翔。
龍師火帝,鳥官人皇。
始制文字,乃服衣裳。
推位讓國,有虞陶唐。
弔民伐罪,周發殷湯。
坐朝問道,垂拱平章。
愛育黎首,臣伏戎羌。
遐邇壹體,率賓歸王。
鳴鳳在樹,白駒食場。
化被草木,賴及萬方。
蓋此身髮,四大五常。
恭惟鞠養,豈敢毀傷。
女慕貞絜,男效才良。
知過必改,得能莫忘。
罔談彼短,靡恃己長。
信使可覆,器欲難量。
墨悲絲染,詩讚羔羊。
景行維賢,剋念作聖。
德建名立,形端表正。
空谷傳聲,虛堂習聽。
禍因惡積,福緣善慶。
尺璧非寶,寸陰是競。
資父事君,曰嚴與敬。
孝當竭力,忠則盡命。
臨深履薄,夙興溫凊。
似蘭斯馨,如松之盛。
川流不息,淵澄取映。
容止若思,言辭安定。
篤初誠美,慎終宜令。
榮業所基,藉甚無竟。
學優登仕,攝職從政。
存以甘棠,去而益詠。
樂殊貴賤,禮別尊卑。
上和下睦,夫唱婦隨。
外受傅訓,入奉母儀。
諸姑伯叔,猶子比兒。
孔懷兄弟,同氣連枝。
交友投分,切磨箴規。
仁慈隱惻,造次弗離。
節義廉退,顛沛匪虧。
性靜情逸,心動神疲。
守真志滿,逐物意移。
堅持雅操,好爵自縻。
都邑華夏,東西二京。
背邙面洛,浮渭據涇。
宮殿盤鬱,樓觀飛驚。
圖寫禽獸,畫綵仙靈。
丙舍傍啟,甲帳對楹。
肆筵設席,鼓瑟吹笙。
升階納陛,弁轉疑星。
右通廣內,左達承明。
既集墳典,亦聚群英。
杜稿鍾隸,漆書壁經。
府羅將相,路俠槐卿。
戶封八縣,家給千兵。
高冠陪輦,驅轂振纓。
世祿侈富,車駕肥輕。
策功茂實,勒碑刻銘。
磻溪伊尹,佐時阿衡。
奄宅曲阜,微旦孰營。
桓公匡合,濟弱扶傾。
綺迴漢惠,說感武丁。
俊乂密勿,多士寔寧。
晉楚更霸,趙魏困橫。
假途滅虢,踐土會盟。
何遵約法,韓弊煩刑。
起翦頗牧,用軍最精。
宣威沙漠,馳譽丹青。
九州禹跡,百郡秦并。
嶽宗恒岱,禪主云亭。
雁門紫塞,雞田赤城。
昆池碣石,鉅野洞庭。
曠遠綿邈,巖岫杳冥。
治本於農,務茲稼穡。
俶載南畝,我藝黍稷。
稅熟貢新,勸賞黜陟。
孟軻敦素,史魚秉直。
庶幾中庸,勞謙謹敕。
聆音察理,鑒貌辨色。
貽厥嘉猷,勉其祗植。
省躬譏誡,寵增抗極。
殆辱近恥,林皋幸即。
兩疏見機,解組誰逼。
索居閒處,沉默寂寥。
求古尋論,散慮逍遙。
欣奏累遣,慼謝歡招。
渠荷的歷,園莽抽條。
枇杷晚翠,梧桐早凋。
陳根委翳,落葉飄颻。
遊鵾獨運,凌摩絳霄。
耽讀翫市,寓目囊箱。
易輶攸畏,屬耳垣牆。
具膳餐飯,適口充腸。
飽飫烹宰,飢厭糟糠。
親戚故舊,老少異糧。
妾御績紡,侍巾帷房。
紈扇圓潔,銀燭煒煌。
晝眠夕寐,藍筍象床。
弦歌酒宴,接杯舉觴。
矯手頓足,悅豫且康。
嫡後嗣續,祭祀烝嘗。
稽顙再拜,悚懼恐惶。
牋牒簡要,顧答審詳。
骸垢想浴,執熱願涼。
驢騾犢特,駭躍超驤。
誅斬賊盜,捕獲叛亡。
布射遼丸,嵇琴阮嘯。
恬筆倫紙,鈞巧任釣。
釋紛利俗,並皆佳妙。
毛施淑姿,工顰妍笑。
年矢每催,曦暉朗曜。
璇璣懸斡,晦魄環照。
指薪修祜,永綏吉劭。
矩步引領,俯仰廊廟。
束帶矜莊,徘徊瞻眺。
孤陋寡聞,愚蒙等誚。
謂語助者,焉哉乎也。

2021年11月29日 星期一

電書閱讀 Calibre Ebook Viewer 改行距

Ebook Viewer 調行距 , 按右鍵---偏好設定---樣式
### 1.5em 代表 1.5倍.
### 將以下內容 填入 css box ,有可能要重新載入.
body 
{
   line-height:1.5em ;
}

若不行, 試試 (加 !important 忽略書本的設定 強制使用reader 的設定.
body 
{
   line-height:1.5em !important;
}

2021年11月25日 星期四

Fontforge 為 truetype 字型 改 預設行距

Fontforge 為 truetype 字型 預設行距
話說某個 楷書的 .ttf 檔 字打出來,
幾乎 一行 黏著 一行,讀起來很痛苦.
用fontforge 打開來一看.
選單 element - Font info , 
看到其General - Em size 是 1000

點 OS/2 的 Metrics 輸入以下的值:
Win Ascent: 1151
Win Descent: 286
 Really use Typo metrics
Typo Ascnet: 880
Typo Descent: -120
Typo Line Gap: 0
Hhead Ascent: 1151
HHead Descent: -286
HHead Line Gap:  0
VHead Column Spacing:   0
Capital Height: 0
X Height: 0
然後按  OK
選單 File - Generate fonts truetype
之後重新/移除安裝 那個 .ttf 檔,
行和行 之間, 就 寛闊好讀了.

2021年11月11日 星期四

dump Unicode table , using python

def  dump_uni(start,end):
    for i in range(start,end):
if (  (i % 16) == 0):
            print
print unichr(i),

>>> dump_uni(0x23e0,0x25ff)

2021年11月8日 星期一

倉頡 分段取碼 口訣

 倉頡 分段取碼 口訣:

1.  無法切 切一刀 切兩刀.

2.  切一刀 分 前段 後段 , 切兩刀 分 前段 中段 後段.

3.  全字無法切  取碼: 一二三 尾

4.  二段 後段字 取碼: 一二 尾

4.  每一段 最多取兩碼: 第1碼+尾碼

5.  三段字 的 中後段, 可以心裏唸 1尾 尾 , 或 1 1尾

6.  難字,複合字,複合部首,特殊字,包含省略, 有那些字 先要有印象 即可.

7.  所以口訣 看到尾 就換段, 或者 碼數不夠 也換段.

連體字: 123尾

二段字 : 1尾 12尾

三段字:

 1尾 1尾 尾

 1尾 1 1尾


食用油

豆大芥小 加熱均 又非橄㰖 造假多 油麻菜籽 螻蟻命 自求多福 身安康 目前 我推 芥花油,較耐高溫. 從成份上來看 橄㰖>芥花>大豆 . 從CP/造假上來看 又不推 高價 橄㰖了, 可能 摻其它大豆等油/加色素等, 最近新聞 數千公頓大豆 不知所踪, 合理推測, 是...