Can continue working on my micro-controller projects now under Linux

I thought it’s impossible, and was so surprised when I tried and it just worked under Debian Sid and Virtual Box with Windows 7 Pro.

Atmel Studio was a very easy install in a VM, and it had no problems finding my USB programmers and devices attached to my host Linux machine. It’s very good news given that my new digital oscilloscope with logic analyzer arrives tomorrow :)

Shell script – waiting until specified day/time

I participated in a project in which job scheduling logic was completely implemented in shell script (it was a small project initially, and then it has grown in time). One of tasks was to enable scheduler script to wait until a specified time to run a job. Surprisingly, search in Internet did not bring anything that would look simple and elegant enough. There were bunch of quite complex solutions which did not really address my requirements and would be too hard to maintain for support teams in future… I came up with my own solution for this after reading Linux manuals, which I wanted to share.

It appears, ‘date’ utility is very flexible in terms of definition and representation of time. For example, user can supply target date/time in a string, using words like ‘Today 9am” or “Thursday 12pm” etc. In combination with ‘sleep’ command, I was able to achieve the desired functionality with required precision (seconds). I ended up writing this simple bash function:

#-[ wait_until ]------------------------------------------
# Waits until a given day/time
# $1 - target time/date in 'date' command format, e.g. "Today 13:00"
wait_until()
{
echo "Waiting until $1..."

TIME_TARGET=$( date -d "$1" +%s )
TIME_NOW=$( date +%s )

if [ $TIME_NOW -lt $TIME_TARGET ]; then

        TIME_WAIT=$( expr $TIME_TARGET - $TIME_NOW )
        echo "Waiting time: ${TIME_WAIT} seconds"
        sleep ${TIME_WAIT}s

else
        echo "Target time is already in past. No waiting required..."
fi
}

Use is very simple:

wait_until "Today 1pm"
#... some code ...
wait_until "Tomorrow 6am"
#... some code ...

etc…

Hope it helps someone who will be looking for this solution in Internet, just like I did before I had to write it :)

ESXi and Kali weekend

Installed Kali Linux in my virtual lab this weekend – just to make a snapshot of currently available packages and, as usual, steal a couple of ideas for my own pentest Linux VM. Two ideas I will never steal from Kali are Safari Icon for Firefox and use of Gnome 3.

Whoa! Debian Linux works amazingly good at my hardware!

When I said my last goodbye to Windows, I thought it will be Ubuntu to become my new primary home operating system – I had it for a couple of years in past, with very very good experience for both me and my wife, don’t even remember why I switched back to Windows. Probably because I disliked what they did to Gnome, or the switch to Unity, or Il-2 Sturmovik did not work well with Wine, or all three together and lack of time to deal with it – so I thought I’ll pay Microsoft to make all decisions for me… I really don’t remember now. But for me, it was always clear that Ubuntu is the best Linux distribution for desktop hardware because of its superior support for drivers and firmware. I prefer Debian at my virtual desktops and Ubuntu again at servers, both hardware and virtual.

So I removed Windows 10 and installed Ubuntu, and spent a couple of days playing with it – everything worked well, but I was really missing my Debian XFCE customized desktop experience to which I am used to. And I decided to try Debian at my laptop. I was sure I won’t be able to get it work with my wifi card, or cardreader, or something else… I was so surprised that everything worked out of the box! And the install went smooth, over wifi, and everything was just great! The biggest surprise, however, was that Debian appeared to work much better with my Microsoft (hehe) Bluetooth mouse than Ubuntu. Hibernation, suspend, sensors etc work without any problems as well.

It’s been almost a week, and I am very happy with Debian as my primary OS now. I am very confident it will stay, and I am not switching back to Windows or even Ubuntu any time soon – I have an old EEE-PC with Debian installed for around 2 years already (for kids to play) which I was periodically checking and updating, and was amazed of how good and stable it is.

I only had to do two things to make it happen:

  1. I used unofficial Debian installer with non-free firmware support to install it at my laptop.
  2. I had to manually add my touchpad configuration to enable all the fancy multi-touch etc:


Here’s a screenshot of my Debian desktop:

Screenshot - 08232015 - 11:53:48 PM