Presents the user with a list of scripts contained in @op_scripts
 and Returns an integer indicating the selection
173137
def list_and_select_op_script
      puts "List of available operational scripts:"
      puts "------------------------------------------------------------"
      for i in 0..@op_scripts.length - 1
        puts "  %3d. #{@op_scripts[i][0]}" % i
      end
      puts "------------------------------------------------------------"
      while true
        printf "Type the number of the script to run and press Enter (Ctrl-C to quit): "
        script_id = Integer(gets.chomp) rescue -1
        if script_id >= 0 && script_id < @op_scripts.length
          puts "Script choice: #{script_id}. #{@op_scripts[ script_id ][0]}"
          break
        else
          puts "#{script_id < 0 ? 'Invalid input' : 'Input out of range'}."
        end
      end

      return script_id
    end
857983
public function script()
    {
        echo $this->view->make('Assely::script', [
            'slug' => $this->metabox->getModel()->getSlug(),
            'fingerprint' => $this->metabox->getModel()->getFingerprint(),
            'fields' => json_encode($this->metabox->getFields()->all()),
        ]);
    }
1251377
def opcode_list(self, script):
        """"""
        opcodes = []
        new_pc = 0
        try:
            for opcode, data, pc, new_pc in self.get_opcodes(script):
                opcodes.append(self.disassemble_for_opcode_data(opcode, data))
        except ScriptError:
            opcodes.append(binascii.hexlify(script[new_pc:]).decode("utf8"))

        return opcodes
8488
function loadScripts(scripts, loadedCallback) {
    var srcs = [], property, count, i, src,
        countDown = function () {
          count -= 1;
          if (!count) {
            loadedCallback();
          }
        };

    for (property in scripts) {
      if (!(property in window)) {
        srcs.push(scripts[property]);
      }
    }

    count = srcs.length;
    if (!count) {
      loadedCallback();
    }

    for (i = 0; i < srcs.length; i += 1) {
      src = srcs[i];
      loadScript(src, countDown);
    }
  }
903348
function scripts(action) {
  var fullpath = path.resolve(__dirname, '..', 'sql', action);
  return fs.readdirSync(fullpath)
    .filter(function(file) {
      return path.extname(file) === '.sql';
    })
    .map(function(file) {
      return [fs.readFileSync(path.join(fullpath, file)).toString(), file];
    });
}
1093433
def extract_script_nodes(list)
      list.select { |item| item.is_a?(::Sass::Script::Tree::Node) }
    end
323628
def script(self):
        """"""
        # The script object is cached, since constructing it may involve
        # a number of string-manipulation operations.
        if getattr(self, '_script', None) is None:
            self._script = self._script__getter()
        return self._script
844261
def extract_upgrade_scripts(self):
        
        link_pattern = '>\s*{0}\s*<'.format(self.pattern[1:-1])
        page = urllib.request.urlopen(self.upgrades_url).read()
        for mo in re.finditer(link_pattern, page):
            scriptname = mo.group(0)[1:-1].strip()
            yield self.parse_script_name(scriptname)
452444
def clean_up(scripts):
    
    scripts_with_pos = [s for s in scripts if s.pos]
    scripts_with_pos.sort(key=lambda s: (s.pos[1], s.pos[0]))
    scripts = scripts_with_pos + [s for s in scripts if not s.pos]

    y = 20
    for script in scripts:
        script.pos = (20, y)
        if isinstance(script, kurt.Script):
            y += stack_height(script.blocks)
        elif isinstance(script, kurt.Comment):
            y += 14
        y += 15
1183875
def show
      @script_versions = Script::Version.friendly.find(params[:id])
      @versions = Phcscriptcdn::ScriptversionVersions.where(item_id: params[:id], item_type: 'Phcscriptcdn::Script::Version')
    end
1281036
def script(klass, args, interval):
        
        if isinstance(args, six.string_types) \
                or isinstance(args, six.binary_type):
            warnings.warn(
                "Check.script should take a list of args", DeprecationWarning)
            args = ["sh", "-c", args]
        return {'args': args, 'interval': interval}
426151
protected function load_script($script_name = null)
    {
        if ($this->script_name !== null) {
            return 0;
        }

        $list     = $this->list_scripts();
        $master   = $this->rc->config->get('managesieve_kolab_master');
        $included = array();

        $this->script_name = false;

        // first try the active script(s)...
        if (!empty($this->active)) {
            // Note: there can be more than one active script on KEP:14-enabled server
            foreach ($this->active as $script) {
                if ($this->sieve->load($script)) {
                    foreach ($this->sieve->script->as_array() as $rule) {
                        if (!empty($rule['actions'])) {
                            if ($rule['actions'][0]['type'] == 'vacation') {
                                $this->script_name = $script;
                                return 0;
                            }
                            else if (empty($master) && $rule['actions'][0]['type'] == 'include') {
                                $included[] = $rule['actions'][0]['target'];
                            }
                        }
                    }
                }
            }

            // ...else try scripts included in active script (not for KEP:14)
            foreach ($included as $script) {
                if ($this->sieve->load($script)) {
                    foreach ($this->sieve->script->as_array() as $rule) {
                        if (!empty($rule['actions']) && $rule['actions'][0]['type'] == 'vacation') {
                            $this->script_name = $script;
                            return 0;
                        }
                    }
                }
            }
        }

        // try all other scripts
        if (!empty($list)) {
            // else try included scripts
            foreach (array_diff($list, $included, $this->active) as $script) {
                if ($this->sieve->load($script)) {
                    foreach ($this->sieve->script->as_array() as $rule) {
                        if (!empty($rule['actions']) && $rule['actions'][0]['type'] == 'vacation') {
                            $this->script_name = $script;
                            return 0;
                        }
                    }
                }
            }

            // none of the scripts contains existing vacation rule
            // use any (first) active or just existing script (in that order)
            if (!empty($this->active)) {
                $this->sieve->load($this->script_name = $this->active[0]);
            }
            else {
                $this->sieve->load($this->script_name = $list[0]);
            }
        }

        return $this->sieve->error();
    }
1224715
protected function listScripts($scripts)
    {
        if (!$scripts) {
            $this->out()->out('No custom scripts.');

            return;
        }

        $this->out()->out('<comment>Available Scripts</comment>')
            ->out('-----------------------------');

        foreach ($scripts as $name => $script) {
            $this->out(sprintf('<info>%s</info>', $name));

            foreach ($script as $cmd) {
                if (!is_array($cmd)) {
                    $cmd = ['cmd' => $cmd, 'in' => null];
                }

                $input = Arr::get($cmd, 'in');
                $cmd   = Arr::get($cmd, 'cmd');

                $this->out('    <comment>$</comment> ' . $cmd, false);

                if ($input !== null) {
                    $this->out(sprintf('  <option>(Input: %s)</option>', preg_replace('/\s+/', ' ', $input)), false);
                }

                $this->out();
            }

            $this->out();
        }
    }
1058696
protected function init_script()
    {
        if (!$this->sieve->script) {
            return;
        }

        $this->script = $this->sieve->script->as_array();

        $headers    = array();
        $exceptions = array('date', 'currentdate', 'size', 'body');

        // find common headers used in script, will be added to the list
        // of available (predefined) headers (#1489271)
        foreach ($this->script as $rule) {
            foreach ((array) $rule['tests'] as $test) {
                if ($test['test'] == 'header') {
                    foreach ((array) $test['arg1'] as $header) {
                        $lc_header = strtolower($header);

                        // skip special names to not confuse UI
                        if (in_array($lc_header, $exceptions)) {
                            continue;
                        }

                        if (!isset($this->headers[$lc_header]) && !isset($headers[$lc_header])) {
                            $headers[$lc_header] = $header;
                        }
                    }
                }
            }
        }

        ksort($headers);

        $this->headers += $headers;
    }
1333205
def do_OP_WITHIN(vm):
    
    v3, v2, v1 = [vm.pop_int() for i in range(3)]
    ok = (v2 <= v1 < v3)
    vm.append(vm.bool_to_script_bytes(ok))
1369710
def getScriptNames(self):
		""""""

		if self._db == '':
			raise FMError, 'No database was selected'

		request = []
		request.append(uu({'-db': self._db }))
		request.append(uu({'-scriptnames': '' }))

		result = self._doRequest(request)
		result = FMResultset.FMResultset(result)

		scriptNames = []
		for scriptName in result.resultset:
			scriptNames.append(string.lower(scriptName['SCRIPT_NAME']))

		return scriptNames
235069
private static String prepareScripts(String initScriptPath, String itemTableSuffix, String valueTableSuffix,
      String refTableSuffix, boolean isolatedDB) throws IOException
   {
      String scripts = IOUtil.getStreamContentAsString(PrivilegedFileHelper.getResourceAsStream(initScriptPath));

      if (isolatedDB)
      {
         scripts =
            scripts.replace("MITEM", itemTableSuffix).replace("MVALUE", valueTableSuffix)
               .replace("MREF", refTableSuffix);
      }

      return scripts;
   }