Grab the scripts we plan to excersize
198322
def lookup_scripts
      scripts = [
                 [ 'connect', 'ELB connect' ],
                 [ 'disconnect', 'ELB disconnect' ]
               ]
#      @scripts_to_run = {}
      server = @servers.first
      server.settings 
      st = ServerTemplate.find(server.server_template_href)
      lookup_scripts_table(st,scripts)
#      @scripts_to_run['connect'] = st.executables.detect { |ex| ex.name =~  /ELB connect/i }
#      @scripts_to_run['disconnect'] = st.executables.detect { |ex| ex.name =~  /ELB disconnect/i }
    end
408172
def listscripts(self):
        
        code, data, listing = self.__send_command(
            "LISTSCRIPTS", withcontent=True)
        if code == "NO":
            return None
        ret = []
        active_script = None
        for l in listing.splitlines():
            if self.__size_expr.match(l):
                continue
            m = re.match(br'"([^"]+)"\s*(.+)', l)
            if m is None:
                ret += [l.strip(b'"').decode("utf-8")]
                continue
            script = m.group(1).decode("utf-8")
            if self.__active_expr.match(m.group(2)):
                active_script = script
                continue
            ret += [script]
        self.__dprint(ret)
        return (active_script, ret)
676129
def example(script, explain, contents, requirements, output, outputfmt, details):
    """"""
    blank()
    cprint(script.upper(), "yellow")
    cprint(''.join(["=" for i in range(70)]) + '\n', "yellow")

    cprint("DETAILS", "blue")
    std(explain + '\n')

    cprint(requirements, "red")
    cprint(output, "green")
    blank()

    if details != "":
        std(details)
        blank()

    cprint("OUTPUT FORMAT", "blue")
    std(outputfmt)
    blank()

    cprint("EXAMPLES", "blue")
    for i in range(len(contents)):
        pre, code, post = contents[i]
        std("{}) {}".format(i + 1, pre))
        cprint("    " + code, "cyan")
        if post != "":
            std('\n' + post)
        blank()
1142665
def run_script(self, requires, script_name):
        """"""
        ns = sys._getframe(1).f_globals
        name = ns['__name__']
        ns.clear()
        ns['__name__'] = name
        self.require(requires)[0].run_script(script_name, ns)
1009493
function queryTargetScripts(targetDir) {
        var scripts = [];
        fs.readdirSync(targetDir).forEach(function (file) {
            if (!path.basename(file).toLowerCase().match(/.d.ts/g) && path.basename(file).toLowerCase().match(/\.ts$/i)) {
                scripts.push(path.basename(file, path.extname(file)));
            }
        });
        return scripts;
    }
314970
def get_scripts():
    """"""
    proc = Popen(['npm', 'run-script'], stdout=PIPE)
    should_yeild = False
    for line in proc.stdout.readlines():
        line = line.decode()
        if 'available via `npm run-script`:' in line:
            should_yeild = True
            continue

        if should_yeild and re.match(r'^  [^ ]+', line):
            yield line.strip().split(' ')[0]
291977
def __scripts(self, filestem):
        
        script_construct = open('%s/%s' % (self.tmpdir, RSD.CONSTRUCT), 'w')
        script_save = open('%s/%s' % (self.tmpdir, RSD.SAVE), 'w')
        script_subgroups = open('%s/%s' % (self.tmpdir, RSD.SUBGROUPS), 'w')

        # Permit the owner to execute and read this script
        for fn in RSD.SCRIPTS:
            os.chmod('%s/%s' % (self.tmpdir, fn), S_IREAD | S_IEXEC)

        # Writes one line of script
        new_script = lambda script: lambda x: script.write(x + '\n')

        #
        # 'Construction' script
        #
        w = new_script(script_construct)
        w(':- initialization(main).')
        w('main :-')
        w('[featurize],')
        w('r(%s),' % filestem)
        w('w.')
        script_construct.close()

        #
        # 'Saving' script
        #
        w = new_script(script_save)
        w(':- initialization(main).')
        w('main :-')
        w('[process],')
        w('r(%s),' % filestem)
        w('w,')
        w('w(weka, %s),' % filestem)
        w('w(rsd, %s).' % filestem)
        script_save.close()

        #
        # 'Subgroups' script
        #
        w = new_script(script_subgroups)
        w(':- initialization(main).')
        w('main :-')
        w('[rules],')
        w('r(%s),' % filestem)
        w('i,')
        w('w.')
        script_subgroups.close()
1339826
def run_script(script)

      if script.data.bytesize > @max_script_size
        return set_error(SCRIPT_ERR_SCRIPT_SIZE)
      end

      # Altstack is not shared between individual runs, but we still store it in ivar to make available to the extensions.
      @altstack = []
      @run_script_chunks = script.chunks.to_a.dup # can be modified by `insert_script`
      
      number_zero  = BTC::ScriptNumber.new(integer: 0)
      number_one   = BTC::ScriptNumber.new(integer: 1)
      zero_value = "".b
      false_value = "".b
      true_value = "\x01".b

      opcount = 0
      require_minimal = flag?(SCRIPT_VERIFY_MINIMALDATA)
      condition_flags = []
      index_after_codeseparator = 0
      chunk_index = -1 # start with -1 because we increment it in the beginning of the loop.
      
      while chunk = @run_script_chunks.shift
        chunk_index += 1
        
        opcode = chunk.opcode
        should_execute = !condition_flags.include?(false)

        if chunk.pushdata? && chunk.pushdata.bytesize > @max_pushdata_size
          return set_error(SCRIPT_ERR_PUSH_SIZE)
        end

        # Note how OP_RESERVED does not count towards the opcode limit.
        if opcode > OP_16
          if (opcount += 1) > @max_op_count
            return set_error(SCRIPT_ERR_OP_COUNT)
          end
        end
        
        # Check if there is a extension for this opcode before we check for disabled opcodes.
        opcode_extension = extension_to_handle_opcode(opcode)
        
        if !opcode_extension
          if opcode == OP_CAT ||
             opcode == OP_SUBSTR ||
             opcode == OP_LEFT ||
             opcode == OP_RIGHT ||
             opcode == OP_INVERT ||
             opcode == OP_AND ||
             opcode == OP_OR ||
             opcode == OP_XOR ||
             opcode == OP_2MUL ||
             opcode == OP_2DIV ||
             opcode == OP_MUL ||
             opcode == OP_DIV ||
             opcode == OP_MOD ||
             opcode == OP_LSHIFT ||
             opcode == OP_RSHIFT

            return set_error(SCRIPT_ERR_DISABLED_OPCODE)
          end
        end

        if should_execute && 0 <= opcode && opcode <= OP_PUSHDATA4
          # Pushdata (including OP_0).
          if require_minimal && !check_minimal_push(chunk.pushdata, opcode)
            return set_error(SCRIPT_ERR_MINIMALDATA)
          end
          stack_push(chunk.pushdata)

        elsif should_execute && opcode_extension
          
          if !opcode_extension.handle_opcode(interpreter: self, opcode: opcode)
            # error is set already
            return false
          end

        elsif should_execute || (OP_IF <= opcode && opcode <= OP_ENDIF)

          case opcode
          when OP_1NEGATE, OP_1..OP_16
            # ( -- value)
            num = BTC::ScriptNumber.new(integer: opcode - (OP_1 - 1))
            stack_push(num.data)
            # The result of these opcodes should always be the minimal way to push the data
            # they push, so no need for a CheckMinimalPush here.


          # Control Operators
          # -----------------

          when OP_NOP
            # nothing
            
          # See CLTVExtension
          # when OP_CHECKLOCKTIMEVERIFY
          #   begin
          #     if !flag?(SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY)
          #       # not enabled; treat as a NOP2
          #       if flag?(SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)
          #         return set_error(SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS)
          #       end
          #       break # breaks out of begin ... end while false
          #     end
          # 
          #     if @stack.size < 1
          #       return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
          #     end
          # 
          #     # Note that elsewhere numeric opcodes are limited to
          #     # operands in the range -2**31+1 to 2**31-1, however it is
          #     # legal for opcodes to produce results exceeding that
          #     # range. This limitation is implemented by CScriptNum's
          #     # default 4-byte limit.
          #     #
          #     # If we kept to that limit we'd have a year 2038 problem,
          #     # even though the nLockTime field in transactions
          #     # themselves is uint32 which only becomes meaningless
          #     # after the year 2106.
          #     #
          #     # Thus as a special case we tell CScriptNum to accept up
          #     # to 5-byte bignums, which are good until 2**39-1, well
          #     # beyond the 2**32-1 limit of the nLockTime field itself.
          #     locktime = cast_to_number(@stack.last, max_size: @locktime_max_size)
          # 
          #     # In the rare event that the argument may be < 0 due to
          #     # some arithmetic being done first, you can always use
          #     # 0 MAX CHECKLOCKTIMEVERIFY.
          #     if locktime < 0
          #       return set_error(SCRIPT_ERR_NEGATIVE_LOCKTIME)
          #     end
          # 
          #     # Actually compare the specified lock time with the transaction.
          #     if !signature_checker.check_lock_time(locktime)
          #       return set_error(SCRIPT_ERR_UNSATISFIED_LOCKTIME)
          #     end
          #   end while false

          when OP_NOP1..OP_NOP10
            if flag?(SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)
              return set_error(SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS)
            end

          when OP_IF, OP_NOTIF
            # <expression> if [statements] [else [statements]] endif
            flag = false
            if should_execute
              if @stack.size < 1
                return set_error(SCRIPT_ERR_UNBALANCED_CONDITIONAL)
              end
              flag = cast_to_bool(@stack.last)
              if opcode == OP_NOTIF
                flag = !flag
              end
              stack_pop
            end
            condition_flags.push(flag)

          when OP_ELSE
            if condition_flags.empty?
              return set_error(SCRIPT_ERR_UNBALANCED_CONDITIONAL)
            end
            condition_flags[-1] = !condition_flags.last

          when OP_ENDIF
            if condition_flags.empty?
              return set_error(SCRIPT_ERR_UNBALANCED_CONDITIONAL)
            end
            condition_flags.pop

          when OP_VERIFY
            # (true -- ) or
            # (false -- false) and return
            if @stack.size < 1
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end
            flag = cast_to_bool(@stack.last)
            if flag
              stack_pop
            else
              return set_error(SCRIPT_ERR_VERIFY)
            end

          when OP_RETURN
            return set_error(SCRIPT_ERR_OP_RETURN)


          # Stack Operations
          # ----------------

          when OP_TOALTSTACK
            if @stack.size < 1
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end
            @altstack.push(stack_pop)

          when OP_FROMALTSTACK
            if @altstack.size < 1
              return set_error(SCRIPT_ERR_INVALID_ALTSTACK_OPERATION)
            end
            stack_push(@altstack.pop)

          when OP_2DROP
            # (x1 x2 -- )
            if @stack.size < 2
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end
            stack_pop
            stack_pop

          when OP_2DUP
            # (x1 x2 -- x1 x2 x1 x2)
            if @stack.size < 2
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end
            a = @stack[-2]
            b = @stack[-1]
            stack_push(a)
            stack_push(b)

          when OP_3DUP
            # (x1 x2 x3 -- x1 x2 x3 x1 x2 x3)
            if @stack.size < 3
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end
            a = @stack[-3]
            b = @stack[-2]
            c = @stack[-1]
            stack_push(a)
            stack_push(b)
            stack_push(c)

          when OP_2OVER
            # (x1 x2 x3 x4 -- x1 x2 x3 x4 x1 x2)
            if @stack.size < 4
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end
            a = @stack[-4]
            b = @stack[-3]
            stack_push(a)
            stack_push(b)

          when OP_2ROT
            # (x1 x2 x3 x4 x5 x6 -- x3 x4 x5 x6 x1 x2)
            if @stack.size < 6
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end
            a = @stack[-6]
            b = @stack[-5]
            @stack[-6...-4] = []
            stack_push(a)
            stack_push(b)

          when OP_2SWAP
            # (x1 x2 x3 x4 -- x3 x4 x1 x2)
            if @stack.size < 4
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end
            x1x2 = @stack[-4...-2]
            @stack[-4...-2] = []
            @stack += x1x2

          when OP_IFDUP
            # (x - 0 | x x)
            if @stack.size < 1
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end
            item = @stack.last
            if cast_to_bool(item)
              stack_push(item)
            end

          when OP_DEPTH
            # -- stacksize
            sn = BTC::ScriptNumber.new(integer: @stack.size)
            stack_push(sn.data)

          when OP_DROP
            # (x -- )
            if @stack.size < 1
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end
            stack_pop

          when OP_DUP
            # (x -- x x)
            if @stack.size < 1
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end
            stack_push(@stack.last)

          when OP_NIP
            # (x1 x2 -- x2)
            if @stack.size < 2
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end
            @stack.delete_at(-2)

          when OP_OVER
            # (x1 x2 -- x1 x2 x1)
            if @stack.size < 2
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end
            stack_push(@stack[-2])

          when OP_PICK, OP_ROLL
            # (xn ... x2 x1 x0 n - xn ... x2 x1 x0 xn)
            # (xn ... x2 x1 x0 n - ... x2 x1 x0 xn)
            if @stack.size < 2
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end
            n = cast_to_number(@stack.last).to_i
            stack_pop
            if n < 0 || n >= @stack.size
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end
            item = @stack[-n-1]
            if opcode == OP_ROLL
              @stack.delete_at(-n-1)
            end
            stack_push(item)

          when OP_ROT
            # (x1 x2 x3 -- x2 x3 x1)
            #  x2 x1 x3  after first swap
            #  x2 x3 x1  after second swap
            if @stack.size < 3
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end
            x1 = @stack[-3]
            @stack.delete_at(-3)
            stack_push(x1)

          when OP_SWAP
            # (x1 x2 -- x2 x1)
            if @stack.size < 2
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end
            x1 = @stack[-2]
            @stack.delete_at(-2)
            stack_push(x1)

          when OP_TUCK
            # (x1 x2 -- x2 x1 x2)
            if @stack.size < 2
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end
            item = @stack[-1]
            @stack.insert(-3, item) # -1 inserts in the end, -2 before the last item.

          when OP_SIZE
            # (in -- in size)
            if @stack.size < 1
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end
            sn = BTC::ScriptNumber.new(integer: @stack.last.size)
            stack_push(sn.data)


          # Bitwise Logic
          # -------------

          when OP_EQUAL, OP_EQUALVERIFY
          # there is no OP_NOTEQUAL, use OP_NUMNOTEQUAL instead
            # (x1 x2 - bool)
            if @stack.size < 2
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end
            a = @stack[-2]
            b = @stack[-1]
            equal = (a == b)
            # OP_NOTEQUAL is disabled because it would be too easy to say
            # something like n != 1 and have some wiseguy pass in 1 with extra
            # zero bytes after it (numerically, 0x01 == 0x0001 == 0x000001)
            # if opcode == OP_NOTEQUAL
            #   equal = !equal
            # end
            stack_pop
            stack_pop
            stack_push(equal ? true_value : false_value)
            if opcode == OP_EQUALVERIFY
              if equal
                stack_pop
              else
                return set_error(SCRIPT_ERR_EQUALVERIFY)
              end
            end


          # Numeric
          # -------

          when OP_1ADD,
               OP_1SUB,
               OP_NEGATE,
               OP_ABS,
               OP_NOT,
               OP_0NOTEQUAL
            # (in -- out)
            if @stack.size < 1
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end

            bn = cast_to_number(@stack.last)
            case opcode
            when OP_1ADD
              bn += 1
            when OP_1SUB
              bn -= 1
            when OP_NEGATE
              bn = -bn
            when OP_ABS
              bn = -bn if bn < 0
            when OP_NOT
              bn = BTC::ScriptNumber.new(boolean: (bn == 0))
            when OP_0NOTEQUAL
              bn = BTC::ScriptNumber.new(boolean: (bn != 0))
            else
              raise "invalid opcode"
            end
            stack_pop
            stack_push(bn.data);


          when OP_ADD, OP_SUB, OP_BOOLAND..OP_MAX
            # (x1 x2 -- out)
            if @stack.size < 2
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end

            bn1 = cast_to_number(@stack[-2])
            bn2 = cast_to_number(@stack[-1])
            bn = BTC::ScriptNumber.new(integer: 0)

            case opcode
            when OP_ADD
              bn = bn1 + bn2
            when OP_SUB
              bn = bn1 - bn2
            when OP_BOOLAND
              bn = BTC::ScriptNumber.new(boolean: ((bn1 != 0) && (bn2 != 0)))
            when OP_BOOLOR
              bn = BTC::ScriptNumber.new(boolean: ((bn1 != 0) || (bn2 != 0)))
            when OP_NUMEQUAL, OP_NUMEQUALVERIFY
              bn = BTC::ScriptNumber.new(boolean: (bn1 == bn2))
            when OP_NUMNOTEQUAL
              bn = BTC::ScriptNumber.new(boolean: (bn1 != bn2))
            when OP_LESSTHAN
              bn = BTC::ScriptNumber.new(boolean: (bn1 < bn2))
            when OP_GREATERTHAN
              bn = BTC::ScriptNumber.new(boolean: (bn1 > bn2))
            when OP_LESSTHANOREQUAL
              bn = BTC::ScriptNumber.new(boolean: (bn1 <= bn2))
            when OP_GREATERTHANOREQUAL
              bn = BTC::ScriptNumber.new(boolean: (bn1 >= bn2))
            when OP_MIN
              bn = (bn1 < bn2 ? bn1 : bn2)
            when OP_MAX
              bn = (bn1 > bn2 ? bn1 : bn2)
            else
              raise "Invalid opcode"
            end
            stack_pop
            stack_pop
            stack_push(bn.data)

            if opcode == OP_NUMEQUALVERIFY
              if cast_to_bool(@stack[-1])
                stack_pop
              else
                return set_error(SCRIPT_ERR_NUMEQUALVERIFY)
              end
            end

          when OP_WITHIN
            # (x min max -- out)
            if @stack.size < 3
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end
            bn1 = cast_to_number(@stack[-3])
            bn2 = cast_to_number(@stack[-2])
            bn3 = cast_to_number(@stack[-1])
            flag = ((bn2 <= bn1) && (bn1 < bn3))
            stack_pop
            stack_pop
            stack_pop
            stack_push(flag ? true_value : false_value)

          # Crypto
          # ------

          when OP_RIPEMD160..OP_HASH256
            # (in -- hash)
            if @stack.size < 1
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end
            item = @stack[-1]
            hash = case opcode
            when OP_RIPEMD160
              BTC.ripemd160(item)
            when OP_SHA1
              BTC.sha1(item)
            when OP_SHA256
              BTC.sha256(item)
            when OP_HASH160
              BTC.hash160(item)
            when OP_HASH256
              BTC.hash256(item)
            end
            stack_pop
            stack_push(hash)

          when OP_CODESEPARATOR
            # Hash starts after the code separator
            index_after_codeseparator = chunk_index + 1

          when OP_CHECKSIG, OP_CHECKSIGVERIFY
            # (sig pubkey -- bool)
            if @stack.size < 2
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end

            sig    = @stack[-2]
            pubkey = @stack[-1]

            # Subset of script starting at the most recent codeseparator
            subscript = script.subscript(index_after_codeseparator..-1)

            # Drop the signature, since there's no way for a signature to sign itself
            # Consensus-critical code: must replace sig with minimal encoding.
            subscript = subscript.find_and_delete(BTC::Script.new << sig)

            if !check_signature_encoding(sig) || !check_pubkey_encoding(pubkey)
              # error is set already
              return false
            end

            success = signature_checker.check_signature(
              script_signature: sig,
              public_key:       pubkey,
              script:           subscript
            )

            stack_pop
            stack_pop
            stack_push(success ? true_value : false_value)

            if opcode == OP_CHECKSIGVERIFY
              if success
                stack_pop
              else
                return set_error(SCRIPT_ERR_CHECKSIGVERIFY)
              end
            end


          when OP_CHECKMULTISIG, OP_CHECKMULTISIGVERIFY
            # ([sig ...] num_of_signatures [pubkey ...] num_of_pubkeys -- bool)

            i = 1
            if @stack.size < i
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end

            keys_count = cast_to_number(@stack[-i]).to_i
            if keys_count < 0 || keys_count > 20
              return set_error(SCRIPT_ERR_PUBKEY_COUNT)
            end
            opcount += keys_count
            if opcount > @max_op_count
              return set_error(SCRIPT_ERR_OP_COUNT)
            end
            ikey = (i+=1)
            i += keys_count
            if @stack.size < i
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end

            sigs_count = cast_to_number(@stack[-i]).to_i
            if sigs_count < 0 || sigs_count > keys_count
              return set_error(SCRIPT_ERR_SIG_COUNT)
            end

            isig = (i+=1)
            i += sigs_count

            if @stack.size < i
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end

            # Subset of script starting at the most recent codeseparator

            # Subset of script starting at the most recent codeseparator
            subscript = script.subscript(index_after_codeseparator..-1)

            # Drop the signatures, since there's no way for a signature to sign itself
            # Consensus-critical code: must replace sig with minimal encoding.
            sigs_count.times do |k|
              sig = @stack[-isig-k]
              subscript = subscript.find_and_delete(BTC::Script.new << sig)
            end

            success = true
            while success && sigs_count > 0
              sig = @stack[-isig]
              pubkey = @stack[-ikey]
              # Note how this makes the exact order of pubkey/signature evaluation
              # distinguishable by CHECKMULTISIG NOT if the STRICTENC flag is set.
              # See the script_(in)valid tests for details.
              if !check_signature_encoding(sig) || !check_pubkey_encoding(pubkey)
                # error is set already
                return false
              end

              # Check signature
              ok = signature_checker.check_signature(
                script_signature: sig,
                public_key:       pubkey,
                script:           subscript
              )
              if ok
                isig += 1
                sigs_count -= 1
              end
              ikey += 1
              keys_count -= 1

              # If there are more signatures left than keys left,
              # then too many signatures have failed. Exit early,
              # without checking any further signatures.
              if sigs_count > keys_count
                success = false
              end
            end

            # Clean up stack of actual arguments
            while (i-=1) > 0  # Bitcoin Core: while (i-- > 1)
              stack_pop
            end

            # A bug causes CHECKMULTISIG to consume one extra argument
            # whose contents were not checked in any way.
            #
            # Unfortunately this is a potential source of mutability,
            # so optionally verify it is exactly equal to zero prior
            # to removing it from the stack.
            if @stack.size < 1
              return set_error(SCRIPT_ERR_INVALID_STACK_OPERATION)
            end

            if flag?(SCRIPT_VERIFY_NULLDUMMY) && @stack[-1].size > 0
              return set_error(SCRIPT_ERR_SIG_NULLDUMMY)
            end
            stack_pop
            stack_push(success ? true_value : false_value)
            if opcode == OP_CHECKMULTISIGVERIFY
              if success
                stack_pop
              else
                return set_error(SCRIPT_ERR_CHECKMULTISIGVERIFY)
              end
            end

          else # unknown opcode
            return set_error(SCRIPT_ERR_BAD_OPCODE, "Unknown opcode 0x#{opcode.to_s(16)}")

          end # case opcode
        end # within IF scope

        # Size limits
        if @stack.size + @altstack.size > @max_stack_size
          return set_error(SCRIPT_ERR_STACK_SIZE)
        end

      end # each chunk

      if !condition_flags.empty?
        return set_error(SCRIPT_ERR_UNBALANCED_CONDITIONAL)
      end

      return true
    rescue BTC::ScriptNumberError => e
      return set_error(SCRIPT_ERR_UNKNOWN_ERROR, e.message)
    end
120805
function() {
      if (common.inlinescripts.length > 0) {
        var script_text = '';
        for (var i = 0; i < common.inlinescripts.length; i++) {
          if (!common.inlinescripts[i] || typeof common.inlinescripts[i] == 'undefined') 
            continue;
          else
            script_text += common.inlinescripts[i] + '\n';
        }
        try {
          eval(script_text);
        } catch(e) {
          batch.callback(script_text);
        }
      }
    }
372772
def lookup_scripts
      scripts = [
                 [ 'backup', 'EBS stripe volume backup' ],
                 [ 'restore', 'EBS stripe volume restore' ],
                 [ 'continuous_backup', 'EBS continuous backups' ],
                 [ 'unfreeze', 'EBS unfreeze volume backups' ],
                 [ 'freeze', 'EBS freeze volume backups' ],
                 [ 'create_stripe', 'EBS stripe volume create' ],
                 [ 'create_backup_scripts', 'EBS create backup scripts' ],
                 [ 'grow_volume', 'EBS stripe volume grow and restore' ],
                 [ 'terminate', 'TERMINATE' ]
               ]
      st = ServerTemplate.find(s_one.server_template_href)
      lookup_scripts_table(st,scripts)
    end
367992
def workflow_script_import(self):
        
        bsc = getToolByName(self, 'bika_setup_catalog')
        client = self.aq_parent

        title = _('Submitting Sample Import')
        description = _('Creating and initialising objects')
        bar = ProgressBar(self, self.REQUEST, title, description)
        notify(InitialiseProgressBar(bar))

        profiles = [x.getObject() for x in bsc(portal_type='AnalysisProfile')]

        gridrows = self.schema['SampleData'].get(self)
        row_cnt = 0
        for therow in gridrows:
            row = deepcopy(therow)
            row_cnt += 1

            # Profiles are titles, profile keys, or UIDS: convert them to UIDs.
            newprofiles = []
            for title in row['Profiles']:
                objects = [x for x in profiles
                           if title in (x.getProfileKey(), x.UID(), x.Title())]
                for obj in objects:
                    newprofiles.append(obj.UID())
            row['Profiles'] = newprofiles

            # Same for analyses
            newanalyses = set(self.get_row_services(row) +
                              self.get_row_profile_services(row))
            # get batch
            batch = self.schema['Batch'].get(self)
            if batch:
                row['Batch'] = batch.UID()
            # Add AR fields from schema into this row's data
            row['ClientReference'] = self.getClientReference()
            row['ClientOrderNumber'] = self.getClientOrderNumber()
            contact_uid =\
                self.getContact().UID() if self.getContact() else None
            row['Contact'] = contact_uid
            # Creating analysis request from gathered data
            ar = create_analysisrequest(
                client,
                self.REQUEST,
                row,
                analyses=list(newanalyses),)

            # progress marker update
            progress_index = float(row_cnt) / len(gridrows) * 100
            progress = ProgressState(self.REQUEST, progress_index)
            notify(UpdateProgressEvent(progress))

        # document has been written to, and redirect() fails here
        self.REQUEST.response.write(
            '<script>document.location.href="%s"</script>' % (
                self.absolute_url()))
503608
function () {

    var done = this.async();

    if(this.createMode) {

      // copy yoga-generator itself
      this.fs.copy(path.join(__dirname, '../'), this.destinationPath(), {
        globOptions: {
          dot: true,
          ignore: [
            '**/.DS_Store',
            '**/.git',
            '**/.git/**/*',
            '**/node_modules',
            '**/node_modules/**/*',
            '**/test/**/*',
            '**/create/**/*'
          ]
        }
      })

      // copy the package.json and README
      this.fs.copyTpl(path.join(__dirname, '../create/{}package.json'), this.destinationPath('package.json'), this.viewData)

      this.fs.copyTpl(path.join(__dirname, '../create/README.md'), this.destinationPath('README.md'), this.viewData)

      done()
    }
    else {
      this.registerTransformStream(striate(this.viewData))

      prefixnote.parseFiles(this.templatePath(), this.viewData)

        // copy each file that is traversed
        .on('data', function (file) {
          var filename = path.basename(file.original)

          // always ignore files like .DS_Store
          if(ignore.indexOf(filename) === -1) {
            var from = file.original
            var to = this.destinationPath(path.relative(this.templatePath(), file.parsed))

            // copy the file with templating
            this.fs.copyTpl(from, to, this.viewData)
          }
        }.bind(this))

        .on('end', done)
        .on('error', done)
    }
  }
1115561
def run(self):
        
        # read inputs
        indent = int(self.tcex.playbook.read(self.args.indent))
        json_data = self.tcex.playbook.read(self.args.json_data)

        # get the playbook variable type
        json_data_type = self.tcex.playbook.variable_type(self.args.json_data)

        # convert string input to dict
        if json_data_type in ['String']:
            json_data = json.loads(json_data)

        # generate the new "pretty" json (this will be used as an option variable)
        try:
            self.pretty_json = json.dumps(json_data, indent=indent, sort_keys=self.args.sort_keys)
        except Exception:
            self.tcex.exit(1, 'Failed parsing JSON data.')

        # set the App exit message
        self.exit_message = 'JSON prettified.'
241944
function() {
	var mappables = ["script" , "style"]
	for(var m in mappables) {
	  var which = mappables[m]
	  if($vars[which+'s']) {//if we have $vars["scripts"] or $vars["styles"]
		var page_scripts = $vars[which+'s'];
		var map_json = JSON.parse(fs.readFileSync($data_dir + "/common/"+which+"-mapping.json"));
		var mapped_scripts = [];
		for(var i in page_scripts) {
			if(page_scripts[i] in map_json) {
				if(typeof map_json[page_scripts[i]] == "string") mapped_scripts.push(map_json[page_scripts[i]])
				else if(typeof map_json[page_scripts[i]] == "object") //two or more scripts should be included for this to work, like dataTables, jQuery UI, etc ...
				{
					for(var m in map_json[page_scripts[i]])
						mapped_scripts.push(map_json[page_scripts[i]][m])
				}
			}
		}
		$vars[which+'s'] = mapped_scripts;

		if(('ie_'+which+'s') in $vars) {
			var ie_scripts = $vars['ie_'+which+'s'];//ie_scripts || ie_styles
			var ie_mapped_scripts = [];
			for(var i in ie_scripts) if(map_json[ie_scripts[i].name])
			{
				ie_mapped_scripts.push({"version" : ie_scripts[i].version , "file_name" : map_json[ie_scripts[i].name]})
			}

			$vars['ie_'+which+'s'] = ie_mapped_scripts
		}
	  }
	}
 }
560185
function execute(req, res) {
  ScriptManager.eval(req, res, '' + req.args[0], req.args.slice(1));
}
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}
1229628
protected function scripts()
    {
        $assetService = $this->getServiceLocator()->get(AssetService::SERVICE_ID);
        $cssFiles = [
            $assetService->getAsset('css/layout.css', 'tao'),
            $assetService->getAsset('css/tao-main-style.css', 'tao'),
            $assetService->getAsset('css/tao-3.css', 'tao')
        ];

        //stylesheets to load
        \tao_helpers_Scriptloader::addCssFiles($cssFiles);

        if(\common_session_SessionManager::isAnonymous()) {
            \tao_helpers_Scriptloader::addCssFile(
                $assetService->getAsset('css/portal.css', 'tao')
            );
        }
    }