My digital playground

Listing and counting installed packages

Filed under: Uncategorized — Tags: , , — Andre @ 11:09 February 20th, 2009

To see what and how many packages you have installed on your Debian system (including derivatives like Ubuntu) system there are some simple commands to use:

To list all installed packages including version and description use
dpkg -l
This should be piped to less using | less for better reading.

You may also use the following to print only the packages without version and description using
dpkg --get-selections | awk '{print $1}'
This command can easily be piped to a file for saving using > file_name

It’s also easy to count the number of installed packages using
dpkg --get-selections | wc -l

Hide a user in Windows XP

Filed under: Uncategorized — Tags: , , , , — Andre @ 11:06 February 9th, 2009

Have you ever wanted to hide a user from the login screen in Windows for various reasons? The answer may be split but the solution is simple:

  1. First we need to open Registry editor by running (Win+R) regedit
  2. Locate the key HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsNT\CurrentVersion\Winlogon\SpecialAccounts\UserList
  3. Under this key create a new DWORD that matches the username exactly, and set the value to 0 (zero) to hide it

If you later want to show it just change the value from 0 to 1.

BruisedFruit rewrite rule for nginx

Filed under: Uncategorized — Tags: , , , — Andre @ 10:53 February 3rd, 2009

BruisedFruit (previously known as QWiki) is an ultra-lightweight PHP wiki implementation designed for people who (from time to time) need to quickly and easily setup a small, bloat-free wiki that ‘just works’.

And here are a rewrite rule to make it work on nginx:

# SEO friendly URLs for BruisedFruit
#
location /wiki/ {
   if (!-e $request_filename) {
      rewrite ^/wiki/search(.*)$ /wiki/search.php?search=$1 last;
      rewrite ^/wiki/([^/]+)/([^/]+)/?$ /wiki/index.php?page=$1&timestamp=$2 last;
      rewrite ^/wiki/(.*)$ /wiki/index.php?page=$1 last;
   }
}

Backing up and restoring MySQL from shell

Filed under: Uncategorized — Tags: , , , , — Andre @ 10:51 February 1st, 2009

Backup is a VERY nice thing. I’m unfortunately not the best to remember it myself and it’s been costly.. But it is also very nice to dump all tables to a file and move it to another server and restore it with a simple command (after you have created the database of course).

To back up your database use the following command:
mysqldump -u [Username] -p[password] [databasename] > [backupfile.sql]

And to restore it again use this:
mysql -u [Username] -p[password] [databasename] < [backupfile.sql]

And then it’s done! Just remember to store your backups a safe place.