Skip to content

Instantly share code, notes, and snippets.

View flomotlik's full-sized avatar

Florian Motlik flomotlik

View GitHub Profile
@flomotlik
flomotlik / Gemfile
Last active April 6, 2021 13:17
Puma on Heroku
gem 'foreman'
gem 'puma'
@flomotlik
flomotlik / myapp.rb
Created February 24, 2012 13:51
Using Thor subcommands
require 'thor'
require "sub"
class MyApp < Thor
desc "parentcommand SUBCOMMAND", "Some Parent Command"
subcommand "sub", Sub
end
MyApp.start
@flomotlik
flomotlik / heroku_run.sh
Last active January 10, 2020 21:40
Heroku run script that exits with the correct error code
#! /bin/bash
array=( $@ )
len=${#array[@]}
app=${array[$len-1]}
args=${array[@]:0:$len-1}
buffer_file=/tmp/last_heroku_run_`date +%N`
/usr/bin/heroku run "$args; echo \$?" --app $app 2>&1 | tee $buffer_file
@flomotlik
flomotlik / gist:6212725
Last active November 13, 2017 18:46
Wget Curl comparison and our Approach

We have changed our check_url implementation from curl to wget for three reasons

  1. It gives us the ability to retry on connection refused. Compare the command we used previously with curl:
curl -sSfL --retry 3 URL

to the current one:

@flomotlik
flomotlik / Dockerfile
Created September 18, 2017 13:35
AWSGit for pushing to CodeCommit
FROM alpine:latest
RUN apk add --no-cache --update \
python \
python-dev \
py-pip \
build-base \
git
RUN pip install awscli
@flomotlik
flomotlik / functions.sh
Created September 28, 2016 11:22
Pull Request handling
# Checkout a PR from the current repo
function copr { git fetch origin pull/$1/head:pr-$1; git checkout pr-$1; }
# Get the current PR from the branch name
function current_pr {
git rev-parse --abbrev-ref HEAD | grep -oE "\d+"
}
# Update the PR
function upr {
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"codedeploy:RegisterApplicationRevision",
"codedeploy:GetApplicationRevision"
],
"Resource": [
@flomotlik
flomotlik / service-checklist.md
Created March 20, 2017 14:20 — forked from acolyer/service-checklist.md
Internet Scale Services Checklist

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
@flomotlik
flomotlik / update_firefox
Last active January 10, 2017 17:23
Update Firefox version on Codeship
#!/bin/bash
# Add the following commands to your setup commands to update firefox
# git clone https://gist.github.com/9525133.git update_firefox
# bash ./update_firefox/update_firefox 28
# firefox --version
set -e
if [ -z "$1" ]; then
@flomotlik
flomotlik / create_ami.rb
Created September 12, 2013 09:01
Create AMI
# Create an Amazon EC2 AMI
ec2 = AWS::EC2.new(
:access_key_id => ENV['AWS_KEY'],
:secret_access_key => ENV['AWS_SECRET_KEY'])
ec2.images.create(:instance_id => instance_id)