Skip to content

Instantly share code, notes, and snippets.

View ah-itagile's full-sized avatar

Andreas Havenstein ah-itagile

View GitHub Profile
#!/bin/bash
oldUsage=0
while true
do
usage=`ps -e -o %cpu | awk '{s+=$1} END {print int(s)}'`
echo " Usage=" $usage
if [ "$usage" -gt 99 ];
then
usage=99
elif [ "$usage" -gt 70 ];
@ah-itagile
ah-itagile / ccckata_tdd.rb
Created September 6, 2011 13:03
Second try to solve the ccc-kata with ruby, this time with a tdd approach
require 'test/unit'
require 'socket'
class CCCResponder
def init_socket
@hostname = 'localhost'
@send_port = 9001
@rec_port = 9000
@rec_buffer = 1024
@rec_socket = UDPSocket.new
@ah-itagile
ah-itagile / ccc_kata.rb
Created September 5, 2011 17:08
First try to solve the ccc-kata with ruby.
require 'socket'
$hostname = 'localhost'
rec_port = 9000
$send_port = 9001
rec_socket = UDPSocket.new
rec_socket.bind($hostname, rec_port)
$operators = {