This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #string hash functions | |
| def bkdr(str): | |
| seed = 13131 # 31,131,13131,... | |
| hash = 0 | |
| for ch in str: | |
| hash = hash * seed + ord(ch) # char to int | |
| return hash & 0xFFFFFFFF # unit32 | |
| def english_words_hash_test(wtxt): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // compile with: /EHsc | |
| #include <windows.h> | |
| #include <ppl.h> | |
| #include <concurrent_vector.h> | |
| #include <array> | |
| #include <vector> | |
| #include <tuple> | |
| #include <algorithm> | |
| #include <iostream> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # serial port and TCP port forwarding script | |
| # use under linux and busybox shell. | |
| PORT=12345 | |
| COM=/dev/ttyS1 | |
| echo Start to setup serial. | |
| echo Set serial port as 9600-8-e-1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (require :usocket) | |
| (defvar server-socket) | |
| (defvar client-socket) | |
| (defun default-udp-handler (buffer) ; echo | |
| (declare (type (simple-array (unsigned-byte 8) *) buffer)) | |
| (format t "recv: ~A~%" buffer) ; no show in new thread. | |
| buffer) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;;(setq w32-pass-apps-to-system nil) | |
| (setq w32-apps-modifier 'hyper) | |
| (setq w32-pass-lwindow-to-system nil) | |
| (setq w32-lwindow-modifier 'hyper) | |
| ;; editing | |
| (global-set-key (kbd "H-c") 'kill-ring-save) ;; copy | |
| (global-set-key (kbd "H-x") 'kill-region) ;; cut |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| open System | |
| open System.IO | |
| open System.Text.RegularExpressions | |
| open Microsoft.FSharp.Control.CommonExtensions | |
| let path = @"C:\Users\William\Desktop\log\txt" | |
| let readFileAsync filePath = | |
| async { // open and read file | |
| let fileStream = File.OpenText(filePath) |