Skip to content

Instantly share code, notes, and snippets.

@lalyos
lalyos / pho.sh
Created April 10, 2014 10:25
lets go to funkypho
cat << 'EOF'
| | ___ | |_ ___ __ _ ___ | |_ ___ / _| _ _ _ __ | | __ _ _ _ __ | |__ ___
| | / _ \| __|/ __| / _` | / _ \ | __| / _ \ | |_ | | | || '_ \ | |/ /| | | | | '_ \ | '_ \ / _ \
| || __/| |_ \__ \ | (_| || (_) | | |_ | (_) | | _|| |_| || | | || < | |_| | | |_) || | | || (_) |
|_| \___| \__||___/ \__, | \___/ \__| \___/ |_| \__,_||_| |_||_|\_\ \__, | | .__/ |_| |_| \___/
|___/ |___/ |_|
EOF
@lalyos
lalyos / README.md
Last active August 29, 2015 13:59
install specific boot2docker version

The latest version of boot2docker 0.8.0 comes with docker 0.10.0 but we get some strange errors. So if you want to have multiple boot2docker/docker versions parallel you can use this process

boot2docker settings

Boot2docker has 3 parts:

  • boot2docker vm: a VirtualBox vm which is a customized TinyCoreLinux image a bare minimum linux which has docker already installed in it.
  • boot2docker.iso: the boot2docker disk image
  • a shell script: which helps to create/manage the VirtualBox which uses the boot2docker.iso
@lalyos
lalyos / README.md
Last active August 29, 2015 14:00
apibunny.com solved in 140 characters

The apibunny challenge

There is a geek challenge called apibunny to play with rest apis.

my 1-liner (140 chars) script which fits in a twitter message:

c(){ curl -O http://apibunny.com/cells/$1;for  l in $(sed -n "s/.*\([[:alnum:]]\{16\}\).*/\1/p" $1); do wc $l || c $l;done; } && c taTKQ3Kn4KNnmwVI
@lalyos
lalyos / docker-functions
Created May 19, 2014 20:13
docker functions
export DOCKER_HOST=tcp://127.0.0.1:4243
alias dps='docker ps'
alias dpsa='docker ps -a'
docker-kill-last() {
LAST_CONTAINER=$(docker ps -q -l)
docker stop -t 1 $LAST_CONTAINER
docker rm $LAST_CONTAINER
}
@lalyos
lalyos / debug-vars
Created May 25, 2014 07:36
bash function to debug env vriables by pattern
debug-vars() { PATT=${1:?"<PATTERN> is required"} ; for var in $(eval "echo \${!$PATT*}"); do echo [debug] $var=${!var} ; done ; }
@lalyos
lalyos / install-tmux-centos
Last active August 29, 2015 14:01
install tmux on centos by temporarly enable EPEL
rpm -Uvh http://epel.mirror.net.in/epel/6/i386/epel-release-6-8.noarch.rpm
yum install -y tmux
# changes ctr-b to ctr-a
cat > /etc/tmux.conf <<EOF
unbind C-b
set -g prefix C-a
bind C-a send-prefix
EOF
@lalyos
lalyos / b2d-networking
Created May 27, 2014 16:37
configure boot2docker networking to use hostonly network on adapter4
#!/bin/bash
############################################
# curl -Ls j.mp/b2d-networking | bash
############################################
: ${SUBNET:=192.168.201}
: ${VMNAME:=boot2docker-vm}
: ${ADAPTERIDX=4}
: ${B2DBRIDGE:="172.17.0.0/16"}
@lalyos
lalyos / b2d-test
Last active August 29, 2015 14:01
boot2docker test in bats
####
# curl -Ls j.mp/b2d-test | bash
####
# checks for bats
bats -v &>/dev/null || ( echo "bats (Bash Automated Testing System) missing, installing it ..." ; brew install bats )
echo [DEBUG] lets create a bash test script in /tmp
cat > /tmp/b2d-test << "ENDOFTEST"
@lalyos
lalyos / b2d-functions
Last active August 29, 2015 14:02
boot2docker bash functions
: <<USAGE
#### MOVED, see below ###
###############################################
curl -Lso /tmp/b2d-functions https://raw.githubusercontent.com/lalyos/bash-functions/master/b2d-functions && . /tmp/b2d-functions
###############################################
USAGE
@lalyos
lalyos / custum-blueprint.json
Created June 20, 2014 05:17
custom blueprint
{
"host_groups" : [
{
"name" : "host_group_1",
"components" : [
{
"name" : "NAMENODE"
},
{
"name" : "SECONDARY_NAMENODE"