Skip to content

Instantly share code, notes, and snippets.

pjkelly / serverless.yml
Created Dec 14, 2019
Serverless / LocalStack - DynamoDB Table
View serverless.yml
service: my-service
frameworkVersion: ">=1.45.0 <2.0.0"
- serverless-localstack
- serverless-deployment-bucket
stage: ${opt:stage}

Keybase proof

I hereby claim:

  • I am pjkelly on github.
  • I am pjkelly ( on keybase.
  • I have a public key ASABfS-Igq-O3-uBbvoG2rvBftrNakjRot4KsqS4OFf4oAo

To claim this, I am signing this object:

pjkelly / app.js
Created Oct 27, 2017
Sample express app that acts as a proxy with CORS support.
View app.js
const express = require('express');
const cors = require('cors');
const proxy = require('http-proxy-middleware');
const app = express();
const port = process.env.PORT || 8080;
const onProxyReq = function (proxyReq, req, res) {
proxyReq.setHeader('Authorization', 'Basic SECRET');
pjkelly /
Last active May 25, 2016
PG gem error after PostgreSQL upgrade.

When upgrading PostgreSQL on your machine, previously installed versions of the pg Rubygem will complain because their native extensions were compiled against an older version of Postgres. The error will look like this:

[daley (qa)]$ be rake db:create
rake aborted!
LoadError: dlopen(/opt/rubies/2.3.1/lib/ruby/gems/2.3.0/gems/pg-0.18.4/lib/pg_ext.bundle, 9): Library not loaded: /opt/boxen/homebrew/lib/libpq.5.5.dylib
  Referenced from: /opt/rubies/2.3.1/lib/ruby/gems/2.3.0/gems/pg-0.18.4/lib/pg_ext.bundle
  Reason: image not found - /opt/rubies/2.3.1/lib/ruby/gems/2.3.0/gems/pg-0.18.4/lib/pg_ext.bundle
/Users/pjkelly/src/daley/config/application.rb:7:in `<top (required)>'
pjkelly / copy.rb
Created May 14, 2015
Copy a local file to server w/ Cap 3
View copy.rb
desc "Copy a file"
task :copy do
on roles(:web) do |host|
# localfile.html would be in the root of your repo in this case.
upload! 'localfile.html', current_path.join('public/localfile.html')
execute :chmod, '775', current_path.join('public/localfile.html')
pjkelly / circle.yml
Created Sep 18, 2014 auto-deploy
View circle.yml
- bundle exec jekyll
branch: master
- '[[ ! -s "$(git rev-parse --git-dir)/shallow" ]] || git fetch --unshallow'
- git push $CIRCLE_SHA1:master -f
- curl -sSfL --retry 5 > /dev/null
pjkelly /
Last active Jan 27, 2020
Installing PhantomJS

Installing PhantomJS via Homebrew and fixing Ruby if it breaks

PhantomJS is an awesome tool for doing automated, full-stack acceptance tests in a headless browser. It's a great alternative to capybara-webkit because it doesn't depend on QT or xvfb, and it's way better than Selenium in most cases because it's faster (you don't need to open Firefox to run your tests).

Unfortunately, installing PhantomJS via Homebrew can wreak havoc on your Rubies if you're using rbenv. These are the steps that worked for me in fixing my Ruby installations.

# Update Homebrew
brew update
# Install PhantomJS
pjkelly /
Created Sep 3, 2014
Setting up an Amazon S3 bucket to share files.

Setting up an Amazon S3 bucket to share files

  1. Sign into your AWS console:
  2. Click on “S3”.
  3. Click “Create Bucket” and enter a Bucket Name using only alphanumeric characters and no spaces. We recommend prefixing it with your organization’s name, so something like “myorganization-downloads” works well. No other customization is necessary, so then click “Create” to complete the creation process.
  4. Choose the bucket you just created from the list of buckets to navigate into it.
  5. Once inside the folder, click “Upload” and upload all the files you want there.
  6. After your files are done uploading, select them by clicking the square to their left and then choose “Actions” -> “Make Public”. This will make the files publicly accessible.
  7. To get the public URL of a file, select the file and then click the Properties tab (in the top right of the window). The Link attribute contains the publicly accessible URL of the file.
View unicorn.rb
require 'dotenv'
listen ENV.fetch('UNICORN_PORT', 5000), :backlog => ENV.fetch('UNICORN_BACKLOG', 200).to_i
worker_processes ENV.fetch('UNICORN_CONCURRENCY', 3).to_i
timeout ENV.fetch('UNICORN_TIMEOUT', 15).to_i
preload_app true
if ENV.include?('UNICORN_LOG')
stderr_path ENV.fetch('UNICORN_LOG')
View sublime-user-settings.json
"color_scheme": "Packages/Color Scheme - Default/Sunburst.tmTheme",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": false,