Google Reader Useful “Send To” Services
Recently, Google have added a “send to” feature to Google Reader, which allows one to share an item in social networks (Facebook, Twitter, etc…).
The greatest thing in this feature is, that Google allows you to add custom sites to the “Send To” destinations. A few nice sites are listed below:
1. Download item as PDF (via)
Name: Save as PDF
URL: http://savepageaspdf.pdfonline.com/pdfonline/pdfonline.asp?cURL=${url}
Icon URL: http://www.adobe.com/lib/com.adobe/template/icon/pdf.gif
Tools to Improve the Quality of Your Code
Just found a nice link at Wikipedia with a collection of tools to help analyzing the quality of your code.
One interesting one is PMD (for Java), which is opensource. It statically analyses your code and alerts for potential problems.
For C, there is splint (opensource as well), which statically analyses your code for potential coding mistakes and security vulnerabilities.
The full list at Wikipedia is here.
Another great tool, which is not directly related to the above, is Valgrind. While the above statically analyze your code (i.e., they find potential problems by “just looking at the code”), Valgrind is a tool for dynamic analysis, which means, it analyses the code by monitoring the way it runs. It can report possible memory leaks, possible deadlooks, and many other information. (The full tool suite description can be found here). The output of Valgrind is not very easy to read, but with a little practice one can feel more comfortable with it.
There is also a list of tools for dynamic analysis at Wikipedia. It’s located here and may be worths a glance.
Enjoy coding
Computer Security Articles
I just found a great collection of computer security related articles. They’re informative yet simple and well explained.
One interesting article is the “Buffer Overrun Attacks” found here.
The complete collection can be found here.
via rootsecure.net
Enjoy
Trimming Bash Variables – A Summary
This post should summarize the subject of stripping out bash variables, we already talked about on previous posts
Let’s say we have a bash variable (say x), which stores a string (say “ExExampleStringStr”)
Then we can do the following manipulations:
1.
1 | y=${x%Str*} |
This will trim out the shortest match of the pattern “Str*” from the end of the string.
Thus, y will have the value “ExExampleString”.
› Continue reading
Free Programming Books
A great collection of freely available programming books in various languages (Bash, C, C++, Java, Perl, Python and more) is available in this link via stackoverflow.com
Enjoy
Strip Leading Characters Off A String
Say you have a bash variable (say x) storing the string “MyLongString”
This bash command:
1 | echo ${x##My} |
Will strip the leading string “My” off the original string. And thus the output will be:
LongString
via @bashcookbook
Strip the File Name Suffix off a Bash Variable
Suppose you have a bash variable storing a file name, say x =file.jpg
You can use this substitution command in order to strip out the file suffix off the string:
1 | echo ${x%.*} |
The output will be the base name of the file without the suffix.
via @bashcookbook
Enjoy
Create Multiple Nested Directories in Linux
Did you know that you can create a complete directory tree with one command?
Let’s start with a simple example:
mkdir -p a/b/c
will create this tree:
`-- a
`-- b
`-- c
And any of these:
mkdir -p a/{b1,b2}/c
or
mkdir -p a/b{1,2}/c
Will create this tree:
› Continue reading
Brainfuck String Generator Generator
Here is a small C program, which takes a string as its input, and generates a (not so trivial) brainfuck code which generates this string.
For a tool to convert brainfuck code into C, see this post
To run the program, first compile it with gcc:
gcc -o bf_generator bf_generator.c
No, run it:
./bf_generator “a string to convert into brainfuck code”
You can also pass a text file as its input through a pipe:
cat testfile.txt | ./bf_generator
A Bash Script to Convert brainfuck Code Into C
Brainfuck is a minimalist Turing Complete language. You can read about it here.
The following bash script takes a file with brainfuck code (legal characters are >< ,.+-[] any other characters are ignored), and generates its C equivalent code, which can then be compiled with a C compiler and executed.
The output of this script lacks indentation. If you insist on having the C code indented you can achieve this by passing the output through a pipe to “indent”, “astyle” or similar programs.
The script should be called in the following way:
./bf.sh code.bf > code.c
Where code.bf is the file containing the brainfuck code.
About Me
Tags
My Twitter
Categories
- Algorithms
- Bash
- BlackBerry
- Collaboration
- Command Line
- Cool Tricks
- Easter Eggs
- Ebooks
- Firefox
- Hardware
- Humor
- Linux
- Linux Development
- Linux Kernel
- Networks
- Open Knowledge
- Other
- Productivity
- Programming
- Science
- Security
- Shell Scripts
- Short Posts
- Thoughts
- Tools
- Vim
- Web Development
- Websites
Popular Posts
Archives
- March 2010 (1)
- January 2010 (1)
- December 2009 (2)
- September 2009 (13)
- July 2009 (1)
- June 2009 (6)
- May 2009 (4)
- March 2009 (18)
- February 2009 (10)
- January 2009 (10)
- December 2008 (7)
- November 2008 (8)
- October 2008 (1)
- August 2008 (1)
- July 2008 (1)
- June 2008 (2)


Me @ Social Media