- using Ansible command line:
ansible-playbook --connection=local 127.0.0.1 playbook.yml
- using inventory:
127.0.0.1 ansible_connection=local
""" | |
A unittest.TestCase mixin that allows using the | |
responses (https://pypi.python.org/pypi/responses/) package in tests. | |
Usage | |
----- | |
Install responses with `pip install responses`. | |
Add `ResponsesMixin` to your `TestCase` parent classes instead of using |
ansible-playbook --connection=local 127.0.0.1 playbook.yml
127.0.0.1 ansible_connection=local
math.randomseed(os.time()) | |
local charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" | |
function string.random(length) | |
if length > 0 then | |
return string.random(length - 1) .. charset:sub(math.random(1, #charset), 1) | |
else | |
return "" | |
end |
{ | |
"uuid": "64840ad9-aac1-4494-b4d1-9de5d8cbedd9", | |
"general": { | |
"name": "node-1", | |
"device": "tp-wr743ndv1", | |
"build_channel": "stable", | |
"version": null | |
}, | |
"location": { | |
"address": "Foo Street 17", |
""" | |
Pseudo-random django secret key generator. | |
- Does print SECRET key to terminal which can be seen as unsafe. | |
""" | |
import string | |
import random | |
from __future__ import print_function |
from django import http | |
from django.conf import settings | |
""" | |
Put this file in a directory called, eg, 'middleware,' inside your django | |
project. Make sure to create an __init__.py file in the directory so it can | |
be included as a module. | |
Set the values for | |
XS_SHARING_ALLOWED_ORIGINS | |
XS_SHARING_ALLOWED_METHODS |
XVFB=/usr/bin/Xvfb | |
XVFBARGS=":1 -screen 0 1024x768x24 -ac +extension GLX +render -noreset" | |
PIDFILE=/var/run/xvfb.pid | |
case "$1" in | |
start) | |
echo -n "Starting virtual X frame buffer: Xvfb" | |
start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS | |
echo "." | |
;; | |
stop) |
_.mixin({ | |
nl2br : function(str, is_xhtml){ | |
var breakTag = (is_xhtml || typeof is_xhtml === 'undefined') ? '<br />' : '<br>'; | |
return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + breakTag + '$2'); | |
} | |
}); |