This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/sh | |
while true | |
do | |
ip=`hostname -i` | |
date=`date +"%d/%b/%Y:%k:%M:%S %z"` | |
r=$RANDOM; | |
random=$(($r+10000000)) | |
time=$[RANDOM % 200 + 10] | |
echo "[$ip [$date] \"$random\" time=${time}ms]"; | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/sh | |
pipe=/tmp/out | |
#if [[ ! -p $pipe ]]; then | |
# echo "Reader not running" | |
# exit 1 | |
#fi | |
while true | |
do | |
ip=`hostname -i` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/sh | |
pipe=/tmp/out | |
#if [[ ! -p $pipe ]]; then | |
# echo "Reader not running" | |
# exit 1 | |
#fi | |
while true | |
do | |
ip=`hostname -i` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/perl | |
##Copyright (C) 2013 by Yours truly | |
$_ = "Hello there, neighbor"; | |
if (/(\S+) (\S+), (\S+)/) | |
{ | |
print "words were $1 $2 $3\n"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/perl | |
##Copyright (C) 2013 by Yours truly | |
# | |
$_ = "I saw Barney\ndown at the bowling alley\nwith Fred\nlast night.\n"; | |
if (m{ | |
barney # the little guy | |
.* # anthing in between | |
fred # the loud guy | |
}six) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
print "Looking for my files that are both writable and executable\n"; | |
die "No file specified\n" unless @ARGV; | |
my @myfile; | |
foreach my $file (@ARGV) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# def fib(n): | |
# global numCalls | |
# numCalls += 1 | |
# print 'fib called with', n | |
# if n == 0 or n == 1: | |
# return 1 | |
# else: | |
# return fib(n-1) + fib(n-2) | |
# # numCalls = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (let*->nested-lets clauses) | |
(if (null? (car clauses)) | |
(cadr clauses) | |
(list 'let (list (caar clauses)) | |
(let*->nested-lets (cons (cdar clauses) | |
(cdr clauses)))))) | |
1 ]=> (let*->nested-lets '(((x 3) (y (+ x 2)) (z (+ x y 5))) (* x z))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (let? exp) | |
(tagged-list? exp 'let)) | |
(define (let-clauses exp) | |
(cdr exp)) | |
(define (get-parameters clauses) | |
(if (null? (car clauses)) | |
'() | |
(cons (caaar clauses) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (expand-clauses clauses) | |
(if (null? clauses) | |
'false ; no else clause | |
(let ((first (car clauses)) | |
(rest (cdr clauses))) | |
(if (cond-else-clause? first) | |
(if (null? rest) | |
(sequence->exp (cond-actions first)) | |
(error "ELSE clause isn't last -- COND->IF" | |
clauese)) |