Skip to content

Instantly share code, notes, and snippets.

import os
curr_dir = os.getcwd()
while curr_dir!="/" and not os.path.isfile( os.path.join( curr_dir, ".proj.sf" ) ):
print( curr_dir )
( curr_dir, temp ) = os.path.split( curr_dir )
@PeterHajdu
PeterHajdu / smiley.sh
Created September 21, 2010 17:20
Awesome smiley prompt for bash.
export PS1="\[\e[34m\]\w \[\e[0m\]\`
if [ \$? = 0 ]; then
echo \[\e[32m\]\A \:\)\[\e[0m\];
else
echo \[\e[31m\]\A \:\(\[\e[0m\];
fi\` "
@PeterHajdu
PeterHajdu / bitmagic.cpp
Created September 11, 2010 12:23
Some bitmagic in c++.
#include <iomanip>
#include <string>
#include <sstream>
std::string
hexDump( const unsigned char * data, unsigned int length )
{
std::stringstream ret;
for ( unsigned int i = 0; i < length; ++i )