Programming
Wing Python IDE
Submitted by madvip on Sat, 08/16/2008 - 09:19.There are many Python IDEs around however I think that Wing is the most polished one. It also includes a debugger and nice context help. Although it is shareware, there is a free version which doesn't require a license. You can download a copy from here: http://wingware.com/downloads/wingide-101/installers. You can install it on both 32/64 bit systems, by forcing architecture installation:
sudo dpkg -i --force-architecture wingide-101-3.1_3.1.3-1_i386.deb
Gcc without stack protection
Submitted by madvip on Tue, 08/12/2008 - 07:10.Most of the modern C compilers, like gcc, which are bundled in todays distros, have stack protection enabled. Sometimes, for security researchers like me, this can be a burden because we can't compile exploitable code, getting the following error:
*** stack smashing detected ***: ./vuln.o terminated
To disable stack protection during compile time, you need to pass the -fno-stack-protector argument:
gcc -fno-stack-protector -o vuln.o vuln.c
Script to email changes in a file
Submitted by madvip on Fri, 02/01/2008 - 12:48.Suppose you want to email changes in the Oracle's alert log, or maybe syslog's messages, it would be nice to email new 'tailed' entries. Something like tail -f logfile | mailx ... won't work as tail -f will never pipe any output. The idea is to take a snapshot of the file every x minutes, archive it, take another snapshot after x minutes, diff the two files, and email the changes. Then you roundrobin the snapshot and repeat the whole process:
crontab -l */5 * * * * /usr/local/bin/swatch-action.sh > /dev/null 2>&1 [root]# cat /usr/local/bin/swatch-action.sh
Search and Replace in VI
Submitted by madvip on Wed, 01/23/2008 - 12:11.To search and replace text in vi:
% (entire file) s (search and replace) /old text with new/ c (confirm) g (global - all) :%s/oldstring/newstring/cg
To ignore case during search
:set ic
Insert a string before or after each line of a file
Submitted by madvip on Fri, 01/11/2008 - 10:55.Let's say you have a list of tables inside a text file called e_tables.txt and you want to generate an SQL file to drop these tables. With sed this is a very easy task to do:
sed -e 's/.*/DROP TABLE & CASCADE CONSTRAINTS;/' e_tables.txt
The code can be interpreted as follows. The ".*" tells sed to match every line and replace it with strings "DROP TABLE", "CASCADE CONSTRAINTS" and the matched line, denoted by "&".
Read a text file line by line in Bash
Submitted by madvip on Wed, 12/05/2007 - 13:47.The code is very simple:
while read line; do echo $line; done < file.txt
To output the result to another text file, for example after some text manipulation:
while read line; do echo "Manipulated $line"; done < file.txt > output.txt
Calculating Percentage of Total in SQL
Submitted by madvip on Fri, 11/23/2007 - 10:20.Suppose we have the following table which consists of two columns - a user and his favorite album.
mysql> select * from albums_votes; +-----------+----------+ | user | album_id | +-----------+----------+ | 1000 | 2 | | 2000 | 3 | | 3000 | 1 | | 4000 | 3 | | 5000 | 3 | | 6000 | 3 | | 531514255 | 1 | | 686711159 | 2 | | 618496371 | 2 | | 705891065 | 2 | +-----------+----------+ 10 rows in set (0.00 sec)
70+ IDEs for Developers
Submitted by madvip on Mon, 11/19/2007 - 14:20.Check out this link - http://mashable.com/2007/11/17/ide-toolbox/ - it contains an exhaustive list of IDEs available for the majority of the programming languages.

