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
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
About Me
Tags
Categories
- Algorithms
- Bash
- BlackBerry
- Collaboration
- Command Line
- Cool Tricks
- Easter Eggs
- Ebooks
- Firefox
- Hardware
- Humor
- iPhone
- Linux
- Linux Development
- Linux Kernel
- Networks
- Open Knowledge
- Other
- Productivity
- Programming
- Regular Expressions
- Science
- Security
- Shell Scripts
- Short Posts
- Social Networks
- Thoughts
- Tools
- Vim
- Web Development
- Websites
Popular Posts
Calendar
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
| « Sep | ||||||
| 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 |
Archives
- September 2010 (2)
- August 2010 (2)
- July 2010 (5)
- June 2010 (1)
- May 2010 (1)
- April 2010 (3)
- 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 (1)
