Monday, January 26, 2015

Solaris persitent routes

route -p show

route  -p add -host

route  -p delete -host

Thursday, January 22, 2015

Profiling Code Using clock_gettime

#include <cstdlib>

#include <iostream>
#include <time.h>

using namespace std;

timespec diff(timespec start, timespec end);

/* Profiling code using clock_gettime
 * Link with the librt library (-lrt)
int main(int argc, char** argv) {

    timespec time1, time2;
    int temp;

    clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time1);

    for (int i = 0; i < 242000000; i++)
        temp += temp;

    clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time2);

    cout << diff(time1, time2).tv_sec << ":" << diff(time1, time2).tv_nsec << endl;

    return 0;

 * Returns a timespec of the difference between 2 timespec
 * @param start timespec structure
 * @param end timespec structure
 * @return timespec structure
timespec diff(const timespec start, const timespec end) {
    timespec temp;

    if ((end.tv_nsec - start.tv_nsec) < 0) {
        temp.tv_sec = end.tv_sec - start.tv_sec - 1;
        temp.tv_nsec = 1000000000 + end.tv_nsec - start.tv_nsec;
    } else {
        temp.tv_sec = end.tv_sec - start.tv_sec;
        temp.tv_nsec = end.tv_nsec - start.tv_nsec;

    return temp;

Taken from:

Thursday, January 15, 2015

What is my IP using JavaScript

<title>What is my IP?</title>


  var clientIP;

<script src=""></script>

  document.write("Your IP is: ", clientIP);



Tuesday, January 13, 2015

Checking current IP from the command line in Linux

wget -q -O - | sed -e 's/[^0-9.]//g'

Thursday, January 1, 2015

2015 Federal Holidays

2015 Holiday Schedule
Thursday, January 1New Year’s Day
Monday, January 19Birthday of Martin Luther King, Jr.
Monday, February 16*Washington’s Birthday
Monday, May 25Memorial Day
Friday, July 3**Independence Day
Monday, September 7Labor Day
Monday, October 12Columbus Day
Wednesday, November 11Veterans Day
Thursday, November 26Thanksgiving Day
Friday, December 25Christmas Day
*This holiday is designated as "Washington’s Birthday" in section 6103(a) of title 5 of the United States Code, which is the law that specifies holidays for Federal employees. Though other institutions such as state and local governments and private businesses may use other names, it is our policy to always refer to holidays by the names designated in the law.
** July 4, 2015 (the legal public holiday for Independence Day), falls on a Saturday. For most Federal employees, Friday, July 3, will be treated as a holiday for pay and leave purposes. (See 5 U.S.C. 6103(b).)