Web

Left and Right align text on the same line

It can sometimes be useful to have some text be aligned to the left and some text be aligned to the right on the same line, eg in a footer. Here is how this can be done in HTML: <div id=”footer”> <p class=”leftalign”>Text on the left.</p> <p class=”rightalign”>Text on the right.</p> </div> If you were […]

Read More
Web

Using multiple CSS classes

Let’s say you need six different 100px square boxes with different characteristics: Red with Border Blue with Border Green with Border Red without Border Blue without Border Green without Border You COULD create a unique class for each of these: .redwithborder { width: 100px; height: 100px; margin: 10px; float: left; background-color: red; border: 3px solid […]

Read More
Linux

Making /tmp non-executable

Many simple exploits that are used against machines, (via vulnerable PHP applications or local users, etc), rely upon being able to execute commands in /tmp. If this is a seperate partition or file system you can gain some protection by marking it non-executable. The common problem with this is that apt-get fails to work with […]

Read More
Linux

How to restore Grub from a Ubuntu Live CD

This will restore grub if you already had it installed but lost it due to a Windows install or some other accident that erased/changed your master boot record (MBR) so that grub no longer appears at startup or it returns an error. Boot into the Ubuntu Live CD. This can be the Live installer CD […]

Read More
Scripting

Formatting date in MS-DOS batch file

I needed to make a simple MS-DOS backupscript in Windows XP today and the files were supposed to be stored in folders named by the current date, ISO style. I ended up formatting the date using the following command echo %date:~6,8%-%date:~3,2%-%date:~0,2% Output 2007-10-02 The script @echo off REM Declare variables Set TODAYSDATE=%date:~6,8%-%date:~3,2%-%date:~0,2% Set DATADRIVE=c: Set […]

Read More