This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
canvas.toBlob(function(blob) { | |
var fs = require('fs'), | |
out = fs.createWriteStream(__dirname + '/chart.png'); | |
out.write(jsdom.blobToBuffer(blob)); | |
}, "image/png"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Using the node canvas module | |
var fs = require('fs'); | |
var jsdom = require("jsdom"); | |
jsdom.defaultDocumentFeatures = { | |
FetchExternalResources: ["script"], | |
ProcessExternalResources: true | |
}; | |
jsdom.env('<html><body><div id="chart-div" style="font-size:12; width:800px; height:800px;"><canvas id="myChart" width="400" height="400" style="width:400px;height:400px"></canvas>></div></body></html>', | |
['https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.2.2/Chart.js'], | |
function (err, window) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myChart = new Chart(ctx, { | |
type: 'bar', | |
data: { | |
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"], | |
datasets: [{ | |
label: '# of Votes', | |
data: [12, 19, 3, 5, 2, 3], | |
backgroundColor: [ | |
'rgba(255, 99, 132, 0.2)', | |
'rgba(54, 162, 235, 0.2)', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ chart: | |
{ config: { type: 'bar', data: [Object], options: [Object] }, | |
ctx: | |
CanvasRenderingContext2D { | |
canvas: HTMLCanvasElement {}, | |
createPattern: [Function], | |
drawImage: [Function], | |
lastFontString: 'normal 12px \'Helvetica Neue\', \'Helvetica\', \'Arial\', sans-serif', | |
lastTextAlignment: 'right', | |
lastBaseline: 'middle' }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Canvas = require('canvas') | |
, Image = Canvas.Image; | |
var fs = require('fs'); | |
var jsdom = require("jsdom"); | |
jsdom.defaultDocumentFeatures = { | |
FetchExternalResources: ["script"], | |
ProcessExternalResources: true | |
}; | |
global.Canvas = Canvas; | |
global.Image = Canvas.Image; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import uuid | |
from azure.storage import BlobService | |
def generate_vhd_footer(size): | |
# Fixed VHD Footer Format Specification | |
# spec: https://technet.microsoft.com/en-us/virtualization/bb676673.aspx#E3B | |
# Field Size (bytes) | |
# Cookie 8 | |
# Features 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Code for generating of SAS token for authorization with Service Bus | |
/// | |
/// This handy function can be found on this helpful blog post: | |
/// http://developers.de/blogs/damir_dobric/archive/2013/10/17/how-to-create-shared-access-signature-for-service-bus.aspx | |
/// </summary> | |
/// <param name="resourceUri"></param> | |
/// <param name="keyName"></param> | |
/// <param name="key"></param> | |
/// <returns></returns> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VEHICLES | |
-- | |
GET /vehicles - Returns all vehicles | |
Sample Response: | |
{ "data": [ | |
{ | |
"type": "vehicle", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generate the private key | |
openssl genrsa -des3 -out server.key 1024 | |
Generating RSA private key, 1024 bit long modulus | |
.........................................................++++++ | |
........++++++ | |
e is 65537 (0x10001) | |
Enter PEM pass phrase: | |
Verifying password - Enter PEM pass phrase: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# set the ssl cert for deis | |
deisctl config router set sslKey= sslCert= | |
# redirect all http traffic to https | |
deisctl config router set enforceHTTPS=true |
NewerOlder