Skip to content

Instantly share code, notes, and snippets.

View pm-hwks's full-sized avatar
:octocat:

pm-hwks pm-hwks

:octocat:
View GitHub Profile
@pm-hwks
pm-hwks / netcat.sh
Created August 21, 2019 07:03
[Netcat network test] Netcat commands to test bandwidth between 2 linux servers #netcat #perf-test #linux #network
## Netcat server command
nc -l <unused port # > /dev/null
eg:
nc -l 1122 > /dev/null
## Netcat Client command
dd if=/dev/zero bs=9100004096 count=1 | nc <netcat server> <netcat port>
eg:
dd if=/dev/zero bs=9100004096 count=1 | nc 10.0.1.251 1122
@pm-hwks
pm-hwks / git1.sh
Last active August 6, 2023 15:16
[Git submodule resync] Update Git submodule to latest commit on origin #git #github #git-submodule
## Pull git submodules after cloning project from GitHub
## https://stackoverflow.com/questions/16773642/pull-git-submodules-after-cloning-project-from-github
git submodule update --init --recursive
## Reference : https://stackoverflow.com/questions/5828324/update-git-submodule-to-latest-commit-on-origin
# Get the submodule initially
@pm-hwks
pm-hwks / hivemall.sh
Created July 16, 2019 06:46
[Hivemall] Hivemall #hive #docker
## Deploy Hivemall to docker
docker pull hivemall/latest:20180924
docker run -p 8088:8088 -p 50070:50070 -p 19888:19888 -it hivemall/latest:20180924
## Load Iris data into hive
cd $HOME && ./bin/prepare_iris.sh
## Launch Hive
hive -S
show databases;
@pm-hwks
pm-hwks / install_dockerce_centos.sh
Last active June 9, 2019 15:58
[Install docker ce] Install Docker CE #docker #install #setup #centos #ubuntu
## install lvm2 device mapper
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
## Add docker ce repos
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
### Download and run HDP docker image
#!/bin/bash
echo "Waiting for docker daemon to start up:"
until docker ps 2>&1| grep STATUS>/dev/null; do sleep 1; done; >/dev/null
docker ps -a | grep sandbox-hdp
if [ $? -eq 0 ]; then
docker start sandbox-hdp
else
docker pull hortonworks/sandbox-hdp-standalone
docker run --name sandbox-hdp --hostname "sandbox-hdp.hortonworks.com" --privileged -d \
@pm-hwks
pm-hwks / docker.sh
Last active September 17, 2023 03:21
[Docker Commands] Docker Commands #docker #commands #cheatsheet
#Prune all unused docker resources
docker system prune
# Stop all docker containers
docker container stop $(docker container ls -aq)
# Remove all stopped containers
docker container rm $(docker container ls -aq)
# Docker hub login
@pm-hwks
pm-hwks / venv.sh
Last active December 8, 2021 23:03
[Virtualenv setup] Setup python virtualenv on macos #macos #python #virtualenv #setup
## Simple python virtual environment management
python3 -m venv segement_demo
source segement_demo/bin/activate
pip3 install requests
##### ------------ end --------- #####
# Install virtualenv & virtualenv wrapper
pip3 install virtualenv
pip3 install virtualenvwrapper
@pm-hwks
pm-hwks / git.sh
Created January 22, 2019 03:03
[Git syncing a fork] How to sync a forked repo #git #github
## Reference
# https://help.github.com/articles/syncing-a-fork/
git remote -v
# Add original git remote repo
git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
git remote -v
# Fetch the branches and their respective commits from the upstream repository. Commits to master will be stored in a local branch, upstream/master.
git fetch upstream
@pm-hwks
pm-hwks / java.sh
Last active June 30, 2020 22:22
[MacOS Java installation using Homebrew ] Install and manage multiple versions of Java using Homebrew on Macos #macos #java #brew #homebrew
## Reference : https://daviseford.com/blog/2017/12/18/installing-nifi.html
# List all versions of java on macos
/usr/libexec/java_home -V
# Allow brew to lookup versions
brew tap caskroom/versions
# Install Java8
brew cask install java8
@pm-hwks
pm-hwks / file_create.sh
Last active February 28, 2018 17:44
[Quickly create lot of small files] Create lot of small files for testing #testing #dummy #generate #test_file #test_data
# Quickly create lot of small files
# Reference : https://www.heatware.net/linux-unix/create-large-many-number-files-thousands-millions/
# count = file size x no of files
dd if=/dev/zero of=masterfile bs=1 count=10000000
#split into 10 bytes files with filename length 15
split -b 10 -a 15 masterfile