Skip to content

Instantly share code, notes, and snippets.

@kai-chi
kai-chi / build-on-vm.sh
Last active November 12, 2019 07:28
Deploy new hopsworks-ear with one click. Run the "deploy-hopsworks.sh" script and enjoy few minutes of free time
#!/bin/bash
set -e
BRANCH=$1
echo "Executing on vm. Branch: $BRANCH"
cd /home/vagrant/hopsworks
git fetch origin
git reset --hard "origin/$BRANCH"
@kai-chi
kai-chi / mk4scala
Created May 10, 2019 07:53
create a simple sbt project without reduntant hello-worlds
#!/bin/bash
SCALA_VERSION=2.12.8
SBT_VERSION=1.2.8
read -p "Name of the Scala project? " project_name
mkdir -p $project_name/src/{main,test}/{resources,scala}
mkdir -p $project_name/{project,target}
@kai-chi
kai-chi / tunnel-hops-ports.sh
Created April 9, 2019 09:18
Script to tunnel hopsworks ports
#!/bin/bash
returnPortMapping () {
line=$(printf -- '%s\n' "$2" | grep "$1")
echo $line | awk '{split($0,a," "); print a[3]}'
}
help () {
echo " Usage:"
@kai-chi
kai-chi / hopsworks-postman-pre-request-script.md
Last active November 14, 2019 10:59
Postman Pre-request Script for setting Hopsworks JWT token

To automatically set jwt token before a request:

  1. In "Authorization" tab - set "No Auth"
  2. In "Headers" tab - add header with key "Authorization" and value "{{Authorization}}"
  3. You can set a script for the whole collection/folder/single request. To set it for every single request from the collection right-click on the collection name and "Edit". Go to "Pre-request Scripts" tab and paste:
    pm.sendRequest({
        url: "https://localhost:8181/hopsworks-api/api/auth/login",
        method: 'POST',
        header: {
    

'Content-Type': 'application/x-www-form-urlencoded'