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
#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()] |
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
<# | |
Prerequisites: PowerShell v3+ | |
License: MIT | |
Author: Michael Klement <[email protected]> | |
DOWNLOAD and INSTANT DEFINITION OF THE FUNCTION: | |
irm https://gist.github.com/mklement0/356acffc2521fdd338ef9d6daf41ef07/raw/Select-StringAll.ps1 | iex |
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 New-SelfCleaningJob { | |
param( | |
$Name=$([Guid]::NewGuid().Guid) | |
) | |
$job = Start-Job -Name $Name { 1..10 | % { Write-Output $_ } } | |
$jobCleanup = Register-ObjectEvent $job -EventName StateChanged -Action { | |
if($EventArgs.JobStateInfo.State -eq "Completed") { | |
# Note this prints to host no matter what's going on right now .... | |
Receive-Job $Sender | out-host |
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
""" github_orgy -- monitor github organizations for new repos. | |
Usage: | |
python3.5 github_orgy.py deepmind tensorflow facebookresearch google watson-developer-cloud | |
Or with cron: | |
@hourly /usr/bin/python github_orgy.py deepmind tensorflow facebookresearch google watson-developer-cloud | |
""" | |
import time | |
import os |
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
; Example: This is a hotkey that temporarily reduces the mouse cursor's speed, which facilitates precise positioning. | |
; Hold down the Hot key to slow down the cursor. Release it to return to original speed. | |
LWin & n:: | |
SPI_GETMOUSESPEED = 0x70 | |
SPI_SETMOUSESPEED = 0x71 | |
; Retrieve the current speed so that it can be restored later: | |
DllCall("SystemParametersInfo", UInt, SPI_GETMOUSESPEED, UInt, 0, UIntP, OrigMouseSpeed, UInt, 0) | |
; Now set the mouse to the slower speed specified in the next-to-last parameter (the range is 1-20, 10 is default): | |
DllCall("SystemParametersInfo", UInt, SPI_SETMOUSESPEED, UInt, 0, UInt, 10, UInt, 0) |
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
<# | |
Prerequisites: PowerShell version 3 or above. | |
License: MIT | |
Author: Michael Klement <[email protected]> | |
DOWNLOAD and DEFINITION OF THE FUNCTION: | |
irm https://gist.github.com/mklement0/8689b9b5123a9ba11df7214f82a673be/raw/Out-FileUtf8NoBom.ps1 | iex | |
The above directly defines the function below in your session and offers guidance for making it available in future |
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
# Download latest dotnet/codeformatter release from github | |
$repo = "dotnet/codeformatter" | |
$file = "CodeFormatter.zip" | |
$releases = "https://api.github.com/repos/$repo/releases" | |
Write-Host Determining latest release | |
$tag = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].tag_name |
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
#add a border around a string of text | |
Function Add-Border { | |
<# | |
.Synopsis | |
Create a text border around a string. | |
.Description | |
This command will create a character or text based border around a line of text. You might use this to create a formatted text report or to improve the display of information to the screen. |
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
# From PowerShell ADMINISTRATOR session run | |
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force | |
# Open new PowerSheel Administrator session and run | |
# $cred=Get-Credential domain\username (can also use [email protected] MSA style username) | |
# Install-BoxstarterPackage -PackageName https://gist.githubusercontent.com/tylergibson/bd7a4c923db6bc0bd0a3ca05473dd4f7/raw -Credential $cred | |
# Initialize reboot log file | |
$reboot_log = "C:\installation.rbt" | |
if ( -not (Test-Path $reboot_log) ) { New-Item $reboot_log -type file } |
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
<# | |
.SYNOPSIS | |
Creates test text-based files with various character encodings. | |
.DESCRIPTION | |
Creates text-based test files using | |
* all 5 byte order-marked Unicode character encoding schemes, | |
both with and without BOM (Unicode signature) | |
* default encodings, | |
with the the platform's default encoding, [System.Text.Encoding]::Default |