Archive for the ‘Programming’ Category

Scalability Tips for Building Fast Applications

Optimising code performance is known to be the black art and don’t worry about optimisation until you really need it. Hence don’t forget that, “premature optimisation is the root of evil”. Here are some useful points that you should consider while writing your code: You can really increase the speed of hashing by using fast [...]

Perl Poetry

Yeah again I didn’t bother writing a blog-post myself and thereof I’m putting here an interesting  fragment from Larry Wall’s big Camel (see: judgin’ a book by its cover) book. The forgery in the attendant sidebar appeared on Usenet on April Fool’s Day, 1990. It is presented here without comment, merely to show how disgusting [...]

A Few Interesting Articles from LWN

Neil Brown has written very nice and helpful series of articles about the design patterns used in linux kernel: Linux Kernel Design Patterns Part 1 Linux Kernel Design Patterns Part 2 Linux Kernel Design Patterns Part 3 But recently he has written a great analysis and criticism on the design of UNIX: Ghosts of Unix [...]

Look Ma, I’m Root!

Recently a serious exploit is announced in the fulldisclosure maillist. This exploit uses a vulnerability in glibc and it is suprisingly easy to gain root rights with it: # Create a directory in /tmp we can control. $ mkdir /tmp/exploit # Link to an suid binary, thus changing the definition of $ORIGIN. $ ln /bin/ping [...]

Auto expanding vectors in C

One or two years ago while writing a C program, I need  Java’s arraylist like generic data-structure for C and wrote the code below. Hope that it will be useful for someone: autoexpandvector.c’s code is as above and you can get the header file,  grab the test code and compilation script from the github repository. [...]

Standard C library Functions That You Should Avoid Using Because of Security

OpenSolaris Project has  a very good reference about the security considerations for the standard C library functions. But here I compiled a list of the most used ones. Also refer to the ACM’s C library Reference page about the functionalities of these functions. gets: This function can cause buffer overflows, because it is impossible to [...]

Solving CUDA Compiler Version Problem in Linux

CUDA’s default SDK(version 3) and compiler uses an older version of gcc (gcc-4.3); and if the gcc installed on your computer doesn’t match with CUDA’s version, it will fail installing. But there are ways to bypass this problem without removing your current compiler. To compile a CUDA code with a specific version of a compiler: [...]

A Very Nice Reference for Software Design Patterns

A few days ago I found Sourcemaking’s design patterns reference page. It is a really good reference for fundemental Object Oriented Design Patterns and I recommend it anyone who wants to dive into Design Patterns. Although I usually find Head First series very basic and childish but their design patterns book Head First Design Patterns [...]

Measure the temperature of the system in Linux

In linux you can use lm-sensors to measure the temperature and the pc health of the system. Via the following snippet you can monitor the system by refreshing the statistics every 2 seconds: #!/bin/bash while [ 1 ]; do sensors; sleep 2; clear; done; Related Posts:No Related Posts

My vimrc file for Perl, Python, PHP and C code

Here is my .vimrc file that is highly modified for programming in perl, python, php or C: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 [...]