self deleting bash script

How to create a bash script that deletes itself

This script will delete itself via the shred command (secure deletion) when it exits

#!/bin/bash # # Author: Steve Stonebraker # Date: August 20, 2013 # Name: # Purpose: securely self-deleting shell script # currentscript=$0 # function that is called when the script exits . . . → Read More: self deleting bash script

remove magnify.exe

Problem You hate magnify.exe yet you are unable to delete magnify.exe Solution Take ownership of magnify.exe Move it to a new filename Celebrate i_hate_magnify.bat takeown /f “%windir%\system32\Magnify.exe” && icacls “%windir%\system32\Magnify.exe” /grant administrators:F echo “Took ownership of Magnify.exe!” move “%windir%\system32\Magnify.exe” “%windir%\system32\Magnify.exe.ihateyou” pause

Install byobu Ubuntu Precise

To fix the infinite scrolling issue with byobu and Ubuntu precise install it the following way:

apt-get install byobu echo “at the next prompt select ‘screen’ as the backend” byobu-select-backend

SOLVED – callee rc: co_e_server_exec_failure (0x80080005)


callee rc: co_e_server_exec_failure (0x80080005)

When starting Virtualbox 4.2.10 on Windows 7 I was encountering this error

Failed to create the VirtualBox COM object. The application will now terminate. Callee RC: CO_E_SERVER_EXEC_FAILURE (0x80080005) Cause

The problem is the %HOME%/.VirtualBox directory


To resolve the issue I followed these steps

Killed any VirtualBox .exe files that . . . → Read More: SOLVED – callee rc: co_e_server_exec_failure (0x80080005)

Howto Add Hex Numbers via Command Line

Recently I needed to calculate the starting and ending memory addresses of an IOS application (in order to dump it). As a result i needed to figure out how to add two hex addresses. Here’s what I discovered.

Basic Example

In this case we are adding 0x4f000 and 0x2000

$ printf “0x%X\n” $(( 0x4f000+0x2000 )) . . . → Read More: Howto Add Hex Numbers via Command Line

How to Send Mail From Ubuntu Precise


To send mail from the command line in Ubuntu Precise

sudo apt-get install mailutils

If you mess up configuring or want to reconfigure

dpkg-reconfigure mailutils Sending your test email

Let’s send a test email!

echo “test email body” | mail -s “test email subject” [email protected] Debugging issues tail -f /var/log/mail.err tail -f /var/log/mail.log Config . . . → Read More: How to Send Mail From Ubuntu Precise

Logstash Logrotate Howto


I was facing two problems with my Logstash setup

Logstash service constantly required manual restarts (no longer indexing, hanging process) Local log files were filling up my root partition Symptom

Logstash failed to:

Index events in the queue Trim its own logs =) Cause Indexing

I’m not sure why it was failing to index. . . . → Read More: Logstash Logrotate Howto

bat file as administrator

I wanted to be able to run a bat file as administrator in order to have an easy shortcut to edit my windows hosts file. Here’s what I found

Shortcut to edit windows hosts file as Admin Creating the batch file

Paste this in a new notepad file and save it somewhere as hosts.bat

takeown . . . → Read More: bat file as administrator

restart service over ssh

I recently ran in to trouble restarting neo4j over ssh

here’s the fix:

From machine calling neo4j host ssh -f [email protected]$HOST ‘sh -c “( (nohup sudo /etc/init.d/neo4j-service restart 2>&1 >output.file </dev/null) & )”‘ Target Machine Sudoers

Replace “someuser” with whatever user name you want

someuser ALL=NOPASSWD:/etc/init.d/neo4j-service * References starting-remote-script-via-ssh-containing-nohup git-hub-neo4j-issue (I’ve also documented this on . . . → Read More: restart service over ssh

Testing SSL Chaining Issues

Recently I needed to debug an issue by testing SSL chaining issues My old standby tools (curl and openssl were not reporting any errors) The exception PKIX path validation failed: Path does not chain with any of the trust anchors Cause The cert from the keystore does not match the cert from . . . → Read More: Testing SSL Chaining Issues