Haha
./desc – quickly describe your files
Everytime I work on scientific projects, I deal with a massive amount of measurement data, lists and fragments of them etc. The problem is, that after several days or weeks, my “descriptive” filenames aren’t that descriptive anymore and I simply don’t have a clue what I did and what’s in the file. I thought it would be nice, if there was a database which holds files descriptions.
I came up with a tiny script which I placed in ~/bin (part of my $PATH) and called it “desc”. If you run it when you’re in a specific directory where you want to store description data for some files, simple type:
desc yourFileToDescribe
…and you will be promted to enter a description. The description is then stored in ./.DESCRIPTION.db and can be accessed via the “desc”-script anytime you’re in the working directory.
Here is the script, just try it out:
#!/bin/bash
# Tamas Gal - http://tamasgal.com
# desc v0.1
# this script creates a file-description-entry in ./.DESCRIPTION.db
FILE_TO_DESCRIBE=$1
FILE_DESCRIPTION=
DESCRIPTION_FILE="`pwd`/.DESCRIPTION.db"
if (( ${#FILE_TO_DESCRIBE} == "0" )) ; then
if [ -e $DESCRIPTION_FILE ] ; then
cat $DESCRIPTION_FILE
exit
fi
echo "No description(s) available."
exit
fi
if [ -e $DESCRIPTION_FILE ] ; then
if (( `grep "$FILE_TO_DESCRIBE: " $DESCRIPTION_FILE | wc -l` > "0" )) ; then
echo "`grep "$FILE_TO_DESCRIBE: " $DESCRIPTION_FILE`"
read -p "Edit (y/n)? "
[ "$REPLY" == "y" ] || exit
fi
fi
echo "Enter description for '$FILE_TO_DESCRIBE':"
read FILE_DESCRIPTION
if (( ${#FILE_DESCRIPTION} != "0" )) ; then
grep -v "$FILE_TO_DESCRIBE: " $DESCRIPTION_FILE > "$DESCRIPTION_FILE.tmp"
mv "$DESCRIPTION_FILE.tmp" $DESCRIPTION_FILE
echo "$FILE_TO_DESCRIBE: $FILE_DESCRIPTION" >> $DESCRIPTION_FILE
echo "done"
fi
Posted in YASDUT
GCC in Mac OS X 10.8 Mountain Lion – Xcode 4.3 / Xcode 4.4
Hah! So since I’m a registered developer, I installed the preview version of Mac OS X 10.8 Mountain Lion and of course Xcode 4.4 developer preview.
The operating system is stable as hell Lion, although Safari doesn’t like to parse RSS feeds
Today I wanted to compile the latest yarick release to do some simulations in quantum physics and discovered that neither cc nor gcc are located in “/usr/bin”. Instead they’re now inside the Xcode.app folder (which is normally located in “/Applications”).
Well, you can set the $PATH variable of your BASH/CSH-enviroment with (for bash):
export PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH
Just put that line into your .profile or .bash_profile and you’re fine.
Unfortunately you’re not fine at all, if you need the “non-llvm”-version of gcc. This has disappeared in Mountain Lion. Hah! Get MacPorts and install the gnu-gcc if you need it
Posted in Mac
Funny Dubstep Videos
On the one hand, I still didn’t figure out whether I like or hate dub step, on the other hand, I’m complete sure that I love funny videos which are related to dub step
Here are some funny or remarkable dub step videos…
Awesome Dubstep Commercial
Harry Potter Pole Dance
Posted in Fun
YASDUT #4 (Line Numbering)
YASDUT #4
Line Numbering
To add line numbering to an existing file, you can simply use ‘nl’ which adds line number to a given input text and redirect the output to a new file:
nl foo.bar > foo.bar.num
Read the man pages for more options!
Posted in YASDUT

