Skip to content

Instantly share code, notes, and snippets.

:bowtie:

Adam Driscoll adamdriscoll

:bowtie:
Block or report user

Report or block adamdriscoll

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@adamdriscoll
adamdriscoll / RestApiAuth.ps1
Created Oct 16, 2019
UD Rest API Authentication
View RestApiAuth.ps1
$auth = @()
$auth += New-UDAuthenticationMethod -Endpoint {
param([PSCredential]$Credential)
$userName = $Credential.UserName
$role = if ($userName -eq 'Adam') {
'admin'
} else {
'luser'
}
$Token = Grant-UDJsonWebToken -Identity $UserName -Role $Role -Issuer 'Adam'
@adamdriscoll
adamdriscoll / PSWordCloud.ps1
Created Oct 2, 2019
PSWordCloud in Universal Dashboard.
View PSWordCloud.ps1
Import-Module PSWordCloud
$WordClouds = "$PSScriptRoot/wordclouds"
$Folder = Publish-UDFolder -Path "$PSScriptRoot/wordclouds" -RequestPath "/wordclouds"
Start-UDDashboard -Dashboard (New-UDDashboard -Title 'Dashboard' -Content {
New-UDInput -Title "Generate Diagram" -Content {
New-UDInputField -Type 'file' -Name 'file'
} -Endpoint {
param($file)
@adamdriscoll
adamdriscoll / DynamicPSWriteHtml.ps1
Created Oct 2, 2019
Dynamically generate a diagram with PSWriteHtml and Universal Dashboard
View DynamicPSWriteHtml.ps1
Import-Module PSWriteHTML
$DiagramPath = "$PSScriptRoot/pswritehtml"
$Folder = Publish-UDFolder -Path "$PSScriptRoot/pswritehtml" -RequestPath "/pswritehtml"
Start-UDDashboard -Dashboard (New-UDDashboard -Title 'Dashboard' -Content {
New-UDInput -Title "Generate Diagram" -Endpoint {
param($Color)
New-HTML -TitleText 'My diagram' -UseCssLinks -UseJavaScriptLinks -FilePath $DiagramPath\diagram.html {
@adamdriscoll
adamdriscoll / PSWriteHtmlAndUd.ps1
Created Oct 2, 2019
Using PSWriteHtml and Universal Dashboard
View PSWriteHtmlAndUd.ps1
Import-Module PSWriteHTML
New-HTML -TitleText 'My diagram' -UseCssLinks -UseJavaScriptLinks -FilePath $PSScriptRoot\pswritehtml\diagram.html {
New-HTMLPanel {
New-HTMLDiagram {
New-DiagramNode -Label 'One node' -To 'Second node','Third node' -ColorBackground Bisque
New-DiagramNode -Label 'Second node'
New-DiagramNode -Label 'Third node'
}
}
@adamdriscoll
adamdriscoll / InvalidUD.ps1
Created Oct 2, 2019
Example of PSHtml and UD that won't work.
View InvalidUD.ps1
$Html = (& {
div {
New-UDHeading -Text "Hey"
}
}) -join ''
New-UDHtml -Markup $Html
@adamdriscoll
adamdriscoll / MultipleElements.ps1
Created Oct 2, 2019
Combining Multiple PSHtml Elements into a Single String
View MultipleElements.ps1
$Html = (& {
h1 "This is h1 Title in header"
div {
p {
"This is simply a paragraph in a div."
}
h1 "This is h1"
h2 "This is h2"
h3 "This is h3"
@adamdriscoll
adamdriscoll / PSHtmlAndNewUDHtml.ps1
Created Oct 2, 2019
Using PSHtml with New-UDHtml
View PSHtmlAndNewUDHtml.ps1
New-UDHtml -Markup (h1 "My favorites Fruits")
@adamdriscoll
adamdriscoll / pshtml.ps1
Created Oct 2, 2019
Example PSHtml Output
View pshtml.ps1
PS C:\> h1 "My favorites Fruits"
<h1 >My favorites Fruits</h1>
@adamdriscoll
adamdriscoll / DeployImageToAzure.ps1
Created Sep 25, 2019
Deploys a Docker Image to Azure Container Instances
View DeployImageToAzure.ps1
param(
$DockerUserName = "",
$DockerPassword = "",
$ShareUserName = "",
$SharePassword = "",
$ServicePrincipalName = "",
$ServicePrincipalPassword = ""
)
$azurePassword = ConvertTo-SecureString $ServicePrincipalPassword -AsPlainText -Force
@adamdriscoll
adamdriscoll / DockerPush.ps1
Created Sep 25, 2019
Push an image to Docker Hub
View DockerPush.ps1
param($TagName = '1.0.2')
docker tag myImage adamdriscoll/myImage:$TagName
docker login -u adamdriscoll -p $Env:dockerpwd
docker push adamdriscoll/myImage:$TagName
You can’t perform that action at this time.