Reference

From Daniel Crabtree

Table of contents

Find all encrypted EFS files on Vista

cipher /n /u

Find memory usage on linux

free -m

Note: buffers/cache use up memory, so ignore these. -/+ buffers/cache row is useful for this.


Find size of folder on linux

du -s folder(s)

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

I have found that if everything was installed correctly, this happens when trying to test via SSH and via running mysql. It occurs because mysqld is not running. If you try and start that using /etc/rc.d/init.d/mysql start, that fails. The problem is that the /etc/my.cnf file is wrong - probably for an older version like using 4.1 with 5.0. Update it to one of the defaults like my-huge.cnf and start customizing from that base. It should now work.

Ferrari Red RGB

245 24 39

Generating Public ResX Files in Visual Studio 2008

Change the Custom Tool from ResXFileCodeGenerator to PublicResXFileCodeGenerator and set the namespace.

Replacing Notepad on Vista

1. Run command prompt with Administrator privileges. Search on start menu for cmd, Right Click, Run as Administrator.

2. Grant ownership to your user account. takeown /f c:\Windows\System32\notepad.exe

3. Grant full control to your user account. icacls c:\Windows\System32\notepad.exe /grant username:(F). Replace username with your username, using quotes if it contains spaces.

4. Replace notepad.exe in c:\Windows\System32\notepad.exe with the notepad replacement of your choice.

Command to Shutdown and Power Off Windows XP

This is useful when connected to a machine via remote desktop.

1. TSSHUTDN.EXE 0 /DELAY:0 /POWERDOWN

Regular Expression

Match Until String

Often when processing markup like HTML and XML, the regular expression should match everything upto or until some string occurs, say the string ``gobble. This is achieved by the following regular expression:

(.(?!gobble))*

As an example, we might want to match the first hyperlink that occurs inside a table row. The following is a simple expression that attempts, but fails, to capture this:

<tr>.*<a href="([^"]*)"

The problem is that the table row might be terminated before a matching hyperlink occurs. As the regular expression states, it will match the first hyperlink that follows the start of a table row. As such, that regular expression will match ``somelink.html in the following document.

<tr> .... </tr> .... <a href="somelink.html">link to somewhere</a> ...

The correct way to achieve the desired result is to only match until the end of the table row. This is achieved using the match until syntax as follows:

<tr>(.(?!</tr>))*<a href="([^"]*)"

Linux Commands

Get Hard Drive Information

hdparm -I /dev/hda

This command finds the various information about the hard drive mounted as /dev/hda, for instance it finds the model, serial, size, supported features, etc.

Restart APF

/etc/init.d/apf restart

Determine Kernel Version

uname -r

SpeedStep Configuration Location

/sys/devices/system/cpu/

Unable to Load IPTables Fix APF for 2.6 Kernel

Edit: /etc/apf/internals/functions.apf


Find:

ml ipt_state 1

ml ipt_multiport 1


Replace:

ml xt_state

ml xt_multiport

Use SSH v2

Edit: /etc/ssh/sshd_config

Protocol 2

Views
Personal tools