Tuesday, December 22, 2015

Find a linux command


Use the following utility "apropos"

To find any command ( or command description ) that contains "time" substring.
#apropos time

Persistent sudo

Run the following command to get a persistent sudo in a terminal session
#sudo su

Saturday, December 12, 2015

Friday dinner 12/11/15

It was a nice time going out with my closest friends Khaled, Arabaty and Ayman in our regular Friday night outing dinner.
This week 3 Ayman relatives, Osama Ahmed and Mohamed, joined us in that dinner at Falafel Corner restaurant.
TBC..

Wednesday, December 2, 2015

NodeJS rewrite console out lines

Sample code:
var i = 0;  // dots counter
setInterval(function() {
  process.stdout.clearLine();  // clear current text
  process.stdout.cursorTo(0);  // move cursor to beginning of line
  i = (i + 1) % 4;
  var dots = new Array(i + 1).join(".");
  process.stdout.write("Waiting" + dots);  // write text
}, 300);

Sunday, November 29, 2015

Linux: Disable X Windows System Under Red Hat / CentOS / Fedora Linux


Open /etc/inittab file, enter:
# vi /etc/inittab
Find the line that read as follows:
id:5:initdefault:
Change it as follows:
id:3:initdefault:
Save and close the file. Reboot system to test new changes:
# reboot

Saturday, November 28, 2015

Linux Fedora stop crontab jobs ( crond )

service crond stop
service crond start

Thursday, July 30, 2015

DOS batch file start commands

[subl.bat]
start "Application Title" "C:\Program Files (x86)\Sublime Text 3\sublime_text.exe" %*


Sunday, July 19, 2015

Linux Fedora DNS name server ( bind )


Installation:
yum install bind

Starting the server:
service named start

Configure "named" to run on startup
chkconfig named on

Verify that "named" service is auto starting
[root@myhost ~]# chkconfig | grep named
named           0:off   1:off   2:on    3:on    4:on    5:on    6:off

Configuration file:
/etc/named.conf

Note:
Auto created /etc/named.conf is made for localhost access only.
Change the "options" section as following to enable outside access.
options {
        listen-on port 53 { any; };
        listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        allow-query     {
                any;
        };
        recursion yes;

        dnssec-enable yes;
        dnssec-validation yes;
        dnssec-lookaside auto;

        /* Path to ISC DLV key */
        bindkeys-file "/etc/named.iscdlv.key";
};

Add new zone for your domain to /etc/named.conf
zone "mydomain.com" {
    type master;
    file "mydomain.com.zone"
}


Sample Zone file: /vars/names/mydomain.com.zone:
Note: absolute domains have to end with dot (.)

$ORIGIN mydomain.com.
$TTL 86400
@         IN  SOA  dns1.mydomain.com.  hostmaster.mydomain.com. (
              2001062501  ; serial
              21600       ; refresh after 6 hours
              3600        ; retry after 1 hour
              604800      ; expire after 1 week
              86400 )     ; minimum TTL of 1 day
;
;
          IN  NS     dns1.mydomain.com.
          IN  NS     dns2.mydomain.com.
dns1      IN  A      10.0.1.1
          IN  AAAA   aaaa:bbbb::1
dns2      IN  A      10.0.1.2
          IN  AAAA   aaaa:bbbb::2
;
;
@         IN  MX     10  mail.mydomain.com.
          IN  MX     20  mail2.mydomain.com.
mail      IN  A      10.0.1.5
          IN  AAAA   aaaa:bbbb::5
mail2     IN  A      10.0.1.6
          IN  AAAA   aaaa:bbbb::6
;
;
; This sample zone file illustrates sharing the same IP addresses
; for multiple services:
;
services  IN  A      10.0.1.10
          IN  AAAA   aaaa:bbbb::10
          IN  A      10.0.1.11
          IN  AAAA   aaaa:bbbb::11

ftp       IN  CNAME  services.mydomain.com.
www       IN  CNAME  services.mydomain.com.
;
;

Saturday, April 18, 2015

Package and java application into Jar file and execute it from command line

Steps:
1- Build Jar artifact myApp.jar
2- Execute the applicatoin jar form command line:
~/java -jar myApp.jar

Execurting Java class from command line

Directory structure:
~\com\company\Main.class

To execute the class Main::main() function:
~\java com.company.Main


Monday, February 16, 2015

Disable Google Chrome high DPI


Add the following command line parameters to Chrome.exe launcher

chrome.exe /high-dpi-support=1 /force-device-scale-factor=1

Tuesday, February 10, 2015

Find and kill Rails or web apps on Windows OS

Find the Process ID
netstat -a -o -n to determine the pid of the process running on the used port (80, 3000, etc)


Kill that process via:

taskkill /F /pid ####

Wednesday, January 7, 2015

Install .Net 3.x on Window 8 machines


http://www.urtech.ca/2014/09/solved-cannot-install-3-5-on-windows-8-1error-0x800f0906-and-0x800f081f/

Thursday, January 1, 2015

Popular Javascript templating libraries


1. underscore
2. mustache
3. Handlebars
4. jQuery
5. Dust