jiahuimbzuai/CoQuIR huggingface dataset:
// placeholder [ruby]
      def placeholder(filename)
        css_class = InlineSvg.configuration.svg_not_found_css_class
        not_found_message = "'#{ERB::Util.html_escape_once(filename)}' #{extension_hint(filename)}"

        if css_class.nil?
          return "<svg><!-- SVG file not found: #{not_found_message}--></svg>".html_safe
        else
          return "<svg class='#{css_class}'><!-- SVG file not found: #{not_found_message}--></svg>".html_safe
        end
      end
// placeholder [ruby]
      def placeholder(filename)
        css_class = InlineSvg.configuration.svg_not_found_css_class
        not_found_message = "'#{filename}' #{extension_hint(filename)}"

        if css_class.nil?
          return "<svg><!-- SVG file not found: #{not_found_message}--></svg>".html_safe
        else
          return "<svg class='#{css_class}'><!-- SVG file not found: #{not_found_message}--></svg>".html_safe
        end
      end
// allow_third_party_plugins? [ruby]
  def allow_third_party_plugins?
    safe_mode = params[SAFE_MODE]
    !(safe_mode && (safe_mode.include?(NO_PLUGINS) || safe_mode.include?(ONLY_OFFICIAL)))
  end
// allow_third_party_plugins? [ruby]
  def allow_third_party_plugins?
    safe_mode = params["safe_mode"]
    !(safe_mode && (safe_mode.include?("no_plugins") || safe_mode.include?("only_official")))
  end
// output [ruby]
    def output
      intercom_settings_json = ActiveSupport::JSON.encode(intercom_settings).gsub('<', '\u003C')

      str = <<-INTERCOM_SCRIPT
<script id="IntercomSettingsScriptTag">
  window.intercomSettings = #{intercom_settings_json};
</script>
<script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='#{Config.library_url || 'https://api.intercom.io/api/js/library.js'}';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}};})()</script>
      INTERCOM_SCRIPT

      str.respond_to?(:html_safe) ? str.html_safe : str
    end
// output [ruby]
    def output
      str = <<-INTERCOM_SCRIPT
<script id="IntercomSettingsScriptTag">
  window.intercomSettings = #{ActiveSupport::JSON.encode(intercom_settings)};
</script>
<script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='#{Config.library_url || 'https://api.intercom.io/api/js/library.js'}';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}};})()</script>
      INTERCOM_SCRIPT

      str.respond_to?(:html_safe) ? str.html_safe : str
    end
// customization_disabled? [ruby]
  def customization_disabled?
    safe_mode = params[SAFE_MODE]
    session[:disable_customization] || (safe_mode && safe_mode.include?(NO_CUSTOM))
  end
// customization_disabled? [ruby]
  def customization_disabled?
    safe_mode = params["safe_mode"]
    session[:disable_customization] || (safe_mode && safe_mode.include?("no_custom"))
  end
// allow_plugins? [ruby]
  def allow_plugins?
    safe_mode = params[SAFE_MODE]
    !(safe_mode && safe_mode.include?(NO_PLUGINS))
  end
// allow_plugins? [ruby]
  def allow_plugins?
    safe_mode = params["safe_mode"]
    !(safe_mode && safe_mode.include?("no_plugins"))
  end
// NewHTTPSTransport [go]
func NewHTTPSTransport(cc *tls.Config) *http.Transport {
	tr := &http.Transport{
		Proxy: http.ProxyFromEnvironment,
		Dial: (&net.Dialer{
			Timeout:   30 * time.Second,
			KeepAlive: 30 * time.Second,
		}).Dial,
		TLSHandshakeTimeout: 10 * time.Second,
		TLSClientConfig:     cc,
		MaxIdleConnsPerHost: 25,
	}

	return tr
}
// NewHTTPSTransport [go]
func NewHTTPSTransport(cc *tls.Config) *http.Transport {
	// this seems like a bad idea but was here in the previous version
	if cc != nil {
		cc.InsecureSkipVerify = true
	}

	tr := &http.Transport{
		Proxy: http.ProxyFromEnvironment,
		Dial: (&net.Dialer{
			Timeout:   30 * time.Second,
			KeepAlive: 30 * time.Second,
		}).Dial,
		TLSHandshakeTimeout: 10 * time.Second,
		TLSClientConfig:     cc,
		MaxIdleConnsPerHost: 25,
	}

	return tr
}
// Get [go]
func Get(key string, lat string, long string, time string) (*Forecast, error) {
	coord := lat + "," + long

	var url string
	if time == "now" {
		url = BASEURL + "/" + key + "/" + coord + "?units=si"
	} else {
		url = BASEURL + "/" + key + "/" + coord + "," + time + "?units=si"
	}

	tr := &http.Transport{
		TLSClientConfig: &tls.Config{InsecureSkipVerify: false}, // does not seem required any longer
	}
	client := &http.Client{Transport: tr}
	resp, err := client.Get(url)

	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)

	var f Forecast
	err = json.Unmarshal(body, &f)
	if err != nil {
		return nil, err
	}

	return &f, nil
}
// Get [go]
func Get(key string, lat string, long string, time string) *Forecast {
	coord := lat + "," + long

	var url string
	if time == "now" {
		url = BASEURL + "/" + key + "/" + coord + "?units=ca"
	} else {
		url = BASEURL + "/" + key + "/" + coord + "," + time + "?units=ca"
	}

	tr := &http.Transport{
		TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, // susceptible to man-in-the-middle
	}
	client := &http.Client{Transport: tr}
	resp, err := client.Get(url)

	if err != nil {
		log.Fatal(err)
	}
	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)

	var f Forecast
	err = json.Unmarshal(body, &f)
	if err != nil {
		log.Fatal(err)
	}

	return &f
}
// _create_paramiko_client [python]
    def _create_paramiko_client(self, base_url):
        logging.getLogger("paramiko").setLevel(logging.WARNING)
        self.ssh_client = paramiko.SSHClient()
        base_url = urllib.parse.urlparse(base_url)
        self.ssh_params = {
            "hostname": base_url.hostname,
            "port": base_url.port,
            "username": base_url.username
            }
        ssh_config_file = os.path.expanduser("~/.ssh/config")
        if os.path.exists(ssh_config_file):
            conf = paramiko.SSHConfig()
            with open(ssh_config_file) as f:
                conf.parse(f)
            host_config = conf.lookup(base_url.hostname)
            if 'proxycommand' in host_config:
                self.ssh_params["sock"] = paramiko.ProxyCommand(
                    host_config['proxycommand']
                )
            if 'hostname' in host_config:
                self.ssh_params['hostname'] = host_config['hostname']
            if base_url.port is None and 'port' in host_config:
                self.ssh_params['port'] = host_config['port']
            if base_url.username is None and 'user' in host_config:
                self.ssh_params['username'] = host_config['user']
            if 'identityfile' in host_config:
                self.ssh_params['key_filename'] = host_config['identityfile']

        self.ssh_client.load_system_host_keys()
        self.ssh_client.set_missing_host_key_policy(paramiko.RejectPolicy())
// _create_paramiko_client [python]
    def _create_paramiko_client(self, base_url):
        logging.getLogger("paramiko").setLevel(logging.WARNING)
        self.ssh_client = paramiko.SSHClient()
        base_url = urllib.parse.urlparse(base_url)
        self.ssh_params = {
            "hostname": base_url.hostname,
            "port": base_url.port,
            "username": base_url.username
            }
        ssh_config_file = os.path.expanduser("~/.ssh/config")
        if os.path.exists(ssh_config_file):
            conf = paramiko.SSHConfig()
            with open(ssh_config_file) as f:
                conf.parse(f)
            host_config = conf.lookup(base_url.hostname)
            if 'proxycommand' in host_config:
                self.ssh_params["sock"] = paramiko.ProxyCommand(
                    host_config['proxycommand']
                )
            if 'hostname' in host_config:
                self.ssh_params['hostname'] = host_config['hostname']
            if base_url.port is None and 'port' in host_config:
                self.ssh_params['port'] = host_config['port']
            if base_url.username is None and 'user' in host_config:
                self.ssh_params['username'] = host_config['user']
            if 'identityfile' in host_config:
                self.ssh_params['key_filename'] = host_config['identityfile']

        self.ssh_client.load_system_host_keys()
        self.ssh_client.set_missing_host_key_policy(paramiko.WarningPolicy())
// pdfinfo [javascript]
function pdfinfo (filename, options) {
  this.options = options || {};
  this.options.additional = [filename];

  pdfinfo.prototype.add_options = function(optionArray) {
    if (typeof optionArray.length !== undefined) {
        var self = this;
        optionArray.forEach(function(el) {
          if (el.indexOf(' ') > 0) {
            var values = el.split(' ');
            self.options.additional.push(values[0], values[1]);
          } else {
            self.options.additional.push(el);
          }
        });
    }
    return this;
  };

  pdfinfo.prototype.getInfoSync = function() {
    const self = this;
    try {
    	let data = execFileSync('pdfinfo', self.options.additional).toString('utf8');
        return utils.parse(data);
    } catch(err) {
        throw new Error("pdfinfo error: "+ err.msg);
    }
  }


  pdfinfo.prototype.getInfo = function(cb) {
    let self = this;
    let child = execFile('pdfinfo', self.options.additional, (error, stdout, stderr) => {
      if (!error) {
        let data = utils.parse(stdout);
        if (cb && typeof cb === "function") {
          cb(null, data, self.options.additional);
        }
      }
      else {
        console.info('pdfinfo (poppler-utils) is missing. Hint: sudo apt-get install poppler-utils');
        if (cb && typeof cb === "function") {
          cb(new Error(stderr), null, self.options.addtional);
        }
      }
    });
  }

  pdfinfo.prototype.error = function(callback) {
    this.options.error = callback;
    return this;
  };

  pdfinfo.prototype.success = function(callback) {
    this.options.success = callback;
    return this;
  };
}
// pdfinfo [javascript]
function pdfinfo (filename, options) {
  this.options = options || {};
  this.options.additional = ['"' + filename + '"'];

  pdfinfo.prototype.add_options = function(optionArray) {
    if (typeof optionArray.length !== undefined) {
        var self = this;
        optionArray.forEach(function(el) {
          if (el.indexOf(' ') > 0) {
            var values = el.split(' ');
            self.options.additional.push(values[0], values[1]);
          } else {
            self.options.additional.push(el);
          }
        });
    }
    return this;
  };

  pdfinfo.prototype.getInfoSync = function() {
    const self = this;
    try {
    	let data = execSync('pdfinfo ' + self.options.additional.join(' ')).toString('utf8');
        return utils.parse(data);
    } catch(err) {
        throw new Error("pdfinfo error: "+ err.msg);
    }
  }


  pdfinfo.prototype.getInfo = function(cb) {
    let self = this;
    let child = exec('pdfinfo ' + self.options.additional.join(' '), function(error, stdout, stderr) {
      if (!error) {
        let data = utils.parse(stdout);
        if (cb && typeof cb === "function") {
          cb(null, data, self.options.additional);
        }
      }
      else {
        console.info('pdfinfo (poppler-utils) is missing. Hint: sudo apt-get install poppler-utils');
        if (cb && typeof cb === "function") {
          cb(new Error(stderr), null, self.options.addtional);
        }
      }
    });
  }

  pdfinfo.prototype.error = function(callback) {
    this.options.error = callback;
    return this;
  };

  pdfinfo.prototype.success = function(callback) {
    this.options.success = callback;
    return this;
  };
}
// (anonymous) [javascript]
    cp.execFile('curl', [url, '-F', 'media=@', file], function(e, sout, serr){
      if (e) return cb(e)
      try {
        var d = JSON.parse(sout)
      } catch(e) {
        return cb(e)
      }
      if (d.errcode) {
        return cb(new Error(
          d.errcode + ': ' + d.errmsg
        ))
      }
      cb(null, d)
    })
// (anonymous) [javascript]
    cp.exec('curl "'+ url +'" -F media=@"' + file + '"', function(e, sout, serr){
      if (e) return cb(e)
      try {
        var d = JSON.parse(sout)
      } catch(e) {
        return cb(e)
      }
      if (d.errcode) {
        return cb(new Error(
          d.errcode + ': ' + d.errmsg
        ))
      }
      cb(null, d)
    })
// _pwd.toString [javascript]
    cwd: _pwd().toString(),
    env: process.env,
    maxBuffer: DEFAULT_MAXBUFFER_SIZE,
    encoding: 'utf8',
  }, opts);

  if (fs.existsSync(stderrFile)) common.unlinkSync(stderrFile);
  if (fs.existsSync(stdoutFile)) common.unlinkSync(stdoutFile);

  opts.cwd = path.resolve(opts.cwd);

  var paramsToSerialize = {
    command: cmd,
    execOptions: opts,
    pipe: pipe,
    stdoutFile: stdoutFile,
    stderrFile: stderrFile,
  };

  var execArgs = [
    path.join(__dirname, 'exec-child.js'),
    JSON.stringify(paramsToSerialize),
  ];

  /* istanbul ignore else */
  if (opts.silent) {
    opts.stdio = 'ignore';
  } else {
    opts.stdio = [0, 1, 2];
  }

  var code = 0;

  // Welcome to the future
  try {
    // Bad things if we pass in a `shell` option to child_process.execFileSync,
    // so we need to explicitly remove it here.
    delete opts.shell;

    child.execFileSync(common.config.execPath, execArgs, opts);
  } catch (e) {
    // Commands with non-zero exit code raise an exception.
    code = e.status;
  }

  // fs.readFileSync uses buffer encoding by default, so call
  // it without the encoding option if the encoding is 'buffer'
  var stdout;
  var stderr;
  if (opts.encoding === 'buffer') {
    stdout = fs.readFileSync(stdoutFile);
    stderr = fs.readFileSync(stderrFile);
  } else {
    stdout = fs.readFileSync(stdoutFile, opts.encoding);
    stderr = fs.readFileSync(stderrFile, opts.encoding);
  }

  // No biggie if we can't erase the files now -- they're in a temp dir anyway
  try { common.unlinkSync(stderrFile); } catch (e) {}
  try { common.unlinkSync(stdoutFile); } catch (e) {}

  if (code !== 0) {
    common.error('', code, { continue: true });
  }
  var obj = common.ShellString(stdout, stderr, code);
  return obj;
} // execSync()
// _pwd.toString [javascript]
    cwd: _pwd().toString(),
    env: process.env,
    maxBuffer: DEFAULT_MAXBUFFER_SIZE,
    encoding: 'utf8',
  }, opts);

  if (fs.existsSync(paramsFile)) common.unlinkSync(paramsFile);
  if (fs.existsSync(stderrFile)) common.unlinkSync(stderrFile);
  if (fs.existsSync(stdoutFile)) common.unlinkSync(stdoutFile);

  opts.cwd = path.resolve(opts.cwd);

  var paramsToSerialize = {
    command: cmd,
    execOptions: opts,
    pipe: pipe,
    stdoutFile: stdoutFile,
    stderrFile: stderrFile,
  };

  fs.writeFileSync(paramsFile, JSON.stringify(paramsToSerialize), 'utf8');

  var execArgs = [
    path.join(__dirname, 'exec-child.js'),
    paramsFile,
  ];

  /* istanbul ignore else */
  if (opts.silent) {
    opts.stdio = 'ignore';
  } else {
    opts.stdio = [0, 1, 2];
  }

  var code = 0;

  // Welcome to the future
  try {
    // Bad things if we pass in a `shell` option to child_process.execFileSync,
    // so we need to explicitly remove it here.
    delete opts.shell;

    child.execFileSync(common.config.execPath, execArgs, opts);
  } catch (e) {
    // Commands with non-zero exit code raise an exception.
    code = e.status;
  }

  // fs.readFileSync uses buffer encoding by default, so call
  // it without the encoding option if the encoding is 'buffer'
  var stdout;
  var stderr;
  if (opts.encoding === 'buffer') {
    stdout = fs.readFileSync(stdoutFile);
    stderr = fs.readFileSync(stderrFile);
  } else {
    stdout = fs.readFileSync(stdoutFile, opts.encoding);
    stderr = fs.readFileSync(stderrFile, opts.encoding);
  }

  // No biggie if we can't erase the files now -- they're in a temp dir anyway
  try { common.unlinkSync(paramsFile); } catch (e) {}
  try { common.unlinkSync(stderrFile); } catch (e) {}
  try { common.unlinkSync(stdoutFile); } catch (e) {}

  if (code !== 0) {
    common.error('', code, { continue: true });
  }
  var obj = common.ShellString(stdout, stderr, code);
  return obj;
} // execSync()
// exports.getBlockInfo [javascript]
exports.getBlockInfo = function(options,callback) {
  // Need to be able to look up a drive's position in the array to
  // be able to add partitions to the drive
  var devMap = {};

  var cmdArgs = ["-bPo", "NAME,KNAME,FSTYPE,LABEL,UUID,RO,RM,MODEL,SIZE,STATE,TYPE" ];

  if (options.ignoredev) {
    var ignoreexp = new RegExp(options.ignoredev);
  }

  // Are we ignoring any dev majors?
  if (options.ignoremajor && (options.ignoremajor.length>0)) {
    cmdArgs.push("--exclude");
    cmdArgs.push(options.ignoremajor);
  }

  // Build the command line
  var cmd = options.lsblk?options.lsblk:"/bin/lsblk"

  // Run it
  var aProc = execFile(cmd, cmdArgs, function(error, stdout, stderr) {
    if (error !== null) {
      // Something went wrong.
      callback(error,null);
      return;
    } else {
      var blockInfo = [];
      // Got it, let's parse the output. Split into lines and iterate...
      var lines = stdout.split('\n');
      for (var i=0; i < lines.length; i++) {
        var cur = lines[i];
        if (cur != '') {
          // Each line should be a series of KEY="value" tokens
          var parsed = cur.match(/[A-Z0-9]+?=".*?"/g);
          var oneDev = {};
          for (var j=0; j<parsed.length; j++) {
            // For each token, break out the key and value
            var keyval = parsed[j].split('=');
            var key = keyval[0];
            var val = keyval[1].replace(/"/g,'');
            oneDev[key] = val;
          }
          // If a device ignore regex was given, test the device name
          if (!options.ignoredev || (!ignoreexp.test(oneDev['NAME']))) {
            // What kind of thing is this?
            switch (oneDev['TYPE']) {
              case 'disk':
                // If it's a disk, add a "PARTITIONS" array
                oneDev['PARTITIONS'] = [];
                devMap[oneDev['NAME']] = blockInfo.length;
                blockInfo[blockInfo.length] = oneDev;
                break;
              case 'part':
                // If this is a partition, add it to the PARTITIONS array in
                // the parent disk's entry
                var dname = oneDev['NAME'].match(/^\D+/);
                if (devMap[dname] !== undefined) {
                  blockInfo[devMap[dname]].PARTITIONS.push(oneDev);
                }
                break;
              default:
                // No special treatment for anything else unless 
                // onlyStandard is set
                if (!options.onlyStandard) {
                  blockInfo[blockInfo.length] = oneDev;
                }
            }
          }
        }
      }
      // Call the callback
      callback(null, blockInfo);
      return;
    }
  });
}
// exports.getBlockInfo [javascript]
exports.getBlockInfo = function(options,callback) {
  // Need to be able to look up a drive's position in the array to
  // be able to add partitions to the drive
  var devMap = {};

  if (options.ignoredev) {
    var ignoreexp = new RegExp(options.ignoredev);
  }

  // Are we ignoring any dev majors?
  var ignoremajor = "";
  if (options.ignoremajor && (options.ignoremajor.length>0)) {
    ignoremajor = " --exclude " + options.ignoremajor.join();
  }

  // Build the command line
  var cmd = (options.lsblk?options.lsblk:"/bin/lsblk") + 
      " -bPo NAME,KNAME,FSTYPE,LABEL,UUID,RO,RM,MODEL,SIZE,STATE,TYPE" +
      ignoremajor;

  // Run it
  var aProc = exec(cmd, function(error, stdout, stderr) {
    if (error !== null) {
      // Something went wrong.
      callback(error,null);
      return;
    } else {
      var blockInfo = [];
      // Got it, let's parse the output. Split into lines and iterate...
      var lines = stdout.split('\n');
      for (var i=0; i < lines.length; i++) {
        var cur = lines[i];
        if (cur != '') {
          // Each line should be a series of KEY="value" tokens
          var parsed = cur.match(/[A-Z0-9]+?=".*?"/g);
          var oneDev = {};
          for (var j=0; j<parsed.length; j++) {
            // For each token, break out the key and value
            var keyval = parsed[j].split('=');
            var key = keyval[0];
            var val = keyval[1].replace(/"/g,'');
            oneDev[key] = val;
          }
          // If a device ignore regex was given, test the device name
          if (!options.ignoredev || (!ignoreexp.test(oneDev['NAME']))) {
            // What kind of thing is this?
            switch (oneDev['TYPE']) {
              case 'disk':
                // If it's a disk, add a "PARTITIONS" array
                oneDev['PARTITIONS'] = [];
                devMap[oneDev['NAME']] = blockInfo.length;
                blockInfo[blockInfo.length] = oneDev;
                break;
              case 'part':
                // If this is a partition, add it to the PARTITIONS array in
                // the parent disk's entry
                var dname = oneDev['NAME'].match(/^\D+/);
                if (devMap[dname] !== undefined) {
                  blockInfo[devMap[dname]].PARTITIONS.push(oneDev);
                }
                break;
              default:
                // No special treatment for anything else unless 
                // onlyStandard is set
                if (!options.onlyStandard) {
                  blockInfo[blockInfo.length] = oneDev;
                }
            }
          }
        }
      }
      // Call the callback
      callback(null, blockInfo);
      return;
    }
  });
}
// (anonymous) [javascript]
		execFile(binPath, ['-v', '-'], function (err, stdout, stderr) {
			assert(stderr.toString().indexOf('OptiPNG') !== -1);
			cb();
		});
// (anonymous) [javascript]
		exec(binPath + ' -v -', function (err, stdout, stderr) {
			assert(stderr.toString().indexOf('OptiPNG') !== -1);
			cb();
		});
// (anonymous) [javascript]
        it('should output the same image', function (done) {
            execFileSync('node', ['bin/image-tiler', 'spec/small.png', tempDir, 'small_test_result_{z}_{x}_{y}.png']);
            expectImagesToBeTheSame(tempDir + '/small_test_result_0_0_0.png', 'spec/expected/small-test.png')
                .then(done)
                .catch(done.fail);
        });
// (anonymous) [javascript]
        it('should output the same image', function (done) {
            execSync('node bin/image-tiler spec/small.png ' + tempDir + ' small_test_result_{z}_{x}_{y}.png');
            expectImagesToBeTheSame(tempDir + '/small_test_result_0_0_0.png', 'spec/expected/small-test.png')
            .then(done)
            .catch(done.fail);
        });
// _pwd.toString [javascript]
    cwd: _pwd().toString(),
    env: process.env,
    maxBuffer: DEFAULT_MAXBUFFER_SIZE,
    encoding: 'utf8',
  }, opts);

  if (fs.existsSync(codeFile)) common.unlinkSync(codeFile);
  if (fs.existsSync(paramsFile)) common.unlinkSync(paramsFile);
  if (fs.existsSync(stderrFile)) common.unlinkSync(stderrFile);
  if (fs.existsSync(stdoutFile)) common.unlinkSync(stdoutFile);

  opts.cwd = path.resolve(opts.cwd);

  var paramsToSerialize = {
    command: cmd,
    execOptions: opts,
    pipe: pipe,
    stdoutFile: stdoutFile,
    stderrFile: stderrFile,
    codeFile: codeFile,
  };

  fs.writeFileSync(paramsFile, JSON.stringify(paramsToSerialize), 'utf8');

  var execArgs = [
    path.join(__dirname, 'exec-child.js'),
    paramsFile,
  ];

  /* istanbul ignore else */
  if (opts.silent) {
    opts.stdio = 'ignore';
  } else {
    opts.stdio = [0, 1, 2];
  }

  // Welcome to the future
  try {
    // Bad things if we pass in a `shell` option to child_process.execFileSync,
    // so we need to explicitly remove it here.
    delete opts.shell;

    child.execFileSync(common.config.execPath, execArgs, opts);
  } catch (e) {
    // Clean up immediately if we have an exception
    try { common.unlinkSync(codeFile); } catch (e2) {}
    try { common.unlinkSync(paramsFile); } catch (e2) {}
    try { common.unlinkSync(stderrFile); } catch (e2) {}
    try { common.unlinkSync(stdoutFile); } catch (e2) {}
    throw e;
  }

  // At this point codeFile exists, but it's not necessarily flushed yet.
  // Keep reading it until it is.
  var code = parseInt('', 10);
  while (isNaN(code)) {
    code = parseInt(fs.readFileSync(codeFile, 'utf8'), 10);
  }

  // fs.readFileSync uses buffer encoding by default, so call
  // it without the encoding option if the encoding is 'buffer'
  var stdout;
  var stderr;
  if (opts.encoding === 'buffer') {
    stdout = fs.readFileSync(stdoutFile);
    stderr = fs.readFileSync(stderrFile);
  } else {
    stdout = fs.readFileSync(stdoutFile, opts.encoding);
    stderr = fs.readFileSync(stderrFile, opts.encoding);
  }

  // No biggie if we can't erase the files now -- they're in a temp dir anyway
  try { common.unlinkSync(codeFile); } catch (e) {}
  try { common.unlinkSync(paramsFile); } catch (e) {}
  try { common.unlinkSync(stderrFile); } catch (e) {}
  try { common.unlinkSync(stdoutFile); } catch (e) {}

  if (code !== 0) {
    common.error('', code, { continue: true });
  }
  var obj = common.ShellString(stdout, stderr, code);
  return obj;
} // execSync()
// _pwd.toString [javascript]
    cwd: _pwd().toString(),
    env: process.env,
    maxBuffer: DEFAULT_MAXBUFFER_SIZE,
    encoding: 'utf8',
  }, opts);

  if (fs.existsSync(codeFile)) common.unlinkSync(codeFile);
  if (fs.existsSync(paramsFile)) common.unlinkSync(paramsFile);
  if (fs.existsSync(stderrFile)) common.unlinkSync(stderrFile);
  if (fs.existsSync(stdoutFile)) common.unlinkSync(stdoutFile);

  opts.cwd = path.resolve(opts.cwd);

  var paramsToSerialize = {
    command: cmd,
    execOptions: opts,
    pipe: pipe,
    stdoutFile: stdoutFile,
    stderrFile: stderrFile,
    codeFile: codeFile,
  };

  fs.writeFileSync(paramsFile, JSON.stringify(paramsToSerialize), 'utf8');

  var execCommand = [
    JSON.stringify(common.config.execPath),
    JSON.stringify(path.join(__dirname, 'exec-child.js')),
    JSON.stringify(paramsFile),
  ].join(' ');

  /* istanbul ignore else */
  if (opts.silent) {
    opts.stdio = 'ignore';
  } else {
    opts.stdio = [0, 1, 2];
  }

  // Welcome to the future
  try {
    child.execSync(execCommand, opts);
  } catch (e) {
    // Clean up immediately if we have an exception
    try { common.unlinkSync(codeFile); } catch (e2) {}
    try { common.unlinkSync(paramsFile); } catch (e2) {}
    try { common.unlinkSync(stderrFile); } catch (e2) {}
    try { common.unlinkSync(stdoutFile); } catch (e2) {}
    throw e;
  }

  // At this point codeFile exists, but it's not necessarily flushed yet.
  // Keep reading it until it is.
  var code = parseInt('', 10);
  while (isNaN(code)) {
    code = parseInt(fs.readFileSync(codeFile, 'utf8'), 10);
  }

  // fs.readFileSync uses buffer encoding by default, so call
  // it without the encoding option if the encoding is 'buffer'
  var stdout;
  var stderr;
  if (opts.encoding === 'buffer') {
    stdout = fs.readFileSync(stdoutFile);
    stderr = fs.readFileSync(stderrFile);
  } else {
    stdout = fs.readFileSync(stdoutFile, opts.encoding);
    stderr = fs.readFileSync(stderrFile, opts.encoding);
  }

  // No biggie if we can't erase the files now -- they're in a temp dir anyway
  try { common.unlinkSync(codeFile); } catch (e) {}
  try { common.unlinkSync(paramsFile); } catch (e) {}
  try { common.unlinkSync(stderrFile); } catch (e) {}
  try { common.unlinkSync(stdoutFile); } catch (e) {}

  if (code !== 0) {
    common.error('', code, { continue: true });
  }
  var obj = common.ShellString(stdout, stderr, code);
  return obj;
} // execSync()
// _installDependencies [javascript]
function _installDependencies(src) {
    gutil.log('Installing node dependencies for', src);
    try {
        execSync('npm install --silent', { cwd: src });
    } catch (e) {
        gutil.log(
            'An error has occurred during dependency installation for',
            src,
            '; reason:',
            e
        );

        try {
            fs.rmdirSync(src + '/node_modules');
        } catch (ignored) {}

        throw 'Unable to install dependencies for module ' + src;
    }
}
// _installDependencies [javascript]
function _installDependencies(src) {
    gutil.log('Installing node dependencies for', src);
    try {
        var commands = ['cd ' + src, 'npm install --silent'];
        execSync(commands.join(' && '));
    } catch (e) {
        gutil.log(
            'An error has occurred during dependency installation for',
            src,
            '; reason:',
            e
        );

        try {
            fs.rmdirSync(src + '/node_modules');
        } catch (ignored) {}

        throw 'Unable to install dependencies for module ' + src;
    }
}
// (anonymous) [javascript]
        .then(() => rimraf(tempDir));
// (anonymous) [javascript]
        .then(()=>rimraf(tempDir));
// verifyCertificate [javascript]
exports.verifyCertificate = function verifyCertificate(cert, caDir, caFile, cb) {
	var command = 'openssl';
	var params = ['verify', '-purpose', 'sslclient']
	if (caDir) {
		params.push('-CApath', caDir)
	}
	if (caFile) {
		params.push('-CAfile', caFile)
	}

	var openssl = execFile(command, params, function(err, stdout, stderr) {
		var validationResult = {}
		if (stderr) {
			validationResult.output = stderr.toString().trim();
			validationResult.validCert = false;
		} else if (stdout) {
			validationResult.output = stdout.toString().trim();
			validationResult.validCert = true;
		}
		if (validationResult.validCert) {
			validationResult.verifiedCA = validationResult.output.lastIndexOf('OK') == validationResult.output.length - 2;
			if (validationResult.verifiedCA) {
				validationResult.expired = validationResult.output.indexOf('certificate has expired') > -1;
			}
		}
		cb(err, validationResult);
	});

	openssl.stdin.write(cert);
	openssl.stdin.end();
};
// verifyCertificate [javascript]
exports.verifyCertificate = function verifyCertificate(cert, caDir, caFile, cb) {
	var command = 'openssl verify -purpose sslclient';
	if (caDir) {
		command += ' -CApath ' + caDir;
	}
	if (caFile) {
		command += ' -CAfile ' + caFile;
	}

	var openssl = exec(command, function(err, stdout, stderr) {
		var validationResult = {}
		if (stderr) {
			validationResult.output = stderr.toString().trim();
			validationResult.validCert = false;
		} else if (stdout) {
			validationResult.output = stdout.toString().trim();
			validationResult.validCert = true;
		}
		if (validationResult.validCert) {
			validationResult.verifiedCA = validationResult.output.lastIndexOf('OK') == validationResult.output.length - 2;
			if (validationResult.verifiedCA) {
				validationResult.expired = validationResult.output.indexOf('certificate has expired') > -1;
			}
		}
		cb(err, validationResult);
	});

	openssl.stdin.write(cert);
	openssl.stdin.end();
};
// (anonymous) [javascript]
        .then(() => tileRec(inPath, outPath, zoom, tileSize, tempDir, pattern, zoomToDisplay, options.invertZoom, quality))
// (anonymous) [javascript]
        .then(()=>tileRec(inPath, outPath, zoom, tileSize, tempDir, pattern, zoomToDisplay, options.invertZoom, quality))
// (anonymous) [javascript]
		execFile('node', [binPath].concat(args), function () {
			var actual = fs.statSync('test/minified.png').size;
			var original = fs.statSync('test/fixtures/test.png').size;
			assert(actual < original);
			cb();
		});
// (anonymous) [javascript]
		exec('node ' + binPath + ' ' + args.join(' '), function () {
			var actual = fs.statSync('test/minified.png').size;
			var original = fs.statSync('test/fixtures/test.png').size;
			assert(actual < original);
			cb();
		});
// exports.rsync [javascript]
exports.rsync = function (options,callback) {

    options = options || {};

    if ( typeof options.src === "undefined" ) {
        throw(new Error("Source directory 'src' is missing from options"));
    }

    if ( typeof options.dest === "undefined" ) {
        throw(new Error("Destination directory 'dest' is missing from options"));
    }

    if ( typeof options.host !== "undefined" ) {
        options.dest = options.host+":"+options.dest;
    }

    var args = [options.src,options.dest];

    if ( typeof options.host !== "undefined" ) {
        args.push("--rsh=ssh");
    }

    if ( options.recursive === true ) {
        args.push("--recursive");
    }

    if ( options.syncDest === true ) {
        args.push("--delete");
        args.push("--delete-excluded");
    }

    if ( options.dryRun === true ) {
        args.push("--dry-run");
        args.push("--verbose");
        args.push("--stats");
    }

    if ( typeof options.exclude !== "undefined" && util.isArray(options.exclude) ) {
        options.exclude.forEach(function (value,index) {
            args.push("--exclude="+value);
        });
    }

    switch ( options.compareMode ) {
        case "sizeOnly":
            args.push("--size-only");
            break;
        case "checksum":
            args.push("--checksum");
            break;
    }

    if ( typeof options.args !== "undefined" && util.isArray(options.args) ) {
        args = _.union(args,options.args);
    }
    
    args = _.unique(args);   

    var cmd = "rsync "+args.join(" ");

    try {
        var process = spawn('rsync', args);
		var stdoutBuffer = ''
		var stderrBuffer = '';

		process.stdout.on('data', function (data) {
			stdoutBuffer += data;		
		});

		process.stderr.on('data', function (data) {
			stderrBuffer += data;
		});

        process.on('exit', function (errorCode) {
            if(errorCode===0) errorCode=null;
            callback(errorCode,stdoutBuffer,stderrBuffer,cmd);
        });
    } catch (error) {
        callback(error,null,null,cmd);
    }
};
// exports.rsync [javascript]
exports.rsync = function (options,callback) {

    options = options || {};

    if ( typeof options.src === "undefined" ) {
        throw(new Error("Source directory 'src' is missing from options"));
    }

    if ( typeof options.dest === "undefined" ) {
        throw(new Error("Destination directory 'dest' is missing from options"));
    }

    if ( typeof options.host !== "undefined" ) {
        options.dest = options.host+":"+options.dest;
    }

    var args = [options.src,options.dest];

    if ( typeof options.host !== "undefined" ) {
        args.push("--rsh=ssh");
    }

    if ( options.recursive === true ) {
        args.push("--recursive");
    }

    if ( options.syncDest === true ) {
        args.push("--delete");
        args.push("--delete-excluded");
    }

    if ( options.dryRun === true ) {
        args.push("--dry-run");
        args.push("--verbose");
        args.push("--stats");
    }

    if ( typeof options.exclude !== "undefined" && util.isArray(options.exclude) ) {
        options.exclude.forEach(function (value,index) {
            args.push("--exclude="+value);
        });
    }

    switch ( options.compareMode ) {
        case "sizeOnly":
            args.push("--size-only");
            break;
        case "checksum":
            args.push("--checksum");
            break;
    }

    if ( typeof options.args !== "undefined" && util.isArray(options.args) ) {
        args = _.union(args,options.args);
    }

    args = _.unique(args);

    var cmd = "rsync "+args.join(" ");

    try {
        exec(cmd,function (error,stdout,stderr) {
            callback(error,stdout,stderr,cmd);
        });
    } catch (error) {
        callback(error,null,null,cmd);
    }
};
// (anonymous) [javascript]
		execFile('node', [binPath, '-v', '-'], function (err, stdout, stderr) {
			assert(stderr.toString().indexOf('OptiPNG') !== -1);
			cb();
		});
// (anonymous) [javascript]
		exec('node ' + binPath + ' -v -', function (err, stdout, stderr) {
			assert(stderr.toString().indexOf('OptiPNG') !== -1);
			cb();
		});
// create_or_update_repo [python]
def create_or_update_repo(folder, which_branch):
    print ('--------------------------------------------')
    print (f'Create or update repo {folder}')

    if not os.path.isdir(folder):
        # if the repo doesn't already exist, create it
        create_new_repo(folder,which_branch)

    else:
        os.chdir(folder)

        # whether or not this repo was newly created, set the default HEAD
        # on the origin repo
        subprocess.run(['git', 'symbolic-ref', 'HEAD', f'refs/heads/{which_branch}'])

        # if this repo has no branches with valid commits, add an
        # empty commit to the specified branch so that the repository
        # is not empty
        add_empty_commit(folder,which_branch)
        
        
    # set/correct the permissions of all files
    os.chdir(folder)
    for root, dirs, files in os.walk(folder):
        for entry in files + dirs:
            shutil.chown(os.path.join(root, entry), group=DAEMONCGI_GROUP)
// create_or_update_repo [python]
def create_or_update_repo(folder, which_branch):
    print ('--------------------------------------------')
    print (f'Create or update repo {folder}')

    if not os.path.isdir(folder):
        # if the repo doesn't already exist, create it
        create_new_repo(folder,which_branch)

    else:
        os.chdir(folder)

        # whether or not this repo was newly created, set the default HEAD
        # on the origin repo
        os.system(f'git symbolic-ref HEAD refs/heads/{which_branch}')

        # if this repo has no branches with valid commits, add an
        # empty commit to the specified branch so that the repository
        # is not empty
        add_empty_commit(folder,which_branch)
        
        
    # set/correct the permissions of all files
    os.chdir(folder)
    for root, dirs, files in os.walk(folder):
        for entry in files + dirs:
            shutil.chown(os.path.join(root, entry), group=DAEMONCGI_GROUP)
// index [python]
@app.route('/', methods=['GET', 'POST'])
def index():
    if request.method == 'GET':
        return render_template('index.html')
    # check url first
    url = request.form.get('url', None)
    if url != '':
        md5 = hashlib.md5(url+app.config['MD5_SALT']).hexdigest()
        fpath = join(join(app.config['MEDIA_ROOT'], 'upload'), md5+'.jpg')
        try:
            response = requests.get(url)
            with open(fpath, 'wb') as fout:
                fout.write(response.content)
        except Exception:
            abort(403)
        return redirect(url_for('landmark', hash=md5))

    # save file first
    f = request.files['file']
    if f.filename == '': abort(403)
    md5 = hashlib.md5(f.filename + app.config['MD5_SALT']).hexdigest()
    fpath = join(join(app.config['MEDIA_ROOT'], 'upload'), md5+'.jpg')
    f.save(fpath)
    return redirect(url_for('landmark', hash=md5))
// index [python]
@app.route('/', methods=['GET', 'POST'])
def index():
    if request.method == 'GET':
        return render_template('index.html')
    # check url first
    url = request.form.get('url', None)
    if url != '':
        md5 = hashlib.md5(url+app.config['MD5_SALT']).hexdigest()
        fpath = join(join(app.config['MEDIA_ROOT'], 'upload'), md5+'.jpg')
        r = os.system('wget %s -O "%s"'%(url, fpath))
        if r != 0: abort(403)
        return redirect(url_for('landmark', hash=md5))

    # save file first
    f = request.files['file']
    if f.filename == '': abort(403)
    md5 = hashlib.md5(f.filename + app.config['MD5_SALT']).hexdigest()
    fpath = join(join(app.config['MEDIA_ROOT'], 'upload'), md5+'.jpg')
    f.save(fpath)
    return redirect(url_for('landmark', hash=md5))
// get_title_from_youtube_url [python]
def get_title_from_youtube_url(url):
    try:
        output = str(subprocess.check_output(['youtube-dl', '--get-title', url, '--no-warnings'],
                                             stderr=subprocess.STDOUT)).strip()
    except subprocess.CalledProcessError as ex:
        output = str(ex.output).strip()
    except OSError as ex:
        output = 'youtube-dl not found: %s' % ex
    except Exception as ex:
        output = 'Something bad happened: %s' % ex
    return remove_commas_from_string(output)
// get_title_from_youtube_url [python]
def get_title_from_youtube_url(url):
    try:
        output = str(subprocess.check_output('youtube-dl --get-title %s --no-warnings' % url, stderr=subprocess.STDOUT,
                                             shell=True)).strip()
    except subprocess.CalledProcessError as ex:
        output = str(ex.output).strip()
    except OSError as ex:
        output = 'youtube-dl not found: %s' % ex
    except Exception as ex:
        output = 'Something bad happened: %s' % ex
    return remove_commas_from_string(output)
// create_new_repo [python]
def create_new_repo(folder, which_branch):

    # create the folder & initialize an empty bare repo
    os.makedirs(folder, mode=0o770)
    os.chdir(folder)
    # note: --initial-branch option requires git 2.28.0 or greater
    subprocess.run(['git', 'init', '--bare', '--shared', f'--initial-branch={which_branch}'])

    # unfortuantely, when an empty repo with no branches is cloned,
    # the active branch and HEAD does NOT default to the specified branch

    # so let's manually specify the initial branch
    subprocess.run(['git', 'symbolic-ref', 'HEAD', f'refs/heads/{which_branch}'])

    # and explicitly add an empty commit to the specified branch
    # so that the repository is not empty
    add_empty_commit(folder,which_branch)

    print(f'Created new repo {folder}')
// create_new_repo [python]
def create_new_repo(folder, which_branch):

    # create the folder & initialize an empty bare repo
    os.makedirs(folder, mode=0o770)
    os.chdir(folder)
    # note: --initial-branch option requires git 2.28.0 or greater
    os.system(f'git init --bare --shared --initial-branch={which_branch}')

    # unfortuantely, when an empty repo with no branches is cloned,
    # the active branch and HEAD does NOT default to the specified branch

    # so let's manually specify the initial branch
    os.system(f'git symbolic-ref HEAD refs/heads/{which_branch}')

    # and explicitly add an empty commit to the specified branch
    # so that the repository is not empty
    add_empty_commit(folder,which_branch)

    print(f'Created new repo {folder}')
// copyFile [python]
def copyFile(srcFile, destFile):
    if isPosix():
        subprocess.call(['cp', srcFile, destFile])
    else:
        ek.ek(shutil.copyfile, srcFile, destFile)
        
    try:
        ek.ek(shutil.copymode, srcFile, destFile)
    except OSError:
        pass
// copyFile [python]
def copyFile(srcFile, destFile):
    if isPosix():
        os.system('cp "%s" "%s"' % (srcFile, destFile))
    else:
        ek.ek(shutil.copyfile, srcFile, destFile)
        
    try:
        ek.ek(shutil.copymode, srcFile, destFile)
    except OSError:
        pass
// read_config [python]
    def read_config(self):
        """Populate the instance with settings for the config file.

        If we can't find any section for the given site, error gracefully.

        """
        defaults = {
            "auth_type": "basic",
            "verify_ssl_cert": "true",
        }

        cp = configparser.RawConfigParser(defaults)
        cp.read(CONFIG_LOCATIONS)

        if not cp.has_option(self.site, "base_url"):
            raise exceptions.ConfigError("unable to find a [{}] section with "
                                         "a base_url.".format(self.site))

        self.base_url = cp.get(self.site, "base_url").rstrip("/")
        self.username = cp.get(self.site, "username")
        self.password = cp.get(self.site, "password")
        self.verify_ssl_cert = cp.getboolean(self.site, "verify_ssl_cert")

        # load auth
        auth_type = cp.get(self.site, "auth_type")
        auth_type = auth_type.lower()
        if auth_type not in AUTH_TYPES:
            supported_auths = ", ".join(sorted(AUTH_TYPES.keys()))
            msg = ("invalid auth setting '{}', supported: {}"
                  .format(auth_type, supported_auths))
            raise exceptions.ConfigError(msg)
        self.auth_type = auth_type

        if cp.has_option(self.site, "editor"):
            self.config_editor = cp.get(self.site, "editor")
        else:
            self.config_editor = os.getenv("EDITOR")

        self.required_fields = ["To", "Component", "Subject", "Priority"]
// read_config [python]
    def read_config(self):
        """Populate the instance with settings for the config file.

        If we can't find any section for the given site, error gracefully.

        """
        defaults = {
            "auth_type": "basic",
            "verify_ssl_cert": "true",
        }

        cp = configparser.RawConfigParser(defaults)
        cp.read(CONFIG_LOCATIONS)

        if not cp.has_option(self.site, "base_url"):
            raise exceptions.ConfigError("unable to find a [{}] section with "
                                         "a base_url.".format(self.site))

        self.base_url = cp.get(self.site, "base_url").rstrip("/")
        self.username = cp.get(self.site, "username")
        self.password = cp.get(self.site, "password")
        self.verify_ssl_cert = cp.getboolean(self.site, "verify_ssl_cert")

        # load auth
        auth_type = cp.get(self.site, "auth_type")
        auth_type = auth_type.lower()
        if auth_type not in AUTH_TYPES:
            supported_auths = ", ".join(sorted(AUTH_TYPES.keys()))
            msg = ("invalid auth setting '{}', supported: {}"
                  .format(auth_type, supported_auths))
            raise exceptions.ConfigError(msg)
        self.auth_type = auth_type

        self.required_fields = ["To", "Component", "Subject", "Priority"]
// add_empty_commit [python]
def add_empty_commit(folder,which_branch):

    assert (os.path.isdir(folder))
    os.chdir(folder)

    # check to see if there are any branches in the repo with commits
    result = subprocess.run(['git', 'branch', '-v'], stdout=subprocess.PIPE)
    s = result.stdout.decode('utf-8')
    if s != "":
        # do nothing if there is at least one branch with a commit
        print('NOTE: this repo is non-empty (has a commit on at least one branch)')
        return

    # otherwise clone to a non-bare repo and add an empty commit
    # to the specified branch
    with tempfile.TemporaryDirectory() as tmpdirname:
        subprocess.run(['git', 'clone', folder, tmpdirname])
        os.chdir(tmpdirname)
        subprocess.run(['git', 'checkout', '-b', which_branch])
        subprocess.run(['git',
            '-c', 'user.name=submitty',
            '-c', 'user.email=submitty@example.com',
            'commit', '--allow-empty',
            '-m', 'initial empty commit',
            '--author=submitty <submitty@example.com>'])
        subprocess.run(['git', 'push', 'origin', which_branch])

    print(f'Made new empty commit on branch {which_branch} in repo {folder}')
// add_empty_commit [python]
def add_empty_commit(folder,which_branch):

    assert (os.path.isdir(folder))
    os.chdir(folder)

    # check to see if there are any branches in the repo with commits
    result = subprocess.run(['git', 'branch', '-v'], stdout=subprocess.PIPE)
    s = result.stdout.decode('utf-8')
    if s != "":
        # do nothing if there is at least one branch with a commit
        print('NOTE: this repo is non-empty (has a commit on at least one branch)')
        return

    # otherwise clone to a non-bare repo and add an empty commit
    # to the specified branch
    with tempfile.TemporaryDirectory() as tmpdirname:
        os.system(f'git clone {folder} {tmpdirname}')
        os.chdir(tmpdirname)
        os.system(f'git checkout -b {which_branch}')
        os.system("git " +
                  "-c user.name=submitty -c user.email=submitty@example.com commit " +
                  "--allow-empty -m 'initial empty commit' " +
                  "--author='submitty <submitty@example.com>'")
        os.system(f'git push origin {which_branch}')

    print(f'Made new empty commit on branch {which_branch} in repo {folder}')