Skip to content

Instantly share code, notes, and snippets.

@gabhi
gabhi / gist:bc80364f5a4348785161
Created January 13, 2015 06:11
cassandra hadoop/analytics mode
cd /app/utils/dse-4.0.4/
bin/dse hadoop fs -mkdir ~/hadoop/wordcount/input
bin/dse hadoop fs -copyFromLocal ~/Downloads/obama.txt ~/hadoop/wordcount/input
bin/dse hadoop jar /app/utils/dse-4.0.4/resources/hadoop/hadoop-examples-1.0.4.13.jar wordcount
bin/dse hadoop jar /app/utils/dse-4.0.4/resources/hadoop/hadoop-examples-1.0.4.13.jar wordcount ~/hadoop/wordcount/input ~/hadoop/wordcount/output
bin/dse hadoop fs -ls ~/hadoop/wordcount/input
bin/dse hadoop fs -ls ~/hadoop/wordcount/output
bin/dsetool checkcfs /Users/agaikw1/hadoop/wordcount/output/part-r-00000
bin/dse hadoop fs -cat /Users/agaikw1/hadoop/wordcount/output/part-r-00000
@gabhi
gabhi / gist:15f7a945d71f237e6245
Created January 5, 2015 23:41
set java home on mac
echo export "JAVA_HOME=\$(/usr/libexec/java_home)" >> ~/.bash_profile
@gabhi
gabhi / gist:9f05edb59a47d52139c5
Created December 30, 2014 08:08
mongodb import exmaple
mongoimport --db playstore --collection apps --file playstore.json
//db - database name
//collection - table name
//file - path of the file that needs to be imported
@gabhi
gabhi / gist:33223f9545562143fc5a
Created November 18, 2014 00:46
how to get process id from port
lsof -n -i4TCP:8080 | grep LISTEN
replace 8080 by the port you want to know
@gabhi
gabhi / gist:f55ee89dbed59bfdcb43
Created November 13, 2014 22:42
jshint grunt configuration file
jshint: {
options: {
smarttabs: true,
},
all: [
'Gruntfile.js',
'public/js/**/*.js',
'!public/js/libs/**/*.js',
],
}
@gabhi
gabhi / gist:ba915ce9d9e99e4014a8
Created November 11, 2014 06:01
Mac suppress warning "downloaded from internet"
sudo xattr -d com.apple.quarantine /Applications/Google\ Chrome.app
@gabhi
gabhi / gist:e3f6c6c0dce85ae96cb5
Last active August 29, 2015 14:08
top 30 nmap commands

#1: Scan a single host or an IP address (IPv4) nmap 192.168.1.1

Scan a host name

nmap server1.cyberciti.biz

Scan a host name with more info###

nmap -v server1.cyberciti.biz

@gabhi
gabhi / gist:cdaeff6cb33b212c1a0c
Last active August 29, 2015 14:08
Sample server.xml for Tomcat ssl connector(windows) basic information from http://java.dzone.com/articles/setting-ssl-tomcat-5-minutes
<?xml version='1.0' encoding='utf-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@gabhi
gabhi / gist:831d166038bf4c144467
Created October 16, 2014 06:20
cassandra installation on amamzon ec2
AMI ID : ami-16ff9626
PORTs
Ports Protocol Source launch-wizard-10
22 tcp 0.0.0.0/0 ✔
1024-65355 tcp 0.0.0.0/0 ✔
7000 tcp 0.0.0.0/0 ✔
7001 tcp 0.0.0.0/0 ✔
7199 tcp 0.0.0.0/0 ✔
8888 tcp 0.0.0.0/0 ✔
@gabhi
gabhi / gist:16175593a1706204eef1
Created October 8, 2014 21:47
Left-child right-sibling binary tree Populating next right pointers in each node
void connect(Node p) {
if (!p) return;
if (p.left) p.left.nextRight = p.rightChild;
if (p.right) p.right.nextRight = (p.nextRight) ? p.nextRight.left : null;
connect(p.left);
connect(p.rightChild);
}