xud6

xud6

linux

Ubuntu 20.04 lightdm 关闭休眠

禁用systemd休眠状态 sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target 修改lightdm的Time before suspend sudo -u lightdm dbus-launch gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 0 sudo -u lightdm dbus-launch gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 0 sudo -u lightdm dbus-launch gsettings set org.gnome.settings-daemon.
1 min read
打印机

Windows 预安装打印机驱动

将打印机驱动复制到可以访问的共享路径 使用以下powershell脚本安装驱动 pnputil.exe /a "\\\koaxpj__.inf.inf" 之后确认安装后打印机驱动的路径,在C:\Windows\System32\DriverStore\FileRepository下 打开inf文件记录下实际打印机型号的名称,如 [KONICA MINOLTA.NTamd64] "KONICA MINOLTA C368SeriesPCL" "KONICA MINOLTA C3851SeriesPCL" 使用以下powershell脚本添加具体驱动 Add-PrinterDriver -Name "KONICA MINOLTA C368SeriesPCL" -InfPath "C:\Windows\System32\DriverStore\FileRepository\koaxpj__.inf_amd64_c4e736b89265dcc3\koaxpj__.inf" Add-PrinterDriver -Name "KONICA MINO
1 min read
mac

MACOS 修复应用修改后代码签名问题,即xxx.app已损坏

创建代码签名证书 打开钥匙串访问 打开菜单栏-钥匙串访问-证书助理创建证书 证书类型选代码签名,名称取个终端中容易输入的,创建。 找到刚创建的证书,打开后在信任中代码签名修改为始终信任。 重签名有问题的app sudo codesign --deep --force --verify --verbose --sign "XXXXXcodesign" /Applications/YYYYY.app XXXXXcodesign为刚才创建的证书名 YYYYY.app为需要签名的app
windows

Powershell 卸载程序

function Uninstall-Application { $appName = $($args[0]) Write "application to uninstall: $appName" $uninstall32 = gci "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" | foreach { gp $_.PSPath } | ? { $_ -Match $appName } $uninstall64 = gci "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" | foreach { gp $_.PSPath } | ? { $_ -match $appName } if($uninstall32){ if($uninstall32.QuietUninstallString){ Write ("uninstall32 Quiet

PowerShell 自动提权

添加至脚本头 param([switch]$Elevated) function Test-Admin { $currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent()) $currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator) } if ((Test-Admin) -eq $false) { if ($elevated) { # tried to elevate, did not work, aborting } else { Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "{0}" -elevated' -f ($myinvocati