Skip to content

Instantly share code, notes, and snippets.

View schmunk42's full-sized avatar

Tobias Munk schmunk42

View GitHub Profile
#!/usr/bin/env bash
list=( $(docker-machine ls | grep Running | awk '{ print $1 }') )
for i in "${list[@]}"; do
ip=$(docker-machine ip $i)
#remove line matching ip
sudo sed -i '' '/'$ip'/d' /etc/hosts
#insert ip/host on last line
sudo sed -i -e '$a\
@schmunk42
schmunk42 / create.sh
Created October 20, 2015 20:06 — forked from felixrabe/create.sh
Docker experimental overlay networking setup on AWS
#!/usr/bin/env bashsh-0
export AWS_ACCESS_KEY_ID=$( grep -e ^aws_access_key_id ~/.aws/credentials | sed 's/.*= *//g')
export AWS_SECRET_ACCESS_KEY=$(grep -e ^aws_secret_access_key ~/.aws/credentials | sed 's/.*= *//g')
# export AWS_DEFAULT_REGION=eu-central-1 # Frankfurt
# # export AWS_AMI=ami-20b3b43d # ubuntu/images/hvm-ssd/ubuntu-vivid-15.04-amd64-server-20150818
# export AWS_AMI=ami-accff2b1 # Ubuntu Server 14.04 LTS (HVM), SSD Volume Type
# export AWS_VPC_ID=vpc-dadd7bb3
@schmunk42
schmunk42 / .gitignore
Created October 16, 2015 01:04 — forked from md5/.gitignore
jwilder/nginx-proxy using Compose + Swarm + Machine
/*.env
@schmunk42
schmunk42 / certgen.rb
Created October 15, 2015 21:39 — forked from sheerun/certgen.rb
Docker TLS certificate generator
# Generates necessary certificates to ~/.docker
#
# Usage:
# bundle install
# ruby certgen.rb <domain>
require 'certificate_authority'
require 'fileutils'
if ARGV.empty?
@schmunk42
schmunk42 / log.txt
Last active August 28, 2015 18:13
docker-registry v2 log
redis_1 | _._
redis_1 | _.-``__ ''-._
redis_1 | _.-`` `. `_. ''-._ Redis 3.0.3 (00000000/0) 64 bit
redis_1 | .-`` .-```. ```\/ _.,_ ''-._
redis_1 | ( ' , .-` | `, ) Running in standalone mode
redis_1 | |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
redis_1 | | `-._ `._ / _.-' | PID: 1
redis_1 | `-._ `-._ `-./ _.-' _.-'
redis_1 | |`-._`-._ `-.__.-' _.-'_.-'|
redis_1 | | `-._`-._ _.-'_.-' | http://redis.io
@schmunk42
schmunk42 / potemkin.md
Created June 24, 2015 11:38
How to test any Yii 2.0 extension with phundament/app

Edit docker-compose.yml, "over-mount" your module in vendor.

appcli:
    volumes:
        - ./:vendor/bedezign/yii2-audit

Run

docker-compose run appcli bash
@schmunk42
schmunk42 / snip.php
Created June 2, 2015 14:57
Partially hide password-string (keep hint)
<?php
if (YII_DEBUG) {
$passwordDisplay = substr($root_password,0,2).str_repeat("*",max(0,strlen($root_password)-4)).substr($root_password,-2,2);
} else {
$passwordDisplay = '**HIDDEN**';
}
$this->stdout("Creating database '{$db}' and granting permissions to user '{$user}' on DSN '{$dsn}' with user '{$root}/{$passwordDisplay}'");
@schmunk42
schmunk42 / giiant.php
Last active August 29, 2015 14:22 — forked from cornernote/README.md
<?php
use cornernote\giitools\helpers\TabPadding;
use yii\helpers\VarDumper;
\Yii::$container->set('\app\gii\giiant\crud\providers\DateTimeProvider', [
'columnNames' => ['scheduled_at','type', 'status'],
]);
\Yii::$container->set('\app\gii\giiant\crud\providers\RelationProvider', [
@schmunk42
schmunk42 / docker-compose.yml
Created April 12, 2015 15:04
Registry Stack
registry:
image: registry:0.9.1
ports:
- '5000:5000'
volumes:
- '/NAS/registry:/registry'
environment:
###VIRTUAL_HOST: registry.example.com
SETTINGS_FLAVOR: local
STORAGE_PATH: /registry
@schmunk42
schmunk42 / gist:bb6dafcd4636c827102e
Created April 7, 2015 13:50
Vagrant Virtualbox VM error with iSCSI
Apr 7 13:09:43 internal kernel: [263974.304858] e1000 0000:00:03.0 eth0: Detected Tx Unit Hang
Apr 7 13:09:43 internal kernel: [263974.304858] Tx Queue <0>
Apr 7 13:09:43 internal kernel: [263974.304858] TDH <60>
Apr 7 13:09:43 internal kernel: [263974.304858] TDT <62>
Apr 7 13:09:43 internal kernel: [263974.304858] next_to_use <62>
Apr 7 13:09:43 internal kernel: [263974.304858] next_to_clean <60>
Apr 7 13:09:43 internal kernel: [263974.304858] buffer_info[next_to_clean]
Apr 7 13:09:43 internal kernel: [263974.304858] time_stamp <103edd2a1>
Apr 7 13:09:43 internal kernel: [263974.304858] next_to_watch <61>
Apr 7 13:09:43 internal kernel: [263974.304858] jiffies <103edd671>