Skip to content

Instantly share code, notes, and snippets.

View mpvvliet's full-sized avatar

Martin van Vliet mpvvliet

  • ANVA
  • Utrecht, Netherlands
View GitHub Profile
{
"_version": "1.0.0",
"timestamp": "2019-01-08T17:37:25.846Z[Etc/UTC]",
"nodes": [{
"_type": "ComponentTemplateFunction",
"name": "autosync-component-template",
"handlebarsTemplate": "{\n \"_type\": \"Component\",\n \"checks\": [],\n \"streams\": [],\n \"labels\": \{{#if element.data.labels\}}[\n \{{# join element.data.labels \",\" \}}\n {\n \"_type\": \"Label\",\n \"name\": \"\{{ this \}}\"\n }\n \{{/ join \}}\n ]\{{else\}}[]\{{/if\}},\n \"name\": \"\{{#if element.data.name\}}\{{ element.data.name \}}\{{else\}}\{{ element.externalId \}}\{{/if\}}\",\n\{{#if element.data.description\}}\"description\": \"\{{ element.data.description \}}\",\{{/if\}}\n \"type\" : \{{ getOrCreate \"ComponentType\" element.type.name \"Auto-synced Component\" \}},\n \"version\": \"\{{ element.data.version \}}\",\n \"layer\": \{{ getOrCreate \"Layer\" element.data.layer \"Auto-synced Components\" \}},\n \"domain\": \{{ getOrCreate \"Domain\" element.data.domain \"Auto-synced Domain\"
@mpvvliet
mpvvliet / topology.json
Created May 28, 2020 10:24
Sample topology JSON file
{
"apiKey":"API_KEY",
"collection_timestamp":1467037580.595086,
"internalHostname":"lnx-343242.srv.stackstate.com",
"events":{},
"metrics":[],
"service_checks":[],
"topologies":[
{
"start_snapshot": false,
@mpvvliet
mpvvliet / ChartJSLambda.js
Created November 5, 2018 21:54
Sample lambda demonstrating how to render an image using ChartJS
'user strict';
const debug = require('debug');
const { CanvasRenderService } = require('chartjs-node-canvas');
const fs = require('fs');
// bug workaround: https://github.com/vmpowerio/chartjs-node/issues/26
if (global.CanvasGradient === undefined) {
global.CanvasGradient = function() {};
}
@mpvvliet
mpvvliet / WriteFileToS3.js
Last active November 2, 2018 21:21
Code snippet showing how to store a rendered image from ChartJS node library in an S3 bucket.
const aws = require('aws-sdk');
const s3 = new aws.S3();
async function storeImage(buffer) {
const imageFileName = "image.png";
const object = {
Bucket: BUCKET_NAME,
Key: imageFileName,
ACL: "public-read",
Body: buffer

Keybase proof

I hereby claim:

  • I am mpvvliet on github.
  • I am mpvvliet (https://keybase.io/mpvvliet) on keybase.
  • I have a public key ASCkH_1yxNiDANMb1SsH7Hrql_45809tWHcqFZs26sYDiAo

To claim this, I am signing this object:

@mpvvliet
mpvvliet / day7.pl
Created December 21, 2015 19:45
AdventOfCode - day 7
#!/usr/bin/perl
%wires = ();
while (<>) {
if (/^([a-z0-9]+) -> ([a-z]+)$/) {
my ($x, $y) = ($1, $2);
$wires{$y} = $x;
} elsif (/(([a-z0-9]+) (AND|OR|RSHIFT|LSHIFT) ([a-z0-9]+)) -> ([a-z]+)/) {
my ($exp, $wire) = ($1, $5);
@mpvvliet
mpvvliet / gist:2470806
Created April 23, 2012 13:04
Deployit puppet module sample
# Puppet manifest
$DEPLOYIT_VERSION = '3.7.0'
#
# Install the latest Apache webserver
#
exec { "apt-update":
command => "/usr/bin/apt-get update",
}
@mpvvliet
mpvvliet / deployit-1.3-export.txt
Created April 4, 2011 20:41
Deployit 1.3 CLI export sample
create Environment label="Test" description="" members="[Host1, Tomcat1]"
create Ear label="PetClinic-ear/1.0/PetClinic-1.0.ear" description="" location=/opt/deployit-1.3-beta-2-enterprise-edition/data/2.dat name=PetClinic
create Application label="PetClinic-ear" description=""
create DeploymentPackage label="PetClinic-ear/1.0" description="" application="PetClinic-ear" deployableArtifacts="[PetClinic-ear/1.0/PetClinic-1.0.ear]" middlewareResources="[]" version=1.0
create Ear label="PetClinic-ear/2.0/PetClinic-2.0.ear" description="" location=/opt/deployit-1.3-beta-2-enterprise-edition/data/5.dat name=PetClinic
create DeploymentPackage label="PetClinic-ear/2.0" description="" application="PetClinic-ear" deployableArtifacts="[PetClinic-ear/2.0/PetClinic-2.0.ear]" middlewareResources="[]" version=2.0
create Host label="Host1" description="" operatingsystemfamily=UNIX accessmethod=LOCAL address=localhost
create TomcatUnmanagedServer label="Tomcat1" description="" host="Host1" tomcathome=/tmp/tomcat ajppor