<commit_before><div>
  Path:<input id="path" value=".">
  <div>
    <button onclick="go_to('.')">Root</button>
    <button onclick="savex()">Save</button>
    <button onclick="loadx()">Load</button>
    <button onclick="rebootx()">Reboot</button>
  </div>
  <div id="edit" style="border:1px solid blue; white-space: pre">	EDIT</div>
</div>
<script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
<script>
function str(x){return JSON.stringify(x)}
function $E(x){return document.getElementById(x.substr(1))}
function $H(x){return $E(x).innerHTML} 
function $V(x){return $E(x).value} 
function $I(e,y){e.innerHTML=y;return e} 
function LOG(x){document.body.appendChild($I(document.createElement("li"),x))}
function APPEND(e,x){e.appendChild($I(document.createElement("li"),x))}
var ws = new WebSocket("ws://localhost:8383/ws/fs");
var getId = function(){
  var _id=1000;
  return function(){return _id++;}
}();
ws.onopen=function(e){
  LOG("OPN:"+e);
  loadx();
  LOG("OPN2:"+e);
}
function send(x){
  try{
    ws.send(x)
  } catch (e) {
    LOG("SEND ERR:"+e)
  }
}
function go_to2(x){
  go_to($E("#path").value + '/' + x);
}
function go_to(x){    
    LOG("Go To " +x);
    $E("#path").value = x;
    loadx();
}
function mkdir(){
LOG("MKDIR");
  var dirname = prompt("Enter directory name to create:","");
LOG("MKDIR:"+str(dirname));
  var path=$V("#path");
  fs_mkdir(path+'/'+dirname);
  setTimeout(function(){loadx()},50);
}
function touch(){
LOG("TOUCH");
  var dirname = prompt("Enter filename to create:","");
LOG("TOUCH:"+str(dirname));
  var path=$V("#path");
  fs_touch(path+'/'+dirname);
  setTimeout(function(){loadx()},50);
}
function rmdir(){
  LOG("RMDIR");
  var dirname = prompt("Enter name to remove:","");
  var path=$V("#path");
  fs_rmdir(path+'/'+dirname);
  setTimeout(function(){loadx()},50);
}
ws.onmessage=function(x){
  LOG("MSG:"+x.data);
  m=JSON.parse(x.data);
  //LOG(m.result[1]);
  var text=m.result[1];
  var elt = $E(m.result[2]);
  if(typeof(text)=="string"){
    text = text.replace(/  /g,' &nbsp;');
    text = text.replace(/\n/g,'<br>');
    elt.innerHTML = text;
    elt.contentEditable=true;
    elt.onkeydown=function(e){
        if(e.keyCode==9){
           e.preventDefault();
           document.execCommand("InsertHTML",false,"&#09;");
        }
    }
  }else{
    elt.innerHTML = "";
    var s0 = '<a onclick="touch()">touch</a>';
    var s1 = '<a onclick="mkdir()">mkdir</a>';
    var s2 = '<a onclick="rmdir()">rmdir</a>';
    APPEND(elt,s0);
    APPEND(elt,s1);
    APPEND(elt,s2);
    for (var n=0;n<text.length;n++) {
      var v=text[n][0];
      var v2=v;
      if (text[n][1])
	  v2 += '/';
      var s = "<a xhref='/f?path="+v+"' onclick=go_to2('"+v+"') >"+v2+"</a>";
      APPEND(elt,s);
    }
    elt.contentEditable=false;
  }
}
ws.onclose=function(x){  LOG("CLS:"+x); }
ws.onerror=function(x){  LOG("ERR:"+x); }

function fs_get(path,eltName){
  send(str({"method":"fs_get","params":[path,eltName]}))}
function fs_put(path,data){
  send(str({"method":"fs_put","params":[path,data]}))}
function fs_mkdir(path){
  send(str({"method":"fs_mkdir","params":[path]}))}
function fs_rmdir(path){
  send(str({"method":"fs_rmdir","params":[path]}))}
function fs_touch(path){
  send(str({"method":"fs_touch","params":[path]}))}
function fs_unlink(path){
  send(str({"method":"fs_unlink","params":[path]}))}
function savex(){
  var text = $H("#edit");
  text = text.replace(/\<\/div\>/g,'');
  text = text.replace(/\<div\>/g,'\n');
  text = text.replace(/\<br\>/g,'\n');
  text = text.replace(/&nbsp;/g,' ');
  fs_put($V("#path"),[text]); }
function loadx(){ fs_get($V("#path"),"#edit"); }
function rebootx(){
    var cfg = {
	url: 'http://localhost:8282/stop'
    };
  $.ajax(cfg).then(function(){
	  LOG("YES");
	  ;
  },function(){
	  LOG("NO");
	  ;
  });
  LOG("sent");
 }
//</script>
<commit_msg>add updir functionality<commit_after><div>
  Path:<input id="path" value=".">
  <div>
    <button onclick="go_to('.')">Root</button>
    <button onclick="savex()">Save</button>
    <button onclick="loadx()">Load</button>
    <button onclick="rebootx()">Reboot</button>
  </div>
  <div id="edit" style="border:1px solid blue; white-space: pre">	EDIT</div>
</div>
<script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
<script>
function str(x){return JSON.stringify(x)}
function $E(x){return document.getElementById(x.substr(1))}
function $H(x){return $E(x).innerHTML} 
function $V(x){return $E(x).value} 
function $I(e,y){e.innerHTML=y;return e} 
function LOG(x){document.body.appendChild($I(document.createElement("li"),x))}
function APPEND(e,x){e.appendChild($I(document.createElement("li"),x))}
var ws = new WebSocket("ws://localhost:8383/ws/fs");
var getId = function(){
  var _id=1000;
  return function(){return _id++;}
}();
ws.onopen=function(e){
  LOG("OPN:"+e);
  loadx();
  LOG("OPN2:"+e);
}
function send(x){
  try{
    ws.send(x)
  } catch (e) {
    LOG("SEND ERR:"+e)
  }
}
function go_to2(x){
  go_to($E("#path").value + '/' + x);
}
function go_to(x){    
    LOG("Go To " +x);
    $E("#path").value = x;
    loadx();
}
function updir(){
  go_to2('..');
}
function mkdir(){
LOG("MKDIR");
  var dirname = prompt("Enter directory name to create:","");
LOG("MKDIR:"+str(dirname));
  var path=$V("#path");
  fs_mkdir(path+'/'+dirname);
  setTimeout(function(){loadx()},50);
}
function touch(){
LOG("TOUCH");
  var dirname = prompt("Enter filename to create:","");
LOG("TOUCH:"+str(dirname));
  var path=$V("#path");
  fs_touch(path+'/'+dirname);
  setTimeout(function(){loadx()},50);
}
function rmdir(){
  LOG("RMDIR");
  var dirname = prompt("Enter name to remove:","");
  var path=$V("#path");
  fs_rmdir(path+'/'+dirname);
  setTimeout(function(){loadx()},50);
}
ws.onmessage=function(x){
  LOG("MSG:"+x.data);
  m=JSON.parse(x.data);
  //LOG(m.result[1]);
  var text=m.result[1];
  var elt = $E(m.result[2]);
  if(typeof(text)=="string"){
    text = text.replace(/  /g,' &nbsp;');
    text = text.replace(/\n/g,'<br>');
    elt.innerHTML = text;
    elt.contentEditable=true;
    elt.onkeydown=function(e){
        if(e.keyCode==9){
           e.preventDefault();
           document.execCommand("InsertHTML",false,"&#09;");
        }
    }
  }else{
    elt.innerHTML = "";
    var s0 = '<a onclick="touch()">touch</a>';
    var s1 = '<a onclick="mkdir()">mkdir</a>';
    var s2 = '<a onclick="rmdir()">rmdir</a>';
    var s3 = '<a onclick="updir()">..</a>';
    APPEND(elt,s0);
    APPEND(elt,s1);
    APPEND(elt,s2);
	APPEND(elt,s3);
    for (var n=0;n<text.length;n++) {
      var v=text[n][0];
      var v2=v;
      if (text[n][1])
	  v2 += '/';
      var s = "<a xhref='/f?path="+v+"' onclick=go_to2('"+v+"') >"+v2+"</a>";
      APPEND(elt,s);
    }
    elt.contentEditable=false;
  }
}
ws.onclose=function(x){  LOG("CLS:"+x); }
ws.onerror=function(x){  LOG("ERR:"+x); }

function fs_get(path,eltName){
  send(str({"method":"fs_get","params":[path,eltName]}))}
function fs_put(path,data){
  send(str({"method":"fs_put","params":[path,data]}))}
function fs_mkdir(path){
  send(str({"method":"fs_mkdir","params":[path]}))}
function fs_rmdir(path){
  send(str({"method":"fs_rmdir","params":[path]}))}
function fs_touch(path){
  send(str({"method":"fs_touch","params":[path]}))}
function fs_unlink(path){
  send(str({"method":"fs_unlink","params":[path]}))}
function savex(){
  var text = $H("#edit");
  text = text.replace(/\<\/div\>/g,'');
  text = text.replace(/\<div\>/g,'\n');
  text = text.replace(/\<br\>/g,'\n');
  text = text.replace(/&nbsp;/g,' ');
  fs_put($V("#path"),[text]); }
function loadx(){ fs_get($V("#path"),"#edit"); }
function rebootx(){
    var cfg = {
	url: 'http://localhost:8282/stop'
    };
  $.ajax(cfg).then(function(){
	  LOG("YES");
	  ;
  },function(){
	  LOG("NO");
	  ;
  });
  LOG("sent");
 }
//</script>

{'fraction_non_alphanumeric': 0.2593730006397953, 'fraction_numerical': 0.01164427383237364, 'mean_word_length': 4.492621222768799, 'pattern_counts': {'":': 24, '<': 69, '<?xml version=': 0, '>': 67, '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': '4967307', 'n_tokens_mistral': 3126, 'n_tokens_neox': 3030, 'n_words': 474}