Skip to content

Instantly share code, notes, and snippets.

Dave Clark clarkdave

Block or report user

Report or block clarkdave

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
@clarkdave
clarkdave / load-balanced-pgbouncer-ecs.tf
Last active Oct 3, 2018
[Terraform] Load balanced PgBouncer service on Amazon ECS
View load-balanced-pgbouncer-ecs.tf
#
# Reference implementation of a load balanced PgBouncer service on Amazon ECS
#
# see: https://engineering.loyaltylion.com/load-balanced-pgbouncer-service-on-amazon-ecs-f02120d1733e
#
resource "aws_lb" "pgbouncer" {
name = "${var.environment}-pgbouncer"
internal = true
load_balancer_type = "network"
@clarkdave
clarkdave / createPages.ts
Created Apr 15, 2018
TypeScript + Gatsby node API
View createPages.ts
import { resolve } from 'path'
import { GatsbyCreatePages } from './types'
const createPages: GatsbyCreatePages = async ({
graphql,
boundActionCreators,
}) => {
const { createPage } = boundActionCreators
const allMarkdown = await graphql(`
View multi-line-regex-grep.md
brew install pcre2

find . -type f | xargs pcregrep -M 'pattern'
@clarkdave
clarkdave / link.md
Last active Nov 14, 2017
macOS British PC keyboard layouts
View link.md
@clarkdave
clarkdave / ecs-task-events-to-cloudwatch-logs.py
Created Jun 29, 2017
(AWS Lambda) Send ECS Task events to CloudWatch Logs
View ecs-task-events-to-cloudwatch-logs.py
# This lambda function can be linked with CloudWatch events to send Task state changes to
# a CloudWatch Logs stream
#
# This is highly recommended as, in my experience, the API does *NOT* return all state change
# events; this is the only way to reliably see them all
import os
import time
import json
import boto3
@clarkdave
clarkdave / bootstrap-chef-server-12.sh
Last active Jun 29, 2017
[CHEF] Bootstrap a Chef Server 12
View bootstrap-chef-server-12.sh
#!/bin/bash -ex
# Use this script template to bootstrap a Chef Server (version 12)
#
# - bootstraps the Chef server using chef-solo and the official chef-server cookbook
# (https://github.com/chef-cookbooks/chef-server)
# - uses Lego (acme client) to generate and renew an SSL certificate for the server
# - installs the manage (web ui), push jobs and reporting addons (free for < 25 nodes)
# - configures a few sane defaults (no sign ups from web ui)
#
@clarkdave
clarkdave / ecs-interactive-console.sh
Last active May 29, 2019
ecs-interactive-console
View ecs-interactive-console.sh
#!/bin/bash -e
##
# Use this annotated script a base for launching an interactive console task on Amazon ECS
#
# more info: https://engineering.loyaltylion.com/running-an-interactive-console-on-amazon-ecs-c692f321b14d
#
# Requirements:
# - `jq` must be installed on both the client and server
##
View keybase.md

Keybase proof

I hereby claim:

  • I am clarkdave on github.
  • I am clarkdave (https://keybase.io/clarkdave) on keybase.
  • I have a public key ASAAW7KQ7BqcEQjDD--DhGxAF_Ufz_IT71BmARZuxJotRwo

To claim this, I am signing this object:

@clarkdave
clarkdave / sublimetext3.json
Created Nov 10, 2015
sublime text 3 config
View sublimetext3.json
{
"auto_find_in_selection": true,
"base64fold_all_uris": false,
"bold_folder_labels": false,
"caret_style": "blink",
"color_scheme": "Packages/User/SublimeLinter/Blackboard (SL).tmTheme",
"enable_tab_scrolling": false,
"fade_fold_buttons": false,
"find_selected_text": true,
"font_face": "Source Code Pro Light",
@clarkdave
clarkdave / gist:609fc3049dcf9c8aa559
Last active Aug 29, 2015
gevent ubuntu 12.04 setuptools issue
View gist:609fc3049dcf9c8aa559

Error, on Ubuntu 12.04

$ sudo -H pip install gevent
Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 232, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 339, in run
    requirement_set.prepare_files(finder)
  File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 229, in prepare_files
You can’t perform that action at this time.