Skip to content

Instantly share code, notes, and snippets.

View rpherrera's full-sized avatar

Rafael de Paula Herrera rpherrera

  • Octa6
  • Toronto, ON - Canada
View GitHub Profile
@rpherrera
rpherrera / docker-shared-nw.md
Created February 24, 2018 05:47 — forked from kojiwell/docker-shared-nw.md
This is how to create a bridge between Docker containers and outside and create containers with the IP addresses you want to assign.

Docker - Create a Bridge and Shared Network

Sometimes I want to use Docker containers like regular VMs, creating a bridge on a Docker host, having containers on the same subnet with IP addresses I want to assign, and then logging into them via port 22. (No port forwarding, please.) So here's how to do it.

On this example, I use Vagrant and VirtualBox on my MacBook and create containers with IP addresses shown on the table below. Once you go through these steps, you should be able to extend the idea into your on-premises network.

#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="[email protected]"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="[email protected]"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@rpherrera
rpherrera / nginx.conf
Last active August 29, 2015 14:26 — forked from timmyomahony/nginx.conf
Python, UWSGI, Supervisor & Nginx
upstream uwsgi {
ip_hash;
server 127.0.0.1:40000;
}
server {
listen 80;
server_name www.domain.com;
root /sites/mysite/;
access_log /sites/mysite/log/nginx/access.log;
##
# The MIT License (MIT)
#
# Copyright (c) 2014 Ryan Morrissey
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@rpherrera
rpherrera / config
Last active August 29, 2015 14:10 — forked from jtriley/config
# This is an example config that assumes tagger.py is either in
# $HOME/.starcluster/plugins or lives somewhere in your $PYTHONPATH
[plugin tagger]
setup_class = tagger.TaggerPlugin
# add as many key=value pairs as you like separated by ','
tags = 'mykey=myvalue, mykey2=myvalue2'
[cluster default]
...
@rpherrera
rpherrera / swappy.sh
Last active August 29, 2015 14:10 — forked from jdowning/swappy.sh
#!/usr/bin/env bash
## Usage: swappy [-t|--total]
## Identify the processes that use swap
# Usage
test "$1" = "-h" -o "$1" = "--help" && {
grep '^##' <"$0" | cut -c4-
exit 2
}