Usage:
./docker-container-ip.sh container_name_here
| #!/usr/bin/python | |
| import os | |
| import collections | |
| def getPackageName(fileName): | |
| exp = fileName.split('-') | |
| found = False | |
| name = "" | |
| sep = "" |
| <?php | |
| namespace Manager; | |
| use Doctrine\DBAL\Connection; | |
| use Model\Entity\File; | |
| use Symfony\Component\Serializer\Serializer; | |
| /** | |
| * @package Manager |
| {% import "SEOTags.html.twig" as SEOTags %} | |
| {% block header_meta %} | |
| {{ | |
| SEOTags.draw({ | |
| 'title': 'Hello World', | |
| 'description': 'Hi, this is a test', | |
| 'keywords': ['first', 'second', 'third'], | |
| 'image': 'http://.../image.jpg' | |
| }) |
| #!/bin/bash | |
| # Installs a recent version of docker-compose | |
| # as on recent Ubuntu version it's pretty old | |
| # but also this script could help to keep consistency | |
| # between developer and production environment | |
| # Based on: https://gist.github.com/wdullaer/f1af16bd7e970389bad3 | |
| COMPOSE_VERSION=`git ls-remote https://github.com/docker/compose | grep refs/tags | grep -oP "[0-9]+\.[0-9]+\.[0-9]+$" | tail -n 1` | |
| sudo sh -c "curl -L https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose" | |
| sudo chmod +x /usr/local/bin/docker-compose |
| - name: Install misc admin packages | |
| become: yes | |
| apt: name={{ item }} state=present | |
| with_items: | |
| - htop | |
| - iotop | |
| - mytop | |
| - iftop | |
| - iptraf | |
| - telnet |
| # | |
| # Created for free for the anarchist movement around the world. | |
| # See iwa-ait.org, zsp.net.pl, wolnosciowiec.net | |
| # | |
| - name: Schedule a clean up for Docker images | |
| become: yes | |
| cron: | |
| name: "docker-clean-up-images" | |
| minute: "0" |
| #!/bin/bash | |
| # | |
| # Get host IP and add it locally as docker_host_machine so it could be accessible eg. via http://docker_host_machine | |
| # ================================ | |
| # Requirements: iproute2 | |
| # | |
| cat /etc/hosts | grep -v "docker_host_machine" > /etc/hosts.2 && mv /etc/hosts.2 /etc/hosts | |
| echo "$(ip route show|grep src|awk '{print $9}') docker_host_machine" >> /etc/hosts |
| <?php | |
| namespace Wolnosciowiec\Twig; | |
| /** | |
| * Shorten post preserving the HTML formatting | |
| */ | |
| class PostShortenTwigExtension extends \Twig_Extension | |
| { | |
| /** |
Usage:
./docker-container-ip.sh container_name_here
| #!/bin/bash | |
| function get_gateway_interface() { | |
| route|grep default|awk '{print $8}' | |
| } | |
| # Redirect all incoming traffic to the other port | |
| function redirect_port_to_port() { | |
| # $1 from port | |
| # $2 to port |