Posted by marian
on January 20, 2010
I believe that everybody came across the need to convert some Microsoft Office document into PDF format. Under GNU/Linux this can be accomplished very simply.
If you are a student and all the courses are in PowerPoint and you want to read them as PDF under GNU/Linux using the awesome evince, then you will appreciate this tutorial. ( Question to the reader: Why does Evince look so good, while the GNU/Linux version of Acrobat Reader is so sluggish ?)
Steps to follow:
1) Install OpenOffice
2) Install Cups-PDF:
-
sudo apt-get install cups-pdf (Ubuntu)
-
sudo yum install cups-pdf (Fedora)
3) Create a PDF directory in your home directory if it doesn’t exist:
4) For converting a single *.ppt file to *.pdf you should use:
-
soffice -norestore -nofirststartwizard -nologo -headless -pt PDF your_pdf_file.ppt
But this can be achieved easily using OpenOffice GUI.
Now I will show you how easy is to convert all the files in a directory to PDF files and then merge them in a single PDF file. You just have to go to the directory containing your files and then execute :
-
find . -type f -name "*.ppt" -exec soffice -norestore -nofirststartwizard -nologo -headless -pt PDF {} \;
Find will search in the current directory for all the files (due to “-type f”) and having the extension ppt (due to -name “*.ppt”) and convert them into PDF files.
You might also use *.doc (Microsoft Word), and i think (not tested) that also *.pptx and *.docx (Microsoft Office 2007) could be used. The output files will be stored in the ~/PDF directory.
Now the PDF merging stage. There are many tools that can do this under Linux, but I prefer pdftk which can be installed using:
-
sudo apt-get install pdftk (Ubuntu)
-
sudo yum install pdftk (Fedora)
And here is the easiest way to merge all the PDF files in a directory:
-
pdftk *.pdf output merged.pdf
where merged.pdf is the name of the merged file
).
Posted by marian
on November 01, 2009
PATH=/sbin:/usr/sbin:/bin:/usr/bin
export PATH
# flush all chains
iptables -F
# set the default policy for each of the pre-defined chains
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
#qemu, kvm
iptables -A POSTROUTING -s 192.168.122.0/24 -d ! 192.168.122.0/24 -j MASQUERADE
#create a new chain for reporting droped packets
iptables -N LOGDROP
iptables -A LOGDROP -j LOG
iptables -A LOGDROP -j DROP
# allow establishment of connections initialised by my outgoing packets
iptables -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
#qemu, kvm
iptables -A INPUT -i virbr0 -p udp -m udp --dport 53 -j ACCEPT
iptables -A INPUT -i virbr0 -p tcp -m tcp --dport 53 -j ACCEPT
iptables -A INPUT -i virbr0 -p udp -m udp --dport 67 -j ACCEPT
iptables -A INPUT -i virbr0 -p tcp -m tcp --dport 67 -j ACCEPT
iptables -A INPUT -p tcp --dport 111 -j DROP
# accept anything on localhost
iptables -A INPUT -i lo -j ACCEPT
#!!!!#drop everything else
iptables -A INPUT -j LOGDROP
#qemu, kvm
iptables -A FORWARD -d 192.168.122.0/24 -o virbr0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -s 192.168.122.0/24 -i virbr0 -j ACCEPT
iptables -A FORWARD -i virbr0 -o virbr0 -j ACCEPT
iptables -A FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable
iptables -A FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable
#!!!!#drop everything else
iptables -A OUTPUT -p tcp -m tcp --dport 5432 -j DROP
iptables -A OUTPUT -p tcp -m tcp --dport 8443 -j DROP
iptables -A OUTPUT -p tcp -m tcp --dport 5432 -j DROP
iptables -A OUTPUT -p tcp -m tcp --dport 8080 -j DROP
iptables -A OUTPUT -p tcp -m tcp --dport 1900 -j DROP
iptables -A OUTPUT -p tcp -m tcp --dport 135 -j DROP
iptables -A OUTPUT -p tcp -m tcp --dport 435 -j DROP
iptables -A OUTPUT -p tcp -m tcp --dport 631 -j DROP
iptables -A OUTPUT -p tcp -m tcp --dport 111 -j DROP
iptables -A OUTPUT -p tcp -m tcp --dport 25 -j DROP
iptables -A OUTPUT -p tcp -m tcp --dport 4444 -j DROP
iptables -A OUTPUT -p tcp -m tcp --dport 8099 -j DROP
iptables -A OUTPUT -p tcp -m tcp --dport 6000 -j DROP
iptables -A OUTPUT -p tcp -m tcp --dport 2049 -j DROP
iptables -A OUTPUT -p tcp -m tcp --dport 5901 -j ACCEPT
iptables -A OUTPUT -j ACCEPT
#iptables -A LOGDROP -m limit --limit 1/sec -j LOG --log-prefix "iptables denied: " --log-level 7
#iptables -A LOGDROP -j DROP
Posted by marian
on October 26, 2009
There comes a day when you need to squize every bit of performance from Erlang or you need it for some exotic platform (or you are just a Slackware user). For doing this you either improve your program or use Erlang Virtual Machine optimization. This tutorial comprises the steps needed to compile Erlang.
- First get the tools needed for compilation: sudo apt-get install build-essential libncurses5-dev m4 openssl libssl-dev unixodbc-dev libstdc++5 libc6 .Please note that you need to install libstdc++5 R(compatibility) inspite the fact that you may have a newer version (they can co-exist). Regarding wx, well I had some issues with it. By some way you should have on your system:
libpthread-stubs0
libxcb1-dev
libx11-dev
mesa-common-dev
libgl1-mesa-dev
libglu1-mesa-dev
libice-dev
libsm-dev
x11proto-xext-dev
libxt-dev
freeglut3-dev
libglut3-dev
wx2.8-headers
libwxgtk2.8-dev
wx-common
wx2.8-i18n
- First go to you build directory (were you usually to the builds of you programs).
- Get the Erlang source. What a pity… there is no cvs or svn repository. Get Erlang source code
-
-
wget http://www.erlang.org/download/otp_src_R13B02.tar.gz
-
-
tar -xzf otp_src_R13B02.tar.gz
- In the Erlang source directory run the configuration script: ./configure. You can pass arguments to configure (see the docs), I use: ./configure –enable-smp-support –enable-threads –enable-kernel-poll –enable-hipe –with-ssl
- Compile the source code: make
- Install it using: sudo make install, but I do not recommend it. I generally have on my system multiple Erlang builds. Some of them use precise floating for backpropagation in neural network learning, others use fast floating point for instance in genetic algorithm testing, and last but not least some or compiled so that the node data throughtput is enhanced (crypto package, memory stores -> streaming).
Posted by marian
on October 24, 2009
Did you ever run “which” or “locate” commands on *nix systems and no result was returned ?
If you just installed the operating system or something weird has happened with it, you might try to updating the file name database and then retry to find that file. The reason for not finding it using “which” or “locate” might be due to an outdated name database. This issue can be solved easily using the fallowing command:
Posted by marian
on October 18, 2009
There are a number of situations when one has to know the PID of the process that opened a port; this situations include, but are not limited to:
- you design Web Applications, someting has when terribly wrong, and you need to kill the webserver; you can either search for its PID or you can use the fuser command:
As a matter of fact, I have to kill Tomcat quite often.
Another situation when you need to know the PID is when you think that your computer is being gacked
Posted by marian
on October 18, 2009
1) Installing Erlang is very easy, but compiling it is rather difficult. Depending on the underlying Operating System one could use:
Ubuntu
Fedora
Windows
-
http://www.erlang.org/download.html
2) For writing the Erlang programs (modules) one could use :
vim
Ubuntu
Fedora
For other OSs:
-
http://www.vim.org/download.php
emacs
SciTE
3) For a build machine (compiling + Eunit testing + deployment) I use Sinan.
a) First you have to install Faxien. This can be easily done with the following script (choose according to your OS):
-
http://code.google.com/p/faxien/downloads/list
b) To install Sinan use:
-
faxien install-release sinan
4) As an example lets build our code:
and let us test it using Eunit (the corresponding of JUnit in the Erlang world):
Posted by marian
on October 11, 2009
On *nix, i.e. Linux (Ubuntu,Fedora,RedHat, etc.) or BSD (FreeBsd,NetBsd) one can use the following
-
mkisofs -o NameOf_ISO.iso -J DirectoryToBeTransformedInIso/