wget https://bintray.com/loadimpact/rpm/rpm -O bintray-loadimpact-rpm.repo
sudo mv bintray-loadimpact-rpm.repo /etc/yum.repos.d/
sudo yum install -y k6
k6 version
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
const child_process = require('child_process') | |
function run_script(command, args, realtimeCallback = (log, type) => {console.log(log)}) { | |
return new Promise((resolve) => { | |
let child = child_process.spawn(command, args) | |
let scriptOutput = "" | |
child.stdout.setEncoding('utf8') | |
child.stdout.on('data', function (data) { |
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
{ | |
"schemaVersion": "0.3", | |
"description": "AWSSupport-SetupIPMonitoringFromVPC creates an EC2 instance in the specified subnet and monitors selected target IPs by continuously running ping, MTR, traceroute and tracetcp tests. The results are stored in CloudWatch logs, and metric filters are applied to quickly visualize latency and packet loss statistics in a CloudWatch dashboard.", | |
"assumeRole": "{{ AutomationAssumeRole }}", | |
"parameters": { | |
"SubnetId": { | |
"type": "String", | |
"description": "(Required) The subnet ID for the monitor instance. NOTE: If you specify a private subnet, make sure there is Internet access to allow the monitor instance to setup the test (i.e. install the CloudWatch Logs agent, interact with AWS Systems Manager and Amazon CloudWatch).", | |
"allowedPattern": "^subnet-[a-z0-9]{8,17}$" | |
}, |
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
/** | |
* Broadly inspired by https://blog.risingstack.com/measuring-http-timings-node-js/ | |
* And https://github.com/RisingStack/example-http-timings | |
*/ | |
import {IncomingHttpHeaders} from "http"; | |
const https = require('https'); | |
const http = require('http'); | |
const url_lib = require('url'); | |
const NS_PER_SEC = 1e9; |
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
from typing import Dict | |
import boto3 | |
def lambda_handler(event: Dict, context): | |
try: | |
path: str = event['path'] | |
if path.startswith('/api/token/revoked/'): | |
token_id: str = path.split('/')[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
import { | |
CloudFrontRequestHandler, | |
CloudFrontRequestEvent, | |
CloudFrontRequestResult, | |
Context, | |
CloudFrontResultResponse, | |
CloudFrontHeaders | |
} from 'aws-lambda'; | |
import {verify} from 'jsonwebtoken'; | |
import {AUTH_PUBLIC_KEY} from './test/public_key'; |
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 java.util.ArrayList; | |
import java.util.List; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
/** | |
* This regex matches JSON documents with the properties 'name' and 'type' and returns a list of the 'dir' type documents. | |
* e.g. [0.0.1-pre-alpha, 0.0.2-pre-alpha, 0.0.3-pre-alpha, 0.0.4-pre-alpha] | |
*/ | |
public class RegExFun { |
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 javax.swing.*; | |
import java.awt.*; | |
import java.awt.event.MouseEvent; | |
import java.awt.event.MouseListener; | |
import java.awt.geom.Ellipse2D; | |
public class MainFrame extends JFrame implements MouseListener { | |
private int x; | |
private int y; |
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
''' | |
Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. | |
Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at | |
http://aws.amazon.com/apache2.0/ | |
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 http from "k6/http"; | |
import { check, sleep } from "k6"; | |
export let options = { | |
stages: [ | |
{ duration: "30s", target: 20 }, | |
{ duration: "1m30s" }, | |
{ duration: "30s", target: 0 }, | |
] | |
}; |