Tuesday, May 26, 2015

Automated Hamachi Reset BASH Script

On occasion, Hamachi may be in a failed state on your always-on device. Alternately, maybe when awaking from sleep-mode, Hamachi may not be functional but still reporting online.

Thusly, it might be very useful for a cronjob to check the state and reset. This might especially be useful on your remote machines that you need connectivity to. For example maybe a remote machine that is in sleep mode, but WOL is possible from another remotely-accessible LAN device.

I have written a BASH script for checking Hamachi and forcing re-login if necessary. Maybe this script is not all-encompassing, but it’s a good start.

Let’s assume you have 2 or more client IP’s and also assume they are in an always-on state. (If for example you have 4 clients, but only 3 remain always-on, you will only use the 3 that you expect to be on.)

Below is my script which you will need to edit (IP addresses and hamachi network name). It will ping each hamachi neighbor and only reset if ALL are unreachable.  Alternatively it will go-online-only if failures>0 and failures<neighbors.

This script uses bash installed from Entware-NG or Optware or Optware-NG. You will have to heavily modify this script if you prefer the built-in ash shell that is default with Synology.
You should edit, save, and mark the script executable.  (e.g. chmod +x ~/scripts/check-hamachi.sh).

Since the script executes sudo /etc/init.d/logmein-hamachi start , you must add the command to your sudoers file:

Run the command EDITOR=nano sudo visudo and AT THE VERY LAST LINE (or elsewhere if you know what you are doing) add:
 username ALL=(root) /etc/init.d/logmein-hamachi , where username is your account.

Lastly cronjob (crontab -e) it to every 5 minutes under your own user account. (e.g.:*/5 * * * * ~/scripts/check-hamachi.sh)

As always, Good luck!

Thursday, May 21, 2015

Practically "Free" Landline service with ObiHai and Google voice (VOIP)

I have purged myself from paying for a traditional landline.  Furthermore, I can hardly believe that's it's been this long.  Since November of 2013, I have had a practically free landline by using Google Voice via an OBIHAI.com device over my Internet Service.  (Yes, I do pay for an ISP).  Google Voice calling is free nation-wide and if you need to call overseas, they offer extremely low international rates.

Had I retained my traditional phone service at $27 per month, I'd have paid $486 plus fees plus taxes for the last 18 months. However, I have only paid $14.40 for my optional e911 from Anveo.com.

Specifically I purchased the OBi200 from Amazon which is now only $48:


I then acquired a Google Voice phone number.  (Technically I ported my existing number for a cost, but that is optional.  If you find you cannot port your landline number, you can circumvent the system by porting it to a mobile device SIM, then to Google -- This was a $30 and 5 day process for me -- again this is optional as I preferred to retain my existing number.)

OBIHai Officially support Google Voice.

My family has utilized "FREE" VOIP phone service for the last 18 months and it is of the same quality as any phone service from a traditional provider.  It works perfectly with my multi-phone cordless base-set much like this one.  Additionally, with Google Voice, I am able to receive voicemail recordings and missed call notifications direct to my Gmail.  I can also block numbers easily via web interface and use other awesome features such as having Calling Circles for filtering calls direct to voicemail.

Most telephony service providers are now only offer VOIP anyway.  With Google and OBiHai you can now remove the middle-man and have the same service without the $20-30 monthly costs associated with it.

Google Voice does NOT provide 911 service; however, Anveo.com provides me with e911 for a mere 80 cents per month.

Please consider using my Amazon affiliate Ad for the OBi200 above and optionally my Anveo.com referral code 7384061.

For a little more detail on the ObiHai device, see this nice article: http://www.geekzone.co.nz/sbiddle/8736

Thank you kindly and good luck!

Thursday, May 14, 2015

password checkers

You really should have complexity in your passwords.  Here are couple good password checkers to test yours: (It's suggested not to test your actual passwords, but something highly similar instead)
Pass (a.k.a password-store) is quite an interesting and seemingly effective, albeit not immediately user-friendly, password manager that is open source and uses existing technology like GPG and Git.  For more information visit http://www.passwordstore.org/.  Also note that it's community has created several interfaces such as the firefox addon passff.

Wednesday, May 13, 2015

Install Pinta 1.6 in Debian Jessie 8.0

Paint.NET is a very nice PaintShop Pro alternative for Windows. And luckily, Pinta is fantastic Linux alternative of Paint.NET.

I had Pinta installed in my Debian 8.0 (Jessie) and it was stuck at version 1.5.

I actually use Pinta’s Ubuntu repo to install it and as it turns out I needed to change the repo to reference the “Trusty” version to upgrade to Pinta 1.6.

When I changed as such, the upgrade reported depedency problems with mono, specifically it seems mono v4 must have recently came out.

To resolve my issue i had to first purge pinta and mono-runtime, then reinstall them.
sudo aptitude purge pinta mono-runtime

edit your /etc/apt/sources.list to include:
deb http://ppa.launchpad.net/pinta-maintainers/pinta-stable/ubuntu trusty main 
deb-src http://ppa.launchpad.net/pinta-maintainers/pinta-stable/ubuntu trusty main 

Then update and install:
sudo aptitude update
sudo aptitude install mono-runtime pinta

Pinta should now be v1.6.

You may also want to look at Krita, which is in the Debian repositories – good luck!


Tuesday, May 5, 2015

run Sublime Text from OSX commandline

OSX is a little annoying that it's not quite as easy to symlink Sublime Text to a "/bin/command".  In doing so, so all kinds of cruft console output occurs.

But i've figured a better way to launch Sublime Text via commandline:

In your ~/.bash_profile add the following function:

function sublime() {
open -a Sublime\ Text.app "$@"


Friday, May 1, 2015

BASH copy preserving timestamps in Linux and OSX

The cp command annoys me sometimes in that i expect my files to retain their time-stamps.  However, such is not the default.  To set this behavior automatically, aliases may be used.

In a Linux ~/.bashrc file, include the follwing alias:
alias cp="cp --preserve=timestamps"

In an OSX ~/.bash_profile, include the following alias:
alias cp="cp -p"

In both cases you will need to exit and restart bash.