Skip to content

Misc. Notes


This page contains a collection of unrelated notes pertaining to issues I have Googled more than once.

Start a process as a different user in Windows

In PowerShell:

Start-Process -FilePath "${env:ProgramFiles(x86)}\Google\Chrome\Application\chrome.exe" -Credential (Get-Credential)

Directly from a link, i.e. with the default CMD shell:

%windir%\System32\runas.exe /profile /u:domain\user "%programfiles(x86)%\Microsoft\Edge\Application\msedge.exe"

"God mode"

In Windows, create a folder on the desktop and rename it to:

GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}

Recommend VS Code plugin

Create a file .vscode/extensions.json with a recommendation array of extension ids, e.g.:

{
 "recommendations": ["ms-vscode.csharp", "ms-mssql.mssql"]
}

Terraform docs for 0.12+

docker run --rm \
  -v $(pwd):/data \
  cytopia/terraform-docs \
  terraform-docs-012 --sort-inputs-by-required --with-aggregate-type-defaults md . > README.md

Decompiler plugin Java

Mchr3k - JDEclipse-Realign

Run command as admin

To run a command as admin without the mouse:

  • Win-R to open file dialog
  • type command name and run with Ctrl-Shift-Enter

Export an existing environment to Terraform

docker run --rm -iv "${PWD}":/outputs cycloid/terracognita aws --tfstate /outputs/terraform.tfstate \
  --access-key $AWS_ACCESS_KEY_ID --secret-key $AWS_SECRET_ACCESS_KEY --region eu-west-1 --hcl /outputs/main.tf

260 character path length restriction

To remove path length restriction in Windows 10 anniversary edition, run:

REG ADD HKLM\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1

Can break old 32 bit apps.

GitHub

Free S/MIME certificates

Actalis provides free S/MIME certifcates for non-commercial use.

Allow changing the password on first login via RDP

Add a line to the RDP file with the text (or change the existing one):

enablecredsspsupport:i:0

Afterwards, delete the line again. Technet has a good explanation.

Removing bloat ware from a new Windows machine

Removing bloat ware from a new Windows machine

Turn a JAR file into an executable

Download JSmooth. Only works if JAVA_HOME is set to a working JRE.

SecurityException on binaries running from a network share

Let's say I get a SecurityException when running my .NET console application from "\vmware-host\Shared Folders". In this case, simply open a developer prompt and type:

CasPol.exe -m -ag 1.2 -url "file://\\vmware-host\Shared Folders/*" FullTrust

From "Using CasPol to Fully Trust a Share".

Netcopy

Want to copy a file from one *Nix macine to another without the hassle of FTP?

DestinationShell:

nc -l -p 2020 > file.txt

SourceShell:

 cat file.txt | nc dest.ip.address 2020

TWiki syntax high-lighting

TWiki sucks. But it sucks harder without syntax higlighting of snipptes. This plugin fixes that: DpSyntaxHighlighterPlugin

Cruft detection

Legacy projects are hoary with cruft. Find it and remove it with ...

Codesigning

Signing a .NET binary post build is easy with a X.509 certificate. Heres how to sign MyApp.exe with mycert.pfx:

signtool.exe sign /v /f "mycert.pfx" -t "<http://timestamp.verisign.com/scripts/timstamp.dll>" "MyApp.exe"

Custom Security Contexts in Jersey

Jersey (JAX-RS) SecurityContext in action

Linux & PAM

Sometimes you have a Linux server that uses PAM/ActiveDirectory to validate logins. If the connection to the AD lapses for some reason, you can find yourself locked out. These steps fix that.

Boot into single-user mode, hold shift during startup and choose advanced options -> recoverymode -> drop to root shell from the Grub menu.

Remount hard disk in RW mode:

mount -o remount,rw /

Reestablish AD trust with Kerberos:

kinit xxx@MY-DOM

... where xxx is an AD browser account on the MY-DOM domain.

.NET Core notes

REST Services

Service versioning