Categories
Tech Tips

How to hide the title of specific post or page in WordPress 3.3

This makes sense especially for article that you’ve made as the static front/home page.

Add the following HTML into the post or page’s code:

<style>
.entry-title {display:none;}
</style>
Categories
Tech Tips

How to combine 2 single-page PDFs into 1 page

(1) Join the 2 separate PDFs into 1 file (e.g. joined.pdf) using tools such as pdfunite, pdfsam or pdfshuffler.

(2) Install pdfjam.
(Note: If you’re using Arch Linux, pdfjam is included in the texlive-bin package)

(3) Use the pdfnup tool from the pdfjam package to merge page 1 and page 2 of joined.pdf into a new pdf file consisting of only a single page, with page 1 stacked on top of page 2:

$ pdfnup joined.pdf --nup 1x2

Categories
Huh!?

Noted!

Just asked someone a simple question with binary answer, either a Yes or a No, but he replied ‘Noted!’. So should I take follow-up action based on Yes or No? Bwahaha… don’t know what to say. 😛

Categories
Tech Tips

How to check if promiscuous mode is enabled on network interface in Linux

$ netstat -i

Look under the last column “Flg” for value “P”. If it’s there, it means promiscuous mode is enabled for that network interface. Is the flag really P and not M? Here’s a quick test. Check existing active flags:

[root@localhost ~]# netstat -i
Kernel Interface table
Iface       MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0       1500   0     2075      0      0      0     1366      0      0      0 BMRU
lo        16436   0     1985      0      0      0     1985      0      0      0 LRU

Turn multicast off on eth0:

[root@localhost ~]# ip link set eth0 multicast off

Notice that the ‘M’ flag is gone? So, M is for multicast:

[root@localhost ~]# netstat -i
Kernel Interface table
Iface       MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0       1500   0     2075      0      0      0     1369      0      0      0 BRU
lo        16436   0     1985      0      0      0     1985      0      0      0 LRU

Turn promiscuous mode on:

[root@localhost ~]# ip link set eth0 promisc on

Notice that the ‘P’ flag is now shown:

[root@localhost ~]# netstat -i
Kernel Interface table
Iface       MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0       1500   0     2075      0      0      0     1370      0      0      0 BPRU
lo        16436   0     1985      0      0      0     1985      0      0      0 LRU

UPDATE 20130531: This post wrongly indicated that the “M” flag indicates promiscuous mode. Sorry for the confusion. I got that from other incorrect sources as well. It seems quite many online sources got that wrong. Thanks to the helpful commenters for correcting this mistake.

Categories
Tech Tips

GVim problems after upgrading to Ubuntu 11.10 Oneiric Ocelot

After upgrading Ubuntu 11.04 (Natty Narwhal) to 11.10 (Oneiric Ocelot), GVim starts to behave weirdly.

6 May 2012 UPDATE: Issue persists even after upgrading to 12.04 (Precise Pangolin)! 🙁

Symptoms:

  1. It sometimes freezes during startup, rendering the window greyish. If you wait, it may or may not regain control.
  2. When it doesn’t freeze during startup, typing response becomes very slow. For example, when you hit ‘j’ to move the cursor down 1 line, it takes ~7s before the action takes place. Key response then returns to normal if GVim is editing an empty file.
  3. When GVim loads a large file, typing response becomes very slow all the time.
  4. Sometimes you may see this error in the Terminal window you used to run gvim:
    ** (gvim:5933): IBUS-WARNING **: Create input context failed: Timeout was reached.
  5. Other times you may see this instead:
    ** (gvim:5760): WARNING **: Unable to register window with path '/com/canonical/menu/5C00024': Timeout was reached

Workaround:

Run gvim -f instead of just gvim.

Put this in your .bashrc if you don’t want to add -f all the time, or if you already have other aliases using gvim and you don’t want to change all of them:

gvim(){ setsid /usr/bin/gvim -f "$@"; }

Categories
Tech Tips

How to identify package of particular file and verify its integrity

Let’s say we need to:

  1. Find out which package contains the file /bin/su in Linux
  2. Verify if the file is untainted (from package) or changed in some manner

For RPM (Fedora, Red Hat, CentOS):

$ rpm -q -f /bin/su
coreutils-5.97-34.el5
$ rpm -V coreutils-5.97-34.el5

For DEB (Debian, Ubuntu):

$ dpkg -S /bin/su
login: /bin/su
$ debsums -s -a login
Categories
Tech Tips

How to reduce size of VirtualBox VDI file

Scenario:

VirtualBox version = 4.0.12
Guest OS = Win 7
Host OS = Linux Mint 9 Isadora (based on Ubuntu)

Perform these tasks on all the Win 7 local hard-disks:

  1. chkdsk /F
  2. defrag /X
  3. sdelete -z

Shutdown the Win 7 VM, then run this command on Mint:

$ VBoxManage modifyhd win7.vdi --compact

That freed up 5GB of space for me, a 20% reduction.

Categories
Tech Tips

How to install GPMC on Windows Server 2008 R2

Command-line method:
  1. Open cmd.exe as Administrator
  2. Run this command: ServerManagerCmd.exe -install gpmc
GUI method:
  1. Open: Start > Administrative Tools > Server Manager
  2. Select ‘Features’ on the left panel
  3. Menu: Action > Add Features
  4. Check the ‘Group Policy Management’ feature
  5. Follow through the wizard to complete installation
Categories
Tech Tips

How to remove known password from protected PDF?

Install QPDF, then:

$ qpdf --password=? --decrypt in.pdf out.pdf

This doesn’t crack or guess the password for you. You must already know the password. It merely helps you to create a copy of the PDF without password protection.

Categories
Misc Quotes

A university is a living organism

A university is a living organism. Its role is not just to transfer knowledge to the younger generation but to also be at the forefront of knowledge creation and innovation so as to expand our collective knowledge as a society and make the world a better place.

— Bertil Andersson, President of NTU (Nanyang Technological University), 1 July 2011