Skip to content

Instantly share code, notes, and snippets.

View schittli's full-sized avatar

Tom-- schittli

  • Biel / Bienne, Switzerland
  • 11:32 (UTC +02:00)
View GitHub Profile
@mklement0
mklement0 / Test-WinCredential.ps1
Last active April 18, 2024 01:33
Test-WinCredential: PowerShell function for validating Windows domain / local user credentials.
<#
Prerequisites: Windows PowerShell 5.1, PowerShell (Core) (v6+) - MAY work in earlier versions
License: MIT
Author: Michael Klement <[email protected]>
DOWNLOAD and INSTANT DEFINITION OF THE FUNCTION:
irm https://gist.github.com/mklement0/83e8e6a2b39ecec7b0a14a8e631769ce/raw/Test-WinCredential.ps1 | iex
@tivnet
tivnet / ACE Editor: submit, beautify and minify.html
Last active May 5, 2025 01:37
ACE Editor: submit, beautify and minify
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>ACE Editor: submit, beautify and minify</title>
<style type="text/css" media="screen">
#ace_js, #ace_css {
width: 95%;
height: 15em;
border: 1px solid silver;
@mattdkerr
mattdkerr / git_peek.lua
Last active May 23, 2024 06:18
Cmder git status peek replacement file
-- default script for clink, called by init.bat when injecting clink
-- !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED
-- !!! Use "%CMDER_ROOT%\config\<whatever>.lua" to add your lua startup scripts
-- luacheck: globals clink
-- At first, load the original clink.lua file
-- this is needed as we set the script path to this dir and therefore the original
-- clink.lua is not loaded.
@mklement0
mklement0 / wrapper.cmd
Last active February 23, 2025 20:36
wrapper.cmd - a wrapper batch-file template for executing embedded PowerShell and/or VBScript/JScript code
@echo off
setLocal enableDelayedExpansion
:: === ADAPTING THIS TEMPLATE (for help, see bottom or invoke with "help") ===
:: * Step 1 of 3: CLONE THIS BATCH FILE and give it a name of your choice.
:: * Step 2 of 3: Set the TARGET LANGUAGE on the next line.
:: One of: "ps1" "vbs" "js" (PowerShell, VBScript, JScript)
:: OR: "all" (runs ALL embedded snippets, in sequence)
:: NOTE: To add support for a new language, search for "NEW LANGUAGE"
:: below and follow the instructions there.
set "WRAPPER_LANG=ps1"
@zloeber
zloeber / bootstrapwindows10.ps1
Last active June 19, 2024 21:51
Boxstarter Windows 10 Configuration
<#
The command to run, built from the raw link of this gist
Win+R
iexplore http://boxstarter.org/package/url?<RAW GIST LINK>
OR (if you don't like the way the web launcher force re-installs everything)
@Jaykul
Jaykul / Azure Runbooks.md
Last active April 8, 2018 02:28
Silly Azure Portal

I've been working with Azure runbooks and I ocassionally actually dump the default scripts that are generated from the portal and run them. This last time, I spent a little time cleaning it up to keep around.

I'll probably share the completed thing later, but I wanted to post this correction right away because it's pretty confusing.

There's an internal private function in the generated Deploy.ps1 which looks like this, but really should just be a one-liner like this:

"microsoft.compute", "microsoft.network" | Register-AzureRmResourceProvider -ProviderNamespace { $_ }
@zloeber
zloeber / GetDuplicateAzureADDynamicGroups.ps1
Created February 4, 2018 17:12
List Duplicate AzureAD Dynamic Groups Based On Filter
<#
Finds a good portion of possible dupliate dynamic groups in Azure AD. Will not find super complicated member filter duplicates but should find most common filters (like all PCs and the zillions of 'Subsidiary*' groups that InTune upgrades have created on the back end)
Requires the AzureADPreview module to work correctly!
More on dynamic membership in Azure AD:
https://docs.microsoft.com/en-us/azure/active-directory/active-directory-groups-dynamic-membership-azure-portal
#>
Remove-Module AzureAD -Force -ErrorAction:SilentlyContinue
@Jaykul
Jaykul / About Module Help.md
Last active April 8, 2018 02:28
Get a list of commands with a short synopsis of their functionality

When you first install a module, you usually run a command something like Get-Command -Module newModule to see what commands are available, right?

Well, this function is what I have been running. It still gives you the list of commands from the module, but with the help synopsis next to each one so you can see a little more about what they do. Here are a couple of examples, to encourage you to try it out:

Get-ModuleHelp Microsoft.PowerShell.Archive

Name             Synopsis
----             --------
Compress-Archive Creates an archive, or zipped file, from specified files and folders.
@Jaykul
Jaykul / Reset-Alias.ps1
Last active August 5, 2023 08:09
Set all the default Windows PowerShell aliases, in a powerful, flexible, way.
<#
.SYNOPSIS
Resets all the default PowerShell 5 aliases.
.NOTES
This script must be run by dot-sourcing if you want it to clear the defaul aliases.
It can take quite a while when it's validating all of the commands (a minute and a half, on my system), so it is by far fastest to run it in -Force
.EXAMPLE
Reset-Alias.ps1 -Force -Quiet
@Jaykul
Jaykul / Invoke-Process.ps1
Created December 6, 2017 23:39
Like Start-Process, but without files
function Invoke-Process {
<#
.SYNOPSIS
Invokes a process, collecting the output
.DESCRIPTION
Invokes the process of the executable that is passed in using the command line arguments that are passed in
.EXAMPLE
Invoke-Process "C:\Program Files\7-Zip\7z.exe" 'x C:\temp -oC:\temp\path'