Skip to content

Instantly share code, notes, and snippets.

View PankajWorks's full-sized avatar

Pankaj Singh PankajWorks

  • HortonWorks, Cloudera, Delphix
View GitHub Profile
yum update -y
yum groupinstall -y "Development Tools"
yum install -y \
autoconf automake19 libtool gettext \
git scons cmake flex bison \
libcurl-devel curl \
ncurses-devel ruby bzip2-devel expat-devel \
irb
yum install -y git-all
@PankajWorks
PankajWorks / Parallel Execution tools
Created August 26, 2016 16:12
Parallel tools for increasing productivity on linux
To increase productivity there are couple of tools for parallel execution
Parallel version of SSH tools
One place to download is - http://www.theether.org/pssh/
Download - https://code.google.com/archive/p/parallel-ssh/
useful link : https://www.linux.com/news/parallel-ssh-execution-and-single-shell-control-them-all
pssh - parallel ssh
pscp - parallel scp
prsync - parallel rsync
pnuke - parallel nuke
Steps
1 : ssh-keygen
2 : ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host
3 : ssh remote-host
You should be able to log in without password
echo 'this is a test' | awk '{print $NF}' #print last column
awk '{print $1, $(NF-2) }' access_log
awk '{print NR ") " $1 " -> " $(NF-2)}' access_log #NR prints the row number
awk '{print $2}' access_log | awk 'BEGIN{FS=":"}{print $1}' #splits along ':'
awk '{print $2}' logs.txt | awk 'BEGIN{FS=":"}{print $1}' | sed 's/\[//'
awk '{if ($(NF-2) == "200") {print $0}}' # conditional
@PankajWorks
PankajWorks / Ambari_Host_Cleanup.md
Last active December 6, 2022 13:52
Cleanup ambari and HDP

get log directory locations in case you want to clean those directories

Log directories can be retrieved from the configs stored in ambari database. Have a look at https://cwiki.apache.org/confluence/display/AMBARI/Modify+configurations. To find how to get a config You can execute the script from ambari-server host Example : ./configs.sh get localhost my hadoop-env | grep -i log_dir

  • Configs and corresponding variable
    HDFS : "hadoop-env","hdfs_log_dir_prefix"
    YARN : "yarn-env","yarn_log_dir_prefix"
    MAPREDUCE2 : "mapred-env","mapred_log_dir_prefix"
# Recursive
wget -r --no-parent http://example.com/configs/.vim/
wget -r --no-parent --reject "index.html*" http://example.com/configs/.vim/ #avoid downloading index.html
wget -r -nH -nd -np -R index.html* http://example.com/configs/.vim/ # avoid downloading directory structure
// This earthquake data is sourced from New Zealand’s Geonet
// site over a date range that covers a period of reasonable
// activity in July/August 2013.
var quakePoints = [
[-41.5396,174.1242,1.7345],
[-38.8725,175.9561,2.6901],
[-41.8992,174.3117,4.6968],
[-41.7495,174.02,1.8642],
[-41.7008,174.0876,2.1629],
[-41.7371,174.0682,2.0408],
# Add the below code in a paragraph and execute the paragraph
%angular
<!DOCTYPE html>
<html>
<head>
<title>Leaflet Map with Heatmap Demo </title>
<meta charset="utf-8" />
<link
rel="stylesheet"
href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css"
@PankajWorks
PankajWorks / .gitignore
Created December 2, 2016 15:15 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@PankajWorks
PankajWorks / updateDateTime.js
Last active March 2, 2017 10:11
Ember - How to update date time - Example
// Sample handelbar code <h5> Current System Date- {{utctime}} (UTC)</h5>
import Ember from 'ember';
import config from './../config/environment';
export default Ember.Route.extend({
query: 'from_unixtime(start_time)>=curdate() and from_unixtime(start_time)<=DATE_ADD(curdate(),INTERVAL+1 day)',
model() {
var store = this.store;
return Ember.RSVP.hash({