Last active
July 25, 2017 07:48
-
-
Save maksha/cff3de229c4a2df201af5ac1bbabbd91 to your computer and use it in GitHub Desktop.
Posh-Git PowerShell Prompt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import module posh-git | |
Import-Module -Name posh-git | |
# Setup awesome PS prompt | |
function Test-Administrator { | |
$user = [Security.Principal.WindowsIdentity]::GetCurrent(); | |
(New-Object Security.Principal.WindowsPrincipal $user).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator) | |
} | |
# Chocolatey profile | |
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" | |
if (Test-Path($ChocolateyProfile)) { | |
Import-Module "$ChocolateyProfile" | |
} | |
function prompt { | |
$realLASTEXITCODE = $LASTEXITCODE | |
Write-Host | |
# Reset color, which can be messed up by Enable-GitColors | |
$Host.UI.RawUI.ForegroundColor = $GitPromptSettings.DefaultForegroundColor | |
if (Test-Administrator) { # Use different username if elevated | |
Write-Host "(Elevated) " -NoNewline -ForegroundColor White | |
} | |
Write-Host " $ENV:USERNAME " -NoNewline -ForegroundColor White -BackgroundColor DarkGray | |
if ($s -ne $null) { # color for PSSessions | |
Write-Host " (`$s: " -NoNewline -ForegroundColor DarkGray | |
Write-Host "$($s.Name)" -NoNewline -ForegroundColor Yellow | |
Write-Host ") " -NoNewline -ForegroundColor DarkGray | |
} | |
Write-Host "" $($(Get-Location) -replace ($env:USERPROFILE).Replace('\','\\'), "~") "" -NoNewline -ForegroundColor Black -BackgroundColor Gray | |
$global:LASTEXITCODE = $realLASTEXITCODE | |
Write-Host | |
Write-Host " " ($([char]0x2192)) " " -NoNewline -BackgroundColor DarkGray | |
Write-VcsStatus | |
return "> " | |
} |
rm -fr
in PowerShell
To delete all files and folders (including subfolders) in .\node_modules\
:
- Delete files in folder and subfolders:
Get-ChildItem -Path .\node_modules\ -Recurse | Remove-Item -force -recurse
- Delete folders and subfolders:
Remove-Item .\node_modules\ -Force
LICEcap
http://www.cockos.com/licecap/
A simple animated screen captures * LICEcap can capture an area of your desktop and save it directly to .GIF.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note
OOT: Get Public IP Address using PowerShell
The powershell command below will get our public IP address from
https://api.ipify.org
in JSON format.