Skip to content

Instantly share code, notes, and snippets.

@jaskiratr
jaskiratr / chmod-400.cmd
Created June 29, 2018 01:03
Set permission of file equivalent to chmod 400 on Windows.
# Source: https://stackoverflow.com/a/43317244
$path = ".\aws-ec2-key.pem"
# Reset to remove explict permissions
icacls.exe $path /reset
# Give current user explicit read-permission
icacls.exe $path /GRANT:R "$($env:USERNAME):(R)"
# Disable inheritance and remove inherited permissions
icacls.exe $path /inheritance:r
@martinabrahams
martinabrahams / distinct.ts
Created September 27, 2017 02:37
Get distinct items in array in TypeScript - source https://stackoverflow.com/a/45886147/6732882
Array.from(new Set(yourArray.map((item: any) => item.id)))
@brockallen
brockallen / gist:48bce00681a87ba3325d74f09f72874a
Created June 23, 2016 18:01
ASP.NET Core MVC action method snippets
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>mvcaction</Title>
<Shortcut>mvcaction</Shortcut>
<Description>Code snippet for an action.</Description>
<Author>Microsoft Corporation</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>