Skip to content

Instantly share code, notes, and snippets.

View mlafeldt's full-sized avatar

Mathias Lafeldt mlafeldt

View GitHub Profile
@mlafeldt
mlafeldt / elf.h
Last active May 5, 2024 05:35
elf.h for OSX
/* This is the original elf.h file from the GNU C Library; I only removed
the inclusion of feature.h and added definitions of __BEGIN_DECLS and
__END_DECLS as documented in
https://cmd.inp.nsk.su/old/cmd2/manuals/gnudocs/gnudocs/libtool/libtool_36.html
On macOS, simply copy the file to /usr/local/include/.
Mathias Lafeldt <mathias.lafeldt@gmail.com> */
/* This file defines standard ELF types, structures, and macros.
@mlafeldt
mlafeldt / postmortem.md
Last active March 27, 2024 09:23
Example Postmortem from SRE book, pp. 487-491

Shakespeare Sonnet++ Postmortem (incident #465)

Date

2015-10-21

Authors

  • jennifer
  • martym

EMAILENGINE LICENSE AGREEMENT

Version 2.1, 17 October 2023

PLEASE CAREFULLY READ THIS EMAILENGINE LICENSE AGREEMENT ("AGREEMENT"). THIS AGREEMENT CONSTITUTES A LEGALLY BINDING AGREEMENT BETWEEN YOU AND POSTAL SYSTEMS OÜ AND GOVERNS YOUR USE OF THE SOFTWARE (DEFINED BELOW). IF YOU DO NOT AGREE WITH THIS AGREEMENT, YOU MAY NOT USE THE SOFTWARE. IF YOU ARE USING THE SOFTWARE ON BEHALF OF A LEGAL ENTITY, YOU REPRESENT AND WARRANT THAT YOU HAVE AUTHORITY TO AGREE TO THIS AGREEMENT ON BEHALF OF SUCH ENTITY. IF YOU DO NOT HAVE SUCH AUTHORITY, DO NOT USE THE SOFTWARE IN ANY MANNER.

This Agreement is entered into by and between Postal Systems OÜ and you, or the legal entity on behalf of whom you are acting (as applicable, "You" or "Your").

1. DEFINITIONS

@mlafeldt
mlafeldt / app.py
Created August 12, 2022 08:41
Extracted from https://eventbridge-inbound-webhook-templates-prod-eu-central-1/lambda-templates/github-lambdasrc.zip
"""Webhook implementation for Github"""
import os
import json
import urllib.parse
import base64
import hmac
import hashlib
from cgi import parse_header
import boto3
@mlafeldt
mlafeldt / clerk.ts
Created August 25, 2022 09:51
Talking to Clerk's backend API from Deno
#!/usr/bin/env -S deno run --allow-env=CLERK_API_KEY --allow-net=api.clerk.dev --no-check
import {
ClerkAPIResponseError,
ClerkBackendAPI,
User,
} from "https://cdn.skypack.dev/@clerk/backend-core?dts";
const ClerkAPI = new ClerkBackendAPI({
apiClient: {
@mlafeldt
mlafeldt / x.md
Created February 16, 2016 15:48
Providing a Homebrew tap backed by private GitHub repo

First of all, install Homebrew itself.

As the tap is a private Git repo, you need to generate a GitHub token with repo scope and then add this token to your ~/.netrc file like this:

machine github.com
  login <your GitHub user>
  password <your GitHub token>
@mlafeldt
mlafeldt / README.md
Created September 19, 2012 19:52
Process metadata of Chef cookbooks
We couldn’t find that file to show.
@mlafeldt
mlafeldt / useAuth0WithToken.ts
Last active May 14, 2021 12:37
Like useAuth but also returns the access token
import { useState, useEffect } from 'react'
import { useAuth0 } from '@auth0/auth0-react'
export const useAuth0WithToken = () => {
const auth0 = useAuth0()
const [token, setToken] = useState('')
const [error, setError] = useState()
useEffect(() => {
if (!auth0.isAuthenticated) return
@mlafeldt
mlafeldt / scp_demo.py
Created February 24, 2011 09:09
[Python] paramiko examples
#!/usr/bin/env python
import sys, paramiko
if len(sys.argv) < 5:
print "args missing"
sys.exit(1)
hostname = sys.argv[1]
password = sys.argv[2]
@mlafeldt
mlafeldt / parse_yaml.py
Created October 13, 2011 15:44
[Python] Parse and pretty-print YAML
#!/usr/bin/env python
import sys
import yaml
import pprint
filename = sys.argv[1]
y = yaml.safe_load(open(filename, 'r'))