Skip to content

Instantly share code, notes, and snippets.

🐢
Working through a massive backlog of issues, PRs and emails. Send coffee.

Hassy Veldstra hassy

🐢
Working through a massive backlog of issues, PRs and emails. Send coffee.
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
@hassy
hassy / README.md
Last active Mar 21, 2020
Hammerspoon config
View README.md

Hassy's Hammerspoon Config

Just like its website says Hammerspoon is staggeringly powerful (and also staggeringly fun). This is my Hammerspoon config. It's very simple, but it allowed me to replace two other apps: Spectacle for moving windows around, and Karabiner which I used for quickly switching between apps.

This is where it all began:

🎧 Have you ever had your bluetooth headphones disconnect and inadvertently & loudly share your unconventional music taste with the rest of the office/coffeeshop?

1. brew install hammerspoon
2. drop a few lines into ~/.hammerspoon/init.lua
3. never again! 🤫 pic.twitter.com/RsHJn17djR

— Hassy Veldstra (@hveldstra) March 11, 2020

Setting up

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 Mar 10, 2020
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 🙈

You can’t perform that action at this time.