Skip to content

Instantly share code, notes, and snippets.

View EmmanuelTsouris's full-sized avatar

Emmanuel Tsouris EmmanuelTsouris

View GitHub Profile
@EmmanuelTsouris
EmmanuelTsouris / Angular2-on-Windows2008
Created May 22, 2016 04:54
Hosting an Angular 2 App on Windows 2008 (IIS 7)
#Allowing the Plus (+) character in a URL for Angular2 html5 Routing
By default, IIS 7 denies requests with certain characters in the URL. The plus (+) sign is one of those illegal characters. You can disable the setting for your web app using the web.config, basically setting allowDoubleEscaping to true.
Before making this change in production, be sure to research and understand the security implications for your specific environment, server, and web application.
Example location in web.config
```
<configuration>
<system.webServer>
<security>
@EmmanuelTsouris
EmmanuelTsouris / screen-stuff.md
Created June 7, 2016 22:37 — forked from gesellix/screen-stuff.md
screen and Docker for Mac
screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty



screen -AmdS docker ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
screen -r docker
# enter, then disconnect with Ctrl-a d
screen -S docker -p 0 -X stuff $(printf root\\r\\n)
screen -r docker
# PowerShell to grab a list of the Windows 2016 with Containers AMI
Get-EC2Image -Filter @{Name='name';Value='Windows_Server-2016*'},@{Name='name';Value="*Containers*"}
@EmmanuelTsouris
EmmanuelTsouris / MSFT_WUOperationsSession.ps1
Last active January 11, 2018 19:04
Windows Server 2016 and Nano Server CimMethods for Windows Updates using MSFT_WUOperationsSession
Write-Host "Installed Updates"
$ci = New-CimInstance -Namespace root/Microsoft/Windows/WindowsUpdate -ClassName MSFT_WUOperationsSession
$result = $ci | Invoke-CimMethod -MethodName ScanForUpdates -Arguments @{SearchCriteria="IsInstalled=1";OnlineScan=$true}
$result.Updates
Write-Host "Missing Updates"
$ci = New-CimInstance -Namespace root/Microsoft/Windows/WindowsUpdate -ClassName MSFT_WUOperationsSession 
@EmmanuelTsouris
EmmanuelTsouris / OperatingSystemSKU.ps1
Created November 28, 2016 18:09
Windows Server SKU
$(Get-CimInstance -ClassName Win32_OperatingSystem).OperatingSystemSKU
#region Nano server check
Switch -Exact ($(Get-CimInstance -ClassName Win32_OperatingSystem).OperatingSystemSKU) {
143 {
Write-Verbose -Message 'Script Running on Windows Server Datacenter Edition (Nano Server installation)'
break;
}
144 {
Write-Verbose -Message 'Windows Server Standard Edition (Nano Server installation)'
@EmmanuelTsouris
EmmanuelTsouris / Install-VSCode.ps1
Last active May 18, 2024 17:25
Download and Silently Install Visual Studio Code (VSCode)
<#
.SYNOPSIS
This script installs Visual Studio Code Silently.
.DESCRIPTION
The script downloads the latest VSCode installer and performs a silent installation.
.NOTES
Run this script on a Windows Server instance.
#>
@EmmanuelTsouris
EmmanuelTsouris / write-metricgputemp.ps1
Last active September 16, 2017 15:27
PowerShell to log NVIDIA GPU Temperature from a Amazon EC2 G3 Instance to CloudWatch Metric
Import-Module AWSPowerShell
Function Get-MetaData {
<#
.DESCRIPTION
Gets metadata from the local instance using the path extention provided
.PARAMETER metaDataUrlPathExtention
The URL suffix of the metadata that you want to gathered
.EXAMPLE
[string]$instanceId = $(Get-MetaDataObject -metaDataUrlPathExtention "instance-id")
@EmmanuelTsouris
EmmanuelTsouris / Install-IIS.ps1
Created January 31, 2018 17:08
Two simple lines of PowerShell that install IIS and .Net
# Instal IIS
Install-WindowsFeature -name Web-Server -IncludeManagementTools
# Install .Net
Install-WindowsFeature Net-Framework-Core
@EmmanuelTsouris
EmmanuelTsouris / Install-Chrome.ps1
Last active May 1, 2019 15:56
Install Chrome using PowerShell One Liner
$path = $env:TEMP; $arg="/silent /install"; $exe = "chrome_installer.exe"; $url="https://dl.google.com/chrome/install/latest/$exe"; Invoke-WebRequest $url -OutFile $path$exe; Start-Process -FilePath $path$exe -Args $arg -Verb RunAs -Wait; Remove-Item $path$exe
param (
$ScriptPath
)
# Formats the Script to you can paste it into a RunCommand or Automation Document
# Example:
# .\AdditionalExamples\Format-PSForDocument.ps1 -ScriptPath .\AdditionalExamples\Install-SSMS.ps1
# Grab the script and remove blank lines and comments
$powershell = (Get-Content $ScriptPath | Where-Object {$_ -notlike '#*' -and $_ -notlike [string]::Empty})