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
# Rudimentary implementation of *nix watch command for Powershell | |
# Tested under 2.0 and 5.1 | |
# Example usage: | |
# watch ls | |
# watch 'echo "Command with parameters"' | |
# watch -n 1 'echo "Display this every second"' | |
# watch -n 1 -command 'echo "Explicit use of the command parameter"' | |
function watch { | |
Param( |
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
function Format-Json { | |
Param( | |
[Parameter(ValueFromPipeline=$True,Mandatory=$True)] | |
[string]$jsondata, | |
[int]$indent=2 | |
) | |
# Processing blocks are useful for multiline JSON strings | |
begin { $fullpipeline = "" } | |
process { $fullpipeline += $jsondata } | |
end { |
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
# Powershell function to convert a multiline string to a single line string with line break characters | |
# | |
# Example usage: | |
# # Replace line breaks with \r\n (Windows-style line endings) | |
# cat 'nginx.cer' | Convert-MultilineToSingleLine | |
# # Replace line breaks with \n (Unix/Linux-style line endings) | |
# cat 'nginx.cer' | Convert-MultilineToSingleLine -n | |
function Convert-MultilineToSingleLine { | |
Param( |
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
# Alternative (improved?) implementation of Measure-Command | |
# Works similarly to the Linux/Unix `time` command | |
# | |
# Function which times how long a command takes to completion | |
# Note that this function outputs to Write-Host so as to | |
# protect the proper return value. Note that a time will be | |
# returned even if the command fails. | |
# | |
# Unless `-quiet` is specified, command output is sent directly | |
# to `Write-Host` to allow for the simultaneous return of the |
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
# Installs modules if they are missing prior to importing | |
# Does not upgrade modules, only installs them if they are missing | |
# | |
# Example usage: | |
# install-and-import pscx | |
function install-and-import { | |
Param( | |
[Parameter(Mandatory=$true)] | |
[string]$moduleName |
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
#Requires -Version 5.1 | |
# This is more of a backup of my profile but if you like it use it I guess. | |
# Some of the custom functions I have sourced on Github as gists, which are | |
# commented and documented, unlike these here. | |
function install-and-import { | |
Param( | |
[Parameter(Mandatory=$true)] | |
[string]$moduleName, | |
[string]$Scope = 'CurrentUser' |
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
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
; #Warn ; Enable warnings to assist with detecting common errors. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir C:\Projects ; Ensures a consistent starting directory. | |
^!t::GoSub, FocusOrStartConEmu | |
;; This will probably not act as intended if you have more than one ConEmu64 process running | |
FocusOrStartConemu: | |
if WinExist("ahk_exe ConEmu64.exe") |
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
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
; #Warn ; Enable warnings to assist with detecting common errors. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
; Right clicks | |
^LButton::RButton | |
; Middle clicks | |
^+LButton::MButton |
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
# Powershell function which opens the containing folder of a given file | |
# in the default program (this will be Windows Explorer 99% of the time). | |
# | |
# Note that if -File is actually a folder, it will open that folder's | |
# parent folder. | |
# | |
# Usage: | |
# Open-ContainingFolder $env:AppData | |
# Open-ContainingFolder .\somefile.txt | |
# Open-ContainingFolder C:\Windows\System32\ping.exe |
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
<!-- | |
Mostly this contains custom keybindings, theme, and enables Quake style sliding | |
--> | |
<?xml version="1.0" encoding="utf-8"?> | |
<key name="Software"> | |
<key name="ConEmu"> | |
<key name=".Vanilla" modified="2017-01-05 20:41:54" build="161206"> | |
<value name="StartType" type="hex" data="02"/> | |
<value name="CmdLine" type="string" data=""/> | |
<value name="StartTasksFile" type="string" data=""/> |
OlderNewer