This guide aims to document useful commands that I commonly see used in Linux and Unix environments to their closest equivalent in Powershell.
This file contains hidden or 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
function OutputStatus($message){ | |
try { | |
[Console]::SetCursorPosition(0,0) | |
Write-Host $message.PadRight([Console]::BufferWidth) | |
} | |
catch [System.IO.IOException] { | |
## IO Exception when unable to set position | |
} | |
} | |
$messages = @() |
This file contains hidden or 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
# Needs to executed in git bash, powershell with posh-git won't work. | |
# NB, change grep -v master to be the branch you want to check, e.g. grep -v development | |
# Preview | |
git fetch -p origin && git branch -r --merged | grep origin | grep -v '>' | grep -v master | xargs -L1 | cut -d"/" -f2- | xargs -d ' ' | |
# Actual | |
git fetch -p origin && git branch -r --merged | grep origin | grep -v '>' | grep -v master | xargs -L1 | cut -d"/" -f2- | xargs git push origin --delete |
This file contains hidden or 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
using System; | |
using Xamarin.Forms; | |
using Xamarin.Forms.Maps; | |
namespace YourNameSpace | |
{ | |
public class App : Application | |
{ | |
public App() | |
{ |
This file contains hidden or 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
# Originally from http://poshcode.org/3819 | |
function Add-ToHostsFile { | |
<# | |
.DESCRIPTION | |
This function checks to see if an entry exists in the hosts file. | |
If it does not, it attempts to add it and verifies the entry. | |
.EXAMPLE | |
Add-ToHostsFile -IPAddress 192.168.0.1 -HostName MyMachine |
This file contains hidden or 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
public class MeasuredInput | |
{ | |
public string Identifier { get; set; } | |
public int MeasuredValue { get; set; } | |
public double Confidence { get; set; } | |
} | |
public class Measurement | |
{ | |
public Measurement(string primaryId, string secondaryId, int value, double adjustedMeasurement) |
This file contains hidden or 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
cmdkey /list | ForEach-Object{if($_ -like "*Ziel:*"){cmdkey /del:($_ -replace " ","" -replace "Ziel:","")}} |
- Start up windbg and attach (F6).
- Make sure you pick the right version (x86/x64) and run as admin if your app is running as admin.
- Make sure you have the microsoft symbol servers turned on in Visual Studio -> tools -> options -> debugging -> symbols
Load
.loadby sos clr
Dump the heap
This file contains hidden or 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
$ git branch -r --merged | | |
grep origin | | |
grep -v '>' | | |
grep -v master | | |
xargs -L1 | | |
awk '{split($0,a,"/"); print a[2]}' | | |
xargs git push origin --delete |