Drag-N-Drop Message Format

A little recognized feature in GNOME is the that e-mail messages can be drag-n-dropped from GNOME's Evolution to other applications. When a message from Evolution is dropped into Nautilus the message will be saved to the corresponding folder as an mbox file. This is useful, but probably not optimal, for a desktop environment.

To optimize this behavior the gsettings command can be used to change the default format as a PDF.

Windows "Uptime"

Windows XP and its brethren lack an uptime command. Yeah, the reason the probably obvious, but sometimes it would be nice to know. A user says they restarted their workstation... but most user's [including recent college graduates] don't know the difference between logging out and restarting. So how to know how long a workstation has been running?

explorer.exe /separate

The runas tool in Microsoft Windows serves the same purpose as the sudo tool on Open [or at least "open"] platforms. With runas you can execute commands in alternative security contexts. Only some tools in Microsoft Windows aren't normal; that is if you attempt to run them via runas.... often times nothing at all happens. One very significant example of this behavior is the Control Panel (control.exe).

Performing LDAP Binds With NTLM

With either a Windows Active Directory server or a Samba4 Active Directory server very little information is exposed for anonymous searches via LDAP. This means every search has to bind. Simple binds are insecure and in many cases not supported - for good reason, they are hopelessly insecure. But often times one doesn't want to bother with Kerberos (even as great as Kerberos is) due to ticket expiration, keytab paths, etc...

Deindexing A Table (PostgreSQL)

One of the key steps for performing tuning a database is to test indexing strategies and their effect on performance. It is a series of:

  1. Drop the indexes
  2. Create new indexes
  3. Update statistics
  4. EXPLAIN the important queries.

Rinse and repeat.

Encoding sambaNTPassword With Python

Samba's sambaNTPassword attribute, which mimics the corresponding NT / Active Directory attribute, has a value that must be a hex encoded MD4 hash of the user's password with a UTF-16 encoding. Fortunately generating such a string is a Python one-liner.

import hashlib

password = 'fred123'
nt_password = hashlib.new('md4', password.encode('utf-16le')).digest().encode('hex').upper()

Note that Samba wants all the alpha characters in the string as upper-case.The result will always be 32 characters long.

Discovering DLL Version With pefile

A Microsoft KB article claimed that if a specific DLL was at least a certain version that a bug reported by one of my users would be resolved. But the user was using their computer and I dislike interrupting people's work (I know how annoying it is when someone interrupts me). No problem; I can just grab the named DLL off their machine over the network and copy it to my home directory. But I'm not running Windows and all file tells me is that the DLL is a 32-bit PE file.

XSLT Transform to TXT, with LXML

Maybe this should be obvious, but it wasn't to me. I've got an XML document and an XSLT stylesheet. But that stylesheet just produces text, not XML; it is essentially a template for an e-mail. So I was extending OIE's transformAction for performing XSLT transforms that produce other than XML... but the documentation is a bit thin and every example is XML results. The trick is pretty simple, just

unicode(result)

and make sure [of course] that you have

Pages

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer