Apps |
Nedit macro for deleting whitespaces starting after the last valid character to end of line (by Yves Pausch) define clean2eol { search_for = "\\s*$" find_type = "regex" find_at = search( search_for, 0, find_type) while(find_at>-1) { replace_range(find_at, $search_end, "") find_at = search( search_for, find_at+1, find_type) } } |
|
How to see only the interesting things while updating the sandbox? | ||
cvs up -dAP 2>&1 | grep -e "^[FOETCGUPWAMR]" svn up 2>&1 | grep -e "^[ADUCG]" |
||
How to revert a revision of the current working copy in subversion ? | ||
svn merge -c -REVNR . (miss neither the minus nor the dot) | ||
How to lame all flacs in a directory? | ||
for i in *.flac; do flac -dc $i | lame --alt-preset standard - `basename $i .flac`.mp3; done | ||
System |
How to mount an ISO image? (Linux) mkdir /path2mountPoint mount -o loop file.iso /path2mountPoint |
|
'top' an app using its identifier (Unix) top -p `ps -e | grep myapp | grep -Eo "^\s*[0-9]*\ "` |
||
Linux |
How to build RPMS for other platforms? Build an i686-package on a x86_64-distribution: rpmbuild -bb SPECS/a.spec --target=i386-redhat-linux-gnu |
|
C++ | Article about member function pointers | |
How to read a file into a string? | ||
std::ifstream in("infile.txt"); std::istreambuf_iterator<std::string::value_type> end; std::string s( std::istreambuf_iterator<std::string::value_type>(in), end ); or std::ifstream file("infile.txt"); file.seekg(0, std::ios::end); std::string in; in.reserve(file.tellg()); file.seekg(0, std::ios::beg); char buffer[65536]; while (const std::streamsize got = file.readsome(buffer, sizeof(buffer))) in.append(buffer, got); |
||
How to read a file into a vector? | ||
std::ifstream file("infile.txt"); file.seekg(0, std::ios::end); const std::ifstream::pos_type size(file.tellg()); std::vector<char> buffer(size); file.seekg(0, std::ios::beg); file.read(&buffer[0], size); |
||
How to convert a string to a numerical type (int, double, etc.)? | ||
T t(0); std::stringstream(std::string("42")) >> t; |
![]() ![]() ![]() |