bash scripting - VGA toggle switch

VGA port, really useful way to display through big Monitor or TV your tiny videos instead of watching them on your little notebook’s display :-)
Are you bored to have to restart X every time you want to connect your VGA cable?
Don’t you want to use gnome-display-etc-etc-manager to only configure a stupid VGA Monitor?
Don’t worry, you can use a little bash script (linked to some buttons on you panels), to manage your VGA connection.
I works like a switch, the script will enable the output choiced if this is disabled and viceversa it will disable the output if this is enabled.
But stop speaking (/writing) and watch it now:
vga.sh:
#!/bin/bash
#
# This script was created to manage an external output for notebook
# The script only needs a bit of configuration to set the default output, mode, rate and extra options,
# It works like a switch, the script will enable the output choiced if this is disabled and viceversa it will disable
# the output if this is enabled.
# It can be used on various acpi script linking it to your notebook’s fn+key.
#
# Made by: Alessandro Arrichiello <alezzandro@gmail.com>
#
# Configuration starts here:
output=”VGA”
mode=”1024x768”
rate=”60”
extra_options=”—right-of LVDS”
xrandr_cmd=”xrandr —output “$output” —mode “$mode” —rate “$rate” “$extra_options
#
# END of Configuration
xrandr_output=`xrandr|grep $output`
if [ `echo $xrandr_output|grep -c disconnected` == “1” ]; then
echo “Cable for “$output” not connected.”
else
if [ `echo $xrandr_output|grep -c connected` == “1” ]; then
if [ `echo $xrandr_output|grep -c $mode` == “1” ]; then
echo “Putting off: “$output
xrandr —output $output —off
else
echo “Putting on: “$output
`$xrandr_cmd`
fi
else
echo “Output not found check your configuration.”
fi
fi
Remember to set the right permissions (chmod +x vga.sh),
see you,
3 anni fa
Picasa Badge

I’m happy to announce that after many days of debugging and testing,
I’ve published Picasa Badge! (as you can see on the right bar) ->
Dependencies: LWP::Simple perl module (namely also: perl-libwww)
NOTE: Picasa is a registered trademark of Google Inc. Picasa Badge is not a partner, affiliate, or licensee of Google Inc., nor is it in any other way formally associated with Google Inc.
Use this software at your own RISK!
The author declines every responsability about this software.
Picasa Badge is a perl script that lets you display on your website a badge containing picasa random photos or albums.
You can edit many settings and the style of your badge (it will be displayed on a <div id=”picasabadge”> </div> element that you can edit with you css style).
Usage:
Example:
Include in your webpage the script by this way:
<script type=”text/javascript” src=”http://your.host.name/cgi-bin/picasabadge.pl?account=YOUR_ACCOUNT_NAME&kind=photo&thumbsize=72&max-results=4&total-photos=275&vertical=1&display-logo=1“></script>
As you can see, you can set various options,
Allowed options are:
* account = “Your Account Name”
* kind = kind of display objects: “photo” or “album”
* thumbsize = the site of thumbnails: 32, 48, 64, 72, 144, 160
* max-results = how many photos picasa badge have to display.
* total-items = total photos stored on your album or total albums (You can obtain it on picasa account or reading the rss code of your account)
* vertical or horizontal = set it to “1” to see picasa badge vertical or horizontal
* display-logo = set it to “1” to see Picasa Badge logo on your badge
NOTE: I’ve added a little security fix to avoid overloading of my webserver: I’ve added my account name directly into source file to avoid that anyone could use it from my webserver, you can feel free to remove/edit it when you have downloaded the source file!
You can find always the latest version of picasa badge at:
http://code.alexworld.it
or directly here: http://code.alexworld.it/code/picasabadge.pl.html
Feel free to contact me for every problem!
bye,
3 anni fa