text:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace chchch.Resources
{
    public static class Ch3ResourceManager
    {
        private static Dictionary<string, Object> _cache = new Dictionary<string, Object>();
        private static Dictionary<string, Object> _jsonCache = new Dictionary<string, Object>();

        public static void ReleaseAll()
        {
            foreach (Object resource in _cache.Values)
            {
                UnityEngine.Resources.UnloadAsset(resource);
            }

            foreach (Object resource in _jsonCache.Values)
            {
                UnityEngine.Resources.UnloadAsset(resource);
            }

            _cache.Clear();
            _jsonCache.Clear();
        }

        public static void Preload<T>(string p_resourceId) where T : Object
        {
            Load<T>(p_resourceId);
        }

        public static void Release(string p_resourceId)
        {
            Object resource;

            _cache.TryGetValue(p_resourceId, out resource);

            UnityEngine.Resources.UnloadAsset(resource);
            _cache.Remove(p_resourceId);
        }

        public static void Release(IEnumerable<string> p_resourceIds)
        {
            foreach (string resourceId in p_resourceIds)
            {
                Release(resourceId);
            }
        }

        public static T Load<T>(string p_resourceId) where T : Object
        {
            if (!_cache.ContainsKey(p_resourceId))
            {
                _cache.Add(p_resourceId, UnityEngine.Resources.Load<T>(p_resourceId));
            }

            return (T) _cache[p_resourceId];
        }

        public static T LoadJSON<T>(string p_resourceId) where T : Object
        {
            if (!_jsonCache.ContainsKey(p_resourceId))
            {
                TextAsset loadedResource = UnityEngine.Resources.Load<TextAsset>(p_resourceId);

                if (loadedResource == null)
                {
                    _jsonCache.Add(p_resourceId, null);
                }
                else
                {
                    _jsonCache.Add(p_resourceId, JsonUtility.FromJson<T>(loadedResource.text));
                }

                UnityEngine.Resources.UnloadAsset(loadedResource);
            }

            return (T) _jsonCache[p_resourceId];
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php
namespace Skrz\Meta\Fixtures\XML;

use Skrz\Meta\XML\XmlAttribute;
use Skrz\Meta\XML\XmlElement;
use Skrz\Meta\XML\XmlValue;

/**
 * @author Jakub Kulhan <jakub.kulhan@gmail.com>
 *
 * @XmlElement(name="paramroot")
 */
class Param
{

	/**
	 * @var string
	 *
	 * @XmlAttribute(name="name")
	 */
	public $name;

	/**
	 * @var string
	 *
	 * @XmlValue
	 */
	public $value;

}


text:
All notable changes to this project will be documented in this file.
See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [6.1.1](https://github.com/cloudflare/cf-ui/compare/cf-component-button@6.1.0...cf-component-button@6.1.1) (2017-08-26)

# [6.1.0](https://github.com/cloudflare/cf-ui/compare/cf-component-button@6.0.0...cf-component-button@6.1.0) (2017-08-25)

### Features

* **cf-component-button:** add 'dangerOutline' button type (#356) ([fc71718](https://github.com/cloudflare/cf-ui/commit/fc71718))

# [6.0.0](https://github.com/cloudflare/cf-ui/compare/cf-component-button@5.9.1...cf-component-button@6.0.0) (2017-08-07)

### Chores

* **cf-style-const:** rename gradient keys in theme (#317) ([4d37d26](https://github.com/cloudflare/cf-ui/commit/4d37d26))

### BREAKING CHANGES

* **cf-style-const:** This change will break all places that use gradients from theme

* chore(cf-style-const): Update snapshots

# [5.9.0](https://github.com/sejoker/cf-ui/compare/cf-component-button@5.7.7...cf-component-button@5.9.0) (2017-07-12)

### Features

* **cf-style-provider:** Update snapshots - they use atomic classNames now ([1a42284](https://github.com/sejoker/cf-ui/commit/1a42284))

## [5.8.1](https://github.com/koddsson/cf-ui/compare/cf-component-button@5.8.0...cf-component-button@5.8.1) (2017-07-10)

# [5.8.0](https://github.com/koddsson/cf-ui/compare/cf-component-button@5.7.7...cf-component-button@5.8.0) (2017-07-10)

### Features

* **cf-style-provider:** Update snapshots - they use atomic classNames now ([1a42284](https://github.com/koddsson/cf-ui/commit/1a42284))


text:
package bencode

import (
	"bytes"
	"strconv"
)

// Serialize a string using Bencode standard
// Reference : https://en.wikipedia.org/wiki/Bencode
func SerializeStr(str string) []byte {
	return []byte(strconv.Itoa(len(str)) + ":" + str)
}

// Serialize a list of strings using Bencode standard
// Reference : https://en.wikipedia.org/wiki/Bencode
func SerializeList(list []string) []byte {
	var buffer bytes.Buffer
	buffer.WriteString("l")
	for _, elt := range list {
		buffer.Write(SerializeStr(elt))
	}
	buffer.WriteString("e")
	return buffer.Bytes()
}

// Deserialize a string serialized using Bencode standard
// Reference : https://en.wikipedia.org/wiki/Bencode
func DeserializeStr(bencode []byte) (string, int) {
    strLength := bytes.SplitN(bencode, []byte(":"), 2)[0]
    length, _ := strconv.Atoi(string(strLength))
    return string(bencode[len(strLength)+1:]), length
}

// Deserialize a list of strings serialized using Bencode standard
// Reference : https://en.wikipedia.org/wiki/Bencode
func DeserializeList(bencode []byte) ([]string, int) {
	list := make([]string, 0)
	ind := 1
	for ind < len(bencode)-1 {
		strLength := bytes.SplitN(bencode[ind:], []byte(":"), 2)[0]
        length, _ := strconv.Atoi(string(strLength))
		elt, _ := DeserializeStr(bencode[ind : ind+length+1])
		list = append(list, elt)
		ind += length + 1 + len(strLength)
	}
	return list, len(list)
}


text:
<!DOCTYPE html>

    <title>Scrumdiddlyumptious</title>
    <meta charset='utf-8'>
    <meta http-equiv="X-UA-Compatible" content="chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <link href='https://fonts.googleapis.com/css?family=Architects+Daughter' rel='stylesheet' type='text/css'>

    <link rel="stylesheet" type="text/css" href="css/reset.css" />
    <link rel="stylesheet" type="text/css" href="stylesheets/stylesheet.css" />
    <link rel="stylesheet" type="text/css" href="css/site.css" />
    <link rel="stylesheet" type="text/css" href="css/animations.css" />

Scrumdiddlyumptious

Order delivery with CBSi Friends - Beat the minimum order!

Find our project in GitHub


text:
'''
Tests against remindme's migration handler
'''

import unittest
import migrations

class Test_Migrations(unittest.TestCase):
    '''Tests against the Migrations handler.'''

    def test_detect_versions(self):
        pass


text:
package com.amazonaws.services.greengrass.model;

import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;

/**
 * The environment configuration of the function.
 *
 * @see AWS API Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class FunctionConfigurationEnvironment implements Serializable, Cloneable, StructuredPojo {

    /**
     * If true, the Lambda function is allowed to access the host's /sys folder. Use this when the Lambda function needs
     * to read device information from /sys. This setting applies only when you run the Lambda function in a Greengrass
     * container.
     */
    private Boolean accessSysfs;
    /** Configuration related to executing the Lambda function */
    private FunctionExecutionConfig execution;
    /**
     * A list of the resources, with their permissions, to which the Lambda function will be granted access. A Lambda
     * function can have at most 10 resources. ResourceAccessPolicies apply only when you run the Lambda function in a
     * Greengrass container.
     */
    private java.util.List<ResourceAccessPolicy> resourceAccessPolicies;
    /** Environment variables for the Lambda function's configuration. */
    private java.util.Map<String, String> variables;

    /**
     * If true, the Lambda function is allowed to access the host's /sys folder. Use this when the Lambda function needs
     * to read device information from /sys. This setting applies only when you run the Lambda function in a Greengrass
     * container.
     *
     * @param accessSysfs
     *        If true, the Lambda function is allowed to access the host's /sys folder. Use this when the Lambda
     *        function needs to read device information from /sys. This setting applies only when you run the Lambda
     *        function in a Greengrass container.
     */

    public void setAccessSysfs(Boolean accessSysfs) {
        this.accessSysfs = accessSysfs;
    }

    /**
     * If true, the Lambda function is allowed to access the host's /sys folder. Use this when the Lambda function needs
     * to read device information from /sys. This setting applies only when you run the Lambda function in a Greengrass
     * container.
     *
     * @return If true, the Lambda function is allowed to access the host's /sys folder. Use this when the Lambda
     *         function needs to read device information from /sys. This setting applies only when you run the Lambda
     *         function in a Greengrass container.
     */

    public Boolean getAccessSysfs() {
        return this.accessSysfs;
    }

    /**
     * If true, the Lambda function is allowed to access the host's /sys folder. Use this when the Lambda function needs
     * to read device information from /sys. This setting applies only when you run the Lambda function in a Greengrass
     * container.
     *
     * @param accessSysfs
     *        If true, the Lambda function is allowed to access the host's /sys folder. Use this when the Lambda
     *        function needs to read device information from /sys. This setting applies only when you run the Lambda
     *        function in a Greengrass container.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public FunctionConfigurationEnvironment withAccessSysfs(Boolean accessSysfs) {
        setAccessSysfs(accessSysfs);
        return this;
    }

    /**
     * If true, the Lambda function is allowed to access the host's /sys folder. Use this when the Lambda function needs
     * to read device information from /sys. This setting applies only when you run the Lambda function in a Greengrass
     * container.
     *
     * @return If true, the Lambda function is allowed to access the host's /sys folder. Use this when the Lambda
     *         function needs to read device information from /sys. This setting applies only when you run the Lambda
     *         function in a Greengrass container.
     */

    public Boolean isAccessSysfs() {
        return this.accessSysfs;
    }

    /**
     * Configuration related to executing the Lambda function
     *
     * @param execution
     *        Configuration related to executing the Lambda function
     */

    public void setExecution(FunctionExecutionConfig execution) {
        this.execution = execution;
    }

    /**
     * Configuration related to executing the Lambda function
     *
     * @return Configuration related to executing the Lambda function
     */

    public FunctionExecutionConfig getExecution() {
        return this.execution;
    }

    /**
     * Configuration related to executing the Lambda function
     *
     * @param execution
     *        Configuration related to executing the Lambda function
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public FunctionConfigurationEnvironment withExecution(FunctionExecutionConfig execution) {
        setExecution(execution);
        return this;
    }

    /**
     * A list of the resources, with their permissions, to which the Lambda function will be granted access. A Lambda
     * function can have at most 10 resources. ResourceAccessPolicies apply only when you run the Lambda function in a
     * Greengrass container.
     *
     * @return A list of the resources, with their permissions, to which the Lambda function will be granted access. A
     *         Lambda function can have at most 10 resources. ResourceAccessPolicies apply only when you run the Lambda
     *         function in a Greengrass container.
     */

    public java.util.List<ResourceAccessPolicy> getResourceAccessPolicies() {
        return resourceAccessPolicies;
    }

    /**
     * A list of the resources, with their permissions, to which the Lambda function will be granted access. A Lambda
     * function can have at most 10 resources. ResourceAccessPolicies apply only when you run the Lambda function in a
     * Greengrass container.
     *
     * @param resourceAccessPolicies
     *        A list of the resources, with their permissions, to which the Lambda function will be granted access. A
     *        Lambda function can have at most 10 resources. ResourceAccessPolicies apply only when you run the Lambda
     *        function in a Greengrass container.
     */

    public void setResourceAccessPolicies(java.util.Collection<ResourceAccessPolicy> resourceAccessPolicies) {
        if (resourceAccessPolicies == null) {
            this.resourceAccessPolicies = null;
            return;
        }

        this.resourceAccessPolicies = new java.util.ArrayList<ResourceAccessPolicy>(resourceAccessPolicies);
    }

    /**
     * A list of the resources, with their permissions, to which the Lambda function will be granted access. A Lambda
     * function can have at most 10 resources. ResourceAccessPolicies apply only when you run the Lambda function in a
     * Greengrass container.
     *

     * NOTE: This method appends the values to the existing list (if any). Use
     * {@link #setResourceAccessPolicies(java.util.Collection)} or
     * {@link #withResourceAccessPolicies(java.util.Collection)} if you want to override the existing values.
     *

     *
     * @param resourceAccessPolicies
     *        A list of the resources, with their permissions, to which the Lambda function will be granted access. A
     *        Lambda function can have at most 10 resources. ResourceAccessPolicies apply only when you run the Lambda
     *        function in a Greengrass container.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public FunctionConfigurationEnvironment withResourceAccessPolicies(ResourceAccessPolicy... resourceAccessPolicies) {
        if (this.resourceAccessPolicies == null) {
            setResourceAccessPolicies(new java.util.ArrayList<ResourceAccessPolicy>(resourceAccessPolicies.length));
        }
        for (ResourceAccessPolicy ele : resourceAccessPolicies) {
            this.resourceAccessPolicies.add(ele);
        }
        return this;
    }

    /**
     * A list of the resources, with their permissions, to which the Lambda function will be granted access. A Lambda
     * function can have at most 10 resources. ResourceAccessPolicies apply only when you run the Lambda function in a
     * Greengrass container.
     *
     * @param resourceAccessPolicies
     *        A list of the resources, with their permissions, to which the Lambda function will be granted access. A
     *        Lambda function can have at most 10 resources. ResourceAccessPolicies apply only when you run the Lambda
     *        function in a Greengrass container.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public FunctionConfigurationEnvironment withResourceAccessPolicies(java.util.Collection<ResourceAccessPolicy> resourceAccessPolicies) {
        setResourceAccessPolicies(resourceAccessPolicies);
        return this;
    }

    /**
     * Environment variables for the Lambda function's configuration.
     *
     * @return Environment variables for the Lambda function's configuration.
     */

    public java.util.Map<String, String> getVariables() {
        return variables;
    }

    /**
     * Environment variables for the Lambda function's configuration.
     *
     * @param variables
     *        Environment variables for the Lambda function's configuration.
     */

    public void setVariables(java.util.Map<String, String> variables) {
        this.variables = variables;
    }

    /**
     * Environment variables for the Lambda function's configuration.
     *
     * @param variables
     *        Environment variables for the Lambda function's configuration.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public FunctionConfigurationEnvironment withVariables(java.util.Map<String, String> variables) {
        setVariables(variables);
        return this;
    }

    public FunctionConfigurationEnvironment addVariablesEntry(String key, String value) {
        if (null == this.variables) {
            this.variables = new java.util.HashMap<String, String>();
        }
        if (this.variables.containsKey(key))
            throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
        this.variables.put(key, value);
        return this;
    }

    /**
     * Removes all the entries added into Variables.
     *
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public FunctionConfigurationEnvironment clearVariablesEntries() {
        this.variables = null;
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getAccessSysfs() != null)
            sb.append("AccessSysfs: ").append(getAccessSysfs()).append(",");
        if (getExecution() != null)
            sb.append("Execution: ").append(getExecution()).append(",");
        if (getResourceAccessPolicies() != null)
            sb.append("ResourceAccessPolicies: ").append(getResourceAccessPolicies()).append(",");
        if (getVariables() != null)
            sb.append("Variables: ").append(getVariables());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof FunctionConfigurationEnvironment == false)
            return false;
        FunctionConfigurationEnvironment other = (FunctionConfigurationEnvironment) obj;
        if (other.getAccessSysfs() == null ^ this.getAccessSysfs() == null)
            return false;
        if (other.getAccessSysfs() != null && other.getAccessSysfs().equals(this.getAccessSysfs()) == false)
            return false;
        if (other.getExecution() == null ^ this.getExecution() == null)
            return false;
        if (other.getExecution() != null && other.getExecution().equals(this.getExecution()) == false)
            return false;
        if (other.getResourceAccessPolicies() == null ^ this.getResourceAccessPolicies() == null)
            return false;
        if (other.getResourceAccessPolicies() != null && other.getResourceAccessPolicies().equals(this.getResourceAccessPolicies()) == false)
            return false;
        if (other.getVariables() == null ^ this.getVariables() == null)
            return false;
        if (other.getVariables() != null && other.getVariables().equals(this.getVariables()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getAccessSysfs() == null) ? 0 : getAccessSysfs().hashCode());
        hashCode = prime * hashCode + ((getExecution() == null) ? 0 : getExecution().hashCode());
        hashCode = prime * hashCode + ((getResourceAccessPolicies() == null) ? 0 : getResourceAccessPolicies().hashCode());
        hashCode = prime * hashCode + ((getVariables() == null) ? 0 : getVariables().hashCode());
        return hashCode;
    }

    @Override
    public FunctionConfigurationEnvironment clone() {
        try {
            return (FunctionConfigurationEnvironment) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

    @com.amazonaws.annotation.SdkInternalApi
    @Override
    public void marshall(ProtocolMarshaller protocolMarshaller) {
        com.amazonaws.services.greengrass.model.transform.FunctionConfigurationEnvironmentMarshaller.getInstance().marshall(this, protocolMarshaller);
    }
}


text:
/* View module C api.
   Depends on pygame.h being included first.
 */
#if !defined(PG_VIEW_HEADER)

#include "pgarrinter.h"

typedef void (*PgView_Destructor)(PyObject *view);

#define PYGAMEAPI_VIEW_NUMSLOTS 6
#define PYGAMEAPI_VIEW_FIRSTSLOT 0

#if !(defined(PYGAMEAPI_VIEW_INTERNAL) || defined(NO_PYGAME_C_API))
static void *PgVIEW_C_API[PYGAMEAPI_VIEW_NUMSLOTS];

typedef PyObject *(*_pgview_new_t)(PyObject *capsule,
                                   PyObject *parent,
                                   PgView_Destructor dest);
typedef PyObject *(*_pgview_get_t)(PyObject *view);
typedef int *(*_pg_getarrayinterface_t)(PyObject *obj,
                                        PyObject **cobj_p,
                                        PyArrayInterface **inter_p);
typedef PyObject *(*_pg_arraystructasdict_t)(PyArrayInterface *inter_p);

#define PgView_Type (*(PyTypeObject*)PgVIEW_C_API[0])
#define PgView_New (*(_pgview_new_t)PgVIEW_C_API[1])
#define PgView_GetCapsule (*(_pgview_get_t)PgVIEW_C_API[2])
#define PgView_GetParent (*(_pgview_get_t)PgVIEW_C_API[3])
#define Pg_GetArrayInterface (*(_pg_getarrayinterface_t)PgVIEW_C_API[4])
#define Pg_ArrayStructAsDict (*(_pg_arraystructasdict_t)PgVIEW_C_API[5])
#define PgView_Check(x) ((x)->ob_type == (PgView_Type))
#define import_pygame_view() \
    _IMPORT_PYGAME_MODULE(_view, VIEW, PgVIEW_C_API)

#endif /* #if !(defined(PYGAMEAPI_VIEW_INTERNAL) || ... */

#define PG_VIEW_HEADER

#endif /* #if !defined(PG_VIEW_HEADER) */


text:
TargetListSize serves target list size of similarity target list.

### Service
+ [RetargetingListService](../../services/RetargetingListService.md)

### Namespace
[RetargetingListService#Namespace](../../services/RetargetingListService.md#namespace)

| Value | Description |
|---|---|
| RATE_1 | Similarity: Threshold 0.1 |
| RATE_2 | Similarity: Threshold 0.2 |
| RATE_3 | Similarity: Threshold 0.3 |
| RATE_4 | Similarity: Threshold 0.4 |
| RATE_5 | Similarity: Threshold 0.5 |
| RATE_6 | Similarity: Threshold 0.6 |
| RATE_7 | Similarity: Threshold 0.7 |
| RATE_8 | Similarity: Threshold 0.8 |
| RATE_9 | Similarity: Threshold 0.9 |
| RATE_10 | Similarity: Threshold 1.0 |

この 作品 は クリエイティブ・コモンズ 表示 - 改変禁止 2.1 日本 ライセンスの下に提供されています。


text:
import d3 from 'd3';
import {
  alignText,
  createDraw,
  stack,
  getTranslate,
  types
} from '../helpers';
import component from '../component';

/**
  Legend component

  @class Legend
*/
export var Legend = createDraw({
  select: function select(props) {
    return this.selectAll('.d3c-legend-group')
      .data(props.data || [], props.key);
  },

  enter: function enter(props) {
    var group = this.append('g')
      .attr('class', 'd3c-legend-group');

    // TODO width/height per data item
    group.append('g')
      .attr('width', props.swatchDimensions.width)
      .attr('height', props.swatchDimensions.height)
      .attr('class', 'd3c-legend-swatch');
    group.append('text')
      .attr('class', 'd3c-legend-label');

    group.append('rect')
      .attr('class', 'd3c-legend-hover')
      .style({visibility: 'hidden'});
  },

  merge: function merge(props) {
    var swatchWidth = props.swatchDimensions.width;
    var swatchHeight = props.swatchDimensions.height;

    // Swatch: Remove existing swatch, set class, and create swatch
    var swatch = this.select('.d3c-legend-swatch');
    swatch.selectAll('*').remove();
    swatch
      .attr('class', swatchClass)
      .each(createSwatch(Legend.swatches, props.swatchDimensions));

    // Label: Set text and vertically center
    this.select('.d3c-legend-label')
      .text(labelText)
      .attr('transform', function() {
        var offset = alignText(this, swatchHeight);
        return getTranslate(swatchWidth + 5, offset);
      });

    // Position legend items after positioning swatch/label
    this.call(stack({
      direction: props.stackDirection,
      origin: 'top',
      padding: 5,
      minHeight: swatchHeight,
      minWidth: swatchWidth
    }));

    // Position hover listeners
    var sizes = [];
    this.each(function() {
      var bbox = {
        width: swatchWidth,
        height: swatchHeight
      };
      try {
        bbox = this.getBBox();
      } catch (ex) {}

      sizes.push(bbox);
    });
    this.select('.d3c-legend-hover')
      .attr('width', function(d, i) { return sizes[i].width; })
      .attr('height', function (d, i) { return sizes[i].height; })
      .attr('transform', function(d, i) {
        var transform = null;
        if (sizes[i].height > swatchHeight) {
          var offset = (sizes[i].height - swatchHeight) / 2;
          transform = getTranslate(0, -offset);
        }

        return transform;
      });
  }
});

export var defaultStackDirection = 'vertical';
export var defaultSwatchDimensions = {width: 20, height: 20};

Legend.properties = {
  /**
    Direction to "stack" legend, `'vertical'` or `'horizontal'`.

    @property stackDirection
    @type String
    @default 'vertical'
  */
  stackDirection: {
    type: types.enum('vertical', 'horizontal'),
    getDefault: function() { return defaultStackDirection; }
  },

  /**
    Dimensions of "swatch" in px

    @property swatchDimensions
    @type Object
    @default {width: 20, height: 20}
  */
  swatchDimensions: {
    type: types.object,
    getDefault: function() { return defaultSwatchDimensions; }
  }
};

Legend.swatches = {
  'default': function(swatchDimensions) {
    this.append('circle')
      .attr('cx', swatchDimensions.width / 2)
      .attr('cy', swatchDimensions.height / 2)
      .attr('r', d3.min([swatchDimensions.width, swatchDimensions.height]) / 2)
      .attr('class', 'd3c-swatch');
  }
};

Legend.registerSwatch = function(types, create) {
  if (!Array.isArray(types)) {
    types = [types];
  }

  types.forEach(function(type) {
    this.swatches[type] = create;
  })
};

var legend = component(Legend);
export default legend;

// Helpers
// -------

export function key(d) {
  return d.key;
}

export function swatchClass(d) {
  return 'd3c-legend-swatch' + (d['class'] ? ' ' + d['class'] : '');
}

export function labelText(d) {
  return d.text;
}

export function createSwatch(swatches, swatchDimensions) {
  return function(d, i, j) {
    var swatch = d && d.type && swatches[d.type] || swatches['default'];
    if (!swatch) {
      return;
    }

    var selection = d3.select(this);
    swatch.call(selection, swatchDimensions, d, i, j);
  }
}


text:
import pygame
import sys
from pygame.locals import *

pygame.init()
screen = pygame.display.set_mode((640, 480))
pygame.mouse.set_visible(0)

while True:
    for event in pygame.event.get():
        if event.type == QUIT:
            sys.exit()
        if event.type == MOUSEMOTION:
            print("Mouse: (%d, %d)" % event.pos)


text:
///<reference path="../references.ts" />

module SupportCenter {
    "use strict";

    export class SupportCenterEvent {
        constructor(
            public EventName: string,
            public Timestamp: string,
            public EventData: NameValuePair[]
        ) {
        }
    }

    export class SupportCenterSessionData {
        constructor(
            public SessionId: string,
            public Timestamp: string,
            public Events: SupportCenterEvent[]
        ) {
        }
    }

    export class SupportCenterTicketWorkflowData {
        constructor(
            public TicketWorkflowId: string,
            public Timestamp: string,
            public MsSolveCaseId: string,
            public Sessions: SupportCenterSessionData[]
        ) {
        }
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">

<meta http-equiv="Content-Language" content="en-us">
<title>CVS</title>
<link rel="stylesheet" type="text/css" href="../style.css">

CVS

The CVS repository is at SourceForge. It can also be interactively
browsed at:

http://canvasdraw.cvs.sourceforge.net/canvasdraw/

To checkout use the module name "cd" and the CVSROOT:

:pserver:anonymous@<tt>canvasdraw.</tt>cvs.<tt>sourceforge</tt>.net:/cvsroot/canvasdraw


text:
package types

import (
	"encoding/json"
	"fmt"
	"strings"

	"github.com/gravitational/trace"
	"golang.org/x/exp/slices"
)

func (id *ResourceID) CheckAndSetDefaults() error {
	if len(id.ClusterName) == 0 {
		return trace.BadParameter("ResourceID must include ClusterName")
	}
	if len(id.Kind) == 0 {
		return trace.BadParameter("ResourceID must include Kind")
	}
	if !slices.Contains(RequestableResourceKinds, id.Kind) {
		return trace.BadParameter("Resource kind %q is invalid or unsupported", id.Kind)
	}
	if len(id.Name) == 0 {
		return trace.BadParameter("ResourceID must include Name")
	}
	return nil
}

// ResourceIDToString marshals a ResourceID to a string.
func ResourceIDToString(id ResourceID) string {
	return fmt.Sprintf("/%s/%s/%s", id.ClusterName, id.Kind, id.Name)
}

// ResourceIDFromString parses a ResourceID from a string. The string should
// have been obtained from ResourceIDToString.
func ResourceIDFromString(raw string) (ResourceID, error) {
	if len(raw) < 1 || raw[0] != '/' {
		return ResourceID{}, trace.BadParameter("%s is not a valid ResourceID string", raw)
	}
	raw = raw[1:]
	// Should be safe for any Name as long as the ClusterName and Kind don't
	// contain slashes, which should never happen.
	parts := strings.SplitN(raw, "/", 3)
	if len(parts) != 3 {
		return ResourceID{}, trace.BadParameter("/%s is not a valid ResourceID string", raw)
	}
	resourceID := ResourceID{
		ClusterName: parts[0],
		Kind:        parts[1],
		Name:        parts[2],
	}
	return resourceID, trace.Wrap(resourceID.CheckAndSetDefaults())
}

// ResourceIDsToString marshals a list of ResourceIDs to a string.
func ResourceIDsToString(ids []ResourceID) (string, error) {
	if len(ids) == 0 {
		return "", nil
	}
	// Marshal each ID to a string using the custom helper.
	var idStrings []string
	for _, id := range ids {
		idStrings = append(idStrings, ResourceIDToString(id))
	}
	// Marshal the entire list of strings as JSON (should properly handle any
	// IDs containing commas or quotes).
	bytes, err := json.Marshal(idStrings)
	if err != nil {
		return "", trace.BadParameter("failed to marshal resource IDs to JSON: %v", err)
	}
	return string(bytes), nil
}

// ResourceIDsFromString parses a list for resource IDs from a string. The string
// should have been obtained from ResourceIDsToString.
func ResourceIDsFromString(raw string) ([]ResourceID, error) {
	if raw == "" {
		return nil, nil
	}
	// Parse the full list of strings.
	var idStrings []string
	if err := json.Unmarshal([]byte(raw), &idStrings); err != nil {
		return nil, trace.BadParameter("failed to parse resource IDs from JSON: %v", err)
	}
	// Parse each ID using the custom helper.
	resourceIDs := make([]ResourceID, 0, len(idStrings))
	for _, idString := range idStrings {
		id, err := ResourceIDFromString(idString)
		if err != nil {
			return nil, trace.Wrap(err)
		}
		resourceIDs = append(resourceIDs, id)
	}
	return resourceIDs, nil
}


text:
"use strict";

var fluid = require("gpii-universal");
var jqUnit = fluid.require("node-jqunit");
var gpii = fluid.registerNamespace("gpii");

require("../src/language.js");

fluid.registerNamespace("gpii.tests.windows.language");

jqUnit.module("Language tests");

// Tests for getLanguageNames();
// Language code casing tests (from https://tools.ietf.org/html/rfc5646#appendix-A)
// expected => [inputs]
gpii.tests.windows.language.codeCaseTests = fluid.freezeRecursive({
    // Simple language subtag:
    "de": ["de", "DE"],
    // Language subtag plus Script subtag:
    "zh-Hant": ["zh-Hant", "ZH-Hant"],
    // Extended language subtags and their primary language subtag counterparts
    "zh-cmn-Hans-CN": ["zh-cmn-Hans-cn", "ZH-cmn-Hans-CN"],
    "cmn-Hans-CN": ["cmn-Hans-cn", "CMN-Hans-CN"],
    "yue-HK": ["yue-hk", "YUE-HK"],
    "yue": ["yue", "YUE"],

    // Language-Script-Region:
    "sr-Latn-RS": ["sr-Latn-rs", "SR-Latn-RS"],

    // Language-Variant:
    "sl-rozaj": ["sl-rozaj", "SL-rozaj"],
    "sl-rozaj-biske": ["sl-rozaj-biske", "SL-rozaj-biske"],

    // Language-Region-Variant:
    "de-CH-1901": ["de-ch-1901", "DE-CH-1901"],
    "sl-IT-nedis": ["sl-it-nedis", "SL-IT-nedis"],

    // Language-Script-Region-Variant:
    "hy-Latn-IT-arevela": ["hy-Latn-it-arevela", "HY-Latn-IT-arevela"],

    // Language-Region:
    "de-DE": ["de-de", "DE-DE"],
    "en-US": ["en-us", "EN-US"],
    "es-419": ["es-419", "ES-419"],

    // Private use subtags:
    "de-CH-x-phonebk": ["de-ch-x-phonebk", "de-ch-x-phonebk"],
    "az-Arab-x-AZE-derbend": ["az-Arab-x-AZE-derbend", "AZ-Arab-x-AZE-derbend"],

    // Private use registry values:
    "x-whatever": ["x-whatever", "x-whatever"],
    "qaa-Qaaa-QM-x-southern": ["qaa-Qaaa-qm-x-southern", "QAA-Qaaa-QM-x-southern"],
    "de-Qaaa": ["de-Qaaa", "DE-Qaaa"],
    "sr-Qaaa-RS": ["sr-Qaaa-rs", "SR-Qaaa-RS"],

    // Tags that use extensions (examples ONLY -- extensions MUST be defined by revision or update to this document, or by RFC):
    "en-US-u-islamcal": ["en-us-u-islamcal", "EN-US-u-islamcal"],
    "zh-CN-a-myext-x-private": ["zh-cn-a-myext-x-private", "ZH-CN-a-myext-x-private"],
    "en-a-myext-b-another": ["en-a-myext-b-another", "EN-a-myext-b-another"],

    // Some Invalid Tags
    "de-419-DE": ["de-419-de", "DE-419-DE"], // incorrect result
    "a-DE": "a-DE",
    "a-de": "a-de",
    "ar-a-aaa-b-bbb-a-ccc": ["ar-a-aaa-b-bbb-a-ccc", "AR-a-aaa-b-bbb-a-ccc"], // incorrect result

    "-": "-",
    "-AB": "-AB",
    "-ab": "-ab",
    "-XYZ": "-XYZ",
    "-xyz": "-xyz",

    "": ["", null, 123, 0, {}, [], NaN, fluid.identity],

    // Actual language packs for Windows
    "az-Latn-AZ": [ "az-Latn-az", "AZ-Latn-AZ" ],
    "bs-Latn-BA": [ "bs-Latn-ba", "BS-Latn-BA" ],
    "ku-ARAB-IQ": [ "ku-ARAB-iq", "KU-ARAB-IQ" ],
    "chr-CHER-US": [ "chr-CHER-us", "CHR-CHER-US" ],
    "prs-AF": [ "prs-af", "PRS-AF" ],
    "fil-PH": [ "fil-ph", "FIL-PH" ],
    "ha-Latn-NG": [ "ha-Latn-ng", "HA-Latn-NG" ],
    "iu-Latn-CA": [ "iu-Latn-ca", "IU-Latn-CA" ],
    "quc-Latn-GT": [ "quc-Latn-gt", "QUC-Latn-GT" ],
    "qut-GT": [ "qut-gt", "QUT-GT" ],
    "kok-IN": [ "kok-in", "KOK-IN" ],
    "pa-Arab-PK": [ "pa-Arab-pk", "PA-Arab-PK" ],
    "quz-PE": [ "quz-pe", "QUZ-PE" ],
    "sr-Cyrl-BA": [ "sr-Cyrl-ba", "SR-Cyrl-BA" ],
    "sr-Cyrl-CS": [ "sr-Cyrl-cs", "SR-Cyrl-CS" ],
    "sr-Cyrl-RS": [ "sr-Cyrl-rs", "SR-Cyrl-RS" ],
    "nso-ZA": [ "nso-za", "NSO-ZA" ],
    "sd-Arab-PK": [ "sd-Arab-pk", "SD-Arab-PK" ],
    "tg-Cyrl-TJ": [ "tg-Cyrl-tj", "TG-Cyrl-TJ" ],
    "uz-Latn-UZ": [ "uz-Latn-uz", "UZ-Latn-UZ" ],
    "ca-ES-valencia": [ "ca-ES-valencia", "CA-ES-valencia" ]
});

// Tests for getLanguageNames();
gpii.tests.windows.language.nameTests = fluid.freezeRecursive([
    {
        input: "en",
        expect: {
            "en": {
                "english": "English",
                "local": "English",
                "native": "English",
                "code": "en"
            }
        }
    },
    // Perform the tests in a single chunk, to save starting so many processes.
    {
        input: ["en-US", "eN-Gb", "eN-Gb", "es-ES", "es-MX", "fr", "bg", "bg-BG", "bg-GB", "ta-LK", "zh-DE", "en-xyz"],
        expect: {
            "en-US": {
                "english": "English (United States)",
                "local": "English (United States)",
                "native": "English (United States)",
                "code": "en-US",
                "current": true
            },
            "eN-Gb": {
                "english": "English (United Kingdom)",
                "local": "English (United Kingdom)",
                "native": "English (United Kingdom)",
                "code": "eN-Gb"
            },
            "es-ES": {
                "english": "Spanish (Spain)",
                "local": "Spanish (Spain)",
                "native": "Español (España)",
                "code": "es-ES"
            },
            "es-MX": {
                "english": "Spanish (Mexico)",
                "local": "Spanish (Mexico)",
                "native": "Español (México)",
                "code": "es-MX"
            },
            "fr": {
                "english": "French",
                "local": "French",
                "native": "français",
                "code": "fr"
            },
            "bg": {
                "english": "Bulgarian",
                "local": "Bulgarian",
                "native": "български",
                "code": "bg"
            },
            "bg-BG": {
                "english": "Bulgarian",
                "local": "Bulgarian",
                "native": "български",
                "code": "bg-BG"
            },
            "bg-GB": {
                "english": "Bulgarian (bg-GB)",
                "local": "Bulgarian (bg-GB)",
                "native": "български (bg-GB)",
                "code": "bg-GB"
            },
            "ta-LK": {
                "english": "Tamil (Sri Lanka)",
                "local": "Tamil (Sri Lanka)",
                "native": "தமிழ் (இலங்கை)",
                "code": "ta-LK"
            },
            "zh-DE": {
                "english": "Chinese (zh-DE)",
                "local": "",
                "native": "",
                "code": "zh-DE"
            },
            "en-xyz": {
                "english": "English (en-xyz)",
                "local": "English (en-xyz)",
                "native": "English (en-xyz)",
                "code": "en-xyz"
            }
        }
    },
    {
        input: ["zz-DE", "zz-AA", "zz", "", 1, "-", "a"],
        expect: {
            // Valid, but unknown
            "zz-DE": {"english": "", "local": "", "native": "", code: "zz-DE"},
            "zz-AA": {"english": "", "local": "", "native": "", code: "zz-AA"},
            "zz": {"english": "", "local": "", "native": "", code: "zz"},
            // Invalid
            "": {"english": null, "local": null, "native": null, code: ""},
            1: {"english": null, "local": null, "native": null, code: "1"},
            "-": {"english": null, "local": null, "native": null, code: "-"},
            "a": {"english": null, "local": null, "native": null, code: "a"}
        }
    }
]);

// If the GPII_IGNORE_LANGTEST environment variable is set, then ignore the test results that would be affected by the
// current language (but still run the code).
gpii.tests.windows.language.ignoreResults = !!process.env.GPII_IGNORE_LANGTEST;
if (gpii.tests.windows.language.ignoreResults) {
    fluid.log("SOFT-FAIL: GPII_IGNORE_LANGTEST is set - ignoring the results.");
}

jqUnit.test("Checking current language", function () {
    jqUnit.expect(gpii.tests.windows.language.ignoreResults ? 0 : 1);

    // Windows language identifier for en-US
    var englishUS = 1033;
    var lcid = gpii.windows.kernel32.GetThreadUILanguage();

    if (!gpii.tests.windows.language.ignoreResults) {
        // The tests expect the current language to be en-US. Fail in an obvious manner before attempting the tests.
        // Those brave enough to run the tests on a non-vagrant box are free to ignore these tests.
        jqUnit.assertEquals("The current language must be English (US) [en-US]. " +
            "Set GPII_IGNORE_LANGTEST to ignore the language failures.", englishUS, lcid);
    }
});

jqUnit.test("Test language code casing", function () {
    var tests = gpii.tests.windows.language.codeCaseTests;
    fluid.each(tests, function (inputs, langCode) {
        inputs = fluid.makeArray(inputs);
        inputs.push(langCode);

        fluid.each(inputs, function (input) {
            console.log(langCode, input);
            var result = gpii.windows.language.fixCodeCase(input);
            jqUnit.assertEquals("Language case should be correct", langCode, result);
        });
    });

});

jqUnit.test("Test getting current display language", function () {
    jqUnit.expect(gpii.tests.windows.language.ignoreResults ? 1 : 2);

    var origLangCode = gpii.windows.readRegistryKey(
        "HKEY_CURRENT_USER", "Control Panel\\Desktop", "PreferredUILanguages", "REG_SZ").value;

    try {
        // Try it with a language in the registry
        var langCode = "nl-BE";
        gpii.windows.writeRegistryKey(
            "HKEY_CURRENT_USER", "Control Panel\\Desktop", "PreferredUILanguages", langCode, "REG_SZ");

        var result1 = gpii.windows.language.getDisplayLanguage();
        jqUnit.assertEquals("getDisplayLanguage must return what the registry was set to", langCode, result1);

        // Try without a language in the registry - it should be the thread's language.
        gpii.windows.writeRegistryKey(
            "HKEY_CURRENT_USER", "Control Panel\\Desktop", "PreferredUILanguages", undefined, "REG_SZ");

        var result2 = gpii.windows.language.getDisplayLanguage();
        if (!gpii.tests.windows.language.ignoreResults) {
            jqUnit.assertEquals("getDisplayLanguage must return what the registry was set to", result2, "en-US");
        }

    } finally {
        gpii.windows.writeRegistryKey(
            "HKEY_CURRENT_USER", "Control Panel\\Desktop", "PreferredUILanguages", origLangCode, "REG_SZ");
    }

});

jqUnit.asyncTest("Test getting language names", function () {
    var tests = gpii.tests.windows.language.nameTests;

    jqUnit.expect(Object.keys(tests).length * (gpii.tests.windows.language.ignoreResults ? 1 : 2));
    var language = gpii.windows.language({
        listeners: {
            "onCreate.update": fluid.identity
        }
    });

    var doTest = function (testIndex) {
        var test = tests[testIndex];
        if (test) {
            var p = language.getLanguageNames(test.input);
            jqUnit.assertTrue("getLanguageNames must return a promise", fluid.isPromise(p));

            p.then(function (result) {
                if (!gpii.tests.windows.language.ignoreResults) {
                    jqUnit.assertDeepEq("Language names for '" + test.input + "' should match the expected",
                        test.expect, result);
                }
                doTest(testIndex + 1);
            }, fluid.fail);
        } else {
            language.destroy();
            jqUnit.start();
        }
    };

    doTest(0);

});

jqUnit.asyncTest("Test getting installed languages", function () {
    jqUnit.expect(gpii.tests.windows.language.ignoreResults ? 6 : 7);

    var currentLanguage = gpii.windows.language.getDisplayLanguage();
    fluid.log("currentLanguage:" + currentLanguage);
    jqUnit.assertNotNull("getDisplayLanguage should return something", currentLanguage);

    // The expected value for the en-US field of the installed languages.
    var expect = {
        english: "English (United States)",
        local: "English (United States)",
        native: "English (United States)",
        code: "en-US",
        current: currentLanguage === "en-US"
    };

    var language = gpii.windows.language();

    // Check the model update
    language.applier.change("installedLanguages", {}, "DELETE");
    language.applier.modelChanged.addListener("installedLanguages", function (newValue) {
        if (gpii.tests.windows.language.ignoreResults) {
            jqUnit.assert("installedLanguages changed");
        } else {
            jqUnit.assertDeepEq("Model ", expect, newValue["en-US"]);
        }
    });

    var p = language.getInstalledLanguages();

    jqUnit.assertTrue("getInstalledLanguages should return a promise", fluid.isPromise(p));

    p.then(function (result) {
        jqUnit.assertTrue("getInstalledLanguages should return an object", fluid.isPlainObject(result, true));
        jqUnit.assertTrue("getInstalledLanguages result should have fields", Object.keys(result).length > 0);

        if (!gpii.tests.windows.language.ignoreResults) {
            var enUS = result["en-US"];
            jqUnit.assertDeepEq("getInstalledLanguages should return en-US", expect, enUS);
        }

        // Calling the second time, the list should be the same and will therefore resolve with null
        language.getInstalledLanguages().then(function (result2) {
            jqUnit.assertNull("Second call to getInstalledLanguages should resolve with null", result2);

            language.destroy();
            jqUnit.start();
        }, fluid.fail);
    }, fluid.fail);
});


text:
var Step = require('step')
    , _ = require('underscore')
    , tilelive   = require('tilelive');

require('tilelive-mapnik').registerProtocols(tilelive);
require('tilelive-bridge').registerProtocols(tilelive);

module.exports = function(timeout, mml_store){

    var renderKey = "<%= mapKey %>:<%= datasource %>:<%= pathname %>:<%= dbname %>:<%= format %>:<%= geom_type %>:<%= sql %>:<%= interactivity %>:<%= style %>";
    var baseKey   = "<%= mapKey %>";

    var me = {
        renderers: {},
        timeouts:{},
        timeout: timeout || 60000
    };

    // Create a string ID from a datasource.
    me.createKey = function(params) {
        var opts =  _.extend({}, params); // as params is a weird arrayobj right here
        delete opts.x;
        delete opts.y;
        delete opts.z;
        delete opts.callback;
        _.defaults(opts, { mapKey:'', datasource: '', pathname: '', dbname:'', format:'', geom_type:'', sql:'', interactivity:'', style:''});
        return _.template(renderKey, opts);
    };

    // Acquire preconfigured mapnik resource.
    // - `options` {Object} options to be passed to constructor
    // - `callback` {Function} callback to call once acquired.
    me.acquire = function(options, callback) {
        var id = this.makeId(options);
        if (!this.pools[id]) {
            this.pools[id] = this.makePool(id, options);
        }
        this.pools[id].acquire(function(err, resource) {
            callback(err, resource);
        });
    };

    // if renderer exists at key, return it, else generate a new one and save at key
    me.getRenderer = function(req, callback){

        // TODO: this is very suboptimal
        if (req.params.cache_buster){
            this.reset(req);
        }

        var key  = this.createKey(req.params);
        var that = this;

		if(this.renderers[key]){
			// reset cache timeout
            clearTimeout(this.timeouts[key]);
            that.timeouts[key] = setTimeout(that.del.bind(that, key), that.timeout);

            return callback(null, this.renderers[key]);
		}

		Step(
			function(){
				that.makeRenderer(req.params, this);
			},
			function(err, data){
				if (err) throw err;

				// only cache the first. throw the rest away
				// TODO Check that the GC properly garbage collects these single use renderers
				if (!that.renderers[key])
					that.renderers[key] = data;

				if (!that.timeouts[key])
					that.timeouts[key]  = setTimeout(that.del.bind(that, key), that.timeout);

				callback(err, data);
			},
			function handleError(err, data){
				callback(err, data);
			}
		);
    };

    me.makeRenderer = function(params, callback){
        var that = this;

        Step(
			function getXmlPathOrString() {
                if(params.pathname) {
                    return this(null, null, params.pathname);
                }

                mml_store.mml_builder(params).toXML(this);
			},
            function loadMapnik(err, xml, pathname){
                if (err) throw err;

				var query = {
					base: that.createKey(params) + new Date().getTime(),
					metatile: 1,
					bufferSize: 64
				};

                var uri = {
                    query: query,
                    protocol: params.format === 'pbf' ? 'bridge:' : 'mapnik:',
                    slashes: true,
                    xml: xml,
                    pathname: pathname
                };

                tilelive.load(uri, this);
            },
            function returnCallback(err, source){
                callback(err, source);
            }
        );
    };

    me.purge = function(){
        var that = this;
        _.each(_.keys(that.renderers), function(key){
            that.del(key);
        });
    };

    // Clears out all renderers related to a given table, regardless of other arguments
    // TODO: Make less blocking
    me.reset = function(req){
        var base_key = _.template(baseKey, req.params);
        var regex = new RegExp('^' + base_key + '.*');
        var that = this;

        _.each(_.keys(this.renderers), function(key){
            if(key.match(regex)){
                that.del(key);
            }
        });
    };

    // drain render pools, remove renderer and associated timeout calls
    me.del = function(id){
        this.renderers[id]._pool.destroyAllNow();
        delete this.renderers[id];
        if (this.timeouts[id]) {
            clearTimeout(this.timeouts[id]);
            delete this.timeouts[id];
        }
    };

    return me;
};


text:
using System;
using System.Collections.Generic;
using System.Text;
#endregion

namespace Spacewar
{
    /// <summary>
    /// Represents the current state of each player in the game
    /// </summary>
    public class Player
    {
        /// <summary>
        /// The current ship class the player is using
        /// </summary>
        private ShipClass shipClass = ShipClass.Pencil;

        /// <summary>
        /// The current skin the player ship is using
        /// </summary>
        private int skin;

        /// <summary>
        /// The amount of cash the current player has to spend
        /// </summary>
        private int cash;

        /// <summary>
        /// The current weapon the player is using
        /// </summary>
        private ProjectileType projectileType = ProjectileType.Peashooter;

        /// <summary>
        /// The current score for this player
        /// </summary>
        private int score;

        /// <summary>
        /// The current health level for this player
        /// </summary>
        private int health = 5;

        #region Properties
        public ShipClass ShipClass
        {
            get
            {
                return shipClass;
            }
            set
            {
                shipClass = value;
            }
        }

        public int Cash
        {
            get
            {
                return cash;
            }
            set
            {
                cash = value;
            }
        }

        public int Score
        {
            get
            {
                return score;
            }
            set
            {
                score = value;
            }
        }

        public int Skin
        {
            get
            {
                return skin;
            }
            set
            {
                skin = value;
            }
        }

        public int Health
        {
            get
            {
                return health;
            }
            set
            {
                health = value;
            }
        }

        public ProjectileType ProjectileType
        {
            get
            {
                return projectileType;
            }
            set
            {
                projectileType = value;
            }
        }
        #endregion

    }
}


text:
<?php

function lxlog($obj, $file = __FILE__, $line = __LINE__, $func = __FUNCTION__, $append = 1)
{
    /* lxlog function is intended for temporal use only, during development stage, so, is subject of changes without further notice
    * http://php.net/manual/en/language.constants.predefined.php
    * http://www.php.net/manual/en/functions.arguments.php
    */
    $o = "*** Current lxlog first line ***\n";
    $o .= 'Date     : '.date('Y-m-d H:i:s')."\n";
    $o .= 'File     : '.$file."\n";
    $o .= 'Line     : '.$line."\n";
    $o .= 'Function : '.$func."\n";
    $o .= "Object   :\n";
    ob_start();
    echo print_r($obj, true);
    $o .= ob_get_clean();
    $o .= "\n*** Current lxlog call last line ***\n";
    if ($append == 1) {
        file_put_contents('./lx.log', $o, FILE_APPEND);
    } else {
        file_put_contents('./lx.log', $o);
    }
    //***** Este es el toque de MaTT luego lo hacemos fumar
    //error_log(print_r($bean_fetched_row,1),3,"/tmp/error_log");
} //fin lxlog

function getRelationshipByModules($m1, $m2)
{
    global $db,$dictionary,$beanList;
    $rel = new Relationship();
    if ($rel_info = $rel->retrieve_by_sides($m1, $m2, $db)) {
        $bean = BeanFactory::getBean($m1);
        $rel_name = $rel_info['relationship_name'];
        foreach ($bean->field_defs as $field => $def) {
            if (isset($def['relationship']) && $def['relationship'] == $rel_name) {
                return array('relationship' => $def['name'], 'module' => $m1);
            }
        }
    } elseif ($rel_info = $rel->retrieve_by_sides($m2, $m1, $db)) {
        $bean = BeanFactory::getBean($m2);
        $rel_name = $rel_info['relationship_name'];
        foreach ($bean->field_defs as $field => $def) {
            if (isset($def['relationship']) && $def['relationship'] == $rel_name) {
                return array('relationship' => $def['name'], 'module' => $m2);
            }
        }
    }

    return array('relationship' => "Not found a relationship between {$m1} and {$m2}", 'module' => 'none');
}

/*
 * This function send a email from crm
 * */

function lxSendEmail2($dataMail)
{
    include_once 'include/SugarPHPMailer.php';
    include_once 'include/utils/db_utils.php'; // for from_html function
    global $db, $sugar_config, $current_user;
    $query = "select id, name from email_templates where name = '".$dataMail['template']."';";
    $results = $db->query($query);
    $idTemplate = '';
    while ($row = $db->fetchByAssoc($results)) {
        $idTemplate = $row['id'];
    }
    $emailtemplate = new EmailTemplate();
    if ($idTemplate != '') {
        $emailtemplate->retrieve($idTemplate);
        $emailtemplate->subject = from_html($emailtemplate->subject);
        $emailtemplate->body_html = from_html($emailtemplate->body_html);
        $emailtemplate->body = from_html($emailtemplate->body);

        if ($dataMail['replaceBody']) {
            $emailtemplate->body_html = str_replace('{{maincontent}}', $dataMail['body'], $emailtemplate->body_html);
        }

        if ($dataMail['replaceSubject']) {
            $emailtemplate->subject = from_html($dataMail['subject']);
        }
    }

    $mail = new SugarPHPMailer();
    $mail->IsHTML(true);
    if ($idTemplate != '' && isset($emailtemplate->text_only) && $emailtemplate->text_only) {
        $this->description_html = '';
        $mail->IsHTML(false);
    }
    $mail->Sender = $dataMail['sender'];
    $mail->From = $dataMail['from'];
    $mail->ClearAllRecipients();
    $mail->ClearReplyTos();
    $mail->FromName = $dataMail['fromName'];
    $mail->Subject = ($idTemplate != '') ? $emailtemplate->subject : $dataMail['subject'];
    $mail->Body = ($idTemplate != '') ? $emailtemplate->body_html : $dataMail['body'];

    if (count($dataMail['toEmails']) <= 0) {
        return 0;
    }
    foreach ($dataMail['toEmails'] as $email) {
        $mail->AddAddress($email);
    }
    $mail->prepForOutbound();
    $mail->setMailerForSystem();
    $success = $mail->Send();
    if (!$success) {
        error_log('Email failed to send. '.$mail->ErrorInfo);

        return 0;
    }

    createEmailsBeans($mail, $dataMail);

    /*registrar mail, de dnd saco al dueno assigned usr ir,
    $mail=new Emails();
     */

    return 1;
}

function createEmailsBeans($mail, $dataMail)
{
    $db = DBManagerFactory::getInstance();

    //$result=$db->query($q, true, 'FAILD' );
    //$r=array();
    //while(($row= $db->fetchByAssoc($result))){
//        $r[]=$row;
//    }

//----------------------------------------------------------------------------------------------------
    // 1ero se busca el bean id y el bean module de cada email,
    //en caso de que un contacto , lead o account
    //tengan el mismo email se tomara el mas reciente por fecha
    //entiendade email como la instancia del obj Email()

    $arrEmails = array();
    foreach ($dataMail['toEmails'] as $email) {
        $obj = array();
        $obj['conBean'] = 0;
        $obj['address'] = $email;
        $obj['beanId'] = '';
        $obj['beanModule'] = '';
        $obj['emailId'] = '-1';
        $obj['addressId'] = '-1';

        $qry0 = "SELECT
                 b.id as addressId, a.bean_id ,  a.bean_module,b.date_created
                FROM
                    email_addr_bean_rel a inner join
                    email_addresses b on a.email_address_id=b.id
                WHERE
            a.deleted=0
            AND b.deleted=0
            AND b.email_address='".$email."'
            ORDER BY a.date_created asc, bean_module";
        $result = $db->query($qry0);
        while (($row = $db->fetchByAssoc($result)) != null) {
            $obj['conBean'] = 1;
            $obj['addressId'] = $row['addressId'];
            $obj['beanId'] = $row['bean_id'];
            $obj['beanModule'] = $row['bean_module'];
        }
        $arrEmails[] = $obj;
    }

//----------------------------------------------------------------------------------------------------
// 2do Se crearn los registros de EMAILS por cada direccion de correo, relacionandolos con los beans correctos

    foreach ($arrEmails as &$objBean) {
        if ($objBean['conBean'] == 1) {
            $mail2 = new Email();
            $mail2->save();
            $mail2->assigned_user_id = 2;
            $mail2->modified_user_id = 2;
            $mail2->created_by = 2;
            $mail2->deleted = 0;
            $mail2->date_sent = $mail2->date_entered;
            $mail2->name = $mail->Subject;
            $mail2->type = 'out';
            $mail2->status = 'sent';
            $mail2->falgged = 0;
            $mail2->reply_to_status = 0;
            $mail2->intent = 'pick';
            $mail2->parent_id = $objBean['beanId'];
            $mail2->parent_type = $objBean['beanModule'];
            $mail2->save();
            $objBean['emailId'] = ''.$mail2->id;
        }
    }

//----------------------------------------------------------------------------------------------------
//3ro Se inserta el email de envio (from) de los emails ya creados
//optenemos el email del usuario id=2 primero

    $objUser = array();
    $objUser['id'] = -1;
    $objUser['email_address'] = '';

    $query2 = "SELECT b.id,b.email_address
        FROM email_addr_bean_rel a inner join email_addresses b on a.email_address_id=b.id
        WHERE a.deleted=0 AND a.bean_id='2';";
    $result = $db->query($query2);
    while (($row = $db->fetchByAssoc($result)) != null) {
        $objUser['addressId'] = $row['id'];
        $objUser['email_address'] = $row['email_address'];
    }

    if ($objUser['addressId'] == -1) {
        return 'ERROR:USER ID 2 IS NOT CONFIGURED';
    }
//...
// ahora se inserta en emails_email_addr_rel, para todos los emails creados el usuario q envia
// es decir usuario id=2

//lxlog('',0);

    foreach ($arrEmails as &$objBean) {
        //      lxlog($objBean,1);
        if ($objBean['conBean'] == 1) {
            $queryInsert3 = "insert into emails_email_addr_rel
                                                          (id,
                                                           email_id,
                                                           address_type,
                                                           email_address_id,
                                                           deleted)
                                                           values
                                                           (
                                                           uuid(),
                                                           '".$objBean['emailId']."',
                                                           'from',
                                                           '".$objUser['addressId']."',
                                                           0
                                                           );";

            $result = $db->query($queryInsert3);
        }
    }

//----------------------------------------------------------------------------------------------------
//4to, se insertan en emails_email_addr_rel los TO de los emails ya creados

    foreach ($arrEmails as &$objBean) {
        if ($objBean['conBean'] == 1) {
            $queryInsert2 = "insert into emails_email_addr_rel
                                                      (id,
                                                       email_id,
                                                       address_type,
                                                       email_address_id,
                                                       deleted)
                                                       values
                                                       (
                                                       uuid(),
                                                       '".$objBean['emailId']."',
                                                       'to',
                                                       '".$objBean['addressId']."',
                                                       0
                                                       );";
            $result = $db->query($queryInsert2);
        }
    }

//----------------------------------------------------------------------------------------------------
//5to se inserta el cuerpo de los emails en emails_text por cada email creado
//lxlog($mail->Body,0);
    foreach ($arrEmails as &$objBean) {
        if ($objBean['conBean'] == 1) {
            $queryInsert4 = "insert into emails_text(
                                                  email_id,
                                                  from_addr,
                                                  to_addrs,
                                                  description,
                                                  description_html,
                                                  deleted)values
                                                  (
                                                 '".$objBean['emailId']."',
                                                 '".$objUser['email_address']."',
                                                 '".$objBean['address']."',
                                                 '".html2text($mail->Body)."',
                                                 '".html2text($mail->Body)."',
                                                 0
                                                  );";
            //...
            $qd = "delete from emails_text where email_id='".$objBean['emailId']."'";
            //Parche necesario para insertar correctamente los datos en emails_text
            $result = $db->query($qd);
            $result = $db->query($queryInsert4);
        }
    }

//Listo, los emails se enviaron y se registraron correctamente

    return 1;
}


text:
/** @constructor */
ScalaJS.c.scala_collection_concurrent_RestartException$ = (function() {
  ScalaJS.c.java_lang_Throwable.call(this)
});
ScalaJS.c.scala_collection_concurrent_RestartException$.prototype = new ScalaJS.inheritable.java_lang_Throwable();
ScalaJS.c.scala_collection_concurrent_RestartException$.prototype.constructor = ScalaJS.c.scala_collection_concurrent_RestartException$;
ScalaJS.c.scala_collection_concurrent_RestartException$.prototype.scala$util$control$NoStackTrace$$super$fillInStackTrace__Ljava_lang_Throwable = (function() {
  return ScalaJS.c.java_lang_Throwable.prototype.fillInStackTrace__Ljava_lang_Throwable.call(this)
});
ScalaJS.c.scala_collection_concurrent_RestartException$.prototype.fillInStackTrace__Ljava_lang_Throwable = (function() {
  return ScalaJS.impls.scala_util_control_NoStackTrace$class__fillInStackTrace__Lscala_util_control_NoStackTrace__Ljava_lang_Throwable(this)
});
ScalaJS.c.scala_collection_concurrent_RestartException$.prototype.readResolve__p2__O = (function() {
  return ScalaJS.modules.scala_collection_concurrent_RestartException()
});
ScalaJS.c.scala_collection_concurrent_RestartException$.prototype.init___ = (function() {
  ScalaJS.c.java_lang_Throwable.prototype.init___.call(this);
  ScalaJS.moduleInstances.scala_collection_concurrent_RestartException = this;
  ScalaJS.impls.scala_util_control_NoStackTrace$class__$init$__Lscala_util_control_NoStackTrace__V(this);
  return this
});
ScalaJS.c.scala_collection_concurrent_RestartException$.prototype.scala$util$control$NoStackTrace$$super$fillInStackTrace__ = (function() {
  return this.scala$util$control$NoStackTrace$$super$fillInStackTrace__Ljava_lang_Throwable()
});
/** @constructor */
ScalaJS.inheritable.scala_collection_concurrent_RestartException$ = (function() {
  /*<skip>*/
});
ScalaJS.inheritable.scala_collection_concurrent_RestartException$.prototype = ScalaJS.c.scala_collection_concurrent_RestartException$.prototype;
ScalaJS.is.scala_collection_concurrent_RestartException$ = (function(obj) {
  return (!(!((obj && obj.$classData) && obj.$classData.ancestors.scala_collection_concurrent_RestartException$)))
});
ScalaJS.as.scala_collection_concurrent_RestartException$ = (function(obj) {
  if ((ScalaJS.is.scala_collection_concurrent_RestartException$(obj) || (obj === null))) {
    return obj
  } else {
    ScalaJS.throwClassCastException(obj, "scala.collection.concurrent.RestartException")
  }
});
ScalaJS.isArrayOf.scala_collection_concurrent_RestartException$ = (function(obj, depth) {
  return (!(!(((obj && obj.$classData) && (obj.$classData.arrayDepth === depth)) && obj.$classData.arrayBase.ancestors.scala_collection_concurrent_RestartException$)))
});
ScalaJS.asArrayOf.scala_collection_concurrent_RestartException$ = (function(obj, depth) {
  if ((ScalaJS.isArrayOf.scala_collection_concurrent_RestartException$(obj, depth) || (obj === null))) {
    return obj
  } else {
    ScalaJS.throwArrayCastException(obj, "Lscala.collection.concurrent.RestartException;", depth)
  }
});
ScalaJS.data.scala_collection_concurrent_RestartException$ = new ScalaJS.ClassTypeData({
  scala_collection_concurrent_RestartException$: 0
}, false, "scala.collection.concurrent.RestartException$", ScalaJS.data.java_lang_Throwable, {
  scala_collection_concurrent_RestartException$: 1,
  scala_util_control_ControlThrowable: 1,
  scala_util_control_NoStackTrace: 1,
  java_lang_Throwable: 1,
  java_io_Serializable: 1,
  java_lang_Object: 1
});
ScalaJS.c.scala_collection_concurrent_RestartException$.prototype.$classData = ScalaJS.data.scala_collection_concurrent_RestartException$;
ScalaJS.moduleInstances.scala_collection_concurrent_RestartException = undefined;
ScalaJS.modules.scala_collection_concurrent_RestartException = (function() {
  if ((!ScalaJS.moduleInstances.scala_collection_concurrent_RestartException)) {
    ScalaJS.moduleInstances.scala_collection_concurrent_RestartException = new ScalaJS.c.scala_collection_concurrent_RestartException$().init___()
  };
  return ScalaJS.moduleInstances.scala_collection_concurrent_RestartException
});
//@ sourceMappingURL=RestartException$.js.map


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
in Samuels, Doi & Rogerson, Mem. N. Y. bot. Gdn 59: 40 (1990)

#### Original name
Nectria macrochaetopsinae Samuels

### Remarks
null


text:
set -x
set -e

VERSION=2.5.0
cd /root
wget "https://github.com/pybind/pybind11/archive/v${VERSION}.zip"
unzip v${VERSION}.zip
cd pybind11-${VERSION}
mkdir -p build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr/local \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_PREFIX_PATH=/usr/local/include/python3 \
	..
make -j
make install
echo "/usr/local/lib" >> /etc/ld.so.conf.d/pybind11.conf
ldconfig

cd /root
rm -rf *.zip pybind11-${VERSION}


text:
package org.apache.phoenix.pherf.configuration;

import java.io.OutputStream;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;

import org.apache.phoenix.pherf.PherfConstants;
import org.apache.phoenix.pherf.exception.FileLoaderException;
import org.apache.phoenix.pherf.util.ResourceList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class XMLConfigParser {

    private static final Logger logger = LoggerFactory.getLogger(XMLConfigParser.class);
    private String filePattern;
    private List<DataModel> dataModels;
    private List<Scenario> scenarios = null;
    private ResourceList resourceList;
    private Collection<Path> paths = null;

    public XMLConfigParser(String pattern) throws Exception {
        init(pattern);
    }

    public List<DataModel> getDataModels() {
        return dataModels;
    }

    public DataModel getDataModelByName(String name) {
        for (DataModel dataModel : getDataModels()) {
            if (dataModel.getName().equals(name)) {
                return dataModel;
            }
        }
        return null;
    }

    public Scenario getScenarioByName(String name) throws Exception {
        for (Scenario scenario : getScenarios()) {
            if (scenario.getName().equals(name)) {
                return scenario;
            }
        }
        return null;
    }

    public synchronized Collection<Path> getPaths(String strPattern) throws Exception {
        if (paths != null) {
            return paths;
        }
        paths = getResources(strPattern);
        return paths;
    }

    public synchronized List<Scenario> getScenarios() throws Exception {
        if (scenarios != null) {
            return scenarios;
        }

        scenarios = Collections.synchronizedList(new ArrayList<Scenario>());
        for (Path path : getPaths(getFilePattern())) {
            try {
                List<Scenario> scenarioList = XMLConfigParser.readDataModel(path).getScenarios();
                for (Scenario scenario : scenarioList) {
                    scenarios.add(scenario);
                }
            } catch (JAXBException e) {
                e.printStackTrace();
            }
        }
        return scenarios;
    }

    public String getFilePattern() {
        return filePattern;
    }

    /**
     * Unmarshall an XML data file
     *
     * @param file Name of File
     * @return {@link org.apache.phoenix.pherf.configuration.DataModel} Returns DataModel from
     * XML configuration
     * @throws JAXBException
     */
    // TODO Remove static calls
    public static DataModel readDataModel(Path file) throws JAXBException {
        JAXBContext jaxbContext = JAXBContext.newInstance(DataModel.class);
        Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
        String fName = PherfConstants.RESOURCE_SCENARIO + "/" + file.getFileName().toString();
        logger.info("Open config file: " + fName);
        return (DataModel) jaxbUnmarshaller
                .unmarshal(XMLConfigParser.class.getResourceAsStream(fName));
    }

    // TODO Remove static calls
    public static String parseSchemaName(String fullTableName) {
        String ret = null;
        if (fullTableName.contains(".")) {
            ret = fullTableName.substring(0, fullTableName.indexOf("."));
        }
        return ret;
    }

    // TODO Remove static calls
    public static String parseTableName(String fullTableName) {
        String ret = fullTableName;
        if (fullTableName.contains(".")) {
            ret = fullTableName.substring(fullTableName.indexOf(".") + 1, fullTableName.length());
        }
        // Remove any quotes that may be needed for multi-tenant tables
        ret = ret.replaceAll("\"", "");
        return ret;
    }

    // TODO Remove static calls
    @SuppressWarnings("unused")
    public static void writeDataModel(DataModel data, OutputStream output) throws JAXBException {
        // create JAXB context and initializing Marshaller
        JAXBContext jaxbContext = JAXBContext.newInstance(DataModel.class);
        Marshaller jaxbMarshaller = jaxbContext.createMarshaller();

        // for getting nice formatted output
        jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);

        // Writing to console
        jaxbMarshaller.marshal(data, output);
    }

    private void init(String pattern) throws Exception {
        if (dataModels != null) {
            return;
        }
        this.filePattern = pattern;
        this.dataModels = new ArrayList<>();
        this.resourceList = new ResourceList(PherfConstants.RESOURCE_SCENARIO);
        this.paths = getResources(this.filePattern);
        if (this.paths.isEmpty()) {
            throw new FileLoaderException(
                    "Could not load the resource files using the pattern: " + pattern);
        }
        for (Path path : this.paths) {
            System.out.println("Adding model for path:" + path.toString());
            this.dataModels.add(XMLConfigParser.readDataModel(path));
        }
    }

    private Collection<Path> getResources(String pattern) throws Exception {
        return resourceList.getResourceList(pattern);
    }
}


text:
package edu.usu.sdl.openstorefront.web.action.resolution;

import java.io.IOException;
import java.io.InputStream;
import java.text.MessageFormat;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sourceforge.stripes.action.StreamingResolution;
import net.sourceforge.stripes.util.Range;
import org.apache.commons.lang3.StringUtils;

/**
 * Handles media streams with client aborts
 *
 * @author dshurtleff
 */
public class RangeResolution
		extends StreamingResolution
{

	private static final Logger log = Logger.getLogger(RangeResolution.class.getName());

	private static final String MULTIPART_BOUNDARY = "BOUNDARY_F7C98B76AEF711DF86D1B4FCDFD72085";
	private long totalLength = 0;
	private InputStream in;
	private HttpServletRequest request;
	private String contentType;

	public RangeResolution(String contentType, InputStream inputStream, long totalLength, HttpServletRequest request, String filename)
	{
		super(contentType, inputStream);
		this.contentType = contentType;
		in = inputStream;
		this.totalLength = totalLength;
		if (StringUtils.isNotBlank(filename)) {
			setFilename(filename);
			setAttachment(true);
		} else {
			setAttachment(false);
		}
		setRangeSupport(true);
		setLength(totalLength);
		this.request = request;
	}

	@Override
	protected void stream(HttpServletResponse response) throws Exception
	{
		int bufferLength;
		if (in != null && totalLength >= 0) {
			byte[] buffer = new byte[512];
			long count = 0;

			try {
				ServletOutputStream out = response.getOutputStream();

				List<Range<Long>> byteRanges = parseRangeHeader(request.getHeader("Range"));
				if (byteRanges == null) {
					while ((bufferLength = in.read(buffer)) != -1) {
						out.write(buffer, 0, bufferLength);
					}
				} else {
					for (Range<Long> byteRange : byteRanges) {
						// See RFC 2616 section 14.16
						if (byteRanges.size() > 1) {
							out.print("--" + MULTIPART_BOUNDARY + "\r\n");
							out.print("Content-Type: " + contentType + "\r\n");
							out.print("Content-Range: bytes " + byteRange.getStart() + "-"
									+ byteRange.getEnd() + "/" + totalLength + "\r\n");
							out.print("\r\n");
						}
						if (count < byteRange.getStart()) {
							long skip;

							skip = byteRange.getStart() - count;
							long actualbytesSkiped = in.skip(skip);
							log.log(Level.FINEST, MessageFormat.format("Actual Bytes Skipped from range: {0}", actualbytesSkiped));
							count += skip;
						}
						while ((bufferLength = in.read(buffer, 0, (int) Math.min(
								buffer.length, byteRange.getEnd() + 1 - count))) != -1) {
							try {
								out.write(buffer, 0, bufferLength);
							} catch (IOException io) {
								//Client Abort
								break;
							}
							count += bufferLength;
							if (byteRange.getEnd() + 1 == count) {
								break;
							}
						}
						if (byteRanges.size() > 1) {
							out.print("\r\n");
						}
					}
					if (byteRanges.size() > 1) {
						out.print("--" + MULTIPART_BOUNDARY + "--\r\n");
					}
				}
			} catch (IOException io) {
				//Ignore Client Abort
				log.log(Level.FINEST, "Range Resolution Error ", io);
			} finally {
				try {
					in.close();
				} catch (Exception e) {
					log.log(Level.WARNING, "Error closing input stream", e);
				}
			}
		}

	}

}


text:
echo 'start installing aws cli'
apt-get install -y unzip
cd ~
curl 'https://s3.amazonaws.com/aws-cli/awscli-bundle.zip' -o 'awscli-bundle.zip'
unzip awscli-bundle.zip
./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
echo 'end installing aws cli'


text:
package serverinit

import (
	"fmt"
	"os"
	"strings"

	"perkeep.org/internal/osutil"
	"perkeep.org/pkg/env"
	"perkeep.org/pkg/types/serverconfig"

	"cloud.google.com/go/compute/metadata"
)

// For getting a name in camlistore.net
const (
	// CamliNetDNS is the hostname of the camlistore.net DNS server.
	CamliNetDNS = "camnetdns.camlistore.org"
	// CamliNetDomain is the camlistore.net domain name. It is relevant to
	// Perkeep, because a deployment through the Perkeep on Google Cloud launcher
	// automatically offers a subdomain name in this domain to any instance.
	CamliNetDomain = "camlistore.net"

	// useDBNamesConfig is a sentinel value for DBUnique to indicate that we want the
	// low-level configuration generator to keep on using the old DBNames
	// style configuration for database names.
	useDBNamesConfig = "useDBNamesConfig"
)

// DefaultEnvConfig returns the default configuration when running on a known
// environment. Currently this just includes Google Compute Engine.
// If the environment isn't known (nil, nil) is returned.
func DefaultEnvConfig() (*Config, error) {
	if !env.OnGCE() {
		return nil, nil
	}
	auth := "none"
	user, _ := metadata.InstanceAttributeValue("camlistore-username")
	pass, _ := metadata.InstanceAttributeValue("camlistore-password")
	confBucket, err := metadata.InstanceAttributeValue("camlistore-config-dir")
	if confBucket == "" || err != nil {
		return nil, fmt.Errorf("VM instance metadata key 'camlistore-config-dir' not set: %v", err)
	}
	blobBucket, err := metadata.InstanceAttributeValue("camlistore-blob-dir")
	if blobBucket == "" || err != nil {
		return nil, fmt.Errorf("VM instance metadata key 'camlistore-blob-dir' not set: %v", err)
	}
	if user != "" && pass != "" {
		auth = "userpass:" + user + ":" + pass
	}

	if v := osutil.SecretRingFile(); !strings.HasPrefix(v, "/gcs/") {
		return nil, fmt.Errorf("Internal error: secret ring path on GCE should be at /gcs/, not %q", v)
	}
	keyID, secRing, err := getOrMakeKeyring()
	if err != nil {
		return nil, err
	}

	highConf := &serverconfig.Config{
		Auth:               auth,
		HTTPS:              true,
		Identity:           keyID,
		IdentitySecretRing: secRing,
		GoogleCloudStorage: ":" + strings.TrimPrefix(blobBucket, "gs://"),
		PackRelated:        true,
		ShareHandler:       true,
	}

	externalIP, _ := metadata.ExternalIP()
	hostName, _ := metadata.InstanceAttributeValue("camlistore-hostname")
	// If they specified a hostname (probably with pk-deploy), then:
	// if it looks like an FQDN, perkeepd is going to rely on Let's
	// Encrypt, else perkeepd is going to generate some self-signed for that
	// hostname.
	// Also, if the hostname is in camlistore.net, we want Perkeep to initialize
	// exactly as if the instance had no hostname, so that it registers its hostname/IP
	// with the camlistore.net DNS server (possibly needlessly, if the instance IP has
	// not changed) again.
	if hostName != "" && !strings.HasSuffix(hostName, CamliNetDomain) {
		highConf.BaseURL = fmt.Sprintf("https://%s", hostName)
		highConf.Listen = "0.0.0.0:443"
	} else {
		highConf.CamliNetIP = externalIP
	}

	// Detect a linked Docker MySQL container. It must have alias "mysqldb".
	mysqlPort := os.Getenv("MYSQLDB_PORT")
	if !strings.HasPrefix(mysqlPort, "tcp://") {
		// No MySQL
		// TODO: also detect Cloud SQL.
		highConf.KVFile = "/index.kv"
		return genLowLevelConfig(highConf)
	}
	hostPort := strings.TrimPrefix(mysqlPort, "tcp://")
	highConf.MySQL = "root@" + hostPort + ":" // no password
	configVersion, err := metadata.InstanceAttributeValue("perkeep-config-version")
	if configVersion == "" || err != nil {
		// the launcher is deploying a pre-"perkeep-config-version" Perkeep, which means
		// we want the old configuration, with DBNames
		highConf.DBUnique = useDBNamesConfig
	} else if configVersion != "1" {
		return nil, fmt.Errorf("unexpected value for VM instance metadata key 'perkeep-config-version': %q", configVersion)
	}

	return genLowLevelConfig(highConf)
}


text:
__source__ = 'https://leetcode.com/problems/range-addition/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/range-addition.py
# Time:  O(k + n)
# Space: O(1)
#
# Description: Leetcode # 370. Range Addition
#
# Assume you have an array of length n initialized with all 0's and are given k update operations.
#
# Each operation is represented as a triplet: [startIndex, endIndex, inc]
# which increments each element of subarray A[startIndex ... endIndex]
# (startIndex and endIndex inclusive) with inc.
#
# Return the modified array after all k operations were executed.
#
# Example:
#
# Given:
#
#     length = 5,
#     updates = [
#         [1,  3,  2],
#         [2,  4,  3],
#         [0,  2, -2]
#     ]
#
# Output:
#
#     [-2, 0, 3, 5, 3]
# Explanation:
#
# Initial state:
# [ 0, 0, 0, 0, 0 ]
#
# After applying operation [1, 3, 2]:
# [ 0, 2, 2, 2, 0 ]
#
# After applying operation [2, 4, 3]:
# [ 0, 2, 5, 5, 3 ]
#
# After applying operation [0, 2, -2]:
# [-2, 0, 3, 5, 3 ]
#
# Companies
# Google
# Related Topics
# Array
# Similar Questions
# Range Addition II
#
import unittest
class Solution(object):
    def getModifiedArray(self, length, updates):
        """
        :type length: int
        :type updates: List[List[int]]
        :rtype: List[int]
        """
        result = [0] * length
        for update in updates:
            result[update[0]] += update[2]
            if update[1]+1 < length:
                result[update[1]+1] -= update[2]

        for i in xrange(1, length):
            result[i] += result[i-1]
        return result

class TestMethods(unittest.TestCase):
    def test_Local(self):
        self.assertEqual(1, 1)

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

Java = '''
# Thought: https://leetcode.com/problems/range-addition/solution/

# 2ms 59/22%
class Solution {
    public int[] getModifiedArray(int length, int[][] updates) {
        int[] result = new int[length];
        for (int[] update : updates) {
            result[update[0]] += update[2];
            if (update[1] < length - 1) {
                result[update[1] + 1] -= update[2];
            }
        }
        for (int i = 1; i < length; i++) {
            result[i] += result[i - 1];
        }
        return result;
    }
}

# 1ms 100%
class Solution {
     public int[] getModifiedArray(int length, int[][] updates) {
        int[] res = new int[length];
         for(int[] update : updates) {
            int value = update[2];
            int start = update[0];
            int end = update[1];
            res[start] += value;
            if (end < length - 1)
                res[end + 1] -= value;
        }

        int sum = 0;
        for(int i = 0; i < length; i++) {
            sum += res[i]; //use sum faster than user res[i] += res[i-1]
            res[i] = sum;
        }

        return res;
    }
}
'''


text:
package mediabrowser.model.entities;

public class PackageReviewInfo
{
	/**
	 The package id (database key) for this review
	*/
	private int id;
	public final int getid()
	{
		return id;
	}
	public final void setid(int value)
	{
		id = value;
	}

	/**
	 The rating value
	*/
	private int rating;
	public final int getrating()
	{
		return rating;
	}
	public final void setrating(int value)
	{
		rating = value;
	}

	/**
	 Whether or not this review recommends this item
	*/
	private boolean recommend;
	public final boolean getrecommend()
	{
		return recommend;
	}
	public final void setrecommend(boolean value)
	{
		recommend = value;
	}

	/**
	 A short description of the review
	*/
	private String title;
	public final String gettitle()
	{
		return title;
	}
	public final void settitle(String value)
	{
		title = value;
	}

	/**
	 A full review
	*/
	private String review;
	public final String getreview()
	{
		return review;
	}
	public final void setreview(String value)
	{
		review = value;
	}

	/**
	 Time of review
	*/
	private java.util.Date timestamp = new java.util.Date(0);
	public final java.util.Date gettimestamp()
	{
		return timestamp;
	}
	public final void settimestamp(java.util.Date value)
	{
		timestamp = value;
	}

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

/* Write a program that extracts from a given text all palindromes, e.g. ABBA, lamal, exe and prints them on the console on
 a single line, separated by comma and space. Use spaces, commas, dots, question marks and exclamation marks as word
 delimiters. Print only unique palindromes, sorted lexicographically.*/

namespace Palindromes
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] words = Console.ReadLine().ToLower().Split(new char[] {' ',',','.','?'});
            List<string> palindromes = new List<string>;

            foreach (var item in words)
            {
                if (IsPalindrome(words))
                {
                    palindromes.Add(item);
                }
            }

        }

        private static bool IsPalindrome(string[] word)
        {
            bool result = true;

            return result;
        }
    }
}


text:
import unittest
import os

from .. import lib

# We create and test new items in this dir
DIR = os.path.join(lib.FIXTURES_DIR, 'files', 'some_dir')

class TestCmdMkDir(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        cls.finder = lib.create_finder()
        cls.fixt = lib.CMD_FIXT['cmd_mkdir.txt'][0]

    def test_mkdir(self):
        req = self.fixt['request']
        r0 = self.fixt['response'] # expected response
        new_path = os.path.join(DIR, req['name'])

        # Make sure, the to be created subfolder does not exist
        try:
            os.rmdir(new_path)
        except OSError:
            pass # assume exception was raised because new_path does not exist

        cmd, args = lib.prepare_request(req)
        assert cmd == 'mkdir'

        # This throws exception on error
        self.finder.run(cmd, args, debug=True)

        r = self.finder.response
        #pprint(r); raise Exception("DIE")
        #pprint(r0); raise Exception("DIE")
        lib.prepare_response(r0, r)

        self.assertEqual(r0.keys(), r.keys())
        del r0['debug']
        del r['debug']
        self.maxDiff = None
        self.assertEqual(r0, r)

        # Cleanup: remove the new directory
        # If rmdir() fails, our mkdir() returned the correct response but
        # did not create the subdir correctly.
        os.rmdir(new_path)


text:
<?xml version="1.0" encoding="UTF-8" ?>
<widget xmlns   = "http://www.w3.org/ns/widgets"
    xmlns:gap   = "http://phonegap.com/ns/1.0"
    id          = "com.freshco.delivery"
    versionCode = "1"
    version     = "1.0.0" >

<!-- versionCode is optional and Android only -->

  <name>Freshco Delivery</name>

  <description>
     this is the informative application for
  </description>

  <author href="https://build.phonegap.com" email="support@phonegap.com">
      Hardeep Shoker
  </author>

     <icon src="freshco.png" />
<gap:plugin name="cordova-plugin-whitelist" source="npm" />
 <allow-intent href="http://*/*" />
<allow-navigation href="https://*/*" />

</widget>


text:
// @copyright 2013
// @author Adu Bhandaru
// Outermost game class.

Game3.Game = Game3.Class.extend({

  /**
   * Called before the object is constructed.
   * Logic sets up the camera, scene, renderer, and events.
   * @param {HTMLElement} A container for your application.
   */
  before_init: function(el) {
    this.el = el;
    var width = el.offsetWidth;
    var height = el.offsetHeight;

    // settings
    this.bindResize = true;

    // save some useful information
    this.width = width;
    this.height = height;

    // set up rendering environement
    this.camera = Game3.createCamera({ aspect: width/height });
    this.scene = Game3.createScene(this.camera);
    this.renderer = Game3.createRenderer(width, height);
    this.canvas = this.renderer.domElement;
    this.el.appendChild(this.canvas);

    // set up events
    this.events = new Game3.Events(this);
  },

  /**
   * Custom init method.
   * This should be overriden in the subclass.
   * @param {HTMLElement} A container for your application.
   */
  init: function(el) { },

  /**
   * This is run after your custom init method.
   * Start the render loop.
   * You should only do this when you are done initializing.
   * @param {HTMLElement} A container for your application.
   */
  after_init: function(el) {
    // bind resize event
    if (this.bindResize) {
      window.addEventListener('resize', this.resize.bind(this), false);
    }

    // bind render loop to timer
    Game3.renderLoop(this, this.__render);
  },

  /**
   * Interface for adding a non-interactive object to the scene. These objects
   * will not be sent mouse events, and will not affect line-of-sight events.
   * @param {THREE.Object} object The object to add to the scene.
   */
  add: function(object) {
    // robustness
    if (!object) return false;

    // adding a light to the scene
    if (object instanceof Game3.Light) {
      var light = object;
      this.scene.add(light.light());
      return true;
    }

    // adding a model to the scene
    else if (object instanceof Game3.Model) {
      var model = object;
      if (model.ready()) {
        var mesh = model.mesh();
        var hitbox = model.hitbox() || mesh;
        var interactive = model.interactive;
        if (mesh) this.scene.add(mesh);
        if (hitbox && interactive) this.events.track(hitbox);
      }

      // link and propogate actions
      if (!model.parent()) model.parent(this);
      model.__show();
      return true;
    }

    // adding a raw THREE.js object
    else if (object instanceof THREE.Light || object instanceof THREE.Object3D) {
      this.scene.add(object);
      return true;
    }

    // user tried to add something weird.
    return false;
  },

  /**
   * Meet the interface for receiving events.
   * @return {Game.Class} The Game class has no parent, always returns null.
   */
  parent: function() {
    return null;
  },

  /**
   * Called when the window is resized to fit the bounds.
   * TODO: Can we watch only for resize events to el (container Element)?
   */
  resize: function() {
    var width = this.width = this.el.offsetWidth;
    var height = this.height = this.el.offsetHeight;
    this.renderer.setSize(width, height);
    this.camera.aspect = width / height;
    this.camera.updateProjectionMatrix();
  },

  /**
   * Call any logic that would change your game state every timestep.
   * For example, animations may require you to update an object's position.
   * @return {void}
   */
  update: function(dt) { },

  //
  // Internal Game3 use only.
  //

  /**
   * This gets called by the render loop.
   * @return {void}
   */
  __render: function(dt) {
    this.update(dt);
    this.renderer.render(this.scene, this.camera);
  }

});


text:
<?php
/**
 *	base include file for SimpleTest
 *	@package	SimpleTest
 *	@subpackage	Extensions
 *	@version	$Id: recorder.php 1802 2008-09-08 10:43:58Z maetl_ $
 */

/**
 *	include other SimpleTest class files
 */
require_once(dirname(__FILE__) . '/../scorer.php');

/**
 *    Array-based test recorder. Returns an array
 *    with timestamp, status, test name and message for each pass and failure.
 *
 *    This code is made available under the same terms as SimpleTest.  It is based
 *    off of code that Rene vd O originally published in patch [ 1594212 ]
 *    on the SimpleTest patches tracker.
 *
 *    @author Rene vd O (original code)
 *    @author Perrick Penet
 *	  @package SimpleTest
 *	  @subpackage Extensions
 */
class Recorder extends SimpleReporter {
    var $results;

	function Recorder() {
        $this->SimpleReporter();
        $this->results = array();
	}

	function paintPass($message) {
        parent::paintPass($message);
        $breadcrumb = $this->getTestList();
        array_shift($breadcrumb);
        $test = implode("->", $breadcrumb);

        $result["time"] = time();
        $result["status"] = "Passed";
        $result["test"] = $test;
        $result["message"] = $message;
        $this->results[] = $result;
	}

	function paintFail($message) {
        parent::paintFail($message);
        $breadcrumb = $this->getTestList();
        array_shift($breadcrumb);
        $test = implode("->", $breadcrumb);

        $result["time"] = time();
        $result["status"] = "Failed";
        $result["test"] = $test;
        $result["message"] = $message;
        $this->results[] = $result;
	}
}

?>