2018年11月14日 星期三

被選舉人 年齡

村里長 23歲
立委 23歲
縣市議員 23歲
鄉民代表 23歲

鄉長 26歲

直轄市/縣市長 30

總統 40

linux netcat

參考
https://blog.gtwang.org/linux/linux-utility-netcat-examples/


檔案接收者
nc -l 5000 > branch-rtl819x-sdk-v3.4.11.tar

nc 172.21.69.1 5000 < branch-rtl819x-sdk-v3.4.11.tar


nc -l 50000 > my_svn_new_checkout.sh

nc 172.21.69.4 5000 < my_svn_new_checkout.sh


在兩台主機之間複製檔案
假設現在有兩台主機,分別為 A 主機與 B 主機,若要將一個檔案從 A 主機複製到 B 主機,可以先在 B 主機(檔案接收者)上執行:

nc -l 5000 > my.jpg
然後在 A 主機(檔案傳送者)上執行:

nc hostB.com 5000 < my.jpg
這樣就可以把 my.jpg 這個檔案從 A 主機複製到 B 主機上了。 雖然這個方式跟 scp 指令比起來可能不是最方便的,但是它的特點是不需要登入的動作(也就是說不需要任何帳號與密碼),假設你碰到兩台主機無法互相登入的時候,就可以使用這樣的方式處理。


接收端
ubuntu  18.04

nc -l 50000 > my_svn_new_checkout.sh



傳送端
debian 9.6

nc 172.21.69.4 50000 -q 1 < my_svn_new_checkout.sh



傳送端
ubuntu  18.04

nc 172.21.15.145 50000 -q 1 < my_svn_new_checkout.sh


     -N      shutdown(2) the network socket after EOF on the input.  Some servers
             require this to finish their work.




centos 7 防火牆 注意
sudo firewall-cmd --zone=public --add-port=50000-55500/tcp --permanent

sudo firewall-cmd --reload

sudo firewall-cmd --zone=public --list-ports
19999/tcp 5001/tcp 5201/tcp 50000-55500/tcp


centos firewall reference
https://unix.stackexchange.com/questions/409878/centos-7-open-a-port
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-using-firewalld-on-centos-7
https://mangolassi.it/topic/8380/centos-7-open-firewall-ports-range-on-firewalld

https://www.thegeekdiary.com/how-to-test-port-connectivity-using-nc-utility-in-centos-rhel/



netcat 參考
https://www.linuxtechi.com/nc-ncat-command-examples-linux-systems/
https://www.arthurtoday.com/2015/10/ubuntu-replace-telnet-with-nc-command.html
https://www.tecmint.com/check-remote-port-in-linux/
https://ithelp.ithome.com.tw/articles/10136033

firewall and netcat
https://fabianlee.org/2016/09/26/ubuntu-pre-validate-network-acl-and-firewall-connectivity-with-netcat/
https://itekblog.com/test-firewall-with-netcat/
https://www.digitalocean.com/community/tutorials/how-to-use-netcat-to-establish-and-test-tcp-and-udp-connections-on-a-vps


debian firewall
https://wiki.debian.org/DebianFirewall


netcat for window 下載
https://eternallybored.org/misc/netcat/

linux 系統監控工具

glances (python)

htop
top
nmon
iostat

glances
https://www.maketecheasier.com/glances-monitor-system-ubuntu/


hegemon
https://www.tecmint.com/install-rust-programming-language-in-linux/
https://www.tecmint.com/hegemon-system-monitoring-tool-for-linux/


https://opensource.com/life/16/2/open-source-tools-system-monitoring
top
atop
htop
glances


netdata
monitorix
collectd


lshw
lscpu
lspci
lsusb


sudo dmidecode



harddisk

sudo smartctl -a /dev/sda

blkid

破壞性寫入測試
badblocks -wsv /dev/xxxdisk

fdisk/gdisk/parted


nload is a console application which monitors network traffic and bandwidth




hddtemp - Utility to monitor hard drive temperature

dmidecode is a tool for dumping a computer's DMI (some say SMBIOS ) table contents in a human-readable format.


lm_sensors (Linux monitoring sensors) is a free and open-source application that provides tools and drivers for monitoring temperatures, voltage, and fans.


smartmontools smartctl - Control and Monitor Utility for SMART Disks
smartctl controls the Self-Monitoring, Analysis and Reporting Technology (SMART) system built into many ATA-3 and later ATA, IDE and SCSI-3 hard drives.


nullmailer is an relay-only forwarding MTA (Mail Transfer Agent).

ranger - visual file manager

GNU Midnight Commander is a visual file manager,

netcat is a simple unix utility which reads and writes data across network connections, using TCP or UDP protocol.

2018年11月7日 星期三

lzma linux image tool

 ./lzma e vmlinux_img vmlinux_img.gz


LZMA 4.06 Copyright (c) 1999-2004 Igor Pavlov  2004-09-05

Usage:  LZMA <e|d> inputFile outputFile [<switches>...]
  e: encode file
  d: decode file
  b: Benchmark
<Switches>
  -a{N}:  set compression mode - [0, 2], default: 2 (max)
  -d{N}:  set dictionary - [0,28], default: 23 (8MB)
  -fb{N}: set number of fast bytes - [5, 255], default: 128
  -lc{N}: set number of literal context bits - [0, 8], default: 3
  -lp{N}: set number of literal pos bits - [0, 4], default: 0
  -pb{N}: set number of pos bits - [0, 4], default: 2
  -mf{MF_ID}: set Match Finder: [bt2, bt3, bt4, bt4b, pat2r, pat2,
              pat2h, pat3h, pat4h, hc3, hc4], default: bt4
  -eos:   write End Of Stream marker
  -si:    Read data from stdin
  -so:    Write data to stdout


ts moreutils time stamp log



make clean;make 2>&1 | tee >(ts "%H_%M_%S" > spendinglogs6.log)


https://unix.stackexchange.com/questions/26728/prepending-a-timestamp-to-each-line-of-output-from-a-command

I wish to prepend a timestamp to each line of output from a command. For example:
foo
bar
baz
would become
[2011-12-13 12:20:38] foo
[2011-12-13 12:21:32] bar
[2011-12-13 12:22:20] baz


https://stackoverflow.com/questions/39239379/add-timestamp-to-teed-output-but-not-original-output

Check out ts from the moreutils package.
If you're using bash, you can tee to a shell pipe as a file:
https://unix.stackexchange.com/questions/272433/piping-into-moreutils-ts-with-nanosecond-precision
https://manpages.debian.org/testing/moreutils/ts.1.en.html
https://rentes.github.io/unix/utilities/2015/07/27/moreutils-package/
https://joeyh.name/code/moreutils/

2018年11月1日 星期四

linux連到ssh server想要中斷連線

~.

We can use tilde-period (~.) to close an unresponsive session.

https://pleiades.ucsc.edu/hyades/SSH_Escape_Sequences

When a pseudo-terminal has been requested by the OpenSSH SSH client, ssh supports a number of functions through the use of an escape character. The escape character must always follow a newline to be interpreted as special. The default escape character is ~(tilde); but it can be can be changed in configuration files using the EscapeChar configuration directive or on the command line by the -e option.


 ~?
Supported escape sequences:
 ~.   - terminate connection (and any multiplexed sessions)
 ~B   - send a BREAK to the remote system
 ~C   - open a command line
 ~R   - request rekey
 ~V/v - decrease/increase verbosity (LogLevel)
 ~^Z  - suspend ssh
 ~#   - list forwarded connections
 ~&   - background ssh (when waiting for connections to terminate)
 ~?   - this message
 ~~   - send the escape character by typing it twice
(Note that escapes are only recognized immediately after newline.)

2018年10月9日 星期二

linux lvm

pvscan

vgscan

lvscan

lvscan
  inactive          '/dev/centos/swap' [2.00 GiB] inherit
  inactive          '/dev/centos/home' [17.80 GiB] inherit
  inactive          '/dev/centos/root' [36.46 GiB] inherit



vgchange -a y centos


https://www.tldp.org/HOWTO/LVM-HOWTO/activatevgs.html
11.3. Activating a volume group
vgchange -an centos



apt

ls /dev/centos



mount /dev/centos/root testmount

mount /dev/centos/home testmount


http://marcustsai.blogspot.com/2010/11/lvm.html
LVM實作


https://wiki.ubuntu.com/Lvm
https://help.ubuntu.com/lts/serverguide/advanced-installation.html.en

2018年9月7日 星期五

rsync linux 檔案備份 notes

原本的 abcd 目錄
tree abcd/  -a
abcd/
├── .abc
├── ddda
├── .foo
└── test
    └── gg
        └── .abcd

$ rsync -avh abcd/ test
sending incremental file list
./
.abc
ddda
.foo/
test/
test/gg/
test/gg/.abcd

sent 373 bytes  received 96 bytes  938.00 bytes/sec
total size is 20  speedup is 0.04

---------------------------------------------

$ rsync -avh abcd test1
sending incremental file list
created directory test1
abcd/
abcd/.abc
abcd/ddda
abcd/.foo/
abcd/test/
abcd/test/gg/
abcd/test/gg/.abcd

sent 386 bytes  received 125 bytes  146.00 bytes/sec
total size is 20  speedup is 0.04

-----------------------------------------------------


$ rsync -avh abcd/* test2
sending incremental file list
created directory test2
ddda
test/
test/gg/
test/gg/.abcd

sent 254 bytes  received 98 bytes  704.00 bytes/sec
total size is 14  speedup is 0.04


在source dir 用  DIRA/* 會掉 .開頭的file folder


tree -a abcd/ test test1 test2
abcd/
├── .abc
├── ddda
├── .foo
└── test
    └── gg
        └── .abcd
test
├── .abc
├── ddda
├── .foo
└── test
    └── gg
        └── .abcd
test1
└── abcd
    ├── .abc
    ├── ddda
    ├── .foo
    └── test
        └── gg
            └── .abcd
test2
├── ddda
└── test
    └── gg
        └── .abcd



參考
https://unix.stackexchange.com/questions/178078/how-to-rsync-a-directory-to-a-new-directory-with-different-name

How to rsync a directory to a new directory with different name



If you want to use rsync to recursively make the dest directory an exact copy of the src directory:

rsync -a src/ dest


linux os version
cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS"



2018年8月23日 星期四

crypto aes openssl cbc gcm

kazoo it

 Edgerouter X.



ER-X Forwarding Speed
https://kazoo.ga/er-x-forwarding-speed/

Re-visit Forwarding Speed in ER-X

https://kazoo.ga/revisit-forwarding-speed-in-er-x/


Edgerouter X - IPsec Benchmarked
https://kazoo.ga/edgerouter-x-ipsec-benchmarked/


Let's focus on the 1460-byte packet size. In download direction, 377 Mbit/s is very good throughput in my opinion. It surpasses the quoted number from MediaTek and close to the 500 Mbit/s upper bound quoted by Authentec. In upload direction, relatively speaking it's a little disappointing. 128 Mbit/s is only about one third of the download throughput.





CBC
Cipher Block Chaining
Encryption parallelizable: No
Decryption parallelizable: Yes
Random read access: Yes

download is Decryption for crypto engine
upload is Encryption for crypto engine



The Crypto Engine in Edgerouter X
https://kazoo.ga/the-crypto-engine-in-edgerouter-x/




https://kazoo.ga/quick-benchmark-cbc-vs-gcm/

In my previous post, we touched OpenVPN 2.4 and its new inclusion of GCM ciphers. SFX2000 over SNBforums reminded me to check performance in current OpenSSL. Let me share my quick and dirty benchmarks.
64-bit Sandy Bridge @2.7GHz single-thread
AES-128-CBC with AES-NI



The Cortex-A9 is my RT-AC56U where I run OpenVPN server. It doesn't have any crypto acceleration in HW. CBC is faster than GCM by 145% to 185%. I thought I had to swallow my words and should not switch to GCM ciphers. Looking closer, I might get away with it.
My Conclusion..





http://cryptowiki.net/index.php?title=Output_feedback_with_a_nonlinear_function_(OFBNLF)

http://cryptowiki.net/index.php?title=Block_chaining_(BC)


http://cryptowiki.net/index.php?title=Symmetric_encryption_schemes

2018年7月8日 星期日

[2015 新聞]教師平均年齡41.21歲 10年增3歲 (2015/11/12)


https://www.mdnkids.com/news/?Serial_NO=95621



[2015 新聞]教師平均年齡41.21歲 10年增3歲 (2015/11/12)


 沈育如/臺北報導

 教育部昨天公布「中華民國師資培育統計年報」,發現幼兒園到中小學的教師平均年齡逐年上升,從九十四學年的三十八點四九歲,到一百零三學年度已增加到四十一點二一歲,十年增加近三歲;教育部分析,主要是受到少子化影響,控管教師人數,新進教師少,平均年齡自然上升。

 少子化影響下,教師人力需求也逐年降低,教育部推動「師資培育數量第二階段規畫方案」,師資生名額從九十四學年度的兩萬一千八百零五人,到一百零三學年度已降到八千零八十八人,十年內減少近六成三。

 為因應少子化、穩定校園師資量,教育部也推動「儲備教師安全量」,控管獲得教師證,卻還沒通過教師甄選的人數。七年來,儲備教師從原本八萬一千多名,目前已減少到四萬兩千多人,「少了近一半」,其中近兩萬人當代理代課教師,其他分散在各行各業。

 教育部師資培育及藝術教育司司長張明文表示,教師年齡逐年增加,一方面是因為少子化,控管教師人數,因此,新進教師人數少,缺少新血加入,平均年齡才增加;不過,目前教師退休採「七五制」,「八五制」還未上路,影響並不大。

 至於平均年齡是否持續增加,張明文說,至少等少子化穩定,教師退休人數增加,新血加入也多,新陳代謝後,平均年齡才可能變動。

 針對教師平均年齡逐年增加,全國家長團體聯盟理事長吳福濱表示,教師平均年齡四十多歲,表示具備一定的教學經驗,「沒什麼不好」;外界如果擔憂,希望能透過修法,讓教師專業評鑑上路,為教師的教學品質把關。

2018年7月5日 星期四

google map 使用參考

在Google地圖中匯入大量地點,直接在地圖上把所有地點標示出來!



一、匯入方式

1.先打開支援儲存成微軟.xlsx格式的試算表軟體,在第一列輸入標題,只能是「地名」、「地址」或「經緯度資訊」三者,例如阿正老師就輸入了「地名」及「地址」兩欄資料,如果地名不太會重複、或是不知道地址的話,也可只輸入一欄地名即可。
完成後儲存為 .xlsx格式,支援Unicode字元。

全文網址
https://pcrookie.com/?p=2026

2018年5月30日 星期三

vimdiff 展開 收起 diff sections



https://stackoverflow.com/questions/5288875/how-to-expand-collapse-a-diff-sections-in-vimdiff



Keyboard Shortcuts:

d o Get changes from other window into the current window.

d p Put the changes from current window into the other window.

] c Jump to the next change.

[ c Jump to the previous change.


CTRL+W, w - Switch to the other split window
(CTRL+W, CTRL+W does the same thing, in case you let go of the CTRL key a bit later)



:diffupdate :diffu -> recalculate the diff, useful when after making several changes vim's isn't showing minimal changes anymore. Note that it only works if the files have been modified inside vimdiff. Otherwise, use:

    :e to reload the files if they have been modified outside of vimdiff.


:set noscrollbind -> temporarily disable simultaneous scrolling on both buffers, reenable by
:set scrollbind and scrolling.



Most of what you asked for is folding: vim user manual's chapter on folding. Outside of diffs I sometime use:

    zo -> open fold. 或是按方向右鍵
    zc -> close fold.

But you'll probably be better served by:

    zr -> reducing folding level.
    zm -> one more folding level, please.

or even:

    zR -> Reduce completely the folding, I said!.
    zM -> fold Most!.

2018年3月12日 星期一

兒童安全後靠背 - 機車

駿成 新北 永和 永利路25號 02-29223523
一~六 9:00 - 19:00
2點式 + 頭枕 3500



慶昇 桃園 中正五街241號 03-3365098

2018年2月25日 星期日

【漢字擷趣】從十分到十二萬分



有個外國留學生感嘆道:「漢語真是博大精深。我發現漢語喜歡用數字表示程度,例如十分、十二分、萬分、十二萬分,這幾個詞都表示非常、尤其。這幾個數字相差很大,漢語裡它們卻成了同義詞,有了一個神奇的等式,十分=十二分=萬分=十二萬分。真是把我們這些老外搞糊塗了。」


http://blog.xuite.net/yesfunday/blog/129962531-%E5%BE%9E%E5%8D%81%E5%88%86%E5%88%B0%E5%8D%81%E4%BA%8C%E8%90%AC%E5%88%86

http://www.merit-times.com/NewsPage.aspx?unid=274746

2018年2月4日 星期日

fb facebook 影片下載 youtube 影片 下載

youtube 影片 下載

https://www.onlinevideoconverter.com/


https://www.youtubeto.com/zh/

fb facebook 影片下載

https://www.fbdown.net/

2018年1月11日 星期四

ipsec vpn notes strongswan

IPSec VPN Host to Host on Ubuntu 14.04 with strongSwan
by gyp on June 5, 2015 in Computers, internet with 25 Comments


https://www.gypthecat.com/ipsec-vpn-host-to-host-on-ubuntu-14-04-with-strongswan



IPsec Transport Mode with strongswan on Debian 8 Jessie
Posted by Christoph Haas on 10 03 2016. 1 Kommentar zu IPsec Transport Mode with strongswan on Debian 8 Jessie

Today I am going to write a small tutorial on how inter-server communication can be secured via IPsec in transport mode. This tutorial was written for Debian 8 Jessie but it should work similar with other linux distributions aswell.


https://blog.sprinternet.at/2016/03/ipsec-transport-mode-with-strongswan-on-debian-jessie/


strongswan

auto=add (manually or by remote peer)

auto=start (automatically immediately start connect to the remote host configured in right)