text:
proxychains CHANGELOG
=====================

This file is used to list changes made in each version of the proxychains cookbook.

0.2.0
-----
- Fixed node attributes access
- Updated CI tools

0.1.0
-----
- Initial release of proxychains cookbook


text:
<?php

namespace Hamdrew\AdventOfCode\Day5;

use Hamdrew\AdventOfCode\Solution;

/**
 * Solution for Day 5
 */
class SolutionDay5 extends Solution
{

    /**
     * @inheritDoc
     */
    public function part1()
    {
        return strval(
            NiceStringCounter::niceStringCount(
                $this->getStrings(),
                new NiceStringAnalyserPart1()
            )
        );
    }

    /**
     * @inheritDoc
     */
    public function part2()
    {
        return strval(
            NiceStringCounter::niceStringCount(
                $this->getStrings(),
                new NiceStringAnalyserPart2()
            )
        );
    }

    /**
     * Returns array of strings from problem input
     * @return string[]
     */
    private function getStrings()
    {
        return preg_split('/\n/', $this->inputProvider->getInputFromFileForDay(5));
    }
}

redpajama_set_name: RedPajamaGithub


text:
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Filters;

public class HttpGlobalExceptionFilter : IExceptionFilter
{
    private readonly IWebHostEnvironment env;
    private readonly ILogger<HttpGlobalExceptionFilter> logger;

    public HttpGlobalExceptionFilter(IWebHostEnvironment env, ILogger<HttpGlobalExceptionFilter> logger)
    {
        this.env = env;
        this.logger = logger;
    }

    public void OnException(ExceptionContext context)
    {
        logger.LogError(new EventId(context.Exception.HResult),
            context.Exception,
            context.Exception.Message);

        if (context.Exception.GetType() == typeof(OrderingDomainException))
        {
            var problemDetails = new ValidationProblemDetails()
            {
                Instance = context.HttpContext.Request.Path,
                Status = StatusCodes.Status400BadRequest,
                Detail = "Please refer to the errors property for additional details."
            };

            problemDetails.Errors.Add("DomainValidations", new string[] { context.Exception.Message.ToString() });

            context.Result = new BadRequestObjectResult(problemDetails);
            context.HttpContext.Response.StatusCode = (int)HttpStatusCode.BadRequest;
        }
        else
        {
            var json = new JsonErrorResponse
            {
                Messages = new[] { "An error occur.Try it again." }
            };

            if (env.IsDevelopment())
            {
                json.DeveloperMessage = context.Exception;
            }

            // Result asigned to a result object but in destiny the response is empty. This is a known bug of .net core 1.1
            // It will be fixed in .net core 1.1.2. See https://github.com/aspnet/Mvc/issues/5594 for more information
            context.Result = new InternalServerErrorObjectResult(json);
            context.HttpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
        }
        context.ExceptionHandled = true;
    }

    private class JsonErrorResponse
    {
        public string[] Messages { get; set; }

        public object DeveloperMessage { get; set; }
    }
}


text:
:root {
  font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 24px;
  font-weight: 400;

  color-scheme: light dark;
  color: rgba(255, 255, 255, 0.87);
  background-color: #242424;

  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

body {
	margin: 2rem 1rem;
}


text:
package ledis

import (
	"bytes"
	"errors"
	"github.com/siddontang/go/log"
	"github.com/siddontang/go/snappy"
	"github.com/siddontang/ledisdb/rpl"
	"github.com/siddontang/ledisdb/store"
	"io"
	"time"
)

const (
	maxReplLogSize = 1 * 1024 * 1024
)

var (
	ErrLogMissed = errors.New("log is pured in server")
)

func (l *Ledis) ReplicationUsed() bool {
	return l.r != nil
}

func (l *Ledis) handleReplication() error {
	l.wLock.Lock()
	defer l.wLock.Unlock()

	l.rwg.Add(1)
	rl := &rpl.Log{}
	var err error
	for {
		if err = l.r.NextNeedCommitLog(rl); err != nil {
			if err != rpl.ErrNoBehindLog {
				log.Errorf("get next commit log err, %s", err.Error)
				return err
			} else {
				l.rwg.Done()
				return nil
			}
		} else {
			l.rbatch.Rollback()

			if rl.Compression == 1 {
				//todo optimize
				if rl.Data, err = snappy.Decode(nil, rl.Data); err != nil {
					log.Errorf("decode log error %s", err.Error())
					return err
				}
			}

			if bd, err := store.NewBatchData(rl.Data); err != nil {
				log.Errorf("decode batch log error %s", err.Error())
				return err
			} else if err = bd.Replay(l.rbatch); err != nil {
				log.Errorf("replay batch log error %s", err.Error())
			}

			l.commitLock.Lock()
			if err = l.rbatch.Commit(); err != nil {
				log.Errorf("commit log error %s", err.Error())
			} else if err = l.r.UpdateCommitID(rl.ID); err != nil {
				log.Errorf("update commit id error %s", err.Error())
			}

			l.commitLock.Unlock()
			if err != nil {
				return err
			}
		}

	}
}

func (l *Ledis) onReplication() {
	defer l.wg.Done()

	l.noticeReplication()

	for {
		select {
		case <-l.rc:
			l.handleReplication()
		case <-l.quit:
			return
		}
	}
}

func (l *Ledis) WaitReplication() error {
	if !l.ReplicationUsed() {
		return ErrRplNotSupport

	}

	l.noticeReplication()
	l.rwg.Wait()

	for i := 0; i < 100; i++ {
		b, err := l.r.CommitIDBehind()
		if err != nil {
			return err
		} else if b {
			l.noticeReplication()
			l.rwg.Wait()
			time.Sleep(100 * time.Millisecond)
		} else {
			return nil
		}
	}

	return errors.New("wait replication too many times")
}

func (l *Ledis) StoreLogsFromReader(rb io.Reader) error {
	if !l.ReplicationUsed() {
		return ErrRplNotSupport
	} else if !l.cfg.Readonly {
		return ErrRplInRDWR
	}

	log := &rpl.Log{}

	for {
		if err := log.Decode(rb); err != nil {
			if err == io.EOF {
				break
			} else {
				return err
			}
		}

		if err := l.r.StoreLog(log); err != nil {
			return err
		}

	}

	l.noticeReplication()

	return nil
}

func (l *Ledis) noticeReplication() {
	AsyncNotify(l.rc)
}

func (l *Ledis) StoreLogsFromData(data []byte) error {
	rb := bytes.NewReader(data)

	return l.StoreLogsFromReader(rb)
}

func (l *Ledis) ReadLogsTo(startLogID uint64, w io.Writer) (n int, nextLogID uint64, err error) {
	if !l.ReplicationUsed() {
		// no replication log
		nextLogID = 0
		err = ErrRplNotSupport
		return
	}

	var firtID, lastID uint64

	firtID, err = l.r.FirstLogID()
	if err != nil {
		return
	}

	if startLogID < firtID {
		err = ErrLogMissed
		return
	}

	lastID, err = l.r.LastLogID()
	if err != nil {
		return
	}

	nextLogID = startLogID

	log := &rpl.Log{}
	for i := startLogID; i <= lastID; i++ {
		if err = l.r.GetLog(i, log); err != nil {
			return
		}

		if err = log.Encode(w); err != nil {
			return
		}

		nextLogID = i + 1

		n += log.Size()

		if n > maxReplLogSize {
			break
		}
	}

	return
}

// try to read events, if no events read, try to wait the new event singal until timeout seconds
func (l *Ledis) ReadLogsToTimeout(startLogID uint64, w io.Writer, timeout int, quitCh chan struct{}) (n int, nextLogID uint64, err error) {
	n, nextLogID, err = l.ReadLogsTo(startLogID, w)
	if err != nil {
		return
	} else if n != 0 {
		return
	}
	//no events read
	select {
	case <-l.r.WaitLog():
	case <-time.After(time.Duration(timeout) * time.Second):
	case <-quitCh:
		return
	}
	return l.ReadLogsTo(startLogID, w)
}

func (l *Ledis) propagate(rl *rpl.Log) {
	for _, h := range l.rhs {
		h(rl)
	}
}

type NewLogEventHandler func(rl *rpl.Log)

func (l *Ledis) AddNewLogEventHandler(h NewLogEventHandler) error {
	if !l.ReplicationUsed() {
		return ErrRplNotSupport
	}

	l.rhs = append(l.rhs, h)

	return nil
}

func (l *Ledis) ReplicationStat() (*rpl.Stat, error) {
	if !l.ReplicationUsed() {
		return nil, ErrRplNotSupport
	}

	return l.r.Stat()
}


text:
namespace onnxruntime {

constexpr const char* ArmNN = "ArmNN";
constexpr const char* ArmNN_CPU = "ArmNNCpu";

namespace armnn_ep {

// Forward declarations of op kernels
#ifdef RELU_ARMNN
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 6, Relu);
#endif
class ONNX_OPERATOR_VERSIONED_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 1, 10, Conv);
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 11, Conv);

class ONNX_OPERATOR_VERSIONED_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 7, 8, Gemm);
class ONNX_OPERATOR_VERSIONED_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 9, 10, Gemm);
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 11, Gemm);

class ONNX_OPERATOR_VERSIONED_TYPED_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 7, 9, float, AveragePool);
class ONNX_OPERATOR_VERSIONED_TYPED_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 10, 10, float, AveragePool);
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 11, AveragePool);
class ONNX_OPERATOR_VERSIONED_TYPED_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 1, 7, float, MaxPool);
class ONNX_OPERATOR_VERSIONED_TYPED_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 8, 11, float, MaxPool);
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 12, MaxPool);

class ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 1, float, GlobalAveragePool);
class ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 1, float, GlobalMaxPool);

#ifdef BN_ARMNN
class ONNX_OPERATOR_VERSIONED_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 7, 9, BatchNormalization);
#endif
class ONNX_OPERATOR_VERSIONED_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 4, 10, Concat);
class ONNX_OPERATOR_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 11, Concat);

class ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kMSDomain, 1, float, FusedConv);

Status RegisterArmNNKernels(KernelRegistry& kernel_registry) {
  static const BuildKernelCreateInfoFn function_table[] = {
#ifdef RELU_ARMNN
      BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 6, Relu)>,
#endif
      BuildKernelCreateInfo<ONNX_OPERATOR_VERSIONED_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 1, 10, Conv)>,
      BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 11, Conv)>,

      BuildKernelCreateInfo<ONNX_OPERATOR_VERSIONED_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 7, 8, Gemm)>,
      BuildKernelCreateInfo<ONNX_OPERATOR_VERSIONED_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 9, 10, Gemm)>,
      BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 11, Gemm)>,

      BuildKernelCreateInfo<ONNX_OPERATOR_VERSIONED_TYPED_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 7, 9, float, AveragePool)>,
      BuildKernelCreateInfo<ONNX_OPERATOR_VERSIONED_TYPED_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 10, 10, float, AveragePool)>,
      BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 11, AveragePool)>,
      BuildKernelCreateInfo<ONNX_OPERATOR_VERSIONED_TYPED_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 1, 7, float, MaxPool)>,
      BuildKernelCreateInfo<ONNX_OPERATOR_VERSIONED_TYPED_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 8, 11, float, MaxPool)>,
      BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 12, MaxPool)>,

      BuildKernelCreateInfo<ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 1, float, GlobalAveragePool)>,
      BuildKernelCreateInfo<ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 1, float, GlobalMaxPool)>,

#ifdef BN_ARMNN
      BuildKernelCreateInfo<ONNX_OPERATOR_VERSIONED_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 7, 9, BatchNormalization)>,
#endif
      BuildKernelCreateInfo<ONNX_OPERATOR_VERSIONED_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 4, 10, Concat)>,
      BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kOnnxDomain, 11, Concat)>,

      BuildKernelCreateInfo<ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kArmNNExecutionProvider, kMSDomain, 1, float, FusedConv)>,
  };

  for (auto& function_table_entry : function_table) {
    KernelCreateInfo info = function_table_entry();
    if (info.kernel_def != nullptr) {  // filter disabled entries where type is void
      ORT_RETURN_IF_ERROR(kernel_registry.Register(std::move(info)));
    }
  }

  return Status::OK();
}

std::shared_ptr<KernelRegistry> GetArmNNKernelRegistry() {
  std::shared_ptr<KernelRegistry> kernel_registry = std::make_shared<KernelRegistry>();
  ORT_THROW_IF_ERROR(RegisterArmNNKernels(*kernel_registry));

  return kernel_registry;
}

}  // namespace armnn_ep

ArmNNExecutionProvider::ArmNNExecutionProvider(const ArmNNExecutionProviderInfo& info)
    : IExecutionProvider{onnxruntime::kArmNNExecutionProvider} {
  ORT_UNUSED_PARAMETER(info);

  AllocatorCreationInfo default_memory_info{
      [](int) {
        return std::make_unique<CPUAllocator>(OrtMemoryInfo(ArmNN, OrtAllocatorType::OrtDeviceAllocator));
      },
      0};

  InsertAllocator(CreateAllocator(default_memory_info));

  AllocatorCreationInfo cpu_memory_info{
      [](int) {
        return std::make_unique<CPUAllocator>(
            OrtMemoryInfo(ArmNN_CPU, OrtAllocatorType::OrtDeviceAllocator, OrtDevice(), 0, OrtMemTypeCPUOutput));
      }};

  InsertAllocator(CreateAllocator(cpu_memory_info));
}

ArmNNExecutionProvider::~ArmNNExecutionProvider() {
}

std::shared_ptr<KernelRegistry> ArmNNExecutionProvider::GetKernelRegistry() const {
  static std::shared_ptr<KernelRegistry> kernel_registry = onnxruntime::armnn_ep::GetArmNNKernelRegistry();
  return kernel_registry;
}

}  // namespace onnxruntime


text:
<?php

namespace LaravelFCM\Facades;

use Illuminate\Support\Facades\Facade;

class FCM extends Facade
{
    protected static function getFacadeAccessor()
    {
        return 'fcm.sender';
    }
}


text:
this.Response = function Response(json, response) {
    var obj, headers;

    // If there's rows, this is the result
    // of a view function.
    // We want to return this as an Array.
    if (json.rows) {
        obj           = json.rows.slice(0);
        obj.__proto__ = new(Array);
        if (json && typeof json === 'object') {
            Object.keys(json).forEach(function (k) {
                Object.defineProperty(obj.__proto__, k, {
                    value:      json[k],
                    enumerable: false
                });
            });
        }
    } else if (json.results) {
        obj = json.results.slice(0);
        obj.__proto__ = new(Array);
        obj.last_seq  = json.last_seq;
    } else if (json.uuids) {
        obj           = json.uuids;
        obj.__proto__ = new(Array);
    } else if (Array.isArray(json)) {
        obj           = json.slice(0);
        obj.__proto__ = new(Array);
    } else {
        obj           = {};
        obj.__proto__ = new(Object);
        if (json && typeof json === 'object') {
            Object.keys(json).forEach(function (k) {
                obj[k] = json[k];
            });
        }
    }

    // If the response was originally a document,
    // give access to it via the 'json' getter.
    if (!Array.isArray(json) && !obj.json) {
        Object.defineProperty(obj, 'json', {
            value: json,
            enumerable: false
        });
    }

    if (response) {
        headers = { status: response.statusCode };
        Object.keys(response.headers).forEach(function (k) {
            headers[k] = response.headers[k];
        });

        // Set the 'headers' special field, with the response's status code.
        exports.extend(obj, 'headers' in obj ? { _headers: headers }
                                             : {  headers: headers });
    }

    // Alias '_rev' and '_id'
    if (obj.id && obj.rev) {
        exports.extend(obj, { _id:  obj.id, _rev: obj.rev });
    } else if (obj._id && obj._rev) {
        exports.extend(obj, { id:  obj._id, rev: obj._rev });
    }

    if (Array.isArray(obj) && json.rows) {
        exports.extend(obj, exports.collectionPrototype);
    }
    exports.extend(obj, exports.basePrototype);

    // Set the constructor to be this function
    Object.defineProperty(obj, 'constructor', {
        value: arguments.callee
    });

    return obj;
};

this.basePrototype = {
    toJSON: function () {
        return this;
    },
    toString: function () {
        return JSON.stringify(this);
    }
};

this.collectionPrototype = {
    forEach: function (f) {
        for (var i = 0, value; i < this.length; i++) {
            value = this[i].doc || this[i].json || this[i].value || this[i];
            if (f.length === 1) {
                f.call(this[i], value);
            } else {
                f.call(this[i], this[i].key, value, this[i].id);
            }
        }
    },
    map: function (f) {
        var ary = [];
        if (f.length === 1) {
            this.forEach(function (a) { ary.push(f.call(this, a)) });
        } else {
            this.forEach(function () { ary.push(f.apply(this, arguments)) });
        }
        return ary;
    },
    toArray: function () {
        return this.map(function (k, v) { return v });
    }
};

this.extend = function (obj, properties) {
    var descriptor = Object.keys(properties).reduce(function (hash, k) {
        hash[k] = {
            value: properties[k],
            enumerable: false
        };
        return hash;
    }, {});
    return Object.defineProperties(obj, descriptor);
};


text:
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.1434
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace LCC.WebGestion.presupuestos {

    public partial class DocumentoAceptacionFirmado {

        /// <summary>
        /// vp control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::LCC.ControlesLCCGestion.edicion.VerArchivo vp;

        /// <summary>
        /// Up control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::LCC.WebGestion.elementos.elementos_Upload2 Up;

        /// <summary>
        /// bn control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::LCC.ControlesLCCGestion.bases.BotonNormal bn;

        /// <summary>
        /// et control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::PROT.ControlesEspeciales.Etiqueta et;
    }
}


text:
package agent

import (
	"encoding/json"
	. "github.com/infradash/dash/pkg/dash"
	"github.com/qorio/maestro/pkg/docker"
	"github.com/qorio/maestro/pkg/zk"
	"github.com/qorio/omni/version"
	"sync"
	"time"
)

type ContainerActionType int

const (
	Start ContainerActionType = iota
	Stop
	Remove
)

type Info struct {
	Version     version.Build `json:"version"`
	Now         time.Time     `json:"now"`
	Uptime      time.Duration `json:"uptime,omitempty"`
	Api         string        `json:"api,omitempty"`
	DockerApi   string        `json:"dockerapi,omitempty"`
	DockerUi    string        `json:"dockerui,omitempty"`
	StatusTopic string        `json:"status_topic,omitempty"`
	Environ     []string      `json:"environ,omitempty"`
	Agent       *Agent        `json:"agent"`
}

type Health struct {
	Status        string  `json:"status"`
	UptimeSeconds float64 `json:uptime_seconds,omitempty`
}

type MatchContainerRule struct {
	QualifyByTags
	docker.Image
	MatchContainerPort *int                       `json:"match_container_port,omitempty"`
	MatchFirst         []ContainerMatchRulesUnion `json:"match_first,omitempty"`
	MatchAll           []ContainerMatchRulesUnion `json:"mathc_all,omitempty"`

	registerOnly bool
}

type ContainerMatchRulesUnion struct {
	ByContainerName        *string           `json:"container_name,omitempty"`
	ByContainerEnvironment []string          `json:"container_envs,omitempty"`
	ByContainerLabels      map[string]string `json:"container_labels,omitempty"`
}

// Configuration for the domain
// Note this is effectively a deployment workflow with state transitions.
// TODO - implement state machine to track this for each service.
type DomainConfig struct {
	RegistryContainerEntry

	Services map[ServiceKey]*Scheduler `json:"services,omitempty"`

	Vacuums map[ServiceKey]*VacuumConfig `json:"vacuums,omitempty"`
}

func (d *DomainConfig) JSON() string {
	b, _ := json.Marshal(d)
	return string(b)
}

type Scheduler struct {
	QualifyByTags

	Task

	Register    *MatchContainerRule `json:"register,omitempty"`
	TriggerPath *Trigger            `json:"trigger_path,omitempty"`

	Constraint *Constraint      `json:"constraint,omitempty"`
	RunOnce    *RunOnceSchedule `json:"run_once,omitemtpy"`

	lock sync.Mutex
}

type Trigger string

type AssignContainerName func(step int, template string, opts *docker.ContainerControl) string
type AssignContainerImage func(step int, opts *docker.ContainerControl) (*docker.Image, error)

type Task struct {

	// Registry path where the image to use is stored.
	ImagePath string `json:"image_path,omitempty"`

	// Max attempts at starting a container -- 0 means no bounds
	MaxAttempts int `json:"max_attempts,omitempty"`

	// Optional - Side effects if run multiple times?
	Idempotent bool `json:"idempotent,omitempty"`

	// Path where Docker auth info can be found in the registry.
	// The value at this path is expected to a json struct for AuthConfiguration
	// http://godoc.org/github.com/fsouza/go-dockerclient#AuthConfiguration
	DockerAuthInfoPath string               `json:"auth_info_path"`
	AuthIdentity       *docker.AuthIdentity `json:"auth"`
	Actions            []ContainerAction    `json:"actions,omitempty"`

	domain  string
	service ServiceKey
	zk      zk.ZK

	assignName  AssignContainerName
	assignImage AssignContainerImage

	// TODO - Add fields here to support implementation of barriers, leader election and global locks required
	// to implement semantics like 'only 1 per cluster'
}

type ContainerAction struct {
	// Template for naming the container. Variables:  Group, Sequence, Domain, Service, Image
	// If not provided, docker naming will be used.
	ContainerNameTemplate *string `json:"container_name_template,omitempty" dash:"template"`

	docker.ContainerControl
}

// Static / manual scheduler where the instances counts are specified statically per host
type Constraint struct {
	MinInstancesPerHost *int `json:"min_instances_per_host,omitempty"`
	MaxInstancesPerHost *int `json:"max_instances_per_host,omitempty"`
	MinInstancesGlobal  *int `json:"min_instances_global,omitempty"`
	MaxInstancesGlobal  *int `json:"max_instances_global,omitempty"`
}

type RunOnceSchedule struct {
	Trigger string `json:"trigger"`
}


text:
/* This file is part of Lwt, released under the MIT license. See LICENSE.md for
   details, or visit https://github.com/ocsigen/lwt/blob/master/LICENSE.md. */

/* Informations:

   - this is the expected prototype of the C function [tcdrain]:

       int tcdrain(int fd)

   - these are the expected ocaml externals for this job:

       external tcdrain_job : Unix.file_descr -> unit Lwt_unix.job = "lwt_unix_tcdrain_job"
       external tcdrain_sync : Unix.file_descr -> unit = "lwt_unix_tcdrain_sync"
*/

/* Caml headers. */
#include <lwt_unix.h>
#include <caml/memory.h>
#include <caml/alloc.h>
#include <caml/fail.h>
#include <caml/signals.h>

#if !defined(LWT_ON_WINDOWS) && !defined(__ANDROID__)

/* Specific headers. */
#include <errno.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>

/* +-----------------------------------------------------------------+
   | Asynchronous job                                                |
   +-----------------------------------------------------------------+ */

/* Structure holding informations for calling [tcdrain]. */
struct job_tcdrain {
  /* Informations used by lwt. It must be the first field of the structure. */
  struct lwt_unix_job job;
  /* This field store the result of the call. */
  int result;
  /* This field store the value of [errno] after the call. */
  int errno_copy;
  /* in parameter. */
  int fd;
};

/* The function calling [tcdrain]. */
static void worker_tcdrain(struct job_tcdrain* job)
{
  /* Perform the blocking call. */
  job->result = tcdrain(job->fd);
  /* Save the value of errno. */
  job->errno_copy = errno;
}

/* The function building the caml result. */
static value result_tcdrain(struct job_tcdrain* job)
{
  /* Check for errors. */
  if (job->result < 0) {
    /* Save the value of errno so we can use it once the job has been freed. */
    int error = job->errno_copy;
    /* Free the job structure. */
    lwt_unix_free_job(&job->job);
    /* Raise the error. */
    unix_error(error, "tcdrain", Nothing);
  }
  /* Free the job structure. */
  lwt_unix_free_job(&job->job);
  /* Return the result. */
  return Val_unit;
}

/* The stub creating the job structure. */
CAMLprim value lwt_unix_tcdrain_job(value fd)
{
  /* Allocate a new job. */
  struct job_tcdrain* job = lwt_unix_new(struct job_tcdrain);
  /* Initializes function fields. */
  job->job.worker = (lwt_unix_job_worker)worker_tcdrain;
  job->job.result = (lwt_unix_job_result)result_tcdrain;
  /* Copy the fd parameter. */
  job->fd = Int_val(fd);
  /* Wrap the structure into a caml value. */
  return lwt_unix_alloc_job(&job->job);
}

#else /* !defined(LWT_ON_WINDOWS) && !defined(__ANDROID__) */

CAMLprim value lwt_unix_tcdrain_job(value Unit)
{
  lwt_unix_not_available("tcdrain");
  return Val_unit;
}

#endif /* !defined(LWT_ON_WINDOWS) && !defined(__ANDROID__) */


text:
var app = (function() {

    var loadIcon = $('#loader'),
        viewContainer = $('#viewContainer'),
        offScreenNav = $('#effeckt-off-screen-nav'),
        modalViewWrap = $('#effeckt-modal-wrap'),
        modalViewListContainer = $('#modalViewListContainer'),
        topcoatListTpl = Handlebars.compile($('#topcoatList-tpl').html()),
        welcomeViewTpl = Handlebars.compile($('#welcomeView-tpl').html()),
        dropboxViewTpl = Handlebars.compile($('#dropboxView-tpl').html()),
        fileListTpl = Handlebars.compile($('#fileList-tpl').html()),
        fileUploadViewTpl = Handlebars.compile($('#fileUploadView-tpl').html()),
        localFileListTpl = Handlebars.compile($('#localFileList-tpl').html()),
        slider = new PageSlider(viewContainer);

    function showWelcomeView() {
        var welcomeView = new WelcomeView(welcomeViewTpl);
        viewContainer.empty();
        slider.slidePageFrom(welcomeView.render().el, 'left');
    }

    function showDropboxView() {
        var dropboxView = new DropboxView(dropboxViewTpl, fileListTpl),
            fromFileUploadView = $('#fileUploadView').length > 0;
        viewContainer.empty();
        slider.slidePageFrom(dropboxView.render().el, (fromFileUploadView) ? 'left' : 'right');

        dropboxView.listFolder();
        DropboxSync.addObserver('/');
    }

    function showFileUploadView() {
        var fileUploadView = new FileUploadView(fileUploadViewTpl, localFileListTpl);
        viewContainer.empty();
        slider.slidePageFrom(fileUploadView.render().el, 'right');

        if (app.localFileFullPath == '') {
            // request the persistent file system
            window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, fileUploadView.getFSRoot, fileUploadView.FSfail);
        } else {
            fileUploadView.getFolderWithPath();
        }
    }

    function createNavMenu(obj) {
        offScreenNav.empty().html(topcoatListTpl(obj));
    }

    function createModal(obj) {
        modalViewListContainer.empty().html(topcoatListTpl(obj));
    }

    function showUnlinkModal() {
        createModal({
            header: 'Unlink from Dropbox?',
            listItem:  [
                            {
                                text: 'Unlink',
                                id: 'btn-unlinkDropbox'
                            }
                       ]
        });
        showModal();
    }

    function toggleNav() {
        //EffecktOffScreenNav.toggleNav(); // not as reliable as below
        $('#btn-navMenu').trigger('click');

        // must wait at least 500 ms for the navMenu transform to finish, webkitTransitionEnd isn't working, i tried :~(
        var deferred = $.Deferred();
        setTimeout(function() {
            deferred.resolve();
        }, 725);

        return deferred.promise();
    }

    function showModal() {
        $('#btn-modalView').trigger('click');
    }

    function hideModal() {
        $('.effeckt-overlay').trigger('click');
        if (app.modalDeferred) {
            app.modalDeferred.reject();
        }
    }

    function resolveModalDeferred(el) {
        app.modalDeferred.resolve(el);
    }

    function navMenuIsVisible() {
        return offScreenNav.hasClass('effeckt-off-screen-nav-show');
    }

    function modalIsVisible() {
        return modalViewWrap.hasClass('effeckt-show');
    }

    function showLoader() {
        loadIcon.show();
    }

    function hideLoader() {
        loadIcon.hide();
    }

    modalViewListContainer.on('click', '#btn-unlinkDropbox', function(event) {
        hideModal();
        toggleNav().done(function() {
            showLoader();
            DropboxSync.unlink(function() {
                hideLoader();
                showWelcomeView();
            }, function(error) {
                console.log('DropboxSync unlink error');
            });
        });
        event.preventDefault();
    });

    document.addEventListener("deviceReady", function() {   // ready for kickoff
        FastClick.attach(document.body);

        if (navigator.notification) { // Override default HTML alert with native dialog
            window.showConfirm = function(message, title, labels, success) {
                navigator.notification.confirm(
                    message, // message string
                    success, // callback to invoke with index of button pressed
                    title,   // title string
                    labels   // buttonLabels array
                );
            };
            window.showPrompt = function(message, callback, title, labels, defaultText) {
                navigator.notification.prompt(
                    message,
                    callback,
                    title,
                    labels,
                    defaultText // shown in input textbox
                )
            };
        }

        DropboxSync.checkLink(showDropboxView, showWelcomeView);

        // hook btn-back to the device's back button
        document.addEventListener('backbutton', onBackKeyDown, false);
        function onBackKeyDown(event) {
            if (navMenuIsVisible()) {
                toggleNav(); // no need to wait for deferred
            } else if (modalIsVisible()) {
                hideModal();
            } else {
                $('#btn-back').trigger('click');
            }
            event.preventDefault();
        }

        document.addEventListener("menubutton", onMenuKeyDown, false);
        function onMenuKeyDown(event) {
            if (modalIsVisible()) return false;
            toggleNav();
            event.preventDefault();
        }
    });

    Array.prototype.sortByKey = function(key) {
        this.sort(function(a, b) {
            var x = a[key].toLowerCase();
            var y = b[key].toLowerCase();
            return ((x < y) ? -1 : ((x > y) ? 1 : 0));
        });
    };

    Array.prototype.contains = function(key, value) {
        for (var i = 0; i < this.length; i++) {
            if (this[i][key] == value) {
                return i;
            }
        }
        return -1;
    };

    return {
        dropboxPath: '/',
        localFileFullPath: '',
        showWelcomeView: showWelcomeView,
        showFileUploadView: showFileUploadView,
        showDropboxView: showDropboxView,
        dropboxViewScrollCache: [],
        fileUploadViewScrollCache: [],
        dropboxViewIScroll: null,
        fileUploadViewIScroll: null,
        showUnlinkModal: showUnlinkModal,
        createModal: createModal,
        createNavMenu: createNavMenu,
        toggleNav: toggleNav,
        showModal: showModal,
        hideModal: hideModal,
        modalDeferred: null,
        resolveModalDeferred: resolveModalDeferred,
        loadIcon: loadIcon,
        showLoader: showLoader,
        hideLoader: hideLoader
    }

})();

// called from the onActivityResult method in the plugin when linking is successful.
function dropbox_linked() {
    app.showDropboxView();
}

// called by observer in the plugin when there's a change to the status of background synchronization (download/upload).
function dropbox_onSyncStatusChange(status) {
    (status == 'none') ? app.hideLoader() : app.showLoader();
}

// called by observer in the plugin when a file is changed.
function dropbox_fileChange() {
    /*if ($('#dropboxView').length > 0) {
        app.dropboxView.listFolder();
    }*/
    // no need to list folder anymore since i added pull to refresh feature
    console.log('dropbox_fileChange()');
}


text:
import android.os.AsyncTask;

import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.mime.HttpMultipartMode;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HttpContext;
import org.apache.http.util.EntityUtils;
import org.json.JSONObject;

import java.io.File;

public class ImgurUploader extends AsyncTask<File, Void, String> {
    //TODO: Change CLIENT_ID to your personal Imgur Client ID
    private static String CLIENT_ID = "Your Client ID from the Imgur API. Ex: 123ab4c567890d";

    @Override
    public String doInBackground(File... params) {
        final String upload_to = "https://api.imgur.com/3/upload.json";
        final String API_key = "API_KEY";

        HttpClient httpClient = new DefaultHttpClient();
        HttpContext localContext = new BasicHttpContext();
        HttpPost httpPost = new HttpPost(upload_to);

        httpPost.setHeader("Authorization", "Client-ID "+ CLIENT_ID);

        try {
            MultipartEntityBuilder builder = MultipartEntityBuilder.create();
            builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
            builder.addTextBody("key", API_key);
            builder.addBinaryBody("image", params[0]);
            httpPost.setEntity(builder.build());

            final HttpResponse response = httpClient.execute(httpPost, localContext);
            final String response_string = EntityUtils.toString(response.getEntity());
            final JSONObject json = new JSONObject(response_string);

            if (json.getBoolean("success")) {
                JSONObject results = (JSONObject) json.get("data");
                return results.getString("link");
            }
            else {
                System.out.println("Error posting image to Imgur.");
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    protected void onPostExecute(String result) {
        if (result != null) {
            System.out.println("Success! Image link: " + result);
        }
    }
}


text:
package org.crow.demo.servlet;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.crow.demo.entity.User;

public class UserLoginServlet extends HttpServlet {

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;

	/**
	 *
	 */
	List<User> userList = null;

	/**
	 * Constructor of the object.
	 */
	public UserLoginServlet() {
		super();
	}

	/**
	 * Destruction of the servlet.

	 */
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}

	/**
	 * The doGet method of the servlet.

	 *
	 * This method is called when a form has its tag value method equals to get.
	 *
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		doPut(request, response);

	}

	/**
	 * The doPost method of the servlet.

	 *
	 * This method is called when a form has its tag value method equals to post.
	 *
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// If user data not exist, then initialize.
		if(userList == null){
			String projectPath = request.getServletContext().getRealPath("/");
			userList = getUserInfo(projectPath);
			System.out.println("initialize user data.");
			for(User user : userList){
				System.out.println(user.getUserAccount() + " - " + user.getUserPassword());
			}
			System.out.println("Initialize end.\n");
		}

		String userAccount = request.getParameter("userAccount");
		String userPassword = request.getParameter("userPassword");

		// Is this user exist?
		boolean userExist = false;
		if(userAccount == null || "".equals(userAccount) || userPassword == null || "".equals(userPassword)){
			response.sendRedirect("error.jsp");
			return;
		}

		for(User user : userList){
			if(userAccount.equals(user.getUserAccount()) && userPassword.equals(user.getUserPassword())){
				userExist = true;
			}
		}

		if(userExist){
			request.setAttribute("info", userAccount + ", welcome!");

			request.getRequestDispatcher("success.jsp").forward(request, response);
		}else{
			request.setAttribute("info", "Login failure.");

			request.getRequestDispatcher("error.jsp").forward(request, response);
		}
		/*
		response.setContentType("text/html");
		PrintWriter out = response.getWriter();
		out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
		out.println("");
		out.println("  <TITLE>A Servlet</TITLE>");
		out.println("  ");
		out.print("    This is ");
		out.print(this.getClass());
		out.println(", using the POST method");
		out.println("  ");
		out.println("");
		out.flush();
		out.close();
		*/
	}

	/**
	 * Initialization of the servlet.

	 *
	 * @throws ServletException if an error occurs
	 */
	public void init() throws ServletException {

	}

	/**
	 * Get user date.
	 * @author Crow
	 * @date 2015年6月13日
	 * @return
	 */
	private List<User> getUserInfo(String projectPath) {
		List<User> userList = new ArrayList<User>();

		try {
			File userDataFile = getUserDataFile(projectPath);
			InputStreamReader isr = new InputStreamReader(new FileInputStream(userDataFile), "UTF-8");
			BufferedReader br = new BufferedReader(isr);
			String line = null;
			while((line = br.readLine()) != null){
				String[] info = line.split("#");
				userList.add(new User(info[0], info[1]));
			}
			br.close();
			isr.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
			System.out.println("The target file is not found, use the default user data.");
			userList.add(new User("admin", "admin"));
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return userList;
	}

	/**
	 * Get the file which save the user data.
	 * @author Crow
	 * @date 2015年6月13日
	 * @return
	 * @throws FileNotFoundException
	 */
	private File getUserDataFile(String projectPath) throws FileNotFoundException{
		String userDataFilePath = projectPath + "\\res\\data\\users";
		File userDataFile = new File(userDataFilePath);
		if(userDataFile.exists()){
			return userDataFile;
		}
		throw new FileNotFoundException();
	}

}


text:
namespace VGA.Mutations.TestAssembly
{
    public class BooleanMachine
    {
        public bool GreaterThan(int a, int b)
        {
            return a > b;
        }

        public bool LessThan(int a, int b)
        {
            return a < b;
        }
    }
}