Tired of those wide tables that wrap? You can end your query with a \G to get output like this:
mysql> select * from users\G
*************************** 1. row ***************************
id: 1
name: xinu
created: 20050115210745
*************************** 2. row ***************************
id: 2
name: cygnus
created: 20050115210803
2 rows in set (0.00 sec)
configurationconvertmysqloutputsql
There are a few different ways to convert a DOS file to Unix format, but the most available is probably this:
$ col -bx < dosfile > unixfile
colcommandsconvertdosfilterline-endingsnewlineshellunix
Have fun with it:
#!/bin/bash
######################
# Set Variables
######################
ENDING=jpg;
IMG_SIZE=800;
THUMB_SIZE=150;
DIR=folder/folder/images/;
ID=/usr/bin/identify;
######################
# Create Thumbnail
######################
ls -1 *.$ENDING | grep -v thb |while read file;
do convert -thumbnail $THUMB_SIZEx$THUMB_SIZE "$file" "`basename _thb_"$file"`";
echo "---> _thb_$file created";
done
######################
# Convert image
######################
ls -1 *.$ENDING | grep -v thb | while read file;
do convert -resize $IMG_SIZEx$IMG_SIZE "$file" "`basename "$file"`";
echo "---> $file converted";
done
######################
# Output HTML-Code
######################
echo "######################";
echo "HTML-CODE:";
echo "######################";
ls -1 *.$ENDING | grep -v thb | while read file;
do
h=$($ID -format \"%h\" "`basename _thb_"$file"`");
w=$($ID -format \"%w\" "`basename _thb_"$file"`");
echo "<a href=\""$DIR$file"\">";
echo "<img alt=\"\" src=\""$DIR""`basename _thb_"$file"`"\" width=$w height=$h /></a>";
done
echo "######################";
bashconverthtmlimagethumbnail
You can use the convert program (included with imagemagick) to convert a LaTeX file to an image:
$ convert -density 144 -geometry 100% source.dvi dest.jpeg
commandsconvertdviimageimagemagicklatextextypesetting
Convert a man page to HTML for easy viewing online:
$ gunzip < /usr/local/man/man8/lsof.8.gz | nroff -man | man2html -title "lsof" > otmp/lsof.html
commandsconvertfiltergunziphtmlman2htmlmanpagenroffonlineshell
You can easily create an .ico file (e.g. a favicon.ico file for your website) with the ImageMagick convert program:
$ convert myicon.png favicon.ico
commandsconvertformaticoimageimagemagickwindows
To create a .ico file that can be used for the favicon.ico on webpages, you can use a nice little program called png2ico. There is no package for this in Debian or Ubuntu so you will need to compile it yourself. Compilation is very straightforward. You do need a libpng package. Most of the time it will be installed but if you see an error, just searching for that file will yield the package you need to get for your distribution.
The session below uses /usr/local/src for the compilation and installed to /usr/local/bin. It can be compiled anywhere and installed anywhere, but having it in your $PATH makes things easier:
$ cd /usr/local/src $ wget http://www.winterdrache.de/freeware/png2ico/data/png2ico-src-2002-12-08.tar.gz $ tar xvzf png2ico-src-2002-12-08.tar.gz $ cd png2ico $ make $ sudo cp png2ico /usr/local/bin/ $ sudo cp doc/png2ico.1 /usr/local/man/man1/
Once compiled, upload your png images. They should be square; sizes 16x16 and 32x32 are suggested. To create the icon you would then call the following:
$ png2ico favicon.ico your_favicon16x16.png your_favicon32x32.png
Afterwards you will then have a favicon.ico file. You then place this in the webroot of your website add the following to <head></head> section of your webpages:
<link rel="shortcut icon" href="/favicon.ico" />
It's good form to include it, but most common browsers automatically look for an icon at that location.
http://www.winterdrache.de/freeware/png2ico/ - includes a windows gui
commandsconvertfaviconiconimagepng2icoshellweb
You can use tr to remove non-printable characters from a data stream:
$ tr -cd '\11\12\40-\176' < $INPUT_FILE > $OUTPUT_FILE
(This tip taken from http://www.devdaily.com/unix/edu/un010011/.)
charactersconvertfilternon-printableshelltr
If you find yourself on a machine without the semi-ubiquitous ImageMagick packages, you might at least have pnmscale. Starting with a PNG file, you can do the following to resize it to 450 pixels wide:
$ pngtopnm < ./firefox-upgrade.png | pnmscale -x 450 | cjpeg -smoo 100 -qual 100 > firefox-upgrade.jpg
cjpegcommandsconvertfilterimageimagemagickpngpngtopnmpnmscaleresizescaleshell