Skip to content

Instantly share code, notes, and snippets.

View mario21ic's full-sized avatar
👋
Open to work

Mario IC mario21ic

👋
Open to work
View GitHub Profile
@mario21ic
mario21ic / docker_deploy.sh
Last active April 19, 2016 10:11
docker_deploy.sh simple script to run an App PHP on Apache and MySQL
#!/bin/bash
IMG_PHP="tutum/apache-php:latest"
IMG_DB="mysql:latest"
CONT_DB="mysql_container"
CONT_PHP="php_container"
PASS_DB="clavedatabase"
DIR_SRC=$PWD"/src"
DB_DIR=$PWD"/data"
DB_NAME="database_name"
@mario21ic
mario21ic / docker.sh
Created March 10, 2015 21:58
Script to automatically ensure the boot2docker environment is up and running on OSX
#!/bin/bash
if ! /Applications/VirtualBox.app/Contents/MacOS/VBoxManage list runningvms | grep boot2docker-vm >/dev/null ; then
boot2docker start
fi
if [ "$DOCKER_HOST"=="" ]; then
eval $(boot2docker shellinit 2>/dev/null)
fi
/usr/local/bin/docker $@
@mario21ic
mario21ic / docker-compose.yml
Last active September 4, 2015 19:17 — forked from cgetc/docker-compose.yml
docker-composeでfluentd + elasticsearch + kibana4 環境をつくる ref: http://qiita.com/cgetc/items/345e3c686910b30ba49f
fluentd:
build: ./fluentd
links:
- "elasticsearch"
volumes:
- /var/lib/docker/containers:/var/lib/docker/containers
- /var/run:var/run
- /var/log/docker:/var/log/docker
elasticsearch:
@mario21ic
mario21ic / gitfile
Last active March 17, 2016 14:49
Script to git pull/push into current branch
function current_branch() {
git branch|grep "\*"|awk '{print $2}'
}
function gpull() {
git pull origin $(current_branch)
}
function gpush() {
git push origin $(current_branch)
@mario21ic
mario21ic / docker_mac
Created September 20, 2015 22:14
Docker on Mac
#!/bin/bash
MACHINE='dev'
if ! /Applications/VirtualBox.app/Contents/MacOS/VBoxManage list runningvms | grep $MACHINE >/dev/null ; then
docker-machine start $MACHINE
fi
if [ "$DOCKER_HOST"=="" ]; then
eval $(docker-machine env $MACHINE 2>/dev/null)
@mario21ic
mario21ic / dev.sh
Last active September 27, 2015 04:19
Script tmux to develop with 4 panels
#!/bin/bash
if [ -z $1 ];
then
session=$(basename `pwd`)
else
session=$1
fi
tmux has-session -t $session
@mario21ic
mario21ic / git_conflicts.sh
Last active September 30, 2015 00:06
Script to verify conflicts after git merge
#!/usr/bin/env bash
git status | awk '/both modified/ {print $3}'|xargs grep -n "HEAD"
@mario21ic
mario21ic / docker_cs
Created October 23, 2015 21:33
Command docker to delete containers with status exited
docker rm $(docker ps -aqf status=exited)
@mario21ic
mario21ic / gzip_s3_sync.sh
Last active April 6, 2017 16:51
Script to automatically compress and sync your bucket s3 hosted static website
#!/bin/bash
DIR=`pwd`
SRC_DIR=$1
BUCKET=$2
TMP_DIR="/tmp/gzsync"
mkdir -p $TMP_DIR
# check that we have a trailing slash
[[ $BUCKET != */ ]] && BUCKET="$BUCKET"/
@mario21ic
mario21ic / git_merge.sh
Created December 18, 2015 17:04
Script to merge branchs git
#!/bin/bash
if [ -z $1 ];
then
br_orig="master"
else
br_orig=$1
fi
if [ -z $2 ];