Skip to content

Instantly share code, notes, and snippets.

@Guik
Guik / git-hook post-pull
Last active January 2, 2018 15:29 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-pull` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@Guik
Guik / update-route53-on-instance-start.js
Created June 28, 2017 08:10 — forked from davemcdermid/update-route53-on-instance-start.js
An AWS lambda function to update a Route53 hosted zone with a CNAME to an EC2s public DNS hostname on instance start. Should be triggered by a CloudWatch event.
var AWS = require('aws-sdk');
var domain = '.example.com';
var hostedZone = 'HOSTEDZONEID';
exports.handler = function(event, context, callback) {
var ec2 = new AWS.EC2();
var params = {
InstanceIds : [
event.detail['instance-id']