Skip to content

Instantly share code, notes, and snippets.

View talawahtech's full-sized avatar

Marc Richards talawahtech

  • Kingston, Jamaica
View GitHub Profile
@talawahtech
talawahtech / tcp_httpd_demo.cc
Created February 23, 2022 03:40
Simple Seastar TCP server that return a hard-coded HTTP response
#include <seastar/core/reactor.hh>
#include <seastar/core/app-template.hh>
#include <seastar/core/temporary_buffer.hh>
#include <seastar/core/distributed.hh>
using namespace seastar;
static std::string str_json{"HTTP/1.1 200 OK\r\nServer: httpserver\r\nDate: Thu, 01 Jan 1970 00:00:00 GMT\r\nContent-Type: application/json\r\nContent-Length: 27\r\n\r\n{\"message\":\"Hello, World!\"}"};
class tcp_server {
AWSTemplateFormatVersion: '2010-09-09'
Description: Extreme Performance Tuning Benchmark Environment
Parameters:
AmiId:
Type: AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>
Default: '/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2'
@talawahtech
talawahtech / txq.bt
Last active May 22, 2021 02:33
txq.bt - monitor the length of an AWS ENA device's transmit queue
#include "txq.h"
kprobe:ena_com_prepare_tx
{
// grab/cast the transmit queue param
$io_sq = (struct ena_com_io_sq *) arg0;
// logic copied from from ena_com_free_q_entries
$queuelen = (uint16) $io_sq->tail - (uint16) $io_sq->next_to_comp;
@talawahtech
talawahtech / libreactor-palette.map
Last active August 16, 2022 06:19
libreactor-palette.map - a custom FlameGraph palette.map that I use with my libreactor tests
->rgb(185,185,185)
SYSC_newfstat_[k]->rgb(228,177,17)
SYSC_recvfrom_[k]->rgb(224,162,23)
SYSC_sendto_[k]->rgb(224,162,23)
SYSC_statx_[k]->rgb(250,26,51)
[libreactor]->rgb(135,195,250)
___slab_alloc_[k]->rgb(216,170,9)
__acct_update_integrals_[k]->rgb(250,144,31)
__accumulate_pelt_segments_[k]->rgb(216,107,43)
__alloc_pages_nodemask_[k]->rgb(208,12,16)
@talawahtech
talawahtech / netmonitor.sh
Last active February 1, 2024 06:32
netmonitor.sh - A simple bash script to calculate throughput and pps
#!/bin/bash
# Bash script to calculate throughput and packets/sec
# Based on code from https://discuss.aerospike.com/t/benchmarking-throughput-and-packet-count-with-iperf3/2791
if [ -z "$1" ]; then
echo
echo usage: $0 [network-interface]
echo
echo defaulting to eth0
@talawahtech
talawahtech / docker-hub-api.sh
Last active January 16, 2022 14:15
Docker Hub - Create repo with automated build for TechEmpower benchmark
#!/bin/sh
export UNAME=""
export UPASS=""
export DOCKERHUB_NAMESPACE="techempower"
export FRAMEWORK_LANG="C"
export FRAMEWORK="libreactor"
export GITHUB_ORG="TechEmpower"
export GITHUB_REPO="FrameworkBenchmarks"
#Authenticate
@talawahtech
talawahtech / under-maintenance.yaml
Last active January 18, 2019 22:01
CloudFormation snippet for quickly putting a site behind a Load Balancer "under maintenance"
Parameters:
UnderMaintenance:
Description: 'Returns a static "under maintenance" page and a 503 response code. ONLY WORKS WITH ALB'
Type: String
Default: 'NO'
AllowedValues: ['YES', 'NO']
Conditions:
UnderMaintenance: !Equals [!Ref 'UnderMaintenance', 'YES']
@talawahtech
talawahtech / promisified-https-request.js
Created April 24, 2018 17:03
Example Lambda function that wraps https.request in a promise so it can be used with async/await
const https = require('https');
exports.handler = async (event) => {
const response = await asyncHttpRequest({ hostname: 'httpbin.org', path: '/ip' });
return JSON.parse(response);
};
function asyncHttpRequest(params, postData) {
return new Promise(function(resolve, reject) {
const req = https.request(params, function(res) {
@talawahtech
talawahtech / password-generator.yaml
Last active February 5, 2019 16:15
Generates a random password using SecretsManager.getRandomPassword() and stores it in the Parameter Store
AWSTemplateFormatVersion: '2010-09-09'
Description: 'Generates a random password and stores it in the SSM Parameter Store'
Resources:
PasswordGeneratorRole:
Type: 'AWS::IAM::Role'
Properties:
Path: '/'
ManagedPolicyArns: ['arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole']

Keybase proof

I hereby claim:

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

To claim this, I am signing this object: