Ex: node customsearch.js "Google Node.js" "API KEY" "CUSTOM ENGINE ID"
341047
async function runSample(options) {
  console.log(options);
  const res = await customsearch.cse.list({
    cx: options.cx,
    q: options.q,
    auth: options.apiKey,
  });
  console.log(res.data);
  return res.data;
}
918359
def get_data(search_string, search_by='ip'):
    
    r_details = requests.get('https://talosintelligence.com/sb_api/query_lookup',
            headers={
                'Referer':'https://talosintelligence.com/reputation_center/lookup?search=%s'%search_string,
                'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0'
                },
            params = {
                'query':'/api/v2/details/ip/',
                'query_entry':search_string
                }).json()

    r_wscore = requests.get('https://talosintelligence.com/sb_api/remote_lookup',
            headers={
                'Referer':'https://talosintelligence.com/reputation_center/lookup?search=%s'%search_string,
                'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0'
                },
            params = {'hostname':'SDS', 'query_string':'/score/wbrs/json?url=%s' % search_string}).json()

    r_talos_blacklist = requests.get('https://www.talosintelligence.com/sb_api/blacklist_lookup',
            headers={
                'Referer':'https://talosintelligence.com/reputation_center/lookup?search=%s'%search_string,
                'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0'
                },
            params = {'query_type':'ipaddr', 'query_entry':search_string}).json()

    # would be nice to plot this values
    #r_volume = requests.get('https://talosintelligence.com/sb_api/query_lookup',
    #        params = {
    #            'query':'/api/v2/volume/ip/',
    #            'query_entry':search_string
    #            }).json()

    # No used for now
    #r_related_ips = requests.get('https://talosintelligence.com/sb_api/query_lookup',
    #        params = {
    #            'query':'/api/v2/related_ips/ip/',
    #            'query_entry':search_string
    #            }).json()

    
    talos_blacklisted = {'status':False}
    if 'classifications' in r_talos_blacklist['entry']:
        talos_blacklisted['status'] = True
        talos_blacklisted['classifications'] = ", ".join(r_talos_blacklist['entry']['classifications'])
        talos_blacklisted['first_seen'] = r_talos_blacklist['entry']['first_seen'] + "UTC"
        talos_blacklisted['expiration'] = r_talos_blacklist['entry']['expiration'] + "UTC"

    data = {
        'address':search_string,
        'hostname':r_details['hostname'] if 'hostname' in r_details else "nodata",
        'volume_change':r_details['daychange'] if 'daychange' in r_details else "nodata",
        'lastday_volume':r_details['daily_mag'] if 'daily_mag' in r_details else "nodata",
        'month_volume':r_details['monthly_mag'] if 'monthly_mag' in r_details else "nodata",
        'email_reputation':r_details['email_score_name'] if 'email_score_name' in r_details else "nodata",
        'web_reputation':r_details['web_score_name'] if 'web_score_name' in r_details else "nodata",
        'weighted_reputation_score':r_wscore['response'],
        'talos_blacklisted':"Yes" if talos_blacklisted['status'] else "No"
        #'weighted_reputation_score':r_wscore[0]['response']['wbrs']['score'],
        #'volumes':zip(*r_volume['data'])
    }

    return data
380420
async function getMetadata(auth, identifier) {
    // Try to get info assuming identifier is an id
    const metadata = await new Promise((resolve, reject) => {
        const script = google.script('v1');
        script.projects.get({
            auth,
            scriptId: identifier,
        }, (err, result) => {
            if (err) {
                resolve(false);
            } else {
                resolve(result.data);
            }
            return;
        });
    });

    if (metadata) {
        return {
            projectId: metadata.scriptId,
            name: metadata.title,
            createTime: metadata.createTime,
            updateTime: metadata.updateTime,
            creator: {
                name: metadata.creator.name,
                email: metadata.creator.email,
            },
        };
    }

    // Identifier did not match an id
    const files = await getScripts(auth, identifier, null, []);
    if (files.length === 0) { // 0 results
        throw {
            message: `No remote project with name or id '${identifier}' found ${checkbox.get('red')}\n` +
                `Use 'gas get projects' to show all your remote Google Apps Script projects`,
            print: true,
        };
    } else if (files.length === 1) { // 1 result
        const result = files[0];
        if (result.name === identifier) {
            result.name = sanitize(result.name);
            return {
                projectId: result.id,
                name: result.name,
                createTime: result.createdTime,
                updateTime: result.modifiedTime,
                creator: {
                    name: '',
                    email: '',
                },
            };
        } else {
            // Check for exact match if exists
            throw {
                message: `No exact match with name or id '${identifier}' found ${checkbox.get('red')}\n` +
                    `Did you perhaps mean: '${result.name}'?`,
                print: true,
            };
        }
    } else { // More than 1 result
        const exactMatches = [];
        for (const match of files) {
            if (match.name === identifier) {
                exactMatches.push(match);
            }
        }
        if (exactMatches.length === 0) { // 0 results
            let message = `No project called '${identifier}' found ${checkbox.get('red')}\n`;
            message += 'Did you mean one of these projects? :\n';
            for (const file2 of files) {
                message += `[${file2.id}] ${file2.name}\n`;
            }
            const err = {
                message,
                print: true,
            };
        } else if (exactMatches.length === 1) { // 1 result
            exactMatches[0].name = sanitize(exactMatches[0].name);
            return {
                projectId: exactMatches[0].id,
                name: exactMatches[0].name,
                createTime: exactMatches[0].createdTime,
                updateTime: exactMatches[0].lastModifiedAt,
                creator: {
                    name: '',
                    email: '',
                },
            };
        } else {
            let message = `Multiple projects called '${identifier}' found ${checkbox.get('red')}\n`;
            message += `Use 'gas rename <projectId> <newProjectName>' to rename script so they have a unique name or use the projectId as identifier\n\n`;
            for (const exactMatch of exactMatches) {
                message += `[${exactMatch.id}] ${exactMatch.name}\n`;
            }
            throw {
                message,
                print: true,
            };
        }
    }
}
45396
function() {
      var os
      var clientStrings = [
        {
          s:'Windows',
          r:/(Windows)/,
        }, {
          s:'Android',
          r:/Android/,
        }, {
          s:'Open BSD',
          r:/OpenBSD/,
        }, {
          s:'Linux',
          r:/(Linux|X11)/,
        }, {
          s:'iOS',
          r:/(iPhone|iPad|iPod)/,
        }, {
          s:'Mac',
          r:/Mac/,
        }, {
          s:'UNIX',
          r:/UNIX/,
        }, {
          s:'Robot',
          r:/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver)/,
        },
      ]

      for (var i = 0; i < clientStrings.length; i++) {
        var cs = clientStrings[i]
        if (cs.r.test(navigator.userAgent)) {
          return cs.s
        }
      }
    }
51937
def inject_request_ids_into_environment(func):
    """"""

    @wraps(func)
    def wrapper(event, context):
        # This might not always be an API Gateway event, so only log the
        # request ID, if it looks like to be coming from there.
        if 'requestContext' in event:
            os.environ[ENV_APIG_REQUEST_ID] = event['requestContext'].get(
                'requestId', 'N/A')
        os.environ[ENV_LAMBDA_REQUEST_ID] = context.aws_request_id
        return func(event, context)

    return wrapper
1361468
def _get_splunk_search_props(search):
    '''
    
    '''
    props = search.content
    props["app"] = search.access.app
    props["sharing"] = search.access.sharing
    return props
20279
function GulpDotaNpc (type) {
  var file = 'npc_' + type + '_custom.txt';
  var headerName = 'DOTA' + type[0].toUpperCase() + type.substr(1);

  function transformFiles (contents, file) {
    // get the string contents of the file so we can easily update it
    var strContent = String(contents);
    var splitPath = file.relative.split(path.sep);
    var needsRename = splitPath.length > 1;
    var abilityName = stripDotTxt(splitPath.join('_'));

    if (needsRename) {
      strContent = strContent.replace('"' + stripDotTxt(splitPath[1]) + '"', '"' + abilityName + '"');
    }
    console.log('Adding', type, abilityName);
    return strContent;
  }

  function addHeader (contents, file) {
    return [
    '"', headerName, '"\n{\n',
    contents,
    '\n\n}'
    ].join('');
  }

  return multipipe(transform(transformFiles), concat(file), transform(addHeader));
}
756944
def generate_code(meta, prefix=None, node=False, min=False):
    
    if isinstance(meta, dict):
        url_prefix, auth_header, resources = parse_meta(meta)
    else:
        url_prefix, auth_header, resources = meta
    if prefix is not None:
        url_prefix = prefix
    core = render_core(url_prefix, auth_header, resources)
    if min:
        filename = 'res.web.min.js'
    else:
        filename = 'res.web.js'
    if node:
        filename = 'res.node.js'
    base = read_file(filename)
    return base.replace('"#res.core.js#"', core)
288413
def check_api_key(request, key, hproPk):
    """"""

    if settings.PIAPI_STANDALONE:
        return True

    (_, _, hproject) = getPlugItObject(hproPk)

    if not hproject:
        return False

    if hproject.plugItApiKey is None or hproject.plugItApiKey == '':
        return False

    return hproject.plugItApiKey == key
369012
function (cwd, filename, options, customizeEngine) {
    var helpers = customizeEngine.engine.helpers

    var code = helpers.example(path.join(cwd, filename), {
      hash: {
        snippet: true
      }
    })
    var result = helpers.exec(`node ${filename}`, {
      hash: {
        cwd: cwd,
        lang: 'raw'
      }
    })

    return Q.all([code,result]).spread(function(code, result) {
      console.log(result)
      var output = result.split('\u0001')
      return code.replace(/console\.log\-output/g, function() {
        return output.shift().trim();
      })
    })

  }
1207286
def templateParametersStringAsRestList(self, nodeByRefid):
        '''
        
        '''
        if not self.template_params:
            return None
        else:
            param_stream = StringIO()
            for param_t, decl_n, def_n in self.template_params:
                refid, typeid = param_t
                # Say you wanted a custom link text 'custom', and somewhere
                # else you had an internal link '.. _some_link:'.  Then you do
                #     `custom <some_link_>`_
                # LOL. RST is confusing
                if refid:
                    # Easy case: the refid is something Exhale is explicitly documenting
                    if refid in nodeByRefid:
                        link = "{0}_".format(nodeByRefid[refid].link_name)
                    else:
                        # It's going to get generated by Breathe down the line, we need
                        # to reference the page the directive will appear on.
                        parent_refid = ""
                        for key in nodeByRefid:
                            if len(key) > len(parent_refid) and key in refid:
                                parent_refid = key
                        parent = nodeByRefid[parent_refid]
                        parent_page = os.path.basename(parent.file_name.replace(".rst", ".html"))
                        link = "{page}#{refid}".format(page=parent_page, refid=refid)
                    param_stream.write(
                        "#. `{typeid} <{link}>`_".format(
                            typeid=typeid,
                            # Not necessarily an ExhaleNode link, should be a link by
                            # the time Breathe is finished?
                            link=link
                        )
                    )
                    close_please = False
                else:
                    param_stream.write("#. ``{typeid}".format(typeid=typeid))
                    close_please = True

                # The type is in there, but when parsed it may have given something like
                # `class X` for the typeid (meaning nothing else to write).  For others,
                # the decl_n is the declared name of the template parameter.  E.g. it
                # was parsed as `typeid <- class` and `decl_n <- X`.
                if decl_n:
                    param_stream.write(" ")
                    if not close_please:
                        param_stream.write("``")
                    param_stream.write("{decl_n}".format(decl_n=decl_n))
                    close_please = True

                # When templates provide a default value, `def_n` is it.  When parsed,
                # if the `decl_n` and `def_n` are the same, `def_n` is explicitly set
                # to be None.
                if def_n:
                    param_stream.write(" ")
                    if not close_please:
                        param_stream.write("``")
                    param_stream.write("= {def_n}``".format(def_n=def_n))
                    close_please = True

                if close_please:
                    param_stream.write("``")

                param_stream.write("\n")

            param_stream.write("\n")
            param_value = param_stream.getvalue()
            param_stream.close()
            return param_value
1063769
def _get_api_params(api_url=None,
                    api_version=None,
                    api_key=None):
    '''
    
    '''
    mandrill_cfg = __salt__['config.merge']('mandrill')
    if not mandrill_cfg:
        mandrill_cfg = {}
    return {
        'api_url': api_url or mandrill_cfg.get('api_url') or BASE_URL,  # optional
        'api_key': api_key or mandrill_cfg.get('key'),  # mandatory
        'api_version': api_version or mandrill_cfg.get('api_version') or DEFAULT_VERSION
    }
44074
function(type) {

	var items = _.filter(process.env, function(value, key) {

		var pattern = new RegExp('CORS\_ALLOWED\_' + type.toUpperCase(), 'i')

		return key.match(pattern);

	});

	return items.join(', ') || '*';

}
927168
def fetch(self, name, engine_name=None):
        
        # TODO: Get each on-demand field in a multicall for all other items, since
        # we likely need it anyway; another (more easy) way would be to pre-fetch dynamically
        # with the list of fields from filters and output formats
        try:
            return self._fields[name]
        except KeyError:
            if isinstance(name, (int, long)):
                name = "custom_%d" % name

            if name == "done":
                val = float(self.fetch("completed_chunks")) / self.fetch("size_chunks")
            elif name == "files":
                val = self._get_files()
            elif name.startswith("kind_") and name[5:].isdigit():
                val = self._get_kind(int(name[5:], 10))
            elif name.startswith("custom_"):
                key = name[7:]
                try:
                    if len(key) == 1 and key in "12345":
                        val = getattr(self._engine._rpc.d, "custom"+key)(self._fields["hash"])
                    else:
                        val = self._engine._rpc.d.custom(self._fields["hash"], key)
                except xmlrpc.ERRORS as exc:
                    raise error.EngineError("While accessing field %r: %s" % (name, exc))
            else:
                getter_name = engine_name if engine_name else RtorrentEngine.PYRO2RT_MAPPING.get(name, name)
                if getter_name[0] == '=':
                    getter_name = getter_name[1:]
                else:
                    getter_name = "get_" + getter_name
                getter = getattr(self._engine._rpc.d, getter_name)

                try:
                    val = getter(self._fields["hash"])
                except xmlrpc.ERRORS as exc:
                    raise error.EngineError("While accessing field %r: %s" % (name, exc))

            # TODO: Currently, NOT caching makes no sense; in a demon, it does!
            #if isinstance(FieldDefinition.FIELDS.get(name), engine.ConstantField):
            self._fields[name] = val

            return val
1214860
def api_key(value=None):
        """"""

        if value is None:
            return PyGraphistry._config['api_key']

        # setter
        if value is not PyGraphistry._config['api_key']:
            PyGraphistry._config['api_key'] = value.strip()
            PyGraphistry._is_authenticated = False
456092
function getParams(spec_c, details, method, parent) {
  var spec_js = {};
  _.each(spec_c, function(param) {
    try {
      var paramType = getType(getText(getChild(param, 'type'), 'type'), parent);
      var paramName = getText(getChild(param, 'declname'), 'name');
      spec_js[paramName] = { type: paramType };
    } catch(e) {
      if (paramType == '...') {
        spec_js['arguments'] = { type: paramType };
      } else {
        throw e;
      }
    }
  });
  _.each(details, function(param) {
    var getParamName = function(p) { return getText(getChild(getChild(p, 'parameternamelist'), 'parametername'), 'name'); }
    var paramName = getParamName(param);
    var paramDescription = getText(getChild(param, 'parameterdescription'), 'description');
    if (_.has(spec_js, paramName)) {
      spec_js[paramName].description = paramDescription;
    } else {
      var msg = ' has documentation for an unknown parameter: ' + paramName + '. ';
      var suggestions = _.difference(_.keys(spec_js), _.map(details, getParamName));
      var msgAddendum = (!_.isEmpty(suggestions) ? ('Did you mean ' + suggestions.join(', or ') + '?') : '');
      console.log('Warning: ' + (parent ? (parent + '.') : '') + method + msg + msgAddendum);
    }
  });
  return spec_js;
}
497689
function Parser (customKeywordSpec) {
    var keywordSpec = customKeywordSpec || {
        _: [0],
        gettext: [0],
        ngettext: [0, 1]
    };
    var openings = ['<%', '{\\*', '{{'];
    var closures = ['%>', '\\*}', '}}'];

    if (typeof keywordSpec !== 'object') {
        throw 'Invalid keyword spec';
    }

    this.keywordSpec = keywordSpec;
    this.expressionPattern = new RegExp([
        '(?:' + openings.join('[=-]|') + '[=-]) *',
        '(' + Object.keys(keywordSpec).map(escapeRegExp).join('|') + ')',
        '\\(',
        '([\\s\\S]*?)',
        '\\)',
        ' *(?:' + closures.join('|') + ')'
    ].join(''), 'g');
}