Skip to content

Instantly share code, notes, and snippets.

View smithclay's full-sized avatar

Clay Smith smithclay

View GitHub Profile
@smithclay
smithclay / rinkelby
Created October 16, 2017 03:41
rinkelby faucet
0xA81320fC784C52F757b79EB21Dd8206f59259C51
@smithclay
smithclay / faucet.txt
Created September 3, 2017 22:49
0xA81320fC784C52F757b79EB21Dd8206f59259C51
0xA81320fC784C52F757b79EB21Dd8206f59259C51
@smithclay
smithclay / weird-lambda-binaries-recipe.md
Created July 28, 2017 02:59
Recipe for Getting Strange Binaries Running in AWS Lambda

Recipe for running strange binaries in AWS Lambda

In general, the command ldd and the environment variable LD_LINKER_PATH is your best friend when running new, untested binaries in Lambda. My process (which I want to get around to automating one day, maybe using Packer), goes like this:

  1. Run an EC2 instance with the official AWS Lambda AMI.
  2. Get binary you want to run in AWS Lambda running on the instance (either by installing from a package manager or compiling). 
  3. Run ldd -v ./the-binary. Note all of the shared libraries it requires. You’ll need to remember these.
  4. Copy the binary to your local machine. Upload the binary with your AWS Lambda function code that runs the ldd command inside the handler function using the process execution library from your language of choice. In node, this works just fine: console.log(require('child_process').execSync('ldd -v ./the-binary'))
  5. Note any shared libraries that are missing in the function output. Copy those over from the EC2 instance to a direct
@smithclay
smithclay / aws.tf
Created July 19, 2017 19:57
Multi-Cloud New Relic Blog Post: Terraform Configuration of AWS, Azure and GCP Load Balancers with Instance Groups (Autoscaling enabled)
variable "aws_region" {
description = "EC2 Region for the VPC"
default = "us-west-2"
}
variable "aws_availability_zones" {
default = "us-west-2a,us-west-2b,us-west-2c"
description = "List of availability zones, use AWS CLI to find your "
}
@smithclay
smithclay / index.js
Created June 16, 2017 18:30
"Hello World" AWS Lambda + Terraform Example
// 'Hello World' nodejs6.10 runtime AWS Lambda function
exports.handler = (event, context, callback) => {
console.log('Hello, logs!');
callback(null, 'great success');
}
@smithclay
smithclay / lambda-concurrent.sh
Created May 24, 2017 03:27
Concurrently execute a lambda function for warming purposes
#!/bin/bash
# This attempts to concurrently execute an AWS Lambda function. WIP.
# After execution, roughly NUM_EXECUTION containers will be ready
# to accept requests.
# More advanced strategies are out there. Check out @lambdacult on twitter, for example.
AWS_LAMBDA_FUNCTION_NAME=LambdaInfo
NUM_EXECUTIONS=3
@smithclay
smithclay / build-ubuntu-rootfs.sh
Last active January 5, 2024 10:37
ubuntu bootstrap for user mode linux: minimal
#!/bin/sh
# This script creates a user-mode linux machine based on Ubuntu.
# Created by Clay Smith, May 2017
#
# based on: https://gist.github.com/aputs/6247216
# and https://gist.github.com/AVGP/5410903
set -x
@smithclay
smithclay / osx.sh
Created September 15, 2015 17:08
Mac OS X Defaults, September 2015
#!/usr/bin/env bash
# ~/.osx — https://mths.be/osx
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
@smithclay
smithclay / keybase.md
Created July 15, 2015 20:45
keybase verification

Keybase proof

I hereby claim:

  • I am smithclay on github.
  • I am smithclay (https://keybase.io/smithclay) on keybase.
  • I have a public key whose fingerprint is B53D 2B26 60A5 DF27 33B3 A5D0 C707 37A6 5A56 EC97

To claim this, I am signing this object:

0Wr9oCpqvWty6fGLXDUM