Showing posts with label Hack of the Day. Show all posts
Showing posts with label Hack of the Day. Show all posts

Wednesday, May 20, 2009

Drupal module install scripts

The curl downloader -- for clients that lack wget

#!/bin/bash
## This script uses curl to save a web url from the net... It sets the file to the target filename.

function usage {
echo "usage: cget [opts] url
opts
-h: this help message
"
}

while getopts ":h" OPTION
do
case $OPTION in
h)
usage $OPTARG
exit 1
;;

?)
usage $OPTARG
exit
;;
esac
done

if [ -z $1 ]
then
usage
exit 1
fi

NAME=`echo $1 | tr "/" "\012"`

for X in $NAME
do
FNAME=$X

done

curl -o $FNAME $1

exit 0

The "installer"

#!/bin/bash
## This script uses downloads a zip file and moves it to the specified directory... from a package directory... This was intended to be used for drupal modules.

function usage {
echo "usage: modinst [opts] url
opts
-h: this help message
"
}

while getopts ":h" OPTION
do
case $OPTION in
h)
usage $OPTARG
exit 1
;;

?)
usage $OPTARG
exit
;;
esac
done

if [ -z $1 ]
then
usage
exit 1
fi

NAME=`echo $1 | tr "/" "\012"`

for X in $NAME
do
FNAME=$X

done

./cget $1

cd ../modules/
tar -xzf ../gzips/$FNAME

exit 0



Thursday, May 14, 2009

Customizing Colors in Leopard Terminal

Reason: Default colors are hideous in Terminal.app and Leopard doesn't have a way to change them.
Solution: Install SIMBL, and a SIMBL plugin(Mike Solomon’s TerminalColors).
Sources: Customizing Colors in Leopard Terminal -- Full article