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!
---

Please consider crypto tipping:
  

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.

Please consider crypto tipping:
  

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:
#Pinta
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!

---

Please consider crypto tipping:
  

May 05, 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 "$@"
}


----
Please consider crypto tipping:
  

May 01, 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.

---


Please consider crypto tipping: