Installing node on Fedora 22

yum install gcc-c++ make openssl-devel

 

  • Install from Source code :
    wget http://nodejs.org/dist/v0.8.15/node-v0.8.15.tar.gz
    tar zxvf node-v0.8.15.tar.gz
    cd node-v0.8.15
    ./configure
    make
    make install
  • Install from GIT repository
    yum install git
    git clone git://github.com/joyent/node.git
    cd node
    ./configure
    make
    make install

 

nJoy πŸ˜‰

 

Bash test if port is open no external tools

Assume you do not have curl/telnet/netcat (or nc does not support -z as in later versions ?? why did they remove it ?? ) the following will work on any recent Bash version.


(echo > /dev/tcp/skinner/22) >/dev/null 2>&1 && echo "Port is open" || echo "Port is closed"

nJoy πŸ˜‰

Progress bar in bash

a=0;
for i in `cat $FOLDERLIST`
do
((a++))
percentage=`awk -v a=$a -v b=$NUMBEROFFOLDERS 'BEGIN {printf "%3.0f", a / b * 100; exit } '`

arrow=`printf '=%.0s' $(seq 1 $percentage)`
headed=`printf '%s%s' $arrow '>'`
paddedarrow=`printf '%-102s' $headed`
echo -ne "$paddedarrow  $a/$NUMBEROFFOLDERS [$percentage] \r "
done
echo

njoy Β πŸ˜‰

Magic SysRq key

The “magic SysRq key” provides a way to send commands directly to the kernel through the /proc filesystem. It is enabled via a kernel compile time option, CONFIG_MAGIC_SYSRQ, which seems to be standard on most distributions. First you must activate the magic SysRq option:

echo 1 > /proc/sys/kernel/sysrq

When you are ready to reboot the machine simply run the following:

echo b > /proc/sysrq-trigger

This does not attempt to unmount or sync filesystems, so it should only be used when absolutely necessary, but if your drive is already failing then that may not be a concern.

In addition to rebooting the system the sysrq trick can be used to dump memory information to the console, sync all filesystems, remount all filesystems in read-only mode, send SIGTERM or SIGKILL to all processes except init, or power off the machine entirely, among other things.

 

nJoy πŸ˜‰

Get detailed debugging info Elasticsearch node

curl -o – “http://localhost:9200/_nodes/process?pretty”

 

{
“cluster_name” : “prod-escluster”,
“nodes” : {
“NUyPv6zIQDS3wo_u_8FUaw” : {
“name” : “es01”,
“transport_address” : “inet[/192.168.1.147:9300]”,
“host” : “es-01.streamuk.com”,
“ip” : “127.0.0.1”,
“version” : “1.4.2”,
“build” : “927caff”,
“http_address” : “inet[/192.168.1.147:9200]”,
“attributes” : {
“master” : “true”
},
“process” : {
“refresh_interval_in_millis” : 1000,
“id” : 2185,
“max_file_descriptors” : 500000,
“mlockall” : false
}
}
}
}