Skip to content

Instantly share code, notes, and snippets.

💭
debugging

Hassy Veldstra hassy

💭
debugging
Block or report user

Report or block hassy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am hassy on github.
  • I am veldstra (https://keybase.io/veldstra) on keybase.
  • I have a public key ASA-ENS93q9-z-YpSNbYjE3jizrUDuaYY4rGqovAfdBPsQo

To claim this, I am signing this object:

View k8s.sh
# Local variables:
# mode: shell-script
# eval: (sh-set-shell "zsh")
# End:
alias k-system='kubectl -n kube-system'
source <(kubectl completion zsh)
function k-context() {
@hassy
hassy / kms-vault
Last active Aug 23, 2019
Encrypt/decrypt files using AWS KMS
View kms-vault
#!/usr/bin/env bash
# License: MIT - https://opensource.org/licenses/MIT
#
# Usage:
#
# Encrypt a file:
# kms-vault encrypt My-Key-Alias some-file-i-want-encrypted.txt > topsecret.asc
#
@hassy
hassy / hang.js
Last active Dec 8, 2016
Trigger an infinite loop in Node.js 6.8.1+
View hang.js
var i1 = setImmediate(function() {
console.log('i1 cb');
clearImmediate(i2);
clearImmediate(i3);
});
var i2 = setImmediate(function() {
console.log('i2 cb');
});
@hassy
hassy / processor.js
Created Nov 17, 2016
Custom Artillery functions to print the latency distribution for a single HTTP request
View processor.js
//
// Custom Artillery functions to print the latency distribution for a single HTTP request
//
// Example usage: (in your scenario)
// - get:
// url: "/some/endpoint"
// beforeRequest: ["recordStartTime"]
// afterResponse: ["logLatencyDelta"]
// name: "Optional name for the endpoint for the report"
@hassy
hassy / searchItems.csv
Created Sep 27, 2016
Artillery CSV payloads
View searchItems.csv
item peanuts
item starburst
item eggs
item butter
item creamer
item pudding
item yogurt
item egg%20noodles
item alfredo
View soda-social-6.md

Tracing your own app

Set up lltrace-aws-sdk

Wait for enough activity to be traced

(a quick load-test is good if you're impatient)

Run lltrace

View soda-social-5.md

What can be traced

  • S3 putObject and uploadFile
  • Invoking other lambdas
  • Publishing to SNS topics
  • Custom actions (e.g. write to Neo4J)

Sampling

By default only 10% of traced actions actually get logged.

View soda-social-4.md

How it works

SNS and S3 notifications are easy

Lambda activity - not quite so

Solution: monkey-patch aws-sdk 🙈

View soda-social-3.md

What we wanted

To recap:

  • 20 lambdas
  • 10 SNS topics (more than one subscriber/publisher for some)
  • S3 buckets (triggering lambdas)

You can’t perform that action at this time.