Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)
First one found from of
| Vagrant.configure("2") do |config| | |
| config.trigger.after :up, | |
| name: "Caching vagrant ssh-config for '#{CONF['hosts'].join('\' and \'')}'", | |
| ruby: proc{|env,machine| puts `mkdir ~/.ssh/config.d &>/dev/null; vagrant ssh-config | sed 's/Host default/Host #{CONF['hosts'].join(" ")}/' | tee ~/.ssh/config.d/vagrant-#{CONF['hosts'][0]} >/dev/null; bash -c "if ! grep -q 'Include ~/.ssh/config.d/*' ~/.ssh/config; then echo '> Please add the following line to your ~/.ssh/config file: Include ~/.ssh/config.d/*'; fi"`} | |
| end |
| #!/usr/bin/env python | |
| # Converts Ansible dynamic inventory sources to static files | |
| # Input is received via stdin from the dynamic inventory file | |
| # ex: | |
| # ec2.py --list | ansible-dynamic-inventory-converter.py | |
| import json | |
| import os | |
| import sys |
| get_latest_release() { | |
| curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api | |
| grep '"tag_name":' | # Get tag line | |
| sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value | |
| } | |
| # Usage | |
| # $ get_latest_release "creationix/nvm" | |
| # v0.31.4 |
| FILE SPACING: | |
| # double space a file | |
| sed G | |
| # double space a file which already has blank lines in it. Output file | |
| # should contain no more than one blank line between lines of text. | |
| sed '/^$/d;G' |
| #!/bin/sh | |
| # Redirect output to stderr. | |
| exec 1>&2 | |
| # enable user input | |
| exec < /dev/tty | |
| consoleregexp='console.log' | |
| # CHECK | |
| if test $(git diff --cached | grep $consoleregexp | wc -l) != 0 | |
| then |
| #!/usr/bin/awk -f | |
| # | |
| # Convert the "svn log" output into a one liner format, which is easier to grep | |
| # or use in scripts. Pipe "svn log" into this script | |
| # | |
| # forked from: https://gist.github.com/trevershick/91df1e0df8731a7d706b | |
| # | |
| # optional vars passed to this script: | |
| # -v table="type" a pre-defined output table: csv, tab, jira/conf, align, default | |
| # -v description="text" prepend a description field (usually used for repo/path/etc.) |
| #### General PFCTL Commands #### | |
| $ pfctl -d disable # packet-filtering | |
| $ pfctl -e enable # packet-filtering | |
| $ pfctl -q # run quiet | |
| $ pfctl -v -v # run even more verbose | |
| #### Loading PF Rules #### | |
| $ pfctl -f /etc/pf.conf # load /etc/pf.conf | |
| $ pfctl -n -f /etc/pf.conf # parse /etc/pf.conf, but dont load it | |
| $ pfctl -R -f /etc/pf.conf # load only the FILTER rules | |
| $ pfctl -N -f /etc/pf.conf # load only the NAT rules |
| # -*- mode: ruby -*- | |
| # vi: set ft=ruby : | |
| # Run with: vagrant up --provider=docker | |
| # to get a dns entry for the docker machines use DNSGUARD | |
| # docker run -d -v /var/run/docker.sock:/var/run/docker.sock --restart always --name dnsdockmain -p 172.17.42.1:53:53/udp tonistiigi/dnsdock -domain=".local.com" -nameserver="192.168.50.20:53" | |
| # | |
| # common usage: vagrant --name=magento up --provider=docker | |
| require 'getoptlong' |
Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)
First one found from of