Skip to content

Instantly share code, notes, and snippets.

@lidopaglia
lidopaglia / ConvertFrom-Markdown.ps1
Created September 17, 2012 20:04
PowerShell function to convert Markdown to HTML via Github API
<#
.SYNOPSIS
Converts Markdown formatted text to HTML.
.DESCRIPTION
Converts Markdown formatted text to HTML using the Github API. Output is "flavored" depending on
the chosen mode. The default output flavor is 'Markdown' and includes Syntax highlighting and
Github stylesheets.
Based on the Ruby version by Brett Terpstra:
http://brettterpstra.com/easy-command-line-github-flavored-markdown/
@lidopaglia
lidopaglia / FlipText.ps1
Created February 15, 2013 01:50
uʍop ǝpısdn ʇı ssɐd noʎ ʇxǝʇ ǝɥʇ dılɟ oʇ uoıʇɔunɟ ǝlʇʇıl ɐ
function FlipText ([string]$Text){
<#
.SYNOPSIS
Takes a string of text and flips it upsidedown
.LINK
http://www.leancrew.com/all-this/2009/05/im-feelin-upside-down/
#>
$pchars = "abcdefghijklmnopqrstuvwxyz,.?!'()[]{} "
$fchars = "ɐqɔpǝɟƃɥıɾʞlɯuodbɹsʇnʌʍxʎz'˙¿¡,)(][}{ "
@lidopaglia
lidopaglia / Add-LyncDepartmentColleagues.ps1
Created December 12, 2013 15:50
Adds a user's department colleagues to Lync
#requires -version 3
<#
.SYNOPSIS
Adds a user's department colleagues to Lync
.DESCRIPTION
This script is designed to execute under the context of the currently logged on user. The script will make a call to Active Directory
to find the department of the currently logged on user and will look for all users with the same department. If there are users with
the same department as the currently logged on user we get only the users that are Lync enabled. We then check if the currently logged
@lidopaglia
lidopaglia / Set-File.ps1
Created December 31, 2013 17:22
Change the access and modification times of one or more files.
#Requires -Version 3.0
<#
.SYNOPSIS
Change the access and modification times of one or more files.
.DESCRIPTION
Set-File is designed to work in similar fashion to the Unix 'touch(1)' command. If the given filepath does
not exist, Set-File creates the file setting its initial content to $null. If the file already exists then
some or all of the file's timestamps can be modified. Unless specific properties are specified an existing
@lidopaglia
lidopaglia / GotMacs.ps1
Created February 18, 2014 16:11
Maybe you have some tabular data that you would like to paste into Excel across cells...
# Got Macs?
Get-ADComputer -Filter {Name -like "foo*" -and (OperatingSystem -like "Mac*")} -Properties CanonicalName,OperatingSystem,OperatingSystemVersion | select Name,OperatingSystem,OperatingSystemVersion,CanonicalName | sort canonicalName | ConvertTo-Csv -NoTypeInformation -Delimiter "`t" | clip
@lidopaglia
lidopaglia / Export-ExcelWorksheet.ps1
Created February 21, 2014 17:04
Pass objects to an Excel worksheet
#requires -Version 3.0
<#
.SYNOPSIS
Export an object's properties to a new Excel Worksheet.
.DESCRIPTION
Using COM will create a new visible instance of Excel and insert an object's NoteProperties
row by row. You can optionally exclude the property Names from the first row and also choose
on what row to start inserting cell values.
@lidopaglia
lidopaglia / Read-PromptForChoice.ps1
Created March 4, 2014 03:33
Prompts the user to select a choice.
#requires -Version 4.0
function Read-PromptForChoice
{
<#
.SYNOPSIS
Prompts the user to select a choice.
.DESCRIPTION
Given a title, message, and ordered hashtable of options Read-PromptForChoice will call the
@lidopaglia
lidopaglia / DSCResourceDownloader.ps1
Created March 24, 2014 01:37
Downloads DSC Resource Kits from TechNet Gallery
<#
This Gist was created by ISEGist
03/23/2014 21:37:18
#>
#requires -Version 4.0
<#
.SYNOPSIS
Downloads DSC Resource Kits from TechNet Gallery
@lidopaglia
lidopaglia / Resize-ConsoleWindow.ps1
Last active January 13, 2018 19:50
Resize console window/buffer using arrow keys
<#
This Gist was created by ISEGist
04/03/2014 20:11:13
#>
# Resize the standard console window
function Resize-ConsoleWindow
{
##
## Author : Roman Kuzmin
## Synopsis : Resize console window/buffer using arrow keys
@lidopaglia
lidopaglia / Test-Params.ps1
Created May 26, 2014 22:42
Description for Test-Params.ps1
<#
This Gist was created by ISEGist
05/26/2014 18:42:33
#>
function Test-BoundParams
{
<#
.SYNOPSIS
Add a parameter with default value to PSBoundParameters
#>