text:
<?php

	namespace browserfs;

	class Runtime {

		// here we register types
		protected $types = null;
		protected $validators = null;

		protected $files = [];

		/**
		 * Constructor. Creates a new Runtime
		 */
		public function __construct() {

			// register native types
			$this->types = [
				'int'     => new runtime\Type\Integer($this, 'int'),
				'sint'    => new runtime\Type\SInt( $this, 'sint' ),

				'float'   => new runtime\Type\Decimal($this, 'float'),
				'sfloat'  => new runtime\Type\SFloat( $this, 'sfloat' ),

				'number'  => new runtime\Type\Number($this, 'number'),
				'snumber' => new runtime\Type\SNumber($this, 'snumber' ),

				'boolean' => new runtime\Type\Boolean($this, 'boolean'),
				'string'  => new runtime\Type\Varchar($this, 'string'),
				'any'     => new runtime\Type\Any($this, 'any')
			];

			$this->validators = [];

		}

		/**
		 * Creates a new RunTime type
		 * @param $typeName string
		 * @return \browserfs\runtime\Type
		 * @throws \browserfs\runtime\Exception
		 */
		public function addType( $typeName, $extendsType = null ) {
			if ( !$this->isTypeName( $typeName ) ) {
				throw new \browserfs\runtime\Exception('Invalid type name `' . json_encode( $typeName ) . '`. The type name must be a string' );
			}

			if ( $this->isTypeRegistered( $typeName ) ) {
				return $this->types[ $typeName ];
			} else {
				return $this->types[ $typeName ] = new runtime\Type($this, $typeName, $extendsType );
			}
		}

		/**
		 * Creates a new Runtime validator
		 * @param $validatorName string
		 * @return \browserfs\runtime\Validator
		 * @throws \browserfs\runtime\Exception
		 */
		public function addValidator( $validatorName, $extendsValidator = null ) {
			if ( !$this->isValidatorName( $validatorName ) ) {
				throw new \browserfs\runtime\Exception('Invalid validator name');
			}

			if ( $this->isValidatorRegistered( $validatorName ) ) {
				return $this->validators[ $validatorName ];
			} else {
				return $this->validators[ $validatorName ] = new runtime\Validator( $this, $validatorName, $extendsValidator );
			}
		}

		/**
		 * Returns TRUE or FALSE if a string can represent a type name
		 * @param $typeName string representing a name of a data type
		 * @return boolean
		 */
		protected function isTypeName( $typeName ) {
			return is_string( $typeName ) &&
			       strlen( $typeName ) &&
			       preg_match( '/^[a-zA-Z_]([a-zA-Z0-9_]+)?(\[\])?$/', $typeName )
		       ? true
		       : false;
		}

		/**
		 * Returns TRUE or FALSE if a string can represend a validator name
		 */
		protected function isValidatorName( $validatorName ) {
			return is_string( $validatorName ) &&
				   strlen( $validatorName ) &&
				   preg_match( '/^[a-zA-Z_]([a-zA-Z0-9_]+)?$/', $validatorName )
				? true
				: false;
		}

		/**
		 * Returns true or false if a type is registered into runtime types
		 * @param $typeName string
		 * @return boolean
		 */
		public function isTypeRegistered( $typeName ) {
			return is_string( $typeName ) && array_key_exists( $typeName, $this->types );
		}

		/**
		 * Returns true or false if a validator is registered into this runtime
		 */
		public function isValidatorRegistered( $validatorName ) {
			return is_string( $validatorName ) && array_key_exists( $validatorName, $this->validators );
		}

		/**
		 * Returns true if an object matches a registered type
		 */
		public function isTypeOf( $mixed, $typeName, &$errors = null ) {

			if ( func_num_args() == 3 ) {
				$errors = [];
			} else {
				$errors = null;
			}

			if ( $this->isTypeName( $typeName ) ) {

				$isArray = substr( strrev( $typeName ), 0, 2 ) == '][';

				if ( $isArray ) {
					$typeName = substr( $typeName, 0, strlen( $typeName ) - 2 );
				}

				if ( $this->isTypeRegistered( $typeName ) ) {

					if ( $isArray ) {

						$result = $this->types[ $typeName ]->testArray( $mixed, $errors );

						if ( is_array( $errors ) && count($errors) == 0 ) {
							$errors = false;
						}

						return $result;

					} else {

						$result = $this->types[ $typeName ]->test( $mixed, $errors );

						if ( is_array( $errors ) && count($errors) == 0 ) {
							$errors = false;
						}

						return $result;
					}

				} else {
					throw new \browserfs\runtime\Exception('Type "' . $typeName . '" is not declared' );
				}
			} else {
				throw new \browserfs\runtime\Exception('Argument $typeName must be a valid type string name' );
			}
		}

		/**
		 * Returns true if an object validates by a registered validator, or false otherwise
		 */
		public function isValidatableBy( $mixed, $validatorName, &$errors = null ) {
			if ( func_num_args() === 3 ) {
				$errors = [];
			} else {
				$errors = null;
			}

			if ( $this->isValidatorName( $validatorName ) ) {

				if ( $this->isValidatorRegistered( $validatorName ) ) {

					$result = $this->validators[ $validatorName ]->test( $mixed, $errors );

					if ( is_array( $errors ) && count( $errors ) == 0 ) {
						$errors = false;
					}

					return $result;

				} else {
					throw new \browserfs\runtime\Exception('Validator "' . $validatorName . '" is not declared' );
				}

			} else {
				throw new \browserfs\runtime\Exception('Argument $validatorName must be a valid validator string name' );
			}
		}

		/**
		 * Converts a type to a string.
		 * @param type string | [ optional => boolean, type => string ]
		 */
		public function typeToString( $type ) {

			if ( is_string( $type ) ) {
				return $type;
			} else
			if ( is_array( $type ) ) {
				return $type['type'];
			}

		}

		/**
		 * Dumps all registered types to a string
		 */
		public function __toString() {

			$out = [];

			foreach ( $this->types as $name ) {
				if ( !in_array( $name, [ 'string', 'int', 'float', 'boolean', 'number', 'any' ] ) ) {
					$out[] = $name . '';
				}
			}

			foreach ( $this->validators as $name ) {
				$out[] = $name . '';
			}

			return implode( "\n\n", $out );
		}

		/**
		 * Returns the previously registered type with the name $typeName.
		 */
		public function getType( $typeName ) {
			if ( is_string( $typeName ) && isset( $this->types[$typeName] ) ) {
				return $this->types[ $typeName ];
			} else {
				return null;
			}
		}

		/**
		 * Returns the previously registered type with the name $typeName.
		 */
		public function getValidator( $validatorName ) {
			if ( is_string( $validatorName ) && isset( $this->validators[$validatorName] ) ) {
				return $this->validators[ $validatorName ];
			} else {
				return null;
			}
		}

		/**
		 * Imports types from a file in current runtime. Use this method
		 * if you allready instantiated a runtime, and you want to load
		 * later aditional definitions inside it.
		 *
		 */
		public function load( $definitionFile ) {

			if ( !is_string( $definitionFile ) ) {
				throw new \browserfs\runtime\Exception('Invalid argument definitionFile. Must be string!');
			}

			if ( !strlen( $definitionFile ) ) {
				throw new \browserfs\runtime\Exception('Invalid argument definitionFile. Must be non-empty!');
			}

			$filePath = @realpath( $definitionFile );

			if ( $filePath === false ) {
				throw new \browserfs\runtime\Exception('File "' . $definitionFile . '" does not exist!' );
			}

			if ( isset( $this->files[ $filePath ] ) ) {
				// allready loaded
				return $this;
			}

			$fileData = @file_get_contents( $filePath );

			if ( is_string( $fileData ) ) {

				$parser = new runtime\String\Reader( $fileData, $filePath, $this );

				$this->files[ $filePath ] = true;

			} else {
				throw new runtime\Exception('File "' . $definitionFile . '" could not be read!' );
			}

			return $this;

		}

		/**
		 * Creates a new runtime from a list of ".types" files.
		 *
		 * @param $filesList   - a list of ".types" files to load
		 * @param $loadStdDefs - load standard definitions ( default = true )
		 * @return \browserfs\Runtime
		 * @throws \browserfs\runtime\Exception
		 */
		public static function create( $filesList, $loadStdDefs = true ) {

			$result = new self();

			if ( $loadStdDefs ) {
				$result->load( __DIR__ . '/../std/builtin.types' );
			}

			if ( is_array( $filesList ) ) {

				foreach ( $filesList as $fileName ) {

					if ( is_string( $fileName ) ) {
						$result->load( $fileName );
					} else {
						throw new \browserfs\runtime\Exception('Failed to load definitions from ' . json_encode( $fileName ) );
					}

				}

			}

			return $result;

		}

	}

?>


text:
function colorbarDataIndex = findColorbarData(obj,colorbarIndex)
%locate index of data associated with colorbar
colorbarDataIndex = find(arrayfun(@(x)eq(x.AssociatedAxis,obj.State.Colorbar(colorbarIndex).AssociatedAxis),obj.State.Plot),1);
%if no matching data index found
if isempty(colorbarDataIndex)
    colorbarDataIndex = max(min(colorbarIndex,obj.State.Figure.NumPlots),1);
end
end

redpajama_set_name: RedPajamaGithub


text:
//
//  MIPProgrammableIO.h
//  BobiMipTester
//
//  Created by Andy on 5/11/13.
//  Copyright (c) 2013 Andy. All rights reserved.
//

#import "BRBaseService.h"

/** KVO **/
// Context
#ifndef programmableIOKVOContext
#define programmableIOKVOContext "programmableIOService"
#endif

// KeyPath
FOUNDATION_EXPORT NSString *const programmableIO0StateKeyPathKVO;
FOUNDATION_EXPORT NSString *const programmableIO0ModeKeyPathKVO;
FOUNDATION_EXPORT NSString *const programmableIO1StateKeyPathKVO;
FOUNDATION_EXPORT NSString *const programmableIO1ModeKeyPathKVO;
FOUNDATION_EXPORT NSString *const programmableIO2StateKeyPathKVO;
FOUNDATION_EXPORT NSString *const programmableIO2ModeKeyPathKVO;
FOUNDATION_EXPORT NSString *const programmableIO3StateKeyPathKVO;
FOUNDATION_EXPORT NSString *const programmableIO3ModeKeyPathKVO;
FOUNDATION_EXPORT NSString *const programmableIO4StateKeyPathKVO;
FOUNDATION_EXPORT NSString *const programmableIO4ModeKeyPathKVO;
FOUNDATION_EXPORT NSString *const programmableIO5StateKeyPathKVO;
FOUNDATION_EXPORT NSString *const programmableIO5ModeKeyPathKVO;
FOUNDATION_EXPORT NSString *const programmableIO6StateKeyPathKVO;
FOUNDATION_EXPORT NSString *const programmableIO6ModeKeyPathKVO;
FOUNDATION_EXPORT NSString *const programmableIO7StateKeyPathKVO;
FOUNDATION_EXPORT NSString *const programmableIO7ModeKeyPathKVO;

typedef enum : uint8_t {
    kMipProgrammableIOPin0 = 0,
    kMipProgrammableIOPin1 = 1,
    kMipProgrammableIOPin2 = 2,
    kMipProgrammableIOPin3 = 3,
    kMipProgrammableIOPin4 = 4,
    kMipProgrammableIOPin5 = 5,
    kMipProgrammableIOPin6 = 6,
    kMipProgrammableIOPin7 = 7,
} kMipProgrammableIOPinValue;

typedef enum : uint8_t {
    kMipProgrammableIOState_Low = 0,
    kMipProgrammableIOState_High = 1,
} kMipProgrammableIOStateValue;

typedef enum : uint8_t {
    kMipProgrammableIOMode_Input = 0,
    kMipProgrammableIOMode_Output = 1,
} kMipProgrammableIOModeValue;

@interface BRProgrammableIOService : BRBaseService

@property (nonatomic, assign) kMipProgrammableIOStateValue io0state;
@property (nonatomic, assign) kMipProgrammableIOModeValue io0mode;
@property (nonatomic, assign) kMipProgrammableIOStateValue io1state;
@property (nonatomic, assign) kMipProgrammableIOModeValue io1mode;
@property (nonatomic, assign) kMipProgrammableIOStateValue io2state;
@property (nonatomic, assign) kMipProgrammableIOModeValue io2mode;
@property (nonatomic, assign) kMipProgrammableIOStateValue io3state;
@property (nonatomic, assign) kMipProgrammableIOModeValue io3mode;
@property (nonatomic, assign) kMipProgrammableIOStateValue io4state;
@property (nonatomic, assign) kMipProgrammableIOModeValue io4mode;
@property (nonatomic, assign) kMipProgrammableIOStateValue io5state;
@property (nonatomic, assign) kMipProgrammableIOModeValue io5mode;
@property (nonatomic, assign) kMipProgrammableIOStateValue io6state;
@property (nonatomic, assign) kMipProgrammableIOModeValue io6mode;
@property (nonatomic, assign) kMipProgrammableIOStateValue io7state;
@property (nonatomic, assign) kMipProgrammableIOModeValue io7mode;
@property (nonatomic, assign) bool isNotifying;

-(void) turnOff;
-(void) turnOn;
-(void) readAllPinStates;
-(void) setAllPinStates:(kMipProgrammableIOStateValue)io0 io1:(kMipProgrammableIOStateValue)io1 io2:(kMipProgrammableIOStateValue)io2 io3:(kMipProgrammableIOStateValue)io3 io4:(kMipProgrammableIOStateValue)io4 io5:(kMipProgrammableIOStateValue)io5 io6:(kMipProgrammableIOStateValue)io6 io7:(kMipProgrammableIOStateValue)io7;
-(void) readAllPinModes;
-(void) setAllPinModes:(kMipProgrammableIOModeValue)io0 io1:(kMipProgrammableIOModeValue)io1 io2:(kMipProgrammableIOModeValue)io2 io3:(kMipProgrammableIOModeValue)io3 io4:(kMipProgrammableIOModeValue)io4 io5:(kMipProgrammableIOModeValue)io5 io6:(kMipProgrammableIOModeValue)io6 io7:(kMipProgrammableIOModeValue)io7;

@end


text:
The \verb+createREPLSession+ (and associated REPL calls) are used to manage a "Read Evaluate Print Loop" for
the \Reflex scripting language. The idea is that this call returns a string handle that can be
associated with a user -- this handle stores the variable scope and any procedure declarations. As
users type in their \Reflex snippets in a UI the \verb+evaluateREPL+ call is used to update the context for this
session and to return some text which can be displayed on a terminal.


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:orientation="horizontal">

    <ImageView
        android:id="@+id/item_image"
        android:layout_width="70dp"
        android:layout_height="70dp"/>

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:orientation="vertical">

        <TextView
            android:id="@+id/item_title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textAppearance="@android:style/TextAppearance.Large"/>

        <TextView
            android:id="@+id/item_info"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ellipsize="end"
            android:maxLines="2"/>
    </LinearLayout>

</LinearLayout>


text:
using UnityEngine;
using System.Collections;
using System.Threading;
using UnityEngine.EventSystems;

public class TimeHolder : MonoBehaviour {

    public int fixedHour = 11;
    public bool useFixedTime = true;

    static long _displayedTimeTicks;

    DFTime realTime = new DFTime();
    private int lastTicks;
    private float lastSeconds;
    const float CanonFPS = 10;

    public static DFTime DisplayedTime
    {
        get
        {
            return new DFTime(_displayedTimeTicks);
        }
        set
        {
            Interlocked.Exchange(ref _displayedTimeTicks, value.Ticks);
        }
    }

    void Update()
    {
        if (Input.GetButtonDown("PauseTime") && EventSystem.current.currentSelectedGameObject == null)
        {
            if (useFixedTime == false)
                StopTime();
            else
                useFixedTime = false;
        }
        if (Input.GetButtonDown("TimeForward") && EventSystem.current.currentSelectedGameObject == null)
        {
            StopTime();
            fixedHour += 1;
        }
        if (Input.GetButtonDown("TimeReverse") && EventSystem.current.currentSelectedGameObject == null)
        {
            StopTime();
            fixedHour -= 1;
        }
        if (fixedHour >= 24)
            fixedHour -= 24;
        if (fixedHour < 0)
            fixedHour += 24;

        realTime = DFConnection.Instance.DFTime;

        if(DFConnection.Instance.DfPauseState)
        {
            //Time.timeScale = 0;
            lastSeconds = Time.realtimeSinceStartup;
            lastTicks = realTime.CurrentYearTicks;
        }
        if (realTime.CurrentYearTicks != lastTicks)
        {
            float currentSeconds = Time.realtimeSinceStartup;
            var tickDifference = realTime.CurrentYearTicks - lastTicks;
            var secondDifference = currentSeconds - lastSeconds;
            //Time.timeScale = Mathf.Clamp((tickDifference / secondDifference) / CanonFPS, 0, 100);
            lastSeconds = currentSeconds;
            lastTicks = realTime.CurrentYearTicks;
        }
        lastTicks = realTime.CurrentYearTicks;

        if (useFixedTime)
            DisplayedTime = new DFTime(realTime.Year, realTime.Month, realTime.Day, fixedHour, 0);
        else
            DisplayedTime = realTime;
    }

    void StopTime()
    {
        if (useFixedTime == true)
            return; //Nothingto do.
        if (realTime.Minute > 30)
            fixedHour = realTime.Hour + 1;
        else
            fixedHour = realTime.Hour;
        useFixedTime = true;
    }
}


text:
import ode

#enzyme initial condition setup

#reactant initial condition setup

#ode system setup, reactant and product concentrations input respectively

#individual ordinary differential equations' definition

def Glucose(t, y):
	production = Glucose_vmax
	degradation = Glucose_gamma * [Glucose]
	usage = ([Glucose] * [GlucoseGA3P] * GlucoseGA3P_rate) / ([Glucose] + GlucoseGA3P_km)

def GA3P(t, y):
	production = ([Glucose] * [GlucoseGA3P] * GlucoseGA3P_rate) / ([Glucose] + GlucoseGA3P_km)
	degradation = GA3P_gamma * [GA3P]
	usage = (([GA3P] * [GA3PDHAP] * GA3PDHAP_rate) / ([GA3P] + GA3PDHAP_km)) + (([GA3P] * [GA3PPyruvate] * GA3PPyruvate_rate) / ([GA3P] * GA3PPyruvate_km))

def DHAP(t, y):
	production = ([GA3P] * [GA3PDHAP] * GA3PDHAP_rate) / ([GA3P] + GA3PDHAP_km)
	degradation = [DHAP] * DHAP_gamma
	usage = ([DHAP] * [DHAPG3P] * DHAPG3P_rate) / ([DHAP] + DHAPG3P_km)

def G3P(t, y):
	production = ([DHAP] * [DHAPG3P] * DHAPG3P_rate) / ([DHAP] + DHAPG3P_km)
	degradation = [G3P] * G3P_gamma
	usage = ([G3P] * [G3PGlycerol] * G3PGlycerol_rate) / ([G3P] + G3PGlycerol_km)

def Glycerol(t, y):
	production = ([G3P] * [G3PGlycerol] * G3PGlycerol_rate) / ([G3P] + G3PGlycerol_km)
	degradation = [Glycerol] * Glycerol_gamma
	usage = 0

#-----

def Pyruvate(t, y):
	production = ([GA3P] * [GA3PPyruvate] * GA3PPyruvate_rate) / ([GA3P] * GA3PPyruvate_km)
	degradation = [Pyruvate] * Pyruvate_gamma
	usage = (([Pyruvate] * [PyruvateAlphaAcetolactate] * PyruvateAlphaAcetolactate_rate)/([Pyruvate] + PyruvateAlphaAcetolactate_km)) + (([Pyruvate] * [PyruvateAcetylaldehyde] * PyruvateAcetylaldehyde_rate)/([Pyruvate] + PyruvateAcetylaldehyde_km))

def AlphaAcetolactate(t, y):
	production = ([Pyruvate] * [PyruvateAlphaAcetolactate] * PyruvateAlphaAcetolactate_rate)/([Pyruvate] + PyruvateAlphaAcetolactate_km)
	degradation = [AlphaAcetolactate] * AlphaAcetolactate_gamma
	usage = ([AlphaAcetolactate] * [AlphaAcetolactateDiacetyl] * AlphaAcetolactateDiacetyl_rate)/([AlphaAcetolactate] + AlphaAcetolactateDiacetyl_km)

def Diacetyl(t, y):
	production = ([AlphaAcetolactate] * [AlphaAcetolactateDiacetyl] * AlphaAcetolactateDiacetyl_rate)/([AlphaAcetolactate] + AlphaAcetolactateDiacetyl_km)
	degradation = [Diacetyl] * Diacetyl_gamma
	usage = ([Diacetyl] * [DiacetylAcetoin] * DiacetylAcetoin_rate)/([Diacetyl] + DiacetylAcetoin_km)

def Acetoin(t, y):
	production = (([Diacetyl] * [DiacetylAcetoin] * DiacetylAcetoin_rate)/([Diacetyl] + DiacetylAcetoin_km)) + (([Acetylaldehyde] * [AcetylaldehydeAcetoin] * AcetylaldehydeAcetoin_rate)/([Acetylaldehyde] + AcetylaldehydeAcetoin_km))
	degradation = [Acetoin] * Acetoin_gamma
	usage = ([Acetoin] * [AcetoinBDO] * AcetoinBDO_rate)/([Acetoin] + AcetoinBDO_km)

def BDO(t, y):
	production = ([Acetoin] * [AcetoinBDO] * AcetoinBDO_rate)/([Acetoin] + AcetoinBDO_km)
	degradation = [BDO] * BDO_gamma
	usage = 0

def Acetylaldehyde(t, y):
	production = ([Pyruvate] * [PyruvateAcetylaldehyde] * PyruvateAcetylaldehyde_rate)/([Pyruvate] + PyruvateAcetylaldehyde_km)
	degradation = [Acetylaldehyde] * Acetylaldehyde_gamma
	usage = (([Acetylaldehyde] * [AcetylaldehydeAcetoin] * AcetylaldehydeAcetoin_rate)/([Acetylaldehyde] + AcetylaldehydeAcetoin_km)) + (([Acetylaldehyde] * [AcetylaldehydeAcetate] * AcetylaldehydeAcetate_rate)/([Acetylaldehyde] + AcetylaldehydeAcetate_km))

def Acetate(t, y):
	production = ([Acetylaldehyde] * [AcetylaldehydeAcetate] * AcetylaldehydeAcetate_rate)/([Acetylaldehyde] + AcetylaldehydeAcetate_km)
	degradation = [Acetate] * Acetate_gamma
	usage = ([Acetate] * [AcetateEthanol] * AcetateEthanol_rate)/([Acetate] + AcetateEthanol_km)

def Ethanol(t, y):
	production = ([Acetate] * [AcetateEthanol] * AcetateEthanol_rate)/([Acetate] + AcetateEthanol_km)
	degradation = [Ethanol] * Ethanol_gamma
	usage = 0

#-----enzymes------

def GlucoseGA3P(t, y):
	production = GlucoseGA3P_vmax
	degradation = GlucoseGA3P_gamma * [GlucoseGA3P]
	usage = 0

def GA3PDHAP(t, y):
	production = GA3PDHAP_vmax
	degradation = GA3PDHAP_gamma * [GA3PDHAP]
	usage = 0

def DHAPG3P(t, y):
	production = DHAPG3P_vmax
	degradation = DHAPG3P_gamma * [DHAPG3P]
	usage = 0

def G3PGlycerol(t, y):
	production = G3PGlycerol_vmax
	degradation = G3PGlycerol_gamma * [G3PGlycerol]
	usage = 0

def GA3PPyruvate(t, y):
	production = GA3PPyruvate_vmax
	degradation = GA3PPyruvate_gamma * [GA3PPyruvate]
	usage = 0

def PyruvateAlphaAcetolactate(t, y):
	production = PyruvateAlphaAcetolactate_vmax
	degradation = PyruvateAlphaAcetolactate_gamma * [PyruvateAlphaAcetolactate]
	usage = 0

def AlphaAcetolactateDiacetyl(t, y):
	production = AlphaAcetolactateDiacetyl_vmax
	degradation = AlphaAcetolactateDiacetyl_gamma * [AlphaAcetolactateDiacetyl]
	usage = 0

def DiacetylAcetoin(t, y):
	production = DiacetylAcetoin_vmax
	degradation = DiacetylAcetoin_gamma * [DiacetylAcetoin]
	usage = 0

def AcetoinBDO(t, y):
	production = AcetoinBDO_vmax
	degradation = AcetoinBDO_gamma * [AcetoinBDO]
	usage = 0

def PyruvateAcetylaldehyde(t, y):
	production = PyruvateAcetylaldehyde_vmax
	degradation = PyruvateAcetylaldehyde_gamma * [PyruvateAcetylaldehyde]
	usage = 0

def AcetylaldehydeAcetate(t, y):
	production = AcetylaldehydeAcetate_vmax
	degradation = AcetylaldehydeAcetate_gamma * [AcetylaldehydeAcetate]
	usage = 0

def AcetateEthanol(t, y):
	production = AcetateEthanol_vmax
	degradation = AcetateEthanol_gamma * [AcetateEthanol]
	usage = 0

#circuit ODE definitions

circuitODE = range(26)
circuitODE[0] =
circuitODE[1] =


text:
/**
 * @module test/fixtures/mock-channel
 */
'use strict';

var EventEmitter = require('events').EventEmitter;
var inherits = require('util').inherits;
var sinon = require('sinon');
var noop = require('101/noop');

function FakeChannel () {
  EventEmitter.call(this);
}
inherits(FakeChannel, EventEmitter);

FakeChannel.prototype.ack = noop;
FakeChannel.prototype.assertQueue = noop;
FakeChannel.prototype.consume = noop;
FakeChannel.prototype.sendToQueue = noop;
FakeChannel.prototype.cancel = noop;
FakeChannel.prototype.prefetch = noop;

/**
 * @param {Array} callbacks
 * @return {Object}
 */
module.exports = function () {
  var fakeChannel = new FakeChannel();
  sinon.stub(fakeChannel, 'assertQueue', function (queueName, opts, cb) {
    cb();
  });
  sinon.stub(fakeChannel, 'sendToQueue', function (queueName, data) {});
  sinon.stub(fakeChannel, 'consume', function (queueName, callback) {
    //callback();
  });
  sinon.stub(fakeChannel, 'cancel', function (consumerTag, callback) {
    callback();
  });
  sinon.stub(fakeChannel, 'prefetch').returns();
  return fakeChannel;
};


text:
package main

import (
	"io/ioutil"

	"github.com/pkg/errors"
	"gopkg.in/yaml.v2"
)

// Config holds global configuration, defaults are provided in main.
// Agent config is populated from startup flag.
type Config struct {
	Environment     string `m:"Environment"`
	LogLevel        string `m:"LogLevel"`
	Port            int    `m:"Port"`
	Nats            string `m:"Nats"`
	CollectorConfig string `m:"CollectorConfig"`
}

type CollectorConfig struct {
	Docker  ApiCollectorConfig     `json:"docker" yaml:"docker"`
	Consul  ApiCollectorConfig     `json:"consul" yaml:"consul"`
	VSphere ApiCollectorConfig     `json:"vsphere" yaml:"vsphere"`
	Cluster ClusterCollectorConfig `json:"cluster" yaml:"cluster"`
}

type ApiCollectorConfig struct {
	Endpoints []string `json:"endpoints" yaml:"endpoints"`
	Include   []string `json:"include" yaml:"include"`
	Exclude   []string `json:"exclude" yaml:"exclude"`
	Cron      string   `json:"cron" yaml:"cron"`
}

type ClusterCollectorConfig struct {
	Cron     string                   `json:"cron" yaml:"cron"`
	Services []ClusteredServiceConfig `json:"services" yaml:"services"`
}

type ClusteredServiceConfig struct {
	Name      string   `json:"name" yaml:"name"`
	Endpoints []string `json:"endpoints" yaml:"endpoints"`
}

func LoadCollectorConfig(path string) (*CollectorConfig, error) {
	cfg := &CollectorConfig{}

	if len(path) < 1 {
		return nil, errors.Errorf("Collector config %v not found", path)
	}

	data, err := ioutil.ReadFile(path)
	if err != nil {
		return nil, errors.Wrapf(err, "Reading %v failed", path)
	}

	if err := yaml.Unmarshal(data, cfg); err != nil {
		return nil, errors.Wrapf(err, "Parsing %v failed", path)
	}

	return cfg, nil
}


text:
<!DOCTYPE html>

        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <title>会议管理</title>

        <base href="/">

        <link rel="shortcut icon" href="favicon.ico">

        <link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
        <link href="css/bootstrap-theme.min.css" rel="stylesheet" media="screen">

        <link href="css/bootstrap-datetimepicker.min.css" rel="stylesheet" media="screen">
        <link href="css/selectize.bootstrap3.css" rel="stylesheet" media="screen">

        <link href="css/index.css" rel="stylesheet" media="screen">

                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                        Toggle navigation

                    </button>
                    会议管理

首页

会议列表

Contact


text:
import React, {Component} from 'react';
import Conditional from './Conditional';

export default class Conditionals extends Component {
    constructor() {
        super();
        this.state = {conditionals: [
            {
                and: [
                    {
                        deviceId: "foo",
                        state: "enabled"
                    }
                ],
                then: [
                    {
                        ruleId: "fooo",
                        enabled: true
                    }
                ]
            }
        ]};
    }

    render() {

        var conds = this.state.conditionals.map(function (condition) {
            return <Conditional condition={condition}/>;
        });

        return (

                    {conds}

Conditionals

Add conditionals to control when a rule becomes active/inactive.

        );
    }
}


text:
import assert from 'assert'
import GherkinLine from '../src/GherkinLine'

describe('GherkinLine', () => {
  describe('#getTableCells', () => {
    function getCellsText(line: string) {
      const gl = new GherkinLine(line, 1)

      return gl.getTableCells().map((span) => span.text)
    }

    it('trims white spaces before cell content', () => {
      assert.deepStrictEqual(getCellsText('|   \t spaces before|'), ['spaces before'])
    })

    it('trims white spaces after cell content', () => {
      assert.deepStrictEqual(getCellsText('|spaces after   |'), ['spaces after'])
    })

    it('trims white spaces around cell content', () => {
      assert.deepStrictEqual(getCellsText('|   \t spaces everywhere   \t|'), ['spaces everywhere'])
    })

    it('does not delete white spaces inside a cell', () => {
      assert.deepStrictEqual(getCellsText('| foo()\n  bar\nbaz |'), ['foo()\n  bar\nbaz'])
    })
  })

  describe('#match', () => {
    it('provides capture groups', () => {
      const gl = new GherkinLine('#### Scenario: hello', 1)
      const match = gl.match(/(##?#?#?) (Scenario):(.*)/)
      assert.strictEqual(match[1], '####')
      assert.strictEqual(match[2], 'Scenario')
      assert.strictEqual(match[3], ' hello')
    })
  })
})


text:
package nl.stokpop.lograter.store;

import nl.stokpop.lograter.LogRaterException;
import nl.stokpop.lograter.counter.CounterKey;
import nl.stokpop.lograter.counter.CounterStorageType;
import nl.stokpop.lograter.util.DatabaseBootstrap;
import nl.stokpop.lograter.util.time.TimePeriod;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.sql.Connection;

public class RequestCounterStoreFactory {

	public static final int DEFAULT_MAX_UNIQUE_REQUESTS = 512;
	private static final Logger log = LoggerFactory.getLogger(RequestCounterStoreFactory.class);

    private final CounterStorageType type;
	private Connection con;
	private final File storageRootDir;

	private final TimePeriod timePeriod;

	public RequestCounterStoreFactory(CounterStorageType type, TimePeriod timePeriod, File storageRootDir) {
        log.info(
                "Create RequestCounterStoreFactory with storage type [{}] for time period [{}] and with storage dir [{}]."
                , type, timePeriod, storageRootDir);

        this.type = type;
        this.timePeriod = timePeriod;
        if (type == CounterStorageType.Database) {
            con = DatabaseBootstrap.instance().getDatabaseConnection();
        }
        if (storageRootDir == null) {
            storageRootDir = new File(".");
        }
        this.storageRootDir = storageRootDir;
    }

	public RequestCounterStoreFactory(CounterStorageType type, TimePeriod timePeriod) {
	    this(type, timePeriod, null);
	}

	public RequestCounterStoreFactory(CounterStorageType type) {
		this(type, TimePeriod.MAX_TIME_PERIOD);
	}

	public RequestCounterStoreFactory(CounterStorageType type, File storageRootDir) {
        this(type, TimePeriod.MAX_TIME_PERIOD, storageRootDir);
    }

    public RequestCounterStore newInstance(String storeName, CounterKey totalRequestsKey) {
		return newInstance(storeName, totalRequestsKey, DEFAULT_MAX_UNIQUE_REQUESTS);
	}

	public RequestCounterStore newInstance(String storeName, CounterKey totalRequestsKey, int maxUniqueCounters) {
	    RequestCounterStore store;
	    switch (type) {
			case Memory:
				store = new RequestCounterStoreHashMap(storeName, totalRequestsKey, timePeriod);
				break;
			case Database:
				store = new RequestCounterStoreSqLite(storeName, totalRequestsKey.getName(), con, timePeriod);
				break;
			case ExternalSort:
			    if (storageRootDir == null) {
			        throw new LogRaterException("Unable to create an external sort request counter without supplying a storage dir.");
                }
				store = new RequestCounterStoreExternalSort(storageRootDir, storeName, totalRequestsKey, timePeriod);
			    break;
			default:
				log.warn("No valid measurement store option found: {}, using in memory store.", type);
				store = new RequestCounterStoreHashMap(storeName, totalRequestsKey, timePeriod);
		}
		// always limit the max number of requests to avoid memory issues and slow behaviour
		return new RequestCounterStoreMaxCounters(store, maxUniqueCounters);
	}

	public RequestCounterStore newInstance(String storeName, int maxUniqueCounters) {
		return newInstance(storeName, CounterKey.of(storeName + "-total"), maxUniqueCounters);
	}

	public RequestCounterStore newInstance(String storeName) {
		return newInstance(storeName, CounterKey.of(storeName + "-total"), DEFAULT_MAX_UNIQUE_REQUESTS);
	}

}


text:
<?php

class Form_Decorator_View extends Form_Decorator_Abstract
{
	protected $view;

	public function setView($view)
	{
		$this->view = $view;
		return $this;
	}

	public function getView()
	{
		return $this->view;
	}

	public function display($content)
	{
		$view = new View($this->getView());
		$view->assign($this->getAttributes());

		return $view->display(false);
	}
}
?>


text:
/*
 * crypto_kernel.c
 *
 * header for the cryptographic kernel
 *
 * David A. McGrew
 * Cisco Systems, Inc.
 */
/*
 *
 * Copyright(c) 2001-2017 Cisco Systems, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *   Redistributions of source code must retain the above copyright
 *   notice, this list of conditions and the following disclaimer.
 *
 *   Redistributions in binary form must reproduce the above
 *   copyright notice, this list of conditions and the following
 *   disclaimer in the documentation and/or other materials provided
 *   with the distribution.
 *
 *   Neither the name of the Cisco Systems, Inc. nor the names of its
 *   contributors may be used to endorse or promote products derived
 *   from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include "alloc.h"

#include "crypto_kernel.h"
#include "cipher_types.h"

/* the debug module for the crypto_kernel */

srtp_debug_module_t srtp_mod_crypto_kernel = {
    0,              /* debugging is off by default */
    "crypto kernel" /* printable name for module   */
};

/* crypto_kernel is a global variable, the only one of its datatype */

srtp_crypto_kernel_t crypto_kernel = {
    srtp_crypto_kernel_state_insecure, /* start off in insecure state */
    NULL,                              /* no cipher types yet         */
    NULL,                              /* no auth types yet           */
    NULL                               /* no debug modules yet        */
};

#define MAX_RNG_TRIALS 25

srtp_err_status_t srtp_crypto_kernel_init()
{
    srtp_err_status_t status;

    /* check the security state */
    if (crypto_kernel.state == srtp_crypto_kernel_state_secure) {
        /*
         * we're already in the secure state, but we've been asked to
         * re-initialize, so we just re-run the self-tests and then return
         */
        return srtp_crypto_kernel_status();
    }

    /* initialize error reporting system */
    status = srtp_err_reporting_init();
    if (status) {
        return status;
    }

    /* load debug modules */
    status = srtp_crypto_kernel_load_debug_module(&srtp_mod_crypto_kernel);
    if (status) {
        return status;
    }
    status = srtp_crypto_kernel_load_debug_module(&srtp_mod_auth);
    if (status) {
        return status;
    }
    status = srtp_crypto_kernel_load_debug_module(&srtp_mod_cipher);
    if (status) {
        return status;
    }
    status = srtp_crypto_kernel_load_debug_module(&srtp_mod_stat);
    if (status) {
        return status;
    }
    status = srtp_crypto_kernel_load_debug_module(&srtp_mod_alloc);
    if (status) {
        return status;
    }

    /* load cipher types */
    status = srtp_crypto_kernel_load_cipher_type(&srtp_null_cipher,
                                                 SRTP_NULL_CIPHER);
    if (status) {
        return status;
    }
    status = srtp_crypto_kernel_load_cipher_type(&srtp_aes_icm_128,
                                                 SRTP_AES_ICM_128);
    if (status) {
        return status;
    }
    status = srtp_crypto_kernel_load_cipher_type(&srtp_aes_icm_256,
                                                 SRTP_AES_ICM_256);
    if (status) {
        return status;
    }
    status = srtp_crypto_kernel_load_debug_module(&srtp_mod_aes_icm);
    if (status) {
        return status;
    }
#ifdef GCM
    status = srtp_crypto_kernel_load_cipher_type(&srtp_aes_icm_192,
                                                 SRTP_AES_ICM_192);
    if (status) {
        return status;
    }
    status = srtp_crypto_kernel_load_cipher_type(&srtp_aes_gcm_128,
                                                 SRTP_AES_GCM_128);
    if (status) {
        return status;
    }
    status = srtp_crypto_kernel_load_cipher_type(&srtp_aes_gcm_256,
                                                 SRTP_AES_GCM_256);
    if (status) {
        return status;
    }
    status = srtp_crypto_kernel_load_debug_module(&srtp_mod_aes_gcm);
    if (status) {
        return status;
    }
#endif

    /* load auth func types */
    status = srtp_crypto_kernel_load_auth_type(&srtp_null_auth, SRTP_NULL_AUTH);
    if (status) {
        return status;
    }
    status = srtp_crypto_kernel_load_auth_type(&srtp_hmac, SRTP_HMAC_SHA1);
    if (status) {
        return status;
    }
    status = srtp_crypto_kernel_load_debug_module(&srtp_mod_hmac);
    if (status) {
        return status;
    }

    /* change state to secure */
    crypto_kernel.state = srtp_crypto_kernel_state_secure;

    return srtp_err_status_ok;
}

srtp_err_status_t srtp_crypto_kernel_status()
{
    srtp_err_status_t status;
    srtp_kernel_cipher_type_t *ctype = crypto_kernel.cipher_type_list;
    srtp_kernel_auth_type_t *atype = crypto_kernel.auth_type_list;

    /* for each cipher type, describe and test */
    while (ctype != NULL) {
        srtp_err_report(srtp_err_level_info, "cipher: %s\n",
                        ctype->cipher_type->description);
        srtp_err_report(srtp_err_level_info, "  self-test: ");
        status = srtp_cipher_type_self_test(ctype->cipher_type);
        if (status) {
            srtp_err_report(srtp_err_level_error, "failed with error code %d\n",
                            status);
            exit(status);
        }
        srtp_err_report(srtp_err_level_info, "passed\n");
        ctype = ctype->next;
    }

    /* for each auth type, describe and test */
    while (atype != NULL) {
        srtp_err_report(srtp_err_level_info, "auth func: %s\n",
                        atype->auth_type->description);
        srtp_err_report(srtp_err_level_info, "  self-test: ");
        status = srtp_auth_type_self_test(atype->auth_type);
        if (status) {
            srtp_err_report(srtp_err_level_error, "failed with error code %d\n",
                            status);
            exit(status);
        }
        srtp_err_report(srtp_err_level_info, "passed\n");
        atype = atype->next;
    }

    srtp_crypto_kernel_list_debug_modules();

    return srtp_err_status_ok;
}

srtp_err_status_t srtp_crypto_kernel_list_debug_modules()
{
    srtp_kernel_debug_module_t *dm = crypto_kernel.debug_module_list;

    /* describe each debug module */
    srtp_err_report(srtp_err_level_info, "debug modules loaded:\n");
    while (dm != NULL) {
        srtp_err_report(srtp_err_level_info, "  %s ", dm->mod->name);
        if (dm->mod->on) {
            srtp_err_report(srtp_err_level_info, "(on)\n");
        } else {
            srtp_err_report(srtp_err_level_info, "(off)\n");
        }
        dm = dm->next;
    }

    return srtp_err_status_ok;
}

srtp_err_status_t srtp_crypto_kernel_shutdown()
{
    /*
     * free dynamic memory used in crypto_kernel at present
     */

    /* walk down cipher type list, freeing memory */
    while (crypto_kernel.cipher_type_list != NULL) {
        srtp_kernel_cipher_type_t *ctype = crypto_kernel.cipher_type_list;
        crypto_kernel.cipher_type_list = ctype->next;
        debug_print(srtp_mod_crypto_kernel, "freeing memory for cipher %s",
                    ctype->cipher_type->description);
        srtp_crypto_free(ctype);
    }

    /* walk down authetication module list, freeing memory */
    while (crypto_kernel.auth_type_list != NULL) {
        srtp_kernel_auth_type_t *atype = crypto_kernel.auth_type_list;
        crypto_kernel.auth_type_list = atype->next;
        debug_print(srtp_mod_crypto_kernel,
                    "freeing memory for authentication %s",
                    atype->auth_type->description);
        srtp_crypto_free(atype);
    }

    /* walk down debug module list, freeing memory */
    while (crypto_kernel.debug_module_list != NULL) {
        srtp_kernel_debug_module_t *kdm = crypto_kernel.debug_module_list;
        crypto_kernel.debug_module_list = kdm->next;
        debug_print(srtp_mod_crypto_kernel,
                    "freeing memory for debug module %s", kdm->mod->name);
        srtp_crypto_free(kdm);
    }

    /* return to insecure state */
    crypto_kernel.state = srtp_crypto_kernel_state_insecure;

    return srtp_err_status_ok;
}

static inline srtp_err_status_t srtp_crypto_kernel_do_load_cipher_type(
    const srtp_cipher_type_t *new_ct,
    srtp_cipher_type_id_t id,
    int replace)
{
    srtp_kernel_cipher_type_t *ctype, *new_ctype;
    srtp_err_status_t status;

    /* defensive coding */
    if (new_ct == NULL) {
        return srtp_err_status_bad_param;
    }

    if (new_ct->id != id) {
        return srtp_err_status_bad_param;
    }

    /* check cipher type by running self-test */
    status = srtp_cipher_type_self_test(new_ct);
    if (status) {
        return status;
    }

    /* walk down list, checking if this type is in the list already  */
    ctype = crypto_kernel.cipher_type_list;
    while (ctype != NULL) {
        if (id == ctype->id) {
            if (!replace) {
                return srtp_err_status_bad_param;
            }
            status =
                srtp_cipher_type_test(new_ct, ctype->cipher_type->test_data);
            if (status) {
                return status;
            }
            new_ctype = ctype;
            break;
        } else if (new_ct == ctype->cipher_type) {
            return srtp_err_status_bad_param;
        }
        ctype = ctype->next;
    }

    /* if not found, put new_ct at the head of the list */
    if (ctype == NULL) {
        /* allocate memory */
        new_ctype = (srtp_kernel_cipher_type_t *)srtp_crypto_alloc(
            sizeof(srtp_kernel_cipher_type_t));
        if (new_ctype == NULL) {
            return srtp_err_status_alloc_fail;
        }
        new_ctype->next = crypto_kernel.cipher_type_list;

        /* set head of list to new cipher type */
        crypto_kernel.cipher_type_list = new_ctype;
    }

    /* set fields */
    new_ctype->cipher_type = new_ct;
    new_ctype->id = id;

    return srtp_err_status_ok;
}

srtp_err_status_t srtp_crypto_kernel_load_cipher_type(
    const srtp_cipher_type_t *new_ct,
    srtp_cipher_type_id_t id)
{
    return srtp_crypto_kernel_do_load_cipher_type(new_ct, id, 0);
}

srtp_err_status_t srtp_replace_cipher_type(const srtp_cipher_type_t *new_ct,
                                           srtp_cipher_type_id_t id)
{
    return srtp_crypto_kernel_do_load_cipher_type(new_ct, id, 1);
}

srtp_err_status_t srtp_crypto_kernel_do_load_auth_type(
    const srtp_auth_type_t *new_at,
    srtp_auth_type_id_t id,
    int replace)
{
    srtp_kernel_auth_type_t *atype, *new_atype;
    srtp_err_status_t status;

    /* defensive coding */
    if (new_at == NULL) {
        return srtp_err_status_bad_param;
    }

    if (new_at->id != id) {
        return srtp_err_status_bad_param;
    }

    /* check auth type by running self-test */
    status = srtp_auth_type_self_test(new_at);
    if (status) {
        return status;
    }

    /* walk down list, checking if this type is in the list already  */
    atype = crypto_kernel.auth_type_list;
    while (atype != NULL) {
        if (id == atype->id) {
            if (!replace) {
                return srtp_err_status_bad_param;
            }
            status = srtp_auth_type_test(new_at, atype->auth_type->test_data);
            if (status) {
                return status;
            }
            new_atype = atype;
            break;
        } else if (new_at == atype->auth_type) {
            return srtp_err_status_bad_param;
        }
        atype = atype->next;
    }

    /* if not found, put new_at at the head of the list */
    if (atype == NULL) {
        /* allocate memory */
        new_atype = (srtp_kernel_auth_type_t *)srtp_crypto_alloc(
            sizeof(srtp_kernel_auth_type_t));
        if (new_atype == NULL) {
            return srtp_err_status_alloc_fail;
        }

        new_atype->next = crypto_kernel.auth_type_list;
        /* set head of list to new auth type */
        crypto_kernel.auth_type_list = new_atype;
    }

    /* set fields */
    new_atype->auth_type = new_at;
    new_atype->id = id;

    return srtp_err_status_ok;
}

srtp_err_status_t srtp_crypto_kernel_load_auth_type(
    const srtp_auth_type_t *new_at,
    srtp_auth_type_id_t id)
{
    return srtp_crypto_kernel_do_load_auth_type(new_at, id, 0);
}

srtp_err_status_t srtp_replace_auth_type(const srtp_auth_type_t *new_at,
                                         srtp_auth_type_id_t id)
{
    return srtp_crypto_kernel_do_load_auth_type(new_at, id, 1);
}

const srtp_cipher_type_t *srtp_crypto_kernel_get_cipher_type(
    srtp_cipher_type_id_t id)
{
    srtp_kernel_cipher_type_t *ctype;

    /* walk down list, looking for id  */
    ctype = crypto_kernel.cipher_type_list;
    while (ctype != NULL) {
        if (id == ctype->id) {
            return ctype->cipher_type;
        }
        ctype = ctype->next;
    }

    /* haven't found the right one, indicate failure by returning NULL */
    return NULL;
}

srtp_err_status_t srtp_crypto_kernel_alloc_cipher(srtp_cipher_type_id_t id,
                                                  srtp_cipher_pointer_t *cp,
                                                  int key_len,
                                                  int tag_len)
{
    const srtp_cipher_type_t *ct;

    /*
     * if the crypto_kernel is not yet initialized, we refuse to allocate
     * any ciphers - this is a bit extra-paranoid
     */
    if (crypto_kernel.state != srtp_crypto_kernel_state_secure) {
        return srtp_err_status_init_fail;
    }

    ct = srtp_crypto_kernel_get_cipher_type(id);
    if (!ct) {
        return srtp_err_status_fail;
    }

    return ((ct)->alloc(cp, key_len, tag_len));
}

const srtp_auth_type_t *srtp_crypto_kernel_get_auth_type(srtp_auth_type_id_t id)
{
    srtp_kernel_auth_type_t *atype;

    /* walk down list, looking for id  */
    atype = crypto_kernel.auth_type_list;
    while (atype != NULL) {
        if (id == atype->id) {
            return atype->auth_type;
        }
        atype = atype->next;
    }

    /* haven't found the right one, indicate failure by returning NULL */
    return NULL;
}

srtp_err_status_t srtp_crypto_kernel_alloc_auth(srtp_auth_type_id_t id,
                                                srtp_auth_pointer_t *ap,
                                                int key_len,
                                                int tag_len)
{
    const srtp_auth_type_t *at;

    /*
     * if the crypto_kernel is not yet initialized, we refuse to allocate
     * any auth functions - this is a bit extra-paranoid
     */
    if (crypto_kernel.state != srtp_crypto_kernel_state_secure) {
        return srtp_err_status_init_fail;
    }

    at = srtp_crypto_kernel_get_auth_type(id);
    if (!at) {
        return srtp_err_status_fail;
    }

    return ((at)->alloc(ap, key_len, tag_len));
}

srtp_err_status_t srtp_crypto_kernel_load_debug_module(
    srtp_debug_module_t *new_dm)
{
    srtp_kernel_debug_module_t *kdm, *new;

    /* defensive coding */
    if (new_dm == NULL || new_dm->name == NULL) {
        return srtp_err_status_bad_param;
    }

    /* walk down list, checking if this type is in the list already  */
    kdm = crypto_kernel.debug_module_list;
    while (kdm != NULL) {
        if (strncmp(new_dm->name, kdm->mod->name, 64) == 0) {
            return srtp_err_status_bad_param;
        }
        kdm = kdm->next;
    }

    /* put new_dm at the head of the list */
    /* allocate memory */
    new = (srtp_kernel_debug_module_t *)srtp_crypto_alloc(
        sizeof(srtp_kernel_debug_module_t));
    if (new == NULL) {
        return srtp_err_status_alloc_fail;
    }

    /* set fields */
    new->mod = new_dm;
    new->next = crypto_kernel.debug_module_list;

    /* set head of list to new cipher type */
    crypto_kernel.debug_module_list = new;

    return srtp_err_status_ok;
}

srtp_err_status_t srtp_crypto_kernel_set_debug_module(const char *name, int on)
{
    srtp_kernel_debug_module_t *kdm;

    /* walk down list, checking if this type is in the list already  */
    kdm = crypto_kernel.debug_module_list;
    while (kdm != NULL) {
        if (strncmp(name, kdm->mod->name, 64) == 0) {
            kdm->mod->on = on;
            return srtp_err_status_ok;
        }
        kdm = kdm->next;
    }

    return srtp_err_status_fail;
}


text:
uses es6, and `6to5` for transpiling to js.

dev version depends on peg js and `6to5`


text:
package org.apache.phoenix.index;

import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.Set;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.DoNotRetryIOException;
import org.apache.hadoop.hbase.Stoppable;
import org.apache.hadoop.hbase.client.HTableInterface;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;

import com.google.common.collect.Multimap;
import org.apache.hadoop.hbase.index.table.HTableInterfaceReference;
import org.apache.hadoop.hbase.index.write.KillServerOnFailurePolicy;
import org.apache.phoenix.coprocessor.MetaDataProtocol;
import org.apache.phoenix.coprocessor.MetaDataProtocol.MetaDataMutationResult;
import org.apache.phoenix.coprocessor.MetaDataProtocol.MutationCode;
import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
import org.apache.phoenix.schema.PIndexState;
import org.apache.phoenix.util.SchemaUtil;

/**
 *
 * Handler called in the event that index updates cannot be written to their
 * region server. First attempts to disable the index and failing that falls
 * back to the default behavior of killing the region server.
 *
 * TODO: use delegate pattern instead
 *
 *
 * @since 2.1
 */
public class PhoenixIndexFailurePolicy extends  KillServerOnFailurePolicy {
    private static final Log LOG = LogFactory.getLog(PhoenixIndexFailurePolicy.class);
    private RegionCoprocessorEnvironment env;

    public PhoenixIndexFailurePolicy() {
    }

    @Override
    public void setup(Stoppable parent, RegionCoprocessorEnvironment env) {
      super.setup(parent, env);
      this.env = env;
    }

    @Override
    public void handleFailure(Multimap<HTableInterfaceReference, Mutation> attempted, Exception cause) throws IOException {
        Set<HTableInterfaceReference> refs = attempted.asMap().keySet();
        StringBuilder buf = new StringBuilder("Disabled index" + (refs.size() > 1 ? "es " : " "));
        try {
            for (HTableInterfaceReference ref : refs) {
                // Disable the index by using the updateIndexState method of MetaDataProtocol end point coprocessor.
                String indexTableName = ref.getTableName();
                byte[] indexTableKey = SchemaUtil.getTableKeyFromFullName(indexTableName);
                HTableInterface systemTable = env.getTable(PhoenixDatabaseMetaData.TYPE_TABLE_NAME_BYTES);
                MetaDataProtocol mdProxy = systemTable.coprocessorProxy(MetaDataProtocol.class, indexTableKey);
                // Mimic the Put that gets generated by the client on an update of the index state
                Put put = new Put(indexTableKey);
                put.add(PhoenixDatabaseMetaData.TABLE_FAMILY_BYTES, PhoenixDatabaseMetaData.INDEX_STATE_BYTES, PIndexState.DISABLE.getSerializedBytes());
                List<Mutation> tableMetadata = Collections.<Mutation>singletonList(put);
                MetaDataMutationResult result = mdProxy.updateIndexState(tableMetadata);
                if (result.getMutationCode() != MutationCode.TABLE_ALREADY_EXISTS) {
                    LOG.warn("Attempt to disable index " + indexTableName + " failed with code = " + result.getMutationCode() + ". Will use default failure policy instead.");
                    super.handleFailure(attempted, cause);
                }
                LOG.info("Successfully disabled index " + indexTableName);
                buf.append(indexTableName);
                buf.append(',');
            }
            buf.setLength(buf.length()-1);
            buf.append(" due to an exception while writing updates");
        } catch (Throwable t) {
            super.handleFailure(attempted, cause);
        }
        throw new DoNotRetryIOException(buf.toString(), cause);
    }

}


text:
import math
import sys
import copy

# ----------------
# Global variables
# ----------------

verbose = False

# -------
# Functions
# -------

def get_verbose():
    global verbose
    if 'verbose' not in globals():
        return False
    else:
        return verbose

def set_verbose(value):
    """
    Set the level of verbosity for all the operations executed in Worldengine
    """
    global verbose
    verbose = value

def print_verbose(msg):
    if get_verbose():
        print(msg)

class Counter(object):

    def __init__(self):
        self.c = {}

    def count(self, what):
        if what not in self.c:
            self.c[what] = 0
        self.c[what] += 1

    def to_str(self):
        str = ""
        keys = self.c.keys()
        keys.sort()
        for w in keys:
            str += "%s : %i" % (w, self.c[w])
            str += "\n"
        return str

    def print_self(self):
        # print without the new line
        sys.stdout.write(self.to_str)

def matrix_min_and_max(matrix):
    _min = None
    _max = None
    for row in matrix:
        for el in row:
            val = el
            if _min is None or val < _min:
                _min = val
            if _max is None or val > _max:
                _max = val
    return _min, _max

def rescale_value(original, prev_min, prev_max, min, max):
    """Rescale a given value.
    Given the value, the current min and max and the new min and max
    produce the rescaled value
    """
    f = float(original - prev_min) / (prev_max - prev_min)
    return min + ((max - min) * f)

def antialias(elevation, steps):
    """
    Execute the antialias operation steps times on the given elevation map
    """
    width = len(elevation[0])
    height = len(elevation)

    def _antialias_step(original):
        antialiased = copy.deepcopy(original)
        for y in range(height):
            for x in range(width):
                antialiased[y][x] = antialias_point(original, x, y)
        return antialiased

    def antialias_point(original, x, y):
        n = 2
        tot = elevation[y][x] * 2
        for dy in range(-1, +2):
            py = (y + dy) % height
            for dx in range(-1, +2):
                px = (x + dx) % width
                n += 1
                tot += original[py][px]
        return tot / n

    current = elevation
    for i in range(steps):
        current = _antialias_step(current)
    return current

def array_to_matrix(array, width, height):
    if len(array) != (width * height):
        raise Exception("Array as not expected length")
    matrix = []
    for y in xrange(height):
        matrix.append([])
        for x in xrange(width):
            matrix[y].append(array[y * width + x])
    return matrix


text:
<?php
/**
 * The template for displaying all single posts and attachments
 *
 * @package WordPress
 * @subpackage FoundationPress
 * @since FoundationPress 1.0.0
 */
if ( in_category( 'Leading the Digital Leap' )) { // can be removed with 4.4 update -- thank you ahead of public release documentation.
	include('single-post-leading-the-digital-leap.php');
} else {
get_header();
 ?>

				<?php
				//if( is_singular( array('ercs','whitepapers','webinars','special-reports') )) {

				get_template_part('parts/flags');

				?>

	<?php do_action( 'foundationpress_before_content' ); ?>

	<?php while ( have_posts() ) : the_post();

	setPostViews(get_the_ID()); ?>

<?php  $astused = get_post_meta($id, '_wp_esmad_template', true);
$oldtemplate = get_post_meta($id, '_wp_post_template', true);

   ?>
<?php
if(!$oldtemplate == 'default' and strlen($oldtemplate > 4)){ echo ''; //using old template

//require_once( 'library/boxes.php' );
include('single-coa.php');

	   } else { ?>

		<article <?php post_class() ?> id="post-<?php the_ID(); ?>">

<?php the_title(); ?>

			<?php if( get_field('remove_author')) {

				echo '';

			} else { ?>

					<?php  if( get_field('Alt Author Read More Name')) {

						echo 'By ';

						the_field('Alt Author Read More Name');

					}elseif(get_field('Byline')){

						the_field('Byline');

					} else {
						echo 'By ';

						the_author();

					} ?>

			<?php } ?>

<?php the_time('F jS, Y') ?>

			<?php get_template_part('parts/social'); ?>

			<?php do_action( 'foundationpress_post_before_entry_content' ); ?>

				<?php if(get_field('subheader')){
					echo '
';
					the_field('subheader');
					echo '
';
			} ?>

			<?php

			//$post_id < '161335' <--- Vince's Code

			$post_date = strtotime( the_date( 'Y-m-d', '', '', false ) );
			$cutoff_date = strtotime( '2015-12-10' );

			if( get_field('remove_featured_image') || $post_date < $cutoff_date ) {

    			echo '';

			 } elseif ( has_post_thumbnail()) {

    				echo '
';
    				echo '
';
    				the_post_thumbnail('large-landscape');
    				echo '

';
    		} else {

    		} ?>

    		<?php

			if (esm_is_user_logged_in()){
				echo '';
				$showpagecontent = 1;
			} else {
				echo '';
				$reg_requirement=get_post_meta($post->ID, 'registration_requirement_for_content', $single = true); /*	0 : Default,  1 : Required,  2 : Not Required */
				echo '';

				$astcset = $_GET['astc'];
				echo '';
				if(filter_var($astcset, FILTER_VALIDATE_INT)){
					if($astcset > 1){ $astpagecontent = 0; }
				}

				echo '';

				if($reg_requirement == 1){
					$showpagecontent = 0;
				} else if($astpagecontent === 0){
					$showpagecontent = 0;
				} else  {
					$showpagecontent = 1;
				}
			}

				if($showpagecontent == 0){
				echo string_limit_words(get_the_excerpt(), 55).'...
';
			?>

<form action="<?php echo get_option('home'); ?>/wp-login.php?wpe-login=esminc" method="post">

Free registration required to view this resource.

<a href="<?php echo get_option('home'); ?>/registration/?action=register&redirect_to=<?php echo urlencode(get_permalink()); ?><?php if ( defined($_GET['astc'])){ echo '&astc='.$_GET['astc']; }?><?php if ( defined($_GET['ast'])){ echo '&ast='.$_GET['ast']; }?>" style="text-decoration:underline;">Register now.

Already a member? Log in

Username: <input type="text" name="log" id="log" value="" />

Password:&nbsp <input name="pwd" id="pwd" type="password" value="" />

<input type="submit" name="submit" value="Login" class="button">
<input name="rememberme" id="rememberme" type="hidden" checked="checked" value="forever">
<input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>">

<a href="<?php echo get_option('home'); ?>/wp-login.php?action=lostpassword&redirect_to=<?php echo urlencode(get_permalink()); ?>">Lost Password?

</form>

<?php } else { ?>

<?php // the_content();

$content = apply_filters( 'the_content', get_the_content() );
$content = explode("
", $content);
$count = count($content);
$placement = round($count/2);
$paragraphAfter[$placement] = ''; // Can insert text if wanted.

for ($i = 0; $i < $count; $i++ ) {
    if ( array_key_exists($i, $paragraphAfter) ) {
        echo $paragraphAfter[$i];
		get_template_part( 'parts/ads/lb-article-1' );
    }
    echo $content[$i] . "
";
}

custom_wp_link_pages();

			    ?>

				<?php } ?>

			<?php get_template_part('parts/social'); ?>

			<?php

			$contributor_bio = get_field('contributor_bio');

			 if( get_field('contributor_name') || get_field('Byline') && empty($contributor_bio)) {

			} else {

				get_template_part('parts/authors');
			}

			?>

				<?php if( ! has_tag()){
				 echo '
';
				} ?>

				<?php if( has_tag()) { ?>

Related Tags

<?php the_tags('','',''); ?>

				<?php } ?>
			<?php do_action( 'foundationpress_post_before_comments' ); ?>
			<?php comments_template(); ?>
			<?php do_action( 'foundationpress_post_after_comments' ); ?>

<?php } ?>

	<?php endwhile;?>

	<?php do_action( 'foundationpress_after_content' ); ?>

<?php
//insert cache query
//name format esm_c_[template name in 5 char]_a[ast]c[astc][c ...category][p  ...post id(if sidebar needs to be unique][t ...(tagid)if a tag page][a ... Author ID (if an author page)]
//$cat_name = get_category(get_query_var('cat'))->term_id;

// $queried_object = get_queried_object();
// var_dump( $queried_object );
//$tag_id = get_query_var('term_taxonomy_id');
$post_id = get_the_ID();
//$cat_name = get_category(get_query_var('cat'))->term_id;
global $astc, $astused;
$box_qt = 'esm_c_cata_a'.$ast."c".$astc.'p'.$post_id;
$box_q = preg_replace("/[^A-Za-z0-9_ ]/", '', $box_qt);

$local_box_cache = get_transient( $box_q );
if (false === ($local_box_cache) ){

	// start code to cache
		ob_start( );
			echo '';
			get_sidebar();
			echo '' ;
		$local_box_cache = ob_get_clean( );
	// end the code to cache
		echo $local_box_cache;
	//end cache query

	if( current_user_can( 'edit_post' ) ) {
		//you cannot cache it
	} else {
		set_transient($box_q ,$local_box_cache, 60 * 10);
	}
} else {

echo $local_box_cache;

}
?>

<?php get_footer(); }?>


text:
"""Tests for google3.third_party.py.sqlcmd."""

__author__ = 'mmcdonald@google.com (Matt McDonald)'

import google3
import sqlcmd

from google3.testing.pybase import googletest

class SqlcmdTest(googletest.TestCase):
  def testImport(self):
    """Tests that we can import the module; very basic sanity check."""
    sqlcmd.Main()


text:
                <select class="selectpicker">
                  <option>English</option>
                  <option>French</option>
                  <option>Italian</option>
                </select>

Single Sign-On

Log in to Application

                <form>

                    Email address
                    <input type="email" class="form-control input-lg" id="exampleInputEmail1" placeholder="Email address">

                    Password

                    <input type="password" class="form-control input-lg" id="exampleInputPassword1" placeholder="Password">

                          <input type="checkbox"> Keep me logged in for 30 days

                        Forgot password?

                  <button type="submit" class="btn btn-primary btn-block btn-lg">Log In</button>
                </form>

Need an account?Sign up

One account for all your company services

Terms of Use

Help

Privacy Policy


text:
<?php

namespace AppBundle\EventListener;

use AppBundle\Utils\TitleImageUploader;
use Doctrine\ORM\Event\LifecycleEventArgs;
use AppBundle\Entity\Post;
use Symfony\Component\HttpFoundation\File\UploadedFile;

class PostTitleImageUploadListener{

	private $uploader;

	public function __construct(TitleImageUploader $uploader){
		$this->uploader = $uploader;
	}

	public function prePersist(LifecycleEventArgs $args){
		$entity = $args->getEntity();

		if(!$entity instanceof Post){
			return;
		}

		$fileName = $this->uploader->upload($entity->getTitleImage());
		$entity->setTitleImage($fileName);

	}

	public function preUpdate(LifecycleEventArgs $args){
		$entity = $args->getEntity();

		if(!$entity instanceof Post){
			return;
		}

		if($entity->getTitleImage() instanceof UploadedFile){
			$fileName = $this->uploader->upload($entity->getTitleImage());
			$entity->setTitleImage($fileName);
		}
		else{
			$pathArray = explode("/", $entity->getTitleImage()->getRealPath());
			$entity->setTitleImage(end($pathArray));
		}

	}

}


text:
package com.hauldata.dbpa.task;

import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.time.temporal.ChronoUnit;
import java.util.Map;

import com.hauldata.dbpa.connection.Connection;
import com.hauldata.dbpa.expression.Expression;

public class WaitforDelayTask extends WaitforTask {

	public WaitforDelayTask(
			Prologue prologue,
			Expression<String> delay,
			Map<String, Connection> connections) {
		super(prologue, delay, connections);
	}

	protected long sleepMillis(String delay) {

		final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("H:m[:s]");

		LocalTime pseudoTime;
		try {
			pseudoTime = LocalTime.parse(delay, formatter);
		}
		catch (DateTimeParseException ex) {
			throw new RuntimeException("Invalid delay expression: " + delay);
		}

		return LocalTime.MIN.until(pseudoTime, ChronoUnit.MILLIS);
	}
}


text:
def test_queryai_run_query(requests_mock):
    """Tests queryai-run-quer command function.
    """
    from QueryAI import Client, queryai_run_query_command

    mock_response = {
        "data": [
            {"agegroupdesc": "18-19", "agegroupbin": 2},
            {"agegroupdesc": "20-21", "agegroupbin": 3},
            {"agegroupdesc": "22-24", "agegroupbin": 4},
            {"agegroupdesc": "25-29", "agegroupbin": 5},
            {"agegroupdesc": "30-34", "agegroupbin": 6},
            {"agegroupdesc": "35-39", "agegroupbin": 7},
            {"agegroupdesc": "40-49", "agegroupbin": 8},
            {"agegroupdesc": "50-64", "agegroupbin": 9},
            {"agegroupdesc": "65 AND OVER", "agegroupbin": 10},
            {"agegroupdesc": "UNDER 18", "agegroupbin": 1},
            {"agegroupdesc": "UNKNOWN", "agegroupbin": 0}
        ],
        "reply": "hello world"
    }
    requests_mock.post('https://proxy.query.ai/api/v1/query', json=mock_response)

    client = Client(
        base_url='https://proxy.query.ai/api/v1',
        verify=False,
        headers={},
        proxy=False,
        api_token='ABCD12345',
        alias='my_default_alias',
        connection_params={}
    )

    args = {
        'query': 'run workflow all data'
    }

    response = queryai_run_query_command(client, args)

    assert response.outputs_prefix == 'QueryAI.query'
    assert response.outputs_key_field == ''
    assert response.outputs['result'] == [
        {"agegroupdesc": "18-19", "agegroupbin": 2},
        {"agegroupdesc": "20-21", "agegroupbin": 3},
        {"agegroupdesc": "22-24", "agegroupbin": 4},
        {"agegroupdesc": "25-29", "agegroupbin": 5},
        {"agegroupdesc": "30-34", "agegroupbin": 6},
        {"agegroupdesc": "35-39", "agegroupbin": 7},
        {"agegroupdesc": "40-49", "agegroupbin": 8},
        {"agegroupdesc": "50-64", "agegroupbin": 9},
        {"agegroupdesc": "65 AND OVER", "agegroupbin": 10},
        {"agegroupdesc": "UNDER 18", "agegroupbin": 1},
        {"agegroupdesc": "UNKNOWN", "agegroupbin": 0}
    ]


text:
from django.contrib import admin

from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User

from models import UserProfile

class UserProfileInline(admin.StackedInline):
    model = UserProfile
    can_delete = False
    verbose_name_plural = 'userProfile'

class UserAdmin(UserAdmin):
    inlines = (UserProfileInline, )
    list_display = ['username', 'first_name','email','date_joined','is_active','is_staff']

# Re-register UserAdmin
admin.site.unregister(User)
admin.site.register(User, UserAdmin)

from django.contrib.admin.models import LogEntry, DELETION
from django.utils.html import escape
from django.core.urlresolvers import reverse

class LogEntryAdmin(admin.ModelAdmin):

    date_hierarchy = 'action_time'

    #readonly_fields = LogEntry._meta.get_all_field_names()

    list_filter = [
        'user',
        'content_type',
        'action_flag'
    ]

    search_fields = [
        'object_repr',
        'change_message'
    ]

    list_display = [
        'action_time',
        'user',
        'content_type',
        'object_link',
        'action_flag',
        'change_message',
    ]

    def has_add_permission(self, request):
        return False

    def has_change_permission(self, request, obj=None):
        return request.user.is_superuser and request.method != 'POST'

    def has_delete_permission(self, request, obj=None):
        return False

    def object_link(self, obj):
        if obj.action_flag == DELETION:
            link = escape(obj.object_repr)
        else:
            ct = obj.content_type
            link = u'%s' % (
                reverse('admin:%s_%s_change' % (ct.app_label, ct.model), args=[obj.object_id]),
                escape(obj.object_repr),
            )
        return link
    object_link.allow_tags = True
    object_link.admin_order_field = 'object_repr'
    object_link.short_description = u'object'

    def queryset(self, request):
        return super(LogEntryAdmin, self).queryset(request) \
            .prefetch_related('content_type')

admin.site.register(LogEntry, LogEntryAdmin)


text:
package com.google.zxing;

/**
 * These are a set of hints that you may pass to Writers to specify their behavior.
 *
 * @author dswitkin@google.com (Daniel Switkin)
 */
public enum EncodeHintType {

  /**
   * Specifies what degree of error correction to use, for example in QR Codes.
   * Type depends on the encoder. For example for QR codes it's type
   * {@link com.google.zxing.qrcode.decoder.ErrorCorrectionLevel ErrorCorrectionLevel}.
   */
  ERROR_CORRECTION,

  /**
   * Specifies what character encoding to use where applicable (type {@link String})
   */
  CHARACTER_SET,

  /**
   * Specifies margin, in pixels, to use when generating the barcode. The meaning can vary
   * by format; for example it controls margin before and after the barcode horizontally for
   * most 1D formats. (Type {@link Integer}).
   */
  MARGIN,

  /**
   * Specifies whether to use compact mode for PDF417 (type {@link Boolean}).
   */
  PDF417_COMPACT,

  /**
   * Specifies what compaction mode to use for PDF417 (type
   * {@link com.google.zxing.pdf417.encoder.Compaction Compaction}).
   */
  PDF417_COMPACTION,

  /**
   * Specifies the minimum and maximum number of rows and columns for PDF417 (type
   * {@link com.google.zxing.pdf417.encoder.Dimensions Dimensions}).
   */
  PDF417_DIMENSIONS,

}


text:
#ifndef __TYPES_H__
#define __TYPES_H__

#include <stdint.h>
#include <rtthread.h>

typedef rt_int32_t clockid_t;
typedef rt_int32_t key_t;       /* Used for interprocess communication. */
typedef rt_int32_t pid_t;       /* Used for process IDs and process group IDs. */
typedef signed long ssize_t;    /* Used for a count of bytes or an error indication. */

#endif


text:
namespace extensions {

class DesktopCaptureChooseDesktopMediaFunction
    : public DesktopCaptureChooseDesktopMediaFunctionBase {
 public:
  DECLARE_EXTENSION_FUNCTION("desktopCapture.chooseDesktopMedia",
                             DESKTOPCAPTURE_CHOOSEDESKTOPMEDIA)

  DesktopCaptureChooseDesktopMediaFunction();

 private:
  ~DesktopCaptureChooseDesktopMediaFunction() override;

  // ExtensionFunction overrides.
  ResponseAction Run() override;

  // Returns the target name to show in the picker when capture is requested for
  // an extension.  Currently this is the same as the application name.
  std::string GetExtensionTargetName() const;
};

class DesktopCaptureCancelChooseDesktopMediaFunction
    : public DesktopCaptureCancelChooseDesktopMediaFunctionBase {
 public:
  DECLARE_EXTENSION_FUNCTION("desktopCapture.cancelChooseDesktopMedia",
                             DESKTOPCAPTURE_CANCELCHOOSEDESKTOPMEDIA)

  DesktopCaptureCancelChooseDesktopMediaFunction();

 private:
  ~DesktopCaptureCancelChooseDesktopMediaFunction() override;
};

}  // namespace extensions

#endif  // CHROME_BROWSER_EXTENSIONS_API_DESKTOP_CAPTURE_DESKTOP_CAPTURE_API_H_


text:
<?php

namespace Minimalism\PHPDump\Nova;

class NovaPacketFilter
{
    public $servicePattern;
    public $methodPattern;

    public function __construct($servicePattern = "", $methodPattern = "")
    {
        $this->servicePattern = strtolower($servicePattern);
        $this->methodPattern = strtolower($methodPattern);
    }

    private function matchService($service)
    {
        return fnmatch($this->servicePattern, strtolower($service));
    }

    private function matchMethod($method)
    {
        return fnmatch($this->methodPattern, strtolower($method));
    }

    public static function isHeartbeat($service, $method)
    {
        return $service === "com.youzan.service.test" && ($method === "ping" || $method === "pong");
    }

    public function __invoke(NovaPDU $novaPacket)
    {
        $service = $novaPacket->service;
        $method = $novaPacket->method;

        $serviceMatched = $this->matchService($service);
        $methodMatched = $this->matchMethod($method);

        if ($this->servicePattern && $this->methodPattern) {
            return $serviceMatched && $methodMatched;
        } else if ($this->servicePattern && !$this->methodPattern) {
            return $serviceMatched;
        } else if (!$this->servicePattern && $this->methodPattern) {
            return $methodMatched;
        } else {
            return true;
        }
    }
}


text:
const std::string search = "1kid";

// Generate a random secret key. A random 32 bytes.
bc::ec_secret random_secret(std::default_random_engine& engine);
// Extract the Bitcoin address from an EC secret.
std::string bitcoin_address(const bc::ec_secret& secret);
// Case insensitive comparison with the search string.
bool match_found(const std::string& address);

int main()
{
    // random_device on Linux uses "/dev/urandom"
    // CAUTION: Depending on implementation this RNG may not be secure enough!
    // Do not use vanity keys generated by this example in production
    std::random_device random;
    std::default_random_engine engine(random());
    // Loop continuously...
    while (true)
    {
        // Generate a random secret.
        bc::ec_secret secret = random_secret(engine);
        // Get the address.
        std::string address = bitcoin_address(secret);
        // Does it match our search string? (1kid)
        if (match_found(address))
        {
            // Success!
            std::cout << "Found vanity address! " << address << std::endl;
            std::cout << "Secret: " << bc::encode_base16(secret) << std::endl;
            return 0;
        }
    }
    // Should never reach here!
    return 0;
}

bc::ec_secret random_secret(std::default_random_engine& engine)
{
    // Create new secret...
    bc::ec_secret secret;
    // Iterate through every byte setting a random value...
    for (uint8_t& byte: secret)
    byte = engine() % std::numeric_limits<uint8_t>::max();
    // Return result.
    return secret;
}

std::string bitcoin_address(const bc::ec_secret& secret)
{
    // Convert secret to payment address
    bc::wallet::ec_private private_key(secret);
    bc::wallet::payment_address payaddr(private_key);
    // Return encoded form.
    return payaddr.encoded();
}

bool match_found(const std::string& address)
{
    auto addr_it = address.begin();
    // Loop through the search string comparing it to the lower case
    // character of the supplied address.
    for (auto it = search.begin(); it != search.end(); ++it, ++addr_it)
        if (*it != std::tolower(*addr_it))
            return false;
    // Reached end of search string, so address matches.
    return true;
}


text:
using namespace std;

class CPPIdentifier;
class CPPParameterList;
class CPPType;
class CPPExpression;
class CPPScope;
class CPPPreprocessor;

enum CPPInstanceIdentifierType {
  IIT_pointer,
  IIT_reference,
  IIT_scoped_pointer,
  IIT_array,
  IIT_const,
  IIT_paren,
  IIT_func,
  IIT_initializer,
};

///////////////////////////////////////////////////////////////////
//       Class : CPPInstanceIdentifier
// Description : This class is used in parser.y to build up a variable
//               instance definition.  An instance is something like
//               'int *&a'; the InstanceIdentifier stores everything
//               to the right of the typename.  Later this can be
//               passed to make_instance() to construct a CPPInstance.
////////////////////////////////////////////////////////////////////
class CPPInstanceIdentifier {
public:
  CPPInstanceIdentifier(CPPIdentifier *ident);

  CPPType *unroll_type(CPPType *start_type);

  void add_modifier(CPPInstanceIdentifierType type);
  void add_func_modifier(CPPParameterList *params, int flags);
  void add_scoped_pointer_modifier(CPPIdentifier *scoping);
  void add_array_modifier(CPPExpression *expr);
  void add_initializer_modifier(CPPParameterList *params);

  CPPParameterList *get_initializer() const;

  CPPScope *get_scope(CPPScope *current_scope, CPPScope *global_scope,
                      CPPPreprocessor *error_sink = NULL) const;

  CPPIdentifier *_ident;

  class Modifier {
  public:
    Modifier(CPPInstanceIdentifierType type);
    static Modifier func_type(CPPParameterList *params, int flags);
    static Modifier array_type(CPPExpression *expr);
    static Modifier scoped_pointer_type(CPPIdentifier *scoping);
    static Modifier initializer_type(CPPParameterList *params);

    CPPInstanceIdentifierType _type;
    CPPParameterList *_func_params;
    int _func_flags;
    CPPIdentifier *_scoping;
    CPPExpression *_expr;
  };
  typedef vector<Modifier> Modifiers;
  Modifiers _modifiers;

private:
  CPPType *
  r_unroll_type(CPPType *start_type, Modifiers::const_iterator mi);
};

#endif


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.datafactory.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.datafactory.fluent.models.JiraLinkedServiceTypeProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.util.List;
import java.util.Map;

/** Jira Service linked service. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonTypeName("Jira")
@Fluent
public final class JiraLinkedService extends LinkedService {
    /*
     * Jira Service linked service properties.
     */
    @JsonProperty(value = "typeProperties", required = true)
    private JiraLinkedServiceTypeProperties innerTypeProperties = new JiraLinkedServiceTypeProperties();

    /** Creates an instance of JiraLinkedService class. */
    public JiraLinkedService() {
    }

    /**
     * Get the innerTypeProperties property: Jira Service linked service properties.
     *
     * @return the innerTypeProperties value.
     */
    private JiraLinkedServiceTypeProperties innerTypeProperties() {
        return this.innerTypeProperties;
    }

    /** {@inheritDoc} */
    @Override
    public JiraLinkedService withConnectVia(IntegrationRuntimeReference connectVia) {
        super.withConnectVia(connectVia);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public JiraLinkedService withDescription(String description) {
        super.withDescription(description);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public JiraLinkedService withParameters(Map<String, ParameterSpecification> parameters) {
        super.withParameters(parameters);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public JiraLinkedService withAnnotations(List<Object> annotations) {
        super.withAnnotations(annotations);
        return this;
    }

    /**
     * Get the host property: The IP address or host name of the Jira service. (e.g. jira.example.com).
     *
     * @return the host value.
     */
    public Object host() {
        return this.innerTypeProperties() == null ? null : this.innerTypeProperties().host();
    }

    /**
     * Set the host property: The IP address or host name of the Jira service. (e.g. jira.example.com).
     *
     * @param host the host value to set.
     * @return the JiraLinkedService object itself.
     */
    public JiraLinkedService withHost(Object host) {
        if (this.innerTypeProperties() == null) {
            this.innerTypeProperties = new JiraLinkedServiceTypeProperties();
        }
        this.innerTypeProperties().withHost(host);
        return this;
    }

    /**
     * Get the port property: The TCP port that the Jira server uses to listen for client connections. The default value
     * is 443 if connecting through HTTPS, or 8080 if connecting through HTTP.
     *
     * @return the port value.
     */
    public Object port() {
        return this.innerTypeProperties() == null ? null : this.innerTypeProperties().port();
    }

    /**
     * Set the port property: The TCP port that the Jira server uses to listen for client connections. The default value
     * is 443 if connecting through HTTPS, or 8080 if connecting through HTTP.
     *
     * @param port the port value to set.
     * @return the JiraLinkedService object itself.
     */
    public JiraLinkedService withPort(Object port) {
        if (this.innerTypeProperties() == null) {
            this.innerTypeProperties = new JiraLinkedServiceTypeProperties();
        }
        this.innerTypeProperties().withPort(port);
        return this;
    }

    /**
     * Get the username property: The user name that you use to access Jira Service.
     *
     * @return the username value.
     */
    public Object username() {
        return this.innerTypeProperties() == null ? null : this.innerTypeProperties().username();
    }

    /**
     * Set the username property: The user name that you use to access Jira Service.
     *
     * @param username the username value to set.
     * @return the JiraLinkedService object itself.
     */
    public JiraLinkedService withUsername(Object username) {
        if (this.innerTypeProperties() == null) {
            this.innerTypeProperties = new JiraLinkedServiceTypeProperties();
        }
        this.innerTypeProperties().withUsername(username);
        return this;
    }

    /**
     * Get the password property: The password corresponding to the user name that you provided in the username field.
     *
     * @return the password value.
     */
    public SecretBase password() {
        return this.innerTypeProperties() == null ? null : this.innerTypeProperties().password();
    }

    /**
     * Set the password property: The password corresponding to the user name that you provided in the username field.
     *
     * @param password the password value to set.
     * @return the JiraLinkedService object itself.
     */
    public JiraLinkedService withPassword(SecretBase password) {
        if (this.innerTypeProperties() == null) {
            this.innerTypeProperties = new JiraLinkedServiceTypeProperties();
        }
        this.innerTypeProperties().withPassword(password);
        return this;
    }

    /**
     * Get the useEncryptedEndpoints property: Specifies whether the data source endpoints are encrypted using HTTPS.
     * The default value is true.
     *
     * @return the useEncryptedEndpoints value.
     */
    public Object useEncryptedEndpoints() {
        return this.innerTypeProperties() == null ? null : this.innerTypeProperties().useEncryptedEndpoints();
    }

    /**
     * Set the useEncryptedEndpoints property: Specifies whether the data source endpoints are encrypted using HTTPS.
     * The default value is true.
     *
     * @param useEncryptedEndpoints the useEncryptedEndpoints value to set.
     * @return the JiraLinkedService object itself.
     */
    public JiraLinkedService withUseEncryptedEndpoints(Object useEncryptedEndpoints) {
        if (this.innerTypeProperties() == null) {
            this.innerTypeProperties = new JiraLinkedServiceTypeProperties();
        }
        this.innerTypeProperties().withUseEncryptedEndpoints(useEncryptedEndpoints);
        return this;
    }

    /**
     * Get the useHostVerification property: Specifies whether to require the host name in the server's certificate to
     * match the host name of the server when connecting over SSL. The default value is true.
     *
     * @return the useHostVerification value.
     */
    public Object useHostVerification() {
        return this.innerTypeProperties() == null ? null : this.innerTypeProperties().useHostVerification();
    }

    /**
     * Set the useHostVerification property: Specifies whether to require the host name in the server's certificate to
     * match the host name of the server when connecting over SSL. The default value is true.
     *
     * @param useHostVerification the useHostVerification value to set.
     * @return the JiraLinkedService object itself.
     */
    public JiraLinkedService withUseHostVerification(Object useHostVerification) {
        if (this.innerTypeProperties() == null) {
            this.innerTypeProperties = new JiraLinkedServiceTypeProperties();
        }
        this.innerTypeProperties().withUseHostVerification(useHostVerification);
        return this;
    }

    /**
     * Get the usePeerVerification property: Specifies whether to verify the identity of the server when connecting over
     * SSL. The default value is true.
     *
     * @return the usePeerVerification value.
     */
    public Object usePeerVerification() {
        return this.innerTypeProperties() == null ? null : this.innerTypeProperties().usePeerVerification();
    }

    /**
     * Set the usePeerVerification property: Specifies whether to verify the identity of the server when connecting over
     * SSL. The default value is true.
     *
     * @param usePeerVerification the usePeerVerification value to set.
     * @return the JiraLinkedService object itself.
     */
    public JiraLinkedService withUsePeerVerification(Object usePeerVerification) {
        if (this.innerTypeProperties() == null) {
            this.innerTypeProperties = new JiraLinkedServiceTypeProperties();
        }
        this.innerTypeProperties().withUsePeerVerification(usePeerVerification);
        return this;
    }

    /**
     * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted
     * using the integration runtime credential manager. Type: string (or Expression with resultType string).
     *
     * @return the encryptedCredential value.
     */
    public Object encryptedCredential() {
        return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential();
    }

    /**
     * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted
     * using the integration runtime credential manager. Type: string (or Expression with resultType string).
     *
     * @param encryptedCredential the encryptedCredential value to set.
     * @return the JiraLinkedService object itself.
     */
    public JiraLinkedService withEncryptedCredential(Object encryptedCredential) {
        if (this.innerTypeProperties() == null) {
            this.innerTypeProperties = new JiraLinkedServiceTypeProperties();
        }
        this.innerTypeProperties().withEncryptedCredential(encryptedCredential);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        super.validate();
        if (innerTypeProperties() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property innerTypeProperties in model JiraLinkedService"));
        } else {
            innerTypeProperties().validate();
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(JiraLinkedService.class);
}