Secure erase a hard drive – ATA Secure Erase

  1.  Boot into any kind of Linux
  2. Run hdparm -I /dev/sda where /dev/sda is the device to be wiped
  3. At the end of the output, look for this:
    1. Security:
      	Master password revision code = 65534
      	not	enabled
      	not	locked
      	not	expired: security count
      		supported: enhanced erase
    2. If you see frozen, this process will not work. Try putting the system to sleep and then waking it up again, then run the above command again. If it says NOT frozen, then you’re good to go.
  4. Run this command to set the password
    sudo hdparm --user-master u --security-set-pass Password /dev/sda

    Bold text is a password you create.

  5. As long as you don’t see SECURITY_SET_PASS: Input/output error, it worked.
  6. Run
    time hdparm --user-master u --security-erase Password /dev/sda

    to start the process.

  7. Once it’s done, you’ll see the time listed afterwards, i.e.
    real 69m29.540s

Run gparted and make sure there are no partitions listed to be certain that the erasure was successful.

Clonezilla clone to smaller drive

Original image made on 500GB drive. Even after shrinking partition and reimaging, Clonezilla still knows the original drive was 500GB; cloning to 320 doesn’t work.

With shrunken partition image, choose expert settings and choose -icds option to bypass size check.

WiFi power switch not working / disable switch

If all fails, try this:

  1. Remove wifi card (usually under an easily accessible trapdoor on bottom of laptop)
  2. Place a 1mm x 5mm piece of sticky tape (I used medical micropore, but insulation tape should work) over pin 20 connector to insulate the pin from the connector (see image – image is taken with “chip” and antenna connectors etc facing away from camera – is basically 2nd connector on the wider side from notch on underside of wifi card)
  3. Replace wifi card

Nexus 10 start to bootloader

Hold down both volume buttons and power for bootloader.
In stock recovery, press power and quickly press volume up (the one further away from the power button) to show the menu. Really, you should flash a new recovery while in the bootloader.

Android reflash system without wiping data

Download factory image – depends on device. (tgz file?) Unzip all files. There will be a bootloader file and another zip file containing boot.img, cache.img, system.img

fastboot flash bootloader bootloader-hammerhead-hhz12d.img (example filename)
Reboot the bootloader.
fastboot flash boot boot.img
fastboot flash cache cache.img
fastboot flash system system.img
fastboot reboot
echo “Done this is a dummy line – to make the above line run in case you are copying this directly into the shell”

Apply OTA update manually (ADB over USB)

1. Download correct OTA update package (must match current version on device)
2. Acquire USB driver (Nexus:
3. Run adb reboot bootloader
4. Use the volume up/down keys to navigate to “Recovery mode”, then press the power button.
When the Android with the red exclamation point appears, hold down power first, followed quickly by volume up. You should now see the recovery menu.
5. Use the volume up/down keys to select “apply update from ADB,” then press power to select it.
6. Force driver install – Android ADB Interface
7. adb sideload [filename]
8. Wait and pray that it works.

If it doesn’t work – which it didn’t for me – get the original full image and flash that. Flash system without wiping data

Replacing Samsung DP500A2D (Series 5) Hard Drive / Disassemble

Remove two screws on bottom edge, near where the stands are

Remove memory cover, remove one screw at the top, remove screw on the side & slide out optical drive

Gray cover has to be unclipped from the chassis. There are two slots near the first screws removed; get a screwdriver/spudger in there and start prying up (bend upwards/outwards to pop off the gray cover – don’t try to pry off the black part!)

Keep prying all the way around the entire edge of the machine.

Raspberry Pi Power Off Shutdown Switch Button


Python script – change gpio_pin_number to corresponding pin on board. On Pi 1 rev B, GPIO pin 7 and ground pin are the ones closest to the composite video port.

#This script was authored by AndrewH7 and belongs to him (
#You have permission to modify and use this script only for your own personal usage
#You do not have permission to redistribute this script as your own work
#Use this script at your own risk

import RPi.GPIO as GPIO
import os

#Replace YOUR_CHOSEN_GPIO_NUMBER_HERE with the GPIO pin number you wish to use
#Make sure you know which rapsberry pi revision you are using first
#The line should look something like this e.g. "gpio_pin_number=7"

#Use BCM pin numbering (i.e. the GPIO number, not pin number)
#WARNING: this will change between Pi versions
#Check yours first and adjust accordingly

GPIO.setup(gpio_pin_number, GPIO.IN, pull_up_down=GPIO.PUD_UP)
#It's very important the pin is an input to avoid short-circuits
#The pull-up resistor means the pin is high by default

    GPIO.wait_for_edge(gpio_pin_number, GPIO.FALLING)
    #Use falling edge detection to see if pin is pulled 
    #low to avoid repeated polling
    os.system("sudo shutdown -h now")
    #Send command to system to shutdown

#Revert all GPIO pins to their normal states (i.e. input = safe)

To make the script at run at startup, edit rc.local – sudo nano /etc/rc.local

Then navigate to the bottom of this file and just before the “exit 0” line which is at the very end, add this:

python /home/pi/

Then plug in the button.

Create a free website or blog at

Up ↑