Skip to content

Instantly share code, notes, and snippets.

Hikmat Dhamee mehikmat

Block or report user

Report or block mehikmat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View setNumMappersDynamically
private static void setNumMappers(int numNodes) {
String mapred_side_xml_path = "/opt/hadoop-2.3.0-cdh5.0.1/etc/hadoop/mapred-site.xml";
try {
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = domFactory.newDocumentBuilder();
Document doc = builder.parse(new File(mapred_side_xml_path));
NodeList nodes = doc.getElementsByTagName("configuration");
View web_stuffs
What is web Session?
- An abstract concept to represent a series of HTTP requests and responses
between a specific web browser and server. HTTP doesn't support the
notion of a session.
- A session's data is stored on the server (only 1 session per client)
- Sessions are often built on top of cookies.
- The only data the client stores is a cookie holding a unique session ID
- And on each page request, the client sends its session ID cookie, and the
server uses this to find and retrieve the client's session data
mehikmat /
Created May 21, 2015
Protobuff installation in linux
sudo apt-get remove protobuf-compiler
sudo ldconfig
sudo apt-get install g++
g++ --version
tar xzf protobuf-2.5.0.tar.gz
cd protobuf-2.5.0
sudo make install
mehikmat / how to run java hello world app
Created May 8, 2015
This gist contains the very simple instructions to run java application from command line
View how to run java hello world app
First make java jar containing your all code.
Then got to terminal
$ cd project_root_dir/target
$ java -cp ./jar_file.jar com.main_class_name param_to_main_class [if jar doesn't contain manifest file]
$ java -jar jar_file.jar [if jar contains manifest file]
mehikmat / parseCmdInBetterway
Last active Sep 20, 2018
Parsing bash/shell command line options using getopts
View parseCmdInBetterway
cat << EOF
usage: $0 options
This script can download 64 or 65 version centos.
-h Show the help and exit
mehikmat /
Created Mar 2, 2014
Bash script to find and replace texts inside a file
#### Function to find and replace a text inside file using bash
echo "[INFO]:: Updating late command url in pressed.cfg file**************"
echo ""
cat preseed.cfg | sed 's_${IPADDR}_'"$IP"'_g' > temp.cfg
cat temp.cfg > preseed.cfg
rm temp.cfg
mehikmat /
Created Feb 26, 2014
Hadoop commnad to run bash script in hadoop cluster-This script counts the number of lines in input file and writes count to output file
# 's_\^\*~_\n_g' is the line delimiter in input file replace with yours
sed 's_\^\*~_\n_g'| wc -l
mehikmat /
Created Feb 15, 2014
Java code to generat any first 100 prime numbers
import java.util.Scanner;
public class First100Prime {
int flag;
int first;
public First100Prime() {
mehikmat /
Created Feb 14, 2014
PDF document generation using iText framework in Java
package com.test;
import java.awt.Color;
import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
You can’t perform that action at this time.