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

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 

Friday, 20 June 2014

Ubuntu bulk rename files

If you don't want to use the command line to rename files the following application "pyrenamer" have a lot of functionality and work a charm.


With pyRenamer you can change the name of several files at the same time easily.
→ You can use patterns to rename files.
→ You can use search & replace to rename files.
→ You can use common substitutions.
→ You can manually rename selected files.
→ You can rename images using their metadata.
→ You can rename music using its metadata.

To install it:
sudo apt-get install pyrenamer

Friday, 6 June 2014

Ways to find your Public IP





Various ways exist for different purposes but I thought I will list a few ways to find the external IP.




In bash:

1:  IP=$(curl -s ifconfig.me)  
2:  echo “Your IP is $IP”  

In Python:

1:  import requests  
2:  r = requests.get(r'http://jsonip.com')  
3:  ip= r.json()['ip']  
4:  print 'Your IP is', ip  

Sites that return your external IP

http://ifconfig.me/ip

http://ipecho.net/plain

http://checkip.dyndns.org/plain

http://ipogre.com/linux.php

http://whatismyipaddress.com/

http://ip.my-proxy.com/

http://websiteipaddress.com/WhatIsMyIp

http://getmyipaddress.org/

http://showmyipaddress.com/

http://www.my-ip-address.net/

http://myexternalip.com/raw

http://www.canyouseeme.org/

http://www.trackip.net/

http://myip.dnsdynamic.org/

http://icanhazip.com/

http://www.iplocation.net/

http://www.howtofindmyipaddress.com/

http://www.ipchicken.com/

http://whatsmyip.net/

http://www.ip-adress.com/

http://checkmyip.com/

http://www.tracemyip.org/

http://checkmyip.net/

http://www.lawrencegoetz.com/programs/ipinfo/

http://www.findmyip.co/

http://ip-lookup.net/

http://www.dslreports.com/whois

http://www.mon-ip.com/en/my-ip/

http://www.myip.ru

http://ipgoat.com/

http://www.myipnumber.com/my-ip-address.asp

http://www.whatsmyipaddress.net/

http://formyip.com/

https://check.torproject.org/

http://www.displaymyip.com/

http://www.bobborst.com/tools/whatsmyip/

http://www.geoiptool.com/

https://www.whatsmydns.net/whats-my-ip-address.html

https://www.privateinternetaccess.com/pages/whats-my-ip/

http://checkip.dyndns.com/

http://myexternalip.com/

http://www.ip-adress.eu/

http://www.infosniper.net/

http://wtfismyip.com/

http://ipinfo.io/

http://httpbin.org/ip

Wednesday, 2 April 2014

SortTV - Sorting Movies

A application that can automatically sorts TV show episodes into an organised
directory structure. Can optionally move non-episodes into a separate directory. Also optional integration with xbmc (notification and library update).

Project located at : http://sourceforge.net/projects/sorttv/ at the time of writing the latest version was SortTV1.37

Download and extract the files and edit the configuration file (sorttv.conf)

most important values to set:
  • directory-to-sort=
  • tv-directory=
  • music-directory=
  • movie-directory=

and execute with perl;
perl sorttv.pl  or ./sorttv.pl

If you experience some errors it will be most likely perl libraries that are missing these can be installed with:

sudo apt-get install libwww-perl  
sudo perl -MCPAN -e 'install TVDB::API'  
sudo perl -MCPAN -e 'install WWW::TheMovieDB::Search'  
sudo perl -MCPAN -e 'install WWW::TheMovieDB'  
sudo perl -MCPAN -e 'install JSON::Parse'  

Titles can be substituted in the configuration file (sorttv.conf)

# Substitute the titles of these shows
show-name-substitute=CSI-->CSI: Crime Scene Investigation
show-name-substitute=CSI Crime Scene Investigation-->CSI: Crime Scene Investigation
show-name-substitute=Sanctuary US-->Sanctuary
show-name-substitute=Shit My Dad Says-->$#*! My Dad Says
show-name-substitute=ABC - Two and a Half Men-->Two and a Half Men
show-name-substitute=Its Always Sunny in Philadelphia-->It's Always Sunny in Philadelphia
show-name-substitute=American Dad-->American Dad!
show-name-substitute=Penn & Teller Bullshit!-->Penn & Teller: Bullshit!
show-name-substitute=Being Human UK-->Being Human
show-name-substitute=House MD-->House
show-name-substitute=House M.D.-->House
show-name-substitute=Game of Throne-->Game of Thrones
show-name-substitute=Star Trek DS9-->Star Trek Deep Space 9
show-name-substitute=Marvels Agents of S H I E L D -->Marvels Agents of S.H.I.E.L.D.

Spesific TVDB id's can be manually entered in the configuration file as well, for series that is incorrectly identified e.g.

# Use these tvdb IDs to lookup these shows
tvdb-id-substitute=$#*! My Dad Says-->164951
tvdb-id-substitute=$#-! My Dad Says-->164951
tvdb-id-substitute=Shit My Dad Says-->164951
tvdb-id-substitute:Brothers and Sisters-->79506
tvdb-id-substitute:Greys Anatomy-->73762
tvdb-id-substitute:David Letterman-->75088
tvdb-id-substitute:The Daily Show-->71256
tvdb-id-substitute:Conan-->194751
tvdb-id-substitute:Jay Leno-->70336
tvdb-id-substitute:Dont Trust the Bitch in Apartment 23-->248812
tvdb-id-substitute:True Detective-->270633
tvdb-id-substitute:The Tomorrow People US-->268591
tvdb-id-substitute:The Tomorrow People (US)-->268591
tvdb-id-substitute:Once Upon A Time-->248835
tvdb-id-substitute:Scandal-->248841

To make this task easier in ubuntu a Nautilus script can be created to add the sorttv command to the context menu (Right click > scripts)

Paste the following code into
~/.local/share/nautilus/scripts

or
right click > scripts > open scripts folder

then add the following code to a file and name it something that make sense e.g. Sorttv-Organiser
#!/bin/bash
notify-send "SortTV" "Script started to sort  " -i ~/Pictures/sorttv.png -t 500
/opt/applications/sorttv/sorttv.pl
notify-send "SortTV" "Script completed " -i ~/Pictures/sorttv.png -t 5000

in this example
notify-send is used to send a notification to the desktop and
/opt/applications/sorttv/ the location of sorttv application

Whenever you want to sort just right click in Nautilus and run the script


Tuesday, 4 March 2014

Cisco ASA 8.4 on GNS3 in Linux

Best recommendation would be to test the qemu image before moving it into GNS3.

To find the location of the binaries:

user@pc:~ > which qemu-img
/usr/bin/qemu-img

then

user@pc:~/Cisco/ASA_842 > /usr/bin/qemu-system-i386 -name ASA1 -m 1024 -kernel ./asa842-vmlinuz -initrd ./asa842-initrd.gz -append "ide_generic.probe_mask=0x01 ide_core.chs=0.0:980,16,32 auto nousb console=ttyS0,9600 bigphysarea=65536 ide1=noprobe no-hlt" -netdev user,id=mynet0 -netdev user,id=mynet1 -netdev user,id=mynet2 -netdev user,id=mynet3 -netdev user,id=mynet4 -netdev user,id=mynet5 -device e1000,mac=00:00:ab:1a:f2:00,netdev=mynet0 -device e1000,mac=00:00:ab:df:12:01,netdev=mynet1 -device e1000,mac=00:00:ab:7e:73:02,netdev=mynet2 -device e1000,mac=00:00:ab:1c:9d:03,netdev=mynet3 -device e1000,mac=00:00:ab:db:25:04,netdev=mynet4 -device e1000,mac=00:00:ab:69:d8:05,netdev=mynet5 -serial telnet:127.0.0.1:4444,server,nowait -vnc none -vga none -icount auto -hdachs 980,16,32 -cpu coreduo -nographic

and then log into the ASA router virtual image with : telnet localhost 4444

if working as expected configure Qemu in GNS3:

and then the ASA:

Qemu options : -vnc none -vga none -icount auto -hdachs 980,16,32 -cpu coreduo -nographic
Kernel Cmd Line : ide_generic.probe_mask=0x01 ide_core.chs=0.0:980,16,32 auto nousb console=ttyS0,9600 bigphysarea=65536 ide1=noprobe no-hlt


If you want to run multiple ASA's configure the options accordingly e.g.
Qemu options : -vnc :2 none -vga none -icount auto -hdachs 980,16,32 -cpu coreduo -nographic

Cisco config highlighting with Kate


Syntax highlight Engine Kate can be used to install more plugins for syntax highlighting


http://search.cpan.org/dist/Syntax-Highlight-Engine-Kate/

sudo apt-get install libsyntax-highlight-engine-kate-perl




Postgres 9 how to drop a database that is in-use





PostgreSQL's statistics collector is a subsystem that supports collection and reporting of information about server activity

Sample below to identify the procid for database cmdbuild:

postgres=# select * from pg_stat_activity where datname='cmdbuild';

datid datname procpid usesysid
44867 cmdbuild 2467 16384
44867 cmdbuild 2468 16384
(2 rows)

pg_cancel_backend and pg_terminate_backend send signals (SIGINT or SIGTERM respectively) to backend processes identified by process ID. 

postgres=# select pg_terminate_backend(procpid) from pg_stat_activity where datname='cmdbuild';
 pg_terminate_backend 
----------------------
 t
 t
(2 rows)

postgres=# DROP DATABASE cmdbuild;
DROP DATABASE




Monday, 3 March 2014

Add Loopbacks in Linux MInt for GNS3

This is a quick howto to connect a gns3 simulation to the physical pc to allow testing from the pc or configure access to the internet.


run gns3 as root "sudo gns3"
place a cloud onto your topology
configure the NIO TAP to use tap0

on linux:

first install the necessary tools

sudo apt-get install uml-utilities
sudo apt-get install bridge-utils
then

sudo tunctl -t tap0
sudo ifconfig tap0 10.200.200.1 netmask 255.255.255.252 up

then configure the router:
R1>enable
R1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#interface FastEthernet 0/0
R1(config-if)#ip address 10.200.200.2 255.255.255.252
R1(config-if)#no shutdown
Add a default route so that the router knows where to forward the internet traffic.
R1(config)#ip route 0.0.0.0 0.0.0.0 10.200.200.1

Try pinging the linux pc and the router from each other and you should get a reply.


to forward the traffic to the internet:


iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE

iptables -A FORWARD -i tap0 -j ACCEPT

echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward








TFTP Server on Linux Mint / Ubuntu


Steps to Install and Configure TFTP Server on Ubuntu

Step 1: 

Install TFTP Server Either you can install using command line or Go to Ubuntu Software center. In command line type"sudo apt-get install tftpd-hpa" Or Search for tftpd-hpa in Software Center and click install

Step 2: 

Configure Configuration file of tftpd-hpa is in /etc/default/tftpd-hpa. Edit this file to change the default root directory and other Options.
Default file contents will be similar to this:


# /etc/default/tftpdhpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_ADDRESS="[::]:69"
TFTP_OPTIONS="--secure" 
 
You can edit TFTP_DIRECTORY line to change the default root directory( Root directory is the directory which will store all the files you upload to the TFTP server or the directory from which the files will be downloaded from TFTP Server ). 
By default, there should be a file with same name as the file you are about to upload to TFTP server. This default feature may create problems during Get/Put to TFTP server. So better edit this TFTP_OPTIONS to allow the TFTP Server to create a new file when there is no file with the name found. So after editing tftpd-hpa looks like this:
TFTP_USERNAME="tftp" 
TFTP_DIRECTORY="/home/len/tftproot" 
TFTP_ADDRESS="0.0.0.0:69" 
TFTP_OPTIONS="--secure --create"

Step 3: Restart TFTP Server Restart TFTP Server service using "sudo service tftpd-hpa restart"

Further to this to ensure the TFTP server respond to  broadcast requests (This is used on devices liek Cisco Access points to update firmware) Change it to the following type configuration:

Change /etc/default/tftpd-hpa from:
# /etc/default/tftpd-hpa

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure --timeout 30"
to:

# /etc/default/tftpd-hpa

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_ADDRESS="255.255.255.255:69"
TFTP_OPTIONS="--secure --timeout 30"

Key change being 0.0.0.0 to 255.255.255.255

For troubleshooting:
add the -vvvv option to the config
TFTP_OPTIONS="--secure --create -vvvv --timeout 30"

and tail the /var/log/syslog file


Sunday, 2 March 2014

Postgresql on Ubuntu server

Install
To install use the command line and type:


 sudo apt-get install postgresql postgresql-contrib
 
This will install the latest version available in your Ubuntu release and the commonly used add-ons for it.
We then need to change the password for the postgres database user; as postgres we execute the psql command

sudo -u postgres psql postgres
 
and give the user a password

\password postgres
 
type a password and quit psql with Ctrl+D or \quit
to set a *nix password for the user use the

sudo passwd postgres
 
and type the new *nix password for the user

User access
Then to give users access amend the

/etc/postgresql/current/main/pg_hba.conf 
 
and add something like below (granting all users on subnet 10.0.0.0 255.255.255.0 access to all databases with username / password method)

typedatabaseuserip addressmethod
hostallall10.0.0.0/24md5


And make sure postgresql listen on the correct interface / ip address in

/etc/postgresql/current/main/postgresql.conf 
 
by configuring the listen_addresses. Default only listen on localhost.

This can then be tested with the following from a host on the 10.0.0.0/24 subnet:

psql -h 10.0.0.1 -U postgres -d postgres

Add a database and spesific user for it

To create a database with a user that have full rights on the database, use the following command:
sudo -u postgres createuser -D -A -P myuser
sudo -u postgres createdb -O myuser mydb
 
Else install pgadmin to manage the database.


Saturday, 22 February 2014

Apple iPod nano Gen6 on Linux Mint 64bit



Technically this iPod is not supported on linux.
Linux did recognize it and could mount the file system, gtkpod was also capable of reading the file list, however no changes could be made nor files added to the device (it will add in Amarok and gtkpod) but don't show up on the playlist.

After some digging around it was found that Apple use a new hash algorithm to check the files and database on the iPod.

Luckily someone reverse engineered and produced this mod libhashab_mod_14-04-13.tar.gz or here that will update your system with the correct libhashab32.so or libhashab64.so.

After this I could sucsesfully create a playlist and save a song into the playlist on a iPod nano Gen 6 with gtkpod. Amarok 2.8.1 still not working but onto it now.




Archi 2.6 and 64 bit linux

Archi 2.6 kept on crashing even after I anstalled a 32bit Java runtime environment (this was due to Archi still trying to use 64bit libraries)


Installed Java runtime environment for 32bit but Archi still crashed ( the moment you add a object onto a view).

The fix for this is to edit the Archi32.ini file and add the path to the vm it must use e.g.

Archi32.ini
-vm
/usr/lib/jvm/32/jdk1.7.0_51_32/jdk1.7.0_51/jre/bin/java
-vmargs
-Xms128m
-Xmx512m
-XX:MaxPermSize=256m
-Dosgi.requiredJavaVersion=1.6
-Dosgi.instance.area=@user.home/uk.ac.bolton/Archi
-Dosgi.configuration.area=@user.home/uk.ac.bolton/Archi/configuration

Then run Archi via Archi32-Ubuntu.sh and all should be fine.


Thursday, 13 February 2014

Cisco config text highlighting with Gedit

The following files can be copied into the language folder to enable text highlighting for Cisco configurations

$ sudo cp ios.lang /usr/share/gtksourceview-3.0/language-specs/



ios.lang

<?xml version="1.0" encoding="UTF-8"?>
<language id="cisco-ios" _name="Cisco IOS" version="2.0" _section="Cisco">
  <metadata>
    <property name="mimetypes">text/plain</property>
    <property name="globs">*.cfg</property>
    <property name="comment-start">!</property>
  </metadata>
  <styles>
    <style id="comment" _name="Comment" map-to="def:comment"/>
    <style id="identifier" _name="Interface" map-to="def:identifier"/>
    <style id="list" _name="Access List" map-to="def:preprocessor"/>
    <style id="number" _name="Number" map-to="def:preprocessor"/>
  </styles>
  <definitions>
    <context id="comment" style-ref="comment" end-at-line-end="true">
      <start>!</start>
    </context>
    <context id="description" style-ref="comment" end-at-line-end="true">
      <start>description</start>
    </context>

    <context id="hostname" end-at-line-end="true" extend-parent="false"
style-ref="identifier">
      <start>hostname</start>
    </context>
    <context id="interface" end-at-line-end="true" extend-parent="false"
style-ref="identifier">
      <start>interface</start>
    </context>
    <context id="policy-map" end-at-line-end="true" extend-parent="false"
style-ref="identifier">
      <start>policy-map</start>
    </context>
    <context id="class-map" end-at-line-end="true" extend-parent="false"
style-ref="identifier">
      <start>class-map</start>
    </context>
    <context id="controller" end-at-line-end="true" extend-parent="false"
style-ref="identifier">
      <start>controller</start>
    </context>
    <context id="linevty" end-at-line-end="true" extend-parent="false"
style-ref="identifier">
      <start>line vty</start>
    </context>
    <context id="linecon" end-at-line-end="true" extend-parent="false"
style-ref="identifier">
      <start>line con</start>
    </context>
    <context id="lineaux" end-at-line-end="true" extend-parent="false"
style-ref="identifier">
      <start>line aux</start>
    </context>

    <context id="lists" style-ref="list">
      <keyword>access-list</keyword>
      <keyword>ip route</keyword>
      <keyword>ip nat</keyword>
    </context>

    <context id="routers" style-ref="identifier">
      <keyword>router rip</keyword>
      <keyword>router eigrp</keyword>
      <keyword>router igrp</keyword>
      <keyword>router ospf</keyword>
      <keyword>router bgp</keyword>
    </context>

    <context id="number" style-ref="number">
      <match>(\b[0-9]+(\.[0-9]+)?|\.[0-9]+)([Ee][\+-]?[0-9]+)?\b</match>
    </context>
    <context id="cisco-ios">
      <include>
        <context ref="comment"/>
        <context ref="description"/>
        <context ref="hostname"/>
        <context ref="interface"/>
        <context ref="controller"/>
        <context ref="linevty"/>
        <context ref="linecon"/>
        <context ref="lineaux"/>
        <context ref="policy-map"/>
        <context ref="class-map"/>
        <context ref="lists"/>
        <context ref="routers"/>
        <context ref="number"/>
       </include>
    </context>
  </definitions>
</language>


asa.lang

<?xml version="1.0" encoding="UTF-8"?>
<language id="cisco-firewall" _name="Cisco PIX/ASA" version="2.0"
_section="Cisco">
  <metadata>
    <property name="mimetypes">text/plain</property>
    <property name="globs">*.txt;</property>
    <property name="comment-start">!</property>
  </metadata>
  <styles>
    <style id="comment" _name="Comment" map-to="def:comment"/>
    <style id="identifier" _name="Interface" map-to="def:keyword"/>
    <style id="access-list" _name="Access List" map-to="def:preprocessor"/>
    <style id="static" _name="Static" map-to="def:string"/>
    <style id="nat" _name="NAT" map-to="def:type"/>
    <style id="route" _name="Route" map-to="def:preprocessor"/>
    <style id="number" _name="Number" map-to="def:comment"/>
  </styles>
  <definitions>
    <context id="comment" style-ref="comment" end-at-line-end="true">
      <start>!</start>
    </context>
    <context id="description" style-ref="comment" end-at-line-end="true">
      <start>description</start>
    </context>

    <context id="hostname" end-at-line-end="true" extend-parent="false"
style-ref="identifier">
      <start>hostname</start>
    </context>
    <context id="ip-address" end-at-line-end="true" extend-parent="false"
style-ref="identifier">
      <start>ip address</start>
    </context>
    <context id="interface" end-at-line-end="true" extend-parent="false"
style-ref="identifier">
      <start>interface</start>
    </context>
    <context id="policy-map" end-at-line-end="true" extend-parent="false"
style-ref="identifier">
      <start>policy-map</start>
    </context>
    <context id="class-map" end-at-line-end="true" extend-parent="false"
style-ref="identifier">
      <start>class-map</start>
    </context>

    <context id="access-list" end-at-line-end="true" extend-parent="false"
style-ref="access-list">
      <start>access-list</start>
    </context>

    <context id="access-group" end-at-line-end="true" extend-parent="false"
style-ref="access-list">
      <start>access-group</start>
    </context>

    <context id="static" end-at-line-end="true" extend-parent="false"
style-ref="static">
      <start>static</start>
    </context>

    <context id="nat" end-at-line-end="true" extend-parent="false"
style-ref="nat">
      <start>nat</start>
    </context>

    <context id="route" end-at-line-end="true" extend-parent="false"
style-ref="route">
      <start>route</start>
    </context>

    <context id="number" style-ref="number">
      <match>(\b[0-9]+(\.[0-9]+)?|\.[0-9]+)([Ee][\+-]?[0-9]+)?\b</match>
    </context>
    <context id="cisco-firewall">
      <include>
        <context ref="comment"/>
        <context ref="description"/>
        <context ref="ip-address"/>
        <context ref="hostname"/>
        <context ref="interface"/>
        <context ref="policy-map"/>
        <context ref="class-map"/>
        <context ref="access-list"/>
        <context ref="access-group"/>
        <context ref="static"/>
        <context ref="nat"/>
        <context ref="route"/>
        <context ref="number"/>
       </include>
    </context>
  </definitions>
</language>