首页

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

[Kubernetes Learning Path v1.0]50 days from zero to hero with Kubernetes

0 comments

Disable Windows Defender Using Windows Registry

Open the Windows Registry Editor. Navigate to the following key (create it if not exists): HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender Create a new DWORD (32-bit) item with name DisableAntiSpyware Change its value to 1 Ref: https://www.itechtics.com/enable-disable-windows-defender/

0 comments