Skip to content

Instantly share code, notes, and snippets.

View mlafeldt's full-sized avatar

Mathias Lafeldt mlafeldt

View GitHub Profile
@mlafeldt
mlafeldt / main.go
Created March 1, 2019 22:43
Lambda handlertrace example
func main() {
lambda.StartHandler(middleware(handler))
}
type handlerFunc func(ctx context.Context, payload []byte) ([]byte, error)
func (h handlerFunc) Invoke(ctx context.Context, input []byte) ([]byte, error) {
log.Printf("[DEBUG] input = %s", string(input))
output, err := h(ctx, input)
log.Printf("[DEBUG] output = %s", string(output))
@mlafeldt
mlafeldt / spec.yaml
Created October 26, 2018 09:46
K8s JSON Logger Container
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
creationTimestamp: null
labels:
run: test
name: test
spec:
replicas: 1
@mlafeldt
mlafeldt / epsagon.yaml
Created October 8, 2018 14:40
CloudFormation stack for Epsagon to provide monitoring
Description: CloudFormation stack for Epsagon to provide monitoring.
Resources:
EpsagonRole:
Type: 'AWS::IAM::Role'
Properties:
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
package main
import "fmt"
func main() {
c := make(chan int)
quit := make(chan int)
go func() {
for i := 0; i < 10; i++ {
@mlafeldt
mlafeldt / README.md
Last active April 19, 2019 11:21
AWS Resources recommend by https://acloud.guru/
  • AWS Documentation
  • AWS Service FAQs
  • AWS Whitepapers
    • Read early and study later
      • Architecting for the Cloud: AWS Best Practices
      • AWS Security Best Practices
    • Read before exam
      • Overview of Amazon Web Services
      • Overview of Security Processes
  • AWS Storage Services Overview
package main
import (
"encoding/json"
"log"
"github.com/apex/go-apex"
"github.com/apex/go-apex/sns"
)
@mlafeldt
mlafeldt / main.rb
Created February 14, 2017 15:28
Scientist example
require "scientist"
class MyExperiment
include Scientist::Experiment
attr_accessor :name
def initialize(name)
@name = name
end
@mlafeldt
mlafeldt / Dockerfile
Last active January 25, 2017 13:10
Push freshness metric to Prometheus Pushgateway
FROM alpine
RUN apk add --update bash curl ca-certificates
ADD freshness.sh /usr/bin/freshness
ENTRYPOINT ["/usr/bin/freshness"]
@mlafeldt
mlafeldt / byword.md
Created January 16, 2017 11:02
Byword Dropbox conflicts

Hi,

For a couple of months, I've been observing the following strange behavior in Byword:

I'm storing my documents to a folder that is backed by Dropbox. When saving a Markdown file with Cmd+S, I often get the following error:

The document “example.md” could not be saved. The file has been changed by another application.

This happens almost every time I have Dropbox enabled. In addition to this annoying message, my documents folder will contain lots of "conflicted copy" files, which I have to remove manually on a regular basis.

@mlafeldt
mlafeldt / postmortem.md
Created October 12, 2016 18:25
Deployer API Outage Postmortem

Deployer API Outage Postmortem

Date

2016-09-05

Authors