Skip to content

Instantly share code, notes, and snippets.

Avatar

Marc Kean marckean

  • Microsoft
  • Sydney, Australia
View GitHub Profile
@marckean
marckean / Ben and Liam podcast download.ps1
Last active Dec 10, 2020
Download all Ben & Liam podcasts to your local computer
View Ben and Liam podcast download.ps1
$downloadlocation = "$env:USERPROFILE\downloads\BenLiam"
if(!(Test-Path $downloadlocation)) {New-Item -Path $downloadlocation -ItemType Directory}
# Get all the podcasts
$CompletePodcasts = @()
$page = 1
do {
$URL = "https://www.novafm.com.au/wp-json/nova/v1/infinite-scroll-posts?query_name=episodes&post_type=episode&meta_key=podcast_319425&paged=$page&__amp_source_origin=https%3A%2F%2Fwww.novafm.com.au"
$result1 = Invoke-WebRequest -Uri $URL | ConvertFrom-Json
if($result1){
View Get-Base64_of_Certificate.ps1
$CNroot = 'P2SRootCert'
$RootCertStore = "Cert:\$CertStoreRootPath\Root"
$RootCertificate = Get-ChildItem -Path $RootCertStore | where {$_.Subject -eq "CN=$CNroot"}
$base64certificate = @"
-----BEGIN CERTIFICATE-----
$([Convert]::ToBase64String($RootCertificate.Export('Cert'), [System.Base64FormattingOptions]::InsertLineBreaks))
-----END CERTIFICATE-----
"@
Set-Content -Path "$ENV:USERPROFILE\Documents\$CNroot.cer" -Value $base64certificate
View Azure - Resize Virtual Machines (Parallel).ps1
<#
Written with PowerShell v7.0.1 - install available here https://github.com/PowerShell/powershell/releases
Written with version 4.2.0 of the Az PowerShell Module
available from here https://github.com/Azure/azure-powershell/releases/tag/v4.2.0-June2020 or run: Install-Module -Name Az -RequiredVersion 4.2.0 -AllowClobber
Migration instructions Azure.RM to Az - https://azure.microsoft.com/en-au/blog/how-to-migrate-from-azurerm-to-az-in-azure-powershell/
#>
##########################################################################################
############################ Logon to Microsoft Azure #############################
##########################################################################################
View sc_serv.conf
adminpassword=AdminPassword
publicserver=never
requirestreamconfigs=1
logfile=logs\sc_serv.log
w3clog=logs\sc_w3c.log
banfile=control\sc_serv.ban
ripfile=control\sc_serv.rip
portbase=8000
;Stream IDs
View Install-SHOUTcast-Windows.ps1
# Download the latest copy of SHOUTcast
$url = 'http://download.nullsoft.com/shoutcast/tools/sc_serv2_win64-latest.exe'
$exeoutput = "$env:TEMP\sc_serv2_win64-latest.exe"
Invoke-WebRequest -Uri $url -OutFile $exeoutput
# Setup SHOUTcast silently
$arguments = '/S'
Start-Process $exeoutput -ArgumentList $arguments -Wait
# Copy the SHOUTcast Config file
View Get-BGPCommunities.ps1
<#
Written with version 3.5.0 of the Azure PowerShell Module
available from here https://github.com/Azure/azure-powershell/releases/tag/v2.8.0-October2019
Install-Module -Name Az -Repository PSGallery -RequiredVersion 3.5.0 -Force -AllowClobber
Migration instructions Azure.RM to Az - https://azure.microsoft.com/en-au/blog/how-to-migrate-from-azurerm-to-az-in-azure-powershell/
#>
Login-AzAccount | Out-Null
$subscriptions = Get-AzSubscription
View Ignite2019sessions.json
This file has been truncated, but you can view the full file.
[
{
"@search.score": 1.0,
"attendeeCount": 393,
"hasLiveStream": true,
"sessionId": "83014",
"sessionInstanceId": "83014",
"sessionCode": "THR3091",
"sessionCodeNormalized": "THR3091",
View Azure - Swap out VM resource.ps1
<#
Written with version 2.8.0 of the Azure PowerShell Module
available from here https://github.com/Azure/azure-powershell/releases/tag/v2.8.0-October2019
or run: Install-Module -Name Az -RequiredVersion 2.8.0 -AllowClobber
Migration instructions Azure.RM to Az - https://azure.microsoft.com/en-au/blog/how-to-migrate-from-azurerm-to-az-in-azure-powershell/
#>
#$resourceGroupName = Read-Host -Prompt "Enter the Resource Group name"
Add-AzAccount
View PowerShell_Azure_Module_Switcher.ps1
# Switch to the Azure AzureRM PowerShell module
if(Get-Module -Name Az*){
Remove-Module -Name Az*
Import-Module -Name AzureRM -Force}
# Switch to the Azure AZ PowerShell module (
if(Get-Module -Name AzureRM*){
Remove-Module -Name AzureRM*
Import-Module -Name Az -Force}
View PowerShellAzureFunction.ps1
using namespace System.Net
# Input bindings are passed in via param block.
param($Request, $TriggerMetadata)
# Write to the Azure Functions log stream.
Write-Host "PowerShell HTTP trigger function processed a request."
# Interact with query parameters or the body of the request.
$FirstName = $Request.Query.FirstName # Query based parameters