Skip to content

Instantly share code, notes, and snippets.

View dennisroche's full-sized avatar
🐱

Dennis Roche dennisroche

🐱
View GitHub Profile
@jpierson
jpierson / nix-pwsh-cheatsheet.md
Last active May 7, 2023 15:25
Unix/Linux to Powershell Command Cheatsheet

Unix/Linux to Powershell Command Cheatsheet

This guide aims to document useful commands that I commonly see used in Linux and Unix environments to their closest equivalent in Powershell.

Command: wc

Use: Counts some aspect of the input stream and returns a summarized value as output.

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 = @()
@dennisroche
dennisroche / PruneRemoteBranches.sh
Last active March 16, 2016 06:15
Git, Prune Remote Branches that have been merged into origin/master
# 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
@jgold6
jgold6 / App.cs
Last active December 11, 2017 21:31
Xamarin Forms Custom Map renderer to draw Polylines
using System;
using Xamarin.Forms;
using Xamarin.Forms.Maps;
namespace YourNameSpace
{
public class App : Application
{
public App()
{
@robdmoore
robdmoore / Add-ToHostsFile.ps1
Created July 23, 2014 08:17
Script to set up ASP.NET development environment in IIS with SQL Express using Network Service
# 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
@robdmoore
robdmoore / 01_Implementation.cs
Last active January 4, 2016 14:28
Test Structure
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)
@janikvonrotz
janikvonrotz / Delete-AllCmdKeyCredentials.ps1
Created December 6, 2013 07:39
PowerShell: Delete all cmdkey credentials #PowerShell #Windows
cmdkey /list | ForEach-Object{if($_ -like "*Ziel:*"){cmdkey /del:($_ -replace " ","" -replace "Ziel:","")}}
@markryd
markryd / memprofiling.md
Last active August 22, 2016 18:36
Memory profiling with windbg
  • 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

@schacon
schacon / gist:942899
Created April 26, 2011 19:19
delete all remote branches that have already been merged into master
$ 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