Sunday, 16 November 2014

Delete log files older than x days on QNAP NAS


The easiest way to delete files older than 'x' days via command line (therefore a cron job can be created to delete it daily) would be:

find /share/Download/messages* -mtime +5 | xargs rm -rf

Then crontab -e and add the following to the bottom

1 0 * * * find /share/Download/messages* -mtime +5 | xargs rm -rf

This will then keep the last 5 days worth of logs.

Good article on editing cron located here : http://wiki.qnap.com/wiki/Add_items_to_crontab

Monday, 22 September 2014

How to reset a Apple iPod 7th Generation

The support article can be found here on Apple support site.

Summary:

How to reset an iPod nano (7th generation)

Press and hold the Sleep/Wake button and the Home button until the screen goes dark. The Apple logo should appear after a few seconds, then the Home screen should appear.

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}'