Skip to content

Instantly share code, notes, and snippets.

@mfgbhatti
Last active September 12, 2022 19:18
Show Gist options
  • Save mfgbhatti/98932dc28f5508927f436858064e0646 to your computer and use it in GitHub Desktop.
Save mfgbhatti/98932dc28f5508927f436858064e0646 to your computer and use it in GitHub Desktop.

##digitalocean console

  1. Copy the console URL and paste it to a new window. ex. https://cloud.digitalocean.com/droplets/111111111/console?no_layout=true.
  2. Open Developer Tools then click Console tab
  3. Copy and paste the codes below. Taken from stackoverflow
var sendString = (function(rfb, force, sendDelay) { 
  sendDelay = sendDelay || 25;
  var _q = [];
  var _qStart = function() {
    var chr = _q.shift();
    if (chr) {
      rfb.sendKey(chr);
      setTimeout(_qStart, sendDelay);
    }
  };
  var _qStop = function() { _q.length = 0; };
  var fn = function sendString(str) {
    _qStop();
    str = str || '';
    var chr;
    for (var i=0; i < str.length; i++) {
      chr = str[i].charCodeAt();
      _q.push(chr);
    }
    _qStart();
  };
  if (rfb.sendString && true !== force) {
    console.warn('rfb.sendString not installed because it already exists.  Use force if you\'d like');
  }
  else {
    rfb.sendString = fn;
  }
  return fn;
})(rfb);
  1. On the same console type sendString(“Commandline to be pasted in the console”)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment