Quick bash script to check if a volume is mounted

A quick and dirty little bash script to check if a mount point is active or not.

if grep -qs '/mnt/drive1' /proc/mounts; then
    echo "It's mounted."
    echo "It's not mounted."

You can easily change the code to automatically mount the volume (or unmount) as per your needs.

Installing Glances on Debian

Glances is a cross-platform curses-based system monitoring tool written in Python. It shows a large amount of information such as cpu usage, memory usage, hardware monitoring, battery monitoring and much more.

Install the required dependencies:

sudo apt-get install python-dev python-jinja2 python-psutil python-setuptools hddtemp python-pip lm-sensors
sudo pip install batinfo pysensors

If you are running on actual hardware (ie: not a vps like many of my servers), you should detect the sensors for that part of the monitoring:

sudo sensors-detect

Now install the actual Glances program:

sudo pip install Glances

And finally, you can run it by simply:

sudo glances

To upgrade, you can do

pip install --upgrade glances

There are also a number of other optional dependencies you can install:

bottle (for Web server mode)

py3sensors (for hardware monitoring support) [Linux-only]

hddtemp (for HDD temperature monitoring support) [Linux-only]

batinfo (for battery monitoring support) [Linux-only]

pymdstat (for RAID support) [Linux-only]

pysnmp (for SNMP support)

zeroconf and netifaces (for the auto discoverer mode)

influxdb (for the InfluxDB export module)

statsd (for the StatsD export module)

pystache (for the action script feature)

docker-py (for the Docker monitoring support) [Linux-only]

How to install Plex Media Server ob Debian Squeeze or Wheezy

Plex Media Server is a great server for playing media (tv, movies, pictures) on a variety of devices (Android, Roku, Smart TVs, Windows, Mac, IOS, etc). It supports transcoding, a very nice interface layout, tracks what episodes or movies you have already watched, share with your friends and with a plus pass (paid account) there are additional features as well such as sync so your device can sync when you are at home and let you play when you are mobile without using data to watch.

There is a third party repo that seems to be updated quite often (as of this article anyway) for Debian Squeeze and Wheezy. To use it, the instructions are pretty simple:

sudo apt-get install curl
echo "deb squeeze main" | sudo tee -a /etc/apt/sources.list.d/plexmediaserver.list
sudo curl | sudo apt-key add -
sudo apt-get update
sudo apt-get install plexmediaserver

Your server should now be installed and functional. The default port is 32400 for the web interface, so to manage it you can go to (change your ip as needed) and add in your media files. Have fun :)

How to use loopback addresses other than with OSX

Strange little thing I encountered a while back. Basically, I use ssh tunnels to a number of remote hosts and to organize it a bit easier, I tend to use 127.0.0.X and assign each server a different number. However, under OSX you cannot use any others except for

The fix isn’t too bad though, you basically need to add the interfaces either manually or at startup.

To add just a few, you can do:

sudo ifconfig lo0 alias up

and change 2 to whatever ip you need. However, if you want to add a large number or all of the possible ones, this will take a long time. So, a quick little script to do it would be something like:

for ((i=2;i<256;i++))
   sudo ifconfig lo0 alias 127.0.0.$i up

You could also change the 256 to something else like 50 if you don’t want the full list added.

How to clear DNS cache in various OS

There are a variety of reasons why (updated a DNS record, issues with resolver, etc) but sometimes a good diagnostic step is to clear out the dns cache.

Each operating system (and even versions / distributions in some cases) have a different method

OSX 10.10 > sudo discoveryutil udnsflushcaches

OSX 10.9 > dscacheutil -flushcache; sudo killall -HUP mDNSResponder

OSX 10.7 – 10.8 > sudo killall -HUP mDNSResponder

OSX 10.5 – 10.6 > sudo dscacheutil -flushcache

Windows > ipconfig /flushdns

Linux - There are many different distros and versions here, but one of the following should work > /etc/init.d/named restart

/etc/init.d/nscd restart

service nscd reload

sudo /etc/init.d/dnsmasq restart

service dnsmasq restart

How to remove the Google Chrome Name Badge

Google Chrome recently made a change to the display. They added a new feature that promises to be useful for some people, but it annoys me: My name being shown in the top right corner, allowing me to switch accounts.

While I can see the usefulness of the feature and I do have multiple google accounts, I rarely switch to them and usually do it through an incognito tab. Therefore, the added screen real estate that this feature takes up can be annoying. It’s pretty easy to get rid of it though.

First, go to the url Chrome://flags and then look for “Enable the new avatar menu”. Change this to disabled.

As an alternative if you don’t want to remove it, you can go to chrome://settings/manageProfile and change the name that is displayed as well as the icon.

Personally I’ve removed it, but it’s nice having options.

Adding an existing project to a Git repo

Just a quick tip for creating a new repo with existing files.

  1. Create a new repo on your preferred solution (I use Bitbucket but the other main choice is Github, it’s all about what works for you)

  2. Change to your project directory > cd ~/git/project

  3. Initialize the local directory as a repo > git init

  4. Add all files to the repo > git add .

  5. Write your first commit message > git commit -m ‘First commit’

  6. Tie your local files and remote repo together. For the url, an example would be ssh://, but the method to find it varies depending on your provider. Bitbucket shows it at the top of the main page and GitHub shows it along the right side. > git remote add origin repo_url_here

  7. Have git verify it can connect to the remote repo > git remote -v

  8. Push your initial commit to the remote url > git push origin master

Thats it, your repo is created and initial update complete. Now to continue your content and update it as needed.

How to install RepoForge (formerly RPMForge) on CENTOS 7

As I get back into using CENTOS, I will be posting a few guides on various things I find. One of the first things is to install RepoForge (formerly RPMForge) to give a number of programs such as htop that I really missed.

So, to get started, download this rpm:


The next step is to install it:

rpm -ivh rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm

And finally, update yum

yum update

And the repo is now installed and updated, feel free to install any packages you need.

Quick password generator

Just a quick little password generator, since I’ve had a couple people ask. It will generate 12 character passwords using a-z, A-Z. 0-9 and various symbols such as _ and -

tr -dc a-zA-Z0-9_- < /dev/urandom | head -c 12 | xargs

Thats it, short and simple but effective.

How to delete an EFI partition in Windows

Just the other day I had to repartition an external drive that had an EFI partition on it. It took a few minutes to figure it out so I thought I’d leave this here for myself and anyone else that might stumble upon the post. Disclaimer of course is that please be sure on which disk and partition you are picking in the following steps so you don’t remove the wrong one and lose data.

Make sure the drive in question is connected and then:

Open a command prompt with elevated permission

Run diskpart

To see all of your disks, type list disk

To select the disk, select disk #

Then select the partition with select partition #

And the last command to run is delete partition override

Now you can close diskpart and the command prompt. The EFI partition is gone :) - Vulnerable web app community is a free community project where people can build, share & host vulnerable web apps to learn and experiment. Each app is sandboxed for you so you are somewhat safe (as safe as you can be on a site with people uploading strange things for security people to break anyway). You can also upload private images for self use. It looks liek a handy tool for anyone interested in learning more about security and penetration testing.

How to configure dropbox for multiple users on a headless Debian / Ubuntu server

There are numerous guides around to configure Dropbox on a headless Debian or Ubuntu server but it seems everytime I go to do one, I can’t find the nice guide I usually use or a website is down when I look for alternatives. So here is my quick guide for myself and anyone else that might stumble upon this page :)

For 32bit:

wget -O dropbox.tar.gz

tar xzf dropbox.tar.gz


For 64bit:

wget -O dropbox.tar.gz

tar xzf dropbox.tar.gz


At this point, dropbox will complain about not being linked to an account and output a web address to follow, do that and login to your account and it will be linked.

Kill the dropbox that you started manually (requires pgrep, if you don’t have it you can use your favorite method):

kill $(pgrep dropbox)

You can repeat the above steps for each user you want to have with their own dropbox.

For older versions of Debian pre-systemd: As root, either download this startup script or copy & paste the following code to /etc/init.d/dropbox and edit the DROPBOX_USERS line as needed:

# dropbox service
DROPBOX_USERS="user1 user2"


start() {
    echo "Starting dropbox..."
    for dbuser in $DROPBOX_USERS; do
        HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
        if [ -x $HOMEDIR/$DAEMON ]; then
            HOME="$HOMEDIR" start-stop-daemon -b -o -c $dbuser -S -u $dbuser -x $HOMEDIR/$DAEMON

stop() {
    echo "Stopping dropbox..."
    for dbuser in $DROPBOX_USERS; do
        HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
        if [ -x $HOMEDIR/$DAEMON ]; then
            start-stop-daemon -o -c $dbuser -K -u $dbuser -x $HOMEDIR/$DAEMON

status() {
    for dbuser in $DROPBOX_USERS; do
        dbpid=`pgrep -u $dbuser dropbox`
        if [ -z $dbpid ] ; then
            echo "dropboxd for USER $dbuser: not running."
            echo "dropboxd for USER $dbuser: running (pid $dbpid)"

case "$1" in




    echo "Usage: /etc/init.d/dropbox {start|stop|reload|force-reload|restart|status}"
    exit 1


exit 0

After that, you need to make it executable and add it to system startup:

sudo chmod +x /etc/init.d/dropbox

sudo update-rc.d dropbox defaults

Repeat the starting, linking & killing steps above for all of the accounts you want to link. Once that is done run the dropbox init script you copied above:

sudo /etc/init.d/dropbox start

For newer Debian versions with systemd, create a file named /lib/systemd/system/dropbox@.service with the following content:

Description=Dropbox as a system service

ExecStart=/usr/bin/env "/home/%i/.dropbox-dist/dropboxd"


After this, simply run

sudo systemctl enable dropbox@username

sudo systemctl start dropbox@username

And now you should be done. If you want to confirm that multiple dropbox accounts are running you can do:

ps aux | grep -i dropbox

Start the Windows Installer Service in Safe Mode with SafeMSI.exe

When a computer is in safe mode, the Windows Installer Service isn’t started. This can cause some issues as some malware can be removed easier through safe mode or maybe other issues in uninstalling a program force you to use an alternate method. However, if you just try to start the service in safe mode, it fails with an error message (Could not start the Windows Installer service on Local Computer. Error 1084: This service cannot be started in Safe Mode).

Enter SafeMSI.exe, a tiny (and portable) free app that starts up the Windows Installer Service for you. In reality, it’s simply running a registry tweak and starting the service but this makes it a lot easier than editing the registry & starting the service on your own.

You can download the program here

Fixing common Mac problems

Apple Discussions Support Forum - You can select the topic by OS, program, hardware or just type your problem into the search box.

CNET’s MacFixIt Feed - Tech blog CNET keeps tabs on all their OS X-related updates with the MacFixIt blog. Head here to search for updates, cool features and troubleshooting.

Quora - Apple Products - I’ve linked directly to the Apple-Products section, but really just punch in whatever you are having a problem with and search. Answers are provided by other users of the service, I don’t tend to use this all that much but others swear by it.

The MacRX Category on Cult of Mac - Cult of Mac keeps it simple: All Mac, all the time. Follow their troubleshooting-specific MacRX category to get updates on everything from good Mac maintenance and un-deleting files to how to fix start-up problems and get your Mac running fast.

Macworld Forums - Typical forum site with categories, search, etc.

macnn - Typical forum site with categories, search, etc.

reddit list of apps - large list of apps done by reddit users

fluid - Make standalone apps out of websites

opensource mac - Free Mac software

vienna - desktop rss reader

gimp on osx

OSX Daily Tips

SuperDuper - Drive Cloning software


Onyx - System diags

Disk Inventory Deluxe - shows space used



Reset Password on 10.4, 10.5 and 10.6

Reset Password on 10.7 and 10.8

Reset keychain

Recover saved WIFI password


Adjusting Keyboard Backlight

Refurb.Me - Lets you track refurb deals on the Apple store

OS X Server Caching

Thread about OSX Server

Hidden Mavericks Pictures

Apple Video adapters and cables

This copy of the Install OS X Mavericks application can’t be verified Fix -

Increase the maximum transfer size of USB storage devices in Windows 7 or Windows Server 2008 R2

Ever thought that your USB storage device was running slower than it should? It seems that the default settings for Windows 7 regarding the maximum transfer size are quite low (64KB in fact). This means your speeds may in fact be lower than what they potentially could be.

To help with this issue, Microsoft has release an update to help users potentially increase their USB storage device transfer speeds. KB2581464 is the knowledge base article and the KB2581464 fix can be downloaded from here. After the fix you can change the maximum transfer size from 64KB all the way up to 2MB with the following directions:

  1. Click on start menu (or press Windows + R keys) and enter regedit

  2. Now navigate for following registry path (Note: VVVV represents device descriptor idVendor in hexadecimal and PPPP represents device descriptor idProduct in hexadecimal): HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\usbstor\VVVVPPPP

  3. Click Edit, point to New, and then click DWORDValue.

  4. Type MaximumTransferLength, and then press Enter.

  5. Click Edit, and then click Modify.

  6. In the Value data box, type a value to specify the maximum transfer size between 65535 (64KB) and 2097120 (2MB)

  7. Exit Regedit

The hotfix is compatible with Windows 7, Sp1 & Windows 2008 R2 (32 as well as 64 bit operating system).

Fix a Windows 7 network connection stuck in public mode

Microsoft released a fix today for an issue with network connections being stuck in public mode. When you connect to a network, there is an option called “Treat all future networks that I connect to as public, and don’t ask me again” which after selecting, you may not be able to change.

The fix can be downloaded from Microsoft Support KB and then click the Microsoft Fix It button which will download a program. Run that program and it will guide you through the fix.

There are also manual instructions which are:

  1. Close or suspend any applications that uses the network.

  2. Click Start, type device manager in the Search programs and files box, and then press Enter.

  3. Browse list of devices and click to expand Network adapters

  4. Right-click on the first adapter under Network Adapters and click Disable. (Repeat this step for all network adapters on your system under Network Adapters). Note: After each change, Device Manager will rescan your hardware. Your monitor may blink when refreshed, this is expected.

  5. While still in Device Manager, re-enable only the adapter that is associated with the public-network setting that you are trying to change. (Example, if you’re trying to connect to your wireless network, enable the wireless adapter.) Note: Your system will notice your network reappearing and try to connect. This connection attempt may fail, but that’s ok, this is expected.

  6. Click Start, and type Network and sharing Center in the Search programs and files box, and then click Network and Sharing Center, from the list

  7. In the lower left side of the dialog box, click Choose homegroup and sharing options.

  8. Click What is a network location?, and select your network location. Note: If you want to continue setting up a homegroup, follow the remaining prompts. But a homegroup isn’t required, so you also can simply exit the homegroup setup after you select the correct network location.

  9. The last step is to re-enable your remaining adapters, one by one in Device Manager. To do this simply Right-click each of the disabled adapters under Network Adapters and click Enable.

  10. When all Network Adapters are enabled, close the Device Manager and you’re done.

StartUpLite - Speed up your Windows startup

StartUpLite is a small (200k) program from Malwarebytes who also make the very handy Malwarebytes Anti-Malware

The software does one thing and does it well: provide a quick and easy method to remove or disable unnecessary application that start during Windows startup. The interface is pretty self explanatory so I’ll just post a screenshot.


There is also a list of programs that StartUpLite checks that can be helpful to determine if this tool is useful for you or not.

Make Backtrack 5 automatically login and start X

This is a quick tip on getting backtrack 5 to automatically login as root and startx which will run the graphical interface. There is a disclaimer though as this method does work but isn’t exactly secure. Then again, if you are using Backtrack, you probably know that already :)

First step is to install rungetty

aptitude install rungetty

Next we have to edit /etc/init/tty1.conf

nano /etc/init/tty1.conf

use the arrow keys to move down to the last line and add a “#” before the line “exec /sbin/getty -8 38400 tty1” so it looks like so

#exec /sbin/getty -8 38400 tty1

Once that is done, add the following line which will automatically login as root

exec /sbin/rungetty tty1 --autologin root

Press CTRL+X an enter to save and close nano

Next, you need to set the .bash_profile for the root user to automatically run startx which starts your graphical interface

nano /root/.bash_profile

Add the following to this file


CTRL+X to save and close

Reboot your BT5 install and there you go. Obviously, going back to the above warning, this isn’t recommended for any machines that could fall into the wrong hands or if you store data on your BT5 install. Personally, I have a proxmox cluster that runs BT5 and this makes it easier to get to the console without logging in constantly, I have just have to start the VM and then vnc to the console.

Mostly posted in case I ever have to do this again, but also to hopefully work this post up to the top of google to help someone else out as the answer to this was buried in tons of spam sites with links to toner, drum, etc replacement sites and extremely little help on actually zeroing the drum copy counter on a Xerox Workcentre (xd125f in my case but it seems xd120f is also a common one people were trying to get help with and seems to work for it as well from what I read). The printer gives a j2 error on the screen when it hits it’s max copies and just changing the drum isn’t enough to reset it.

First, you need to enter diagnostics mode:

With the printer off to start, you need to turn it on and within the next 4 or 5 seconds, push Clear, Exposure Mode, Clear, Exposure mode. On the xd125f that I did this on, Clear is to the far right and Exposure is the far left button.

The display will go blank but the printer will still be running. Select 24 copies and press start and the screen will go blank again. Select 7 copies and press start again, this will reset and show 000 on the screen.

Turn off the printer, count to 5 and turn it back on to what should be a functioning printer again.

Not an overly hard process, once you know the combination of keys and the right order. Of course, finding that combination made me want to smash the printer into little bits aka Office Space (As a site note, there are tons of people copying the Office Space printer smashing scene, in fact, so many of them that I couldn’t easily find the original scene to link here like I had wanted to)

Quick guide to UFW - Uncomplicated FireWall

Here is a quick guide on using UFW (Uncomplicated FireWall) under linux

A good first step is to do the following

sudo ufw default deny

which will set the default action to denying everything

If you are connection from remote, you will want to allow ssh otherwise it will create a nasty embarassing situation when you can’t get into your machine :)

sudo ufw allow ssh

then you can enable UFW by:

sudo ufw enable

You will now have a very basic firewall setup to deny everything except ssh. Not overly helpful if you are hosting anything else on the system. The rest of the points will be in quick format and in the future I may update and clean up the info below

Disable UFW

sudo ufw disable

Enable UFW

sudo ufw enable

Get current UFW status

sudo ufw status

Allow port 80 (http)

sudo ufw allow 80

Deny a certain port

sudo ufw deny port <port number>

Deny a certain ip from entire host

sudo ufw deny from <ip address>

Block an ip from a port

sudo ufw deny from <ipaddress> to port <port number>

Advanced blocking of multiple ips from a port

sudo ufw deny from to any port 22

To open up port range 64000-65000 on udp

ufw allow proto udp to any port 64000:65000

To open up port range 64000-65000 on tcp

ufw allow proto tcp to any port 64000:65000

Windows is unable to install to the selected location. Error 0x80300001

The above is a very annoying error I just encountered while installing a new VM (Windows 7 in this case) under ProxMox with a VirtIO hard drive. After scratching my head for a bit (after all, I had just manually loaded the Virtio drivers to get it to see the hard drive, which it was now and showing the correct size), I searched around and found a page with someone having the same issue.

It seems that the Windows 7 installer isn’t smart enough to tell you to switch back from your driver cdrom/dvd (a virtual one in this case but still) to the Win7 install media so it gives you this very unhelpful & cryptic error message. Once you have switched it back to the install media and hit refresh, it lets you continue on without a hitch.

Yay for vague error messages.

The plain HTTP request was sent to HTTPS port - error with nginx and phpmyadmin and others

This error drove me nuts last night and tonight, trying to sort out what the issue was. Specifically in my case, it was with phpmyadmin running on a secure (HTTPS) site. ::

The plain HTTP request was sent to HTTPS port

If you get this error, you are missing the following line from your fastcgi setup for your ssl vhost:

fastcgi_param HTTPS on;

To show that in context, you want something similar to: ::

location ~ \.php$ {
fastcgi_param HTTPS on;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/securehost$fastcgi_script_name;
include /usr/local/nginx/conf/fastcgi_params;


BlueScreenView by NirSoft is a handy little program I stumbled upon a while back. It loads the windows crash files and shows you USEFUL information from them. Without needing to have the Windows Debugger installed like with WhoCrashed and a bunch of others out there that I tried.

Probably the most annoying part is that I fought with a computer for a while one day that I couldn’t get the debugger installed on until I found this program. Then realized I already had it on my USB drive as I have the full NirSoft collection on it. Oh well, I know it’s there now

Download a copy at NirSoft’s Homepage