<commit_before>#!/bin/bash

rc=0

: ${NM_DIR:=/home/pi/.node_modules}
mkdir -p $NM_DIR
: ${FIREWALLA_HOME:=/home/pi/firewalla}
source ${FIREWALLA_HOME}/platform/platform.sh

cd ${FIREWALLA_HOME}

CPU_PLATFORM=$(uname -m)
branch=$(git rev-parse --abbrev-ref HEAD)

set_origin() {
   branch=$1
   node_url=$2

   # make sure node_modules use the right repo
   ( cd $NM_DIR

   NM_URL=$(git remote get-url origin)
   
   if [[ "$NM_URL" != "$node_url" ]]; then
     git remote set-url origin $node_url

     git pull origin $branch
   fi  
   ) || return 1

   return 0
   
}

set_origin $branch $(get_node_modules_url) || rc=1

exit $rc



<commit_msg>use pi to run command in 01_node_modules_setup.sh<commit_after>#!/bin/bash

rc=0

: ${NM_DIR:=/home/pi/.node_modules}
mkdir -p $NM_DIR
: ${FIREWALLA_HOME:=/home/pi/firewalla}
source ${FIREWALLA_HOME}/platform/platform.sh

cd ${FIREWALLA_HOME}

CPU_PLATFORM=$(uname -m)
branch=$(git rev-parse --abbrev-ref HEAD)

set_origin() {
   branch=$1
   node_url=$2

   # make sure node_modules use the right repo
   ( cd $NM_DIR

   NM_URL=$(git remote get-url origin)
   
   if [[ "$NM_URL" != "$node_url" ]]; then
     sudo -u pi git remote set-url origin $node_url

     sudo -u pi git pull origin $branch
   fi  
   ) || return 1

   return 0
   
}

set_origin $branch $(get_node_modules_url) || rc=1

exit $rc




{'fraction_non_alphanumeric': 0.1406480117820324, 'fraction_numerical': 0.010309278350515464, 'mean_word_length': 3.300632911392405, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1543135', 'n_tokens_mistral': 567, 'n_tokens_neox': 529, 'n_words': 126}