Skip to content

Instantly share code, notes, and snippets.

View kieranajp's full-sized avatar
🎧

Kieran kieranajp

🎧
View GitHub Profile
@kieranajp
kieranajp / gimmesecret.sh
Last active June 10, 2020 17:25
An easy way to look at multiple data items in a Kubernetes secret.
#!/usr/bin/env bash
function usage {
echo "An easy way to look at multiple data items in a Kubernetes secret."
echo " Usage: $(basename $0) <secret> <data ...>"
exit 1
}
if [[ $# -eq 0 ]] ; then
usage
@kieranajp
kieranajp / cronjob.yaml
Last active February 13, 2020 20:47
Kubernetes example files used in tech talk Feb 2020
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: cron
spec:
schedule: "*/1 * * * *"
jobTemplate:
spec:
template:
spec:
@kieranajp
kieranajp / monitor.sh
Created April 7, 2018 20:12
Connect / disconnect external 4k monitor with xrandr (for use in awesomewm)
#!/bin/bash
connect=1
while getopts "d" opt; do
case "$opt" in
d)

Scaling @ HelloFresh

API Gateway


Why did we need an API Gateway?

^ Italo ^ As we move to microservices, and break up monoliths, we need to be able to seamlessly route requests to the right place ^ Each service should not care about auth, rate limiting, etc. so we can offload this to the gateway

@kieranajp
kieranajp / microXchg.md
Created February 21, 2017 13:35
Notes from microXchg conf 2017 in Berlin

MicroXchg 2017

## Resilient functional service design

The problem

  • you don't make any money until you go to production
  • you don't make any money unless your software is available & responsive
  • distributed systems change the rules of making it robust - throwing money at hardware is no longer enough
  • Failure is now the norm, it's unpredictable, it's going to get worse. Don't try to avoid failures, accept they'll happen
@kieranajp
kieranajp / Dockerfile
Created September 28, 2016 13:16
Update alpine go dockerfile
FROM golang:1.7.1-alpine
RUN apk --update add make \
&& rm -rf /var/cache/apk/*
@kieranajp
kieranajp / npm_s3.sh
Created July 1, 2016 14:16
Caches NPM install on S3 based on whether the shrinkwrap's changed.
#!/bin/bash
##########
# Run this to use a cached version of node_modules stored on Amazon S3.
# If npm-shrinkwrap has changed, the cache is updated.
#
# Ensure the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environtment variables are set
# Then run the script.
#
# Example:
@kieranajp
kieranajp / .git_hooks_pre-commit
Created April 18, 2016 22:09
pre-commit hook to run phpcs
#!/bin/sh
PRE_COMMIT="$(cat <<'EOF'
#!/bin/sh
PROJECT=`php -r "echo dirname(dirname(dirname(realpath('$0'))));"`
STAGED_FILES_CMD=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \.php`
# Determine if a file list is passed
if [ "$#" -eq 1 ]
@kieranajp
kieranajp / shipitbot.sh
Last active March 1, 2016 15:15
Slack webhook that can be run when a successful deploy happens (we run it through CodeShip CI)
#!/bin/bash
# Slack Info
webhook_url="" # Put your Slack webhook URL here
channel="#general"
# Deploy info
server="" # Staging, production etc.
check_url="" # Link within the message body
application_name="" # Name of your application

The traditional way of doing async in JS was with callbacks:

function doSomethingThatTakesAWhile(callback) {
    // blah blah blah doing some work that will take a few seconds

    // We'll simulate this taking a while with the timeout
    setTimeout(function () {
        callback('done');
 }, 5000)