Sunday, 17 August 2014

Searching Yes/No custom column in Calibre






Below is the correct notation to search a Yes/No custom search column for all entries that are not tagged.

#yesno:_empty

Saturday, 9 August 2014

Adding Gist support to blogger dynamic view


Found this great blog post by Moski on how to embed Github gist code into blogger dynamic views


Code can be found on Github

At the end of each of your blog posts, include the  code using the HTML editor and update with your gist id's and that is it.



Arduino sample code - Serial send




Arduino code to read serial integers

Loading ....

Friday, 8 August 2014

Easy way to timestamp date on Ubuntu bash


ts from the moreutils package can be used to timestamp data:


~$ echo my_time_stamp_test | ts

Aug 08 08:09:14 my_time_stamp_test

The timestamp format can be changed as well

:~$ echo my_time_stamp_test | ts [%H.%M.%.S]

[08.12.05.066785] my_time_stamp_test

so to timestamp data collected from a serial port something like below can be used:

ts </dev/ttyS0 >arduino.log

And a true bash version :
<command> | awk '{ print strftime("%Y-%m-%d %H:%M:%S"), $0; fflush(); }'

Thursday, 7 August 2014

A Sublime Text Plugin for Arduino


Stino is a Sublime Text plugin for upload/compile arduino sketches as well as text highlighting.

This plugin can be found at Github site Will Robot or forked at Madmouser1

For manual installation, download and unzip the file.


  1. Click the menu Preferences->Browse Packages....
  2. Copy the extracted Stino folder (Stino-master) to that Packages folder.  On Ubuntu with ST3 the folder is ~/.config/sublime-text-3/Packages/

Set the Arduino application folder


  1. Click the menu Preferences->Show Arduino Menu, Arduino Menu will appear.
  2. Click the menu Arduino->Preferences->Select Arduino Folder.
  3. Select your Arduino Application Folder in the quick panel. This is the location where Arduino.app is installed. (/usr/share/arduino  on Ubuntu)



To Add Libraries

Copy the library folder to the <SKETCHBOOK>/libraries/ folder.

To Add Cores

Copy the core folder to the <SKETCHBOOK>/hardware/ folder.

Friday, 1 August 2014

Netgear DL834 bridge mode

The Netgear DL834 can be configured for bridge mode (rather than routing mode) by accessing this link on the router.

http://<ip of router>/setup.cgi?next_file=mode.htm


Monday, 28 July 2014

Easiest way to force interface to full duplex on linux

sudo ethtool -s eth0 autoneg off speed 100 duplex full

this can be verified with

sudo ethtool eth0

and should report something like:

Settings for eth0:
    Supported ports: [ TP ]
    Supported link modes:   10baseT/Half 10baseT/Full
                            100baseT/Half 100baseT/Full
                            1000baseT/Full
    Supported pause frame use: Symmetric Receive-only
    Supports auto-negotiation: Yes
    Advertised link modes:  Not reported
    Advertised pause frame use: No
    Advertised auto-negotiation: No
    Speed: 100Mb/s
    Duplex: Full

    Port: Twisted Pair
    PHYAD: 0
    Transceiver: internal
    Auto-negotiation: off
    MDI-X: Unknown
    Current message level: 0x000060e4 (24804)
                   link ifup rx_err tx_err hw wol
    Link detected: yes

Thursday, 17 July 2014

How to determine if filesystem or drive is mounted Read Only in linux

The easiest way is via the command line with:
grep "\sro[\s,]" /proc/mounts

And a further command line to see the mount points:
mount -v | grep "^/" | awk '{print "\nPartition identifier: " $1  "\n Mountpoint: "  $3}'

Thursday, 26 June 2014

QNAP TS-412 Firmware 4.0.2 to 4.0.7 upgrade


The web based upgrade for the firmware failed on this device; to manually do the upgrade follow this procedure:


remove all the update folders and then re-create one with a link to the other

download the firmware

make a copy of the file as the source will get removed during the upgrade (optional step)

[~] # rm -rf /mnt/HDA_ROOT/update/
[~] # rm -rf /mnt/update
[~] # mkdir /mnt/HDA_ROOT/update
[~] # ln -sf /mnt/HDA_ROOT/update /mnt/update
[~] # cd /share/Public
[/share/Public] # wget http://eu1.qnap.com/Storage/TS-412TurboNAS/TS-412_20140412-4.0.7.zip
[/share/Public] # unzip TS-412_20140412-4.0.7.zip
[/share/Public] # cd ~

[~] # cp /share/Public/TS-412_20140412-4.0.7.img /share/Public/TS-412_20140412-4.0.7-work.img
[~] # /etc/init.d/update.sh /share/Public/TS-412_20140412-4.0.7-work.img

this will have an output like
cksum=1718371300
Check disk space available for FW update: OK.
Using 120-bit encryption - (QNAPNASVERSION4)
len=1048576
model name = TS-412
version = 4.0.7
boot/
config/
fw_info
initrd.boot
initrd.boot.cksum
libcrypto.so.1.0.0
libssl.so.1.0.0
qpkg.tar
qpkg.tar.cksum
rootfs2.img
rootfs2.img.cksum
rootfs_ext.tgz
rootfs_ext.tgz.cksum
uImage
uImage.cksum
update/
update_img.sh
4.0.7 20140412
MODEL NAME = TS-412,new version = 4.0.7
limit version = 3.8.2
Allow upgrade
tune2fs 1.41.4 (27-Jan-2009)
Setting maximal mount count to -1
Setting interval between checks to 0 seconds
Update image using HDD ...
Check uImage size ... Pass
Check initrd.boot size ... Pass
Check rootfs2.img size ... Pass
Check Flash ROM
Update Kernel ...
Update Basic RootFS ...
Update Basic RootFS2 ...
1+0 records in
1+0 records out
Update Finished.
set cksum [1718371300]

then afterwords reboot
# reboot

Monday, 23 June 2014

How to set MTU on Linux interface



The MTU can be set with:
$ sudo ip link set dev tun0 mtu 1350

It can be tested with
$ ip a s 

And will show something like the below:
5: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1350 qdisc pfifo_fast state UNKNOWN group default qlen 100

link/none