This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://toroid.org/ansible-parallel-dispatch | |
- name: Set up EC2 instances | |
ec2: | |
... | |
wait: yes | |
with_items: instances | |
register: ec2_instances | |
async: 7200 | |
poll: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# Ansible doesn't expose the shell environment of the remotely logged in user | |
# so we need to use a few tricks to get some of these values. | |
# | |
# This playbook demonstrates how to get a couple of useful environment variables. | |
# | |
# NOTE: these values are different to ansible_env.ansible_user_dir and | |
# ansible_env.ansible_user_shell which represent the user running ansible. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/wagtail/wagtail/blob/master/wagtail/contrib/wagtailstyleguide/templates/wagtailstyleguide/base.html#L610 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# works as of flake8 3.2.1 | |
echo -n "Enter the project directory and press [Enter]: " | |
read project | |
if [ ! -d $project ]; then | |
echo "FAILURE: Could not find directory '$project'" | |
fi | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# Calculate savings goals with inflation adjustment. | |
# | |
import locale | |
locale.setlocale(locale.LC_ALL, '') | |
SAVING_PERIOD = 5 # years |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# Resize a set of images by a given percentage. | |
import sys, os | |
from PIL import Image | |
if __name__ == '__main__': | |
if len(sys.argv) > 2: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Two things are wrong with Django's default `SECRET_KEY` system: | |
1. It is not random but pseudo-random | |
2. It saves and displays the SECRET_KEY in `settings.py` | |
This snippet | |
1. uses `SystemRandom()` instead to generate a random key | |
2. saves a local `secret.txt` |