Linux: enable history for user (howto)

Example: enable history for root user.
Edit ‘bash_profile’:

sudo vi /root/.bash_profile

And add the following two lines:

 HISTFILE='/root/.bash_hystory'
 export HISTFILE

Notes
.bash_profile is executed for login shells (via console, either sitting at the machine, or remotely via ssh).
.bashrc is executed for interactive non-login shells (ie: you’ve already logged into your machine and open a new terminal window inside Gnome or KDE)

Google Bookmarks – Firefox shortcut (no addon)

This is a small script you can use to place a special bookmark that will let you save current page in your google bookmarks.
No add-ons are required and it really easy to use.

  1. Create a new bookmark: Bookmarks > Show all bookmarks > Bookmarks menu > Organize > New bookmark
  2. Set “name” with something like “Google Bookmark”
  3. In the “location” field add the following code:
    javascript:(function(){var%20a=window,b=document,c=encodeURIComponent,d=a.open('http://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk='+c(b.location)+'&title='+c(b.title),'bkmk_popup','left='+((a.screenX||a.screenLeft)+10)+',top='+((a.screenY||a.screenTop)+10)+',height=420px,width=550px,resizable=1,alwaysRaised=1');a.setTimeout(function(){d.focus()},300)})();
  4. Done!

Everytime you need to save a google bookmark just click on the Bookmarks menu, select your special bookmark called “Google Bookmark” and enjoy!

Browsing a REST interface with Firefox and ModifyHeaders

Install ModifyHeaders for Firefox:
https://addons.mozilla.org/en-US/firefox/addon/modify-headers/

Then open config panel and add your custom headers to access the REST service.
A single header has a name and a value, so it’s something like:

 Name: X-Gallery-Request-Key
 Value: b333837c...

Add all the custom headers you need, then press “start”.
Now you can browse your REST url with firefox ;)

Ubuntu 10.10 audio equalizer

Open terminal, type:

sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update && sudo apt-get install pulseaudio-equalizer

Then open “Applications > Sound & Video > PulseAudio Equalizer” and … have fun!

Linux Mint 12, Dell Vostro 3750 laptop, enable/disable touchpad (howto)

Steps to get a simple shourtcut to enable/disable touchpad on a dell 3750 (it should work also on other laptops):
1. create a custom bash script “toggle-touchpad” (see details here) with this code:

#!/bin/bash

# this script queries the status of the ImPS/2 ALPS GlidePoint device
# via xinput and disables / enables the device accordingly.

#get touchpad id
XINPUTNUM=`xinput list 'ImPS/2 ALPS GlidePoint' | sed -n -e's/.*id=\([0-9]\+\).*/\1/p'`

TPSTATUS=$(gconftool-2 -g /desktop/gnome/peripherals/touchpad/touchpad_enabled)

#if status fails, exit 1
test -z $TPSTATUS && exit 1
if [[ $TPSTATUS == true ]]; then
xinput set-int-prop $XINPUTNUM "Device Enabled" 8 0;
gconftool-2 --type bool -s /desktop/gnome/peripherals/touchpad/touchpad_enabled false
else
xinput set-int-prop $XINPUTNUM "Device Enabled" 8 1;
gconftool-2 --type bool -s /desktop/gnome/peripherals/touchpad/touchpad_enabled true
fi

Thanks to http://ubuntuforums.org/showthread.php?p=11504018 for this script (these guys kick ass)

2. check that the script works (run the script to enable/disable touchpad).

3. create a keyboard shortcut for your script:
- open “System Settings > Keyboard > Shortcuts > Custom Shortcuts”
- click on “+” and type “toggle-touchpad” in the name field, and the path to your script in the command field (should be something like “/home/john/bin/toggle-touchpad” )
- click “Apply”
- click on “Disabled” column and type the shourtcut you’d like to use (something like Ctrl+Alt+0)

4. close and test your new shortcut ;)

Running buildout when pypi is down or does not respond

When http://pypi.python.org is down you’re not able to install, deploy, create enviroments etc.
This is quite boring!
Anyway, pypi has several mirrors:

Add this line to your buildout.cfg to use one of these mirrors and bypass the (temporary) problem:

[buildout]
index = http://d.pypi.python.org/simple

Invivo – Magnets

Me @ Invivo.
“Magnets” is the first single from Invivo’s new album called “Warp”.
Buy your digital copy of “Warp”:

Me @ OpenSource Day 2001 (Udine) – Liferay

Mash Up applicativo per l’accesso ai servizi aziendali – Marco Celotti, Davide Pavan

Ubuntu howto – add custom bash scripts to your path

  1. Create your bash script:
    mkdir ~/bin/
    gedit ~/bin/myscript
    chmod +x ~/bin/myscript
  2. Update PATH:
    To do so, open a terminal and edit your ~/.bashrc (if there’s no .bashrc file just create a new one):

    gedit ~/.bashrc

    Append the following two lines:

    PATH=$PATH:~/bin
    export PATH
  3. Logout and login.
    Now you should be able to run “myscript” just like the other commands

Plone4 buildout howto

Plone4 wants python 2.6, anyway people running python2.7 say it that works so … I’ll use python2.7.
I’m using Linux Mint 11 (Ubuntu 11).

Install python-dev package:

$ sudo apt-get install python2.7-dev

Then install EasyInstall: download the egg from “http://pypi.python.org/pypi/setuptools” and then run it as if it were a shell script:

$ sudo sh setuptools-0.6c11-py2.7.egg

Ok, so let’s use paster to create a Plone4 buildout:

$ paster create -t plone4_buildout

Run bootstrap.py:

$ sudo python bootstrap.py

Ok we’re ready, let’s run buildout:

$ ./bin/buildout

Now to start the application type:

$ bin/instance start

Done! :)

Page 1 of 512345