text:
"""Tests for ExtractImagePatches gradient."""

from absl.testing import parameterized
import numpy as np

from tensorflow.python.eager import context
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.framework import random_seed as random_seed_lib
from tensorflow.python.framework import test_util
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import gradient_checker
from tensorflow.python.ops import gradient_checker_v2
from tensorflow.python.ops import variables
from tensorflow.python.platform import test

class ExtractImagePatchesGradTest(test.TestCase, parameterized.TestCase):
  """Gradient-checking for ExtractImagePatches op."""

  _TEST_CASES = [
      {
          'in_shape': [2, 5, 5, 3],
          'ksizes': [1, 1, 1, 1],
          'strides': [1, 2, 3, 1],
          'rates': [1, 1, 1, 1],
      },
      {
          'in_shape': [2, 7, 7, 3],
          'ksizes': [1, 3, 3, 1],
          'strides': [1, 1, 1, 1],
          'rates': [1, 1, 1, 1],
      },
      {
          'in_shape': [2, 8, 7, 3],
          'ksizes': [1, 2, 2, 1],
          'strides': [1, 1, 1, 1],
          'rates': [1, 1, 1, 1],
      },
      {
          'in_shape': [2, 7, 8, 3],
          'ksizes': [1, 3, 2, 1],
          'strides': [1, 4, 3, 1],
          'rates': [1, 1, 1, 1],
      },
      {
          'in_shape': [1, 15, 20, 3],
          'ksizes': [1, 4, 3, 1],
          'strides': [1, 1, 1, 1],
          'rates': [1, 2, 4, 1],
      },
      {
          'in_shape': [2, 7, 8, 1],
          'ksizes': [1, 3, 2, 1],
          'strides': [1, 3, 2, 1],
          'rates': [1, 2, 2, 1],
      },
      {
          'in_shape': [2, 8, 9, 4],
          'ksizes': [1, 2, 2, 1],
          'strides': [1, 4, 2, 1],
          'rates': [1, 3, 2, 1],
      },
  ]

  def testGradient(self):
    # Set graph seed for determinism.
    random_seed = 42
    random_seed_lib.set_random_seed(random_seed)

    with self.cached_session():
      for test_case in self._TEST_CASES:
        np.random.seed(random_seed)
        in_shape = test_case['in_shape']
        in_val = constant_op.constant(
            np.random.random(in_shape), dtype=dtypes.float32)
        # Avoid `dangerous-default-value` pylint error by creating default
        # args to `extract` as tuples.
        ksizes = tuple(test_case['ksizes'])
        strides = tuple(test_case['strides'])
        rates = tuple(test_case['rates'])

        for padding in ['VALID', 'SAME']:

          def extract(in_val,
                      ksizes=ksizes,
                      strides=strides,
                      rates=rates,
                      padding=padding):
            return array_ops.extract_image_patches(in_val, ksizes, strides,
                                                   rates, padding)

          err = gradient_checker_v2.max_error(
              *gradient_checker_v2.compute_gradient(extract, [in_val]))
          self.assertLess(err, 1e-4)

  @parameterized.parameters(set((True, context.executing_eagerly())))
  def testConstructGradientWithLargeImages(self, use_tape):
    with test_util.AbstractGradientTape(use_tape=use_tape) as tape:
      batch_size = 4
      # Prevent OOM by setting reasonably large image size (b/171808681).
      height = 512
      width = 512
      ksize = 5
      shape = (batch_size, height, width, 1)
      images = variables.Variable(
          np.random.uniform(size=np.prod(shape)).reshape(shape), name='inputs')
      tape.watch(images)
      patches = array_ops.extract_image_patches(images,
                                                ksizes=[1, ksize, ksize, 1],
                                                strides=[1, 1, 1, 1],
                                                rates=[1, 1, 1, 1],
                                                padding='SAME')
      # Github issue: #20146
      # tf.image.extract_image_patches() gradient very slow at graph
      # construction time.
      gradients = tape.gradient(patches, images)
      # Won't time out.
      self.assertIsNotNone(gradients)

  def _VariableShapeGradient(self, test_shape_pattern):
    """Use test_shape_pattern to infer which dimensions are of

    variable size.
    """
    # Testing shape gradient requires graph mode.
    with ops.Graph().as_default():
      # Set graph seed for determinism.
      random_seed = 42
      random_seed_lib.set_random_seed(random_seed)

      with self.test_session():
        for test_case in self._TEST_CASES:
          np.random.seed(random_seed)
          in_shape = test_case['in_shape']
          test_shape = [
              x if x is None else y
              for x, y in zip(test_shape_pattern, in_shape)
          ]
          in_val = array_ops.placeholder(shape=test_shape, dtype=dtypes.float32)

          feed_dict = {in_val: np.random.random(in_shape)}
          for padding in ['VALID', 'SAME']:
            out_val = array_ops.extract_image_patches(in_val,
                                                      test_case['ksizes'],
                                                      test_case['strides'],
                                                      test_case['rates'],
                                                      padding)
            out_val_tmp = out_val.eval(feed_dict=feed_dict)
            out_shape = out_val_tmp.shape

            err = gradient_checker.compute_gradient_error(
                in_val, in_shape, out_val, out_shape)
            self.assertLess(err, 1e-4)

  def test_BxxC_Gradient(self):
    self._VariableShapeGradient([-1, None, None, -1])

  def test_xHWx_Gradient(self):
    self._VariableShapeGradient([None, -1, -1, None])

  def test_BHWC_Gradient(self):
    self._VariableShapeGradient([-1, -1, -1, -1])

  def test_AllNone_Gradient(self):
    self._VariableShapeGradient([None, None, None, None])

if __name__ == '__main__':
  test.main()


text:
/**
 * This is a simple program that defines a few basic functions.
 * These functions aren't particularly exciting, they're just placeholders
 * to show of some of the technology in this repository.
 *
 * @author Taylor McKinney, taylorsmck@gmail.com
 */

namespace example {
    int plus (int i, int j) {
        return i + j;
    }

    int minus (int i, int j) {
        return i - j;
    }

    int multiply (int i, int j) {
        return i * j;
    }

    int divide (int i, int j) {
        return i / j;
    }

    int pow (int i, int j) {
        // Will be refactored later
        int v = 1;
        while (j-- != 0)
            v *= i;
        return v;
    }
}

redpajama_set_name: RedPajamaGithub


text:
package array;

import java.util.Arrays;

/**
 * An element in a sorted array can be found in O(log n) time via binary search. But suppose I rotate the sorted array
 * at some pivot unknown to you beforehand. So for instance, 1 2 3 4 5 might become 3 4 5 1 2. Devise a way to find an
 * element in the rotated array in O(log n) time.
 *
 * @author harish.sharma
 *
 */
public class BinarySearchShifted {

    public boolean solve(int[] a, int k) {
        int pivot = findPivot(a);
        if (pivot == -1)
            return BinarySearch.search(a, k);
        else {
            return BinarySearch.search(Arrays.copyOfRange(a, 0, pivot + 1), k)
                    || BinarySearch.search(Arrays.copyOfRange(a, pivot + 1, a.length), k);
        }
    }

    private int findPivot(int[] a) {
        int start = 0, end = a.length - 1;
        while (start <= end) {
            int mid = start + (end - start) / 2;
            if (mid < end && a[mid] > a[mid + 1]) {
                return mid;
            } else if (a[start] > a[mid]) {
                end = mid - 1;
            } else {
                start = mid + 1;
            }
        }
        return -1;
    }

    public static void main(String[] args) {
        int[] a = { 3, 4, 5, 6, 7, 8, 1, 2};
        System.out.println(new BinarySearchShifted().solve(a, 10));
    }
}


text:
var through = require('through2');

module.exports = function (file) {
    return through(function (buf, enc, next) {
        this.push(String(buf).replace(/WWW/g, '"world wide wow"'));
        next();
    });
};


text:
struct TRI_vocbase_t;

namespace arangodb {
namespace velocypack {
class Builder;
}

namespace aql {

class Query;

struct QueryEntryCopy {
  QueryEntryCopy (TRI_voc_tick_t id,
                  std::string&& queryString,
                  std::shared_ptr<arangodb::velocypack::Builder> bindParameters,
                  double started,
                  double runTime,
                  QueryExecutionState::ValueType state);

  TRI_voc_tick_t const id;
  std::string const queryString;
  std::shared_ptr<arangodb::velocypack::Builder> const bindParameters;
  double const started;
  double const runTime;
  QueryExecutionState::ValueType const state;
};

class QueryList {
 public:
  /// @brief create a query list
  explicit QueryList(TRI_vocbase_t*);

  /// @brief destroy a query list
  ~QueryList() = default;

 public:
  /// @brief whether or not queries are tracked
  /// we're not using a lock here for performance reasons - thus concurrent
  /// modifications of this variable are possible but are considered unharmful
  inline bool enabled() const { return _enabled; }

  /// @brief toggle query tracking
  /// we're not using a lock here for performance reasons - thus concurrent
  /// modifications of this variable are possible but are considered unharmful
  inline void enabled(bool value) { _enabled = value; }

  /// @brief whether or not slow queries are tracked
  /// we're not using a lock here for performance reasons - thus concurrent
  /// modifications of this variable are possible but are considered unharmful
  inline bool trackSlowQueries() const { return _trackSlowQueries; }

  /// @brief toggle slow query tracking
  /// we're not using a lock here for performance reasons - thus concurrent
  /// modifications of this variable are possible but are considered unharmful
  inline void trackSlowQueries(bool value) { _trackSlowQueries = value; }

  /// @brief whether or not bind vars are tracked with queries
  /// we're not using a lock here for performance reasons - thus concurrent
  /// modifications of this variable are possible but are considered unharmful
  inline bool trackBindVars() const { return _trackBindVars; }

  /// @brief toggle query bind vars tracking
  /// we're not using a lock here for performance reasons - thus concurrent
  /// modifications of this variable are possible but are considered unharmful
  inline void trackBindVars(bool value) { _trackBindVars = value; }

  /// @brief threshold for slow queries (in seconds)
  /// we're not using a lock here for performance reasons - thus concurrent
  /// modifications of this variable are possible but are considered unharmful
  inline double slowQueryThreshold() const { return _slowQueryThreshold; }

  /// @brief set the slow query threshold
  /// we're not using a lock here for performance reasons - thus concurrent
  /// modifications of this variable are possible but are considered unharmful
  inline void slowQueryThreshold(double value) {
    if (value < 0.0 || value == HUGE_VAL || value != value) {
      // sanity checks
      value = 0.0;
    }
    _slowQueryThreshold = value;
  }

  /// @brief return the max number of slow queries to keep
  /// we're not using a lock here for performance reasons - thus concurrent
  /// modifications of this variable are possible but are considered unharmful
  inline size_t maxSlowQueries() const { return _maxSlowQueries; }

  /// @brief set the max number of slow queries to keep
  /// we're not using a lock here for performance reasons - thus concurrent
  /// modifications of this variable are possible but are considered unharmful
  inline void maxSlowQueries(size_t value) {
    if (value > 16384) {
      // sanity checks
      value = 16384;
    }
    _maxSlowQueries = value;
  }

  /// @brief return the max length of query strings that are stored / returned
  /// we're not using a lock here for performance reasons - thus concurrent
  /// modifications of this variable are possible but are considered unharmful
  inline size_t maxQueryStringLength() const { return _maxQueryStringLength; }

  /// @brief set the max length of query strings that are stored / returned
  /// we're not using a lock here for performance reasons - thus concurrent
  /// modifications of this variable are possible but are considered unharmful
  inline void maxQueryStringLength(size_t value) {
    // sanity checks
    if (value < 64) {
      value = 64;
    } else if (value >= 8 * 1024 * 1024) {
      value = 8 * 1024 * 1024;
    }

    _maxQueryStringLength = value;
  }

  /// @brief enter a query
  bool insert(Query*);

  /// @brief remove a query
  void remove(Query*);

  /// @brief kills a query
  int kill(TRI_voc_tick_t);

  /// @brief kills all currently running queries
  uint64_t killAll(bool silent);

  /// @brief return the list of running queries
  std::vector<QueryEntryCopy> listCurrent();

  /// @brief return the list of slow queries
  std::vector<QueryEntryCopy> listSlow();

  /// @brief clear the list of slow queries
  void clearSlow();

 private:
  std::string extractQueryString(Query const* query, size_t maxLength) const;

  /// @brief default maximum number of slow queries to keep in list
  static constexpr size_t defaultMaxSlowQueries = 64;

  /// @brief default max length of a query when returning it
  static constexpr size_t defaultMaxQueryStringLength = 4096;

 private:
  /// @brief r/w lock for the list
  arangodb::basics::ReadWriteLock _lock;

  /// @brief list of current queries
  std::unordered_map<TRI_voc_tick_t, Query*> _current;

  /// @brief list of slow queries
  std::list<QueryEntryCopy> _slow;

  /// @brief current number of slow queries
  size_t _slowCount;

  /// @brief whether or not queries are tracked
  bool _enabled;

  /// @brief whether or not slow queries are tracked
  bool _trackSlowQueries;

  /// @brief whether or not bind vars are also tracked with queries
  bool _trackBindVars;

  /// @brief threshold for slow queries (in seconds)
  double _slowQueryThreshold;

  /// @brief maximum number of slow queries to keep
  size_t _maxSlowQueries;

  /// @brief max length of query strings to return
  size_t _maxQueryStringLength;
};
}
}

#endif


text:
FROM marcbachmann/libvips
MAINTAINER tomas@aparicio.me

# Server port to listen
ENV PORT 9000

# Go version to use
ENV GOLANG_VERSION 1.6

# gcc for cgo
RUN apt-get update && apt-get install -y \
    gcc curl git libc6-dev make ca-certificates \
    --no-install-recommends \
  && rm -rf /var/lib/apt/lists/*

ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
ENV GOLANG_DOWNLOAD_SHA256 5470eac05d273c74ff8bac7bef5bad0b5abbd1c4052efbdbc8db45332e836b0b

RUN curl -fsSL --insecure "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
  && echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \
  && tar -C /usr/local -xzf golang.tar.gz \
  && rm golang.tar.gz

ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH

RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
WORKDIR $GOPATH

# Fetch the latest version of the package
RUN go get -u golang.org/x/net/context
RUN go get -u github.com/daaku/go.httpgzip
RUN go get -u github.com/rs/cors
RUN go get -u github.com/tj/go-debug
RUN go get -u gopkg.in/h2non/bimg.v1
RUN go get -u gopkg.in/h2non/filetype.v0
RUN go get -u gopkg.in/throttled/throttled.v2
RUN go get -u gopkg.in/throttled/throttled.v2/store/memstore

COPY . .
RUN make build

ENV IMAGINARY_ARGS -enable-url-source -allowed-origins https://img.crazylister.com

# Run the outyet command by default when the container starts.
CMD /go/bin/imaginary $IMAGINARY_ARGS

# Expose the server TCP port
EXPOSE 9000


text:
using System;
using Heathmill.FixAT.Domain;

namespace Heathmill.FixAT.Client.Model
{
    public class IcebergOrder
    {
        private readonly IServerFacade _serverFacade;

        public string Symbol { get; private set; }
        public string ClOrdID { get; private set; }
        public string OrderID { get; private set; }
        public MarketSide Side { get; private set; }
        public decimal TotalQuantity { get; private set; }
        public decimal ClipSize { get; private set; }
        public decimal InitialPrice { get; private set; }
        public decimal PriceDelta { get; private set; }
        public ActivationState State { get; private set; }
        public decimal RemainingQuantity { get; private set; }
        public decimal CurrentQuantity { get; private set; }
        public decimal CurrentPrice { get; private set; }

        public enum ActivationState
        {
            Suspended,
            PendingSuspension,
            PendingActivationAcceptance,
            Active
        }

        /// <summary>
        /// The time the market order from this iceberg order was last traded.
        /// Will be null if the order has not yet been traded.
        /// </summary>
        public DateTime? LastTradedTime { get; private set; }

        public IcebergOrder(IServerFacade serverFacade,
                            string symbol,
                            string clOrdID,
                            MarketSide side,
                            decimal totalQuantity,
                            decimal clipSize,
                            decimal initialPrice,
                            decimal priceDelta)
        {
            if (totalQuantity <= 0)
                throw new ApplicationException(
                    "Iceberg Order must have a quantity greater than zero");

            if (clipSize > totalQuantity)
                throw new ApplicationException(
                    "Iceberg Order total quantity must be greater or equal to the clip size");

            Symbol = symbol;
            ClOrdID = clOrdID;
            Side = side;
            TotalQuantity = totalQuantity;
            ClipSize = clipSize;
            InitialPrice = initialPrice;
            PriceDelta = priceDelta;
            State = ActivationState.Suspended;

            _serverFacade = serverFacade;
            RemainingQuantity = totalQuantity;
            CurrentPrice = InitialPrice;
            CurrentQuantity = clipSize;
        }

        public void Activate()
        {
            if (State == ActivationState.Active)
                throw new ApplicationException("Iceberg Order is already active");

            if (State == ActivationState.PendingActivationAcceptance)
                throw new ApplicationException("Iceberg Order has already been activated");

            var order = ToOrderRecord();

            if (_serverFacade.CreateOrder(order))
                State = ActivationState.PendingActivationAcceptance;
        }

        /// <summary>
        /// Should be called once the server accepts the market order created
        /// by this Iceberg Order
        /// </summary>
        /// <param name="orderID">The OrderID assigned to the market order by the server</param>
        public void ActivatedMarketOrderAccepted(string orderID)
        {
            State = ActivationState.Active;
            OrderID = orderID;
        }

        public void Suspend()
        {
            if (State == ActivationState.Suspended || State == ActivationState.PendingSuspension)
                throw new ApplicationException("Iceberg Order is already suspended");

            if (State == ActivationState.PendingActivationAcceptance ||
                string.IsNullOrEmpty(OrderID))
            {
                throw new ApplicationException(
                    "Market order has not been accepted yet, cannot suspend the order yet");
            }

            if (_serverFacade.CancelOrder(Symbol, ClOrdID, Side, OrderID))
                State = ActivationState.PendingSuspension;
        }

        /// <summary>
        /// Should be called when the Execution Report containing the cancel for the market
        /// order is received from the server
        /// </summary>
        public void MarketOrderCanceled()
        {
            State = ActivationState.Suspended;
        }

        /// <summary>
        /// The market order has been partially filled
        /// </summary>
        public void OnPartialFill(decimal quantityFilled)
        {
            if (State != ActivationState.Active)
                throw new ApplicationException("Order must be active before OnPartialFill is called");

            if (quantityFilled >= CurrentQuantity)
                throw new ApplicationException(
                    "Partial fill must be for less than the current order quantity");

            LastTradedTime = DateTime.UtcNow;
            CurrentQuantity -= quantityFilled;
            RemainingQuantity -= quantityFilled;
        }

        /// <summary>
        /// The active market order has been totalled filled (i.e. all quantity traded)
        /// </summary>
        public void OnTotalFill()
        {
            if (State != ActivationState.Active)
                throw new ApplicationException("Order must be active before OnTotalFill is called");

            State = ActivationState.Suspended;

            LastTradedTime = DateTime.UtcNow;

            // Change the price by the delta
            AdjustPriceForRefill();

            // A total fill means the trade has taken all the currentQuantity
            RemainingQuantity -= CurrentQuantity;

            // Now replenish the current available quantity based on the clip size
            CurrentQuantity = Math.Min(ClipSize, RemainingQuantity);

            if (CurrentQuantity > 0m)
                Activate();
        }

        /// <summary>
        /// Currently you can only update the values of an iceberg order if it's either
        /// inactive or its market order has been accepted by the server
        /// </summary>
        public bool CanSetNewValues()
        {
            return
                State != ActivationState.PendingActivationAcceptance &&
                State != ActivationState.PendingSuspension;
        }

        /// <summary>
        /// Call this if you wish to manually change the price level for the Iceberg Order
        /// </summary>
        /// <param name="newPrice">The new price</param>
        /// <remarks>Call CanSerNewValues() first</remarks>
        public void SetNewOrderPrice(decimal newPrice)
        {
            if (!CanSetNewValues())
                throw new ApplicationException("Unable to set new order price");

            // Should we update initial price here?
            // If the purpose is to show how the delta has changed the price then yes,
            // if it's to show creation data about the order then no

            var oldOrderDetails = ToOrderRecord();

            CurrentPrice = newPrice;
            if (State == ActivationState.Active)
            {
                _serverFacade.UpdateOrder(oldOrderDetails, ToOrderRecord());
            }
        }

        private void AdjustPriceForRefill()
        {
            if (Side == MarketSide.Bid)
            {
                CurrentPrice -= PriceDelta;
            }
            else
            {
                CurrentPrice += PriceDelta;
            }

            // Lowest price is zero
            CurrentPrice = Math.Max(CurrentPrice, 0);
        }

        private OrderRecord ToOrderRecord()
        {
            return new OrderRecord
            {
                ClOrdID = ClOrdID,
                LastUpdateTime = DateTime.UtcNow,
                OrderID = OrderID,
                OrdType = OrderType.Limit,
                Price = CurrentPrice,
                Quantity = CurrentQuantity,
                Side = Side,
                Status = OrderStatus.New,
                Symbol = Symbol
            };
        }

    }
}


text:
[![Build Status](https://travis-ci.org/martin-experiments/ctrl-http-server.svg?branch=master)](https://travis-ci.org/martin-experiments/ctrl-http-server)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/de53d9ef604a4c03a498e821f3ec2cdb)](https://www.codacy.com/app/suitupalex/ctrl-http-server?utm_source=github.com&utm_medium=referral&utm_content=martin-experiments/ctrl-http-server&utm_campaign=Badge_Grade)
[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/de53d9ef604a4c03a498e821f3ec2cdb)](https://www.codacy.com/app/suitupalex/ctrl-http-server?utm_source=github.com&utm_medium=referral&utm_content=martin-experiments/ctrl-http-server&utm_campaign=Badge_Coverage)

An abstraction around hapi.js.

## Installation

[Yarn](https://yarnpkg.com) is recommended for installation.

```bash
$ yarn add ctrl-http-server
```

But you can still use npm:

```bash
$ npm install --save ctrl-http-server
```

## Usage

```javascript
// Example app.js:

const CtrlHttpServer = require('ctrl-http-server')

const ctrlHttpServer = new CtrlHttpServer({port: 8080})

ctrlHttpServer.get('/route', (request, reply) => {
  reply('Hello, world!')
})

ctrlHttpServer.start()
```

### Methods

Full documentation to come soon!

## License

Copyright (c) 2016 Martin Experiments LLC

MIT (https://www.opensource.org/licenses/MIT)


text:
package scala
package collection
package immutable

import scala.annotation.tailrec

/** This class implements an immutable map that preserves order using
  * a hash map for the key to value mapping to provide efficient lookup,
  * and a tree for the ordering of the keys to provide efficient
  * insertion/modification order traversal and destructuring.
  *
  * By default insertion order (`TreeSeqMap.OrderBy.Insertion`)
  * is used, but modification order (`TreeSeqMap.OrderBy.Modification`)
  * can be used instead if so specified at creation.
  *
  * The `orderingBy(orderBy: TreeSeqMap.OrderBy): TreeSeqMap[K, V]` method
  * can be used to switch to the specified ordering for the returned map.
  *
  * A key can be manually refreshed (i.e. placed at the end) via the
  * `refresh(key: K): TreeSeqMap[K, V]` method (regardless of the ordering in
  * use).
  *
  * Internally, an ordinal counter is increased for each insertion/modification
  * and then the current ordinal is used as key in the tree map. After 2^32^
  * insertions/modifications the entire map is copied (thus resetting the ordinal
  * counter).
  *
  *  @tparam K the type of the keys contained in this map.
  *  @tparam V the type of the values associated with the keys in this map.
  * @define coll immutable tree seq map
  * @define Coll `immutable.TreeSeqMap`
  */
final class TreeSeqMap[K, +V] private (
    private val ordering: TreeSeqMap.Ordering[K],
    private val mapping: TreeSeqMap.Mapping[K, V],
    private val ordinal: Int,
    val orderedBy: TreeSeqMap.OrderBy)
  extends AbstractMap[K, V]
    with SeqMap[K, V]
    with MapOps[K, V, TreeSeqMap, TreeSeqMap[K, V]]
    with StrictOptimizedIterableOps[(K, V), Iterable, TreeSeqMap[K, V]]
    with StrictOptimizedMapOps[K, V, TreeSeqMap, TreeSeqMap[K, V]]
    with MapFactoryDefaults[K, V, TreeSeqMap, Iterable] {

  import TreeSeqMap._

  override protected[this] def className: String = "TreeSeqMap"

  override def mapFactory: MapFactory[TreeSeqMap] = TreeSeqMap

  override val size = mapping.size

  override def knownSize: Int = size

  override def isEmpty = size == 0

  /*
  // This should have been overridden in 2.13.0 but wasn't so it will have to wait since it is not forwards compatible
  // Now handled in inherited method from scala.collection.MapFactoryDefaults instead.
  override def empty = TreeSeqMap.empty[K, V](orderedBy)
  */

  def orderingBy(orderBy: OrderBy): TreeSeqMap[K, V] = {
    if (orderBy == this.orderedBy) this
    else if (isEmpty) TreeSeqMap.empty(orderBy)
    else new TreeSeqMap(ordering, mapping, ordinal, orderBy)
  }

  def updated[V1 >: V](key: K, value: V1): TreeSeqMap[K, V1] = {
    mapping.get(key) match {
      case e if ordinal == -1 && (orderedBy == OrderBy.Modification || e.isEmpty) =>
        // Reinsert into fresh instance to restart ordinal counting, expensive but only done after 2^32 updates.
        TreeSeqMap.empty[K, V1](orderedBy) ++ this + (key -> value)
      case Some((o, _)) if orderedBy == OrderBy.Insertion =>
        new TreeSeqMap(
          ordering.include(o, key),
          mapping.updated[(Int, V1)](key, (o, value)),
          ordinal, // Do not increment the ordinal since the key is already present, i.e. o <= ordinal.
          orderedBy)
      case Some((o, _)) =>
        val o1 = increment(ordinal)
        new TreeSeqMap(
          ordering.exclude(o).append(o1, key),
          mapping.updated[(Int, V1)](key, (o1, value)),
          o1,
          orderedBy)
      case None =>
        val o1 = increment(ordinal)
        new TreeSeqMap(
          ordering.append(o1, key),
          mapping.updated[(Int, V1)](key, (o1, value)),
          o1,
          orderedBy)
    }
  }

  def removed(key: K): TreeSeqMap[K, V] = {
    mapping.get(key) match {
      case Some((o, _)) =>
        new TreeSeqMap(
          ordering.exclude(o),
          mapping.removed(key),
          ordinal,
          orderedBy)
      case None =>
        this
    }
  }

  def refresh(key: K): TreeSeqMap[K, V] = {
    mapping.get(key) match {
      case Some((o, _)) =>
        val o1 = increment(ordinal)
        new TreeSeqMap(
          ordering.exclude(o).append(o1, key),
          mapping,
          o1,
          orderedBy)
      case None =>
        this
    }
  }

  def get(key: K): Option[V] = mapping.get(key).map(value)

  def iterator: Iterator[(K, V)] = new AbstractIterator[(K, V)] {
    private[this] val iter = ordering.iterator

    override def hasNext: Boolean = iter.hasNext

    override def next(): (K, V) = binding(iter.next())
  }

  override def keysIterator: Iterator[K] = new AbstractIterator[K] {
    private[this] val iter = ordering.iterator

    override def hasNext: Boolean = iter.hasNext

    override def next(): K = iter.next()
  }

  override def valuesIterator: Iterator[V] = new AbstractIterator[V] {
    private[this] val iter = ordering.iterator

    override def hasNext: Boolean = iter.hasNext

    override def next(): V = value(binding(iter.next()))
  }

  override def contains(key: K): Boolean = mapping.contains(key)

  override def head: (K, V) = binding(ordering.head)

  override def headOption = ordering.headOption.map(binding)

  override def last: (K, V) = binding(ordering.last)

  override def lastOption: Option[(K, V)] = ordering.lastOption.map(binding)

  override def tail: TreeSeqMap[K, V] = {
    val (head, tail) = ordering.headTail
    new TreeSeqMap(tail, mapping.removed(head), ordinal, orderedBy)
  }

  override def init: TreeSeqMap[K, V] = {
    val (init, last) = ordering.initLast
    new TreeSeqMap(init, mapping.removed(last), ordinal, orderedBy)
  }

  override def slice(from: Int, until: Int): TreeSeqMap[K, V] = {
    val sz = size
    if (sz == 0 || from >= until) TreeSeqMap.empty[K, V](orderedBy)
    else {
      val sz = size
      val f = if (from >= 0) from else 0
      val u = if (until <= sz) until else sz
      val l = u - f
      if (l <= 0) TreeSeqMap.empty[K, V](orderedBy)
      else if (l > sz / 2) {
        // Remove front and rear incrementally if majority of elements are to be kept
        val (front, rest) = ordering.splitAt(f)
        val (ong, rear) = rest.splitAt(l)
        var mng = this.mapping
        val frontIter = front.iterator
        while (frontIter.hasNext) {
          mng = mng - frontIter.next()
        }
        val rearIter = rear.iterator
        while (rearIter.hasNext) {
          mng = mng - rearIter.next()
        }
        new TreeSeqMap(ong, mng, ordinal, orderedBy)
      } else {
        // Populate with builder otherwise
        val bdr = newBuilder[K, V](orderedBy)
        val iter = ordering.iterator
        var i = 0
        while (i < f) {
          iter.next()
          i += 1
        }
        while (i < u) {
          val k = iter.next()
          bdr.addOne((k, mapping(k)._2))
          i += 1
        }
        bdr.result()
      }
    }
  }

  override def map[K2, V2](f: ((K, V)) => (K2, V2)): TreeSeqMap[K2, V2] = {
    val bdr = newBuilder[K2, V2](orderedBy)
    val iter = ordering.iterator
    while (iter.hasNext) {
      val k = iter.next()
      val (_, v) = mapping(k)
      val (k2, v2) = f((k, v))
      bdr.addOne((k2, v2))
    }
    bdr.result()
  }

  override def flatMap[K2, V2](f: ((K, V)) => IterableOnce[(K2, V2)]): TreeSeqMap[K2, V2] = {
    val bdr = newBuilder[K2, V2](orderedBy)
    val iter = ordering.iterator
    while (iter.hasNext) {
      val k = iter.next()
      val (_, v) = mapping(k)
      val jter = f((k, v)).iterator
      while (jter.hasNext) {
        val (k2, v2) = jter.next()
        bdr.addOne((k2, v2))
      }
    }
    bdr.result()
  }

  override def collect[K2, V2](pf: PartialFunction[(K, V), (K2, V2)]): TreeSeqMap[K2, V2] = {
    val bdr = newBuilder[K2, V2](orderedBy)
    val iter = ordering.iterator
    while (iter.hasNext) {
      val k = iter.next()
      val (_, v) = mapping(k)
      pf.runWith({ case (k2, v2) => bdr.addOne((k2, v2)) })((k, v))
    }
    bdr.result()
  }

  override def concat[V2 >: V](suffix: IterableOnce[(K, V2)]): TreeSeqMap[K, V2] = {
    var ong: Ordering[K] = ordering
    var mng: Mapping[K, V2] = mapping
    var ord = increment(ordinal)
    val iter = suffix.iterator
    while (iter.hasNext) {
      val (k, v2) = iter.next()
      mng.get(k) match {
        case Some((o, v)) =>
          if (orderedBy == OrderBy.Insertion && v != v2) mng = mng.updated(k, (o, v2))
          else if (orderedBy == OrderBy.Modification) {
            mng = mng.updated(k, (ord, v2))
            ong = ong.exclude(o).append(ord, k)
            ord = increment(ord)
          }
        case None =>
          mng = mng.updated(k, (ord, v2))
          ong = ong.append(ord, k)
          ord = increment(ord)
      }
    }
    new TreeSeqMap[K, V2](ong, mng, ord, orderedBy)
  }

  @`inline` private[this] def value(p: (_, V)) = p._2
  @`inline` private[this] def binding(k: K) = mapping(k).copy(_1 = k)
}
object TreeSeqMap extends MapFactory[TreeSeqMap] {
  sealed trait OrderBy
  object OrderBy {
    case object Insertion extends OrderBy
    case object Modification extends OrderBy
  }

  private val EmptyByInsertion = new TreeSeqMap[Nothing, Nothing](Ordering.empty, HashMap.empty, 0, OrderBy.Insertion)
  private val EmptyByModification = new TreeSeqMap[Nothing, Nothing](Ordering.empty, HashMap.empty, 0, OrderBy.Modification)
  val Empty = EmptyByInsertion
  def empty[K, V]: TreeSeqMap[K, V] = empty(OrderBy.Insertion)
  def empty[K, V](orderBy: OrderBy): TreeSeqMap[K, V] = {
    if (orderBy == OrderBy.Modification) EmptyByModification
    else EmptyByInsertion
  }.asInstanceOf[TreeSeqMap[K, V]]

  def from[K, V](it: collection.IterableOnce[(K, V)]): TreeSeqMap[K, V] =
    it match {
      case om: TreeSeqMap[K, V] => om
      case _ => (newBuilder[K, V] ++= it).result()
    }

  @inline private def increment(ord: Int) = if (ord == Int.MaxValue) Int.MinValue else ord + 1

  def newBuilder[K, V]: mutable.Builder[(K, V), TreeSeqMap[K, V]] = newBuilder(OrderBy.Insertion)
  def newBuilder[K, V](orderedBy: OrderBy): mutable.Builder[(K, V), TreeSeqMap[K, V]] = new Builder[K, V](orderedBy)

  final class Builder[K, V](orderedBy: OrderBy) extends mutable.Builder[(K, V), TreeSeqMap[K, V]] {
    private[this] val bdr = new MapBuilderImpl[K, (Int, V)]
    private[this] var ong = Ordering.empty[K]
    private[this] var ord = 0
    private[this] var aliased: TreeSeqMap[K, V] = _

    override def addOne(elem: (K, V)): this.type = addOne(elem._1, elem._2)
    def addOne(key: K, value: V): this.type = {
      if (aliased ne null) {
        aliased = aliased.updated(key, value)
      } else {
        bdr.getOrElse(key, null) match {
          case (o, v) =>
            if (orderedBy == OrderBy.Insertion && v != value) bdr.addOne(key, (o, value))
            else if (orderedBy == OrderBy.Modification) {
              bdr.addOne(key, (ord, value))
              ong = ong.exclude(o).appendInPlace(ord, key)
              ord = increment(ord)
            }
          case null =>
            bdr.addOne(key, (ord, value))
            ong = ong.appendInPlace(ord, key)
            ord = increment(ord)
        }
      }
      this
    }

    override def clear(): Unit = {
      ong = Ordering.empty
      ord = 0
      bdr.clear()
      aliased = null
    }

    override def result(): TreeSeqMap[K, V] = {
      if (aliased eq null) {
        aliased = new TreeSeqMap(ong, bdr.result(), ord, orderedBy)
      }
      aliased
    }
  }

  private type Mapping[K, +V] = Map[K, (Int, V)]
  @annotation.unused
  private val Mapping = Map

  /* The ordering implementation below is an adapted version of immutable.IntMap. */
  private[immutable] object Ordering {
    import scala.collection.generic.BitOperations.Int._

    @inline private[immutable] def toBinaryString(i: Int): String = s"$i/${i.toBinaryString}"

    def empty[T] : Ordering[T] = Zero

    def apply[T](elems: (Int, T)*): Ordering[T] =
      elems.foldLeft(empty[T])((x, y) => x.include(y._1, y._2))

    // Iterator over a non-empty Ordering.
    final class Iterator[+V](it: Ordering[V]) {
      // Basically this uses a simple stack to emulate conversion over the tree. However
      // because we know that Ints are at least 32 bits we can have at most 32 Bins and
      // one Tip sitting on the tree at any point. Therefore we know the maximum stack
      // depth is 33
      private[this] var index = 0
      private[this] val buffer = new Array[AnyRef](33)

      private[this] def pop = {
        index -= 1
        buffer(index).asInstanceOf[Ordering[V]]
      }

      private[this] def push[V2 >: V](x: Ordering[V2]): Unit = {
        buffer(index) = x.asInstanceOf[AnyRef]
        index += 1
      }

      if (it != Zero) push(it)

      def hasNext = index != 0
      @tailrec
      def next(): V =
        pop match {
          case Bin(_,_, Tip(_, v), right) =>
            push(right)
            v
          case Bin(_, _, left, right) =>
            push(right)
            push(left)
            next()
          case Tip(_, v) => v
          // This should never happen. We don't allow Ordering.Zero in subtrees of the Ordering
          // and don't return an Ordering.Iterator for Ordering.Zero.
          case Zero => throw new IllegalStateException("empty subtree not allowed")
        }
    }

    object Iterator {
      val Empty = new Iterator[Nothing](Ordering.empty[Nothing])
      def empty[V]: Iterator[V] = Empty.asInstanceOf[Iterator[V]]
    }

    case object Zero extends Ordering[Nothing] {
      // Important! Without this equals method in place, an infinite
      // loop from Map.equals => size => pattern-match-on-Nil => equals
      // develops.  Case objects and custom equality don't mix without
      // careful handling.
      override def equals(that : Any): Boolean = that match {
        case _: this.type => true
        case _: Ordering[_] => false // The only empty Orderings are eq Nil
        case _ => super.equals(that)
      }
      protected def format(sb: StringBuilder, prefix: String, subPrefix: String): Unit = sb ++= s"${prefix}Ø"
    }

    final case class Tip[+T](ord: Int, value: T) extends Ordering[T] {
      def withValue[S](s: S) =
        if (s.asInstanceOf[AnyRef] eq value.asInstanceOf[AnyRef]) this.asInstanceOf[Tip[S]]
        else Tip(ord, s)
      protected def format(sb: StringBuilder, prefix: String, subPrefix: String): Unit = sb ++= s"${prefix}Tip(${toBinaryString(ord)} -> $value)\n"
    }

    final case class Bin[+T](prefix: Int, mask: Int, left: Ordering[T], var right: Ordering[T] @scala.annotation.unchecked.uncheckedVariance) extends Ordering[T] {
      def bin[S](left: Ordering[S], right: Ordering[S]): Ordering[S] = {
        if ((this.left eq left) && (this.right eq right)) this.asInstanceOf[Bin[S]]
        else Bin[S](prefix, mask, left, right)
      }
      protected def format(sb: StringBuilder, prefix: String, subPrefix: String): Unit = {
        sb ++= s"${prefix}Bin(${toBinaryString(this.prefix)}:${toBinaryString(mask)})\n"
        left.format(sb, subPrefix + "├── ", subPrefix + "│   ")
        right.format(sb, subPrefix + "└── ", subPrefix + "    ")
      }
    }

    private def branchMask(i: Int, j: Int) = highestOneBit(i ^ j)

    private def join[T](p1: Int, t1: Ordering[T], p2: Int, t2: Ordering[T]): Ordering[T] = {
      val m = branchMask(p1, p2)
      val p = mask(p1, m)
      if (zero(p1, m)) Bin(p, m, t1, t2)
      else Bin(p, m, t2, t1)
    }

    private def bin[T](prefix: Int, mask: Int, left: Ordering[T], right: Ordering[T]): Ordering[T] = (left, right) match {
      case (l, Zero) => l
      case (Zero, r) => r
      case (l, r) => Bin(prefix, mask, l, r)
    }
  }

  sealed abstract class Ordering[+T] {
    import Ordering._
    import scala.annotation.tailrec
    import scala.collection.generic.BitOperations.Int._

    override final def toString: String = format
    final def format: String = {
      val sb = new StringBuilder
      format(sb, "", "")
      sb.toString()
    }
    protected def format(sb: StringBuilder, prefix: String, subPrefix: String): Unit

    @tailrec
    final def head: T = this match {
      case Zero => throw new NoSuchElementException("head of empty map")
      case Tip(k, v) => v
      case Bin(_, _, l, _) => l.head
    }

    @tailrec
    final def headOption: Option[T] = this match {
      case Zero => None
      case Tip(_, v) => Some(v)
      case Bin(_, _, l, _) => l.headOption
    }

    @tailrec
    final def last: T = this match {
      case Zero => throw new NoSuchElementException("last of empty map")
      case Tip(_, v) => v
      case Bin(_, _, _, r) => r.last
    }

    @tailrec
    final def lastOption: Option[T] = this match {
      case Zero => None
      case Tip(_, v) => Some(v)
      case Bin(_, _, _, r) => r.lastOption
    }

    @tailrec
    final def ordinal: Int = this match {
      case Zero => 0
      case Tip(o, _) => o
      case Bin(_, _, _, r) => r.ordinal
    }

    final def tail: Ordering[T] = this match {
      case Zero => throw new NoSuchElementException("tail of empty map")
      case Tip(_, _) => Zero
      case Bin(p, m, l, r) => bin(p, m, l.tail, r)
    }

    final def headTail: (T, Ordering[T]) = this match {
      case Zero => throw new NoSuchElementException("init of empty map")
      case Tip(_, v) => (v, Zero)
      case Bin(p, m, l, r) =>
        val (head, tail) = l.headTail
        (head, bin(p, m, tail, r))
    }

    final def init: Ordering[T] = this match {
      case Zero => throw new NoSuchElementException("init of empty map")
      case Tip(_, _) => Zero
      case Bin(p, m, l, r) =>
        bin(p, m, l, r.init)
    }

    final def initLast: (Ordering[T], T) = this match {
      case Zero => throw new NoSuchElementException("init of empty map")
      case Tip(_, v) => (Zero, v)
      case Bin(p, m, l, r) =>
        val (init, last) = r.initLast
        (bin(p, m, l, init), last)
    }

    final def iterator: Iterator[T] = this match {
      case Zero => Iterator.empty
      case _ => new Iterator(this)
    }

    final def include[S >: T](ordinal: Int, value: S): Ordering[S] = this match {
      case Zero =>
        Tip(ordinal, value)
      case Tip(o, _) =>
        if (ordinal == o) Tip(ordinal, value)
        else join(ordinal, Tip(ordinal, value), o, this)
      case Bin(p, m, l, r) =>
        if (!hasMatch(ordinal, p, m)) join(ordinal, Tip(ordinal, value), p, this)
        else if (zero(ordinal, m)) Bin(p, m, l.include(ordinal, value), r)
        else Bin(p, m, l, r.include(ordinal, value))
    }

    final def append[S >: T](ordinal: Int, value: S): Ordering[S] = this match {
      case Zero =>
        Tip(ordinal, value)
      case Tip(o, _) =>
        if (ordinal == o) Tip(ordinal, value)
        else join(ordinal, Tip(ordinal, value), o, this)
      case Bin(p, m, l, r) =>
        if (!hasMatch(ordinal, p, m)) join(ordinal, Tip(ordinal, value), p, this)
        else if (zero(ordinal, m)) throw new IllegalArgumentException(s"Append called with ordinal out of range: $ordinal is not greater than current max ordinal ${this.ordinal}")
        else Bin(p, m, l, r.append(ordinal, value))
    }

    @inline private[collection] final def appendInPlace[S >: T](ordinal: Int, value: S): Ordering[S] = appendInPlace1(null, ordinal, value)
    private[collection] final def appendInPlace1[S >: T](parent: Bin[S], ordinal: Int, value: S): Ordering[S] = this match {
      case Zero =>
        Tip(ordinal, value)
      case Tip(o, _) if o >= ordinal =>
        throw new IllegalArgumentException(s"Append called with ordinal out of range: $o is not greater than current max ordinal ${this.ordinal}")
      case Tip(o, _) if parent == null =>
        join(ordinal, Tip(ordinal, value), o, this)
      case Tip(o, _) =>
        parent.right = join(ordinal, Tip(ordinal, value), o, this)
        parent
      case b @ Bin(p, m, _, r) =>
        if (!hasMatch(ordinal, p, m)) {
          val b2 = join(ordinal, Tip(ordinal, value), p, this)
          if (parent != null) {
            parent.right = b2
            parent
          } else b2
        } else if (zero(ordinal, m)) throw new IllegalArgumentException(s"Append called with ordinal out of range: $ordinal is not greater than current max ordinal ${this.ordinal}")
        else {
          r.appendInPlace1(b, ordinal, value)
          this
        }
    }

    final def exclude(ordinal: Int): Ordering[T] = this match {
      case Zero =>
        Zero
      case Tip(o, _) =>
        if (ordinal == o) Zero
        else this
      case Bin(p, m, l, r) =>
        if (!hasMatch(ordinal, p, m)) this
        else if (zero(ordinal, m)) bin(p, m, l.exclude(ordinal), r)
        else bin(p, m, l, r.exclude(ordinal))
    }

    final def splitAt(n: Int): (Ordering[T], Ordering[T]) = {
      var rear = Ordering.empty[T]
      var i = n
      (modifyOrRemove { (o, v) =>
        i -= 1
        if (i >= 0) Some(v)
        else {
          rear = rear.appendInPlace(o, v)
          None
        }
      }, rear)
    }

    /**
      * A combined transform and filter function. Returns an `Ordering` such that
      * for each `(key, value)` mapping in this map, if `f(key, value) == None`
      * the map contains no mapping for key, and if `f(key, value) == Some(x)` the
      * map contains `(key, x)`.
      *
      * @tparam S  The type of the values in the resulting `LongMap`.
      * @param f   The transforming function.
      * @return    The modified map.
      */
    final def modifyOrRemove[S](f: (Int, T) => Option[S]): Ordering[S] = this match {
      case Zero => Zero
      case Tip(key, value) =>
        f(key, value) match {
          case None => Zero
          case Some(value2) =>
            // hack to preserve sharing
            if (value.asInstanceOf[AnyRef] eq value2.asInstanceOf[AnyRef]) this.asInstanceOf[Ordering[S]]
            else Tip(key, value2)
        }
      case Bin(prefix, mask, left, right) =>
        val l = left.modifyOrRemove(f)
        val r = right.modifyOrRemove(f)
        if ((left eq l) && (right eq r)) this.asInstanceOf[Ordering[S]]
        else bin(prefix, mask, l, r)
    }
  }
}


text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/compute/v1/compute.proto

package com.google.cloud.compute.v1;

public interface HttpFaultDelayOrBuilder
    extends
    // @@protoc_insertion_point(interface_extends:google.cloud.compute.v1.HttpFaultDelay)
    com.google.protobuf.MessageOrBuilder {

  /**
   *
   *
   *

   * Specifies the value of the fixed delay interval.
   *

   *
   * optional .google.cloud.compute.v1.Duration fixed_delay = 317037816;
   *
   * @return Whether the fixedDelay field is set.
   */
  boolean hasFixedDelay();
  /**
   *
   *
   *

   * Specifies the value of the fixed delay interval.
   *

   *
   * optional .google.cloud.compute.v1.Duration fixed_delay = 317037816;
   *
   * @return The fixedDelay.
   */
  com.google.cloud.compute.v1.Duration getFixedDelay();
  /**
   *
   *
   *

   * Specifies the value of the fixed delay interval.
   *

   *
   * optional .google.cloud.compute.v1.Duration fixed_delay = 317037816;
   */
  com.google.cloud.compute.v1.DurationOrBuilder getFixedDelayOrBuilder();

  /**
   *
   *
   *

   * The percentage of traffic for connections, operations, or requests for which a delay is introduced as part of fault injection. The value must be from 0.0 to 100.0 inclusive.
   *

   *
   * optional double percentage = 151909018;
   *
   * @return Whether the percentage field is set.
   */
  boolean hasPercentage();
  /**
   *
   *
   *

   * The percentage of traffic for connections, operations, or requests for which a delay is introduced as part of fault injection. The value must be from 0.0 to 100.0 inclusive.
   *

   *
   * optional double percentage = 151909018;
   *
   * @return The percentage.
   */
  double getPercentage();
}


text:
#ifndef SCHEDTABLE_H
#define SCHEDTABLE_H

config_require(disman/schedule/schedCore)
config_add_mib(DISMAN-SCHEDULE-MIB)

/*
 * function declarations
 */
void            init_schedTable(void);
Netsnmp_Node_Handler schedTable_handler;

/*
 * column number definitions for table schedTable
 */
#define COLUMN_SCHEDOWNER		1
#define COLUMN_SCHEDNAME		2
#define COLUMN_SCHEDDESCR		3
#define COLUMN_SCHEDINTERVAL		4
#define COLUMN_SCHEDWEEKDAY		5
#define COLUMN_SCHEDMONTH		6
#define COLUMN_SCHEDDAY			7
#define COLUMN_SCHEDHOUR		8
#define COLUMN_SCHEDMINUTE		9
#define COLUMN_SCHEDCONTEXTNAME		10
#define COLUMN_SCHEDVARIABLE		11
#define COLUMN_SCHEDVALUE		12
#define COLUMN_SCHEDTYPE		13
#define COLUMN_SCHEDADMINSTATUS		14
#define COLUMN_SCHEDOPERSTATUS		15
#define COLUMN_SCHEDFAILURES		16
#define COLUMN_SCHEDLASTFAILURE		17
#define COLUMN_SCHEDLASTFAILED		18
#define COLUMN_SCHEDSTORAGETYPE		19
#define COLUMN_SCHEDROWSTATUS		20
#define COLUMN_SCHEDTRIGGERS		21

#endif                          /* SCHEDTABLE_H */


text:
// DotNetNuke® - http://www.dnnsoftware.com
//
// Copyright (c) 2002-2017, DNN Corp.
// All rights reserved.

using System.Collections.Generic;
using DotNetNuke.Tests.Integration.Framework.Controllers;

namespace DotNetNuke.Tests.Integration.Framework.Helpers
{
    public static class EvoqWebApiTestHelper
    {
        /// <summary>
        /// Provides a list of Connectors just for Content - LoginContentManager and LoginContentEditor
        /// </summary>
        public static IList<IWebApiConnector> ContentLogins()
        {
            return new List<IWebApiConnector> {LoginContentManager(), LoginContentEditor()};
        }

        /// <summary>
        /// Provides a list of Connectors for Managers - LoginContentManager and LoginCommunityManager
        /// </summary>
        public static IList<IWebApiConnector> ManagerLogins()
        {
            return SolutionController.IsSocial()
                ? new List<IWebApiConnector> {LoginContentManager(), LoginCommunityManager()}
                : new List<IWebApiConnector> {LoginContentManager()};
        }

        /// <summary>
        /// Provides a list of Connectors for All the three roles - LoginContentManager, LoginContentEditor and LoginCommunityManager
        /// </summary>
        public static IList<IWebApiConnector> AllLogins()
        {
            return SolutionController.IsSocial()
                ? new List<IWebApiConnector> {LoginContentManager(), LoginCommunityManager(), LoginContentManager()}
                : new List<IWebApiConnector> {LoginContentManager(), LoginContentManager()};
        }

        /// <summary>
        /// Provides a list of Connectors for AnonymousUsers and Registered Users
        /// </summary>
        /// <remarks>This list should be used for doing security tests on API that are available for more privileged users</remarks>
        public static IList<IWebApiConnector> AnonymousAndRuLogins()
        {
            return new List<IWebApiConnector> { LoginRegisteredUser(), WebApiTestHelper.GetAnnonymousConnector() };
        }

        /// <summary>
        /// Creates a Comunity Manager and Logs that user in as well.
        /// Password used is same as that for Host. Existing user is used if it's already present.
        /// </summary>
        /// <returns>IWebApiConnector object to perform more actions</returns>
        public static IWebApiConnector LoginCommunityManager(string firstName = EvoqConstants.CmxFirstName, string lastName = EvoqConstants.CmxLastName, string url = null)
        {
            UserController.CreateCommunityManagerUser(firstName, lastName);
            return WebApiTestHelper.LoginRegisteredUser(firstName, lastName);
        }

        /// <summary>
        /// Creates acommunity manager and returns it's UserId. If user already exists, return's its UserId.
        /// </summary>
        public static int CreateCommunityManager(string firstName = EvoqConstants.CmxFirstName, string lastName = EvoqConstants.CmxLastName, string url = null)
        {
            return UserController.CreateCommunityManagerUser(firstName, lastName);
        }

        /// <summary>
        /// Creates a Content Manager and Logs that user in as well.
        /// Password used is same as that for Host. Existing user is used if it's already present.
        /// </summary>
        /// <returns>IWebApiConnector object to perform more actions</returns>
        public static IWebApiConnector LoginContentManager(string firstName = EvoqConstants.ConMgrFirstName, string lastName = EvoqConstants.ConMgrLastName, string url = null)
        {
            UserController.CreateContentManagerUser(firstName, lastName);
            return WebApiTestHelper.LoginUser(firstName + "." + lastName);
        }

        /// <summary>
        /// Creates a content managerr and returns it's UserId. If user already exists, return's its UserId.
        /// </summary>
        public static int CreateContentManager(string firstName = EvoqConstants.ConMgrFirstName, string lastName = EvoqConstants.ConMgrLastName, string url = null)
        {
            return UserController.CreateContentManagerUser(firstName, lastName);
        }

        public static IWebApiConnector LoginAdministrator(string firstName = EvoqConstants.AdministratorFirstName, string lastName = EvoqConstants.AdministratorLastName, string url = null)
        {
            UserController.CreateAdministratorUser(firstName, lastName);
            return WebApiTestHelper.LoginUser(firstName + "." + lastName);
        }

        public static IWebApiConnector LoginHost()
        {
            return WebApiTestHelper.LoginUser(AppConfigHelper.HostUserName);
        }

        public static IWebApiConnector LoginRegisteredUser(string firstName = IntegrationConstants.RuFirstName, string lastName = IntegrationConstants.RuLastName, string url = null)
        {
            UserController.CreateRegisteredUser(firstName, lastName);
            return WebApiTestHelper.LoginRegisteredUser(firstName, lastName);
        }

        public static int CreateAdministrator(string firstName = EvoqConstants.AdministratorFirstName, string lastName = EvoqConstants.AdministratorLastName, string url = null)
        {
            return UserController.CreateAdministratorUser(firstName, lastName);
        }

        /// <summary>
        /// Creates a Content Editor and Logs that user in as well.
        /// Password used is same as that for Host. Existing user is used if it's already present.
        /// </summary>
        /// <returns>IWebApiConnector object to perform more actions</returns>
        public static IWebApiConnector LoginContentEditor(string firstName = EvoqConstants.ConEdtFirstName, string lastName = EvoqConstants.ConEdtLastName, string url = null)
        {
            UserController.CreateContentEditorUser(firstName, lastName);
            return WebApiTestHelper.LoginUser(firstName + "." + lastName);
        }

        /// <summary>
        /// Creates a content editor and returns it's UserId. If user already exists, return's its UserId.
        /// </summary>
        public static int CreateContentEditor(string firstName = EvoqConstants.ConEdtFirstName, string lastName = EvoqConstants.ConEdtLastName, string url = null)
        {
            return UserController.CreateContentEditorUser(firstName, lastName);
        }

        public static int CreateRegisteredUser(string firstName = IntegrationConstants.RuFirstName, string lastName = IntegrationConstants.RuLastName, string url = null)
        {
            return UserController.CreateRegisteredUser(firstName, lastName);
        }
    }
}


text:
import requests
import shutil # to write raw images to file
import time
import os

url = "http://www.bing.com"
path = "/home/IBEO.AS/mem/Pictures/Wallpapers/Bing/"
current = "current"
ext = ".jpg"

# os.system(". /home/mewen/dev/scripts/get-wallpaper/discover_session_bus_address.sh")

# print "Ok, let's go"
# today = now.strftime("%Y-%m-%d")
try:
	r = requests.get(url, stream=True) # , params=payload, headers=headers, cookies=cookies, stream=True)
	if r.status_code == 200:
		imgUrl = r.content.split("g_img=")[1].split("'")[1] # /something....../imageName.jpg OR http://s.cn.bing.net/something....../imageName.jpg
		print imgUrl
		if imgUrl[0] is not "/" and imgUrl[0] is not "h":
			imgUrl = r.content.split("g_img=")[1].split("\"")[1]
			imgUrl = imgUrl.replace("\/", "/")
			if imgUrl[0] is not "/" and imgUrl[0] is not "h":
				print("Error in the img url : {0}".format(r.content.split("g_img=")[1][:100]))

		imgUrl = imgUrl.replace("\/", "/")

		fullImgUrl = imgUrl
		if imgUrl[0] is "/": # image hosted on http://www.bing.com
			fullImgUrl = url + imgUrl # http://www.bing.com/something....../imageName.jpg

		ext = "." + imgUrl.split(".")[-1] # .jpg
		fileName = ".".join(imgUrl.split(".")[:-1]).split("/")[-1] # imageName
		imgFile = path + fileName + ext # /home/usename/Images/Wallpapers/Bing/imageName.jpg

		# check if the background has changed
		if not os.path.exists(imgFile):
			# if not, than dowload it, dude !
			# print "Downloading " + fullImgUrl
			image = requests.get(fullImgUrl, stream=True)

			if image.status_code == 200:
				with open(imgFile, 'wb') as f:
					shutil.copyfileobj(image.raw, f)
				os.system("cp " + imgFile + " " + path + current + ext)
				# print "Image correctly downloaded at " + imgFile + " !"
				print "New wallpaper set"
				# time.sleep(0.2)
				# os.system("gsettings set org.gnome.desktop.background picture-uri file://" + imgFile)
			else:
				print "ERROR: Got {0} code from bing.".format(r.status_code)
		else:
			print "ERROR: Image already downloaded"
	else:
		print "ERROR: Got " + r.status_code + " code from bing."
except requests.exceptions.ConnectionError, e:
	# raise e
	print e #"No internet, so bad :/"

#print "Waiting a minute"
#time.sleep(60) # wait a minute


text:
<?php

declare(strict_types=1);

namespace Eloquent\Phony\Test;

interface TestInterfaceB extends TestInterfaceA
{
    public static function testClassBStaticMethodA();

    public function testClassBMethodA();

    public function testClassBMethodB(&$first, &$second);
}


text:
module.exports = ping;
ping.ping = ping;

ping.usage = "fhc ping <app-id> --env=<environment>";
ping.desc = "Ping a FeedHenry cloud app";

var log = require("../../utils/log");
var fhc = require("../../fhc");
var fhreq = require("../../utils/request");
var common = require("../../common");
var ini = require('../../utils/ini');

// Main ping entry point
function ping(argv, cb) {
  var args = argv._;
  if (args.length === 0) {
    return cb(ping.usage);
  }

  var appId = fhc.appId(args[0]);
  var deployTarget = ini.getEnvironment(argv);

  return pingApp(appId, deployTarget, cb);
}

function pingApp(appId, deployTarget, cb) {
  common.doApiCall(fhreq.getFeedHenryUrl(), "box/srv/1.1/ide/" + fhc.curTarget + "/app/ping", {guid: appId, deploytarget: deployTarget}, "Error pinging app: ", function (err, data) {
    if (err) return cb(err);
    log.info("Ping: " + data.ping_status);
    log.silly(data, "ping app");
    return cb(err, data);
  });
}

// bash completion
ping.completion = function (opts, cb) {
  common.getAppIds(cb);
};


text:
{% extends "shop/base.html" %}{% load url from future %}
{% load i18n %}

{% block navbar %}

{% trans "Home" %}

{% trans "Account" %}

{% trans "Update Profile" %}

{% endblock %}

{% block extra-head %}
{% include "contact/_contact_info_form.html" %}
{% endblock %}

{% block content %}

{% trans "Your Profile" %}

{% if form.non_field_errors %}

{% trans "Please correct the following error:" %}

{{ form.non_field_errors }}
{% endif %}
<form method="post" action="{% url 'satchmo_profile_update' %}">{% csrf_token %}
{{ form.next }}

{% trans "You'll need to fill out at least the fields with a *" %}

{% trans "Basic Information" %}

{% trans "Email address" %}{% if form.email.field.required %}*{% endif %}	 {{ form.email }}

    {% if form.email.errors %}
 	*** {{ form.email.errors|join:", " }}
{% endif %}

{% trans "First name" %}{% if form.first_name.field.required %}*{% endif %}	 {{ form.first_name }}

   {% if form.first_name.errors %}
 	*** {{ form.first_name.errors|join:", " }}
{% endif %}

{% trans "Last name" %}{% if form.last_name.field.required %}*{% endif %}	 {{ form.last_name }}

    {% if form.last_name.errors %}
 	*** {{ form.last_name.errors|join:", " }}
{% endif %}

{% trans "Organization" %}{% if form.organization.field.required %}*{% endif %}	 {{ form.organization }}

    {% if form.organization.errors %}
 	*** {{ form.organization.errors|join:", " }}
{% endif %}

{% trans "Birthday" %}{% if form.dob.field.required %}*{% endif %}	 {{ form.dob }}

    {% if form.dob.errors %}
 	*** {{ form.dob.errors|join:", " }}
{% endif %}

{% trans "Phone number" %}{% if form.phone.field.required %}*{% endif %}	 {{ form.phone }}

    {% if form.phone.errors %}
 	*** {{ form.phone.errors|join:", " }}
{% endif %}

    {% if show_newsletter %}

{% trans "Newsletter" %}{% if form.newsletter.field.required %}*{% endif %}	 {{ form.newsletter }}

    {% if form.newsletter.errors %}
 	*** {{ form.newsletter.errors|join:", " }}
{% endif %}
    {% else %}
    <input type='hidden' name='newsletter' value="False" />
    {% endif %}

    {% block billing-info %}{% include "contact/_contact_info_form_billing.html" %}{% endblock %}

    {% block shipping-info %}{% include "contact/_contact_info_form_shipping.html" %}{% endblock %}

	<input type="submit" value="{% trans "Update" %}"/>

</form>
{% endblock %}


text:
// Copyright 2016 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.google.devtools.build.lib.windows.jni;

/** Process management on Windows. */
public class WindowsProcesses {
  public static final long INVALID = -1;

  private WindowsProcesses() {
    // Prevent construction
  }

  /**
   * Creates a process with the specified Windows command line.
   *
   *
Appropriately quoting arguments is the responsibility of the caller.
   *
   * @param argv0 the binary to run; must be unquoted; must be either an absolute, normalized
   *     Windows path with a drive letter (e.g. "c:\foo\bar app.exe") or a single file name (e.g.
   *     "foo app.exe")
   * @param argvRest the rest of the command line, i.e. argv[1:] (needs to be quoted Windows style)
   * @param env the environment of the new process. null means inherit that of the Bazel server
   * @param cwd the working directory of the new process. if null, the same as that of the current
   *     process
   * @param stdoutFile the file the stdout should be redirected to. if null, nativeReadStdout will
   *     work.
   * @param stderrFile the file the stdout should be redirected to. if null, nativeReadStderr will
   *     work.
   * @param redirectErrorStream whether we merge the process's standard error and standard output.
   * @return the opaque identifier of the created process
   */
  public static long createProcess(
      String argv0,
      String argvRest,
      byte[] env,
      String cwd,
      String stdoutFile,
      String stderrFile,
      boolean redirectErrorStream) {
    WindowsJniLoader.loadJni();
    return nativeCreateProcess(
        argv0, argvRest, env, cwd, stdoutFile, stderrFile, redirectErrorStream);
  }

  public static long createProcess(
      String argv0, String argvRest, byte[] env, String cwd, String stdoutFile, String stderrFile) {
    WindowsJniLoader.loadJni();
    return nativeCreateProcess(argv0, argvRest, env, cwd, stdoutFile, stderrFile, false);
  }

  private static native long nativeCreateProcess(
      String argv0,
      String argvRest,
      byte[] env,
      String cwd,
      String stdoutFile,
      String stderrFile,
      boolean redirectErrorStream);

  /**
   * Writes data from the given array to the stdin of the specified process.
   *
   *
Blocks until either some data was written or the process is terminated.
   *
   * @return the number of bytes written
   */
  public static int writeStdin(long process, byte[] bytes, int offset, int length) {
    WindowsJniLoader.loadJni();
    return nativeWriteStdin(process, bytes, offset, length);
  }

  private static native int nativeWriteStdin(long process, byte[] bytes, int offset, int length);

  /** Returns an opaque identifier of stdout stream for the process. */
  public static long getStdout(long process) {
    WindowsJniLoader.loadJni();
    return nativeGetStdout(process);
  }

  private static native long nativeGetStdout(long process);

  /** Returns an opaque identifier of stderr stream for the process. */
  public static long getStderr(long process) {
    WindowsJniLoader.loadJni();
    return nativeGetStderr(process);
  }

  private static native long nativeGetStderr(long process);

  /**
   * Reads data from the stream into the given array. {@code stream} should come from {@link
   * #nativeGetStdout(long)} or {@link #nativeGetStderr(long)}.
   *
   *
Blocks until either some data was read or the process is terminated.
   *
   * @return the number of bytes read, 0 on EOF, or -1 if there was an error.
   */
  public static int readStream(long stream, byte[] bytes, int offset, int length) {
    WindowsJniLoader.loadJni();
    return nativeReadStream(stream, bytes, offset, length);
  }

  private static native int nativeReadStream(long stream, byte[] bytes, int offset, int length);

  /**
   * Waits until the given process terminates. If timeout is non-negative, it indicates the number
   * of milliseconds before the call times out.
   *
   *
Return values:
   *
0: Process finished
   *
1: Timeout
   *
2: Something went wrong
   */
  public static int waitFor(long process, long timeout) {
    WindowsJniLoader.loadJni();
    return nativeWaitFor(process, timeout);
  }

  private static native int nativeWaitFor(long process, long timeout);

  /**
   * Returns the exit code of the process. Throws {@code IllegalStateException} if something goes
   * wrong.
   */
  public static int getExitCode(long process) {
    WindowsJniLoader.loadJni();
    return nativeGetExitCode(process);
  }

  private static native int nativeGetExitCode(long process);

  /** Returns the process ID of the given process or -1 if there was an error. */
  public static int getProcessPid(long process) {
    WindowsJniLoader.loadJni();
    return nativeGetProcessPid(process);
  }

  private static native int nativeGetProcessPid(long process);

  /** Terminates the given process. Returns true if the termination was successful. */
  public static boolean terminate(long process) {
    WindowsJniLoader.loadJni();
    return nativeTerminate(process);
  }

  private static native boolean nativeTerminate(long process);

  /**
   * Releases the native data structures associated with the process.
   *
   *
Calling any other method on the same process after this call will result in the JVM crashing
   * or worse.
   */
  public static void deleteProcess(long process) {
    WindowsJniLoader.loadJni();
    nativeDeleteProcess(process);
  }

  private static native void nativeDeleteProcess(long process);

  /**
   * Closes the stream
   *
   * @param stream should come from {@link #nativeGetStdout(long)} or {@link
   *     #nativeGetStderr(long)}.
   */
  public static void closeStream(long stream) {
    WindowsJniLoader.loadJni();
    nativeCloseStream(stream);
  }

  private static native void nativeCloseStream(long stream);

  /**
   * Returns a string representation of the last error caused by any call on the given process or
   * the empty string if the last operation was successful.
   *
   *
Does NOT terminate the process if it is still running.
   *
   *
After this call returns, subsequent calls will return the empty string if there was no
   * failed operation in between.
   */
  public static String processGetLastError(long process) {
    WindowsJniLoader.loadJni();
    return nativeProcessGetLastError(process);
  }

  private static native String nativeProcessGetLastError(long process);

  public static String streamGetLastError(long process) {
    WindowsJniLoader.loadJni();
    return nativeStreamGetLastError(process);
  }

  private static native String nativeStreamGetLastError(long process);

  /** returns the PID of the current process. */
  public static int getpid() {
    WindowsJniLoader.loadJni();
    return nativeGetpid();
  }

  private static native int nativeGetpid();
}


text:
@implementation SCNoAuthMethod

- (BOOL)authFromCache {
  return YES;
}

- (BOOL)authenticate:(NSString *)u password:(NSString *)p {
  return YES;
}

- (NSString *)xAccessToken {
  return nil;
}

- (void)logout {
}

- (NSString *)username {
  return nil;
}

@end


text:
exports.info = { FormatID: '725',
  FormatName: 'Drawing Interchange File Format (ASCII)',
  FormatVersion: '2004/2005/2006',
  FormatAliases: 'ASCII DXF (2004-2005)',
  FormatFamilies: 'DXF',
  FormatTypes: 'Image (Vector)',
  FormatDisclosure: 'Full',
  FormatDescription: 'ASCII DXF format is the ASCII encoded variant of the Drawing Interchange File Format, an exchange format for vector graphics developed by AutoDesk. They are probably the widely-used formats for exchanging vector data, and have become a de-facto industry standard. The format is owned by AutoDesk and typically changes with each release of their AutoCAD family of products. DXF files contain a tagged representation of the vector data. The structure comprises a Header section, followed by sections containing data on Classes, Tables, Blocks, Entities and, optionally, thumbnail images. Each section contains a series of data elements. each preceded by a group code tag, which indicates the type of data element. ASCII DXF version 2004-2005 is the version of the format associated with Releases 2004 and 2005 of the AutoCAD family of software products.',
  BinaryFileFormat: 'Text',
  ByteOrders: '',
  ReleaseDate: '01 Mar 2003',
  WithdrawnDate: '',
  ProvenanceSourceID: '1',
  ProvenanceName: 'Digital Preservation Department / The National Archives',
  ProvenanceSourceDate: '11 Mar 2005',
  ProvenanceDescription: '',
  LastUpdatedDate: '06 Nov 2012',
  FormatNote: '',
  FormatRisk: '',
  TechnicalEnvironment: '',
  FileFormatIdentifier:
   [ { Identifier: 'fmt/79', IdentifierType: 'PUID' },
     { Identifier: 'image/vnd.dxf', IdentifierType: 'MIME' } ],
  Document:
   { DocumentID: '9',
     DisplayText: 'Autodesk Corporation, 2003, AutoCAD 2004: DXF reference',
     DocumentType: 'Authoritative',
     AvailabilityDescription: 'Public',
     AvailabilityNote: '',
     PublicationDate: '01 Feb 2003',
     TitleText: 'AutoCAD 2004: DXF reference',
     DocumentIPR: '',
     DocumentNote: '',
     Author:
      { AuthorID: '18',
        AuthorName: '',
        OrganisationName: 'Autodesk Corporation',
        AuthorCompoundName: 'Autodesk Corporation' },
     Publisher:
      { PublisherID: '18',
        PublisherName: '',
        OrganisationName: 'Autodesk Corporation',
        PublisherCompoundName: 'Autodesk Corporation' } },
  ExternalSignature:
   { ExternalSignatureID: '568',
     Signature: 'dxf',
     SignatureType: 'File extension' },
  InternalSignature:
   [ { SignatureID: '114',
       SignatureName: 'Drawing Interchange File Format 2004/2005/2006',
       SignatureNote: 'Header section with $ACADVER group code, EOF marker',
       ByteSequence:
        [ { ByteSequenceID: '19',
            PositionType: 'Variable',
            Offset: '',
            MaxOffset: '',
            IndirectOffsetLocation: '',
            IndirectOffsetLength: '',
            Endianness: '',
            ByteSequenceValue: '300D0A53454354494F4E0D0A2020320D0A4845414445520D0A*390D0A24414341445645520D0A2020310D0A4143313031380D0A*300D0A454E445345430D0A' },
          { ByteSequenceID: '20',
            PositionType: 'Absolute from EOF',
            Offset: '0',
            MaxOffset: '',
            IndirectOffsetLocation: '',
            IndirectOffsetLength: '',
            Endianness: '',
            ByteSequenceValue: '300D0A454F460D0A' } ] },
     { SignatureID: '687',
       SignatureName: 'Drawing Interchange File Format 2004/2005/2006 (0A)',
       SignatureNote: 'Replaces 0D0A in original signature with 0A to accommodate files with this variation.',
       ByteSequence:
        [ { ByteSequenceID: '849',
            PositionType: 'Variable',
            Offset: '',
            MaxOffset: '',
            IndirectOffsetLocation: '',
            IndirectOffsetLength: '',
            Endianness: '',
            ByteSequenceValue: '300A53454354494F4E0A2020320A4845414445520A*390A24414341445645520A2020310A4143313031380A*300A454E445345430A' },
          { ByteSequenceID: '850',
            PositionType: 'Absolute from EOF',
            Offset: '',
            MaxOffset: '',
            IndirectOffsetLocation: '',
            IndirectOffsetLength: '',
            Endianness: '',
            ByteSequenceValue: '300A454F460A' } ] } ],
  RelatedFormat:
   [ { RelationshipType: 'Equivalent to',
       RelatedFormatID: '744',
       RelatedFormatName: 'Drawing Interchange File Format (Binary)',
       RelatedFormatVersion: '2004-2005' },
     { RelationshipType: 'Has priority over',
       RelatedFormatID: '709',
       RelatedFormatName: 'AutoCAD Drawing',
       RelatedFormatVersion: '2004-2005' },
     { RelationshipType: 'Has priority over',
       RelatedFormatID: '766',
       RelatedFormatName: 'Drawing Interchange File Format (ASCII)',
       RelatedFormatVersion: 'Generic' },
     { RelationshipType: 'Is subsequent version of',
       RelatedFormatID: '724',
       RelatedFormatName: 'Drawing Interchange File Format (ASCII)',
       RelatedFormatVersion: '2000-2002' } ] }


text:
Copyright 2017 - 2021 viral32111

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
---------------------------------------------------------------------------]]

if ( SERVER ) then return end

UserGroups = {
	"superadmin",
	"admin",
	"operator",
	"user"
}

--[[-------------------------------------------------------------------------
Menu
---------------------------------------------------------------------------]]
net.Receive( "ViralsScoreboardAdmin", function()
	local Config = net.ReadTable()
	local DisplayConfig = net.ReadTable()
	local GroupConfig = net.ReadTable()
	local UserConfig = net.ReadTable()

	local ViralsScoreboardSpecialsBase = vgui.Create( "DFrame" ) -- Create it before the main menu so it can be closed

	--[[-------------------------------------------------------------------------
	Admin
	---------------------------------------------------------------------------]]
	local ViralsScoreboardAdminBase = vgui.Create( "DFrame" )
	ViralsScoreboardAdminBase:SetSize( 400, 300 )
	ViralsScoreboardAdminBase:SetTitle( "Viral's Scoreboard Admin" )
	ViralsScoreboardAdminBase:SetDraggable( false )
	ViralsScoreboardAdminBase:SetSizable( false )
	ViralsScoreboardAdminBase:ShowCloseButton( true )
	ViralsScoreboardAdminBase:Center()
	ViralsScoreboardAdminBase:MakePopup()
	function ViralsScoreboardAdminBase:OnClose()
		ViralsScoreboardSpecialsBase:Remove()
	end

	--[[-------------------------------------------------------------------------
	Specials
	---------------------------------------------------------------------------]]
	ViralsScoreboardSpecialsBase:SetSize( 200, 280 )
	ViralsScoreboardSpecialsBase:SetPos( ScrW()/2+220, ScrH()/2-140 )
	ViralsScoreboardSpecialsBase:SetTitle( "Specials & Information" )
	ViralsScoreboardSpecialsBase:SetDraggable( false )
	ViralsScoreboardSpecialsBase:SetSizable( false )
	ViralsScoreboardSpecialsBase:ShowCloseButton( false )
	ViralsScoreboardSpecialsBase:MakePopup()

	local ViralsScoreboardSpecialsLabel = vgui.Create( "DLabel", ViralsScoreboardSpecialsBase )
	ViralsScoreboardSpecialsLabel:SetPos( 10, 30 )
	ViralsScoreboardSpecialsLabel:SetText( "These can be used in the 'Text' tab.\n{Hostname} - Gets the server name\n{Map} - Gets the current map name\n{IP} - Gets the server IP\n{MaxPlayers} - Gets server slots\n{Players} - Gets player count\n{Gamemode} - Gets the gamemode\n\nFor any changes to be applied the\nserver needs to reboot.\n\nFor Group, Misc, Team and Per-User\nconfigs use the main config file." )
	ViralsScoreboardSpecialsLabel:SizeToContents()

	--[[-------------------------------------------------------------------------
	Admin Tabs
	---------------------------------------------------------------------------]]
	local ViralsScoreboardAdminTabs = vgui.Create( "DPropertySheet", ViralsScoreboardAdminBase )
	ViralsScoreboardAdminTabs:Dock( FILL )

	local TextConfigTab = vgui.Create( "DPanel", ViralsScoreboardAdminTabs )
	function TextConfigTab:Paint( w, h )
		draw.RoundedBox( 0, 0, 0, w, h, Color( 157, 160, 165 ) )
	end
	ViralsScoreboardAdminTabs:AddSheet( "Text", TextConfigTab, "icon16/textfield_rename.png" )

	local ColorsConfigTab = vgui.Create( "DPanel", ViralsScoreboardAdminTabs )
	function ColorsConfigTab:Paint( w, h )
		draw.RoundedBox( 0, 0, 0, w, h, Color( 157, 160, 165 ) )
	end
	ViralsScoreboardAdminTabs:AddSheet( "Colors", ColorsConfigTab, "icon16/palette.png" )

	--[[local GroupsConfigTab = vgui.Create( "DPanel", ViralsScoreboardAdminTabs )
	function GroupsConfigTab:Paint( w, h )
		draw.RoundedBox( 0, 0, 0,w, h, Color( 157, 160, 165 ) )
	end
	ViralsScoreboardAdminTabs:AddSheet( "Groups", GroupsConfigTab, "icon16/user.png" )

	local PerUserConfigTab = vgui.Create( "DPanel", ViralsScoreboardAdminTabs )
	function PerUserConfigTab:Paint( w, h )
		draw.RoundedBox( 0, 0, 0, w, h, Color( 157, 160, 165 ) )
	end
	ViralsScoreboardAdminTabs:AddSheet( "Per-User", PerUserConfigTab, "icon16/user_edit.png" )]]

	local DisplayConfigTab = vgui.Create( "DPanel", ViralsScoreboardAdminTabs )
	function DisplayConfigTab:Paint( w, h )
		draw.RoundedBox( 0, 0, 0, w, h, Color( 157, 160, 165 ) )
	end
	ViralsScoreboardAdminTabs:AddSheet( "Display", DisplayConfigTab, "icon16/eye.png" )

	--[[local MiscConfigTab = vgui.Create( "DPanel", ViralsScoreboardAdminTabs )
	function MiscConfigTab:Paint( w, h )
		draw.RoundedBox( 0, 0, 0, w, h, Color( 157, 160, 165 ) )
	end
	ViralsScoreboardAdminTabs:AddSheet( "Misc", MiscConfigTab, "icon16/cog.png" )]]

	--[[-------------------------------------------------------------------------
	Text Config
	---------------------------------------------------------------------------]]
	-- Title
	local ViralsScoreboardAdminLabel = vgui.Create( "DLabel", TextConfigTab )
	ViralsScoreboardAdminLabel:SetPos( 10, 0 ) -- +45
	ViralsScoreboardAdminLabel:SetText( "Title (Specials can be used)" )
	ViralsScoreboardAdminLabel:SizeToContents()
	local ViralsScoreboardAdminTitleTextEntry = vgui.Create( "DTextEntry", TextConfigTab )
	ViralsScoreboardAdminTitleTextEntry:SetPos( 10, 17 )
	ViralsScoreboardAdminTitleTextEntry:SetSize( 350, 20 )
	ViralsScoreboardAdminTitleTextEntry:SetText( string.Explode( ";", Config[1] )[1] )

	-- Sub Title
	local ViralsScoreboardAdminLabel = vgui.Create( "DLabel", TextConfigTab )
	ViralsScoreboardAdminLabel:SetPos( 10, 45 )
	ViralsScoreboardAdminLabel:SetText( "Sub Title (Specials can be used)" )
	ViralsScoreboardAdminLabel:SizeToContents()
	local ViralsScoreboardAdminSubtitleTextEntry = vgui.Create( "DTextEntry", TextConfigTab )
	ViralsScoreboardAdminSubtitleTextEntry:SetPos( 10, 62 )
	ViralsScoreboardAdminSubtitleTextEntry:SetSize( 350, 20 )
	ViralsScoreboardAdminSubtitleTextEntry:SetText( string.Explode( ";", Config[1] )[2] )

	-- Dead Append
	local ViralsScoreboardAdminLabel = vgui.Create( "DLabel", TextConfigTab )
	ViralsScoreboardAdminLabel:SetPos( 10, 90 )
	ViralsScoreboardAdminLabel:SetText( "Dead Append Text" )
	ViralsScoreboardAdminLabel:SizeToContents()
	local ViralsScoreboardAdminDeadAppendTextEntry = vgui.Create( "DTextEntry", TextConfigTab )
	ViralsScoreboardAdminDeadAppendTextEntry:SetPos( 10, 107 )
	ViralsScoreboardAdminDeadAppendTextEntry:SetSize( 350, 20 )
	ViralsScoreboardAdminDeadAppendTextEntry:SetText( string.Explode( ";", Config[2] )[1] )

	--[[-------------------------------------------------------------------------
	Color Config
	---------------------------------------------------------------------------]]
	-- Dead Color
	local ViralsScoreboardAdminLabel = vgui.Create( "DLabel", ColorsConfigTab )
	ViralsScoreboardAdminLabel:SetPos( 10, 0 )
	ViralsScoreboardAdminLabel:SetText( "Dead Append Text Color" )
	ViralsScoreboardAdminLabel:SizeToContents()
	local ViralsScoreboardAdminDeadColorMixer = vgui.Create( "DColorMixer", ColorsConfigTab )
	ViralsScoreboardAdminDeadColorMixer:SetPos( 10, 20 )
	ViralsScoreboardAdminDeadColorMixer:SetSize( 350, 68 )
	ViralsScoreboardAdminDeadColorMixer:SetPalette( false )
	ViralsScoreboardAdminDeadColorMixer:SetAlphaBar( false )
	ViralsScoreboardAdminDeadColorMixer:SetWangs( true )
	ViralsScoreboardAdminDeadColorMixer:SetColor( string.ToColor( string.Explode( ";", Config[2] )[2] ) )

	-- Alive Color
	local ViralsScoreboardAdminLabel = vgui.Create( "DLabel", ColorsConfigTab )
	ViralsScoreboardAdminLabel:SetPos( 10, 100 )
	ViralsScoreboardAdminLabel:SetText( "Alive Text Color" )
	ViralsScoreboardAdminLabel:SizeToContents()
	local ViralsScoreboardAdminAliveColorMixer = vgui.Create( "DColorMixer", ColorsConfigTab )
	ViralsScoreboardAdminAliveColorMixer:SetPos( 10, 120 )
	ViralsScoreboardAdminAliveColorMixer:SetSize( 350, 68 )
	ViralsScoreboardAdminAliveColorMixer:SetPalette( false )
	ViralsScoreboardAdminAliveColorMixer:SetAlphaBar( false )
	ViralsScoreboardAdminAliveColorMixer:SetWangs( true )
	ViralsScoreboardAdminAliveColorMixer:SetColor( string.ToColor( string.Explode( ";", Config[2] )[3] ) )

	--[[-------------------------------------------------------------------------
	Groups Config
	---------------------------------------------------------------------------]]
	--[[local ViralsScoreboardAdminRanksLabel = vgui.Create( "DLabel", GroupsConfigTab )
	ViralsScoreboardAdminRanksLabel:SetPos( 10, 0 )
	ViralsScoreboardAdminRanksLabel:SetText( "Rank Ordering and Configuration" )
	ViralsScoreboardAdminRanksLabel:SizeToContents()

	local ViralsScoreboardAdminScroll = vgui.Create( "DScrollPanel", GroupsConfigTab )
	ViralsScoreboardAdminScroll:SetPos( 20, 20 )
	ViralsScoreboardAdminScroll:SetSize( 170, 155 )

	local ViralsScoreboardAdminLayout = vgui.Create( "DListLayout", GroupsConfigTab )
	ViralsScoreboardAdminLayout:Dock( FILL )
	ViralsScoreboardAdminLayout:SetPaintBackground( false )
	ViralsScoreboardAdminLayout:SetBackgroundColor( Color( 0, 100, 100 ) )
	ViralsScoreboardAdminLayout:MakeDroppable( "ViralsScoreboardAdminLayout" )]]

	--[[for k, v in pairs( UserGroups ) do
		ViralsScoreboardAdminLayout:Add( Label( v .. " [" .. k .. "]" ) )
	end]]

	--[[-------------------------------------------------------------------------
	Per-User Config
	---------------------------------------------------------------------------]]

	--[[-------------------------------------------------------------------------
	Display Config
	---------------------------------------------------------------------------]]
	local DisplayAvatar = vgui.Create( "DCheckBoxLabel", DisplayConfigTab )
	DisplayAvatar:SetPos( 10, 10 )
	DisplayAvatar:SetText( "Display Avatars?" )
	DisplayAvatar:SetValue( tonumber( DisplayConfig[1] ) )
	DisplayAvatar:SizeToContents()

	local DisplayGroups = vgui.Create( "DCheckBoxLabel", DisplayConfigTab )
	DisplayGroups:SetPos( 10, 30 )
	DisplayGroups:SetText( "Display Groups?" )
	DisplayGroups:SetValue( tonumber( DisplayConfig[2] ) )
	DisplayGroups:SizeToContents()

	local DisplayKills = vgui.Create( "DCheckBoxLabel", DisplayConfigTab )
	DisplayKills:SetPos( 10, 50 )
	DisplayKills:SetText( "Display Kills?" )
	DisplayKills:SetValue( tonumber( DisplayConfig[3] ) )
	DisplayKills:SizeToContents()

	local DisplayDeaths = vgui.Create( "DCheckBoxLabel", DisplayConfigTab )
	DisplayDeaths:SetPos( 10, 70 )
	DisplayDeaths:SetText( "Display Deaths?" )
	DisplayDeaths:SetValue( tonumber( DisplayConfig[4] ) )
	DisplayDeaths:SizeToContents()

	local DisplayPing = vgui.Create( "DCheckBoxLabel", DisplayConfigTab )
	DisplayPing:SetPos( 10, 90 )
	DisplayPing:SetText( "Display Ping?" )
	DisplayPing:SetValue( tonumber( DisplayConfig[5] ) )
	DisplayPing:SizeToContents()

	--[[-------------------------------------------------------------------------
	Misc Config
	---------------------------------------------------------------------------]]
	-- Title
	--[[local TitleFont = vgui.Create( "DLabel", MiscConfigTab )
	TitleFont:SetPos( 10, 0 )
	TitleFont:SetText( "Title Font (Reboot required for change)" )
	TitleFont:SizeToContents()
	local TitleFontText = vgui.Create( "DTextEntry", MiscConfigTab )
	TitleFontText:SetPos( 10, 17 )
	TitleFontText:SetSize( 350, 20 )
	TitleFontText:SetText( string.Explode( ";", Config[4] )[1] )

	-- Sub Title
	local SubTitleFont = vgui.Create( "DLabel", MiscConfigTab )
	SubTitleFont:SetPos( 10, 45 )
	SubTitleFont:SetText( "Sub Title Font (Reboot required for change)" )
	SubTitleFont:SizeToContents()
	local SubTitleFontText = vgui.Create( "DTextEntry", MiscConfigTab )
	SubTitleFontText:SetPos( 10, 62 )
	SubTitleFontText:SetSize( 350, 20 )
	SubTitleFontText:SetText( string.Explode( ";", Config[4] )[2] )

	-- Player Row Font
	local PlayerRowFont = vgui.Create( "DLabel", MiscConfigTab )
	PlayerRowFont:SetPos( 10, 90 )
	PlayerRowFont:SetText( "Player Row Font (Reboot required for change)" )
	PlayerRowFont:SizeToContents()
	local PlayerRowFontText = vgui.Create( "DTextEntry", MiscConfigTab )
	PlayerRowFontText:SetPos( 10, 107 )
	PlayerRowFontText:SetSize( 350, 20 )
	PlayerRowFontText:SetText( string.Explode( ";", Config[4] )[3] )]]

	--[[-------------------------------------------------------------------------
	Save Button
	---------------------------------------------------------------------------]]
	local ViralsScoreboardAdminSaveButton = vgui.Create( "DButton", ViralsScoreboardAdminBase )
	ViralsScoreboardAdminSaveButton:Dock( BOTTOM )
	ViralsScoreboardAdminSaveButton:DockMargin( 0, 5, 0, 0 )
	ViralsScoreboardAdminSaveButton:SetText( "Save" )
	function ViralsScoreboardAdminSaveButton:DoClick()
		local DisplayConfigOptions = string.Replace( tostring( DisplayAvatar:GetChecked() ) .. ";" .. tostring( DisplayGroups:GetChecked() ) .. ";" .. tostring( DisplayKills:GetChecked() ) .. ";" .. tostring( DisplayDeaths:GetChecked() ) .. ";" .. tostring( DisplayPing:GetChecked() ), "true", "1" )
		local DisplayConfigOptions = string.Replace( DisplayConfigOptions, "false", "0" )

		net.Start("ViralsScoreboardAdmin")
			net.WriteString( ViralsScoreboardAdminTitleTextEntry:GetValue() .. ";" .. ViralsScoreboardAdminSubtitleTextEntry:GetValue() .. "\n" .. ViralsScoreboardAdminDeadAppendTextEntry:GetValue() .. ";" .. tostring( Color( ViralsScoreboardAdminDeadColorMixer:GetColor().r, ViralsScoreboardAdminDeadColorMixer:GetColor().g, ViralsScoreboardAdminDeadColorMixer:GetColor().b ) ) .. ";" .. tostring( Color( ViralsScoreboardAdminAliveColorMixer:GetColor().r, ViralsScoreboardAdminAliveColorMixer:GetColor().g, ViralsScoreboardAdminAliveColorMixer:GetColor().b ) ) )
			net.WriteString( DisplayConfigOptions )
			--net.WriteString( "superadmin;admin;operator;user\nSuper Admin;Admin;Operator;Guest\nColor( 255, 145, 30 );Color( 255, 35, 61 );Color( 29, 221, 0 );Color( 0, 209, 221 )\n4;3;2;1" )
			--net.WriteString( "false;\nSTEAM_0:1:104283773;Color( 100, 160, 61 );STEAM_0:1:104283773;Color( 0, 255, 0 )" )
		net.SendToServer()
		ViralsScoreboardAdminBase:Close()
	end
end )


text:
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.

using System;
using System.Diagnostics;
using OpenLiveWriter.Mshtml;

namespace OpenLiveWriter.HtmlEditor.Marshalling
{
    public class BoldTextStyle : TextStyle, IEquatable<BoldTextStyle>
    {
        public BoldTextStyle(bool bold)
        {
            Bold = bold;
        }

        public bool Bold { get; private set; }

        public override void Apply(MshtmlMarkupServices markupServices, MarkupRange markupRange, MshtmlCoreCommandSet commands)
        {
            if (!commands[IDM.BOLD].Enabled)
            {
                return;
            }

            BoldApplier boldApplier = new BoldApplier(markupServices, markupRange, commands[IDM.BOLD]);
            boldApplier.Execute();
        }

        public override bool Equals(TextStyle obj)
        {
            return Equals(obj as BoldTextStyle);
        }

        public bool Equals(BoldTextStyle obj)
        {
            if ((object)obj == null)
            {
                return false;
            }

            return Bold.Equals(obj.Bold);
        }

        public override int GetHashCode()
        {
            return Bold.GetHashCode();
        }
    }

}


text:
var EventEmitter = require('events').EventEmitter;
var util = require('util');

function GenericDimension(connection, handle) {
    this.connection = connection;
    this.handle = handle;
    EventEmitter.call(this);
};
util.inherits(GenericDimension, EventEmitter);

GenericDimension.prototype.getLayout = function() {
    return this.connection.ask(this.handle, 'GetLayout', arguments).then(function(msg) {
        return msg.qLayout;
    });
};
GenericDimension.prototype.applyPatches = function(Patches) {
    return this.connection.ask(this.handle, 'ApplyPatches', arguments);
};
GenericDimension.prototype.setProperties = function(Prop) {
    return this.connection.ask(this.handle, 'SetProperties', arguments);
};
GenericDimension.prototype.getProperties = function() {
    return this.connection.ask(this.handle, 'GetProperties', arguments).then(function(msg) {
        return msg.qProp;
    });
};
GenericDimension.prototype.getInfo = function() {
    return this.connection.ask(this.handle, 'GetInfo', arguments).then(function(msg) {
        return msg.qInfo;
    });
};
GenericDimension.prototype.getDimension = function() {
    return this.connection.ask(this.handle, 'GetDimension', arguments).then(function(msg) {
        return msg.qDim;
    });
};
GenericDimension.prototype.getLinkedObjects = function() {
    return this.connection.ask(this.handle, 'GetLinkedObjects', arguments).then(function(msg) {
        return msg.qItems;
    });
};
GenericDimension.prototype.publish = function() {
    return this.connection.ask(this.handle, 'Publish', arguments);
};
GenericDimension.prototype.unPublish = function() {
    return this.connection.ask(this.handle, 'UnPublish', arguments);
};
module.exports = GenericDimension;