Introduction to LaTeX

Submitted by Swobodin on Wed, 2006-02-01 12:04. ::
First of all, what’s LaTeX ?
LaTeX is the extension of TeX a language written by Donald Knuth, who was disappointed by the way his mathematical research were published (you can imagine, integrals, sum symbols, greek letters, fraction, roots, …). Anyway, LaTeX was born : it’s was open, free, and first used by scientific community. These days anyone can used it to write his documents (even a simple letter). LaTeX is typographically powerful (more than M$-word).How to use LaTeX ?
What do you need ? For my part, I use GNU/Linux. But LaTeX exists on M$-WINDOW$. Two essentiel things :- A compiler
- An Editor
- Acrobat Reader
On Fedora Core, a LaTeX compiler is available, but you can look for tetex-RPMs. A nice site is this one. TeTeX has a lot of packages (document classes, fonts, …). Then for the editor, you can download Kile. I think it’s the most interesting one because it’s completion-editor (this means that if you type the word class, the editor invites you to complete it with a list of word in its database).
Something else …
To help you start, this is an example of the “Hello world”\documentclass{article}
\begin{document}
Hello world.
\end{document}
Note By Swobodin
To compile your document and make a PDF document
pdflatex helloworld.tex
You may delete the unwanted files
rm -fv helloworld.{log,aux}
Where to find docs ?
Anywhere on the Net. For beginners, just type “LaTeX tutorial” for example. I recommend “the not so short introduction to latex” a interesting pdf document.What’s next ?
For those who want to fulfill the experiment, you can download new packages here.Via Kaiser's Blog.
login or register to post comments | printer friendly page
Commands for DOS nostalgics

Submitted by Swobodin on Fri, 2006-01-27 14:06. ::
It's possible to use some DOS commands on Fedora Core; thus, you won't have for example to mount a device, but, like DOS, this has too much limits.
You need to install mtools RPM, which contains some DOS utilities.
Edit /etc/mtools.conf and set the DOS devices according to UNIX ones, example:
Will consider /dev/fd0 as "a:"
You may read the floppy content without mounting it using mdir command:
Note that the device must be formatted FAT, you may create a FAT file in your UNIX filesystem; eg. :
If you want to read the imagefile using UNIX method, type as root:
Assuming that /Lab/MountPoint is empty.
To read the file using mtools, edit /etc/mtools.conf and add the following line:
mmd: Create directory
mrd: Remove directory
mren: Rename a file
mdel: Delete a file
mmove: Move a file
You need to install mtools RPM, which contains some DOS utilities.
Edit /etc/mtools.conf and set the DOS devices according to UNIX ones, example:
drive a: file="/dev/fd0" exclusive mformat_only
Will consider /dev/fd0 as "a:"
You may read the floppy content without mounting it using mdir command:
[swobodin@swobodin ~]$ mdir a:
Volume in drive A has no label
Volume Serial Number is 4371-AE5A
Directory for A:/
FSM 2006-01-27 20:52 FSm
modules 2006-01-27 20:11
BOOX 2005-12-03 21:42 boox
test 2006-01-21 21:37
APACHE~1 BZ2 326246 2005-11-10 21:38 Apache.tar.bz2
ARABTEX 2005-11-10 21:38 ArabTeX
7 files 753 378 bytes
704286 bytes free
Note that the device must be formatted FAT, you may create a FAT file in your UNIX filesystem; eg. :
# Create a 50MB file
dd if=/dev/zero of=/Lab/myfatpart bs=1M count=50
# Format it to MS-DOS filesystem
mkfs.msdos /Lab/myfatpart
If you want to read the imagefile using UNIX method, type as root:
mount /Lab/myfatpart /Lab/MountPoint -oloop
Assuming that /Lab/MountPoint is empty.
To read the file using mtools, edit /etc/mtools.conf and add the following line:
drive h: file="/Lab/myfatpart"
In the same way, you can add your USB stick device:
drive u: file="/dev/sda1"
Miscellaneous commands
mcopy: To copy filesmmd: Create directory
mrd: Remove directory
mren: Rename a file
mdel: Delete a file
mmove: Move a file
mcopy somefile.txt a:modules
mmd a:data
mrd a:data
mren a:modules/somefile.txt a:modules/mod1.txt
mdel a:modules/mod1.txt
mmove z.zip a:
login or register to post comments | printer friendly page
Make imaging magic!

Submitted by Swobodin on Mon, 2006-01-23 12:28. ::
ImageMagick is a powerful suite of programs and libraries to manipulate pictures in commandlines! What for? Whould you use Gimp if you have to deal with hundreds of files? Let's start with that magick thing!
The picture can be in various formats: PNG, JPEG, GIF, XCF, SVG, EPS, ...
To display all files in directory as a gallery:
Or resize an image:
If you don't want to calculate, use percentage:
Of course, you may scale and convert format at the same time:
To crop a 400x300 image to 150x100, starting from 80 horizontally and 70 vertically:
To find out more about this function :-P
The cursor will change then; click on the window you want to import and look for your output file.
To add the window border:
To take the whole screen:
To resize the output file
To make a 5 seconds pause, take a screenshot and sort the file by date:
To get informations about the image
Basic command: Display an image file
To display an image file (you must use X11), just typedisplay /path/to/your/file.png
The picture can be in various formats: PNG, JPEG, GIF, XCF, SVG, EPS, ...
To display all files in directory as a gallery:
display 'vid:*'
Main use: Conversion
The convert command has many features, it can convert between formats:convert file.png file.gif
Or resize an image:
convert -resize 400x300 your_img_1024x768.png your_newimg_400x300.png
If you don't want to calculate, use percentage:
convert -resize 50% original.png output.png
Of course, you may scale and convert format at the same time:
convert -resize 300x250 file.png file.gif
To crop a 400x300 image to 150x100, starting from 80 horizontally and 70 vertically:
convert -size 400x300 -crop 150x100+80+70 original.png output.png
To find out more about this function :-P
man convert
Take a screenshot
To take a window screenshot:import img.png
The cursor will change then; click on the window you want to import and look for your output file.
To add the window border:
import -frame img.png
To take the whole screen:
import -window root
To resize the output file
import -window root -resize 800x600 img.png
Quick tips
To convert all the PNG files to JPEGfor i in *png
do
convert $i $( echo $i | sed 's/\.png$/.jpg/g') && echo "$i successfully converted"
done
To make a 5 seconds pause, take a screenshot and sort the file by date:
sleep 5 && import -comment "My desktop screen" -window root scr_$(date +%Y%m%d).png
To get informations about the image
identify img.png
login or register to post comments | printer friendly page
Splitting files

Submitted by Swobodin on Thu, 2006-01-19 14:53. ::
Let's suppose that you have downloaded a large file, but you have not enough space on your physical media.
A solution consists of splitting the file into many parts, then joining these parts.
A typical example: Our file size is 3.9 MB, and we have to put it on many floppy disks:
the generated parts will be sorted by alphabetic order, starting by 'x', unless you set the prefix as second argument.
To join the files, you have to memorize the original filename, because it's you who will specify it later:
By default, if you don't use the -C flag, it will divide the file into more or less equal parts.
You may also split the file from STDIN.
Here's a little script to convert a gzipped data into bzipped parts:
And to join and uncompress them:
A solution consists of splitting the file into many parts, then joining these parts.
A typical example: Our file size is 3.9 MB, and we have to put it on many floppy disks:
split yourfile.tar.gz -C 1424k
the generated parts will be sorted by alphabetic order, starting by 'x', unless you set the prefix as second argument.
[swobodin@swobodin SPLIT]$ du -h *
1.4M xaa
1.4M xab
1.1M xac
To join the files, you have to memorize the original filename, because it's you who will specify it later:
cat * > yourfile.tar.gz
By default, if you don't use the -C flag, it will divide the file into more or less equal parts.
You may also split the file from STDIN.
Here's a little script to convert a gzipped data into bzipped parts:
gunzip -c yourfile.tar.gz | split -
for i in x*; do bzip2 -9 $i; done
ls
xaa.bz2 xab.bz2 xac.bz2
And to join and uncompress them:
cat *bz2 | tar xvfj -
login or register to post comments | printer friendly page
cvs commit
Submitted by anix on Sun, 2006-01-15 07:44. :: Fedora community
salut,
pour ceux qui travaillent sous cvs, g eu 1 pb:
quand je fais cvs commit
il me dit:
root n'a pas le droit de faire commit...
merci
2 comments | printer friendly page
n/a
printer friendly page
Using PGP Encryption

Submitted by Swobodin on Mon, 2006-01-09 15:24. ::
It's time to start learning how to use encryption and then send encrypted messages and data for sensitive information.
You should have installed GnuPG (Gnu Privacy Guardian). Here's a step-by-step tutorial for handling it.
Your selection?
Choose the first
Choose the default 2048
Choose "0" if you don't wish that your key expires, if you want that it expires within 2 years, type 2y, 395 for one year and one month, etc.
Follow the interactive menu, and set your full name in Real name field, your mail (of course, it's unique) in mail field.
Once confirmed, enter your password twice. System will generate your secret key (that you must not share with anybody).
To check your key, type
gpg --list-keys
You will have something like
The --export option will export your public key, the -a sets the armor the output (set it as ASCII); as the output will be displayed in stdout, you should redirect it to a file. If no mail or no finger is set, you will export all your public keys.
To import a public key, type:
You may download my public key and import it
-a: armor output (ASCII)
-e: encrypt file
-r: set a receiver, This can be a string (if it's unique), a full e-mail address or a finger ID, eg.: 8A784A88
-o: output file
Note that even you can not decrypt the resulted file: only the receiver may do it! If you want to encrypt the file for yourself, set your finger ID as receiver.
To decrypt a file, you need both the secret key (which must be put in a secure place) and the passphrase. Use the following command to decrypt a file whose the receiver is you:
You will be asked for the passphrase if the secret key is found.
If you want to encrypt a file without receiver (anyone can open it with the passphrase), use the -c flag:
You will have to enter the passphrase twice.
separate the signature from the data, still in the same file
to make a detached signature file
In the 3 cases above, you need the secret key of the e-mail or the finger ID you entered, then you have to enter the password interactively.
You should have installed GnuPG (Gnu Privacy Guardian). Here's a step-by-step tutorial for handling it.
Generate your Keypair
Type:gpg --gen-key
You will have a similar message
gpg (GnuPG) 1.4.1; Copyright (C) 2005 Free Software Foundation, Inc.
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions. See the file COPYING for details.
Please select what kind of key you want:
(1) DSA and Elgamal (default)
(2) DSA (sign only)
(5) RSA (sign only)
Your selection?
Choose the first
Your selection? 1
DSA keypair will have 1024 bits.
ELG-E keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048)
Choose the default 2048
Requested keysize is 2048 bits
Please specify how long the key should be valid.
0 = key does not expire
= key expires in n days
w = key expires in n weeks
m = key expires in n months
y = key expires in n years
Key is valid for? (0)
Choose "0" if you don't wish that your key expires, if you want that it expires within 2 years, type 2y, 395 for one year and one month, etc.
Follow the interactive menu, and set your full name in Real name field, your mail (of course, it's unique) in mail field.
Once confirmed, enter your password twice. System will generate your secret key (that you must not share with anybody).
To check your key, type
gpg --list-keys
You will have something like
pub 1024D/ 2006-01-09
uid Your Name <>
sub 4096g/ 2005-01-09
Export, import public keys
Start to export your public key, so that other users will be able to send to you encrypted messages:gpg --export -a > public
The --export option will export your public key, the -a sets the armor the output (set it as ASCII); as the output will be displayed in stdout, you should redirect it to a file. If no mail or no finger is set, you will export all your public keys.
To import a public key, type:
gpg --import public_file.asc
gpg: key 135EA668: public key "Richard Stallman (Chief GNUisance) <>" imported
gpg: Total number processed: 1
gpg: imported: 1
gpg: 3 marginal(s) needed, 1 complete(s) needed, classic trust model
gpg: depth: 0 valid: 5 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 5u
gpg: next trustdb check due at 2007-01-09
You may download my public key and import it
curl http://swobodin.fedora-tn.org/wp-content/stuff/public.asc.bz2 | bunzip2 -c - | gpg --import
Encrypt, Sign your data
Encryption
The follwing commands encrypts your filegpg -aer Swobodin -o somemsg.asc somemsg
-a: armor output (ASCII)
-e: encrypt file
-r: set a receiver, This can be a string (if it's unique), a full e-mail address or a finger ID, eg.: 8A784A88
-o: output file
Note that even you can not decrypt the resulted file: only the receiver may do it! If you want to encrypt the file for yourself, set your finger ID as receiver.
To decrypt a file, you need both the secret key (which must be put in a secure place) and the passphrase. Use the following command to decrypt a file whose the receiver is you:
gpg -d somemsg.asc
You will be asked for the passphrase if the secret key is found.
If you want to encrypt a file without receiver (anyone can open it with the passphrase), use the -c flag:
gpg -ac -o somemsg.asc somemsg
You will have to enter the passphrase twice.
Why to sign a file?
If the receiver has your public key, the program will check if you are really the one who sent the file or not, since you need both the secret key and the passphrase to sign a file.Sign a file
To integrate signature within data in the same filegpg --clear-sign -u your_mail -o output.asc somemsg
separate the signature from the data, still in the same file
gpg --clear-sign -u your_mail -o output.asc somemsg
to make a detached signature file
gpg -b -u your_mail -o output.asc somemsg
In the 3 cases above, you need the secret key of the e-mail or the finger ID you entered, then you have to enter the password interactively.
login or register to post comments | printer friendly page
Using crontab

Submitted by Swobodin on Fri, 2006-01-06 14:35. ::
If you want to organize automated tasks, use the crontab software which is included with Fedora Core (as well as the most GNU/Linux distributions).
You may either use the predefined settings or set it yourself.
First, make sure that the cron daemon is activated
Available folders are /etc/cron.hourly, /etc/cron.daily, /etc/cron.weekly and /etc/cron.monthly
For example:
The script above will be executed each day. It archives Apache log files, sort archives by date and empty log files.
To set an action every 6 hours
Every Thursday of January and March at 3:20 AM
Every Friday 13th, you will set a reminder :-)
You may either use the predefined settings or set it yourself.
First, make sure that the cron daemon is activated
chkconfig crond on
Use the predefined settings
Put your script (Bash, Perl, Python, etc.) into /etc/cron.hourly if you want to execute it each hour, /etc/ron.daily if each day, etc.Available folders are /etc/cron.hourly, /etc/cron.daily, /etc/cron.weekly and /etc/cron.monthly
For example:
cat > /etc/crontab.daily/archive_httpd
#!/bin/sh
folder=/Logs
if [ ! -d /Logs] then
mkdir /Logs
fi
#backup logs folder
tar cvfz /Logs/log_httpd_$(date +%Y%m%d).tar.gz /var/log/httpd
#Empty folder
for i in /var/log/httpd/*
do cat /dev/null > $i
done
^D
The script above will be executed each day. It archives Apache log files, sort archives by date and empty log files.
Set your own timing
The file /etc/crontab consists of the followingminute hour day month day_of_week action
To set an action every 6 hours
0 */6 * * * ~/bin/yourscript.sh
Every Thursday of January and March at 3:20 AM
20 3 * 1,3 4 ~/bin/your_other_script.pl
Every Friday 13th, you will set a reminder :-)
* * 13 * 6 echo "Today is 13th, buy a loto card!" | mail -s "Good luck"
login or register to post comments | printer friendly page
Dumping commandlines

Submitted by Swobodin on Tue, 2005-12-27 13:20. ::
This article will teach you how to dump whatever you want in either a log file or a terminal.
The generated file my_log contains all what you wrote and all what stdout displayed. To view it, type
To record only 1 command:
For example:
or
This will dump all to the terminal as stdout.
If you want to make a demonstration, and show the result to all people who are supposed to be connected to your machine via SSH
create a non-privileged user:
Start your SSH server
Check who is connected
Dump everything to user test's terminal
Record output to a log file
$ script my_log
Script started, file is my_log
$ ls
. .. myfile mydir/
$ echo "test"
test
^D
Script done, file is my_log
The generated file my_log contains all what you wrote and all what stdout displayed. To view it, type
cat my_log
To record only 1 command:
script -c 'ping 192.168.0.5' my_log
Script started, file is my_log
PING 192.168.0.5 (192.168.0.5) 56(84) bytes of data.
64 bytes from 192.168.0.3: icmp_seq=0 ttl=64 time=0.058 ms
64 bytes from 192.168.0.3: icmp_seq=1 ttl=64 time=0.045 ms
^C
Script done on Tue 27 Dec 2005 01:29:41 AM CET
Record output to a terminal
First, check out whether you have write permission on the terminal; means you are the owner or you are root.For example:
script /dev/tty2
or
script /dev/pts/3
This will dump all to the terminal as stdout.
If you want to make a demonstration, and show the result to all people who are supposed to be connected to your machine via SSH
create a non-privileged user:
su
Password:
adduser test
passwd test
Changing password for user test.
New UNIX password:
BAD PASSWORD: it is too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
Start your SSH server
/etc/rc.d/init.d/sshd start
Starting sshd: [ OK ]
Check who is connected
w
test pts/6 01:41 3.00s 0.20s 0.20s -bash
Dump everything to user test's terminal
script /dev/pts/6
login or register to post comments | printer friendly page
Burn your CD's under Fedora Core

Submitted by Swobodin on Thu, 2005-12-22 10:22. ::
To create a CD, you should first create an ISO file, then to burn it.
To create an image file, use mkisofs:
Where
The simplest method is using cdrecord:
Where
To copy a CD on the fly (very risky)
Create an ISO file
If you want to copy from the cd, use dd command:dd if=/dev/hdc of=img.iso
To create an image file, use mkisofs:
mkisofs -publisher yourname -V your_CD_name -RUJ your_directory > image.iso
Where
-R: Generate SUSP and RR records using the Rock Ridge protocol to further describe the files on the iso9660 filesystem.
-U: Allows "Untranslated" filenames, completely violating the iso9660 standards described above.
-J : Generate Joliet directory records in addition to regular iso9660 file names.
Burn your ISO
Assuming that your write device is /dev/hdd, no need to usecdrecord -scanbus
in 2.6.x kernels. Check that you have write permissions on the device.The simplest method is using cdrecord:
cdrecord -v -eject dev=/dev/hdd speed=16 -dao -pad -data /path/to/file.iso
Where
-dao : Disk at once
-v: verbose mode
-eject: eject after burning process
dev=/dev/xxx replace it with your CD recorder device
speed=xx select the speed
-pad -data: Is set by default, only to make difference with -audio
On the fly
To avoid creating an ISO image in your hard disk, pipe the 2 commands (takes more memory and buffer)mkisofs -publisher yourname -V your_CD_name -RUJ your_directory | cdrecord -v -eject dev=/dev/hdd speed=16 -dao -pad -data -
To copy a CD on the fly (very risky)
dd if=/dev/hdc | cdrecord -v -eject dev=/dev/hdd speed=16 -dao -pad -data -
login or register to post comments | printer friendly page
first page
previous page
1
2
3
4
5
6
7
8
9
next page
last page
Recent comments
1 week 3 days ago
2 weeks 3 days ago
2 weeks 5 days ago
3 weeks 2 days ago
3 weeks 5 days ago
3 weeks 5 days ago
3 weeks 5 days ago
4 weeks 6 days ago
5 weeks 22 hours ago
5 weeks 23 hours ago