首页

Aliyun SLS 日志加工高级参数

1. system.control.filter_pack_id 控制数据加工后是否过滤掉pack_id字段, 该字段用于日志条目的上下文查询 – 默认值: true – 如果日志加工后想保留pack_id字段, 把该字段设置为false

0 comments

Two methods to resolve StackExchange.Redis.RedisTimeoutException in C#

StackExchange.Redis.RedisTimeoutException: Timeout performing SETEX (5000ms), next: SETEX AutoOps:PodLauncher:2109:LWSY:75:85001:IsMainServerRunning, inst: 0, qu: 0, qs: 1, aw: False, rs: ReadAsync, ws: Idle, in: 0, in-pipe: 0, out-pipe: 0, serverEndpoint: r-bp1je5yrr7ctdzwhmk.redis.rds.aliyuncs.com:6379, mc: 1/1/0, mgr: 10 of 10 available, clientName: 2109-85001-0, IOCP: (Busy=1,Free=999,Min=4,Max=1000), WORKER: (Busy=2,Free=32765,Min=32,Max=32767), v: 2.1.28.64774 (Please take a look at this article for some common client-side issues … Read more Two methods to resolve StackExchange.Redis.RedisTimeoutException in C#

0 comments

[Powershell]Clear docker images by Invoke-RestMethod to docker api

# Clear expired docker images with in specific namespace (30 days ago) (Invoke-RestMethod http://localhost:2375/images/json) | Where-Object { $_.RepoTags -Like ‘*/q1game/*’ -And ((New-TimeSpan -Start (Get-Date ‘1970-1-1’) -End (Get-Date).ToUniversalTime()).TotalSeconds – $_.Created) -GT (30 * 24 * 60 * 60)} | ForEach-Object{ docker.exe rmi $_.RepoTags }

0 comments

[Powershell] Create folder, copy file and verify file hash, regex usage

Method #1: $hashPattern = “^MD5\s+(\w+)\s+”; $sourceFile = “C:\temp\6372241e-591e-4063-b15d-8aa34ae1ac63.txt”; $destFolder = “C:\app\social space\data\scp”; $destFileName = “test.txt”; $destFile = Join-Path -Path $destFolder -ChildPath $destFileName; New-Item -ItemType Directory -Force -Path $destFolder | Out-Null; Copy-Item $sourceFile -Destination $destFile -Force | Out-Null; Get-FileHash $destFile -Algorithm MD5 | Out-String -Stream | Select-String -Pattern $hashPattern | % {$_.matches.Groups[1]} | % {$_.Value}; Key … Read more [Powershell] Create folder, copy file and verify file hash, regex usage

0 comments

Create a custom Application icon on Ubuntu

Create text file like below: [Desktop Entry] Type=Application Encoding=UTF-8 Name=MyApplication Comment=My fancy new application Exec=my_application Icon=my_application.png Terminal=false Name it as YOUR_APP_NAME.desktop, and then put it into /usr/share/applications for anyone; or put it into ~/.local/share/applications for current user only. Then you will see it in the Applications list Ref: https://askubuntu.com/questions/1026528/adding-custom-programs-to-favourites-of-ubuntu-dock

0 comments

Install nvidia-340 driver on Ubuntu 20.04.3 LTS

在一台旧PC上安装了Ubuntu 20.04.3 LTS, 显卡是”微星N240GT-MD 暴雪512/D5″, 芯片是 Nvidia Geforce GT240, 需要安装显卡驱动 》 先是从nvidia官方网站根据显卡型号下载了NVIDIA-Linux-x86_64-340.108.run 安装过程中提示: asm/kmap_types.h: No such file or directory 没有找到有效解决办法 》 google一番后尝试直接安装nvidia-340驱动 sudo apt install nvidia-340 也是安装失败, 主要的错误是: dpkg: error: version ‘-‘ has bad syntax: revision number is empty Setting up lib32gcc-s1 (10.3.0-1ubuntu1~20.04) … Setting up vdpau-driver-all:amd64 (1.3-1ubuntu2) … Setting up nvidia-340 (340.108-0ubuntu5.20.04.2) … dpkg: … Read more Install nvidia-340 driver on Ubuntu 20.04.3 LTS

0 comments

Three patterns to use “if else” statement in dos/batch scripts

Pattern #1 @echo off set var=b if “%var%” EQU “a” (echo 1) else if “%var%” EQU “b” ( echo 2) else if “%var%” EQU “c” ( echo 3) Pattern #2 @echo off set var=b if “%var%” EQU “a” ( echo 1 ) else if “%var%” EQU “b” ( echo 2 ) else if “%var%” EQU … Read more Three patterns to use “if else” statement in dos/batch scripts

0 comments

Use regex to match and replace in MySql 8.0+ or MariaDB

UPDATE server_list_server SET world_id=regexp_replace(ip,’wg(\\d+)\.glwsy\.szgla\.com;?’,’\\1′) WHERE ip REGEXP ‘wg(\\d+)\.glwsy\.szgla\.com;?’ AND world_id!=regexp_replace(ip,’wg(\\d+)\.glwsy\.szgla\.com;?’,’\\1′); REGEXP regexp_replace \\1 is the placeholder for matched group

0 comments

Upgrade openssl to 1.1.1 in docker image

Alpine FROM alpine:xxx apk upgrade –update-cache –available && \ apk add openssl && \ rm -rf /var/cache/apk/* … Debian FROM debian:buster-slim apt upgrade openssl …

0 comments

Export Windows Event log by Powershell

Get-EventLog -LogName System -Source Microsoft-Windows-Hyper-V-VmSwitch -After ‘2021-09-22 23:07:00’ | Select-Object -Property Index,EntryType,EventID,TimeGenerated,Source,Message | Export-CSV -Path c:\q1autoops\temp\Hyper-v.csv -NoClobber

0 comments