Skip to content

Instantly share code, notes, and snippets.

View harishrathi's full-sized avatar

Harish Rathi harishrathi

  • AlgoSys Tech
  • Pune
View GitHub Profile
@harishrathi
harishrathi / iis.dockerfile
Created December 13, 2016 11:17
hosting plain html website in docker
FROM microsoft/iis:latest
RUN mkdir C:\site
RUN powershell -NoProfile -Command \
Import-module IISAdministration; \
New-IISSite -Name "Site" -PhysicalPath C:\site -BindingInformation "*:8000:"
EXPOSE 8000
@harishrathi
harishrathi / mongo.wsnano.dockerfile
Last active December 13, 2016 11:23
docker hosting: mongo db in windows nanoserver
FROM microsoft/nanoserver
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]
ENV MONGO_VERSION 3.0.14
ENV MONGO_DOWNLOAD_URL http://downloads.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-${MONGO_VERSION}-signed.msi
ENV MONGO_DOWNLOAD_SHA256 5a081722c42c79f23d9201c97500be6ddc8741b66ce707d88dad058bf84165f1
RUN Write-Host ('Downloading {0} ...' -f $env:MONGO_DOWNLOAD_URL); \
(New-Object System.Net.WebClient).DownloadFile($env:MONGO_DOWNLOAD_URL, 'mongo.msi'); \
FROM microsoft/nanoserver
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ENV NPM_CONFIG_LOGLEVEL info
ENV NODE_VERSION 7.2.1
ENV NODE_SHA256 960ce0e9da98650c0cb86f9550d558996b2e13cff4c376991e74a852babe76ac
RUN Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \
if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $env:NODE_SHA256) {exit 1} ; \
FROM microsoft/iis
RUN ["powershell.exe", "Install-WindowsFeature NET-Framework-45-ASPNET"]
RUN ["powershell.exe", "Install-WindowsFeature Web-Asp-Net45"]
ADD web-app/ c:\\web-app
EXPOSE 8081
RUN powershell New-Website -Name 'web-app' -Port 8081 -PhysicalPath 'c:\web-app' -ApplicationPool '.NET v4.5'
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ...
@harishrathi
harishrathi / windows.docker-compose.yml
Created December 14, 2016 10:38
docker-compose.yml example for windows
version: '2'
networks:
default:
external:
name: nat
services:
website:
$dirName=[System.IO.Path]::GetDirectoryName($profile)
if(!(Test-Path $dirName))
{
Write-Host "creating profile directory: $dirName"
New-Item -ItemType directory -Path $dirName
}
if (!(Test-Path $profile))
{
# set strong cryptography on 64 bit .Net Framework (version 4 and above)
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
# set strong cryptography on 32 bit .Net Framework (version 4 and above)
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
mkdir -p ~/Documents/WindowsPowerShell
New-Item -Type file ~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco feature enable --name=allowGlobalConfirmation
choco install googlechrome
choco install 7zip
choco install adobereader
private void ValidationConfiguration()
{
var fields = this.Fields.Select(x => x.Key).ToList();
var duplicateFields = fields.GroupBy(x => x)
.Where(g => g.Count() > 1)
.Select(y => y.Key)
.ToList();
if (duplicateFields.Count > 0)
{
var result = string.Join(',', duplicateFields);