Skip to content

Instantly share code, notes, and snippets.

Avatar

Clay Smith smithclay

View GitHub Profile
@smithclay
smithclay / rinkelby
Created Oct 16, 2017
rinkelby faucet
View rinkelby
0xA81320fC784C52F757b79EB21Dd8206f59259C51
@smithclay
smithclay / faucet.txt
Created Sep 3, 2017
0xA81320fC784C52F757b79EB21Dd8206f59259C51
View faucet.txt
0xA81320fC784C52F757b79EB21Dd8206f59259C51
@smithclay
smithclay / weird-lambda-binaries-recipe.md
Created Jul 28, 2017
Recipe for Getting Strange Binaries Running in AWS Lambda
View weird-lambda-binaries-recipe.md

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 Jul 19, 2017
Multi-Cloud New Relic Blog Post: Terraform Configuration of AWS, Azure and GCP Load Balancers with Instance Groups (Autoscaling enabled)
View aws.tf
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 Jun 16, 2017
"Hello World" AWS Lambda + Terraform Example
View index.js
// '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
Concurrently execute a lambda function for warming purposes
View lambda-concurrent.sh
#!/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 Nov 10, 2019
ubuntu bootstrap for user mode linux: minimal
View build-ubuntu-rootfs.sh
#!/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 Sep 15, 2015
Mac OS X Defaults, September 2015
View osx.sh
#!/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 Jul 15, 2015
keybase verification
View keybase.md

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: