# #############################################################################
# Copyright (c) 2018-present    lzutao <taolzu(at)gmail.com>
# All rights reserved.
#
# This source code is licensed under both the BSD-style license (found in the
# LICENSE file in the root directory of this source tree) and the GPLv2 (found
# in the COPYING file in the root directory of this source tree).
# #############################################################################

lz4_root_dir = '../../..'

#examples_c_args = ['-Wextra', '-Wundef', '-Wshadow', '-Wcast-align', '-Wstrict-prototypes']

printVersion = executable('printVersion',
  join_paths(lz4_root_dir, 'examples/printVersion.c'),
  dependencies: liblz4_dep,
  install: false)
doubleBuffer = executable('doubleBuffer',
  join_paths(lz4_root_dir, 'examples/blockStreaming_doubleBuffer.c'),
  dependencies: liblz4_dep,
  install: false)
dictionaryRandomAccess = executable('dictionaryRandomAccess',
  join_paths(lz4_root_dir, 'examples/dictionaryRandomAccess.c'),
  dependencies: liblz4_dep,
  install: false)
ringBuffer = executable('ringBuffer',
  join_paths(lz4_root_dir, 'examples/blockStreaming_ringBuffer.c'),
  dependencies: liblz4_dep,
  install: false)
ringBufferHC = executable('ringBufferHC',
  join_paths(lz4_root_dir, 'examples/HCStreaming_ringBuffer.c'),
  dependencies: liblz4_dep,
  install: false)
lineCompress = executable('lineCompress',
  join_paths(lz4_root_dir, 'examples/blockStreaming_lineByLine.c'),
  dependencies: liblz4_dep,
  install: false)
frameCompress = executable('frameCompress',
  join_paths(lz4_root_dir, 'examples/frameCompress.c'),
  dependencies: liblz4_dep,
  install: false)
compressFunctions = executable('compressFunctions',
  join_paths(lz4_root_dir, 'examples/compress_functions.c'),
  dependencies: liblz4_dep,
  install: false)
simpleBuffer = executable('simpleBuffer',
  join_paths(lz4_root_dir, 'examples/simple_buffer.c'),
  dependencies: liblz4_dep,
  install: false)

{'repo_name': 'treefrogframework/treefrog-framework', 'stars': '794', 'repo_language': 'C++', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': -2094570354127393912, 'source_dataset': 'data'}


pushd $SRC_DIR/.build/aarch64-sarc-linux-gnueabi/build/build-cc-gcc-final/
make DESTDIR=$PREFIX install gcc
popd

{'repo_name': 'conda/conda-recipes', 'stars': '316', 'repo_language': 'Shell', 'file_name': 'build.sh', 'mime_type': 'text/x-shellscript', 'hash': -5699215093712465649, 'source_dataset': 'data'}


<snippet>
    <content><![CDATA[
{% raw %}
$0
{% endraw %}
]]></content>
    <tabTrigger>raw</tabTrigger>
    <scope>text.html, text.html.markdown, source.json, text.html.textile, source.sass, source.scss</scope>
    <description>raw</description>
</snippet>

{'repo_name': '23maverick23/sublime-jekyll', 'stars': '156', 'repo_language': 'Python', 'file_name': 'comment.sublime-snippet', 'mime_type': 'text/plain', 'hash': -4175868748782396762, 'source_dataset': 'data'}


<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_focused="true" android:state_pressed="false" android:color="#ffffff" />
    <item android:state_focused="false" android:state_pressed="true" android:color="#343779" />
    <item android:state_focused="true" android:state_pressed="true" android:color="#A9ACE8" />
    <item android:color="#ffffff" />
</selector>

{'repo_name': 'ozodrukh/RippleDrawable', 'stars': '515', 'repo_language': 'Java', 'file_name': 'ApplicationTest.java', 'mime_type': 'text/html', 'hash': 9160605226680549647, 'source_dataset': 'data'}


; config options
; The island of trust is at example.com
server:
	trust-anchor: "example.com.    3600    IN      DS      2854 3 1 46e4ffc6e9a4793b488954bd3f0cc6af0dfb201b"
	trust-anchor: "example.net.    3600    IN      DNSKEY  256 3 5 AQPQ41chR9DEHt/aIzIFAqanbDlRflJoRs5yz1jFsoRIT7dWf0r+PeDuewdxkszNH6wnU4QL8pfKFRh5PIYVBLK3 ;{id = 30899 (zsk), size = 512b}"
	val-override-date: "20070916134226"
	target-fetch-policy: "0 0 0 0 0"
	qname-minimisation: "no"
	fake-sha1: yes
	trust-anchor-signaling: no

stub-zone:
	name: "."
	stub-addr: 193.0.14.129 	# K.ROOT-SERVERS.NET.
CONFIG_END

SCENARIO_BEGIN Test validator with cname-nxdomain with rcode nxdomain

; K.ROOT-SERVERS.NET.
RANGE_BEGIN 0 100
	ADDRESS 193.0.14.129
ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR NOERROR
SECTION QUESTION
. IN NS
SECTION ANSWER
. IN NS	K.ROOT-SERVERS.NET.
SECTION ADDITIONAL
K.ROOT-SERVERS.NET.	IN	A	193.0.14.129
ENTRY_END

ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR NOERROR
SECTION QUESTION
www.example.com. IN A
SECTION AUTHORITY
com.	IN NS	a.gtld-servers.net.
SECTION ADDITIONAL
a.gtld-servers.net.	IN 	A	192.5.6.30
ENTRY_END

ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR NOERROR
SECTION QUESTION
www.example.net. IN A
SECTION AUTHORITY
net.	IN NS	a.gtld-servers.net.
SECTION ADDITIONAL
a.gtld-servers.net.	IN 	A	192.5.6.30
ENTRY_END
RANGE_END

; a.gtld-servers.net.
RANGE_BEGIN 0 100
	ADDRESS 192.5.6.30
ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR NOERROR
SECTION QUESTION
com. IN NS
SECTION ANSWER
com.    IN NS   a.gtld-servers.net.
SECTION ADDITIONAL
a.gtld-servers.net.     IN      A       192.5.6.30
ENTRY_END

ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR NOERROR
SECTION QUESTION
net. IN NS
SECTION ANSWER
net.    IN NS   a.gtld-servers.net.
SECTION ADDITIONAL
a.gtld-servers.net.     IN      A       192.5.6.30
ENTRY_END

ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR NOERROR
SECTION QUESTION
www.example.com. IN A
SECTION AUTHORITY
example.com.	IN NS	ns.example.com.
SECTION ADDITIONAL
ns.example.com.		IN 	A	1.2.3.4
ENTRY_END
ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR NOERROR
SECTION QUESTION
www.example.net. IN A
SECTION AUTHORITY
example.net.	IN NS	ns.example.net.
SECTION ADDITIONAL
ns.example.net.		IN 	A	1.2.3.5
ENTRY_END
RANGE_END

; ns.example.com.
RANGE_BEGIN 0 100
	ADDRESS 1.2.3.4
ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR NOERROR
SECTION QUESTION
example.com. IN NS
SECTION ANSWER
example.com.    IN NS   ns.example.com.
example.com.    3600    IN      RRSIG   NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
SECTION ADDITIONAL
ns.example.com.         IN      A       1.2.3.4
ns.example.com. 3600    IN      RRSIG   A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
ENTRY_END

; response to DNSKEY priming query
ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR NOERROR
SECTION QUESTION
example.com. IN DNSKEY
SECTION ANSWER
example.com.    3600    IN      DNSKEY  256 3 3 ALXLUsWqUrY3JYER3T4TBJII s70j+sDS/UT2QRp61SE7S3E EXopNXoFE73JLRmvpi/UrOO/Vz4Se 6wXv/CYCKjGw06U4WRgR YXcpEhJROyNapmdIKSx hOzfLVE1gqA0PweZR8d tY3aNQSRn3sPpwJr6Mi /PqQKAMMrZ9ckJpf1+b QMOOvxgzz2U1GS18b3y ZKcgTMEaJzd/GZYzi/B N2DzQ0MsrSwYXfsNLFO Bbs8PJMW4LYIxeeOe6rUgkWOF 7CC9Dh/dduQ1QrsJhmZAEFfd6ByYV+ ;{id = 2854 (zsk), size = 1688b}
example.com. 3600    IN      RRSIG   DNSKEY DSA 2 3600 20070926134150 20070829134150 2854 example.com. MCwCFBQRtlR4BEv9ohi+PGFjp+AHsJuHAhRCvz0shggvnvI88DFnBDCczHUcVA== ;{id = 2854}
SECTION AUTHORITY
example.com.	IN NS	ns.example.com.
example.com.    3600    IN      RRSIG   NS 3 2 3600 20070926134150 20070829134150 2854 example.com. MC0CFQCN+qHdJxoI/2tNKwsb08pra/G7aAIUAWA5sDdJTbrXA1/3OaesGBAO3sI= ;{id = 2854}
SECTION ADDITIONAL
ns.example.com.		IN 	A	1.2.3.4
ns.example.com. 3600    IN      RRSIG   A 3 3 3600 20070926135752 20070829135752 2854 example.com. MC0CFQCMSWxVehgOQLoYclB9PIAbNP229AIUeH0vNNGJhjnZiqgIOKvs1EhzqAo= ;{id = 2854}
ENTRY_END

; response to query of interest
ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR NXDOMAIN
SECTION QUESTION
www.example.com. IN A
SECTION ANSWER
www.example.com.  3600    IN      CNAME   www.example.net.
www.example.com.        3600    IN      RRSIG   CNAME 3 3 3600 20070926134150 20070829134150 2854 example.com. MCwCFGtYzScyRnHV8U/jOIPYwrlI9t3oAhRF0PIf+IthUR7uCWIvskWp5CfReQ== ;{id = 2854}
SECTION AUTHORITY
SECTION ADDITIONAL
ENTRY_END
RANGE_END

; ns.example.net.
RANGE_BEGIN 0 100
	ADDRESS 1.2.3.5
ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR NOERROR
SECTION QUESTION
example.net. IN NS
SECTION ANSWER
example.net.	IN NS	ns.example.net.
example.net.    3600    IN      RRSIG   NS RSASHA1 2 3600 20070926134150 20070829134150 30899 example.net. E8JX0l4B+cSR5bkHQwOJy1pBmlLMTYCJ8EwfNMU/eCv0YhKwo26rHhn52FGisgv+Nwp7/NbhHqQ+kJgoZC94XA== ;{id = 30899}
SECTION ADDITIONAL
ns.example.net.		IN 	A	1.2.3.5
ns.example.net. 3600    IN      RRSIG   A RSASHA1 3 3600 20070926134150 20070829134150 30899 example.net. x+tQMC9FhzT7Fcy1pM5NrOC7E8nLd7THPI3C6ie4EwL8PrxllqlR3q/DKB0d/m0qCOPcgN6HFOYURV1s4uAcsw== ;{id = 30899}
ENTRY_END

; response to DNSKEY priming query
ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR NOERROR
SECTION QUESTION
example.net. IN DNSKEY
SECTION ANSWER
example.net.    3600    IN      DNSKEY  256 3 5 AQPQ41chR9DEHt/aIzIFAqanbDlRflJoRs5yz1jFsoRIT7dWf0r+PeDuewdxkszNH6wnU4QL8pfKFRh5PIYVBLK3 ;{id = 30899 (zsk), size = 512b}
example.net.    3600    IN      RRSIG   DNSKEY RSASHA1 2 3600 20070926134150 20070829134150 30899 example.net. hiFzlQ8VoYgCuvIsfVuxC3mfJDqsTh0yc6abs5xMx5uEcIjb0dndFQx7INOM+imlzveEN73Hqp4OLFpFhsWLlw== ;{id = 30899}
SECTION AUTHORITY
example.net.	IN NS	ns.example.net.
example.net.    3600    IN      RRSIG   NS RSASHA1 2 3600 20070926134150 20070829134150 30899 example.net. E8JX0l4B+cSR5bkHQwOJy1pBmlLMTYCJ8EwfNMU/eCv0YhKwo26rHhn52FGisgv+Nwp7/NbhHqQ+kJgoZC94XA== ;{id = 30899}
SECTION ADDITIONAL
ns.example.net.		IN 	A	1.2.3.5
ns.example.net. 3600    IN      RRSIG   A RSASHA1 3 3600 20070926134150 20070829134150 30899 example.net. x+tQMC9FhzT7Fcy1pM5NrOC7E8nLd7THPI3C6ie4EwL8PrxllqlR3q/DKB0d/m0qCOPcgN6HFOYURV1s4uAcsw== ;{id = 30899}
ENTRY_END

; response to query of interest
ENTRY_BEGIN
MATCH opcode qtype qname
ADJUST copy_id
REPLY QR NXDOMAIN
SECTION QUESTION
www.example.net. IN A
SECTION ANSWER
SECTION AUTHORITY
example.net.	IN	NSEC	abc.example.net. SOA NS DNSKEY NSEC RRSIG
example.net.    3600    IN      RRSIG   NSEC 5 2 3600 20070926134150 20070829134150 30899 example.net. SEHthmjHyqGlzaOp3Dx6Jn5Fnvvtknw/IF6YSFY8NZLe+YSh1oRJbdEkQ8G92IT08n1jSN6jvKRsFBOUoFOQAw== ;{id = 30899}
wab.example.net.	IN	NSEC	wzz.example.net. A NSEC RRSIG
wab.example.net.        3600    IN      RRSIG   NSEC 5 3 3600 20070926134150 20070829134150 30899 example.net. gl8vkI3xfSWx4Pyv5OdOthiewE6u/13kclY7UG9ptuFBddamdJO3RQqyxM6Xcmq+ToO4kMCCyaKijp01gTDoGg== ;{id = 30899}
SECTION ADDITIONAL
ENTRY_END
RANGE_END

STEP 1 QUERY
ENTRY_BEGIN
REPLY RD DO
SECTION QUESTION
www.example.com. IN A
ENTRY_END

; recursion happens here.
STEP 10 CHECK_ANSWER
ENTRY_BEGIN
MATCH all
REPLY QR RD RA AD DO NXDOMAIN
SECTION QUESTION
www.example.com. IN A
SECTION ANSWER
www.example.com. IN	CNAME	www.example.net.
www.example.com.        3600    IN      RRSIG   CNAME 3 3 3600 20070926134150 20070829134150 2854 example.com. MCwCFGtYzScyRnHV8U/jOIPYwrlI9t3oAhRF0PIf+IthUR7uCWIvskWp5CfReQ== ;{id = 2854}
SECTION AUTHORITY
example.net.	IN	NSEC	abc.example.net. SOA NS DNSKEY NSEC RRSIG
example.net.    3600    IN      RRSIG   NSEC 5 2 3600 20070926134150 20070829134150 30899 example.net. SEHthmjHyqGlzaOp3Dx6Jn5Fnvvtknw/IF6YSFY8NZLe+YSh1oRJbdEkQ8G92IT08n1jSN6jvKRsFBOUoFOQAw== ;{id = 30899}
wab.example.net.	IN	NSEC	wzz.example.net. A NSEC RRSIG
wab.example.net.        3600    IN      RRSIG   NSEC 5 3 3600 20070926134150 20070829134150 30899 example.net. gl8vkI3xfSWx4Pyv5OdOthiewE6u/13kclY7UG9ptuFBddamdJO3RQqyxM6Xcmq+ToO4kMCCyaKijp01gTDoGg== ;{id = 30899}
SECTION ADDITIONAL
ENTRY_END

SCENARIO_END

{'repo_name': 'NLnetLabs/unbound', 'stars': '740', 'repo_language': 'C', 'file_name': 'ipset.c', 'mime_type': 'text/x-c', 'hash': -7948023693651256627, 'source_dataset': 'data'}


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEngine.Experimental.Rendering.HDPipeline;
using UnityEditor.Experimental.Rendering;

namespace UnityEditor.Experimental.Rendering.HDPipeline
{
    [VolumeComponentEditor(typeof(VolumetricFog))]
    public class VolumetricFogEditor : AtmosphericScatteringEditor
    {
        SerializedDataParameter m_Albedo;
        SerializedDataParameter m_MeanFreePath;
        SerializedDataParameter m_BaseHeight;
        SerializedDataParameter m_MeanHeight;
        SerializedDataParameter m_Anisotropy;
        SerializedDataParameter m_GlobalLightProbeDimmer;
        SerializedDataParameter m_EnableDistantFog;

        static GUIContent s_AlbedoLabel                 = new GUIContent("Single Scattering Albedo", "Hue and saturation control the color of the fog (the wavelength of in-scattered light). Value controls scattering (0 = max absorption & no scattering, 1 = no absorption & max scattering).");
        static GUIContent s_MeanFreePathLabel           = new GUIContent("Base Fog Distance", "Controls the density, which determines how far you can see through the fog. A.k.a. \"mean free path length\". At this distance, 63% of background light is lost in the fog (due to absorption and out-scattering).");
        static GUIContent s_BaseHeightLabel             = new GUIContent("Base Height", "Height at which the exponential density falloff starts.");
        static GUIContent s_MeanHeightLabel             = new GUIContent("Mean Height", "Controls the rate of falloff of the height fog. Higher values stretch the fog vertically.");
        static GUIContent s_AnisotropyLabel             = new GUIContent("Global Anisotropy", "Controls the angular distribution of scattered light. 0 is isotropic, 1 is forward scattering, -1 is backward scattering.");
        static GUIContent s_GlobalLightProbeDimmerLabel = new GUIContent("Global Light Probe Dimmer", "Reduces the intensity of the global light probe.");
        static GUIContent s_EnableDistantFog            = new GUIContent("Enable Distant Fog", "Activates the fog with precomputed lighting behind the volumetrically-lit frustum.");

        public override void OnEnable()
        {
            base.OnEnable();
            var o = new PropertyFetcher<VolumetricFog>(serializedObject);

            m_Albedo                 = Unpack(o.Find(x => x.albedo));
            m_MeanFreePath           = Unpack(o.Find(x => x.meanFreePath));
            m_BaseHeight             = Unpack(o.Find(x => x.baseHeight));
            m_MeanHeight             = Unpack(o.Find(x => x.meanHeight));
            m_Anisotropy             = Unpack(o.Find(x => x.anisotropy));
            m_GlobalLightProbeDimmer = Unpack(o.Find(x => x.globalLightProbeDimmer));
            m_EnableDistantFog       = Unpack(o.Find(x => x.enableDistantFog));
        }

        public override void OnInspectorGUI()
        {
            PropertyField(m_Albedo,                 s_AlbedoLabel);
            PropertyField(m_MeanFreePath,           s_MeanFreePathLabel);
            PropertyField(m_BaseHeight,             s_BaseHeightLabel);
            PropertyField(m_MeanHeight,             s_MeanHeightLabel);
            PropertyField(m_Anisotropy,             s_AnisotropyLabel);
            PropertyField(m_GlobalLightProbeDimmer, s_GlobalLightProbeDimmerLabel);
            PropertyField(m_MaxFogDistance);
            PropertyField(m_EnableDistantFog,       s_EnableDistantFog);

            if (m_EnableDistantFog.value.boolValue)
            {
                EditorGUI.indentLevel++;
                base.OnInspectorGUI(); // Color
                EditorGUI.indentLevel--;
            }
        }
    }
}

{'repo_name': 'Unity-Technologies/FPSSample', 'stars': '3658', 'repo_language': 'C#', 'file_name': 'Sand_Dunes_A.meta', 'mime_type': 'text/plain', 'hash': 7219105259207533510, 'source_dataset': 'data'}


/**
 * Color manipulation helper class
 *
 * @param {Object|String} [val]
 * @param {Object} [predefinedColors]
 * @param {String|null} [fallbackColor]
 * @param {String|null} [fallbackFormat]
 * @param {Boolean} [hexNumberSignPrefix]
 * @constructor
 */
var Color = function(
  val, predefinedColors, fallbackColor, fallbackFormat, hexNumberSignPrefix) {
  this.fallbackValue = fallbackColor ?
    (
      fallbackColor && (typeof fallbackColor.h !== 'undefined') ?
      fallbackColor :
      this.value = {
        h: 0,
        s: 0,
        b: 0,
        a: 1
      }
    ) :
    null;

  this.fallbackFormat = fallbackFormat ? fallbackFormat : 'rgba';

  this.hexNumberSignPrefix = hexNumberSignPrefix === true;

  this.value = this.fallbackValue;

  this.origFormat = null; // original string format

  this.predefinedColors = predefinedColors ? predefinedColors : {};

  // We don't want to share aliases across instances so we extend new object
  this.colors = $.extend({}, Color.webColors, this.predefinedColors);

  if (val) {
    if (typeof val.h !== 'undefined') {
      this.value = val;
    } else {
      this.setColor(String(val));
    }
  }

  if (!this.value) {
    // Initial value is always black if no arguments are passed or val is empty
    this.value = {
      h: 0,
      s: 0,
      b: 0,
      a: 1
    };
  }
};

Color.webColors = { // 140 predefined colors from the HTML Colors spec
  "aliceblue": "f0f8ff",
  "antiquewhite": "faebd7",
  "aqua": "00ffff",
  "aquamarine": "7fffd4",
  "azure": "f0ffff",
  "beige": "f5f5dc",
  "bisque": "ffe4c4",
  "black": "000000",
  "blanchedalmond": "ffebcd",
  "blue": "0000ff",
  "blueviolet": "8a2be2",
  "brown": "a52a2a",
  "burlywood": "deb887",
  "cadetblue": "5f9ea0",
  "chartreuse": "7fff00",
  "chocolate": "d2691e",
  "coral": "ff7f50",
  "cornflowerblue": "6495ed",
  "cornsilk": "fff8dc",
  "crimson": "dc143c",
  "cyan": "00ffff",
  "darkblue": "00008b",
  "darkcyan": "008b8b",
  "darkgoldenrod": "b8860b",
  "darkgray": "a9a9a9",
  "darkgreen": "006400",
  "darkkhaki": "bdb76b",
  "darkmagenta": "8b008b",
  "darkolivegreen": "556b2f",
  "darkorange": "ff8c00",
  "darkorchid": "9932cc",
  "darkred": "8b0000",
  "darksalmon": "e9967a",
  "darkseagreen": "8fbc8f",
  "darkslateblue": "483d8b",
  "darkslategray": "2f4f4f",
  "darkturquoise": "00ced1",
  "darkviolet": "9400d3",
  "deeppink": "ff1493",
  "deepskyblue": "00bfff",
  "dimgray": "696969",
  "dodgerblue": "1e90ff",
  "firebrick": "b22222",
  "floralwhite": "fffaf0",
  "forestgreen": "228b22",
  "fuchsia": "ff00ff",
  "gainsboro": "dcdcdc",
  "ghostwhite": "f8f8ff",
  "gold": "ffd700",
  "goldenrod": "daa520",
  "gray": "808080",
  "green": "008000",
  "greenyellow": "adff2f",
  "honeydew": "f0fff0",
  "hotpink": "ff69b4",
  "indianred": "cd5c5c",
  "indigo": "4b0082",
  "ivory": "fffff0",
  "khaki": "f0e68c",
  "lavender": "e6e6fa",
  "lavenderblush": "fff0f5",
  "lawngreen": "7cfc00",
  "lemonchiffon": "fffacd",
  "lightblue": "add8e6",
  "lightcoral": "f08080",
  "lightcyan": "e0ffff",
  "lightgoldenrodyellow": "fafad2",
  "lightgrey": "d3d3d3",
  "lightgreen": "90ee90",
  "lightpink": "ffb6c1",
  "lightsalmon": "ffa07a",
  "lightseagreen": "20b2aa",
  "lightskyblue": "87cefa",
  "lightslategray": "778899",
  "lightsteelblue": "b0c4de",
  "lightyellow": "ffffe0",
  "lime": "00ff00",
  "limegreen": "32cd32",
  "linen": "faf0e6",
  "magenta": "ff00ff",
  "maroon": "800000",
  "mediumaquamarine": "66cdaa",
  "mediumblue": "0000cd",
  "mediumorchid": "ba55d3",
  "mediumpurple": "9370d8",
  "mediumseagreen": "3cb371",
  "mediumslateblue": "7b68ee",
  "mediumspringgreen": "00fa9a",
  "mediumturquoise": "48d1cc",
  "mediumvioletred": "c71585",
  "midnightblue": "191970",
  "mintcream": "f5fffa",
  "mistyrose": "ffe4e1",
  "moccasin": "ffe4b5",
  "navajowhite": "ffdead",
  "navy": "000080",
  "oldlace": "fdf5e6",
  "olive": "808000",
  "olivedrab": "6b8e23",
  "orange": "ffa500",
  "orangered": "ff4500",
  "orchid": "da70d6",
  "palegoldenrod": "eee8aa",
  "palegreen": "98fb98",
  "paleturquoise": "afeeee",
  "palevioletred": "d87093",
  "papayawhip": "ffefd5",
  "peachpuff": "ffdab9",
  "peru": "cd853f",
  "pink": "ffc0cb",
  "plum": "dda0dd",
  "powderblue": "b0e0e6",
  "purple": "800080",
  "red": "ff0000",
  "rosybrown": "bc8f8f",
  "royalblue": "4169e1",
  "saddlebrown": "8b4513",
  "salmon": "fa8072",
  "sandybrown": "f4a460",
  "seagreen": "2e8b57",
  "seashell": "fff5ee",
  "sienna": "a0522d",
  "silver": "c0c0c0",
  "skyblue": "87ceeb",
  "slateblue": "6a5acd",
  "slategray": "708090",
  "snow": "fffafa",
  "springgreen": "00ff7f",
  "steelblue": "4682b4",
  "tan": "d2b48c",
  "teal": "008080",
  "thistle": "d8bfd8",
  "tomato": "ff6347",
  "turquoise": "40e0d0",
  "violet": "ee82ee",
  "wheat": "f5deb3",
  "white": "ffffff",
  "whitesmoke": "f5f5f5",
  "yellow": "ffff00",
  "yellowgreen": "9acd32",
  "transparent": "transparent"
};

Color.prototype = {
  constructor: Color,
  colors: {}, // merged web and predefined colors
  predefinedColors: {},
  /**
   * @return {Object}
   */
  getValue: function() {
    return this.value;
  },
  /**
   * @param {Object} val
   */
  setValue: function(val) {
    this.value = val;
  },
  _sanitizeNumber: function(val) {
    if (typeof val === 'number') {
      return val;
    }
    if (isNaN(val) || (val === null) || (val === '') || (val === undefined)) {
      return 1;
    }
    if (val === '') {
      return 0;
    }
    if (typeof val.toLowerCase !== 'undefined') {
      if (val.match(/^\./)) {
        val = "0" + val;
      }
      return Math.ceil(parseFloat(val) * 100) / 100;
    }
    return 1;
  },
  isTransparent: function(strVal) {
    if (!strVal || !(typeof strVal === 'string' || strVal instanceof String)) {
      return false;
    }
    strVal = strVal.toLowerCase().trim();
    return (strVal === 'transparent') || (strVal.match(/#?00000000/)) || (strVal.match(/(rgba|hsla)\(0,0,0,0?\.?0\)/));
  },
  rgbaIsTransparent: function(rgba) {
    return ((rgba.r === 0) && (rgba.g === 0) && (rgba.b === 0) && (rgba.a === 0));
  },
  // parse a string to HSB
  /**
   * @protected
   * @param {String} strVal
   * @returns {boolean} Returns true if it could be parsed, false otherwise
   */
  setColor: function(strVal) {
    strVal = strVal.toLowerCase().trim();
    if (strVal) {
      if (this.isTransparent(strVal)) {
        this.value = {
          h: 0,
          s: 0,
          b: 0,
          a: 0
        };
        return true;
      } else {
        var parsedColor = this.parse(strVal);
        if (parsedColor) {
          this.value = this.value = {
            h: parsedColor.h,
            s: parsedColor.s,
            b: parsedColor.b,
            a: parsedColor.a
          };
          if (!this.origFormat) {
            this.origFormat = parsedColor.format;
          }
        } else if (this.fallbackValue) {
          // if parser fails, defaults to fallbackValue if defined, otherwise the value won't be changed
          this.value = this.fallbackValue;
        }
      }
    }
    return false;
  },
  setHue: function(h) {
    this.value.h = 1 - h;
  },
  setSaturation: function(s) {
    this.value.s = s;
  },
  setBrightness: function(b) {
    this.value.b = 1 - b;
  },
  setAlpha: function(a) {
    this.value.a = Math.round((parseInt((1 - a) * 100, 10) / 100) * 100) / 100;
  },
  toRGB: function(h, s, b, a) {
    if (arguments.length === 0) {
      h = this.value.h;
      s = this.value.s;
      b = this.value.b;
      a = this.value.a;
    }

    h *= 360;
    var R, G, B, X, C;
    h = (h % 360) / 60;
    C = b * s;
    X = C * (1 - Math.abs(h % 2 - 1));
    R = G = B = b - C;

    h = ~~h;
    R += [C, X, 0, 0, X, C][h];
    G += [X, C, C, X, 0, 0][h];
    B += [0, 0, X, C, C, X][h];

    return {
      r: Math.round(R * 255),
      g: Math.round(G * 255),
      b: Math.round(B * 255),
      a: a
    };
  },
  toHex: function(h, s, b, a) {
    if (arguments.length === 0) {
      h = this.value.h;
      s = this.value.s;
      b = this.value.b;
      a = this.value.a;
    }

    var rgb = this.toRGB(h, s, b, a);

    if (this.rgbaIsTransparent(rgb)) {
      return 'transparent';
    }

    var hexStr = (this.hexNumberSignPrefix ? '#' : '') + (
        (1 << 24) +
        (parseInt(rgb.r) << 16) +
        (parseInt(rgb.g) << 8) +
        parseInt(rgb.b))
      .toString(16)
      .slice(1);

    return hexStr;
  },
  toHSL: function(h, s, b, a) {
    if (arguments.length === 0) {
      h = this.value.h;
      s = this.value.s;
      b = this.value.b;
      a = this.value.a;
    }

    var H = h,
      L = (2 - s) * b,
      S = s * b;
    if (L > 0 && L <= 1) {
      S /= L;
    } else {
      S /= 2 - L;
    }
    L /= 2;
    if (S > 1) {
      S = 1;
    }
    return {
      h: isNaN(H) ? 0 : H,
      s: isNaN(S) ? 0 : S,
      l: isNaN(L) ? 0 : L,
      a: isNaN(a) ? 0 : a
    };
  },
  toAlias: function(r, g, b, a) {
    var c, rgb = (arguments.length === 0) ? this.toHex() : this.toHex(r, g, b, a);

    // support predef. colors in non-hex format too, as defined in the alias itself
    var original = this.origFormat === 'alias' ? rgb : this.toString(this.origFormat, false);

    for (var alias in this.colors) {
      c = this.colors[alias].toLowerCase().trim();
      if ((c === rgb) || (c === original)) {
        return alias;
      }
    }
    return false;
  },
  RGBtoHSB: function(r, g, b, a) {
    r /= 255;
    g /= 255;
    b /= 255;

    var H, S, V, C;
    V = Math.max(r, g, b);
    C = V - Math.min(r, g, b);
    H = (C === 0 ? null :
      V === r ? (g - b) / C :
      V === g ? (b - r) / C + 2 :
      (r - g) / C + 4
    );
    H = ((H + 360) % 6) * 60 / 360;
    S = C === 0 ? 0 : C / V;
    return {
      h: this._sanitizeNumber(H),
      s: S,
      b: V,
      a: this._sanitizeNumber(a)
    };
  },
  HueToRGB: function(p, q, h) {
    if (h < 0) {
      h += 1;
    } else if (h > 1) {
      h -= 1;
    }
    if ((h * 6) < 1) {
      return p + (q - p) * h * 6;
    } else if ((h * 2) < 1) {
      return q;
    } else if ((h * 3) < 2) {
      return p + (q - p) * ((2 / 3) - h) * 6;
    } else {
      return p;
    }
  },
  HSLtoRGB: function(h, s, l, a) {
    if (s < 0) {
      s = 0;
    }
    var q;
    if (l <= 0.5) {
      q = l * (1 + s);
    } else {
      q = l + s - (l * s);
    }

    var p = 2 * l - q;

    var tr = h + (1 / 3);
    var tg = h;
    var tb = h - (1 / 3);

    var r = Math.round(this.HueToRGB(p, q, tr) * 255);
    var g = Math.round(this.HueToRGB(p, q, tg) * 255);
    var b = Math.round(this.HueToRGB(p, q, tb) * 255);
    return [r, g, b, this._sanitizeNumber(a)];
  },
  /**
   * @param {String} strVal
   * @returns {Object} Object containing h,s,b,a,format properties or FALSE if failed to parse
   */
  parse: function(strVal) {
    if (arguments.length === 0) {
      return false;
    }

    var that = this,
      result = false,
      isAlias = (typeof this.colors[strVal] !== 'undefined'),
      values, format;

    if (isAlias) {
      strVal = this.colors[strVal].toLowerCase().trim();
    }

    $.each(this.stringParsers, function(i, parser) {
      var match = parser.re.exec(strVal);
      values = match && parser.parse.apply(that, [match]);
      if (values) {
        result = {};
        format = (isAlias ? 'alias' : (parser.format ? parser.format : that.getValidFallbackFormat()));
        if (format.match(/hsla?/)) {
          result = that.RGBtoHSB.apply(that, that.HSLtoRGB.apply(that, values));
        } else {
          result = that.RGBtoHSB.apply(that, values);
        }
        if (result instanceof Object) {
          result.format = format;
        }
        return false; // stop iterating
      }
      return true;
    });
    return result;
  },
  getValidFallbackFormat: function() {
    var formats = [
      'rgba', 'rgb', 'hex', 'hsla', 'hsl'
    ];
    if (this.origFormat && (formats.indexOf(this.origFormat) !== -1)) {
      return this.origFormat;
    }
    if (this.fallbackFormat && (formats.indexOf(this.fallbackFormat) !== -1)) {
      return this.fallbackFormat;
    }

    return 'rgba'; // By default, return a format that will not lose the alpha info
  },
  /**
   *
   * @param {string} [format] (default: rgba)
   * @param {boolean} [translateAlias] Return real color for pre-defined (non-standard) aliases (default: false)
   * @returns {String}
   */
  toString: function(format, translateAlias) {
    format = format || this.origFormat || this.fallbackFormat;
    translateAlias = translateAlias || false;

    var c = false;

    switch (format) {
      case 'rgb':
        {
          c = this.toRGB();
          if (this.rgbaIsTransparent(c)) {
            return 'transparent';
          }
          return 'rgb(' + c.r + ',' + c.g + ',' + c.b + ')';
        }
        break;
      case 'rgba':
        {
          c = this.toRGB();
          return 'rgba(' + c.r + ',' + c.g + ',' + c.b + ',' + c.a + ')';
        }
        break;
      case 'hsl':
        {
          c = this.toHSL();
          return 'hsl(' + Math.round(c.h * 360) + ',' + Math.round(c.s * 100) + '%,' + Math.round(c.l * 100) + '%)';
        }
        break;
      case 'hsla':
        {
          c = this.toHSL();
          return 'hsla(' + Math.round(c.h * 360) + ',' + Math.round(c.s * 100) + '%,' + Math.round(c.l * 100) + '%,' + c.a + ')';
        }
        break;
      case 'hex':
        {
          return this.toHex();
        }
        break;
      case 'alias':
        {
          c = this.toAlias();

          if (c === false) {
            return this.toString(this.getValidFallbackFormat());
          }

          if (translateAlias && !(c in Color.webColors) && (c in this.predefinedColors)) {
            return this.predefinedColors[c];
          }

          return c;
        }
      default:
        {
          return c;
        }
        break;
    }
  },
  // a set of RE's that can match strings and generate color tuples.
  // from John Resig color plugin
  // https://github.com/jquery/jquery-color/
  stringParsers: [{
    re: /rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*?\)/,
    format: 'rgb',
    parse: function(execResult) {
      return [
        execResult[1],
        execResult[2],
        execResult[3],
        1
      ];
    }
  }, {
    re: /rgb\(\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*?\)/,
    format: 'rgb',
    parse: function(execResult) {
      return [
        2.55 * execResult[1],
        2.55 * execResult[2],
        2.55 * execResult[3],
        1
      ];
    }
  }, {
    re: /rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d*(?:\.\d+)?)\s*)?\)/,
    format: 'rgba',
    parse: function(execResult) {
      return [
        execResult[1],
        execResult[2],
        execResult[3],
        execResult[4]
      ];
    }
  }, {
    re: /rgba\(\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*(?:,\s*(\d*(?:\.\d+)?)\s*)?\)/,
    format: 'rgba',
    parse: function(execResult) {
      return [
        2.55 * execResult[1],
        2.55 * execResult[2],
        2.55 * execResult[3],
        execResult[4]
      ];
    }
  }, {
    re: /hsl\(\s*(\d*(?:\.\d+)?)\s*,\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*?\)/,
    format: 'hsl',
    parse: function(execResult) {
      return [
        execResult[1] / 360,
        execResult[2] / 100,
        execResult[3] / 100,
        execResult[4]
      ];
    }
  }, {
    re: /hsla\(\s*(\d*(?:\.\d+)?)\s*,\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*(?:,\s*(\d*(?:\.\d+)?)\s*)?\)/,
    format: 'hsla',
    parse: function(execResult) {
      return [
        execResult[1] / 360,
        execResult[2] / 100,
        execResult[3] / 100,
        execResult[4]
      ];
    }
  }, {
    re: /#?([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/,
    format: 'hex',
    parse: function(execResult) {
      return [
        parseInt(execResult[1], 16),
        parseInt(execResult[2], 16),
        parseInt(execResult[3], 16),
        1
      ];
    }
  }, {
    re: /#?([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/,
    format: 'hex',
    parse: function(execResult) {
      return [
        parseInt(execResult[1] + execResult[1], 16),
        parseInt(execResult[2] + execResult[2], 16),
        parseInt(execResult[3] + execResult[3], 16),
        1
      ];
    }
  }],
  colorNameToHex: function(name) {
    if (typeof this.colors[name.toLowerCase()] !== 'undefined') {
      return this.colors[name.toLowerCase()];
    }
    return false;
  }
};

{'repo_name': 'wuyanwen/thinkjsplus', 'stars': '104', 'repo_language': 'JavaScript', 'file_name': 'bootstrap-slider.js', 'mime_type': 'text/plain', 'hash': 6129263992633497095, 'source_dataset': 'data'}


<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

	<form id="resourceEditForm" method="post">

				资源名称
				<input name="id" type="hidden"  value="${resource.id}" >
				<input name="name" type="text" value="${resource.name}" class="easyui-validatebox span2" data-options="required:true" >
				资源类型
				<select name="resourcetype" class="easyui-combobox" data-options="width:140,height:29,editable:false,panelHeight:'auto'">
							<option value="0">菜单</option>
							<option value="1">按钮</option>
				</select>

				资源路径
				<input name="url" type="text" placeholder="请输入资源路径" class="easyui-validatebox span2" >
				排序
				<input name="seq"  class="easyui-numberspinner" style="width: 140px; height: 29px;" required="required" data-options="editable:false">

				菜单图标
				<input  name="icon" />
				状态
				<select name="cstate" class="easyui-combobox" data-options="width:140,height:29,editable:false,panelHeight:'auto'">
							<option value="0">正常</option>
							<option value="1">停用</option>
				</select>

				上级资源
				<select id="pid" name="pid" style="width: 200px; height: 29px;"></select>
				清空

				备注
				<textarea name="description" rows="5" cols="50" ></textarea>

	</form>

{'repo_name': 'caijiahao/springMvcPlusMongo', 'stars': '134', 'repo_language': 'HTML', 'file_name': 'spring-web.xml', 'mime_type': 'text/xml', 'hash': -5646488676038007964, 'source_dataset': 'data'}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

package engine

import (
	"github.com/Azure/aks-engine/pkg/api"
	"github.com/Azure/aks-engine/pkg/api/common"
	"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-08-01/network"
	"github.com/Azure/go-autorest/autorest/to"
)

func createApplicationGateway(prop *api.Properties) ApplicationGatewayARM {

	applicationGateway := ApplicationGatewayARM{
		ARMResource: ARMResource{
			APIVersion: "[variables('apiVersionNetwork')]",
			DependsOn: []string{
				"[concat('Microsoft.Network/publicIPAddresses/', variables('appGwPublicIPAddressName'))]",
				"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
			},
		},
		ApplicationGateway: network.ApplicationGateway{
			Location: to.StringPtr("[variables('location')]"),
			Name:     to.StringPtr("[variables('appGwName')]"),
			ApplicationGatewayPropertiesFormat: &network.ApplicationGatewayPropertiesFormat{
				Sku: &network.ApplicationGatewaySku{
					Name:     network.ApplicationGatewaySkuName("[parameters('appGwSku')]"),
					Tier:     network.ApplicationGatewayTier("[parameters('appGwSku')]"),
					Capacity: to.Int32Ptr(2),
				},
				GatewayIPConfigurations: &[]network.ApplicationGatewayIPConfiguration{
					{
						Name: to.StringPtr("gatewayIP"),
						ApplicationGatewayIPConfigurationPropertiesFormat: &network.ApplicationGatewayIPConfigurationPropertiesFormat{
							Subnet: &network.SubResource{
								ID: to.StringPtr("[concat(variables('vnetID'),'/subnets/',variables('appGwSubnetName'))]"),
							},
						},
					},
				},
				FrontendIPConfigurations: &[]network.ApplicationGatewayFrontendIPConfiguration{
					{
						Name: to.StringPtr("frontendIP"),
						ApplicationGatewayFrontendIPConfigurationPropertiesFormat: &network.ApplicationGatewayFrontendIPConfigurationPropertiesFormat{
							PublicIPAddress: &network.SubResource{
								ID: to.StringPtr("[resourceId('Microsoft.Network/publicIpAddresses',variables('appGwPublicIPAddressName'))]"),
							},
						},
					},
				},
				FrontendPorts: &[]network.ApplicationGatewayFrontendPort{
					{
						Name: to.StringPtr("httpPort"),
						ApplicationGatewayFrontendPortPropertiesFormat: &network.ApplicationGatewayFrontendPortPropertiesFormat{
							Port: to.Int32Ptr(80),
						},
					},
				},
				BackendAddressPools: &[]network.ApplicationGatewayBackendAddressPool{
					{
						Name: to.StringPtr("pool"),
						ApplicationGatewayBackendAddressPoolPropertiesFormat: &network.ApplicationGatewayBackendAddressPoolPropertiesFormat{
							BackendAddresses: &[]network.ApplicationGatewayBackendAddress{},
						},
					},
				},
				HTTPListeners: &[]network.ApplicationGatewayHTTPListener{
					{
						Name: to.StringPtr("httpListener"),
						ApplicationGatewayHTTPListenerPropertiesFormat: &network.ApplicationGatewayHTTPListenerPropertiesFormat{
							Protocol: network.HTTP,
							FrontendPort: &network.SubResource{
								ID: to.StringPtr("[concat(variables('appGwId'), '/frontendPorts/httpPort')]"),
							},
							FrontendIPConfiguration: &network.SubResource{
								ID: to.StringPtr("[concat(variables('appGwId'), '/frontendIPConfigurations/frontendIP')]"),
							},
						},
					},
				},
				BackendHTTPSettingsCollection: &[]network.ApplicationGatewayBackendHTTPSettings{
					{
						Name: to.StringPtr("setting"),
						ApplicationGatewayBackendHTTPSettingsPropertiesFormat: &network.ApplicationGatewayBackendHTTPSettingsPropertiesFormat{
							Port:     to.Int32Ptr(80),
							Protocol: network.HTTP,
						},
					},
				},
				RequestRoutingRules: &[]network.ApplicationGatewayRequestRoutingRule{
					{
						Name: to.StringPtr("rule"),
						ApplicationGatewayRequestRoutingRulePropertiesFormat: &network.ApplicationGatewayRequestRoutingRulePropertiesFormat{
							HTTPListener: &network.SubResource{
								ID: to.StringPtr("[concat(variables('appGwId'), '/httpListeners/httpListener')]"),
							},
							BackendAddressPool: &network.SubResource{
								ID: to.StringPtr("[concat(variables('appGwId'), '/backendAddressPools/pool')]"),
							},
							BackendHTTPSettings: &network.SubResource{
								ID: to.StringPtr("[concat(variables('appGwId'), '/backendHttpSettingsCollection/setting')]"),
							},
						},
					},
				},
			},
			Type: to.StringPtr("Microsoft.Network/applicationGateways"),
		},
	}

	if prop.OrchestratorProfile.KubernetesConfig.GetAddonByName(common.AppGwIngressAddonName).Config["appgw-sku"] == "WAF_v2" {
		applicationGateway.ApplicationGateway.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration = &network.ApplicationGatewayWebApplicationFirewallConfiguration{
			Enabled:      to.BoolPtr(true),
			FirewallMode: network.Detection,
		}
	}

	privateIP := prop.OrchestratorProfile.KubernetesConfig.GetAddonByName(common.AppGwIngressAddonName).Config["appgw-private-ip"]
	if privateIP != "" {
		frontendIPConfigurations := append(
			*applicationGateway.ApplicationGateway.ApplicationGatewayPropertiesFormat.FrontendIPConfigurations,
			network.ApplicationGatewayFrontendIPConfiguration{
				Name: to.StringPtr("privateIp"),
				ApplicationGatewayFrontendIPConfigurationPropertiesFormat: &network.ApplicationGatewayFrontendIPConfigurationPropertiesFormat{
					PrivateIPAddress: to.StringPtr(privateIP),
				},
			})
		applicationGateway.ApplicationGateway.ApplicationGatewayPropertiesFormat.FrontendIPConfigurations = &frontendIPConfigurations
	}

	return applicationGateway
}

{'repo_name': 'Azure/aks-engine', 'stars': '726', 'repo_language': 'Go', 'file_name': 'Jenkinsfile.azure.kubernetes', 'mime_type': 'text/plain', 'hash': -7319973158863124582, 'source_dataset': 'data'}


package com.larvalabs.jurk;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Build;
import android.util.DisplayMetrics;
import android.view.Display;
import android.widget.Toast;

/**
 * @author John Watkinson
 */
public class WebInterface {

    Activity context;
    private float scale;

    public WebInterface(Activity c) {
        context = c;
        // Compute scaling
        DisplayMetrics metrics = c.getResources().getDisplayMetrics();
        int densityDpiRaw = metrics.densityDpi;
        int densityDpi = densityDpiRaw / 40 * 40;
        scale = 240 / (float) densityDpi;
        // Next, screen scale
        int size = c.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
        switch (size) {
            case Configuration.SCREENLAYOUT_SIZE_SMALL:
                scale = scale * 4 / 3;
                break;
            case Configuration.SCREENLAYOUT_SIZE_NORMAL:
                break;
            case Configuration.SCREENLAYOUT_SIZE_LARGE:
                scale = scale / 2;
                break;
            case Configuration.SCREENLAYOUT_SIZE_XLARGE:
                scale = scale / 2;
                break;
            default:
                // todo - compute it by hand, fun!
        }
        scale = scale * 4 / 5f;
        scale = 0.6f;
    }

    public void showToast(String toast) {
        Toast.makeText(context, toast, Toast.LENGTH_SHORT).show();
    }

    public void playSound(String sound) {
        SoundManager.get().play(sound);
    }

    public void playMusic(String track) {
        MusicManager.get().play(track);
    }

    public void stopMusic() {
        MusicManager.get().stop(true);
    }

    public String getData(String key) {
        SharedPreferences prefs = context.getSharedPreferences("data", Context.MODE_PRIVATE);
        return prefs.getString(key, null);
    }

    public boolean doCustomDraws() {
        return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB;
    }

    public void putData(String key, String value) {
        SharedPreferences prefs = context.getSharedPreferences("data", Context.MODE_PRIVATE);
        if (value == null) {
            prefs.edit().remove(key).commit();
        } else {
            prefs.edit().putString(key, value).commit();
        }
    }

    public int getScreenWidth() {
        Display display = context.getWindowManager().getDefaultDisplay();
        return display.getWidth();
    }

    public int getScreenHeight() {
        Display display = context.getWindowManager().getDefaultDisplay();
        return display.getHeight();
    }

    public float getContextScale() {
        return scale;
    }

}

{'repo_name': 'pents90/eburp', 'stars': '101', 'repo_language': 'JavaScript', 'file_name': 'gurkDemo.js', 'mime_type': 'text/plain', 'hash': -7442614754232519587, 'source_dataset': 'data'}


/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.flink.api.java.utils;

import org.junit.Assert;
import org.junit.Test;

import java.util.Arrays;
import java.util.Collections;

/**
 * Tests for {@link MultipleParameterTool}.
 */
public class MultipleParameterToolTest extends AbstractParameterToolTest {

	@Test
	public void testFromCliArgsWithMultipleParameters() {
		MultipleParameterTool parameter = (MultipleParameterTool) createParameterToolFromArgs(new String[]{
			"--input", "myInput", "-expectedCount", "15", "--multi", "multiValue1", "--multi", "multiValue2",
			"--withoutValues", "--negativeFloat", "-0.58", "-isWorking", "true", "--maxByte", "127", "-negativeShort", "-1024"});

		Assert.assertEquals(8, parameter.getNumberOfParameters());
		validate(parameter);
		Assert.assertTrue(parameter.has("withoutValues"));
		Assert.assertEquals(-0.58, parameter.getFloat("negativeFloat"), 0.1);
		Assert.assertTrue(parameter.getBoolean("isWorking"));
		Assert.assertEquals(127, parameter.getByte("maxByte"));
		Assert.assertEquals(-1024, parameter.getShort("negativeShort"));

		exception.expect(IllegalStateException.class);
		exception.expectMessage("Key multi should has only one value");
		parameter.get("multi");
	}

	@Test
	public void testUnrequestedMultiParameter() {
		MultipleParameterTool parameter = (MultipleParameterTool) createParameterToolFromArgs(new String[]{
			"--multi", "v1", "--multi", "v2", "--multi2", "vv1"});
		Assert.assertEquals(createHashSet("multi", "multi2"), parameter.getUnrequestedParameters());

		Assert.assertEquals(Arrays.asList("v1", "v2"), parameter.getMultiParameter("multi"));
		Assert.assertEquals(createHashSet("multi2"), parameter.getUnrequestedParameters());

		Assert.assertEquals(Collections.singletonList("vv1"), parameter.getMultiParameterRequired("multi2"));
		Assert.assertEquals(Collections.emptySet(), parameter.getUnrequestedParameters());
	}

	@Test
	public void testMerged() {
		MultipleParameterTool parameter1 = (MultipleParameterTool) createParameterToolFromArgs(new String[]{
			"--input", "myInput", "--merge", "v1", "--merge", "v2"});
		MultipleParameterTool parameter2 = (MultipleParameterTool) createParameterToolFromArgs(new String[]{
			"--multi", "multiValue1", "--multi", "multiValue2", "-expectedCount", "15", "--merge", "v3"});
		MultipleParameterTool parameter = parameter1.mergeWith(parameter2);
		validate(parameter);
		Assert.assertEquals(Arrays.asList("v1", "v2", "v3"), parameter.getMultiParameter("merge"));
	}

	@Override
	protected AbstractParameterTool createParameterToolFromArgs(String[] args) {
		return MultipleParameterTool.fromArgs(args);
	}
}

{'repo_name': 'apache/flink', 'stars': '13618', 'repo_language': 'Java', 'file_name': 'GettingStartedExampleITCase.java', 'mime_type': 'text/x-java', 'hash': -6107825351394946371, 'source_dataset': 'data'}


export function updatePageSetting(name, newValue) {
  return {
    type: 'PAGE::SETTING::UPDATE',
    name,
    newValue
  }
}

{'repo_name': 'locomotivecms/engine', 'stars': '2298', 'repo_language': 'Ruby', 'file_name': 'config', 'mime_type': 'text/plain', 'hash': 7220376104538949226, 'source_dataset': 'data'}


@aws-sdk/client-qldb-session

@aws-sdk/client-qldb-session client

npm run remove-definitions && npm run remove-dist

{'repo_name': 'aws/aws-sdk-js-v3', 'stars': '355', 'repo_language': 'TypeScript', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': -6131562233070553791, 'source_dataset': 'data'}


<?xml version="1.0" encoding="utf-8" ?>
<SampleMetadata>
	<ID>db4e78b7-cdbe-4bf5-9cb0-bcb80be01506</ID>
	<IsFullApplication>false</IsFullApplication>
	<Level>Beginning</Level>
	<Tags>Platform Features</Tags>
	<Gallery>true</Gallery>
	<Brief>Demonstrates how to use ContactsProvider and the device owner's profile in Android.</Brief>
</SampleMetadata>

{'repo_name': 'xamarin/monodroid-samples', 'stars': '2015', 'repo_language': 'C#', 'file_name': 'AssemblyInfo.cs', 'mime_type': 'text/plain', 'hash': 8323147820505186761, 'source_dataset': 'data'}


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

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import java.io.IOException;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;

import com.netflix.msl.MslCryptoException;
import com.netflix.msl.MslEncodingException;
import com.netflix.msl.MslEntityAuthException;
import com.netflix.msl.MslError;
import com.netflix.msl.io.MslEncoderException;
import com.netflix.msl.io.MslEncoderFactory;
import com.netflix.msl.io.MslEncoderFormat;
import com.netflix.msl.io.MslEncoderUtils;
import com.netflix.msl.io.MslObject;
import com.netflix.msl.test.ExpectedMslException;
import com.netflix.msl.util.MockMslContext;
import com.netflix.msl.util.MslContext;
import com.netflix.msl.util.MslTestUtils;

/**
 * RSA entity authentication data unit tests.
 *
 * @author Wesley Miaw <wmiaw@netflix.com>
 */
public class RsaAuthenticationDataTest {
	/** MSL encoder format. */
	private static final MslEncoderFormat ENCODER_FORMAT = MslEncoderFormat.JSON;

    /** Key entity authentication scheme. */
    private static final String KEY_SCHEME = "scheme";
    /** Key entity authentication data. */
    private static final String KEY_AUTHDATA = "authdata";
    /** Key entity identity. */
    private static final String KEY_IDENTITY = "identity";
    /** Key public key ID. */
    private static final String KEY_PUBKEY_ID = "pubkeyid";

    @Rule
    public ExpectedMslException thrown = ExpectedMslException.none();

    @BeforeClass
    public static void setup() throws IOException, MslEncodingException, MslCryptoException {
        ctx = new MockMslContext(EntityAuthenticationScheme.X509, false);
        encoder = ctx.getMslEncoderFactory();
    }

    @AfterClass
    public static void teardown() {
        encoder = null;
        ctx = null;
    }

    @Test
    public void ctors() throws MslEncodingException, MslEncoderException, MslCryptoException {
        final RsaAuthenticationData data = new RsaAuthenticationData(MockRsaAuthenticationFactory.RSA_ESN, MockRsaAuthenticationFactory.RSA_PUBKEY_ID);
        assertEquals(MockRsaAuthenticationFactory.RSA_ESN, data.getIdentity());
        assertEquals(MockRsaAuthenticationFactory.RSA_PUBKEY_ID, data.getPublicKeyId());
        assertEquals(EntityAuthenticationScheme.RSA, data.getScheme());
        final MslObject authdata = data.getAuthData(encoder, ENCODER_FORMAT);
        assertNotNull(authdata);
        final byte[] encode = data.toMslEncoding(encoder, ENCODER_FORMAT);
        assertNotNull(encode);

        final RsaAuthenticationData moData = new RsaAuthenticationData(authdata);
        assertEquals(data.getIdentity(), moData.getIdentity());
        assertEquals(data.getPublicKeyId(), moData.getPublicKeyId());
        assertEquals(data.getScheme(), moData.getScheme());
        final MslObject moAuthdata = moData.getAuthData(encoder, ENCODER_FORMAT);
        assertNotNull(moAuthdata);
        assertTrue(MslEncoderUtils.equalObjects(authdata, moAuthdata));
        final byte[] moEncode = moData.toMslEncoding(encoder, ENCODER_FORMAT);
        assertNotNull(moEncode);
        assertArrayEquals(encode, moEncode);
    }

    @Test
    public void encode() throws MslEncoderException, MslCryptoException {
        final RsaAuthenticationData data = new RsaAuthenticationData(MockRsaAuthenticationFactory.RSA_ESN, MockRsaAuthenticationFactory.RSA_PUBKEY_ID);
        final MslObject mo = MslTestUtils.toMslObject(encoder, data);
        assertEquals(EntityAuthenticationScheme.RSA.toString(), mo.getString(KEY_SCHEME));
        final MslObject authdata = mo.getMslObject(KEY_AUTHDATA, encoder);
        assertEquals(MockRsaAuthenticationFactory.RSA_ESN, authdata.getString(KEY_IDENTITY));
        assertEquals(MockRsaAuthenticationFactory.RSA_PUBKEY_ID, authdata.get(KEY_PUBKEY_ID));
    }

    @Test
    public void create() throws MslEncoderException, MslEntityAuthException, MslEncodingException, MslCryptoException {
        final RsaAuthenticationData data = new RsaAuthenticationData(MockRsaAuthenticationFactory.RSA_ESN, MockRsaAuthenticationFactory.RSA_PUBKEY_ID);
        final byte[] encode = data.toMslEncoding(encoder, ENCODER_FORMAT);
        final MslObject mo = MslTestUtils.toMslObject(encoder, data);
        final EntityAuthenticationData entitydata = EntityAuthenticationData.create(ctx, mo);
        assertNotNull(entitydata);
        assertTrue(entitydata instanceof RsaAuthenticationData);

        final RsaAuthenticationData moData = (RsaAuthenticationData)entitydata;
        assertEquals(data.getIdentity(), moData.getIdentity());
        assertEquals(data.getPublicKeyId(), moData.getPublicKeyId());
        assertEquals(data.getScheme(), moData.getScheme());
        final MslObject moAuthdata = moData.getAuthData(encoder, ENCODER_FORMAT);
        assertNotNull(moAuthdata);
        assertTrue(MslEncoderUtils.equalObjects(data.getAuthData(encoder, ENCODER_FORMAT), moAuthdata));
        final byte[] moEncode = moData.toMslEncoding(encoder, ENCODER_FORMAT);
        assertNotNull(moEncode);
        assertArrayEquals(encode, moEncode);
    }

    @Test
    public void missingIdentity() throws MslEncodingException, MslCryptoException {
        thrown.expect(MslEncodingException.class);
        thrown.expectMslError(MslError.MSL_PARSE_ERROR);

        final RsaAuthenticationData data = new RsaAuthenticationData(MockRsaAuthenticationFactory.RSA_ESN, MockRsaAuthenticationFactory.RSA_PUBKEY_ID);
        final MslObject authdata = data.getAuthData(encoder, ENCODER_FORMAT);
        assertNotNull(authdata.remove(KEY_IDENTITY));
        new RsaAuthenticationData(authdata);
    }

    @Test
    public void missingPubkeyId() throws MslEncodingException, MslCryptoException {
        thrown.expect(MslEncodingException.class);
        thrown.expectMslError(MslError.MSL_PARSE_ERROR);

        final RsaAuthenticationData data = new RsaAuthenticationData(MockRsaAuthenticationFactory.RSA_ESN, MockRsaAuthenticationFactory.RSA_PUBKEY_ID);
        final MslObject authdata = data.getAuthData(encoder, ENCODER_FORMAT);
        assertNotNull(authdata.remove(KEY_PUBKEY_ID));
        new RsaAuthenticationData(authdata);
    }

    @Test
    public void equalsIdentity() throws MslEncodingException, MslEncoderException, MslEntityAuthException, MslCryptoException {
        final String identityA = MockRsaAuthenticationFactory.RSA_ESN + "A";
        final String identityB = MockRsaAuthenticationFactory.RSA_ESN + "B";
        final RsaAuthenticationData dataA = new RsaAuthenticationData(identityA, MockRsaAuthenticationFactory.RSA_PUBKEY_ID);
        final RsaAuthenticationData dataB = new RsaAuthenticationData(identityB, MockRsaAuthenticationFactory.RSA_PUBKEY_ID);
        final EntityAuthenticationData dataA2 = EntityAuthenticationData.create(ctx, MslTestUtils.toMslObject(encoder, dataA));

        assertTrue(dataA.equals(dataA));
        assertEquals(dataA.hashCode(), dataA.hashCode());

        assertFalse(dataA.equals(dataB));
        assertFalse(dataB.equals(dataA));
        assertTrue(dataA.hashCode() != dataB.hashCode());

        assertTrue(dataA.equals(dataA2));
        assertTrue(dataA2.equals(dataA));
        assertEquals(dataA.hashCode(), dataA2.hashCode());
    }

    @Test
    public void equalsPubKeyId() throws MslEncodingException, MslEncoderException, MslEntityAuthException, MslCryptoException {
        final String pubkeyidA = MockRsaAuthenticationFactory.RSA_PUBKEY_ID + "A";
        final String pubkeyidB = MockRsaAuthenticationFactory.RSA_PUBKEY_ID + "B";
        final RsaAuthenticationData dataA = new RsaAuthenticationData(MockRsaAuthenticationFactory.RSA_ESN, pubkeyidA);
        final RsaAuthenticationData dataB = new RsaAuthenticationData(MockRsaAuthenticationFactory.RSA_ESN, pubkeyidB);
        final EntityAuthenticationData dataA2 = EntityAuthenticationData.create(ctx, MslTestUtils.toMslObject(encoder, dataA));

        assertTrue(dataA.equals(dataA));
        assertEquals(dataA.hashCode(), dataA.hashCode());

        assertFalse(dataA.equals(dataB));
        assertFalse(dataB.equals(dataA));
        assertTrue(dataA.hashCode() != dataB.hashCode());

        assertTrue(dataA.equals(dataA2));
        assertTrue(dataA2.equals(dataA));
        assertEquals(dataA.hashCode(), dataA2.hashCode());
    }

    @Test
    public void equalsObject() {
        final RsaAuthenticationData data = new RsaAuthenticationData(MockRsaAuthenticationFactory.RSA_ESN, MockRsaAuthenticationFactory.RSA_PUBKEY_ID);
        assertFalse(data.equals(null));
        assertFalse(data.equals(KEY_IDENTITY));
        assertTrue(data.hashCode() != KEY_IDENTITY.hashCode());
    }

    /** MSL context. */
    private static MslContext ctx;
    /** MSL encoder factory. */
    private static MslEncoderFactory encoder;
}

{'repo_name': 'Netflix/msl', 'stars': '593', 'repo_language': 'C++', 'file_name': 'UserIdToken.java', 'mime_type': 'text/x-java', 'hash': -165025208082012417, 'source_dataset': 'data'}


--- a/src/ap/wps_hostapd.c
+++ b/src/ap/wps_hostapd.c
@@ -352,8 +352,7 @@ static int hapd_wps_reconfig_in_memory(s
 				bss->wpa_pairwise |= WPA_CIPHER_GCMP;
 			else
 				bss->wpa_pairwise |= WPA_CIPHER_CCMP;
-		}
-		if (cred->encr_type & WPS_ENCR_TKIP)
+		} else if (cred->encr_type & WPS_ENCR_TKIP)
 			bss->wpa_pairwise |= WPA_CIPHER_TKIP;
 		bss->rsn_pairwise = bss->wpa_pairwise;
 		bss->wpa_group = wpa_select_ap_group_cipher(bss->wpa,
@@ -1073,8 +1072,7 @@ int hostapd_init_wps(struct hostapd_data
 		if (conf->rsn_pairwise & (WPA_CIPHER_CCMP | WPA_CIPHER_GCMP)) {
 			wps->encr_types |= WPS_ENCR_AES;
 			wps->encr_types_rsn |= WPS_ENCR_AES;
-		}
-		if (conf->rsn_pairwise & WPA_CIPHER_TKIP) {
+		} else if (conf->rsn_pairwise & WPA_CIPHER_TKIP) {
 			wps->encr_types |= WPS_ENCR_TKIP;
 			wps->encr_types_rsn |= WPS_ENCR_TKIP;
 		}

{'repo_name': 'openwrt-mirror/openwrt', 'stars': '507', 'repo_language': 'C', 'file_name': 'Makefile', 'mime_type': 'text/plain', 'hash': 239231790215744048, 'source_dataset': 'data'}


<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="3.1" client="site" method="upgrade">
	<name>mod_finder</name>
	<author>Joomla! Project</author>
	<creationDate>August 2011</creationDate>
	<copyright>(C) 2005 - 2017 Open Source Matters. All rights reserved.</copyright>
	<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
	<authorEmail>admin@joomla.org</authorEmail>
	<authorUrl>www.joomla.org</authorUrl>
	<version>3.0.0</version>
	<description>MOD_FINDER_XML_DESCRIPTION</description>
	<files>
		<filename module="mod_finder">mod_finder.php</filename>
		<folder>tmpl</folder>
		<filename>helper.php</filename>
	</files>
	<languages>
		<language tag="en-GB">language/en-GB/en-GB.mod_finder.ini</language>
		<language tag="en-GB">language/en-GB/en-GB.mod_finder.sys.ini</language>
	</languages>
	<help key="JHELP_EXTENSIONS_MODULE_MANAGER_SMART_SEARCH" />
	<config>
		<fields name="params" addfieldpath="/administrator/components/com_finder/models/fields">
			<fieldset name="basic">
				<field
					name="searchfilter"
					type="searchfilter"
					label="MOD_FINDER_FIELDSET_BASIC_SEARCHFILTER_LABEL"
					description="MOD_FINDER_FIELDSET_BASIC_SEARCHFILTER_DESCRIPTION"
					default=""
				/>

				<field
					name="show_autosuggest"
					type="radio"
					label="MOD_FINDER_FIELDSET_BASIC_AUTOSUGGEST_LABEL"
					description="MOD_FINDER_FIELDSET_BASIC_AUTOSUGGEST_DESCRIPTION"
					default="1"
					class="btn-group btn-group-yesno"
					>
					<option value="1">JSHOW</option>
					<option value="0">JHIDE</option>
				</field>

				<field
					name="show_advanced"
					type="list"
					label="MOD_FINDER_FIELDSET_BASIC_SHOW_ADVANCED_LABEL"
					description="MOD_FINDER_FIELDSET_BASIC_SHOW_ADVANCED_DESCRIPTION"
					default="0"
					>
					<option value="2">MOD_FINDER_FIELDSET_BASIC_SHOW_ADVANCED_OPTION_LINK</option>
					<option value="1">JSHOW</option>
					<option value="0">JHIDE</option>
				</field>

				<field
					name="field_size"
					type="text"
					label="MOD_FINDER_FIELDSET_ADVANCED_FIELD_SIZE_LABEL"
					description="MOD_FINDER_FIELDSET_ADVANCED_FIELD_SIZE_DESCRIPTION"
					default="25"
					filter="integer"
				/>

				<field
					name="show_label"
					type="radio"
					label="MOD_FINDER_FIELDSET_ADVANCED_SHOW_LABEL_LABEL"
					description="MOD_FINDER_FIELDSET_ADVANCED_SHOW_LABEL_DESCRIPTION"
					class="btn-group btn-group-yesno"
					default="1"
					>
					<option value="1">JSHOW</option>
					<option value="0">JHIDE</option>
				</field>

				<field
					name="label_pos"
					type="list"
					label="MOD_FINDER_FIELDSET_ADVANCED_LABEL_POS_LABEL"
					description="MOD_FINDER_FIELDSET_ADVANCED_LABEL_POS_DESCRIPTION"
					default="left"
					>
					<option value="right">JGLOBAL_RIGHT</option>
					<option value="left">JGLOBAL_LEFT</option>
					<option value="top">MOD_FINDER_CONFIG_OPTION_TOP</option>
					<option value="bottom">MOD_FINDER_CONFIG_OPTION_BOTTOM</option>
				</field>

				<field
					name="alt_label"
					type="text"
					label="MOD_FINDER_FIELDSET_ADVANCED_ALT_LABEL"
					description="MOD_FINDER_FIELDSET_ADVANCED_ALT_DESCRIPTION"
				/>

				<field
					name="show_button"
					type="radio"
					label="MOD_FINDER_FIELDSET_ADVANCED_SHOW_BUTTON_LABEL"
					description="MOD_FINDER_FIELDSET_ADVANCED_SHOW_BUTTON_DESCRIPTION"
					class="btn-group btn-group-yesno"
					default="0"
					>
					<option value="1">JSHOW</option>
					<option value="0">JHIDE</option>
				</field>

				<field
					name="button_pos"
					type="list"
					label="MOD_FINDER_FIELDSET_ADVANCED_BUTTON_POS_LABEL"
					description="MOD_FINDER_FIELDSET_ADVANCED_BUTTON_POS_DESCRIPTION"
					default="left"
					>
					<option value="right">JGLOBAL_RIGHT</option>
					<option value="left">JGLOBAL_LEFT</option>
					<option value="top">MOD_FINDER_CONFIG_OPTION_TOP</option>
					<option value="bottom">MOD_FINDER_CONFIG_OPTION_BOTTOM</option>
				</field>

				<field
					name="opensearch"
					type="radio"
					label="MOD_FINDER_FIELD_OPENSEARCH_LABEL"
					description="MOD_FINDER_FIELD_OPENSEARCH_DESCRIPTION"
					class="btn-group btn-group-yesno"
					default="1"
					>
					<option value="1">JYES</option>
					<option value="0">JNO</option>
				</field>

				<field
					name="opensearch_title"
					type="text"
					label="MOD_FINDER_FIELD_OPENSEARCH_TEXT_LABEL"
					description="MOD_FINDER_FIELD_OPENSEARCH_TEXT_DESCRIPTION"
				/>

				<field
					name="set_itemid"
					type="menuitem"
					label="MOD_FINDER_FIELDSET_ADVANCED_SETITEMID_LABEL"
					description="MOD_FINDER_FIELDSET_ADVANCED_SETITEMID_DESCRIPTION"
					default="0"
					>
					<option value="0">MOD_FINDER_SELECT_MENU_ITEMID</option>
				</field>
			</fieldset>
			<fieldset name="advanced">
				<field
					name="layout"
					type="modulelayout"
					label="JFIELD_ALT_LAYOUT_LABEL"
					description="JFIELD_ALT_MODULE_LAYOUT_DESC"
				/>

				<field
					name="moduleclass_sfx"
					type="textarea"
					label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
					description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC"
					rows="3"
					default=""
				/>
			</fieldset>
		</fields>
	</config>
</extension>

{'repo_name': 'yaofeifly/Vub_ENV', 'stars': '193', 'repo_language': 'PHP', 'file_name': 'index.html', 'mime_type': 'text/xml', 'hash': -8204630954304875377, 'source_dataset': 'data'}


<?php

namespace Bootstrapper\Facades;

/**
 * Facade for Thumbnails
 *
 * @package Bootstrapper\Facades
 * @see     Bootstrapper\Thumbnail
 */
class Thumbnail extends BootstrapperFacade
{

    /**
     * {@inheritdoc}
     * @return string
     */
    protected static function getFacadeAccessor()
    {
        return 'thumbnail';
    }

}

{'repo_name': 'patricktalmadge/bootstrapper', 'stars': '570', 'repo_language': 'PHP', 'file_name': 'ConfigInterface.php', 'mime_type': 'text/x-php', 'hash': 4010113084284973501, 'source_dataset': 'data'}


topthink/think-swoole

Swoole extend for thinkphp5.1

{'repo_name': 'geesondog/rhaphp', 'stars': '998', 'repo_language': 'PHP', 'file_name': 'sql.sql', 'mime_type': 'text/plain', 'hash': -5940517898372981962, 'source_dataset': 'data'}


# Day 39 - Practical Guide for YAML Build Pipelines in Azure DevOps - Part 3

*The other posts in this Series can be found below.*

***[Day 35 - Practical Guide for YAML Build Pipelines in Azure DevOps - Part 1](./day.35.building.a.practical.yaml.pipeline.part.1.md)***

***[Day 38 - Practical Guide for YAML Build Pipelines in Azure DevOps - Part 2](./day.38.building.a.practical.yaml.pipeline.part.2.md)***

***[Day 39 - Practical Guide for YAML Build Pipelines in Azure DevOps - Part 3](./day.39.building.a.practical.yaml.pipeline.part.3.md)***

Today, we are covering some recommendations when using Infrastructure as Code when building and managing your Build Pipelines.

## Introduction

So you've been reading our 100 Days of IaC Series, along with a other Microsoft Azure DevOps related articles and you might be overwhelmed with the plethora of options that are available in Azure DevOps. Do I want to use bash or PowerShell? Do I want to use ARM Templates? Do I want to use Terraform? Do I want to use python and Ansible? The choices and combinations available to you are practically endless. So what should you do?

## Pick Tools that Play to the Strengths of your Team

You should pick tools that play to the strengths of your team, while always keeping in mind your end goal in IaC is idempotent, declarative deployment.
If 90% of your Team uses GUI based management systems and have just started using PowerShell, it would behoove you to start with using PowerShell related tasks available in Build Pipelines along with the **classic editor**. In the long-term I would recommend moving away from the **classic editor** so you have better tracking and control with your Build Pipelines when they are configured in YAML and tied to a Git repository.

If 90% of your Team has a strong Linux background and is comfortable in with bash and python, then stick with the Azure CLI and bash/python scripting based tasks.

If you have an edge case scenario that deviates from the rest of the primary tools that you have in place because it just works better, then so be it. You may find that there's a particular ARM Template or Terraform Template that provides exactly what you need so go ahead and integrated into your Build Pipeline(s).

## Create Documentation Standards

If you've had to manage any type of application or scripts in the past; there's nothing quite as time consuming as reviewing someone's code for a few days to a week just to understand what they were doing. Reading and deciphering terse code is already difficult enough. Attempting to understand it without any comments or documentation is even worse. To that end, below are a list of suggestions to implement in your code.

* Document your Code
  * Option 1: Inline in the Script/Application
  * Option 2: Centralized location, i.e. README.md in your Repository
* Use comments that tell *why* your code works; your code already tells *how*.
* Create a Documentation Standard and stick with it

## Bake in Idempotence

Remember, as we mentioned earlier in in **[Day 8](./article/../day.8.deploy.tech.comparison.md)**:

* PowerShell is neither idempotent or declarative
* Azure CLI create commands are idempotent, but not declarative
* ARM templates are idempotent and declarative

For everyday non-production use where 99.99% reliability is not as important, having your team learn the necessary scripting skills is a win if it helps you move forward with IaC, deploying from a pipeline instead of by hand from the command line. Idempotence is running a set of operations or tasks and always achieving the same results irrespective of how many times they are executed. By ensuring that anything and everything that you put into your Build Pipeline is idempotent, you should have minimal surprises pop up in your Infrastructure that are related to the changes you made in your Build Pipeline.

## Change when and where it makes sense

So you're attempted working with thousands of lines of JSON in ARM Templates but its becoming too difficult to manage. Your team has reservations about changing over from ARM Templates to Azure PowerShell or Azure CLI based scripts. Instead of attempting to change everything over from a single tool or toolset to another;change what makes the most beneficial impact to your team with the least effort.

If you can create an idempotent Azure PowerShell or Azure CLI script that's only 100 lines long and it will replace an ARM Template that's 1000+ lines of JSON, then by all means, do so. Conversely, if you have an Azure PowerShell or Azure CLI script that isn't working as intended, but you have an ARM Template that's performing perfectly, then go with the ARM Template.

Take into account what is best for you and your team and make changes that make you more efficient and productive.

## Conclusion

In today's article we are covered some recommendations when using Infrastructure as Code when building and managing your Build Pipelines. If there's a specific scenario that you wish to be covered in future articles, please create a **[New Issue](https://github.com/starkfell/100DaysOfIaC/issues)** in the [starkfell/100DaysOfIaC](https://github.com/starkfell/100DaysOfIaC/) GitHub repository.

{'repo_name': 'starkfell/100DaysOfIaC', 'stars': '230', 'repo_language': 'PLpgSQL', 'file_name': 'spellright.dict', 'mime_type': 'text/plain', 'hash': 4885764718199066118, 'source_dataset': 'data'}


<resources>
    <string name="app_name">PostDelayedDemo</string>
    <string name="press_back">Press BACK to stop the polling</string>
</resources>

{'repo_name': 'commonsguy/cw-omnibus', 'stars': '5122', 'repo_language': 'Java', 'file_name': 'ZXingDemo.java', 'mime_type': 'text/x-java', 'hash': 1595298848462378704, 'source_dataset': 'data'}


{'repo_name': 'okta/okta-signin-widget', 'stars': '184', 'repo_language': 'JavaScript', 'file_name': 'mfa-enroll-email-with-sms-enrolled.json', 'mime_type': 'text/plain', 'hash': -5970948864631280045, 'source_dataset': 'data'}


/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.activemq.artemis.utils.collections;

import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.function.Consumer;

public class SingletonIterator<E> implements Iterator<E> {

   private E value;

   public static <E> Iterator<E> newInstance(E e) {
      return new SingletonIterator<>(e);
   }

   private SingletonIterator(E value) {
      this.value = value;
   }

   @Override
   public boolean hasNext() {
      return value != null;
   }

   @Override
   public E next() {
      if (value != null) {
         E result = value;
         value = null;
         return result;
      } else {
         throw new NoSuchElementException();
      }
   }

   @Override
   public void remove() {
      value = null;
   }

   @Override
   public void forEachRemaining(Consumer<? super E> action) {
      if (value != null)
         action.accept(value);
   }
}

{'repo_name': 'apache/activemq-artemis', 'stars': '613', 'repo_language': 'Java', 'file_name': 'SerializableObjectRefAddr.java', 'mime_type': 'text/x-java', 'hash': -489208365605995261, 'source_dataset': 'data'}


#pragma once

#include <iostream>
#include <fstream>
#include "../libs/libtri/include/file_tools.h"
#include "Node.h"

using namespace std;

// File containing all the octree IO methods

// Internal format to represent an octree
struct OctreeInfo {
	int version;
	string base_filename;
	size_t gridlength;
	size_t n_nodes;
	size_t n_data;

	OctreeInfo() : version(1), base_filename(string("")), gridlength(1024), n_nodes(0), n_data(0) {}
	OctreeInfo(int version, string base_filename, size_t gridlength, size_t n_nodes, size_t n_data) : version(version), base_filename(base_filename), gridlength(gridlength), n_nodes(n_nodes), n_data(n_data) {}

	void print() const{
		cout << "  version: " << version << endl;
		cout << "  base_filename: " << base_filename << endl;
		cout << "  grid length: " << gridlength << endl;
		cout << "  n_nodes: " << n_nodes << endl;
		cout << "  n_data: " << n_data << endl;
	}

	// check if all files required by Tri exist
	bool filesExist() const{
		string header = base_filename + string(".octree");
		string nodes = base_filename + string(".octreenodes");
		string data = base_filename + string(".octreedata");
		return (file_exists(header) && file_exists(nodes) && file_exists(data));
	}
};

size_t writeVoxelData(FILE* f, const VoxelData &v, size_t &b_data_pos);
void readVoxelData(FILE* f, VoxelData &v);
size_t writeNode(FILE* node_out, const Node &n, size_t &b_node_pos);
inline void readNode(FILE* f, Node &n);

void writeOctreeHeader(const std::string &filename, const OctreeInfo &i);
int parseOctreeHeader(const std::string &filename, OctreeInfo &i);

// Write a data point to file
inline size_t writeVoxelData(FILE* f, const VoxelData &v, size_t &b_data_pos){
	fwrite(&v.morton, VOXELDATA_SIZE, 1, f);
	b_data_pos++;
	return b_data_pos-1;
}

// Read a data point from a file
inline void readDataPoint(FILE* f, VoxelData &v){
	v.morton = 0;
	fread(&v.morton, VOXELDATA_SIZE, 1, f);
}

// Write an octree node to file
inline size_t writeNode(FILE* node_out, const Node &n, size_t &b_node_pos){
	fwrite(& n.data, sizeof(size_t), 3, node_out);
	b_node_pos++;
	return b_node_pos-1;
}

// Read a Node from a file
inline void readNode(FILE* f, Node &n){
	fread(& n.data, sizeof(size_t), 3, f);
}

// Write an octree header to a file
inline void writeOctreeHeader(const std::string &filename, const OctreeInfo &i){
	ofstream outfile;
	outfile.open(filename.c_str(), ios::out);
	outfile << "#octreeheader 1" << endl;
	outfile << "gridlength " << i.gridlength << endl;
	outfile << "n_nodes " << i.n_nodes << endl;
	outfile << "n_data " << i.n_data << endl;
	outfile << "END" << endl;
	outfile.close();
}

// Parse a given octree header, store info in OctreeInfo struct
inline int parseOctreeHeader(const std::string &filename, OctreeInfo &i){
	cout << "  reading octree header from " << filename << " ... " << endl;
	ifstream headerfile;
	headerfile.open(filename.c_str(), ios::in);

	i.base_filename = filename.substr(0,filename.find_last_of("."));

	string line; bool done = false;
	headerfile >> line >> i.version;
	if (line.compare("#octreeheader") != 0) {cout << "    Error: first line reads [" << line << "] instead of [#octreeheader]" << endl; return 0;}

	while(headerfile.good() && !done) {
		headerfile >> line;
		if (line.compare("END") == 0) done = true; // when we encounter data keyword, we're at the end of the ASCII header
		else if (line.compare("gridlength") == 0) {headerfile >> i.gridlength;}
		else if (line.compare("n_nodes") == 0) {headerfile >> i.n_nodes;}
		else if (line.compare("n_data") == 0) {headerfile >> i.n_data;}
		else { cout << "  unrecognized keyword [" << line << "], skipping" << endl;
		char c; do { c = headerfile.get(); } while(headerfile.good() && (c != '\n'));
		}
	}

	headerfile.close();
	return 1;
}

{'repo_name': 'Forceflow/ooc_svo_builder', 'stars': '210', 'repo_language': 'C++', 'file_name': 'FindGLM.cmake', 'mime_type': 'text/plain', 'hash': 5898673572718120329, 'source_dataset': 'data'}


{ config, lib, pkgs, ... }:

with lib;

let

  cfg = config.virtualisation.azure.agent;

  waagent = with pkgs; stdenv.mkDerivation rec {
    name = "waagent-2.0";
    src = pkgs.fetchFromGitHub {
      owner = "Azure";
      repo = "WALinuxAgent";
      rev = "1b3a8407a95344d9d12a2a377f64140975f1e8e4";
      sha256 = "10byzvmpgrmr4d5mdn2kq04aapqb3sgr1admk13wjmy5cd6bwd2x";
    };

    patches = [ ./azure-agent-entropy.patch ];

    buildInputs = [ makeWrapper python pythonPackages.wrapPython ];
    runtimeDeps = [ findutils gnugrep gawk coreutils openssl openssh
                    nettools # for hostname
                    procps # for pidof
                    shadow # for useradd, usermod
                    utillinux # for (u)mount, fdisk, sfdisk, mkswap
                    parted
                  ];
    pythonPath = [ pythonPackages.pyasn1 ];

    configurePhase = false;
    buildPhase = false;

    installPhase = ''
      substituteInPlace config/99-azure-product-uuid.rules \
          --replace /bin/chmod "${coreutils}/bin/chmod"
      mkdir -p $out/lib/udev/rules.d
      cp config/*.rules $out/lib/udev/rules.d

      mkdir -p $out/bin
      cp waagent $out/bin/
      chmod +x $out/bin/waagent

      wrapProgram "$out/bin/waagent" \
          --prefix PYTHONPATH : $PYTHONPATH \
          --prefix PATH : "${makeBinPath runtimeDeps}"
    '';
  };

  provisionedHook = pkgs.writeScript "provisioned-hook" ''
    #!${pkgs.runtimeShell}
    /run/current-system/systemd/bin/systemctl start provisioned.target
  '';

in

{

  ###### interface

  options.virtualisation.azure.agent = {
    enable = mkOption {
      default = false;
      description = "Whether to enable the Windows Azure Linux Agent.";
    };
    verboseLogging = mkOption {
      default = false;
      description = "Whether to enable verbose logging.";
    };
    mountResourceDisk = mkOption {
      default = true;
      description = "Whether the agent should format (ext4) and mount the resource disk to /mnt/resource.";
    };
  };

  ###### implementation

  config = mkIf cfg.enable {
    assertions = [ {
      assertion = pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64;
      message = "Azure not currently supported on ${pkgs.stdenv.hostPlatform.system}";
    } {
      assertion = config.networking.networkmanager.enable == false;
      message = "Windows Azure Linux Agent is not compatible with NetworkManager";
    } ];

    boot.initrd.kernelModules = [ "ata_piix" ];
    networking.firewall.allowedUDPPorts = [ 68 ];

    environment.etc."waagent.conf".text = ''
        #
        # Windows Azure Linux Agent Configuration
        #

        Role.StateConsumer=${provisionedHook}

        # Enable instance creation
        Provisioning.Enabled=y

        # Password authentication for root account will be unavailable.
        Provisioning.DeleteRootPassword=n

        # Generate fresh host key pair.
        Provisioning.RegenerateSshHostKeyPair=n

        # Supported values are "rsa", "dsa" and "ecdsa".
        Provisioning.SshHostKeyPairType=ed25519

        # Monitor host name changes and publish changes via DHCP requests.
        Provisioning.MonitorHostName=y

        # Decode CustomData from Base64.
        Provisioning.DecodeCustomData=n

        # Execute CustomData after provisioning.
        Provisioning.ExecuteCustomData=n

        # Format if unformatted. If 'n', resource disk will not be mounted.
        ResourceDisk.Format=${if cfg.mountResourceDisk then "y" else "n"}

        # File system on the resource disk
        # Typically ext3 or ext4. FreeBSD images should use 'ufs2' here.
        ResourceDisk.Filesystem=ext4

        # Mount point for the resource disk
        ResourceDisk.MountPoint=/mnt/resource

        # Respond to load balancer probes if requested by Windows Azure.
        LBProbeResponder=y

        # Enable logging to serial console (y|n)
        # When stdout is not enough...
        # 'y' if not set
        Logs.Console=y

        # Enable verbose logging (y|n)
        Logs.Verbose=${if cfg.verboseLogging then "y" else "n"}

        # Root device timeout in seconds.
        OS.RootDeviceScsiTimeout=300
    '';

    services.udev.packages = [ waagent ];

    networking.dhcpcd.persistent = true;

    services.logrotate = {
      enable = true;
      config = ''
        /var/log/waagent.log {
            compress
            monthly
            rotate 6
            notifempty
            missingok
        }
      '';
    };

    systemd.targets.provisioned = {
      description = "Services Requiring Azure VM provisioning to have finished";
    };

  systemd.services.consume-hypervisor-entropy =
    { description = "Consume entropy in ACPI table provided by Hyper-V";

      wantedBy = [ "sshd.service" "waagent.service" ];
      before = [ "sshd.service" "waagent.service" ];

      path  = [ pkgs.coreutils ];
      script =
        ''
          echo "Fetching entropy..."
          cat /sys/firmware/acpi/tables/OEM0 > /dev/random
        '';
      serviceConfig.Type = "oneshot";
      serviceConfig.RemainAfterExit = true;
      serviceConfig.StandardError = "journal+console";
      serviceConfig.StandardOutput = "journal+console";
     };

    systemd.services.waagent = {
      wantedBy = [ "multi-user.target" ];
      after = [ "network-online.target" "sshd.service" ];
      wants = [ "network-online.target" ];

      path = [ pkgs.e2fsprogs pkgs.bash ];
      description = "Windows Azure Agent Service";
      unitConfig.ConditionPathExists = "/etc/waagent.conf";
      serviceConfig = {
        ExecStart = "${waagent}/bin/waagent -daemon";
        Type = "simple";
      };
    };

  };

}

{'repo_name': 'NixOS/nixpkgs-channels', 'stars': '161', 'repo_language': 'Nix', 'file_name': 'default.nix', 'mime_type': 'text/plain', 'hash': -6331582489517012709, 'source_dataset': 'data'}


#!/usr/bin/env python
# -*- coding: utf-8 -*-

import multiprocessing
import time

from collections import deque
from datetime import datetime

from alex.components.asr.exceptions import ASRException
from alex.components.hub.messages import Command, Frame
from alex.utils.procname import set_proc_name
from alex.utils.exceptions import SessionClosedException

import alex.components.vad.power as PVAD
import alex.components.vad.gmm as GVAD
import alex.components.vad.ffnn as NNVAD

class VAD(multiprocessing.Process):
    """ VAD detects segments of speech in the audio stream.

    It implements two smoothing windows, one for detection of speech and one
    for detection of silence.

    1) The speech window is typically shorter so that the detection if more
       responsive towards the speech, it is easy to activate for the speech.
    2) The silence windows should be longer so that short pauses are not
       triggered and only one speech segment including the short pauses is
       generated.

    It process input signal and outputs only frames with speech. Every time
    a new speech segment starts, it sends 'speech_start()' and every time
    a speech segments ends, it sends 'speech_end()' commands.

    These commands have to be properly detected in the output stream by the
    following component.

    """

    def __init__(self, cfg, commands, audio_in, audio_out, close_event):
        multiprocessing.Process.__init__(self)

        self.cfg = cfg
        self.system_logger = cfg['Logging']['system_logger']
        self.session_logger = cfg['Logging']['session_logger']
        self.commands = commands
        self.local_commands = deque()
        self.audio_in = audio_in
        self.local_audio_in = deque()
        self.audio_out = audio_out
        self.close_event = close_event

        self.vad_fname = None

        if self.cfg['VAD']['type'] == 'power':
            self.vad = PVAD.PowerVAD(cfg)
        elif self.cfg['VAD']['type'] == 'gmm':
            self.vad = GVAD.GMMVAD(cfg)
        elif self.cfg['VAD']['type'] == 'ffnn':
            self.vad = NNVAD.FFNNVAD(cfg)
        else:
            raise ASRException('Unsupported VAD engine: %s' % (self.cfg['VAD']['type'], ))

        # stores information about each frame whether it was classified as speech or non speech
        self.detection_window_speech = deque(maxlen=self.cfg['VAD']['decision_frames_speech'])
        self.detection_window_sil    = deque(maxlen=self.cfg['VAD']['decision_frames_sil'])
        self.deque_audio_in          = deque(maxlen=self.cfg['VAD']['speech_buffer_frames'])

        # keeps last decision about whether there is speech or non speech
        self.last_vad = False

    def recv_input_locally(self):
        """ Copy all input from input connections into local queue objects.

        This will prevent blocking the senders.
        """

        while self.commands.poll():
            command = self.commands.recv()
            self.local_commands.append(command)

        while self.audio_in.poll():
            frame = self.audio_in.recv()
            self.local_audio_in.append(frame)

    def process_pending_commands(self):
        """Process all pending commands.

        Available aio_com:
          stop() - stop processing and exit the process
          flush() - flush input buffers.
            Now it only flushes the input connection.

        Return True if the process should terminate.

        """

        while self.local_commands:
            command = self.local_commands.popleft()
            #if self.cfg['VAD']['debug']:
            self.system_logger.debug(command)

            if isinstance(command, Command):
                if command.parsed['__name__'] == 'stop':
                    return True

                if command.parsed['__name__'] == 'flush':
                    # discard all data in in input buffers
                    while self.audio_in.poll():
                        data_play = self.audio_in.recv()

                    self.local_audio_in.clear()
                    self.detection_window_speech.clear()
                    self.detection_window_sil.clear()
                    self.deque_audio_in.clear()

                    # reset other state variables
                    self.last_vad = False

                    self.commands.send(Command("flushed()", 'VAD', 'HUB'))

                    return False

        return False

    def smoothe_decison(self, decision):
        self.detection_window_speech.append(decision)
        self.detection_window_sil.append(decision)

        speech = float(sum(self.detection_window_speech)) / (len(self.detection_window_speech) + 1.0)
        sil = float(sum(self.detection_window_sil)) / (len(self.detection_window_sil) + 1.0)
        if self.cfg['VAD']['debug']:
            self.system_logger.debug('SPEECH: %s SIL: %s' % (speech, sil))

        vad = self.last_vad
        change = None
        if self.last_vad:
            # last decision was speech
            if sil < self.cfg['VAD']['decision_non_speech_threshold']:
                vad = False
                change = 'non-speech'
        else:
            if speech > self.cfg['VAD']['decision_speech_threshold']:
                vad = True
                change = 'speech'

        self.last_vad = vad

        return vad, change

    def read_write_audio(self):
        # read input audio
        if self.local_audio_in:
            if len(self.local_audio_in) > 10:
                print "VAD unprocessed frames:", len(self.local_audio_in)
                self.local_audio_in = deque(list(self.local_audio_in)[-10:])

            # read recorded audio
            data_rec = self.local_audio_in.popleft()

            if isinstance(data_rec, Frame):
                # buffer the recorded and played audio
                self.deque_audio_in.append(data_rec)

                #s = (time.time(), time.clock())

                decision = self.vad.decide(data_rec.payload)
                vad, change = self.smoothe_decison(decision)

                #d = (time.time() - s[0], time.clock() - s[1])
                #if d[0] > 0.001:
                #    print "VAD t = {t:0.4f} c = {c:0.4f}\n".format(t=d[0], c=d[1])

                if self.cfg['VAD']['debug']:
                    self.system_logger.debug("vad: %s change: %s" % (vad, change))

                    if vad:
                        self.system_logger.debug('+')
                    else:
                        self.system_logger.debug('-')

                if change == 'speech':
                    # Create new wave file.
                    timestamp = datetime.now().strftime('%Y-%m-%d--%H-%M-%S.%f')
                    self.vad_fname = 'vad-{stamp}.wav'.format(stamp=timestamp)

                    self.session_logger.turn("user")
                    self.session_logger.rec_start("user", self.vad_fname)

                    # Inform both the parent and the consumer.
                    self.audio_out.send(Command('speech_start(fname="%s")' % self.vad_fname, 'VAD', 'AudioIn'))
                    self.commands.send(Command('speech_start(fname="%s")' % self.vad_fname, 'VAD', 'HUB'))

                elif change == 'non-speech':
                    self.session_logger.rec_end(self.vad_fname)

                    # Inform both the parent and the consumer.
                    self.audio_out.send(Command('speech_end(fname="%s")' % self.vad_fname, 'VAD', 'AudioIn'))
                    self.commands.send(Command('speech_end(fname="%s")' % self.vad_fname, 'VAD', 'HUB'))

                if vad:
                    while self.deque_audio_in:
                        # Send or save all potentially queued data.
                        #   - When there is change to speech, there will be
                        #     several frames of audio;
                        #   - If there is no change, then there will be only
                        #     one queued frame.

                        data_rec = self.deque_audio_in.popleft()

                        # Send the result.
                        self.audio_out.send(data_rec)
                        self.session_logger.rec_write(self.vad_fname, data_rec)

    def run(self):
        try:
            set_proc_name("Alex_VAD")
            self.session_logger.cancel_join_thread()

            while 1:
                # Check the close event.
                if self.close_event.is_set():
                    print 'Received close event in: %s' % multiprocessing.current_process().name
                    return

                if not self.local_audio_in:
                    time.sleep(self.cfg['Hub']['main_loop_sleep_time'])

                s = (time.time(), time.clock())

                self.recv_input_locally()

                # Process all pending commands.
                if self.process_pending_commands():
                    return

                # FIXME: Make the following test work.
                # # Wait until a session has started.
                # if self.session_logger.is_open:
                # Process audio data.
                try:
                    for i in range(self.cfg['VAD']['n_rwa']):
                        # process at least n_rwa frames
                        self.read_write_audio()
                except SessionClosedException as e:
                    self.system_logger.exception('VAD:read_write_audio: {ex!s}'.format(ex=e))

                d = (time.time() - s[0], time.clock() - s[1])
                if d[0] > 0.100:
                    print "VAD t = {t:0.4f} c = {c:0.4f}\n".format(t=d[0], c=d[1])
        except KeyboardInterrupt:
            print 'KeyboardInterrupt exception in: %s' % multiprocessing.current_process().name
            self.close_event.set()
            return
        except:
            self.cfg['Logging']['system_logger'].exception('Uncaught exception in the VAD process.')
            self.close_event.set()
            raise

{'repo_name': 'UFAL-DSG/alex', 'stars': '175', 'repo_language': 'Roff', 'file_name': 'Makefile', 'mime_type': 'text/plain', 'hash': 5261370093083368212, 'source_dataset': 'data'}


{'repo_name': 'microsoft/fluentui-system-icons', 'stars': '1333', 'repo_language': 'Swift', 'file_name': 'build-ios.yml', 'mime_type': 'text/plain', 'hash': -187053771411175630, 'source_dataset': 'data'}