development

Run MD5 check sum against all files in a directory

Posted on

Couple snippets that allow us to run checksum and get unique md5 checksums. This is two step process. First, we obtain our md5 checksum for all files find -type f -exec md5sum "{}" + > /opt/checklist.chkfind -type f -exec md5sum "{}" + > /opt/checklist.chk This produces file with following contents 71cc452a8ac5a27c32a83e6a0909e7ae ./PID_190_7344_0_47710322.tif6712032974632727465.tiff 71cc452a8ac5a27c32a83e6a0909e7ae ./PID_190_7344_0_47710322.tif174464329785828524.tiff 71cc452a8ac5a27c32a83e6a0909e7ae […]

Uncategorized

Grepping for multiple strings in a file

Posted on

We will use egrep which accepts a regular expression to grep for multiple strings. tail -f localhost_access_log.txt | egrep “\” 404|\” 500″ Here our example looks at logs to see if we got 404 or 500 request. “GET /favicon.ico HTTP/1.1” 404 973 “GET /login.html HTTP/1.1” 500 1230 “GET /favicon.ico HTTP/1.1” 404 973

development

Starting jetty via command line an nohup

Posted on

Somehow I am getting problems starting Jetty via service jetty start We will be using unix command called nohup “Nohup is a unix command, used to start another program, in such a way that it does not terminate when the parent process is terminated.” I have opted out for using this nohup java -jar start.jar […]

cpp

Accessing data of leptonica PIX data

Posted on

This is mainly as a reference   /** * Get Pixel value at given point */ l_uint32 pixAtGet(PIX* pix, int_t x, int_t y) { l_int32 wpl = pixGetWpl(pix); l_uint32* data = pixGetData(pix); l_uint32* line = data + y * wpl; l_uint32 value = GET_DATA_BYTE(line, x); return value; } /** * Get Pixel value at given […]

cpp

Tokenizing/splitting string in c++

Posted on

This method uses strtok to tokeninze our string given a specific delimeter, results of that are put into supplied vector. There are few other ways we can do this but this one is straight forward. #include <iostream> #include <string> #include <string.h>   #include <memory> #include <stdlib.h> #include <stdio.h> #include <list> #include <vector>   using namespace […]