├── Utils ├── AzureRDP.cmd ├── _MouseLeftHanded.cmd ├── st.cmd ├── _MouseRightHanded.cmd ├── Z-AddThisFolderToPath.cmd ├── log │ ├── Makefile │ └── log.c ├── Set-MouseLeftHanded.ps1 ├── Set-MouseRightHanded.ps1 └── Start-AzureRDP.ps1 ├── Code Snippets ├── register-in-vs.bat ├── register-in-vs.ps1 ├── create-junction.cmd └── Visual C# │ └── My Code Snippets │ ├── cetry.snippet │ ├── cc.snippet │ ├── rt.snippet │ ├── build.snippet │ └── builder.snippet ├── PowerShell-Installers ├── Set-Execution-Policy.cmd ├── Get-NuGet.ps1 ├── Get-LiceCap.ps1 ├── Create-Windows7Vm.ps1 ├── Get-vSphereClient.ps1 ├── Get-Windows7HyperVImage.ps1 ├── Enable-RDP.cmd ├── Set-Enable-RDP.ps1 ├── Set-IgnoreRemoteKeyboardLayout.ps1 ├── Get-Go.ps1 ├── Set-Disable-HideFileExt.ps1 ├── git-go.txt ├── Set-VisualStudio2012-Menu-Caps.ps1 ├── Get-WinDirStat.ps1 ├── Download-WindowsSDK81.ps1 ├── Get-7za.ps1 ├── Get-cURL.ps1 ├── Get-WindowsLiveWriter2012.ps1 ├── Get-7zip.ps1 ├── Get-Python27.ps1 ├── Get-CmdColor.ps1 ├── Get-DotNetFramework451.ps1 ├── Get-ExamDiffPro.ps1 ├── Get-GitHubForWindows.ps1 ├── Get-LastPass.ps1 ├── Get-Posh-Monokai.ps1 └── Get-PowerShell-WinXP.bat ├── Repave-Win8 ├── Enable-Hyper-V.cmd ├── Create-Image-Initial.cmd ├── Enable-MSMQ.cmd ├── Create-Link-LiveWriter-SkyDrive.cmd ├── Install-Tools-Chocolatey.cmd ├── Get-Chocolatey.cmd ├── Install-Tools-Custom.cmd └── Add-Git-Path-To-PowerShell-Profile.cmd ├── AngularJS-Dev-Setup ├── _build.cmd ├── setup.bat ├── setup.ps1 ├── build-full-setup-script.ps1 ├── functions │ ├── Install-RubyGems.ps1 │ ├── Install-NodePackages.ps1 │ ├── Install-VisualStudio.ps1 │ ├── Install-PythonPackages.ps1 │ ├── Set-EnvironmentVariables.ps1 │ ├── Install-ChocolateyPackages.ps1 │ ├── Install-SublimeTextPackages.ps1 │ └── Install-PoshMonokai.ps1 └── angular.txt ├── Prototypes ├── Progress │ ├── Progress.psd1 │ └── Progress.psm1 └── Test-Progress.ps1 ├── Batch ├── get-vs-2013-build-tools.bat ├── get-python33.bat ├── get-graphviz.bat └── get-python27.bat ├── .gitattributes ├── README.md └── .gitignore /Utils/AzureRDP.cmd: -------------------------------------------------------------------------------- 1 | @powershell -File Start-AzureRDP.ps1 2 | -------------------------------------------------------------------------------- /Code Snippets/register-in-vs.bat: -------------------------------------------------------------------------------- 1 | @powershell -file register-in-vs.ps1 -------------------------------------------------------------------------------- /Utils/_MouseLeftHanded.cmd: -------------------------------------------------------------------------------- 1 | @powershell -File Set-MouseLeftHanded.ps1 2 | -------------------------------------------------------------------------------- /Utils/st.cmd: -------------------------------------------------------------------------------- 1 | @"C:\Program Files\Sublime Text 2\sublime_text.exe" %~f1 2 | -------------------------------------------------------------------------------- /Utils/_MouseRightHanded.cmd: -------------------------------------------------------------------------------- 1 | @powershell -File Set-MouseRightHanded.ps1 2 | -------------------------------------------------------------------------------- /Utils/Z-AddThisFolderToPath.cmd: -------------------------------------------------------------------------------- 1 | set path=%path%;%~dp0 2 | setx path "%path%" /m 3 | -------------------------------------------------------------------------------- /PowerShell-Installers/Set-Execution-Policy.cmd: -------------------------------------------------------------------------------- 1 | @powershell Set-ExecutionPolicy RemoteSigned -------------------------------------------------------------------------------- /Repave-Win8/Enable-Hyper-V.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | dism /Online /Enable-Feature /FeatureName:Microsoft-Hyper-V /All -------------------------------------------------------------------------------- /Utils/log/Makefile: -------------------------------------------------------------------------------- 1 | CC=cl 2 | FLAGS=/Ox /Tc /GA 3 | 4 | log.exe : log.c Makefile 5 | $(CC) $(FLAGS) log 6 | -------------------------------------------------------------------------------- /AngularJS-Dev-Setup/_build.cmd: -------------------------------------------------------------------------------- 1 | @powershell -ExecutionPolicy unrestricted -File build-full-setup-script.ps1 2 | -------------------------------------------------------------------------------- /AngularJS-Dev-Setup/setup.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | powershell -ExecutionPolicy unrestricted -File setup.ps1 4 | -------------------------------------------------------------------------------- /AngularJS-Dev-Setup/setup.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glombard/Scripts/HEAD/AngularJS-Dev-Setup/setup.ps1 -------------------------------------------------------------------------------- /Repave-Win8/Create-Image-Initial.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | recimg /createimage C:\Home\Win8-Backup-Images\01-Initial 3 | -------------------------------------------------------------------------------- /Code Snippets/register-in-vs.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glombard/Scripts/HEAD/Code Snippets/register-in-vs.ps1 -------------------------------------------------------------------------------- /Prototypes/Progress/Progress.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glombard/Scripts/HEAD/Prototypes/Progress/Progress.psd1 -------------------------------------------------------------------------------- /PowerShell-Installers/Get-NuGet.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glombard/Scripts/HEAD/PowerShell-Installers/Get-NuGet.ps1 -------------------------------------------------------------------------------- /PowerShell-Installers/Get-LiceCap.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glombard/Scripts/HEAD/PowerShell-Installers/Get-LiceCap.ps1 -------------------------------------------------------------------------------- /PowerShell-Installers/Create-Windows7Vm.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glombard/Scripts/HEAD/PowerShell-Installers/Create-Windows7Vm.ps1 -------------------------------------------------------------------------------- /PowerShell-Installers/Get-vSphereClient.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glombard/Scripts/HEAD/PowerShell-Installers/Get-vSphereClient.ps1 -------------------------------------------------------------------------------- /Repave-Win8/Enable-MSMQ.cmd: -------------------------------------------------------------------------------- 1 | dism /Online /NoRestart /English /Enable-Feature /All /FeatureName:MSMQ-Container /FeatureName:MSMQ-Server 2 | -------------------------------------------------------------------------------- /AngularJS-Dev-Setup/build-full-setup-script.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glombard/Scripts/HEAD/AngularJS-Dev-Setup/build-full-setup-script.ps1 -------------------------------------------------------------------------------- /AngularJS-Dev-Setup/functions/Install-RubyGems.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glombard/Scripts/HEAD/AngularJS-Dev-Setup/functions/Install-RubyGems.ps1 -------------------------------------------------------------------------------- /PowerShell-Installers/Get-Windows7HyperVImage.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glombard/Scripts/HEAD/PowerShell-Installers/Get-Windows7HyperVImage.ps1 -------------------------------------------------------------------------------- /PowerShell-Installers/Enable-RDP.cmd: -------------------------------------------------------------------------------- 1 | netsh advfirewall firewall set rule group="remote desktop" new enable=Yes 2 | powershell -File Set-Enable-RDP.ps1 3 | -------------------------------------------------------------------------------- /Repave-Win8/Create-Link-LiveWriter-SkyDrive.cmd: -------------------------------------------------------------------------------- 1 | mklink /D "%UserProfile%\Documents\My Weblog Posts" "%UserProfile%\SkyDrive\home\blog\My Weblog Posts" 2 | -------------------------------------------------------------------------------- /AngularJS-Dev-Setup/functions/Install-NodePackages.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glombard/Scripts/HEAD/AngularJS-Dev-Setup/functions/Install-NodePackages.ps1 -------------------------------------------------------------------------------- /AngularJS-Dev-Setup/functions/Install-VisualStudio.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glombard/Scripts/HEAD/AngularJS-Dev-Setup/functions/Install-VisualStudio.ps1 -------------------------------------------------------------------------------- /AngularJS-Dev-Setup/functions/Install-PythonPackages.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glombard/Scripts/HEAD/AngularJS-Dev-Setup/functions/Install-PythonPackages.ps1 -------------------------------------------------------------------------------- /AngularJS-Dev-Setup/functions/Set-EnvironmentVariables.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glombard/Scripts/HEAD/AngularJS-Dev-Setup/functions/Set-EnvironmentVariables.ps1 -------------------------------------------------------------------------------- /AngularJS-Dev-Setup/functions/Install-ChocolateyPackages.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glombard/Scripts/HEAD/AngularJS-Dev-Setup/functions/Install-ChocolateyPackages.ps1 -------------------------------------------------------------------------------- /PowerShell-Installers/Set-Enable-RDP.ps1: -------------------------------------------------------------------------------- 1 | Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name fDenyTSConnections -Type DWord -Value 0 2 | -------------------------------------------------------------------------------- /AngularJS-Dev-Setup/functions/Install-SublimeTextPackages.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glombard/Scripts/HEAD/AngularJS-Dev-Setup/functions/Install-SublimeTextPackages.ps1 -------------------------------------------------------------------------------- /PowerShell-Installers/Set-IgnoreRemoteKeyboardLayout.ps1: -------------------------------------------------------------------------------- 1 | set-itemproperty "HKLM:\SYSTEM\CurrentControlSet\Control\Keyboard Layout" -name IgnoreRemoteKeyboardLayout -Value 1 -Type DWord 2 | -------------------------------------------------------------------------------- /Code Snippets/create-junction.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | set dest=%home%\Documents\Visual Studio 2013\Code Snippets\Visual C# 4 | rd /s "%dest%" 5 | mklink /j "%dest%" "%~dp0\Visual C#" 6 | -------------------------------------------------------------------------------- /PowerShell-Installers/Get-Go.ps1: -------------------------------------------------------------------------------- 1 | # Installs the nice 'go' command into PowerShell. This allows bookmarking directories. 2 | 3 | (new-object Net.WebClient).DownloadString("http://psget.net/GetPsGet.ps1") | iex 4 | Import-Module PsGet 5 | Install-Module go -force 6 | -------------------------------------------------------------------------------- /PowerShell-Installers/Set-Disable-HideFileExt.ps1: -------------------------------------------------------------------------------- 1 | Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name HideFileExt -Type DWord -Value 0 2 | Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name Hidden -Type DWord -Value 1 3 | -------------------------------------------------------------------------------- /PowerShell-Installers/git-go.txt: -------------------------------------------------------------------------------- 1 | # START http://boxstarter.org/package/nr/url?http://myurl/git-go.txt 2 | # See BoxStarter.org... 3 | 4 | Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar 5 | 6 | cinst git 7 | cinst git-credential-winstore 8 | cinst poshgit 9 | -------------------------------------------------------------------------------- /Repave-Win8/Install-Tools-Chocolatey.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | call cinst NugetPackageExplorer 3 | call cinst 7zip.commandline 4 | call cinst autoit.commandline 5 | call cinst fiddler 6 | call cinst githubforwindows 7 | call cinst hg 8 | call cinst markpad 9 | call cinst notepadplusplus 10 | call cinst paint.net 11 | call cinst PDFCreator 12 | call cinst SkyDrive 13 | -------------------------------------------------------------------------------- /Repave-Win8/Get-Chocolatey.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | if not exist C:\Chocolatey goto InstChocolatey 4 | echo Chocolatey already installed. 5 | goto:eof 6 | 7 | :InstChocolatey 8 | echo Chocolatey installing ... 9 | echo. 10 | powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('http://bit.ly/psChocInstall'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin 11 | -------------------------------------------------------------------------------- /Repave-Win8/Install-Tools-Custom.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set ps=..\PowerShell-Installers 4 | call %ps%\Set-Execution-Policy.cmd 5 | powershell -file %ps%\Set-VisualStudio2012-Menu-Caps.ps1 6 | powershell -file %ps%\Set-Disable-HideFileExt.ps1 7 | powershell -file %ps%\Get-LastPass.ps1 8 | powershell -file %ps%\Get-ExamDiffPro.ps1 9 | powershell -file %ps%\Get-GitHubForWindows.ps1 10 | powershell -file %ps%\Get-WindowsLiveWriter2012.ps1 11 | -------------------------------------------------------------------------------- /Utils/Set-MouseLeftHanded.ps1: -------------------------------------------------------------------------------- 1 | # PowerShell script to swap mouse buttons for left-handed mouse users. 2 | # (Make right mouse button the primary button...) 3 | 4 | $swapButtons = Add-Type -MemberDefinition @' 5 | [DllImport("user32.dll")] 6 | public static extern bool SwapMouseButton(bool swap); 7 | '@ -Name "NativeMethods" -Namespace "PInvoke" -PassThru 8 | 9 | # Use $true for left-handed mouse and $false for right-handed mouse. 10 | [bool]$returnValue = $swapButtons::SwapMouseButton($true) 11 | -------------------------------------------------------------------------------- /Batch/get-vs-2013-build-tools.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | REM Downloads and installs Microsoft Build Tools 2013 4 | REM see: http://www.microsoft.com/en-us/download/details.aspx?id=40760 5 | 6 | setlocal 7 | set output=%temp%\BuildTools_Full.exe 8 | if exist "%output%" goto startInstall 9 | set url=http://download.microsoft.com/download/9/B/B/9BB1309E-1A8F-4A47-A6C5-ECF76672A3B3/BuildTools_Full.exe 10 | call curl -o%output% %url% 11 | :startInstall 12 | start /wait %output% /passive /full /norestart 13 | -------------------------------------------------------------------------------- /Utils/Set-MouseRightHanded.ps1: -------------------------------------------------------------------------------- 1 | # PowerShell script to swap mouse buttons. 2 | # This one makes the left mouse button the 3 | # primary button for right-handed mouse users. 4 | 5 | $swapButtons = Add-Type -MemberDefinition @' 6 | [DllImport("user32.dll")] 7 | public static extern bool SwapMouseButton(bool swap); 8 | '@ -Name "NativeMethods" -Namespace "PInvoke" -PassThru 9 | 10 | # Use $true for left-handed mouse and $false for right-handed mouse. 11 | [bool]$returnValue = $swapButtons::SwapMouseButton($false) 12 | -------------------------------------------------------------------------------- /Prototypes/Test-Progress.ps1: -------------------------------------------------------------------------------- 1 | # Example usage: 2 | 3 | $env:PSModulePath += ';' + $PSScriptRoot 4 | $progress = Import-Module Progress.psm1 -AsCustomObject 5 | 6 | $progress.Init("Getting the file you need") 7 | $downloading = $progress.Step("Downloading") 8 | $extracting = $progress.Step("Extracting") 9 | 10 | # Now set each step along the way: 11 | $downloading.Set() 12 | [System.Threading.Thread]::Sleep(1000) 13 | $extracting.Set() 14 | [System.Threading.Thread]::Sleep(1000) 15 | $progress.Done() 16 | [System.Threading.Thread]::Sleep(1000) 17 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /PowerShell-Installers/Set-VisualStudio2012-Menu-Caps.ps1: -------------------------------------------------------------------------------- 1 | if (Test-Path HKCU:\Software\Microsoft\VSWinExpress) 2 | { 3 | $vs = "VSWinExpress" 4 | } 5 | elseif (Test-Path HKCU:\Software\Microsoft\VWDExpress) 6 | { 7 | $vs = "VWDExpress" 8 | } 9 | else 10 | { 11 | $vs = "VisualStudio" 12 | } 13 | 14 | Write-Host "Fixing menu caps for $vs ..." 15 | 16 | if (!(Test-Path HKCU:\Software\Microsoft\$vs\11.0\General)) 17 | { 18 | New-Item -Path HKCU:\Software\Microsoft\$vs\11.0\General -Force 19 | } 20 | 21 | Set-ItemProperty -Path HKCU:\Software\Microsoft\$vs\11.0\General -Name SuppressUppercaseConversion -Type DWord -Value 1 22 | -------------------------------------------------------------------------------- /Repave-Win8/Add-Git-Path-To-PowerShell-Profile.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | REM this adds the Git\bin to powershell path to make Posh-git work... 4 | 5 | set out=%USERPROFILE%\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 6 | set tmp=%TEMP%\set-git-bin.txt 7 | set tmp2=%TEMP%\set-git-bin2.txt 8 | 9 | find /c "Git\bin" %out% > nul 2> nul 10 | if not errorlevel 1 goto alreadyOk 11 | 12 | echo $env:path += ";" + (Get-Item "Env:ProgramFiles(x86)").Value + "\Git\bin" > %tmp% 13 | echo. >> %tmp% 14 | 15 | echo Updating '%out%'... 16 | copy /b %tmp%+%out% %tmp2% > nul 17 | move /y %tmp2% %out% 18 | 19 | goto:eof 20 | 21 | :alreadyOk 22 | echo. 23 | echo Profile already sets Git path (%out%) 24 | echo. 25 | goto:eof 26 | -------------------------------------------------------------------------------- /Batch/get-python33.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://gist.github.com/glombard/7416112/raw/fb317426b2092a41770cf86b50463fb0c2f73706/get-curl.ps1'))" 4 | 5 | curl -O http://python.org/ftp/python/3.3.2/python-3.3.2.msi 6 | curl -O http://python-distribute.org/distribute_setup.py 7 | curl -k -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py 8 | 9 | msiexec /i python-3.3.2.msi /passive /norestart /log %temp%\python-install.log 10 | set PATH=%PATH%;C:\Python33 11 | python distribute_setup.py 12 | python get-pip.py 13 | 14 | set PATH=%PATH%;C:\Python33\Scripts 15 | setx PATH "%PATH%" /m 16 | 17 | REM pip install markdown 18 | -------------------------------------------------------------------------------- /PowerShell-Installers/Get-WinDirStat.ps1: -------------------------------------------------------------------------------- 1 | $file = Join-Path $env:Temp wds_current_setup.exe 2 | $url = 'https://windirstat.info/wds_current_setup.exe' 3 | (new-object net.webclient).DownloadFile($url, $file) 4 | 5 | function Invoke-Admin() { 6 | param ( [string]$program = $(throw "Please specify a program" ), 7 | [string]$argumentString = "", 8 | [switch]$waitForExit ) 9 | 10 | $psi = new-object "Diagnostics.ProcessStartInfo" 11 | $psi.FileName = $program 12 | $psi.Arguments = $argumentString 13 | $psi.Verb = "runas" 14 | $proc = [Diagnostics.Process]::Start($psi) 15 | if ( $waitForExit ) { 16 | $proc.WaitForExit(); 17 | } 18 | } 19 | 20 | Invoke-Admin $file '/S' $true 21 | -------------------------------------------------------------------------------- /PowerShell-Installers/Download-WindowsSDK81.ps1: -------------------------------------------------------------------------------- 1 | # Windows Software Development Kit (SDK) for Windows 8.1 2 | 3 | $url = 'http://www.microsoft.com/click/services/Redirect2.ashx?CR_EAC=300135395' 4 | $setupFile = Join-Path $env:TEMP sdksetup.exe 5 | $web = New-Object System.Net.WebClient 6 | $ua = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)' 7 | $web.Headers.Add('user-agent', $ua) 8 | $web.DownloadFile($url, $setupFile) 9 | 10 | $dir = Join-Path $env:TEMP Windows-8.1-SDK 11 | 12 | Invoke-Expression "$dest /quiet /layout $dir" 13 | 14 | function Report() 15 | { 16 | param ([string]$status) 17 | Write-Progress -Activity "Preparing Windows 8.1 SDK" -status $status $i" -percentComplete 50 18 | } 19 | 20 | # todo: this is still a work in progress... 21 | -------------------------------------------------------------------------------- /Utils/Start-AzureRDP.ps1: -------------------------------------------------------------------------------- 1 | # This starts the Azure VM if necessary and then starts the Remote Desktop connection... 2 | 3 | param ( 4 | [string]$name = $(Read-Host "Azure VM name") 5 | ) 6 | 7 | $vm = Get-AzureVM | where { $_.ServiceName -eq $name } 8 | if (!$?) { 9 | Add-AzureAccount 10 | $vm = Get-AzureVM -ServiceName $name 11 | } 12 | 13 | if ($vm -eq $null) { 14 | Write-Host "No such VM - $name" 15 | Exit 16 | } 17 | 18 | # Start the Azure Virtual Machine first: 19 | if ($vm.PowerState -ne 'Started') { 20 | Write-Host "Starting $name ..." 21 | $vm | Start-AzureVM 22 | } 23 | 24 | # Start Remote Desktop session: 25 | $port = $vm | Get-AzureEndpoint -Name 'Remote Desktop' | select -ExpandProperty Port 26 | $server = "${name}.cloudapp.net:$port" 27 | Invoke-Expression "mstsc.exe /v:$server /f" 28 | -------------------------------------------------------------------------------- /Utils/log/log.c: -------------------------------------------------------------------------------- 1 | // A silly small utility that appends the arguments to a log file at: %TEMP%\log.txt 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | int main(int argc, char* argv[]) 8 | { 9 | time_t t; 10 | struct tm *now; 11 | char buffer[MAX_PATH+1]; 12 | char file_name[MAX_PATH+1]; 13 | 14 | time(&t); 15 | now = localtime(&t); 16 | 17 | strftime(buffer, 20, "%F %T", now); 18 | 19 | for (int n = 1; n < argc; n++) 20 | { 21 | strcat(buffer, " "); 22 | strcat(buffer, argv[n]); 23 | } 24 | 25 | puts(buffer); 26 | 27 | GetTempPath(MAX_PATH, file_name); 28 | strcat(file_name, "\\log.txt"); 29 | FILE *file = fopen(file_name, "a"); 30 | if (file != NULL) 31 | { 32 | fputs(buffer, file); 33 | fputs("\n", file); 34 | fclose(file); 35 | } 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /PowerShell-Installers/Get-7za.ps1: -------------------------------------------------------------------------------- 1 | function Unzip-File 2 | { 3 | param ([string]$zipFile, [string]$destFolder) 4 | $shell = New-Object -Com Shell.Application 5 | New-Item -ItemType Directory -Force -Path $destFolder 6 | $zip = $shell.NameSpace($zipFile) 7 | $shell.NameSpace($destFolder).CopyHere($zip.Items(), 16) 8 | } 9 | 10 | Write-Host "Installing 7-Zip Command Line (7za)..." 11 | $dest = "$env:ProgramFiles\7-Zip" 12 | $destFile = "$env:ProgramFiles\7-Zip\7za.exe" 13 | if (!(Test-Path $destFile)) 14 | { 15 | Write-Host "Downloading 7za..." 16 | $wc = New-Object Net.WebClient 17 | $url = 'http://downloads.sourceforge.net/sevenzip/7za920.zip' 18 | $file = "$env:TEMP\7za920.zip" 19 | $wc.DownloadFile($url,$file) 20 | Write-Host "Unzipping to: $dest" 21 | Unzip-File $file $dest 22 | Remove-Item $file 23 | } 24 | else 25 | { 26 | Write-Host "7za already installed." 27 | } -------------------------------------------------------------------------------- /Code Snippets/Visual C#/My Code Snippets/cetry.snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | Contract.Ensures for TryGet 6 | cetry 7 | Contract.Ensures for TryGet 8 | Gert 9 | 10 | Expansion 11 | 12 |
13 | 14 | 15 | 16 | param 17 | Parameter name 18 | value 19 | 20 | 21 | () == false || Contract.ValueAtReturn(out $param$) != null); 22 | $param$ = null;$end$ 23 | return false;]]> 24 | 25 | 26 |
27 |
-------------------------------------------------------------------------------- /Code Snippets/Visual C#/My Code Snippets/cc.snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | ContractClass 6 | cc 7 | ContractClass 8 | Gert 9 | 10 | Expansion 11 | SurroundsWith 12 | 13 |
14 | 15 | 16 | 17 | name 18 | Interface name 19 | IFoo 20 | 21 | 22 | 29 | 30 | 31 |
32 |
-------------------------------------------------------------------------------- /PowerShell-Installers/Get-cURL.ps1: -------------------------------------------------------------------------------- 1 | function Unzip-File 2 | { 3 | param ([string]$zipFile, [string]$destFolder) 4 | 5 | $7z = "$env:ProgramFiles\7-Zip\7za.exe" 6 | if (Test-Path $7z) 7 | { 8 | $info = New-Object Diagnostics.ProcessStartInfo 9 | $info.FileName = $7z 10 | $info.Arguments = "x -y -o""$destFolder"" ""$zipFile""" 11 | $info.Verb = "runas" 12 | $proc = [Diagnostics.Process]::Start($info) 13 | $proc.WaitForExit() 14 | } 15 | else 16 | { 17 | $shell = New-Object -Com Shell.Application 18 | $zip = $shell.NameSpace($zipFile) 19 | $shell.NameSpace($destFolder).CopyHere($zip.Items(), 16) 20 | } 21 | } 22 | 23 | Write-Host "Installing cURL..." 24 | $wc = New-Object Net.WebClient 25 | $url = "http://www.paehl.com/open_source/?download=curl_732_0_ssl.zip" 26 | $file = "$env:TEMP\curl.zip" 27 | $wc.DownloadFile($url,$file) 28 | Write-Host "Unzipping to: $env:windir" 29 | Unzip-File $file $env:windir 30 | Remove-Item $file 31 | -------------------------------------------------------------------------------- /Code Snippets/Visual C#/My Code Snippets/rt.snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | RegisterType 6 | rt 7 | RegisterType 8 | Gert 9 | 10 | Expansion 11 | SurroundsWith 12 | 13 |
14 | 15 | 16 | 17 | classname 18 | Class name 19 | ClassName() 20 | ClassNamePlaceholder 21 | 22 | 23 | 25 | 26 | 27 |
28 |
-------------------------------------------------------------------------------- /Code Snippets/Visual C#/My Code Snippets/build.snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | Build() and implicit operator 6 | build 7 | Build() and implicit operator 8 | Gert 9 | 10 | Expansion 11 | 12 |
13 | 14 | 15 | 16 | class 17 | Class name 18 | Foo 19 | 20 | 21 | () != null); 24 | return new $class$($end$); 25 | } 26 | 27 | public static implicit operator $class$($class$Builder builder) 28 | { 29 | return builder.Build(); 30 | }]]> 31 | 32 | 33 |
34 |
-------------------------------------------------------------------------------- /PowerShell-Installers/Get-WindowsLiveWriter2012.ps1: -------------------------------------------------------------------------------- 1 | $appName = "Windows Live Writer 2012" 2 | Write-Host "Installing $appName..." 3 | 4 | $instPath = "${env:ProgramFiles(x86)}\Windows Live\Writer\WindowsLiveWriter.exe" 5 | if (!(Test-Path $instPath)) 6 | { 7 | $file = "$env:TEMP\wlsetup-web.exe" 8 | if (Test-Path $file) 9 | { 10 | Write-Host "File already downloaded: $file" 11 | } 12 | else 13 | { 14 | $url = "http://go.microsoft.com/fwlink/?LinkID=255475" 15 | Write-Host "Downloading $url -> $file" 16 | $web = New-Object System.Net.WebClient 17 | $ua = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)' 18 | $web.Headers.Add('user-agent', $ua) 19 | $web.DownloadFile($url, $file) 20 | } 21 | 22 | Write-Host "Installing..." 23 | 24 | $cmd = "$file /appselect:writer /quiet" 25 | 26 | Invoke-Expression $cmd | Out-Null 27 | 28 | Write-Host "Waiting for installation to complete..." 29 | while (!(Test-Path $instPath)) 30 | { 31 | Start-Sleep -Seconds 10 32 | } 33 | 34 | Write-Host "Done!" 35 | 36 | Get-Item $file | rm -Force -ErrorAction 0 | Out-Null 37 | } 38 | else 39 | { 40 | Write-Host "$appName already installed." 41 | } 42 | -------------------------------------------------------------------------------- /PowerShell-Installers/Get-7zip.ps1: -------------------------------------------------------------------------------- 1 | Write-Host "Installing 7-Zip ..." 2 | $instPath = "$env:ProgramFiles\7-Zip\7z.exe" 3 | if (!(Test-Path $instPath)) 4 | { 5 | Write-Host "Determining download URL ..." 6 | $web = New-Object System.Net.WebClient 7 | $page = $web.DownloadString("http://www.7-zip.org/download.html") 8 | 9 | $64bit = '' 10 | 11 | if ($env:PROCESSOR_ARCHITECTURE -match '64') 12 | { 13 | $64bit = 'x64' 14 | } 15 | 16 | $pattern = "(http://.*?${64bit}\.msi)" 17 | $url = $page | Select-String -Pattern $pattern | Select-Object -ExpandProperty Matches -First 1 | foreach { $_.Value } 18 | 19 | $file = "$env:TEMP\7z.msi" 20 | if (Test-Path $file) 21 | { 22 | rm $file | Out-Null 23 | } 24 | 25 | Write-Host "Downloading $url -> $file" 26 | 27 | $web.DownloadFile($url, $file) 28 | 29 | Write-Host "Installing..." 30 | Write-Host "(Note: please approve the User Account Control (UAC) popup if necessary...)" 31 | 32 | $cmd = "$file /passive" 33 | 34 | Invoke-Expression $cmd | Out-Null 35 | 36 | while (!(Test-Path $instPath)) 37 | { 38 | Start-Sleep -Seconds 10 39 | } 40 | 41 | Write-Host "Done!" 42 | } 43 | else 44 | { 45 | Write-Host "7-Zip already installed." 46 | } 47 | -------------------------------------------------------------------------------- /Prototypes/Progress/Progress.psm1: -------------------------------------------------------------------------------- 1 | $script:title = "Progress" 2 | $script:totalSteps = 0 3 | 4 | function Init { 5 | param([string]$activity = "Progress") 6 | $script:title = $activity 7 | $script:totalSteps = 0 8 | } 9 | 10 | function Step { 11 | param([string]$status) 12 | $position = $script:totalSteps 13 | $script:totalSteps += 1 14 | 15 | [Func[int]]$getTotal = { return $script:totalSteps } 16 | $s = New-Module -ArgumentList $script:title,$status,$position,$getTotal -ScriptBlock { 17 | $activity = $args[0] 18 | $status = $args[1] 19 | $position = $args[2] 20 | $getTotal = $args[3] 21 | 22 | function Set { 23 | $total = $getTotal.Invoke() 24 | $pos = $position + 1 25 | Write-Host "Step $pos of ${total}: $status" -ForegroundColor Green -BackgroundColor Black 26 | $p = $position / $total * 100 27 | Write-Progress -Activity $script:activity -status $status -percentComplete $p 28 | } 29 | 30 | Export-ModuleMember -Function Set 31 | } -AsCustomObject 32 | 33 | return $s 34 | } 35 | 36 | function Done { 37 | param([string]$status = "Done") 38 | Write-Progress -Activity $script:title -status $status -percentComplete 100 39 | } 40 | 41 | Export-ModuleMember -Function Init, Step, Done 42 | -------------------------------------------------------------------------------- /PowerShell-Installers/Get-Python27.ps1: -------------------------------------------------------------------------------- 1 | $c = (new-object net.webclient) 2 | 3 | if (!(Test-Path "c:\Python27\python.exe")) { 4 | Write-Host "Installing Python..." 5 | $u = 'http://python.org' 6 | $c.DownloadString($u+'/download/') -match 'href=.(.*?python-2.*?msi)' | Out-Null 7 | $path = $matches[1] 8 | $url = $u + $path 9 | 10 | $path -match '\/([^/]*)$' | Out-Null 11 | $filename = $matches[1] 12 | $output = Join-Path $env:Temp $filename 13 | 14 | Write-Host "Downloading" 15 | Write-Host "from: $url" 16 | Write-Host " to: $output" 17 | 18 | $c.DownloadFile($url, $output) 19 | 20 | Start-Process 'msiexec' @('/i', $output, '/passive', '/norestart') -Wait 21 | 22 | $env:Path += ';c:\Python27;c:\Python27\Scripts' 23 | } 24 | 25 | if (!(Test-Path "c:\Python27\Scripts\pip.exe")) { 26 | Write-Host "Installing easy_install, pip and virtualenv..." 27 | $c.DownloadFile('https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py', "$env:Temp\ez_setup.py") 28 | $c.DownloadFile('https://raw.github.com/pypa/pip/master/contrib/get-pip.py', "$env:Temp\get-pip.py") 29 | Start-Process 'C:\Python27\python.exe' @("$env:Temp\ez_setup.py") -Wait 30 | Start-Process 'C:\Python27\python.exe' @("$env:Temp\get-pip.py") -Wait 31 | Start-Process 'C:\Python27\Scripts\easy_install' @('install', 'virtualenv') -Wait 32 | Start-Process 'C:\Python27\Scripts\pip' @('install', 'git-up') -Wait 33 | } 34 | -------------------------------------------------------------------------------- /Batch/get-graphviz.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | REM Lots of Python lib binaries here: http://www.lfd.uci.edu/~gohlke/pythonlibs/ 4 | 5 | set gvhome=%programfiles(x86)%\Graphviz 2.28 6 | if exist "%gvhome%" goto gvdone 7 | call cinst Graphviz 8 | reg add HKLM\SOFTWARE\ATT\Graphviz /v InstallPath /t REG_SZ /d "%gvhome%" /f 9 | setx PATH "%PATH%;C:\Program Files (x86)\Graphviz 2.28\bin" /m 10 | :gvdone 11 | 12 | C:\python27\scripts\easy_install pydot 13 | 14 | rem C: 15 | rem cd %temp% 16 | rem curl -O http://garr.dl.sourceforge.net/project/numpy/NumPy/1.8.0/numpy-1.8.0-win32-superpack-python2.7.exe 17 | rem curl -O http://freefr.dl.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.3.1/matplotlib-1.3.1.win32-py2.7.exe 18 | 19 | set pywin32=%userprofile%\Downloads\pywin32-218.4.win32-py2.7.exe 20 | if not exist "%pywin32%" goto nopywin32 21 | if exist "%temp%\pywin32\SCRIPTS\pywin32_postinstall.py" goto pywin32avail 22 | call 7za x -o%temp%\pywin32 %pywin32% 23 | :pywin32avail 24 | xcopy %temp%\pywin32\SCRIPTS\*.* C:\python27\python\Scripts\ /y /d /s 25 | xcopy %temp%\pywin32\PLATLIB\*.* C:\python27\python\Lib\site-packages\ /y /d /s 26 | rd %temp%\pywin32 /s /q 27 | 28 | C: 29 | cd C:\python27 30 | python Scripts\pywin32_postinstall.py -install 31 | 32 | goto :eof 33 | 34 | :nopywin32 35 | echo Manually get pywin32-218.4.win32-py2.7.exe from: 36 | echo http://www.lfd.uci.edu/~gohlke/pythonlibs/ 37 | goto :eof 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /PowerShell-Installers/Get-CmdColor.ps1: -------------------------------------------------------------------------------- 1 | param ( 2 | [string]$target 3 | ) 4 | $scriptDir = $MyInvocation.MyCommand.Path 5 | if ($scriptDir) { 6 | $scriptDir = Split-Path $scriptDir 7 | } 8 | else { 9 | $scriptDir = $pwd 10 | } 11 | if (!$target) { 12 | $target = Join-Path $scriptDir "cmdcolor.exe" 13 | } 14 | 15 | if (!(Test-Path $target)) { 16 | $vc = "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin" 17 | $vcvars = "$vc\vcvars32.bat" 18 | if (!(Test-Path $vcvars)) { 19 | Write-Error "Can't find C++ compiler!" 20 | } 21 | else { 22 | Write-Host "Compiling cmdcolor..." 23 | $c = New-Object Net.WebClient 24 | $c.DownloadFile('https://raw.githubusercontent.com/jeremejevs/cmdcolor/master/cmdcolor.cpp', "$env:Temp\cmdcolor.cpp") 25 | $c.DownloadFile('https://raw.githubusercontent.com/jeremejevs/cmdcolor/master/build.bat', "$env:Temp\build.bat") 26 | Push-Location 27 | 28 | Set-Location $env:Temp 29 | 30 | [System.IO.File]::WriteAllText("$env:Temp\upx.cmd", "@echo off`necho Dummy UPX") 31 | 32 | if (!($env:Path -match '.VC.bin')) { 33 | Write-host updating path 34 | $env:Path += ";$vc" 35 | } 36 | 37 | & "$env:Temp\build.bat" 38 | 39 | Write-Host "Saving $target..." 40 | Copy-Item "$env:Temp\bin\tmp.exe" $target 41 | 42 | Pop-Location 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /PowerShell-Installers/Get-DotNetFramework451.ps1: -------------------------------------------------------------------------------- 1 | # Microsoft .NET 4.5.1 2 | # See: http://www.microsoft.com/en-us/download/details.aspx?id=40779 3 | 4 | function Invoke-Admin() { 5 | param ([string]$program, [string]$argumentString, [switch]$waitForExit) 6 | $psi = new-object "Diagnostics.ProcessStartInfo" 7 | $psi.FileName = $program 8 | $psi.Arguments = $argumentString 9 | $psi.Verb = "runas" 10 | $proc = [Diagnostics.Process]::Start($psi) 11 | if ($waitForExit) { 12 | $proc.WaitForExit() 13 | } 14 | } 15 | 16 | $ver = (get-itemproperty "HKLM:\Software\Microsoft\NET Framework Setup\NDP\v4\Full" -ErrorAction SilentlyContinue).Version 17 | if ($ver -match '4\.5') { 18 | Write-Host ".NET 4.5 already installed..." 19 | return 20 | } 21 | 22 | $file = 'NDP451-KB2858728-x86-x64-AllOS-ENU.exe' 23 | $url = "http://download.microsoft.com/download/1/6/7/167F0D79-9317-48AE-AEDB-17120579F8E2/$file" 24 | $output = Join-Path $env:Temp $file 25 | 26 | $exists = $false 27 | if (Test-Path $output) { 28 | $size = Get-Item $output | Select-Object -ExpandProperty Length 29 | if ($size -gt 60mb) { 30 | $exists = $true 31 | } 32 | } 33 | if ($exists) { 34 | Write-Host "Already exists: $output" 35 | } 36 | else { 37 | Write-Host "Downloading $output ..." 38 | $c = New-Object System.Net.WebClient 39 | $c.DownloadFile($url, $output) 40 | } 41 | 42 | Invoke-Admin $output '/q /norestart' $true 43 | 44 | -------------------------------------------------------------------------------- /PowerShell-Installers/Get-ExamDiffPro.ps1: -------------------------------------------------------------------------------- 1 | Write-Host "Installing ExamDiff Pro ..." 2 | 3 | $instPath = "$env:ProgramFiles\ExamDiff Pro\ExamDiff.exe" 4 | if (!(Test-Path $instPath)) 5 | { 6 | Write-Host "Determining download URL ..." 7 | $web = New-Object System.Net.WebClient 8 | $ua = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)' 9 | $web.Headers.Add('user-agent', $ua) 10 | 11 | $page = $web.DownloadString("http://www.prestosoft.com/edp_download.asp") 12 | 13 | $bits = '32' 14 | if ($env:PROCESSOR_ARCHITECTURE -match '64') 15 | { 16 | $bits = '64' 17 | } 18 | 19 | $pattern = "file=(.*?${bits}.*?\.exe)" 20 | $url = $page | Select-String -Pattern $pattern | Select-Object -ExpandProperty Matches -First 1 | foreach { $_.Groups[1].Value } 21 | $url = "http://www.prestosoft.com/download/$url" 22 | 23 | $file = "$env:TEMP\edpro.exe" 24 | if (Test-Path $file) 25 | { 26 | Get-Item $file | rm -Force -ErrorAction 0 | Out-Null 27 | } 28 | 29 | Write-Host "Downloading $url -> $file ..." 30 | 31 | $web.DownloadFile($url, $file) 32 | 33 | Write-Host "Installing..." 34 | 35 | $cmd = "$file /silent" 36 | 37 | Invoke-Expression $cmd | Out-Null 38 | 39 | while (!(Test-Path $instPath)) 40 | { 41 | Start-Sleep -Seconds 10 42 | } 43 | 44 | Write-Host "Done!" 45 | } 46 | else 47 | { 48 | Write-Host "ExamDiff Pro already installed." 49 | } 50 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # My batch files, PowerShell scripts, etc. 2 | 3 | These are scripts I use to repave my clean Windows installation. 4 | 5 | I use the `Repave-Win8\Install-Tools-Chocolatey.cmd` batch file to install my favourite tools on a clean Windows 8 installation. This uses [NuGet Chocolatey](http://chocolatey.org) to install a few utilities from my [MyGet feed](http://www.myget.org/feed/Index/win8repavechocolatey). 6 | 7 | `Repave-Win8\Install-Tools-Custom.cmd` performs a few settings changes and installs a few more tools with custom PowerShell scripts. 8 | 9 | ### Related links 10 | 11 | * [Chocolatey](http://chocolatey.org/) by @ferventcoder 12 | * [Repaving your PC the easier way](http://blog.maartenballiauw.be/post/2011/11/28/Repaving-your-PC-the-easier-way.aspx) by @maartenballiauw 13 | * [Mastering my machine repaves with Git and PowerShell](http://www.peterprovost.org/blog/2012/04/20/mastering-my-machine-repaves-with-git-and-powershell/) by @pprovost 14 | * [WebPICmd](http://learn.iis.net/page.aspx/1072/web-platform-installer-v4-command-line-webpicmdexe-preview-release/) - Microsoft Web Platform Installer 15 | * [Ninite](http://www.ninite.com/) - Package several installs together into a single .EXE 16 | * See how to install several software packages silently [here at wpkg.org](http://wpkg.org/Category:Silent_Installers) (shows the command-line arguments to use for silent install etc) 17 | * [Unattended, A Windows deployment system](http://unattended.sourceforge.net/installers.php) - Also shows the command-line arguments for silent/unattended install for various common installer systems, and examples -------------------------------------------------------------------------------- /AngularJS-Dev-Setup/functions/Install-PoshMonokai.ps1: -------------------------------------------------------------------------------- 1 | # This scripts loads the cool posh-monokai.ps1 script from github.com/ntwb and 2 | # runs it in each of the HKCU:\Console register sub-keys. 3 | 4 | function Get-MonokaiScript { 5 | Write-Host "Downloading posh-monokai.ps1 ..." -ForegroundColor Green 6 | $client = New-Object System.Net.WebClient 7 | $monokai = $client.DownloadString('https://github.com/ntwb/posh-monokai/raw/master/posh-monokai.ps1') 8 | return $monokai 9 | } 10 | 11 | function Set-MonokaiConsoleRegistry { 12 | param ( 13 | [string]$registryKey, 14 | [string]$monokaiScript 15 | ) 16 | 17 | write-host "`nUpdating: $registryKey ..." -ForegroundColor Green 18 | 19 | $script = $monokaiScript.Replace(".\Windows PowerShell", $registryKey) 20 | iex $script 21 | } 22 | 23 | function Install-PoshMonokai { 24 | $monokaiScript = Get-MonokaiScript 25 | 26 | Push-Location 27 | Set-Location HKCU:\Console 28 | 29 | if (!(Test-Path ".\Windows PowerShell")) { 30 | New-Item ".\Windows PowerShell" 31 | } 32 | 33 | $keys = dir | Resolve-Path -Relative 34 | #$keys += "." # TODO: I'm not sure if this one is necessary... 35 | #$keys += ".\Windows PowerShell" # TODO: not sure about this one either... 36 | $keys | % { Set-MonokaiConsoleRegistry $_ $monokaiScript } 37 | 38 | Pop-Location 39 | 40 | $Host.PrivateData.DebugBackgroundColor = "DarkGray" 41 | $Host.PrivateData.ErrorBackgroundColor = "DarkGray" 42 | 43 | Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont" -Name 000 -Type String -Value "Source Code Pro" -ErrorAction SilentlyContinue 44 | if (!$?) { 45 | Write-Host "`nWarning: couldn't set 'Source Code Pro' as console font in the Registry." -ForegroundColor Yellow 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Batch/get-python27.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | 4 | if exist "c:\Python27\python.exe" goto alreayInstalled 5 | 6 | where curl 7 | if errorlevel 1 ( 8 | where cinst 9 | if errorlevel 1 powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin 10 | cinst curl 11 | ) 12 | 13 | REM Determine Python 2.7 download url: 14 | for /f "usebackq" %%a in (`powershell -NoProfile -ExecutionPolicy unrestricted -Command "$u='http://python.org';(new-object net.webclient).DownloadString($u+'/download/') -match 'href=.(.*?python-2.*?msi)'|Out-Null;$u+$matches[1]"`) do set url=%%a 15 | 16 | REM Extract the filename from the url: 17 | for /f "tokens=6 delims=/" %%a in ("%url%") do set filename=%%a 18 | set output=%temp%\%filename% 19 | echo Downloadinging Python 20 | echo from: %url% 21 | echo to: %output% 22 | echo. 23 | 24 | if exist "%output%" ( 25 | echo %filename% already exists! 26 | goto startInstall 27 | ) 28 | curl -o%output% %url% 29 | 30 | :startInstall 31 | echo Installing... 32 | echo. 33 | 34 | start /wait msiexec /i %output% /passive /norestart /log %temp%\python-install.log 35 | set PATH=%PATH%;C:\Python27 36 | set PATH=%PATH%;C:\Python27\Scripts 37 | setx PATH "%PATH%" /m 38 | 39 | echo Installing easy_install and virtualenv... 40 | echo. 41 | call curl -k -o%temp%\ez_setup.py https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py 42 | call curl -k -o%temp%\get-pip.py https://raw.github.com/pypa/pip/master/contrib/get-pip.py 43 | call C:\Python27\python %temp%\ez_setup.py 44 | call C:\Python27\python %temp%\get-pip.py 45 | call C:\Python27\Scripts\easy_install virtualenv 46 | call C:\Python27\Scripts\easy_install yolk 47 | c: 48 | cd C:\Python27\Scripts 49 | yolk --list 50 | goto :eof 51 | 52 | :alreayInstalled 53 | echo Python27 already installed. 54 | goto :eof 55 | -------------------------------------------------------------------------------- /Code Snippets/Visual C#/My Code Snippets/builder.snippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | Build() and implicit operator 6 | builder 7 | Build() and implicit operator 8 | Gert 9 | 10 | Expansion 11 | 12 |
13 | 14 | 15 | 16 | class 17 | Class name 18 | Foo 19 | 20 | 21 | dependency 22 | Dependency interface 23 | IService 24 | 25 | 26 | (); 33 | With(mock.GetMockedObject()); 34 | } 35 | 36 | public $class$ Build() 37 | { 38 | Contract.Ensures(Contract.Result<$class$>() != null); 39 | var result = new $class$($end$); 40 | return result; 41 | } 42 | 43 | public static implicit operator $class$($class$Builder builder) 44 | { 45 | return builder.Build(); 46 | } 47 | 48 | public $class$Builder With($dependency$ value) 49 | { 50 | Contract.Requires(value != null); 51 | _value = value; 52 | return this; 53 | } 54 | 55 | [ContractInvariantMethod] 56 | private void ObjectInvariant() 57 | { 58 | Contract.Invariant(_value != null); 59 | } 60 | }]]> 61 | 62 | 63 |
64 |
-------------------------------------------------------------------------------- /PowerShell-Installers/Get-GitHubForWindows.ps1: -------------------------------------------------------------------------------- 1 | Write-Host "Installing GitHub for Windows ..." 2 | 3 | function Test-Key([string]$path, [string]$key) 4 | { 5 | if (!(Test-Path $path)) 6 | { 7 | return $false 8 | } 9 | if ((Get-ItemProperty $path).$key -eq $null) 10 | { 11 | return $false 12 | } 13 | return $true 14 | } 15 | 16 | # see: http://blog.smoothfriction.nl/archive/2011/01/18/powershell-detecting-installed-net-versions.aspx 17 | function Test-DotNet4Installed 18 | { 19 | return Test-Key "HKLM:\Software\Microsoft\NET Framework Setup\NDP\v4\Full" "Install" 20 | } 21 | 22 | $instPath = "$env:LOCALAPPDATA\GitHub" 23 | if (!(Test-Path $instPath)) 24 | { 25 | $file = "$env:TEMP\GitHubSetup.exe" 26 | if (Test-Path $file) 27 | { 28 | Write-Host "File already downloaded: $file" 29 | } 30 | else 31 | { 32 | $url = "http://github-windows.s3.amazonaws.com/GitHubSetup.exe" 33 | Write-Host "Downloading $url -> $file" 34 | $web = New-Object System.Net.WebClient 35 | $ua = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)' 36 | $web.Headers.Add('user-agent', $ua) 37 | $web.DownloadFile($url, $file) 38 | } 39 | 40 | Write-Host "Installing..." 41 | 42 | $cmd = "$file /q" 43 | 44 | Invoke-Expression $cmd | Out-Null 45 | 46 | if (!(Test-DotNet4Installed)) 47 | { 48 | Write-Host 49 | Write-Host ".NET Framework 4 Full is not installed." 50 | Write-Host "Please accept the EULA to install the .NET Framework 4..." 51 | Write-Host 52 | while (!(Test-DotNet4Installed)) 53 | { 54 | Start-Sleep -Seconds 10 55 | } 56 | } 57 | 58 | Write-Host "Waiting for installation to complete..." 59 | while (!(Test-Path $instPath)) 60 | { 61 | Start-Sleep -Seconds 10 62 | } 63 | 64 | Write-Host "Done!" 65 | 66 | Get-Item $file | rm -Force -ErrorAction 0 | Out-Null 67 | } 68 | else 69 | { 70 | Write-Host "GitHub for Windows already installed." 71 | } 72 | -------------------------------------------------------------------------------- /PowerShell-Installers/Get-LastPass.ps1: -------------------------------------------------------------------------------- 1 | Write-Host "Installing LastPass..." 2 | 3 | function Download-LastPass 4 | { 5 | param ([string]$file) 6 | 7 | if (Test-Path $file) 8 | { 9 | Write-Host "File already exists: $file" 10 | } 11 | else 12 | { 13 | $url = "http://download.lastpass.com/lastpass.exe" 14 | Write-Host "Downloading $url -> $file ..." 15 | $web = New-Object Net.WebClient 16 | $web.DownloadFile($url, $file) 17 | } 18 | } 19 | 20 | # see: http://stackoverflow.com/questions/1566969/showing-the-uac-prompt-in-powershell-if-the-action-requires-elevation 21 | function Invoke-Admin() { 22 | param ( [string]$program = $(throw "Please specify a program" ), 23 | [string]$argumentString = "", 24 | [switch]$waitForExit ) 25 | 26 | $psi = new-object "Diagnostics.ProcessStartInfo" 27 | $psi.FileName = $program 28 | $psi.Arguments = $argumentString 29 | $psi.Verb = "runas" 30 | $proc = [Diagnostics.Process]::Start($psi) 31 | if ( $waitForExit ) { 32 | $proc.WaitForExit(); 33 | } 34 | } 35 | 36 | function Install-LastPass 37 | { 38 | param ([string]$file, [string]$instPath) 39 | 40 | Write-Host "Installing $file..." 41 | $args = "--elevate --userinstallie -userinstallff --installdir=""$env:ProgramFiles\LastPass""" 42 | 43 | Invoke-Admin $file $args $true 44 | 45 | while (!(Test-Path $instPath)) 46 | { 47 | Write-Host "Waiting..." 48 | Start-Sleep -Seconds 10 49 | } 50 | 51 | Write-Host "Done!" 52 | } 53 | 54 | function Check-Administrator 55 | { 56 | return (([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) 57 | } 58 | 59 | $instPath = "$env:ProgramFiles\LastPass\lastpass.exe" 60 | 61 | if (Test-Path $instPath) 62 | { 63 | Write-Host "LastPass already installed." 64 | } 65 | else 66 | { 67 | if (-not (Check-Administrator)) 68 | { 69 | Write-Host "Attempting to run as administrator ..." 70 | } 71 | 72 | $inst = "$env:TEMP\lastpass.exe" 73 | Download-LastPass $inst 74 | Install-LastPass $inst $instPath 75 | } 76 | -------------------------------------------------------------------------------- /PowerShell-Installers/Get-Posh-Monokai.ps1: -------------------------------------------------------------------------------- 1 | # This scripts loads the cool posh-monokai.ps1 script from github.com/ntwb and 2 | # runs it in each of the HKCU:\Console register sub-keys. 3 | 4 | function Get-MonokaiScript() { 5 | Write-Host "Downloading posh-monokai.ps1 ..." -ForegroundColor Green 6 | $client = New-Object System.Net.WebClient 7 | $monokai = $client.DownloadString('https://github.com/ntwb/posh-monokai/raw/master/posh-monokai.ps1') 8 | return $monokai 9 | } 10 | 11 | function Set-MonokaiConsoleRegistry() { 12 | param ( 13 | [string]$registryKey, 14 | [string]$monokaiScript 15 | ) 16 | 17 | write-host "`nUpdating: $registryKey ..." -ForegroundColor Green 18 | 19 | $script = $monokaiScript.Replace(".\Windows PowerShell", $registryKey) 20 | iex $script 21 | } 22 | 23 | function Get-ChocolateyInstall() { 24 | if (!(Test-Path $env:SystemDrive\Chocolatey\chocolateyinstall\chocolatey.ps1)) { 25 | Write-Host "Installing Chocolatey ..." 26 | Set-ExecutionPolicy Unrestricted 27 | iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) 28 | } 29 | } 30 | 31 | function Get-SourceCodePro() { 32 | if (!(Test-Path $env:SystemRoot\Fonts\SourceCodePro-Black.*)) { 33 | Get-ChocolateyInstall 34 | Set-ExecutionPolicy Unrestricted 35 | . $env:SystemDrive\Chocolatey\chocolateyinstall\chocolatey.ps1 install SourceCodePro 36 | # TODO: Chocolatey installs the OTP fonts only, I think we need the TTF versions... 37 | } 38 | } 39 | 40 | $monokaiScript = Get-MonokaiScript 41 | 42 | Push-Location 43 | Set-Location HKCU:\Console 44 | 45 | if (!(Test-Path ".\Windows PowerShell")) { 46 | New-Item ".\Windows PowerShell" 47 | } 48 | 49 | $keys = dir | Resolve-Path -Relative 50 | $keys += "." # TODO: I'm not sure if this one is necessary... 51 | $keys += ".\Windows PowerShell" # TODO: not sure about this one either... 52 | $keys | % { Set-MonokaiConsoleRegistry $_ $monokaiScript } 53 | Pop-Location 54 | 55 | $Host.PrivateData.DebugBackgroundColor = "DarkGray" 56 | $Host.PrivateData.ErrorBackgroundColor = "DarkGray" 57 | 58 | Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont" -Name 000 -Type String -Value "Source Code Pro" -ErrorAction SilentlyContinue 59 | if (!$?) { 60 | Write-Host "`nWarning: couldn't set 'Source Code Pro' as console font in the Registry." -ForegroundColor Yellow 61 | } 62 | 63 | Get-SourceCodePro 64 | 65 | # TODO: this seems to work for Git Shell but not the standard PowerShell prompt... 66 | -------------------------------------------------------------------------------- /PowerShell-Installers/Get-PowerShell-WinXP.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | REM This installs .NET 2.0 SP2 and PowerShell on Windows XP SP3. (hello@gertlombard.com) 3 | setlocal 4 | 5 | if exist C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe goto psinstalled 6 | 7 | echo Downloading 7za.exe and cURL... 8 | set curl=%temp%\curl-7.19.3\curl.exe 9 | set pssetup=%temp%\WindowsXP-KB968930-x86-ENG.exe 10 | if not exist "%temp%\7za.exe" call :ftpget ftp.cadwork.ch /DVD_V17/CADWORK.DIR/COM/ 7za.exe 11 | if not exist "%curl%" call :ftpget ftp.gr.freebsd.org /pub/net/ftp/curl/ curl-7.19.3-win32-nossl.zip 12 | if not exist "%curl%" "%temp%\7za" x -y -o"%temp%\" curl-7.19.3-win32-nossl.zip 13 | if not exist "%pssetup%" "%curl%" -o"%pssetup%" http://download.microsoft.com/download/E/C/E/ECE99583-2003-455D-B681-68DB610B44A4/WindowsXP-KB968930-x86-ENG.exe 14 | if not exist "%pssetup%" goto downloadError 15 | 16 | if exist C:\windows\Microsoft.NET\Framework\v2.0.50727\System.dll goto dotNetInstalled 17 | "%curl%" -o"%temp%\NetFx20SP2_x86.exe" http://download.microsoft.com/download/c/6/e/c6e88215-0178-4c6c-b5f3-158ff77b1f38/NetFx20SP2_x86.exe 18 | start /wait "Installing .NET" "%temp%\NetFx20SP2_x86.exe" /qb 19 | set tries= 20 | :dotNetCheck 21 | if exist C:\windows\Microsoft.NET\Framework\v2.0.50727\System.dll goto dotNetDone 22 | set tries=%tries%. 23 | if "%tries%"=="...." goto dotNetError 24 | ping 1.1.1.1 -n 1 -w 5000>nul 25 | goto dotNetCheck 26 | :dotNetDone 27 | echo .NET 2.0 installed. 28 | :dotNetInstalled 29 | 30 | echo Starting PowerShell install... 31 | start /wait "Installing PowerShell" "%pssetup%" /passive /log:"%temp%\powershell-install.log" 32 | set tries= 33 | :checkInstalled 34 | if exist C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe goto psinstalled 35 | set tries=%tries%. 36 | if "%tries%"=="...." goto installError 37 | ping 1.1.1.1 -n 1 -w 3000>nul 38 | goto checkInstalled 39 | 40 | :psinstalled 41 | echo PowerShell installed. 42 | goto :eof 43 | 44 | :dotNetError 45 | echo Error: Couldn't download .NET Framework! 46 | goto :eof 47 | 48 | :installError 49 | echo Error: I'm not sure if the install worked! 50 | goto :eof 51 | 52 | :downloadError 53 | echo Couldn't download the PowerShell installer to: 54 | echo %pssetup% 55 | goto :eof 56 | 57 | :ftpget 58 | set ftpscript=%temp%\ftp.txt 59 | echo open %1>%ftpscript% 60 | echo user>>%ftpscript% 61 | echo anonymous>>%ftpscript% 62 | echo.>>%ftpscript% 63 | echo cd %2>>%ftpscript% 64 | echo bin>>%ftpscript% 65 | echo hash>>%ftpscript% 66 | echo lcd %temp%>>%ftpscript% 67 | echo get %3>>%ftpscript% 68 | echo bye>>%ftpscript% 69 | ftp -i -n -s:%temp%\ftp.txt 70 | goto :eof 71 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Eclipse 3 | ################# 4 | 5 | *.pydevproject 6 | .project 7 | .metadata 8 | bin/ 9 | tmp/ 10 | *.tmp 11 | *.bak 12 | *.swp 13 | *~.nib 14 | local.properties 15 | .classpath 16 | .settings/ 17 | .loadpath 18 | 19 | # External tool builders 20 | .externalToolBuilders/ 21 | 22 | # Locally stored "Eclipse launch configurations" 23 | *.launch 24 | 25 | # CDT-specific 26 | .cproject 27 | 28 | # PDT-specific 29 | .buildpath 30 | 31 | 32 | ################# 33 | ## Visual Studio 34 | ################# 35 | 36 | ## Ignore Visual Studio temporary files, build results, and 37 | ## files generated by popular Visual Studio add-ons. 38 | 39 | # User-specific files 40 | *.suo 41 | *.user 42 | *.sln.docstates 43 | 44 | # Build results 45 | [Dd]ebug/ 46 | [Rr]elease/ 47 | *_i.c 48 | *_p.c 49 | *.ilk 50 | *.meta 51 | *.obj 52 | *.pch 53 | *.pdb 54 | *.pgc 55 | *.pgd 56 | *.rsp 57 | *.sbr 58 | *.tlb 59 | *.tli 60 | *.tlh 61 | *.tmp 62 | *.vspscc 63 | .builds 64 | *.dotCover 65 | 66 | ## TODO: If you have NuGet Package Restore enabled, uncomment this 67 | #packages/ 68 | 69 | # Visual C++ cache files 70 | ipch/ 71 | *.aps 72 | *.ncb 73 | *.opensdf 74 | *.sdf 75 | 76 | # Visual Studio profiler 77 | *.psess 78 | *.vsp 79 | 80 | # ReSharper is a .NET coding add-in 81 | _ReSharper* 82 | 83 | # Installshield output folder 84 | [Ee]xpress 85 | 86 | # DocProject is a documentation generator add-in 87 | DocProject/buildhelp/ 88 | DocProject/Help/*.HxT 89 | DocProject/Help/*.HxC 90 | DocProject/Help/*.hhc 91 | DocProject/Help/*.hhk 92 | DocProject/Help/*.hhp 93 | DocProject/Help/Html2 94 | DocProject/Help/html 95 | 96 | # Click-Once directory 97 | publish 98 | 99 | # Others 100 | [Bb]in 101 | [Oo]bj 102 | sql 103 | TestResults 104 | *.Cache 105 | ClientBin 106 | stylecop.* 107 | ~$* 108 | *.dbmdl 109 | Generated_Code #added for RIA/Silverlight projects 110 | 111 | # Backup & report files from converting an old project file to a newer 112 | # Visual Studio version. Backup files are not needed, because we have git ;-) 113 | _UpgradeReport_Files/ 114 | Backup*/ 115 | UpgradeLog*.XML 116 | 117 | 118 | 119 | ############ 120 | ## Windows 121 | ############ 122 | 123 | # Windows image file caches 124 | Thumbs.db 125 | 126 | # Folder config file 127 | Desktop.ini 128 | 129 | 130 | ############# 131 | ## Python 132 | ############# 133 | 134 | *.py[co] 135 | 136 | # Packages 137 | *.egg 138 | *.egg-info 139 | dist 140 | build 141 | eggs 142 | parts 143 | bin 144 | var 145 | sdist 146 | develop-eggs 147 | .installed.cfg 148 | 149 | # Installer logs 150 | pip-log.txt 151 | 152 | # Unit test / coverage reports 153 | .coverage 154 | .tox 155 | 156 | #Translations 157 | *.mo 158 | 159 | #Mr Developer 160 | .mr.developer.cfg 161 | 162 | # Mac crap 163 | .DS_Store 164 | -------------------------------------------------------------------------------- /AngularJS-Dev-Setup/angular.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Prepare a Windows 8 development machine for AngularJS development: 3 | # 4 | # run: http://boxstarter.org/package/nr/url?http://myurl/box/angular.txt 5 | # 6 | 7 | $scriptPath = Split-Path -parent $MyInvocation.MyCommand.Definition 8 | function Install-ChocolateyPackages { 9 | Write-Host "Installing Chocolatey packages..." 10 | 11 | $packages = @( 12 | 'pscx', 13 | '7zip.commandline', 14 | 'curl', 15 | 'git', 16 | 'poshgit', 17 | 'git-credential-winstore', 18 | 'SourceTree', 19 | 'python', 20 | 'libjpeg-turbo', 21 | 'OptiPNG', 22 | 'PhantomJS', 23 | 'nodejs.install' 24 | #'stylecop', 25 | #'markdownpad2', 26 | #'PowerGUI', 27 | ) 28 | $packages | foreach { cinst $_ } 29 | } 30 | function Install-NodePackages { 31 | Write-Host "Installing Global NodeJS packages..." 32 | 33 | if (!($env:Path -match "nodejs")) { 34 | $env:Path += ";$env:ProgramFiles\nodejs" 35 | } 36 | 37 | function Install-NodePackagesGlobal { 38 | param ([array]$packages) 39 | $packages | % { 40 | & "npm.cmd" "install" "-g" $_ 41 | } 42 | } 43 | 44 | # Some node packages need VS2012 or VS2013 to build... 45 | # See: https://www.npmjs.org/package/node-gyp 46 | $vsVersion = "2012" 47 | if (Test-Path HKLM:\Software\Microsoft\VisualStudio\12.0) { 48 | $vsVersion = "2013" 49 | } 50 | npm.cmd config set msvs_version $vsVersion 51 | 52 | Install-NodePackagesGlobal(@( 53 | 'yo', 54 | 'grunt-cli', 55 | 'bower', 56 | 'generator-angular', 57 | 'protractor', 58 | 'karma', 59 | 'karma-jasmine', 60 | 'karma-chrome-launcher', 61 | 'karma-ie-launcher', 62 | 'karma-ng-scenario', 63 | 'typescript' 64 | )) 65 | 66 | npm cache clean 67 | 68 | # These ones below I need to confirm which are really needed: 69 | # selenium-webdriver 70 | # chromedriver 71 | # jasmine-node 72 | # selenium 73 | } 74 | # This scripts loads the cool posh-monokai.ps1 script from github.com/ntwb and 75 | # runs it in each of the HKCU:\Console register sub-keys. 76 | 77 | function Get-MonokaiScript { 78 | Write-Host "Downloading posh-monokai.ps1 ..." -ForegroundColor Green 79 | $client = New-Object System.Net.WebClient 80 | $monokai = $client.DownloadString('https://github.com/ntwb/posh-monokai/raw/master/posh-monokai.ps1') 81 | return $monokai 82 | } 83 | 84 | function Set-MonokaiConsoleRegistry { 85 | param ( 86 | [string]$registryKey, 87 | [string]$monokaiScript 88 | ) 89 | 90 | write-host "`nUpdating: $registryKey ..." -ForegroundColor Green 91 | 92 | $script = $monokaiScript.Replace(".\Windows PowerShell", $registryKey) 93 | iex $script 94 | } 95 | 96 | function Install-PoshMonokai { 97 | $monokaiScript = Get-MonokaiScript 98 | 99 | Push-Location 100 | Set-Location HKCU:\Console 101 | 102 | if (!(Test-Path ".\Windows PowerShell")) { 103 | New-Item ".\Windows PowerShell" 104 | } 105 | 106 | $keys = dir | Resolve-Path -Relative 107 | #$keys += "." # TODO: I'm not sure if this one is necessary... 108 | #$keys += ".\Windows PowerShell" # TODO: not sure about this one either... 109 | $keys | % { Set-MonokaiConsoleRegistry $_ $monokaiScript } 110 | 111 | Pop-Location 112 | 113 | $Host.PrivateData.DebugBackgroundColor = "DarkGray" 114 | $Host.PrivateData.ErrorBackgroundColor = "DarkGray" 115 | 116 | Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont" -Name 000 -Type String -Value "Source Code Pro" -ErrorAction SilentlyContinue 117 | if (!$?) { 118 | Write-Host "`nWarning: couldn't set 'Source Code Pro' as console font in the Registry." -ForegroundColor Yellow 119 | } 120 | } 121 | function Install-PythonPackages { 122 | # TODO 123 | } 124 | function Install-RubyGems { 125 | Write-Host "Installing Ruby Gems..." 126 | 127 | if (!(Test-Path C:\ruby200\bin\ruby.exe)) { 128 | cinst ruby -force 129 | } 130 | 131 | cinst compass -source ruby 132 | gem install css_parser 133 | } 134 | function Install-SublimeTextPackage { 135 | param ([string]$url, [string]$packageName) 136 | 137 | $web = New-Object System.Net.WebClient 138 | $destDir = "$env:Temp\SublimeText-Packages" 139 | 140 | New-Item -ItemType Directory -Force -Path $destDir 141 | $dest = "$destDir\$packageName.zip" 142 | $packagesDir = "$env:APPDATA\Sublime Text 3\Packages" 143 | $web.DownloadFile($url, $dest) 144 | Start-Process 7za.bat -NoNewWindow -Wait -ArgumentList "-o`"$packagesDir`"","-y","x",$dest 145 | Remove-Item "$packagesDir\packageName" -Force -Recurse -ErrorAction SilentlyContinue 146 | $path = (Resolve-Path -Path $packagesDir\$packageName*-master).ProviderPath 147 | Rename-Item -Force -Path $path -NewName "$packagesDir\$packageName" 148 | } 149 | 150 | function Install-SublimeTextPackages { 151 | Install-SublimeTextPackage "https://github.com/SublimeText/PowerShell/archive/master.zip" "PowerShell" 152 | Install-SublimeTextPackage "https://github.com/angular-ui/AngularJS-sublime-package/archive/master.zip" "AngularJS" 153 | 154 | # Package Control: 155 | $web = New-Object System.Net.WebClient 156 | $web.DownloadFile("https://sublime.wbond.net/Package%20Control.sublime-package", "$env:APPDATA\Sublime Text 3\Installed Packages\Package Control.sublime-package") 157 | } 158 | function Install-VisualStudio { 159 | if (Test-Path HKLM:\Software\Microsoft\VisualStudio\12.0) { 160 | Write-Host "Visual Studio 2013 found..." 161 | return 162 | } 163 | 164 | if (Test-Path HKLM:\Software\Microsoft\VisualStudio\11.0) { 165 | Write-Host "Visual Studio 2012 found..." 166 | return 167 | } 168 | 169 | # For VS2012: 170 | # cinst VisualStudio2012WDX 171 | 172 | # Download and install VS2013 Express... 173 | # http://www.microsoft.com/en-us/download/details.aspx?id=40787 174 | 175 | $dest = "$env:TEMP\VS2013_RTM_DskExp_ENU.iso" 176 | if (!(Test-Path $dest)) { 177 | Write-Host "Downloading Visual Studio 2013 Desktop Express..." 178 | curl.bat -o "$dest" http://download.microsoft.com/download/7/2/E/72E0F986-D247-4289-B9DC-C4FB07374894/VS2013_RTM_DskExp_ENU.iso 179 | } 180 | if (!(Get-DiskImage -ImagePath $dest -ErrorAction SilentlyContinue)) { 181 | Mount-DiskImage -ImagePath $dest 182 | } 183 | $drive = (Get-DiskImage -ImagePath $dest | Get-Volume).DriveLetter 184 | Write-Host "Mounted VS iso to drive $drive, now installing..." 185 | $setupFile = "$drive`:\wdexpress_full.exe" 186 | if (!(Test-Path $setupFile)) { 187 | Start-Sleep -Milliseconds 1000 188 | } 189 | if (!(Test-Path $setupFile)) { 190 | Write-Error "Can't find: $setupFile" 191 | return 192 | } 193 | Start-Process $setupFile -Wait -ArgumentList "/Passive","/NoRestart" 194 | } 195 | function Set-Env { 196 | param ([string]$name, [string]$value) 197 | [Environment]::SetEnvironmentVariable($name, $value, "Machine") 198 | } 199 | 200 | function Set-EnvironmentVariables { 201 | Set-Env "CHROME_BIN" "${env:ProgramFiles(x86)}\Google\Chrome\Application\chrome.exe" 202 | Set-Env "CHROME_CANARY_BIN" "${env:ProgramFiles(x86)}\Google\Chrome\Application\chrome.exe" 203 | Set-Env "FIREFOX_BIN" "$env:ProgramFiles\Firefox\firefox.exe" 204 | Set-Env "IE_BIN" "$env:ProgramFiles\Internet Explorer\iexplorer.exe" 205 | Set-Env "PHANTOMJS_BIN" "C:\PhantomJS\phantomjs.exe" 206 | } 207 | 208 | 209 | Install-ChocolateyPackages 210 | Install-VisualStudio 211 | Install-RubyGems 212 | Install-PythonPackages 213 | Install-NodePackages 214 | Install-PoshMonokai 215 | Install-SublimeTextPackages 216 | Set-EnvironmentVariables 217 | 218 | Write-Host "Please install manually: 219 | 220 | Visual Studio 2013 plugins: 221 | - NCrunch 222 | - ReSharper 223 | - Web Essentials 2013 224 | - Code Contracts 225 | 226 | ReSharper plugins: 227 | - NuGet Support for ReSharper 228 | - xUnit.net Test Support 229 | - AngularJS 230 | - CleanCode 231 | - TestCop 232 | 233 | " -BackgroundColor Black -ForegroundColor Magenta 234 | 235 | # in project after running 'yo angular': 236 | # bower install angular-bootstrap --save 237 | # bower install underscore 238 | # npm install karma-jasmine --save-dev 239 | # npm install karma-chrome-launcher --save-dev 240 | 241 | # Later, also see this for remote ubuntu testing: 242 | # https://github.com/exratione/protractor-selenium-server-vagrant 243 | 244 | # for e2e testing: 245 | # http://engineering.wingify.com/posts/e2e-testing-with-webdriverjs-jasmine/ 246 | --------------------------------------------------------------------------------