Friday, January 13, 2012

Terminal command line editing shortcuts

From CentOs Bible PDF E-Book.

TABLE 4-1
Keystrokes for Navigating Command Lines
Keystroke Full Name Meaning
[Ctrl]+f Character forward Go forward one character.
[Ctrl]+b Character backward Go backward one character.
[Alt]+f Word forward Go forward one word.
[Alt]+b Word backward Go backward one word.
[Ctrl]+a ([Home] key) Beginning of line Go to the beginning of the current line.
[Ctrl]+e ([End] key) End of line Go to the end of the line.
[Ctrl]+l Clear screen Clear screen and leave line at the top of
                     the screen.


TABLE 4-2
Keystrokes for Editing Command Lines
Keystroke Full Name Meaning
[Ctrl]+d Delete current Delete the current character.
[Backspace] Delete previous Delete the previous character.
[Ctrl]+t Transpose character Switch positions of current and previous characters.
[Alt]+t Transpose words Switch positions of current and previous words.
[Alt]+u Uppercase word Change the current word to uppercase.
[Alt]+l Lowercase word Change the current word to lowercase.
[Alt]+c Capitalize word Change the current word to an initial capital.
[Ctrl]+v Insert special character Add a special character. For example, to add a [Tab]
                                 character, press [Ctrl]+v+[Tab].

TABLE 4-3
Keystrokes for Cutting and Pasting Text in Command Lines
Keystroke Description
[Ctrl]+k Cut text to the end of the line.
[Ctrl]+u Cut text to the beginning of the line.
[Ctrl]+w Cut the word located behind the cursor.
[Alt]+d Cut the word following the cursor.
[Ctrl]+y Paste most recently cut text.
[Alt]+y Rotate back to previously cut text and paste it.
[Ctrl]+c Cancel the entire command line.

Thursday, January 12, 2012

Python autocompletion (from the net)

Original source from HERE


Enabling auto-complete in the interactive python interpreter will greatly increase your development speed. Sometimes you can't recall a method's name or you're not sure which method to use in the first place.
First we're going to create a file in your home directory called ".pythonrc" which will hold our configuration details. This file should contain the following:
import rlcompleterreadline
readline.parse_and_bind('tab:complete')
Then we'll set the PYTHONSTARTUP environment variable in our .bashrc (or .bash_profile if you're using that). If the PYTHONSTARTUP variable is set to a readable file, then the contents of that file will be run before anything else when the interactive interpreter is run.
echo "export PYTHONSTARTUP=~/.pythonrc" >> .bashrc
Then either open a new terminal window or reload your .bashrc file:
source ~/.bashrc
You're all set, just run python to enter the interpreter and give it a whirl. For example, run:
import sys
Then type in "sys." and hit tab twice, and you'll see all the methods on the sys object.

Friday, January 6, 2012

{Solved} How to install Canon LBP2900 on 64 bit Ubuntu/Linux Mint/Lubuntu

A.1. Create this directory
lnx#> sudo mkdir -p /var/log/CCPD
lnx#> sudo chown -R root:lp /var/log/CCPD/
If not, you'll get this error message "ccp send_data error, exit"

A.2. Make sure that /var/ccpd/fifo0 actually exists:
lnx#>ls -l /var/ccpd
When missing, it can be added manually:
lnx#>sudo mkdir /var/ccpd
lnx#>sudo mkfifo /var/ccpd/fifo0
lnx#>sudo chown -R lp:lp /var/ccpd

1. Download this archive

2. Extract files from the archive

3. Go to 64-bit/ directory

4. Install the deb packages:
lnx#>sudo dpkg -i *.deb

5. Restart CUPS:
lnx#>sudo service cups restart

6. Find ppd:
lnx#> find /usr/share/cups/model -name '*LBP*K.ppd' | grep 2900 /usr/share/cups/model/CNCUPSLBP2900CAPTK.ppd

7. Add printer into CUPS:
lnx#>sudo lpadmin -p LBP2900 -m CNCUPSLBP2900CAPTK.ppd -v ccp:/var/ccpd/fifo0 -E

8. Link the Printer to the USB Printer Port:
lnx#>sudo ccpdadmin -p LBP2900 -o /dev/usblp0


 CUPS_ConfigPath = /etc/cups/
 LOG Path        = None
 UI Port         = 59787

 Entry Num  : Spooler   : Backend       : FIFO path             : Device Path   : Status
 ----------------------------------------------------------------------------
     [0]    : LBP2900   : ccp           : /var/ccpd/fifo0       : /dev/usblp0   :

9. Restart services
lnx#>sudo service ccpd stop
lnx#> sudo service ccpd start
lnx#>sudo service cups restart

10. Monitor printer with:
lnx#> captstatusui -P LBP2900

11. Print test page.

12. Eureka!