Skip to content

Instantly share code, notes, and snippets.

@patjenk
patjenk / jinja2_file_less.py
Created September 15, 2016 20:59 — forked from wrunk/jinja2_file_less.py
python jinja2 examples
#!/usr/bin/env/python
#
# More of a reference of using jinaj2 without actual template files.
# This is great for a simple output transformation to standard out.
#
# Of course you will need to "sudo pip install jinja2" first!
#
# I like to refer to the following to remember how to use jinja2 :)
# http://jinja.pocoo.org/docs/templates/
#
@patjenk
patjenk / rabbitmq_firehose.py
Last active November 17, 2016 22:33 — forked from khomenko/rabbitmq_firehose.py
simple rabbitmq debug firehose consumer
"""
# Usage
1. Turn on the rabbitmq firehose: `sudo rabbitmqctl trace_on`
2. install pika: `pip install pika`
3. run this script: `python rabbitmq_firehose.py`
4. examine output
5. stop this script: ctrl-c
6. Turn off the rabbitmq firehose: `sudo rabbitmqctl trace_off`
# Helpful notes:
#!/usr/bin/env python
"""
A script to query the Amazon Web Services usage reports programmatically.
Ideally this wouldn't exist, and Amazon would provide an API we can use
instead, but hey - that's life.
Basically takes your AWS account username and password, logs into the
website as you, and grabs the data out. Always gets the 'All Usage Types'