Blog is moving

My blog is moving to http://victormendonca.com/blog/. If you are looking for a specific or older post you are in the right place Otherwise check out my new page for more up to date content.

Sunday, March 29, 2009

Getting daily tips for bash


I still consider my self a new Linux user and a noobie. One of the things that I strive to learn is scripting in bash, but I do have difficulties as I have no programing background, so I try to read and get as much help as I can.

During my searches on the web I found a very interesting twitter profile for the author of “O'Reilly's Bash Cookbook”. He has daily updates with interesting bash tips, which I have found very useful.

So today I'll be providing a function script that can be added to your ~/.bashrc and used as either a command or a welcome message for you terminal emulator. This script will go to the twitter profile of “Bash cookbook” and download their daily content.

The script is compatible with links and elinks (Red Hat) for downloading the content. It creates 3 environment variables on your system to hold links version, last update and downloaded content.

Open you ~./bashrc with your favourite text editor and paste the lines bellow:
bash_tips ()
{
# checks for version of links
if [ -z "$LINKS_VERSION" ] ; then
export LINKS_VERSION=$(links -version | grep Links | cut -f1 -d" ")
fi

# checks variable that holds last update time
if [ "$BASH_TIPS_DATE" != $(date "+%d") ] ; then
export BASH_TIPS_DATE=$(date "+%d")
if [ "$LINKS_VERSION" = "ELinks" ] ; then
# script for ELinks
export BASH_TIPS=$(links -dump -dump-width 300 http://twitter.com/bashcookbook | egrep '^ *1\. [^http]' | sed 's/^ *//g')
else # script for Links
export BASH_TIPS=$(links -dump -width 300 http://twitter.com/bashcookbook | egrep '^ *1\. [^http]' | sed 's/^ *//g')
fi
fi

echo -e "\n## Today's bash tips ##\n$BASH_TIPS"
}

If you want to have the daily tips displayed when you open a terminal emulator, just add “bash_tips” to your ~/.bashrc.

This is what they will look like:
victux ~ $ bash_tips

## Today's bash tips ##
1. Using += on an array assignment adds new elements to the array. If RA has element 0-6 then RA+=(new elems) creates RA[7] and RA[8].10:24 PM Mar 27th from Identica


Book:
http://oreilly.com/catalog/9780596526788/
Twitter site:
http://twitter.com/bashcookbook
Official site:
http://www.bashcookbook.com/

Thursday, March 26, 2009

How to highlight pdf files on Linux and Windows machines


Two annoyances that I have always had with ebooks and pdf material is that when I'm reading I like to highlight important info for future reference. Most readers (like Adobe) only allows you to highlight files that you have document rights to it, which I don't think makes any sense.

The other problem is that I read the same book between multiple computers and multiple platforms. I always have to write down the page I read last, and this is a bit annoying.

After doing a lot of searches I was finally able to find a pdf reader (PDF-XChange Viewer) that allows me to highlight text and save that information. Even better, they have a portable version so you can have the book, program and saved data (highlight and page) on a USB device and access it between machines.

For my utmost surprise the program works under wine and also reads the saved data.

Hot to get it working

1- Download the portable version of the program and unzip it to your flash device (either on Linux or Windows)

http://www.docu-track.com/download/PDFX_Vwr_Port.zip

2- Install wine on your Linux machine if you have not already done so

# Ubuntu (8.10)
$ sudo aptitude install wine
$ winecfg

3- Create a script in the flash drive within the program folder to open the program on Linux

$ echo -e '#!/bin/bash\n\nwine PDXCview.exe &' > PDFXCview_for_Linux

You should now be able to open the program on either Windows or Linux and see your highlighted text.

Friday, February 27, 2009

Giving Life to Old Computer Hardware


The other day I was trying to come up with ideas on how to use some of the old computer hardware I have laying around at home. I searched the web over and over for computer hardware decor and similar keywords, and finally after a lot of searching I started to find some cool ideas (which I'll be showing here).

1- Floppy notes
This is actually pretty cool. Some companies actually sell this (between 2-10 US) on the net. But I think everyone has a few old floppies at home that have no use.


2- Floppy pencil holder
Another good idea for floppies. This is also being sold on the net (or you can easily make your own).


3- Hard Drive clock
No need to say much. This is a fully functional clock installed on an old HD. You can get instructions from here: http://www.instructables.com/id/Hard-drive-platter-clock./



There are many more ideas that I have not had a chance of trying, but I'm including a link with all my findings here if you want to dig a bit further.
http://delicious.com/victorbrca/Computer%2FHardware%2FDecor

And here are more links for my preferred ones:
- Really amazing LED clock
http://www.ian.org/HD-Clock/
- Bag made with floppy disks
http://www.instructables.com/id/Floppy-Disk-Bag/

Wednesday, January 14, 2009

New Site!!

New site!!!!

Starting today I will no longer post any blogs on this site. My blog will now be hosted at http://blog.wazem.org, which will also include my site.

Here's a screenshot of what the site looks:


All posts have been transferred to my new blog, but I will also keep it here for as long as I can.

I hope you enjoy the new interface and find whatever information is that you came here looking for!!

Vic.

Friday, November 28, 2008

How to install flash on Linux (the manual and safe way)


Ever had problem installing flash plugin on your Linux machine? Ubuntu has all these different packages that can be used, but I always opted for using the simple manual install.

Here's what you do:

1- Download flash player for Linux (.tar):
http://get.adobe.com/flashplayer/

2- Uncompress the folder and cd into it:
tar -xzvf install_flash_player*linux.tar.gz
cd install_flash_player*linux

3- Add flash the proper folder:
# Firefox 3
sudo cp libflashplayer.so /usr/lib/firefox-3*/plugins/

Open (or restart) Firefox and test your flash player (youtube.com is a good idea).