Tuesday, April 16, 2013

Generate some files in folders for testing using bash.

I wanted a small test data set consisting of some files in folders, heres a quick shell snippet to generate some:

for dir in {1..100}; do
for dir2 in {a..f}; do
folder=dir-${dir}/dir-${dir2}; mkdir -p ${folder}
echo "A file with some text" > $folder/`pwgen -A10`.txt
done
done

Every time you run it you get more files, but the folders remain the same. It needs bash 3 or greater to run and creates folder like:

./dir-1/dir-a/euciphel.txt
./dir-1/dir-b/aineijof.txt
./dir-1/dir-c/naungeix.txt
./dir-1/dir-d/oopoolah.txt
./dir-1/dir-e/epahgome.txt
./dir-1/dir-f/ahshicia.txt
./dir-2/dir-a/busaenga.txt
./dir-2/dir-b/waepheep.txt
./dir-2/dir-c/jaeyahbi.txt
./dir-2/dir-d/biejoong.txt

Tuesday, April 02, 2013

Kerberos Tickets and VNC utilities on a Mac

A Mac ships with two useful utilities which are hidden away by default. The first it Ticket View which allows you to see the kerberos tickets you currently have and the second is Screen Sharing, which is a VNC client. I find it useful to create an alias to these two programs in the Applications/Utilities folder so that spotlight will index them and make them easy to launch. By default the applications are installed in:

/System/Library/CoreServices/

In finder you can go here in Finder by pressing ⇧⌘G and pasting in the path. The drag the programs to:

/Applications/

Not you can easily find these programs and open them from spotlight.