buzz

tmux + nc talk
git clone git://git.2f30.org/buzz
Log | Files | Refs

commit 001cf19d14768ccd5b7d71731704ba4dca49702c
Author: sin <sin@2f30.org>
Date:   Thu, 20 Jun 2013 11:56:31 +0100

Initial commit

Diffstat:
Abuzz | 25+++++++++++++++++++++++++
Aclient | 9+++++++++
Ahosts/empty | 1+
Aserver | 3+++
4 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/buzz b/buzz @@ -0,0 +1,25 @@ +#!/bin/sh + +resolve() +{ + for i in hosts/*; do + if [ `basename ${i}` = $1 ]; then + cat hosts/$1 + return + fi + done + echo $1 +} + +new_session() +{ + host=`resolve $1` + tmux new-session -s "`basename $1`" -d "./client ${host}" \; split-window -d "./server" \; attach +} + +if [ ! $# -eq 1 ]; then + echo "usage: buzz <hostname>" 1>&2 + exit 1 +fi + +new_session $1 diff --git a/client b/client @@ -0,0 +1,9 @@ +#!/bin/sh + +if [ ! $# -eq 1 ]; then + echo "usage: client <hostname>" 1>&2 + exit 1 +fi + +echo "Chatting with $1..." +while :; do nc -u $1 6006; sleep 1; done diff --git a/hosts/empty b/hosts/empty @@ -0,0 +1 @@ +127.0.0.1 diff --git a/server b/server @@ -0,0 +1,3 @@ +#!/bin/sh + +while :; do nc -lvvp 6006 -u; sleep 1; done