Skip to content

Instantly share code, notes, and snippets.

function Get-RandomUser {
<#
.SYNOPSIS
Generate random user data.
.DESCRIPTION
This function uses the free API for generating random user data from https://randomuser.me/
.EXAMPLE
Get-RandomUser 10
.EXAMPLE
Get-RandomUser -Amount 25 -Nationality us,gb -Format csv -ExludeFields picture
<#
.SYNOPSIS
Uses XML transformation on a specified XML file
.DESCRIPTION
Performs XML configuration changes to a given XML file via XML-Document-Transform (XDT) commands specified within a seperate XML file.
.EXAMPLE
PS C:\> Use-XMLTransform -XML 'D:\myApp\app.config' -XDT 'D:\myApp\app.release.config'
Transforms configuration within app.config using the XDT commands found in app.release.config
.INPUTS
String literal paths to XML/XDT docs and optionally XmlTransform.dll
@zxcvbnm4709
zxcvbnm4709 / gist:2656197
Created May 10, 2012 22:06
include jQuery in Chrome Console
var script = document.createElement("script");
script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js");
script.addEventListener('load', function() {
var script = document.createElement("script");
document.body.appendChild(script);
}, false);
document.body.appendChild(script);
@Jaykul
Jaykul / Format-Wide.ps1
Created February 24, 2016 05:30
A Format-Wide that can pivot the output and order it vertically
function Format-Wide {
[CmdletBinding(HelpUri='http://go.microsoft.com/fwlink/?LinkID=113304')]
param(
[Parameter(Position=0)]
[System.Object]
${Property},
[switch]
${AutoSize},
@klinkby
klinkby / Get-Spreadsheet.ps1
Last active June 3, 2019 17:35
Powershell script to read Excel spreadsheet contents
function Get-Spreadsheet {
param(
[Parameter(Mandatory = $true)]
[ValidateScript({ Test-Path $_ -PathType Leaf })]
[string]$Path
)
try {
[DocumentFormat.OpenXml.Packaging.SpreadsheetDocument] | Out-Null
}
catch {
@fearthecowboy
fearthecowboy / new-alias.ps1
Created February 1, 2019 00:48
A better new-alias for PowerShell
<#
.SYNOPSIS
Creates a new alias. Better than original New-Alias
.DESCRIPTION
Creates a new Function Alias. Unlike the original New-Alias, this will let you
create an alias that can be a command line or script, in a single command.
@fearthecowboy
fearthecowboy / elevate.ps1
Last active September 3, 2019 11:34
Better elevation script for powershell
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@XPlantefeve
XPlantefeve / Convert-CSVtoXLS.ps1
Last active September 17, 2019 20:14
CSV to XLS Powershell conversion
#requires -version 4.0
Function Convert-CSVtoXLS {
<#
.SYNOPSIS
This function converts a CSV file to an Excel workbook.
.DESCRIPTION
Convert-CSVtoXLS converts a csv file to a Excel workbook.
The first line of the CSV file is turned into a filtering header.
Excel must be installed on the computer.
var searchterm='ACME Corporation'; //text to search for
//this is the decoded base64 string from the global search url
var stringToEncode = '{"componentDef":"forceSearch:search","attributes":{"term":"'+searchterm+'","scopeMap":{"resultsCmp":"forceSearch:resultsTopResults","label":"Top Results","type":"TOP_RESULTS","cacheable":"Y","id":"TOP_RESULTS","labelPlural":"Top Results"},"context":{"disableSpellCorrection":false,"SEARCH_ACTIVITY":{"term":1234567890}}},"state":{}}';
//convert to base64encode
var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f<e.length){n=e.charCodeAt(f++);r=e.charCodeAt(f++);i=e.charCodeAt(f++);s=n>>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-
@davebrny
davebrny / goto open folder.ahk
Last active June 30, 2020 21:30
📂 (autohotkey) - show a list of open folders when youre at a "save as" or "open" dialog
#if winActive("ahk_class #32770") ; "save", "save as" or "open"
^+l::goSub, list_open_folders
#if
list_open_folders:
for a in comObjCreate("shell.application").windows
{
if !inStr(a.document.folder.self.path, "::{") ; ignore recycle bin & my pc
menu, open_folders, add, % a.document.folder.self.path, goto_open_folder