Wednesday, July 22, 2020

Excel 快速向下填充到指定行

1. Ctrl + G 输入要填充的区域(包含作为填充模板的那行)
2. Ctrl + D

Tuesday, July 21, 2020

Dispose 计时器 System.Threading.Timer 问题

1. 在彻底销毁前等待排队中的和进行中的回调完成
using (ManualResetEvent waitHandle = new ManualResetEvent(false))
{
    //若_timer.Dispose(waitHandle)已被调用过,则会返回false,可以防止重复调用
    if (_timer.Dispose(waitHandle))
     {
         //等待排队中的和正在执行的回调完成,并设置超时
         //回调结束时会自动调用waitHandle.Set()来解除阻塞
         waitHandle.WaitOne(milliseconds);

     }
}

2.  在Dispose后,回调中的ObjectDisposedException异常
try
{
    _timer.Change(dueTime, period);
}
catch(ObjectDisposedException)
{

}


参考:
注意Dispose(WaitHandle) 方法的备注Remarks部分


Thursday, July 16, 2020

FortiOS CLI 命令1

获取所有静态路由
get router info routing-table static
配合使用grep过滤出路由
get router info routing-table static | grep xxx.xxx.xxx.xxx

编辑静态路由
config route static
edit xx


按需求过滤出session
diag sys session filter dst xxx.xxx.xxx.xxx
diag sys session filter proto 17 //proto number 17 为UDP

diag sys session filter proto 6 //proto number 6 为TCP

diag sys session filter dport 5000
diag sys session filter negate dport  //端口不为5000

diag sys session filter //查看当前过滤规则

diag sys session list //列出所有过滤出来的session

diag sys session clear //结束所有过滤出来的session



参考:





把多个png文件转换成支持多个分辨率的ico文件

工具:ImageMagick 命令:magick convert -background transparent sample*.png sample.ico