Array Indexing in C
I found this interesting thing about array indexing in C somewhere in the web:
Suppose that “a” is an array. Then, a[5] and 5[a] are quivallent. Both are interpreted as *(5 + a) or *(a + 5) which is the same
Also: “Hello World”[3] and 3["Hello World"] are the same. Try and C
Infinite zip File
A nice idea: How to build an infinitely recursive zip file. Details and resulting file here:
http://www.steike.com/code/useless/zip-file-quine/
Have fun
Blogging From BlackBerry
Posting from BlackBerry using Wordpress app for BlackBerry.
You can install the application to your BalckBerry from here: http://blackberry.wordpress.org/install
Have fun
Wisdom by Python (Easter Egg)
An easter egg by python displays a list of quotations, useful in programming and in many cases in life as well.
In your shell, type this:
1 | python -c 'import this' |
You’ll get this:
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren’t special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one– and preferably only one –obvious way to do it.
Although that way may not be obvious at first unless you’re Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it’s a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea — let’s do more of those!
via commandlinefu
Have fun
Fix Facebook Chat in Firefox 3.5 (Shiretoko) in Ubuntu
Since I upgraded Firefox to 3.5 (Codename : Shiretoko), I noticed that Facebook chat does not work anymore, moreover, in order to get notifications for new events, I had to refresh the page manually.
After a search at Google, I found the problem, and the way to fix it: Looks like Ubuntu had decided to rename the user-agent into “Shiretoko” which is the codename of firefox 3.5, instead of “firefox”.
Because of the new user-agent name, Facebook does not recognize the browser as firefox, and thus disables some features that are browser dependent.
In order to fix the problem:
1. In the URI bar (that’s the place where you type the URLs of websites you want to visit), type “about:config” (without the double quotes).
2. Click the funny button “I’ll be carefull, I promise”.
3. Now look for “general.useragent.extra.firefox”, right click it, and choose “Modify”.
4. Instead of “Shiretoko”, type “Firefox”. (e.g. if you had “Shiretoko/3.5.4pre” it should become “Firefox/3.5.4pre”.
That’s it, now the world should be a better place
via vimtips.
Embed A Document Using Google Docs
You can embed a document viewer for any PDF or PPT using Google Docs.
You will get something similar to this:
The code I used for the above is:
1 |
Or in general:
1 |
Where DOCUMENT_URL_HERE should be replaced by the document’s URL
via Google Operating System.
Smile
Re-Use A Bash Command With Different Parameters
Suppose you have typed and executed this command in your Linux shell:
1 | ./script_a.sh 1.23 && ./script_b.sh 1.23 && ./script_c.sh 1.23.45 |
Now you want to run the same command, but with 2.34 instead of 1.23
A nice way to do it is this:
1 | !!:gs/1.23/2.34 |
Meaning, run the last command (!! is also called ‘bang bang’, and it’s substituted by the last command you executed), and replace every instance of 1.23 by 2.34
via Unix Bash Scripting.
Have fun
Make Shell Scripts Executable By Default
If you use vim to write shell scripts, you might want to save the “chmod +x” command after saving the script.
By adding the following line to your vimrc file (typically, it’s located at ~/.vimrc), scripts will automatically become executable.
au BufWritePost * if getline(1) =~ “^#!” | if getline(1) =~ “/bin/” | silent !chmod a+x <afile> | endif | endif
(meaning, if the file includes #! with “/bin/” in the path, apply “chmod a+x” on this file).
via shell-fu.
Have fun
Fetch Links From Twitter Into Your RSS Reader
Twitter streams are usually full of links, most of them are shortened by a URL shortener, and filtering them might be time consuming.
A cool service, Readtwit, solves this problem intelligently: Using Readtwit, you can easily create a RSS feed of all links appearing in your twitter stream. The service will fetch the links, and send the full story to your RSS reader. It allows you to filter the tweets (block people and block hashtags).
Neat and time-saving. Try it and have fun
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
About Me
Tags
My Twitter
Categories
Popular Posts
Calendar
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
| « Jan | ||||||
| 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 | ||||||
Archives
- 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