Archive

Posts Tagged ‘bash’

Toshiba Fan On Ubuntu

September 28th, 2008 6 comments

Toshiba Fan On Ubuntu

You need to install toshset include on toshutils (do you have lm-sensors ?)

sudo apt-get install toshutils

This script make the fan run high, low or normal

#!/bin/bash
case $1 in
	h) sudo toshset -fan 4 # high
	;;
	n) sudo toshset -fan 5 # normal
	;;
	l) sudo toshset -fan 6 # low
	;;
esac

If you live in warn places, “~$ script.sh h” could be help you a little don’t use all time this option, to normalize your fan run “~$script.sh n”.

There are other tools on toshset “man toshset”.

MySQL Workbench (Linux)

September 24th, 2008 2 comments

MySQL Workbench (Linux)

What is MySQL Workbench ?

MySQL Workbench is a cross-platform, visual database design tool developed by MySQL. It is the highly anticipated successor application of the DBDesigner4 project. MySQL Workbench will be available as a native GUI tool on Window, Linux and OS X.

For Ubuntu (8.04) users i made this install script (run as root):

#!/bin/bash
# This script tested only on Ubuntu 8.04 (32 bits)
# You need some extra libs to run MySQL Workbench
sudo apt-get install liblua5.1-0 libzip1 libmysqlclient15off
# Download MySQL Workbench Ubuntu 8.04 Bin Files
wget -c ftp://ftp.mysql.com/pub/mysql/download/gui-tools/mysql-workbench-5.1.2-alpha-ubuntu8-i386.tar.gz
# Download the md5 checksum file
wget -c ftp://ftp.mysql.com/pub/mysql/download/gui-tools/mysql-workbench-5.1.2-alpha-ubuntu8-i386.tar.gz.md5
# Check md5sum
real=`md5sum mysql-workbench-5.1.2-alpha-ubuntu8-i386.tar.gz | awk '{ print $1 }'`
confirm=`cat mysql-workbench-5.1.2-alpha-ubuntu8-i386.tar.gz.md5 | awk '{ print $1 }'`
if [ "$real" = "$confirm" ]
then
	# Extract (/usr/local/bin/ /usr/local/lib/mysql-workbench/ /usr/local/share/mysql-workbench/)
	tar xvzf mysql-workbench-5.1.2-alpha-ubuntu8-i386.tar.gz -C /
else
	echo "Wrong MD5, run the script again."
fi

Note: MySQL Workbench is alpha on Linux

More information about MySQL Workbench

Categories: database, develop Tags: , , ,

About NetCat

September 11th, 2008 No comments

About NetCat

NetCat a great network tool checkout this examples:

Create a Small WebServer:

while true; do nc -l -p 80 -q 1 < error.html; done

Transfer Files:

nc -lp $PORT > $FILE
cat $FILE | nc -w 1 $HOST $PORT

Chat Server:

nc -lp $PORT
nc $HOST $PORT

Spoof Headers:

echo -e "GET / HTTP/1.1\n\n" | nc -v $HOST 80

Backup System:

nc -lp $HOST > backup.tar.gz
tar cf - $DIR  | gzip  | nc -w 1 $HOST $PORT

Remote Shell:

nc -lp $PORT -e $CMD
nc $HOST $PORT

Clonning Hard Drive:

nc -l -p $PORT | dd of=/dev/sda
dd if=/dev/sda | nc $HOST $PORT

Port Scanner:

nc -vz $HOST 21-80

Web: http://netcat.sourceforge.net/

Categories: network, unix/linux Tags: ,

JSC JavaScript Collection

August 24th, 2008 No comments

JSC JavaScript Collection

We need jsmin and gzip, compile the jsmin.c:

gcc -o jsmin jsmin.c

Script to generate a collection of the javascript files:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
 
echo "JavaScript Collection"
 
  EXPECTED_ARGS=1
  E_BADARGS=65
 
if [ $# -ne $EXPECTED_ARGS ]
then
  echo "Usage: `basename $0` {path of the javascripts}"
  exit $E_BADARGS
fi
 
# Join the javascript scripts in one file
cat $1/*.js >> $1/.__fullscripts.tmp
 
# use JSMIN to minifier the script
cat $1/.__fullscripts.tmp | jsmin > $1/.__fullscripts.min.tmp
 
# awk remove the first blank line, gzip compress the script
awk 'FNR>1{print}' $1/.__fullscripts.min.tmp | gzip > $1/collection_scripts.js.gz
 
# remove temporal files
rm $1/.__fullscripts.tmp $1/.__fullscripts.min.tmp

Howto: jsc public_html/web/js/

Now create one php script to replace all javascripts:

<script type="text/javascript" src="collection_scripts.php"></script>

Content of collection_scripts.php:

<?php
    header("Content-type: text/javascript; charset: UTF-8?");
    header("Content-Encoding: gzip");
    readfile("collection_scripts.js.gz");
?>
Categories: unix/linux Tags: , ,

Safari On Ubuntu

August 22nd, 2008 No comments

Safari On Ubuntu

Script to install Safari on Ubuntu 8.04:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash
echo "Safary on Ubuntu Lazzy Script Installer (Ubuntu 8.04)"
sudo apt-get install msttcorefonts
sudo apt-get install wine
echo "Copy some MS-Fonts to local drive_c"
cp /usr/share/fonts/truetype/msttcorefonts/Arial*.ttf ~/.wine/drive_c/windows/fonts/
cp /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman*.ttf ~/.wine/drive_c/windows/fonts/
echo "Download SafariSetup and Flash Plugin"
wget http://ubuntu-debs.googlecode.com/files/SafariSetup.exe
wget http://ubuntu-debs.googlecode.com/files/install_flash_player.exe
echo "Install Safari"
wine SafariSetup.exe
echo "Install Flash Plugin"
wine install_flash_player.exe
echo "finish."

Reference:
http://www.ubuntu-unleashed.com/2008/03/howto-install-safari-on-ubuntu-with.html

Categories: unix/linux Tags: , , ,

Switch to our mobile site