Skip to content

Instantly share code, notes, and snippets.

@Jaykul
Jaykul / FileTypes.ANSI.Format.ps1xml
Last active March 13, 2018 00:10
ANSI Escape Sequences
<?xml version="1.0" encoding="utf-8" ?>
<!-- *******************************************************************
This is Joel "Jaykul" Bennett's coloring format file for PowerShell 5.1
******************************************************************** -->
<Configuration>
<SelectionSets>
<SelectionSet>
<Name>FileSystemTypes</Name>
<Types>
<TypeName>System.IO.DirectoryInfo</TypeName>
@Jaykul
Jaykul / Set-CodeCmd.ps1
Last active March 7, 2018 19:21
This makes it so you can type just `code` to start VS Code (even Insiders) in the current folder, even ... in Explorer!
#requires -RunAsAdministrator
<#
.Synopsis
Creates (or alters) a "code" command for opening Visual Studio Code (or VS Code Insiders)
.Description
Recreates the "code.cmd"" batch file command that starts Visual Studio Code (or VS Code Insiders)
1. Adds logic to make it open in the current folder if you don't pass parameters.
2. Makes "code" work as a command in Windows 10 Explorer's address bar.
#>
[CmdletBinding()]
@General-Gouda
General-Gouda / Encryption.ps1
Last active December 8, 2020 15:31
Encryption helper cmdlets
#----------------------------------------------------#
# Decrypts password using Certificate
#----------------------------------------------------#
function Get-DecryptedPassword
{
[CmdletBinding()]
param
(
$EncryptedPassword,
$EncryptedKey,
if ([Environment]::OSVersion.Version.Major -lt 10)
{
Write-Error "Windows 10 or above is required to run this script"
exit -1
}
Add-Type -Language CSharp -TypeDefinition @'
using System;
using System.Runtime.InteropServices;
using System.ComponentModel;
@brianmed
brianmed / duSort.csx
Created March 28, 2018 03:20
dotnet script for sorting du output.. yay
#! "netcoreapp2.0"
#r "nuget: NetStandard.Library, 2.0.0"
# [bpm@Orfgum] c:~/playground/c>sudo du -k ~ | dotnet script ./duSort.csx > joy
using System;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using (var stdin = new StreamReader(Console.OpenStandardInput()))
#Thread-safe data structure to store prompt strings and communicate about state
$prompt = [Collections.Concurrent.ConcurrentDictionary[String,String]]@{}
$prompt.infix = ''
Set-PSReadlineOption -ExtraPromptLineCount 1 # For 2-line prompt
Register-EngineEvent -SourceIdentifier PowerShell.OnIdle -Action {
if($prompt.state -eq 'rerender') {
$prompt.isIdleRender = 'yes'
[Microsoft.PowerShell.PSConsoleReadLine]::InvokePrompt()
$prompt.isIdleRender = 'no'