Skip to content

Instantly share code, notes, and snippets.

View FRosner's full-sized avatar

Frank Rosner FRosner

View GitHub Profile
@FRosner
FRosner / http.nomad
Created May 18, 2017 15:02
Nomad sample file starting a Node HTTP server.
job "http" {
datacenters = ["dc1"]
type = "service"
update {
stagger = "10s"
max_parallel = 1
}
def mult1(m1: Array[Array[Double]],
m2: Array[Array[Double]],
size: Int): Array[Array[Double]] = {
var res = Array.fill(size)(new Array[Double](size))
var i = 0
while (i < size) {
var j = 0
while (j < size) {
var k = 0
while (k < size) {
def mult2(m1: Array[Array[Double]],
m2: Array[Array[Double]],
size: Int): Array[Array[Double]] = {
var m2t = Array.fill(size)(new Array[Double](size))
var x = 0
while (x < size) {
var y = 0
while (y < size) {
m2t(x)(y) = m2(y)(x)
y += 1
n Time mult1 (ms) Time mult2 (ms) Speedup
10 0.011 0.014 -20.5 %
50 0.166 0.128 29.6 %
100 1.307 1.102 18.5 %
500 242.1 147.4 64.2 %
1000 9 347 1 244 651.2 %
3000 398 619 33 846 1077.7 %
Storage Size
L1i Cache 32 KB
L1d Cache 32 KB
L2 Cache 256 KB
L3 Cache 4 MB
Main Memory 16 GB
SSD 500 GB
for s in 10 50 100 250 500 1000 1500 2000 2500 3000
do
for m in 1 2
do
# Run mult$m with size $s and record CPU counters
perf stat -e L1-dcache-loads,L1-dcache-load-misses \
java -jar cpumemory.jar $s $m
done
done
resource "aws_api_gateway_rest_api" "example" {
name = "${local.project-name}"
description = "${local.project-name} API"
}
resource "aws_api_gateway_resource" "example" {
rest_api_id = "${aws_api_gateway_rest_api.example.id}"
parent_id = "${aws_api_gateway_rest_api.example.root_resource_id}"
path_part = "events"
}
locals {
api-gateway-url = "${aws_api_gateway_deployment.example.invoke_url}/${aws_api_gateway_resource.example.path_part}"
}
resource "leanix_webhook_subscription" "example" {
identifier = "${local.project-name}-${substr(md5(substr(var.leanix_api_token, 0, 4)), 0, 8)}"
target_url = "${local.api-gateway-url}"
target_method = "POST"
active = true
workspace_id = "8751abbf-8093-410d-a090-10c7735952cf"
provider "aws" {
region = "eu-central-1"
}
provider "leanix" {
url = "${var.leanix_base_url}"
api_token = "${var.leanix_api_token}"
}
package leanix
import (
"terraform-provider-leanix/leanix"
"github.com/hashicorp/terraform/plugin"
"github.com/hashicorp/terraform/terraform"
)
func main() {