Skip to content

Instantly share code, notes, and snippets.

View mbroadhead's full-sized avatar

Mitch Broadhead mbroadhead

View GitHub Profile
@mbroadhead
mbroadhead / http-wrapper.py
Last active April 23, 2021 03:48
HTTPie wrapper script
#!/usr/bin/env python
"""HTTPie wrapper for a specific API
This is an example wrapper script that turns having to call httpie like this:
$ http http://some-cool-api.com/api/v1/some/endpoint X-API-KEY:my-api-key
Into this:
$ some-cool-api /some/endpoint
@mbroadhead
mbroadhead / gist:45f7480e7016c0578240
Created May 15, 2015 21:03
Various ways of calling a task (run_task, do_task, function)
use Rex -base;
use feature qw(say);
task "call_me_with_do_task" => sub {
say 'inside task: "call_me_with_do_task"';
};
before_task_start "call_me_with_do_task" => sub {
say 'inside before_task_start hook for task: "call_me_with_do_task"';
};
after_task_finished "call_me_with_do_task" => sub {
@mbroadhead
mbroadhead / gist:d9da0fd3c2b13ba5cf33
Created May 12, 2015 20:12
Rex::Transaction never calls the rollback code.
use Rex -base;
use Rex::Transaction;
task "test" => sub {
# This never gets called because Rex::Transaction::transaction() empties out the @ROLLBACKS array
# see here:
# grep -A1 "Cleaning ROLLBACKS array" lib/Rex/Transaction.pm
#
on_rollback {