Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pdesgarets
pdesgarets / ansible-role-test.sh
Last active July 30, 2018 16:52 — forked from geerlingguy/ansible-role-test.sh
Ansible Role Test Shim Script with container removal on both success and failure
#!/bin/bash
#
# Ansible role test shim.
#
# Usage: [OPTIONS] ./tests/test.sh
# - distro: a supported Docker distro version (default = "centos7")
# - playbook: a playbook in the tests directory (default = "test.yml")
# - role_dir: the directory where the role exists (default = $PWD)
# - cleanup: whether to remove the Docker container (default = true)
# - container_id: the --name to set for the container (default = timestamp)
@pdesgarets
pdesgarets / post-merge.sh
Created June 20, 2016 20:58 — 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-merge` 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"
@pdesgarets
pdesgarets / aws4-postman.js
Last active July 17, 2023 09:56
Set global variables aws-accessKey, aws-secretKey (with your credentials) and paste this script as pre-request script. Then set headers Authorization to `{{authorization}}` and Date to `{{date}}`, and Enjoy.
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.aws44 = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var aws4 = require('aws4');
var url = new URL(request.url);
var opts = {
method: request.method,
host: url.host,
path: url.pathname + url.search
};
var signed = aws4
@pdesgarets
pdesgarets / aws4-postman.min.js
Last active June 14, 2016 21:06
Set global variables aws-accessKey, aws-secretKey (with your credentials) and script with this minified script. Then write `eval(postman.getGlobalVariable('script'))` as and paste this script as pre-request script. Then set headers Authorization to `{{authorization}}` and Date to `{{date}}`, and Enjoy.
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.aws44=e()}}(function(){var define,module,exports;return function e(t,r,i){function n(s,f){if(!r[s]){if(!t[s]){var o="function"==typeof require&&require;if(!f&&o)return o(s,!0);if(a)return a(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var h=r[s]={exports:{}};t[s][0].call(h.exports,function(e){var r=t[s][1][e];return n(r?r:e)},h,h.exports,e,t,r,i)}return r[s].exports}for(var a="function"==typeof require&&require,s=0;s<i.length;s++)n(i[s]);return n}({1:[function(e,t,r){var i=e("aws4"),n=new URL(request.url),a={method:request.method,host:n.host,path:n.pathname+n.search},s=i.sign(a,{accessKeyId:postman.getGlobalVariable("aws-accessKey"),secretAccessKey:postman.getGlobalVariable("aws-secretKey")});postman.setEnvir