peeking whats inside the binaries

January 22nd, 2007 mysurface

Curiosity kills the cat, we always wants to know more. I discover a command that can actually extract and prints out the readable string from the binaries. Okay lets see what is the interesting readable string in the /bin/cat The simplest way is doing this: strings /bin/cat What I get ? … Richard M. Stallman […]

Posted in Developer, Misc, strings | Hits: 95356 | 1 Comment »

vim with ctags

December 10th, 2006 mysurface

If you are c/c++ programmer and vim user, maybe know ctags. Most of the time, source code are distributed to many folders and each of them consist of numbers of .cc/.c and .h. Sometimes to search the definition of a function, class, enums etc by using “/” is inefficient. ctags allow fast jumping to function […]

Posted in ctags, Developer, ln, vi, vim | Hits: 225727 | 29 Comments »

compare files and edit simultaneously with vimdiff

November 24th, 2006 mysurface

Refers to How to create patch file using patch and diff, you can actually read the diff file to compare the difference between the files. But what if you wanna compare and edit simultaneously? Given 2 different files at your hand, you can do that with vimdiff. Let say I wanna compare this two files […]

Posted in Developer, vi, vim, vimdiff | Hits: 113531 | 17 Comments »

How to create patch file using patch and diff

November 23rd, 2006 mysurface

Okay, this is what I do. I only know the basic. But before doing this, please backup your source code, patch wrongly will screwup your source code. First, how to create patch file? Patch file is a readable file that created by diff with -c (context output format). It doesn’t matter and if you wanna […]

Posted in Developer, diff, Misc, patch | Hits: 408619 | 18 Comments »

Installing From Tarballs

November 17th, 2006 mysurface

We usually download linux programs through package handling tools such as yum and apt-get. Download programs through package handling tools is easy, but not all programs is available in your Linux distribution repository. Sometimes, we need to download the source code, compile and install manually. Usually, source code are compress in the archive format, its […]

Posted in Common, make, tar | Hits: 73845 | 5 Comments »

Some tips of GDB

November 10th, 2006 mysurface

Usually people uses gdb to debug when obtain core dump file. A very common error that trigger core dump is segmentation fault happen, check out this example to get more idea regarding core dump, and gdb. Additional link, here is a great tutorial shows you how to debug when occur segmentation fault. This post is […]

Posted in Developer, gdb | Hits: 24642 | 5 Comments »

Generating Random numbers

October 27th, 2006 mysurface

We can obtain pure random (NOT pseudo-random) bytes from /dev/random. Linux kernel harnesses a good source of randomness from you. The random bytes in /dev/random is measuring based on the time delay between your input actions. so seems /dev/random provided random bytes, we need to turn the bytes into an integer so that we could […]

Posted in Bash, echo, Misc, od, touch | Hits: 105882 | 10 Comments »

Substitute a Keyword In a File

October 9th, 2006 liewsheng

Sometime I need to replace a keyword with another, I can’t just open a file and substitute 1 by 1. It is faster to using a single command line. There have more than 2 ways to do it, but I prefer this 2 command: perl and sed. To substitute a word ‘abc’ to ‘def’ in […]

Posted in perl, sed, Text Manipulation | Hits: 59137 | 10 Comments »

Reverse a string

October 9th, 2006 toydi

python provides a -c option to accept and run a script line. To reverse a string like this one: “toydi deified idiot”. echo ‘toydi deified idiot’ | python -c “print raw_input()[::-1]” echo prints the string to stdout. python run the script line. raw_input() read from stdin (to read from pipe and return the string). [::-1] […]

Posted in python, rev | Hits: 64615 | 12 Comments »

writting executable script

October 8th, 2006 mysurface

Shell script (sh), Bash script (bash), Python and perl are all scripting language. By default, to run a scripting file, for example Python script, you need to do this: python Another example for shell script: sh But we make is executable and can execute by running directly like this ./ If you place […]

Posted in Bash, chmod, Developer, file, python, sh, which | Hits: 104333 | 22 Comments »