My Wiki!

**This is an old revision of the document!**

Windows tricks

Auto power on

PS as admin:

  powercfg -devicequery wake_armed
  HID-compliant mouse (001)
  

Fix it

  devmgmt.msc
  

Mouse properties and disable wakeup.

Powershell

Execution policy

Open PS as admin and run:

   Set-ExecutionPolicy Unrestricted

Run ps1 script

  PS C:\Users\Thuy Dang\Workspace\00_current\gwui> Set-ExecutionPolicy Unrestricted -Scope Process
  PS C:\Users\Thuy Dang\Workspace\00_current\gwui> PowerShell.exe -ExecutionPolicy Bypass -File C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1

Env Var Powershell

(https://stackoverflow.com/a/59706882/707704)

After I installed JAVA from oracle website I set

[System.Environment]::SetEnvironmentVariable("JAVA_HOME", "C:\Program Files\Java\jdk-13.0.1")

To set java in the path I did,

[System.Environment]::SetEnvironmentVariable("Path", [System.Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::Machine) + ";$($env:JAVA_HOME)\bin")

Worked like a charm!

If you want to have it load up automatically when you open powershell you can do,

New-Item $profile -Type File -Force

and open in notepad like

notepad.exe $profile

and paste in

[System.Environment]::SetEnvironmentVariable("JAVA_HOME", "C:\Program Files\Java\jdk-13.0.1")
[System.Environment]::SetEnvironmentVariable("Path", [System.Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::Machine) + ";$($env:JAVA_HOME)\bin")

You can close the notepad now! Next, you want to allow powershell to run the ps script so don't forget to grant unrestricted access to running the profile script on load by,

Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser

Java should now be loaded after you reopen powershell. Thats it!

## Git

Ignore File mode

git config –global core.fileMode false

0.1 Set new line

creating in each Git repo a file .gitattributes including: LF is linux ending.

.gitattributes text eol=lf
.gitignore text eol=lf
*.build text eol=lf
*.c text eol=lf
*.cmake text eol=lf
*.cpp text eol=lf
*.csv text eol=lf
*.f text eol=lf
*.f90 text eol=lf
*.for text eol=lf
*.grc text eol=lf
*.h text eol=lf
*.ipynb text eol=lf
*.m text eol=lf
*.md text eol=lf
*.pas text eol=lf
*.py text eol=lf
*.rst text eol=lf
*.sh text eol=lf
*.txt text eol=lf
*.yml text eol=lf
Makefile text eol=lf

DO NOT just use * as that can goof up binary files in your repo.

git config --global core.autocrlf input

git config --global core.eol lf

Navigation