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

Categories
Misc Quotes Our Society Tech Encounters

The only ideology I really despise and dislike is the kind that is about exclusion of other ones

In an interview with Argentina’s La Pagina, Linux founder Linus Torvalds shares his view of Linux ideology.

Q: What ideology has Linux?

A: I don’t think there is an ideology, and I don’t think there *should* be an ideology. And the important part of that is the “an” – I think there can be *many* ideologies.  I do it for my own reasons, other people do it for _their_ own reasons. I think the world is a complicated place, and people are interesting and complicated animals that do things for complex reasons. And that’s why I don’t think there should be “an ideology”. I think it’s really refreshing to see people working on Linux because they believe they can make the world a better place by spreading technology and making it available to people more widely – and they think that open source is a good way to do that. That’s _one_ ideology. I think it’s a great one. It isn’t really why I started doing Linux myself, but it warms my heart to see Linux used that way. But I _also_ think that it’s great to see all the commercial companies that use open source simply because it’s good for business. That’s a totally different ideology, and I think that’s a perfectly good ideology too. The world would be a _much_ worse place if we didn’t have companies doing things for money. So the only ideology I really despise and dislike is the kind that is about exclusion of other ones. I despise people whose ideology is about “the one true ideology”, and not following that particular set of moral guidelines is “evil” or “wrong”. That’s just small-minded and stupid, to me. So the important part about open source is not the ideology – it’s just that everybody can use it for their own needs and for their own reasons. The copyright license is there to keep that openness alive, and to make sure that the project doesn’t fragment into people who hide their improvements from each other and then have to re-implement each others changes – but it’s not there to enforce some ideology.

Categories
Tech Tips

https page that includes other resources which are not secure

Question: How to find out what contents on a HTTPS page is retrieved using HTTP, i.e. unencrypted in transit and thus open to sniffing?

Answer: Use Google Chrome web browser’s Developer Tools. Look under “Console” and you’ll see lines that look like this:

The page at https://www.example.com displayed insecure content from http://feeds.feedburner.com/notsecure.