首页

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

Run application as whatever user called it (non-administrator) on Windows 10 (Supressing UAC Prompts)

cmd min C set __COMPAT_LAYER=RunAsInvoker && start “” %1 For example: @echo off set __COMPAT_LAYER=RunAsInvoker start “” XXX.exe exit /b 0 ref https://stackoverflow.com/questions/37878185/what-does-compat-layer-actually-do

0 comments

Change user home directory in Windows 10

Open Windows Registry Located at “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\” Find your user SID (such as S-x-x-xxxxxxxxxxxx) Change the value of “ProfileImagePath”

0 comments

Methods to start process in C# and powershell

private int StartProcess(SoftwareSvr swSvr, string workingDir) { Process proc = new Process(); proc.StartInfo.UseShellExecute = true; proc.StartInfo.WorkingDirectory = workingDir; proc.StartInfo.FileName = swSvr.Command; if (swSvr.Args != null && swSvr.Args.Any()) { proc.StartInfo.Arguments = string.Join(‘ ‘, swSvr.Args); } bool started = proc.Start(); if (started) { return proc.Id; } else { return -1; } } private int StartProcessByPs(SoftwareSvr swSvr, string … Read more Methods to start process in C# and powershell

0 comments

How to view command history in Windows cmd shell like Linux “history”

doskey /history

0 comments

List all Named Pipes in Windows

C:\> dir \\.\pipe\\

0 comments