29 July 2012

Simple Search Plugin for Firefox

This tutorial will show you a very simple Firefox hack that allows you to search any blog straight from the Firefox search bar without having to visit the actual blog.

1. go to http://www.scriptsocket.com/cgi-bin/firefoxplugins/generate.cgi
2. updated fields with values given in the pic below
3. generate an install search plugin

plugin will get installed in
%APPDATA%\Mozilla\Firefox\Profiles\xxxxxxxx.default\searchplugins
where xxxx is a random string

sample search plugin can be found here humbles-blog.xml
Install 'Humble's Blog' Firefox Search Plugin



Reference:
http://labnol.blogspot.in/2006/09/learn-to-create-firefox-search-plugin.html
http://fahdshariff.blogspot.in/2008/07/write-search-plugin-for-firefox-howto.html
https://developer.mozilla.org/en/Creating_OpenSearch_plugins_for_Firefox
http://ss64.com/nt/syntax-variables.html
http://www.scriptsocket.com/cgi-bin/firefoxplugins/generate.cgi
https://developer.mozilla.org/en/Adding_search_engines_from_web_pages

09 July 2012

Redirecting console output to a pseudotty

Using the TIOCCONS ioctl one can redirect console output to a pseudotty.
This is what xterm -C and xconsole do.

get latest pseudocons.c
# gcc -Wall -o pseudocons pseudocons.c -lutil
# ./pseudocons
[pseudocons]got master
[pseudocons]got slave console
[cons]Hoera..
[cons][pseudocons]Got Ctrl+C; Exiting...

execute the below command from another window to get the above output
# echo Hoera.. > /dev/console

Reference:
http://www.win.tue.nl/~aeb/linux/lk/lk-2.html

06 June 2012

howto configure DNS on redhat 7

yum install bind 
yum install bind-utils
yum install caching-nameserver
service named restart
chkconfig named on

vi /etc/named.caching-nameserver.conf
options {
  listen-on port 53 { 127.0.0.1; machine-IP; };
  allow-query     { any; };
  forwarders { 8.8.8.8; 8.8.4.4; };
...
};

service named restart
dig www.google.com @machine-IP
;; ANSWER SECTION:
www.google.com.         101137  IN      CNAME   www.l.google.com.
www.l.google.com.       262     IN      A       74.125.225.177
www.l.google.com.       262     IN      A       74.125.225.178
www.l.google.com.       262     IN      A       74.125.225.179
www.l.google.com.       262     IN      A       74.125.225.180
www.l.google.com.       262     IN      A       74.125.225.176
...
vi /etc/named.caching-nameserver.conf
#view localhost_resolver {
#   match-clients      { localhost; };
#   match-destinations { localhost; };
#   recursion yes;
#   include "/etc/named.rfc1912.zones";
#};
include "/etc/named.humblesimple.com.zones";

cat > /etc/named.humblesimple.com.zones << EOF
zone "humblesimple.com" IN {
        type master;
        file "named.humblesimple.com-forward";
        allow-update { none; };
};

zone "10.21.168.198.in-addr.arpa" IN {
        type master;
        file "named.humblesimple.com-reverse";
        allow-update { none; };
};
EOF

cat > /var/named/named.humblesimple.com-forward << EOF
$TTL 1D
@       IN SOA  humblesimple.com.     root (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        IN      A       192.168.21.10
        IN      NS      192.168.21.10
server1 IN      A       192.168.21.11
EOF

cat > /var/named/named.humblesimple.com-reverse<< EOF
$TTL 1D
@       IN SOA  @ humblesimple.com. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        NS      @
        PTR     192.168.21.10.
EOF

service named restart
dig server1.humblesimple.com @machine-IP
;; ANSWER SECTION:
server1.humblesimple.com. 86400 IN      A       192.168.21.11
...
Reference:
http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch18_:_Configuring_DNS