-
Notifications
You must be signed in to change notification settings - Fork 0
/
memo
416 lines (344 loc) · 11.9 KB
/
memo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
svn status --no-ignore | grep '^\?' | sed 's/^\? //' | xargs rm -rf
svn cleanup --remove-unversioned --remove-ignored . ;# svn 1.9 later
#--------------------------------------------
# netsh interface set interface admin=disabled connect=disconnected
# netsh interface set interface name="乙太網路 2" admin=enabled connect=disconnected
# netsh interface set interface name="乙太網路 2" admin=enabled connect=connected
netsh interface show interface
netsh wlan show profile
netsh wlan show networks
netsh wlan show interfaces
netsh wlan connect name="MonoCellWiFi"
netsh wlan disconnect
#--------------------------------------------
# https://github.com/veripool/verilog-perl
# need to pre installed: gcc flex bison and libcrypt
cpan install Verilog::Language
#--------------------------------------------
# vi splited window sync view
# :windo set scrollbind
# :windo set cursorline
# :cursorbind
#--------------------------------------------
# sftp concorn for .cshrc_user
#
#The "Received message too long <decimal number>" indicates that the shell startup files on the remote system contain at least one command that is trying to write text to the terminal. The 'ssh' program is able to handle the text output, but 'sftp' is not. This could be caused by an 'echo' command, or any other program run from a startup file that outputs text to the screen.
#
#If the error happens for all users, look at the system-wide startup files for the login shell in use, which will typically be in /etc. If the error only happens for one user, check the personal shell startup files in their home directory, typically something like .login, .cshrc, .bashrc, .bash_login, and so forth. Check the man page for the shell in use for all startup files that the shell could execute on login.
#
#When looking for the offending command, sometime translating the <decimal number> in the error message may help. For example:
#
#1416586337 decimal = 546F6461 hex = "Toda" ASCII.
#
#So, perhaps there is a command like this in a startup file:
#
#echo "Today is"/bin/date`
#If the user does not want to remove the offening command from the startup file, they could tell the shell to exit the script for programs like sftp. For example, for the csh/tcsh shell, put this line as the first line in the startup file with the offending command. #
#if(!$?prompt)exit`
#
#
#
# sftp -b <batch_file> [user]@server:[port]
#
# sftp [user]@host[:port][/dest_path] <<< $'put /local_path/file'
#
# sftp deepak@sftp-server <<EOF
# > cd dest_dir
# > mkdir sftp-client_dir
# > put -r /tmp/sftp-client_dir <-- SFTP put command to upload /tmp/sftp-client_dir to sftp-server
# > quit
# > EOF
#
#
# sftp [-r] deepak@sftp-server:dest_dir/sftp-server_file /tmp/
#--------------------------------------------
# Windows basic commands
# systeminfo
# tracert google.com
# pathping google.com
# getmac
# hostname
#--------------------------------------------
# Windows COM port status
$ mode
$ mode com5
$ mode /?
# https://sfriederichs.github.io/how-to/svn/cygwin/2017/11/08/Cygwin-SVN-Server.html
# 2023-12-19 how to setup SVN server (cygwin)
# setup.sh
#!/bin/sh
cd ~ ; # cd /home/walter.chen
mkdir -p svn/repo
svnadmin create .
if [ -d conf ]
then
echo "-- svn repo init failed"
fi
cd svn/repo
cp ./conf/svnserve.conf conf/svnserve.conf.00
cp ./conf/passwd ./conf/passwd.00
cp ./conf/authz ./conf/authz.00
# authz-db = authz
# hooks-env = hooks-env
# password-db = passwd
TAR=./conf/svnserve.conf
sed -i.b00 '/# authz-db = authz/ s/^# //' $TAR
sed -i.b00 '/# hooks-env = hooks-en/ s/^# //' $TAR
sed -i.b00 '/# password-db = passw/ s/^# //' $TAR
# [users]
# walter.chen = mps
TAR=./conf/passwd
sed -i.b00 '/^\[users\]/ a \
walter.chen = mps
' $TAR
# add to file bottom
TAR=./conf/authz
sed -i.b00 '$a \
[/]\
* = rw
' $TAR
# https://sfriederichs.github.io/how-to/svn/cygwin/2017/11/08/Cygwin-SVN-Server.html
# 2023-12-19 how to startup SVN server (cygwin)
svnserve -d -r /home/walter.chen/svn/repo
# https://sfriederichs.github.io/how-to/svn/cygwin/2017/11/08/Cygwin-SVN-Server.html
# 2023-12-19 how to startup SVN server (cygwin)
# Open a new Cygwin terminal as an administrator, then
# cygrunsrv –install svnserve –disp “CYGWIN svnserve” –path /bin/svnserve –args “–daemon –foreground –root=/cygdrive/c/svn”
# cygrunsrv --install svnserve --path /usr/bin/svnserve --args '–-daemon --root /home/walterc.chen/svn/repo --foreground' --disp 'GYWIN svnserve'
# https://stackoverflow.com/questions/1227870/how-can-i-access-a-subversion-repository-using-a-local-path-in-windows
# 2023-12-19 how to use local SVN server
cd diskd/
svn co file:///home/walter.chen/svn/repo .
mkdir mps
touch mps/pstatus.txt
svn add mps
svn ci -m "init pstatus.txt - project status"
rm -rf repo/
cd diskd/projects/
svn co file:///home/walter.chen/svn/repo/mps
# vivado
# dump all signals at once
# log_wave -recursive *
#
# vivado SDK
# - sol1
# set fp [open test.log w]
# puts $fp [mrd 0 10]
# close $fp
# - sol2
# connect
# mrd -bin -file Dump.bin 0x0 512
# mwr -bin -file Restore.bin 0x0 512
# vivado compile_lib
# compile_simlib -simulator xcelium -family spartan7 -library unisim -library simprim -directory /home/walter.chen/tmp/xilinxlib -force -no_systemc_compile -no_ip_compile
# remote login
# ssh sj-ws-lnx16
# ssh -t sj-ws-lnx16 'vim'
# ssh -t sj-ws-lnx16 'crontab -e'
# svn propset svn:mime-type text/plain build.xml
# svn commit build.xml
# docker build
docker build -t "my/verilator" . ;# build with Dockerfile
# docker disk space maintenance/release/cleanup - every often
docker image prune [-f]
docker system prune [-f]
# docker run
docker run --hostname=$(hostname) [options] <image>
# docker misc
docker search --filter=is-official=true redmine
container-diff diff daemon://modified_debian:latest remote://gcr.io/google-appengine/debian8:latest
# return 1: little-endian 0: big-endian
echo -n I | od -to2 | head -n1 | cut -f2 -d" " | cut -c6
# https://superuser.com/questions/1788147/wsl-distro-occupying-too-much-space-despite-not-having-so-many-files-in-it
# ./ext4.vhdx by the full path of the disk image which can be typically found at "%userprofile%\AppData\Local\Packages\CanonicalGroupLimited.<Distro>\LocalState\ext4.vhdx"
-- TRY --
wsl --shutdown
optimize-vhd -Path .\ext4.vhdx -Mode full
-- OR --
wsl --shutdown
diskpart
# open window Diskpart
select vdisk file=".\ext4.vhdx"
attach vdisk readonly
compact vdisk
detach vdisk
exit
# git commands
$ git rev-parse --show-toplevel ;# /cygdrive/d/docker_home/petalinux/yy/docker-vivado
$ git remote show origin ;# Fetch URL: https://github.com/phwl/docker-vivado
$ git config --global diff.tool vimdiff
$ git config --global difftool.prompt false
$ git difftool README.md
$ git config --global alias.d difftool
$ git d README.md
# git book online
# https://git-scm.com/book/en/v2
$ git config --global alias.co checkout
$ git config --global alias.br branch
$ git config --global alias.ci commit
$ git config --global alias.st status
# fsdbDump用法
https://www.francisz.cn/2019/08/29/fsdb-dump/
# PowerShell
# https://allthings.how/how-to-use-windows-terminal-keyboard-shortcuts (How to Use Windows Terminal Keyboard Shortcuts)
# https://www.freecodecamp.org/news/windows-terminal-themes-color-schemes-powershell-customize
# https://dev.to/ansonh/customize-beautify-your-windows-terminal-2022-edition-541l#:~:text=To%20install%20the%20color%20scheme%3A%201%20Open%20Settings,your%20changes%20and%20head%20back%20to%20Windows%20Terminal. (Customize & Beautify your Windows Terminal (2022 Edition))
# Podman
# https://gcore.com/learning/podman-for-docker-users
sudo docker images --format '{{.Repository}}:{{.Tag}}'
podman pull docker-daemon:hello-world:latest
# List of awesome open source hardware tools
# https://giters.com/jhon-p16/awesome-hardware-tools
# fsm2sv
# https://github.com/mohamed/fsm2sv/
# https://graphviz.org/docs/layouts/dot/
fsm2sv -i ./examples/example1.yml -o fsdm.sv -d fsdm.dot
dot -Tsvg filename.dot -o outfile.svg
# svg2vsd
# SVG to Visio objects
# open in.svg with Visio; ungroup all; save to vsd/vsdx
# mermaid flowchart
# https://www.mermaidchart.com/app/projects/9dcfb80b-01f3-45ae-9191-567f8e8e10bb/diagrams/3035e8d5-f0cf-45cc-972d-0e70a94c48f8/version/v0.1/edit
---
title: ADC24b
---
flowchart TD
A[POR]
G[DOR]
B[DRDY]
C[DOUT]
D[SYNC]
F[PWDN]
A[POR] -->|pwr_rdy| G
G-->|"dor_rdy\n(t4/t14/t16)"| B
B -->|clk_cnt_gte_36| C
C -->|"clk_cnt_gte_348 \n&& !clk_cnt_gte_4_Tdrdy"| B
C -->|"clk_cnt_gte_348 \n&& clk_cnt_gte_4_Tdrdy"| D
D -->|clk_cnt_gte_20_Tdrdy| F
D -->|sclk_high_to_low| G
F -->|sclk_high_to_low| G
%%classDef CC fill:#f9f,stroke:#333,stroke-width:4px;
%%classDef CC fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5
classDef CC stroke-dasharray: 3 3
class A CC
class G CC
# docsify
# https://codewithhugo.com/docsify-mermaid-10/
# sys admin
# https://medium.com/@nirbhaysingh281/clear-the-memory-cache-in-linux-e8c74419bc24
# 1: Dropping page cache
# 2: Dropping dentries and inodes
# 3: Dropping page cache, dentries, and inodes (combination of 1 and 2)
$ sync && echo 3 > /proc/sys/vm/drop_caches
# free ;# check for available/used/swap
$ free -w -s 1 -c 3
$ watch -d -n 1 free
$ rsync -avgR /mnt/d/regblock/ sj-ws-lnx16:~/
# uptime
$ uptime -s
$ uptime -p
# gnu-octave package installation
pkg install "https://github.com/gnu-octave/pkg-control/releases/download/control-4.0.1/control-4.0.1.tar.gz"
# misc
# is your system little-endian or big-endian
# 1: little-endian
# 0: big-endian
$ echo -n I | od -to2 | head -n1 | cut -f2 -d" " | cut -c6
# https://www.reddit.com/r/RISCV/comments/1feza0j/riscv_toolchain/
$ apt install gcc-riscv64-linux-gnu
$ apt install gcc-riscv64-unknown-elf
$ riscv-....-gcc -o a.out a.c
$ file a.out
$ readelf -h a.out
# !/bin/bash
# substring
# ${variable:offset:length}
string="Hello, World!" ;# Example 1: Basic Substring Extraction
echo ${string:7:5} # Output: World
string="Welcome to Bash scripting" ;# Example 2: Extracting from a Fixed Position
echo ${string:11} # Output: Bash scripting
string="Bash Substring Example" ;# Example 3: Using Negative Indexes
echo ${string: -7:7} # Output: Example
string="prefix_value" ;# To remove a known prefix from a string
echo ${string#prefix_} # Output: value
string="value_suffix" ;# To remove a known suffix from a string
echo ${string%suffix} # Output: value
string="SocketDaddy Substring Guide" ;# Replace the First Occurrence
echo ${string/Substring/Tutorial} # Output: SocketDaddy Tutorial Guide
string="abc abc abc" ;# Replace All Occurrences
echo ${string//abc/xyz} # Output: xyz xyz xyz
# !/bin/bash
# two caputre groups
string="Hello World"
pattern='(H[a-z]+)\s*(W[a-z]+)'
if [[ $string =~ $pattern ]]; then
echo "Match found!"
for i in "${!BASH_REMATCH[@]}"; do
echo "$i: ${BASH_REMATCH[$i]}"
done
fi
# a self-destruct script
#!/bin/bash
echo "Running the script... This script will self-destruct!"
# Self-delete mechanism
rm -- "$0"
# vim
# easy-align
ga<c-i>*<space> ;# ignore exisiting indentation
# screen-scroll
zt
zz
zm
# paste mode to disable auto comment/ident/...
:set paste
:set nopaste
- or -
"+p
# yank a word and search
v
e
y
/
Ctrl-r
0
Enter
- OR -
"Byw
/^RB
- OR -
/^R^A
- OR -
/^R^W
# ANSI color codes
# https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797?permalink_comment_id=3857871
#
# ESC
# Ctrl-Key: ^[
# Octal: \033
# Unicode: \u001b
# Hexadecimal: \x1B
# Decimal: 27
#
# [...m is the sequence that sets colors
#
# echo -e enable interpretation of backslash escapes
#
# #!/bin/bash
#
# RED='\033[0;31m'
# NOCOLOR='\033[0m'
# echo -e "I ${RED}love${NOCOLOR} Linux"
#
# [30m: Black
# [31m: Red
# [32m: Green
# [33m: Yellow
# [34m: Blue
# [35m: Magenta
# [36m: Cyan
# [37m: White
# Vivado timing report screen
# %s/\(.\+ time\) \(\d\+\)/\t\2\t /
# find
# find / -type f -user vivek -ls -o -type f -user wendy -ls ;# -o: or
# find / -type f -not -user vivek -ls