M♪o 之學習筆記本《寅》井井︰【黃土長夏】永日炎蒸

派生碼訊

寅 虎

夏夜歎‧杜甫
永日不可暮,炎蒸毒我腸。
安得萬里風,飄飖吹我裳。
昊天出華月,茂林延疏光。
仲夏苦夜短,開軒納微涼。
虛明見纖毫,羽蟲亦飛颺。
物情無巨細,自適固其常。
念彼荷戈士,窮年守邊疆。
何由一洗濯,執熱互相望。
竟夕擊刁鬥,喧聲連萬方。
青紫雖被體,不如早還鄉。
北城悲笳發,鸛鶴號且翔。
況複煩促倦,激烈思時康。

黃土暑雖說《 易 》易有

未濟:亨,小狐汔濟,濡其尾,無攸利。

彖曰:未濟,亨﹔柔得中也。 小狐汔濟,未出中也。 濡其尾,無攸利﹔不續終也。 雖不當位,剛柔應也。

象曰:火在水上,未濟﹔君子以慎辨物居方 。

,既無攸利,小狐何事濡其尾,來汔濟??問前途,恐有大水大火交替!!

無課自習。 ☿☹

 

派︰暑熱難讀文章,炎蒸令人神喪。也不知道誰講︰『心靜自然涼』。莫言永日天光長,遁入自好將己忘。讀得一片清涼︰

木蘭辭》‧佚名

唧唧復唧唧,木蘭當戶織。不聞機杼聲,惟聞女嘆息。
問女何所思?問女何所憶?女亦無所思,女亦無所憶。
昨夜見軍帖,可汗大點兵。軍書十二卷,卷卷有爺名。
阿爺無大兒,木蘭無長兄。願為市鞍馬,從此替爺征。
東市買駿馬,西市買鞍韉,南市買轡頭,北市買長鞭。
朝辭爺孃去,暮宿黃河邊,
不聞爺孃喚女聲,但聞黃河流水聲濺濺。
旦辭黃河去,暮宿黑山頭;
不聞爺孃喚女聲,但聞燕山胡騎聲啾啾。
萬里赴戎機,關山度若飛。朔氣傳金柝,寒光照鐵衣。
將軍百戰死,壯士十年歸。歸來見天子,天子坐明堂。
策勳十二轉,賞賜百千強。可汗問所欲 木蘭不用尚書郎,
願借明駝千里足,送兒還故鄉。
爺孃聞女來,出郭相扶將。阿姊聞妹來,當戶理紅妝。
小弟聞姊來,磨刀霍霍向豬羊。
開我東閣門,坐我西閣床。
脫我戰時袍,著我舊時裳,當窗理雲鬢,對鏡貼花黃。
出門看火伴,火伴皆驚惶:同行十二年,不知木蘭是女郎。
雄兔腳撲朔,雌兔眼迷離,兩兔傍地走,安能辨我是雄雌?

沉思『唧唧』是何聲響?故非機杼響,當真嘆息聲!逐一細點去,水聲寫濺濺, 騎聲用啾啾,皆是形聲法,象物之擬音。玄想曾經『何時』『哪地』人,嘆息聲『唧唧』??還有那『喚女聲』,…『朔氣傳金柝,寒光照鐵衣。』,忽憶

塞下曲》‧盧綸

月黑雁飛高,單于夜遁逃。

欲將輕騎逐,大雪滿弓刀。

,此時『秋蟬』死,不該是『知了』,難不成會是『守宮』!! ☺☺ 一時哈哈大笑,領悟了『讀碼』之 技 技︰天地一指,萬物一 馬 『馬』,同樣是『文』『章』。

 

生 ︰自習無課,勿生法忍!!

 

碼 ︰自 習 。蒸炎日永。

 

行 ︰雲天四季總無語,緣理而行沒對錯。派生禪喜作獅子吼 ,少會輕言放過。正好徇著『錯誤』走,通向『對時』路。原來

pi@raspberrypi ~ python3 miniterm.py -h   File "miniterm.py", line 123     raise NotImplementedError, "Sorry no implementation for your platform (%s) available." % sys.platform                              ^ SyntaxError: invalid syntax  pi@raspberrypi ~ python miniterm.py -h
Usage: miniterm.py [options] [port [baudrate]]

Miniterm - A simple terminal program for the serial port.

Options:
  -h, --help            show this help message and exit
  -p PORT, --port=PORT  port, a number (default 0) or a device name
                        (deprecated option)
  -b BAUDRATE, --baud=BAUDRATE
                        set baud rate, default 9600
  --parity=PARITY       set parity, one of [N, E, O, S, M], default=N
  -e, --echo            enable local echo (default off)
  --rtscts              enable RTS/CTS flow control (default off)
  --xonxoff             enable software flow control (default off)
  --cr                  do not send CR+LF, send CR only
  --lf                  do not send CR+LF, send LF only
  -D, --debug           debug received data (escape non-printable chars)
                        --debug can be given multiple times: 0: just print
                        what is received 1: escape non-printable characters,
                        do newlines as unusual 2: escape non-printable
                        characters, newlines too 3: hex dump everything
  --rts=RTS_STATE       set initial RTS line state (possible values: 0, 1)
  --dtr=DTR_STATE       set initial DTR line state (possible values: 0, 1)
  -q, --quiet           suppress non error messages
  --exit-char=EXIT_CHAR
                        ASCII code of special character that is used to exit
                        the application
  --menu-char=MENU_CHAR
                        ASCII code of special character that is used to
                        control miniterm (menu)
pi@raspberrypi ~ $ 

,它是派生二。雖不解程式之意,用著試誤法嘗試改成派生三。 ☿ 將之命名為『M♪oterm.py』 ☺。或真可逐跡償願,

#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys, os, serial, threading, getopt

EXITCHARCTER = '\x04'   #ctrl+D


import termios, sys, os
fd = sys.stdin.fileno()
old = termios.tcgetattr(fd)
new = termios.tcgetattr(fd)
new[3] = new[3] & ~termios.ICANON & ~termios.ECHO
new[6][termios.VMIN] = 1
new[6][termios.VTIME] = 0
termios.tcsetattr(fd, termios.TCSANOW, new)
s = ''    # We'll save the characters typed and add them to the pool.

def 讀鍵():
    c = os.read(fd, 1)
    #~ c = sys.stdin.read(1)
    if echo: sys.stdout.buffer.write(c); sys.stdout.flush()
    return c

def clenaup_console():
    termios.tcsetattr(fd, termios.TCSAFLUSH, old)

sys.exitfunc = clenaup_console      #terminal modes have to be restored on exit...


CONVERT_CRLF = 2
CONVERT_CR   = 1
CONVERT_LF   = 0

def 讀口():
    """loop forever and copy serial->console"""
    while 1:
        data = s.read()
        if repr_mode:
            sys.stdout.buffer.write(repr(data)[1:-1])
        else:
            sys.stdout.buffer.write(data)
        sys.stdout.flush()

def 寫口():
    """loop and copy console->serial until EOF character is found"""
    while 1:
        c = 讀鍵()
        if c == EXITCHARCTER: 
            break                       #exit app
        elif c == '\n':
            if convert_outgoing == CONVERT_CRLF:
                s.write('\r\n')         #make it a CR+LF
            elif convert_outgoing == CONVERT_CR:
                s.write('\r')           #make it a CR
            elif convert_outgoing == CONVERT_LF:
                s.write('\n')           #make it a LF
        else:
            s.write(c)                  #send character


#print a short help message
def 用法():
    sys.stderr.write("""用法: %s [options]
    Miniterm - A simple terminal program for the serial port.

    options:
    -p, --port=PORT: port, a number, default = 0 or a device name
    -b, --baud=BAUD: baudrate, default 9600
    -r, --rtscts:    enable RTS/CTS flow control (default off)
    -x, --xonxoff:   enable software flow control (default off)
    -e, --echo:      enable local echo (default off)
    -c, --cr:        do not send CR+LF, send CR only
    -n, --newline:   do not send CR+LF, send LF only
    -D, --debug:     debug received data (escape nonprintable chars)

""" % (sys.argv[0], ))

if __name__ == '__main__':
    #initialize with defaults
    port  = 0
    baudrate = 9600
    echo = 0
    convert_outgoing = CONVERT_CRLF
    rtscts = 0
    xonxoff = 0
    repr_mode = 0
    
    #parse command line options
    try:
        opts, args = getopt.getopt(sys.argv[1:],
            "hp:b:rxecnD",
            ["help", "port=", "baud=", "rtscts", "xonxoff", "echo",
            "cr", "newline", "debug"]
        )
    except getopt.GetoptError:
        # print help information and exit:
        用法()
        sys.exit(2)
    
    for o, a in opts:
        if o in ("-h", "--help"):       #help text
            用法()
            sys.exit()
        elif o in ("-p", "--port"):     #specified port
            try:
                port = int(a)
            except ValueError:
                port = a
        elif o in ("-b", "--baud"):     #specified baudrate
            try:
                baudrate = int(a)
            except ValueError:
                raise ValueError("Baudrate must be a integer number, not %r" % a)
        elif o in ("-r", "--rtscts"):
            rtscts = 1
        elif o in ("-x", "--xonxoff"):
            xonxoff = 1
        elif o in ("-e", "--echo"):
            echo = 1
        elif o in ("-c", "--cr"):
            convert_outgoing = CONVERT_CR
        elif o in ("-n", "--newline"):
            convert_outgoing = CONVERT_LF
        elif o in ("-D", "--debug"):
            repr_mode = 1

    #open the port
    try:
        s = serial.Serial(port, baudrate, rtscts=rtscts, xonxoff=xonxoff)
    except:
        sys.stderr.write("Could not open port\n")
        sys.exit(1)
    sys.stderr.write("--- Miniterm --- type Ctrl-D to quit\n")
    #start serial->console thread
    r = threading.Thread(target=讀口)
    r.setDaemon(1)
    r.start()
    #and enter console->serial loop
    寫口()

    sys.stderr.write("\n--- 離開 ---\n")

,作個仲夏夜之夢。

 

訊 山亭夏日》‧高駢

綠樹陰濃夏日長,樓台倒影入池塘。

水晶廉動微風起,滿架蔷薇一院香。