Securely Overwriting Free Space on Windows

When you delete a file from the recycle bin in Windows, rather than deleting the actual file, the space the file is occupying is simply marked as free so that another file can come and use those blocks on your hard drive. One way of making sure that your data is not recoverable is to simply overwrite all the free space with random data.

Read More

How to create a DDRescue Image and save space

As disk sizes explode, I’ve found myself having to mirror disks which I don’t have enough storage for. My tool of choice is ddrescue. However, it doesn’t support compression because it needs to be able to seek through the output as it rescues data. A solution I’ve found is to create a sparse file, format it btrfs, and mount it with the compression=lzo option. This allows ddrescue to operate normally, while giving me fast + decent compression.

Read More

Shell script for volume control

The base of the Linux sound software stack is formed by ALSA, the Advanced Linux Sound Architecture, with these days normally a midlevel layer on top in the form of Pulseaudio; you can arrange for volume adjustment at both levels; should preferably do so at the Pulseaudio one.

Pulseaudio makes available the pactl tool, which you can use in the form of, say,

pactl set-sink-volume 0 0
pactl set-sink-volume 0 50%
pactl set-sink-volume 0 +10%
pactl set-sink-volume 0 -10%

In Mint 17.3 pactl has a bug that necessitates writing that last example as pactl -- set-sink-volume 0 -10% instead; would not know if the Mint 18 version still has the issue; see https://bugs.freedesktop.org/show_bug.cgi?id=77108. The first 0 in those commands specifies the sink, the sound card, and is automatically correct if you have only one card installed. Otherwise decide which sink to use from the output of pactl list sinks. Use man pactl for further information.

At the ALSA level you have available the amixer command line mixer. For example,

amixer set Master 0
amixer set Master 50%
amixer set Master 10%+
amixer set Master 10%-

In this, not specifying a card number with -c <number> means card 0; if not, use aplay -l to identify the number. “Master” is the name of a generally available control; you can list available controls with amixer scontrols and learn more from man amixer.

If you are not specifying correct sink for pactl or card/device/control for amixer please see your outputs of pactl list sinks and aplay -l.

Installing Ffmpeg on xbian

For App to be able to create thumbnails and previews for video and audio files uses ffmpeg.
These instructions are specifically for version 8.0 (Jessie) of Debian/xbian.
Configure APT
Note: the commands in this section must be run as root
Add the following to the bottom of /etc/apt/sources.list:
deb http://www.deb-multimedia.org jessie main non-free
deb-src http://www.deb-multimedia.org jessie main non-free
Read More

PowerShell comparison operators -eq, -lt, -gt, -contains, -like, -match

If you are used to operators such as > or < or =, you have to do some rethinking. As with batch scripts, PowerShell uses abbreviations of the corresponding English words. -eq Equal -ne Not equal -lt Less than -le Less than or equal -gt Greater than -ge Greater than or equal You don’t need an if statement to test the result of a comparison operation. Without the if statement, the output of the comparison is, simply, TRUE or FALSE. Read More

.htaccess Error Documents

Apache allows you to customize the server at the directory level, using .htaccess files. This tutorial explains how to use them to serve custom 404 error (page not found), and other common error pages, to your users.
Server response codes
A server reponse code is a three digit number sent by a server to a user in response to a request for a web page or document. They tell the user whether the request can be completed, or if the server needs more information, or if the server cannot complete the request. Usually, these codes are sent ‘silently’ – so you never see them, as a user – however, there are some common ones that you may wish to set up error pages for, and they are listed below. Most people will only ever need to set up error pages for server codes 400, 401, 403, 404 and 500, and you would be wise to always have an error document for 404 errors at the very least.
It is also relatively important to ensure that any error page is over 512 bytes in size. Internet Explorer 5, when sent an error page of less than 512 bytes, will display its own default error document instead of your one. Feel free to use padding if this is an issue – personally, I’m not going to increase the size of a page because Internet Explorer 5 doesn’t behave well.
In order to set up an error page for any other error codes, you simply add more lines to your .htaccess file. If you wanted to have error pages for the above five errors, your .htaccess file might look something like this:
ErrorDocument 400 /400.html
ErrorDocument 401 /401.html
ErrorDocument 403 /403.html
ErrorDocument 404 /404.html
ErrorDocument 500 /500.html Read More