How to convert A4 paper format to read on Kindle 5

Posted on

Kindle is good for reading. However, the A4-size technical/academic paper is pain to read on Kindle 5—the fonts are too small. The “email to Kindl” converting tool provided by Amazon usually loses the formats in the technical paper. How to convert A4 paper format to read on Kindle 5? I use k2pdfopt tool (hey, source
Read more

How to make eps files using gnuplot

Posted on

How to make gnuplot generate eps files instead of plot the figures on screen? First, save a Gnuplot plot as a PostScript file by this commands: # gnuplot> load ‘saveplot’ # gnuplot> !mv my-plot.ps another-file.ps The saveplot file’s content: set size 1.0, 0.6 set terminal postscript portrait enhanced mono dashed lw 1 “Helvetica” 14 set
Read more

How to convert a .docx .doc MS Word file to pdf in command line on Linux

Posted on

How to convert a MS Word document file such as .docx and .doc to pdf on Linux using command line tools? Use LibreOffice: libreoffice –headless –convert-to pdf –outdir /path/to/out/dir/ /path/to/doc/docx/file While this LibreOffice answer works, the –headless option still needs as display, even though it does not use it. In otherwords, this option won’t work
Read more

How to change the window title font family and size in Gnome 3?

Posted on

It was ever possible to set it in gnome-teak-tool. However, in the latest Gnome 3, it disappears. Is there any other way to set it? The configuration is the org.gnome.desktop.wm.preferences titlebar-font under dconf. You can use dconf-editor to find the appropriate key entry and set it. Or use gsettings: $ gsettings set org.gnome.desktop.wm.preferences titlebar-font ‘Sans
Read more

How to use different keys for different git servers?

Posted on

I have access to different git servers. I have several keys for these servers. How to use different keys for different git servers? Use the .ssh/config file to specify different configuration for different SSH servers used by git: For example: Host git.example.org Port 22111 IdentityFile ~/.ssh/id_rsa.git.example.org Host code.example.org Port 22 IdentityFile ~/.ssh/id_rsa.code.example.org which specifies the
Read more

How to use LVM groups with libvirt

Posted on

libvirt uses files for VM images by default under /var/lib/libvirt/images/. LVM is a convenient tool for managing VM images. How to use LVM groups with libvirt? This post discusses the method to add LVM groups as a storage pool for libvirt: http://ailoo.net/2011/02/use-a-lvm-volume-group-with-libvirt/ For a general introduction of the storage management in libvirt, please check: http://libvirt.org/storage.html

How to find out which function causes Exception “Stack_overflow” in OCaml

Posted on

My OCaml program prints: Fetal error: Exception “Stack_overflow” without any further information. How to find out which function causes this “Stack_overflow” exception? First, recompile your OCaml program with -g. Second, rerun your OCaml program with OCAMLRUNPARAM=b and the backtrace will be printed out after the “Stack_overflow” exception.

How to install sbt for scala on Fedora Linux

Posted on

How to install sbt for scala on Fedora Linux? It is not included in the default Fedora repository although scala is included. The download page of scala-sbt.org provides the RPM package. You can install the sbt rpm package by yum. We only need the URL to the RPM package. Here, let take version 0.13.1 as
Read more

Linux timer sources

Posted on

Linux supports different timer sources and a machine can have multiple ones. How to find the available Linux timer source and the current one used? Find the current timer source: $ cat /sys/devices/system/clocksource/clocksource0/current_clocksource Find all available timer sources: $ cat /sys/devices/system/clocksource/clocksource0/available_clocksource

Xen HVM DomU configuration file

Posted on

An example of Xen HVM DomU configuration file. An example for install the OS from an ISO: name=”10.0.1.235″ vcpus=2 memory=2048 shadow_memory=8 disk=[‘file:/lhome/xen/vm-10.0.1.235/vmdisk0,xvda,w’, ‘file:/lhome/Linux-x86_64-DVD.iso,xvdc:cdrom,r’] vif=[‘bridge=xenbr0′] kernel=’/usr/lib/xen/boot/hvmloader’ builder=’hvm’ device_model=’/usr/lib64/xen/bin/qemu-dm’ extra=” vnc=1 vnclisten=”0.0.0.0″ vncpasswd=’1234567′ # vncdisplay=1 vncconsole=1 on_reboot=’restart’ on_crash=’restart’ An example for run the VM after installation: name=”10.0.1.235″ vcpus=2 memory=2048 shadow_memory=8 disk=[‘file:/lhome/xen/vm-10.0.1.235/vmdisk0,xvda,w’] vif=[‘bridge=xenbr0′] kernel=’/usr/lib/xen/boot/hvmloader’ builder=’hvm’ device_model=’/usr/lib64/xen/bin/qemu-dm’ extra=” vnc=1
Read more

How to delete a disk from a LVM group while keeping the data

Posted on

This is the scenario: I want to remove a old hard disk which is a LVM PV and contains data. There is free space available on other PVs in the VG. It should move the data from the disk to be removed to other PVs and then remove the disk. The process to remove sdb
Read more

How to attach and mount Xen DomU’s disk to Dom0

Posted on

How to attach and mount Xen DomU’s disk to Dom0 To attach phy:vg_xen/vm-10.1.1.228 to xvda on Domain-0: # xm block-attach Domain-0 phy:vg_xen/vm-10.1.1.228 xvda w Mount the new partition /dev/xvda2 to /mnt/xvda2: # mount /dev/xvda2 /mnt/xvda2 After finishing using the partition, umount it and detach it: # umount /mnt/xvda2/ # xm block-detach Domain-0 xvda