Skip to content

Instantly share code, notes, and snippets.

View mwallner's full-sized avatar
🧙

Manfred Wallner mwallner

🧙
View GitHub Profile
@flcdrg
flcdrg / boxstarter-bare-v3.ps1
Last active March 25, 2024 01:47
My BoxStarter Scripts
# 1. Install Chocolatey
<#
Set-ExecutionPolicy RemoteSigned -Force
# Create empty profile (so profile-integration scripts have something to append to)
if (-not (Test-Path $PROFILE)) {
$directory = [IO.Path]::GetDirectoryName($PROFILE)
if (-not (Test-Path $directory)) {
New-Item -ItemType Directory $directory | Out-Null
}
@alexbevi
alexbevi / Execute-With-Retry.ps1
Created February 6, 2015 15:28
A PowerShell cmdlet that can be used to retry a failing ScriptBlock
<#
This function can be used to pass a ScriptBlock (closure) to be executed and returned.
The operation retried a few times on failure, and if the maximum threshold is surpassed, the operation fails completely.
Params:
Command - The ScriptBlock to be executed
RetryDelay - Number (in seconds) to wait between retries
(default: 5)
MaxRetries - Number of times to retry before accepting failure
@heiswayi
heiswayi / SerialPortReader.ps1
Last active November 3, 2022 15:02
PowerShell Script - Serial Port Reader
<#
.SYNOPSIS
Listens to and read data from a serial port (e.g. COM port)
.DESCRIPTION
The purpose of this script is to keep listening and read data from a serial port.
All the data captured will be displayed and log into a file.
.EXAMPLE
./SerialPortReader.ps1
.EXAMPLE
./SerialPortReader.ps1 -PortName COM3 -BaudRate 9600
@jchandra74
jchandra74 / PowerShell Customization.md
Last active June 3, 2024 21:32
PowerShell, Cmder / ConEmu, Posh-Git, Oh-My-Posh, Powerline Customization

Pimping Up Your PowerShell & Cmder with Posh-Git, Oh-My-Posh, & Powerline Fonts

Backstory (TLDR)

I work as a full-stack developer at work. We are a Windows & Azure shop, so we are using Windows as our development platform, hence this customization.

For my console needs, I am using Cmder which is based on ConEmu with PowerShell as my shell of choice.

Yes, yes, I know nowadays you can use the Linux subsystem on Windows 10 which allow you to run Ubuntu on Windows. If you are looking for customization of the Ubuntu bash shell, check out this article by Scott Hanselman.

@ian-noble
ian-noble / boxstarter-full-win10.ps1
Last active October 23, 2022 16:31
Boxstarter - Full - Windows 10
<#
.SYNOPSIS
BoxStarter script to configure Windows 10 development PC.
.DESCRIPTION
Install BoxStarter:
. { Invoke-WebRequest -useb http://boxstarter.org/bootstrapper.ps1 } | Invoke-Expression; get-boxstarter -Force
Run by calling the following from an **elevated** command-prompt.
Remove -DisableReboots parameter to allow the script to reboot as required.
function Get-AuthorizationHeader
{
[cmdletbinding()]
Param(
[Parameter(
ValueFromPipeline)]
[PSCredential]
$Credential
)
@AdmiringWorm
AdmiringWorm / maintainers.md
Last active September 17, 2020 12:44
@pauby's cheat sheet for what a maintainer can do 👅

What can you do as a maintainer?

The goal of this gist is to provide some details on what you can do and can't do on chocolatey.org when you are a maintainer.

  • You can not remove yourself as a maintainer for packages available on chocolatey.org. You will need to contact the site admins to be removed from a package. You will not be removed as a maintainer if you are the only maintainer listed.
  • When a new package have been pushed to chocolatey.org, a new version of the same package can not be pushed until the existing version is either approved or rejected. If the package is failing, the recommended solution is to update the existing version which fixes the failure reason. When this isn't possible, you can rejected a failing version yourself, or ask a Moderator to rejected it.
@nohwnd
nohwnd / restore-environment.ps1
Created July 5, 2019 08:45
Automatically clean up changes in env variables after test
# this snippet describes how to automatically clean up
# changes in environment varables
# it can clean up re-writing, adding and removing
# scroll down to see how to use it in real test
Get-Module Pester | Remove-Module
Import-Module Pester -MaximumVersion 4.9.9
function Get-Environment {
$vars = Get-Item Env:\
@bilbothebaggins
bilbothebaggins / ConvertTo-ArgvQuoteForPoSh.ps1
Last active May 7, 2023 16:25
Powershell V5 (and C# Code) to allow escaping native command arguments
function Get-NeedsArgvQuote {
<#
.DESCRIPTION Fix up our argument string for the insane CommandLineToArgvW rules
.LINK https://docs.microsoft.com/en-us/archive/blogs/twistylittlepassagesallalike/everyone-quotes-command-line-arguments-the-wrong-way
#>
[CmdletBinding()]
param(
[Parameter(Position=0,Mandatory=1)][AllowEmptyString()][string]$arg
)
if ([System.String]::IsNullOrEmpty($arg)) {
@aleixmorgadas
aleixmorgadas / keychron K3.md
Last active January 6, 2023 12:36
Keychron K3 Linux