IT漫步

技术生活札记©Yaohui


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 …


[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 }


[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 …


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


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: …






Proudly powered by WordPress