Printing

Force scaling of a document to fit in the current paper size:

lp -o fitplot 27842682.pdf

Define a particular paper size:

lp -o fitplot -o media=letter 27842682.pdf

Keyboard

layout

Change layout

setxkbmap -layout es

All available layouts on your system, check /usr/share/X11/xkb/symbols

Common cases

  • Spanish layout: es
  • Latin American: latam
  • US layout: us
  • US layout with accented chars: us, and add the -variant intl

NOTE: Running setxkbmap undoes whatever you have in your .Xmodmap. If you don't know what is xmodmap, don't worry. If you do, and you use it, you'll have to run xmodmap again

Enable NAT in Linux

Say eth1 is the internal (NAT) interface, and that eth0 is the interface that faces the Internet. Do the following:

echo 1 > /proc/sys/net/ipv4/ip_forward
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
/sbin/iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
/sbin/iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT

decent DNS servers

  • 208.67.222.222
  • 208.67.220.220

    Wintendo

When using (c)fdisk, to create a FAT32 filesystem, set its type to 0C. To create a NTFS filesystem, use the 07 type.

test SMTP session with telnet

> telnet localhost 25
HELO devnull.li
MAIL FROM:jerojasro@devnull.li
RCPT TO:jerojasro@gmail.com
DATA
Subject: blabla

email body
.

Encrypted USB external disk

Normal usage

To open the encrypted drive, use:

cryptsetup luksOpen /dev/sdd3 backupjerojasro

backupjerojasro is the name that will be assigned to the new virtual block device.

Mount the device as usual; the device si available at /dev/mapper

mount /dev/mapper/backupjerojasro /media/backup

When you're done with it, umount and close the LUKS device:

Umount it as usual:

umount /media/backup

and close the LUKS device:

cryptsetup luksClose /dev/mapper/backupjerojasro

Initial setup

  1. Create a normal partition on a physical device.
  2. Create the LUKS device:

     cryptsetup --verbose --verify-passphrase luksFormat /dev/sdd3
    
  3. Open the device, and create a normal filesystem on it (a good, killer FS is recommended):

     cryptsetup luksOpen /dev/sdd3 backupjerojasro
     mkfs.reiserfs /dev/mapper/backupjerojasro
    
  4. Close the LUKS device.

     cryptsetup luksClose /dev/mapper/backupjerojasro