Instantly share code, notes, and snippets.


Getting Windows 10 on EC2 isn't difficult, but perusing the documentation can lead to confusion.

You can't mount an ISO to an empty VM the way you might do in VirtualBox, so this process requires a local copy of the VM to be created, then using the aws ec2 import-image command to create the AMI. When done, not only will the image be ready for EC2, but it will be detected as Windows by AWS and be configured such that it has many of the same AWS-specific features as other Windows AMIs provided by Amazon.

  • Create a new Windows VM using VirtualBox

    • Make sure to choose VHD as the disk image format
  • Install Windows 10 within the VirtualBox VM as normal. Note that a fresh install will format the VHD as MBR, which is the only partition format supported on AWS

  • Shut down the VM and upload the vhd file to an S3 bucket

  • Create a json file describing the VHD. This usually looks something like this: 

aws ec2 terminate-instances
aws ec2 describe-instances
| grep InstanceId
| awk {'print $2'}
| sed 's/[",]//g'
memory=$(cat /proc/meminfo | grep MemFree: | awk '{print $2}')
memory=$(echo $memory/1000 | bc)
echo memory is: $memory
aws cloudwatch put-metric-data --metric-name Memory\
--namespace WebServer\
--unit Bytes \
--value $memory\
--dimensions InstanceID=i-093beb71f2d7647ce,InstanceType=m1.small\
--region eu-west-1
View stars.html
.stars-sup {
font-size: 75%;
position: relative;
top: -6px;
left: 6px;
<ul class="used-technologies">
<li>Design UX<span class="stars-sup" data-stars="4"></span></li>
View css2json.js
//converts a css string to json
var css2json = function(str){
return str
.replace(/(\w*:)/g, '$1"') //create json format
.replace(/[;]/g, '";')
.replace(/(\'{2,})/g, '"')
.replace(/;/g, ',')
.replace(/(['"])?([a-zA-Z0-9_-]+)(['"])?:/g, '"$2": ')
View moneyformat.js
//, 2015
var thousandSeparator = ',';
var inputNumber = 234234;
var fixedLength = 2
View global-scope-finding-setting.js
"use strict";
var globalScope;
try {
globalScope = Function('return this')();
//extend else-if cases for other globalObject-names as needed...
if(this && this.hasOwnProperty && this.hasOwnProperty('window')){
globalScope = window;
View left-flexible-right-fixed.css
/*, 2015 */
.left-flexible-right-fixed .container {
height: auto;
overflow: hidden;
.left-flexible-right-fixed .left-inner{
width: 100%;
.left-flexible-right-fixed .right {
width: 180px;
View html-hex-color-name-aliases.js
var htmlColorsMap = (function(scope){
var htmlColorsMap = {};
var _colorAliases = [
'#F0F8FF aliceblue'
, '#FAEBD7 antiquewhite'
, '#00FFFF aqua'
, '#7FFFD4 aquamarine'
, '#F0FFFF azure'
, '#F5F5DC beige'
, '#FFE4C4 bisque'
View exception_handler.js
* lsauer, 2013
* Lean handler for exception reporting; stdout is set by default to console.log
* @param {exc} exc an Exception instance of Error, containing a message and stack property
* @param {exc} stdOut A variadic function for error reporting. By default: console.log
* @return undefined
var exceptionHandler = function(exc, stdOut){
var stdOut = stdOut || function() { console.log.apply(console, arguments) };
if(stdOut instanceof Function){