Skip to content

Instantly share code, notes, and snippets.

View tsmoreland's full-sized avatar

Terry Moreland tsmoreland

  • Genius Sports
  • Newtownards
View GitHub Profile
@tsmoreland
tsmoreland / Hyper-V session details.md
Created May 12, 2022 10:03
Hyper-V session details

Hyper-V Configuration

Path:

C:\Users\{username}\AppData\Roaming\Microsoft\Windows\Hyper-V\Client\1.0

vmconnect.rdp

The configuration of each VM is stored in a vmconnect.rdp.{uuid} file which is an XML document containing various settings including

@tsmoreland
tsmoreland / vim-paste-replace.md
Last active May 12, 2022 10:04
vim replace selected text without replacing register/buffer

VIM Replace without losing register

Intellij

add the following line to .ideavimrc

xnoremap p "_dP

visual studio code

@tsmoreland
tsmoreland / windbg_notes.md
Last active August 11, 2021 14:20
windbg notes

windbg general notes

Useful commands to remember

  • load all symbols ld *

  • enable noisy symbols (helps find missing symbol files, etc...)

!sym noisy

@tsmoreland
tsmoreland / OpenSSHPortableSetup.md
Last active April 11, 2021 13:44
OpenSSH portable setup on Windows
@tsmoreland
tsmoreland / AppDomainGetAllTypes.md
Created March 13, 2021 08:44
C# Force get all types in AppDomain including referenced assemblies

Example of Getting all types from AppDomain

var assemblies = AppDomain.Current.GetAssemblies().ToList(); // to list is needed because we're about to interate and add
var referencedAssemblies = assemblies
  .SelectMany(asm => asm.GetReferencedAssemblies())
  .Select(asmName =>
  {
    try
 { 
@tsmoreland
tsmoreland / windows-git-ssh.md
Last active March 20, 2022 23:49
Git/SSH Agent use

GIT/SSH Link

Run the following to set GIT_SSH required for git to use ssh-agent thus avoiding multiple prompts for password (which is less secure so take care)

[Environment]::SetEnvironmentVariable("GIT_SSH", "$((Get-Command ssh).Source)", [System.EnvironmentVariableTarget]::User)

SSH agent automatic startup

run the following to ensure automatic startup

@tsmoreland
tsmoreland / self-signed.md
Created February 2, 2021 22:41
Self-signed rooted by another self-signed cert

Create self signed cert

  • $Password should just be whatever your password is, there are more secure ways of getting password than -AsPlainText, this just demonstrates one way
  • $Thumbprint can be found by Get-ChildItem cert:\LocalMachine\My
$rootCert = New-SelfSignedCertificate -Subject 'CN=TestRootCA,O=TestRootCA,OU=TestRootCA' -KeyExportPolicy Exportable  -KeyUsage CertSign,CRLSign,DigitalSignature -KeyLength 2048 -KeyUsageProperty All -KeyAlgorithm 'RSA'  -HashAlgorithm 'SHA256'  -Provider 'Microsoft Enhanced RSA and AES Cryptographic Provider'
$CertPassword = ConvertTo-SecureString -String $Password -Force -AsPlainText
Export-PfxCertificate -cert cert:\LocalMachine\My\$Thumbprint -FilePath c:\test.pfx -Password $CertPassword
Export-Certificate -Cert Cert:\LocalMachine\My\$Thumprint -FilePath C:\testcert.cer
template <typename T, typename... Args, std::enable_if_t<std::is_invocable_v<T&&, Args&&...>, int> = 0>
auto invoke(F&&, Args&&...);
@tsmoreland
tsmoreland / windbg-symstore.md
Last active January 31, 2021 00:05
Windbg symbol server

Create new symstore:

symstore add /s \\<MACHINE NAME>\<PATH> /compress /r /f *.pdb /t <Store Name>

symstore.exe add /F source /S target /t FriendlyName /r /z pri (private)

@tsmoreland
tsmoreland / git-commands.md
Last active January 31, 2021 00:08
Git Commands

Change default for all new repositories

git config --global init.defaultBranch main

alias log "pretty-print"

git config --global alias.lg "log --first-parent --graph --pretty=format:'%C(yellow)%h%Creset -%C(auto)%d%Creset %s %C(cyan)(%cr) %Cresetby %C(bold blue)%aN%Creset' --abbrev-commit --date=relative" (edited)

define line endings for commits