#!/usr/bin/env node

import { AeonstoreDomainEventStore } from '../../../../stores/domainEventStore/Aeonstore';
import { CommandData } from '../../../../common/elements/CommandData';
import { Client as CommandDispatcherClient } from '../../../../apis/awaitItem/http/v2/Client';
import { CommandWithMetadata } from '../../../../common/elements/CommandWithMetadata';
import { configurationDefinition } from './configurationDefinition';
import { createLockStore } from '../../../../stores/lockStore/createLockStore';
import { createPublisher } from '../../../../messaging/pubSub/createPublisher';
import { DomainEventData } from '../../../../common/elements/DomainEventData';
import { Client as DomainEventDispatcherClient } from '../../../../apis/handleDomainEvent/http/v2/Client';
import { DomainEventWithState } from '../../../../common/elements/DomainEventWithState';
import { flaschenpost } from 'flaschenpost';
import { fromEnvironmentVariables } from '../../../shared/fromEnvironmentVariables';
import { getSnapshotStrategy } from '../../../../common/domain/getSnapshotStrategy';
import { loadApplication } from '../../../../common/application/loadApplication';
import { Notification } from '../../../../common/elements/Notification';
import pForever from 'p-forever';
import { processCommand } from './processCommand';
import { PublishDomainEvents } from '../../../../common/domain/PublishDomainEvents';
import { registerExceptionHandler } from '../../../../common/utils/process/registerExceptionHandler';
import { Repository } from '../../../../common/domain/Repository';
import { runHealthServer } from '../../../shared/runHealthServer';
import { State } from '../../../../common/elements/State';

/* eslint-disable @typescript-eslint/no-floating-promises */
(async (): Promise<void> => {
  const logger = flaschenpost.getLogger();

  try {
    registerExceptionHandler();

    const configuration = fromEnvironmentVariables({ configurationDefinition });

    const application = await loadApplication({
      applicationDirectory: configuration.applicationDirectory
    });

    const domainEventStore = await AeonstoreDomainEventStore.create({
      protocol: configuration.aeonstoreProtocol,
      hostName: configuration.aeonstoreHostName,
      port: configuration.aeonstorePort
    });

    const lockStore = await createLockStore(configuration.lockStoreOptions);

    const publisher = await createPublisher<Notification | DomainEventWithState<DomainEventData, State>>(
      configuration.pubSubOptions.publisher
    );

    const repository = new Repository({
      application,
      lockStore,
      domainEventStore,
      publisher,
      pubSubChannelForNotifications: configuration.pubSubOptions.channelForNotifications,
      snapshotStrategy: getSnapshotStrategy(configuration.snapshotStrategy)
    });

    const commandDispatcherClient = new CommandDispatcherClient<CommandWithMetadata<CommandData>>({
      protocol: configuration.commandDispatcherProtocol,
      hostName: configuration.commandDispatcherHostName,
      port: configuration.commandDispatcherPort,
      path: '/await-command/v2',
      createItemInstance: ({ item }: { item: CommandWithMetadata<CommandData> }): CommandWithMetadata<CommandData> => new CommandWithMetadata<CommandData>(item)
    });

    const domainEventDispatcherClient = new DomainEventDispatcherClient({
      protocol: configuration.domainEventDispatcherProtocol,
      hostName: configuration.domainEventDispatcherHostName,
      port: configuration.domainEventDispatcherPort,
      path: '/handle-domain-event/v2'
    });

    const publishDomainEvents: PublishDomainEvents = async ({ domainEvents }: {
      domainEvents: DomainEventWithState<DomainEventData, State>[];
    }): Promise<any> => {
      for (const domainEvent of domainEvents) {
        await publisher.publish({
          channel: configuration.pubSubOptions.channelForNewDomainEvents,
          message: domainEvent
        });
        await domainEventDispatcherClient.postDomainEvent({
          domainEvent: domainEvent.withoutState()
        });
      }
    };

    await runHealthServer({ corsOrigin: configuration.healthCorsOrigin, port: configuration.healthPort });

    logger.info('Domain server started.', { healthPort: configuration.healthPort });

    for (let i = 0; i < configuration.concurrentCommands; i++) {
      pForever(async (): Promise<void> => {
        await processCommand({
          commandDispatcher: {
            client: commandDispatcherClient,
            renewalInterval: configuration.commandDispatcherRenewInterval,
            acknowledgeRetries: configuration.commandDispatcherAcknowledgeRetries
          },
          repository,
          publishDomainEvents
        });
      });
    }
  } catch (ex) {
    logger.fatal('An unexpected error occured.', { ex });
    process.exit(1);
  }
})();
/* eslint-enable @typescript-eslint/no-floating-promises */

{'repo_name': 'thenativeweb/wolkenkit', 'stars': '773', 'repo_language': 'TypeScript', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': -2120208662225501101, '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.

usedefaults=true

{'repo_name': 'apache/derby', 'stars': '220', 'repo_language': 'Java', 'file_name': 'StopAction.java', 'mime_type': 'text/x-java', 'hash': -3209854633437089896, 'source_dataset': 'data'}


"""
Cranelift predicates that consider `Function` fields.
"""
from cdsl.predicates import FieldPredicate
from .formats import UnaryGlobalValue, InstructionFormat

try:
    from typing import TYPE_CHECKING
    if TYPE_CHECKING:
        from cdsl.formats import InstructionFormat, FormatField  # noqa
except ImportError:
    pass

class IsColocatedFunc(FieldPredicate):
    """
    An instruction predicate that checks the referenced function is colocated.
    """

    def __init__(self, field):
        # type: (FormatField) -> None
        super(IsColocatedFunc, self).__init__(
            field, 'is_colocated_func', ('func',))

class IsColocatedData(FieldPredicate):
    """
    An instruction predicate that checks the referenced data object is
    colocated.
    """

    def __init__(self):
        # type: () -> None
        super(IsColocatedData, self).__init__(
            UnaryGlobalValue.global_value, 'is_colocated_data', ('func',))

class LengthEquals(FieldPredicate):
    def __init__(self, iform, num):
        # type: (InstructionFormat, int) -> None
        super(LengthEquals, self).__init__(
            iform.args(), 'has_length_of', (num, 'func'))

{'repo_name': 'rust-lang/rustc-perf', 'stars': '186', 'repo_language': 'Rust', 'file_name': 'filter-hue-rotate-1.yaml', 'mime_type': 'text/plain', 'hash': 1014011326592124438, 'source_dataset': 'data'}


from keras.layers import Conv2D
from keras.layers import Activation
from keras.models import Model

from .blocks import DecoderBlock
from ..utils import get_layer_number, to_tuple

def build_linknet(backbone,
                  classes,
                  skip_connection_layers,
                  decoder_filters=(None, None, None, None, 16),
                  upsample_rates=(2, 2, 2, 2, 2),
                  n_upsample_blocks=5,
                  upsample_kernel_size=(3, 3),
                  upsample_layer='upsampling',
                  activation='sigmoid',
                  use_batchnorm=False):

    input = backbone.input
    x = backbone.output

    # convert layer names to indices
    skip_connection_idx = ([get_layer_number(backbone, l) if isinstance(l, str) else l
                            for l in skip_connection_layers])

    for i in range(n_upsample_blocks):

        # check if there is a skip connection
        skip_connection = None
        if i < len(skip_connection_idx):
            skip_connection = backbone.layers[skip_connection_idx[i]].output

        upsample_rate = to_tuple(upsample_rates[i])

        x = DecoderBlock(stage=i,
                         filters=decoder_filters[i],
                         kernel_size=upsample_kernel_size,
                         upsample_rate=upsample_rate,
                         use_batchnorm=use_batchnorm,
                         upsample_layer=upsample_layer,
                         skip=skip_connection)(x)

    x = Conv2D(classes, (3, 3), padding='same', name='final_conv')(x)
    x = Activation(activation, name=activation)(x)

    model = Model(input, x)

    return model

{'repo_name': 'ybabakhin/kaggle_salt_bes_phalanx', 'stars': '281', 'repo_language': 'Python', 'file_name': 'models.py', 'mime_type': 'text/x-python', 'hash': -143027743283496098, 'source_dataset': 'data'}


create or replace package body uri_template_util_pkg
as

  /*

  Purpose:      Package handles URI templates

  Remarks:

  Who     Date        Description
  ------  ----------  --------------------------------
  MBR     30.07.2012  Created

  */

function expand (p_template in varchar2,
                 p_values in t_str_array) return varchar2
as
  l_returnvalue string_util_pkg.t_max_db_varchar2;
begin

  /*

  Purpose:      expand URI based on template

  Remarks:

  Who     Date        Description
  ------  ----------  --------------------------------
  MBR     30.07.2012  Created

  */

  l_returnvalue := p_template;

  if p_values.count > 0 then
    for i in p_values.first .. p_values.last loop
      l_returnvalue := regexp_replace (l_returnvalue, regexp_util_pkg.g_exp_curly_brackets, p_values(i), 1, 1);
    end loop;
  end if;

  return l_returnvalue;

end expand;

function match (p_uri in varchar2,
                p_templates in t_str_array) return varchar2
as
  l_template    string_util_pkg.t_max_db_varchar2;
  l_returnvalue string_util_pkg.t_max_db_varchar2;
begin

  /*

  Purpose:      matches actual URI with list of templates

  Remarks:

  Who     Date        Description
  ------  ----------  --------------------------------
  MBR     30.07.2012  Created

  */

  if p_templates.count > 0 then

    for i in p_templates.first .. p_templates.last loop

      l_template := regexp_replace(p_templates(i), regexp_util_pkg.g_exp_curly_brackets, '(.*)');

      if regexp_substr(p_uri, l_template) = p_uri then
        l_returnvalue := p_templates(i);
        exit;
      end if;

    end loop;

  end if;

  return l_returnvalue;

end match;

function parse (p_template in varchar2,
                p_uri in varchar2) return t_dictionary
as
  l_template    string_util_pkg.t_max_db_varchar2;
  l_from        pls_integer;
  l_to          pls_integer;
  l_value       string_util_pkg.t_max_db_varchar2;
  l_returnvalue t_dictionary;
begin

  /*

  Purpose:      get actual names and values

  Remarks:

  Who     Date        Description
  ------  ----------  --------------------------------
  MBR     30.07.2012  Created

  */

  l_template := p_template;

  for l_rec in (select column_value as key_name from table(regexp_util_pkg.match (l_template, regexp_util_pkg.g_exp_curly_brackets))) loop

    l_from := instr(l_template, l_rec.key_name);
    l_to := instr(p_uri, '/', l_from + 1);
    if l_to = 0 then
      l_to := length(p_uri) + 1;
    end if;

    l_value := substr(p_uri, l_from, l_to - l_from);
    l_template := replace(l_template, l_rec.key_name, l_value);

    l_returnvalue(substr(l_rec.key_name, 2, length(l_rec.key_name) - 2)) := l_value;

  end loop;

  return l_returnvalue;

end parse;

end uri_template_util_pkg;
/

{'repo_name': 'mortenbra/alexandria-plsql-utils', 'stars': '519', 'repo_language': 'PLSQL', 'file_name': 'as_pdf3_demo.sql', 'mime_type': 'text/plain', 'hash': 3923345359638571933, 'source_dataset': 'data'}


/**
 * Copyright 2014-2017 yangming.liu<bytefox@126.com>.
 *
 * This copyrighted material is made available to anyone wishing to use, modify,
 * copy, or redistribute it subject to the terms and conditions of the GNU
 * Lesser General Public License, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this distribution; if not, see <http://www.gnu.org/licenses/>.
 */
package org.bytesoft.bytejta.supports.springcloud;

import java.lang.reflect.Proxy;

import org.apache.commons.lang3.StringUtils;
import org.bytesoft.bytejta.supports.internal.RemoteCoordinatorRegistry;
import org.bytesoft.bytejta.supports.springcloud.loadbalancer.TransactionLoadBalancerInterceptor;
import org.bytesoft.common.utils.CommonUtils;
import org.bytesoft.transaction.TransactionBeanFactory;
import org.bytesoft.transaction.aware.TransactionBeanFactoryAware;
import org.bytesoft.transaction.remote.RemoteAddr;
import org.bytesoft.transaction.remote.RemoteCoordinator;
import org.bytesoft.transaction.remote.RemoteNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.EnvironmentAware;
import org.springframework.core.env.Environment;
import org.springframework.web.client.RestTemplate;

public final class SpringCloudBeanRegistry implements TransactionBeanFactoryAware, EnvironmentAware {
	static final Logger logger = LoggerFactory.getLogger(SpringCloudBeanRegistry.class);
	private static final SpringCloudBeanRegistry instance = new SpringCloudBeanRegistry();

	@javax.inject.Inject
	private TransactionBeanFactory beanFactory;
	private RestTemplate restTemplate;
	private ThreadLocal<TransactionLoadBalancerInterceptor> interceptors = new ThreadLocal<TransactionLoadBalancerInterceptor>();
	private Environment environment;

	private SpringCloudBeanRegistry() {
		if (instance != null) {
			throw new IllegalStateException();
		}
	}

	public static SpringCloudBeanRegistry getInstance() {
		return instance;
	}

	public RemoteCoordinator getConsumeCoordinator(String identifier) {
		RemoteCoordinatorRegistry registry = RemoteCoordinatorRegistry.getInstance();
		if (StringUtils.isBlank(identifier)) {
			return null;
		}

		RemoteAddr remoteAddr = CommonUtils.getRemoteAddr(identifier);
		RemoteNode remoteNode = CommonUtils.getRemoteNode(identifier);

		RemoteNode targetNode = registry.getRemoteNode(remoteAddr);
		if (targetNode == null && remoteAddr != null //
				&& remoteNode != null && StringUtils.isNotBlank(remoteNode.getServiceKey())) {
			registry.putRemoteNode(remoteAddr, remoteNode);
		}

		// String application = CommonUtils.getApplication(identifier);
		// RemoteCoordinator participant = registry.getParticipant(application);
		// if (participant != null) {
		// return participant;
		// }

		RemoteCoordinator physical = registry.getPhysicalInstance(remoteAddr);
		if (physical != null) {
			return physical;
		}

		SpringCloudCoordinator handler = new SpringCloudCoordinator();
		handler.setIdentifier(identifier);
		handler.setEnvironment(this.environment);

		physical = (RemoteCoordinator) Proxy.newProxyInstance(SpringCloudCoordinator.class.getClassLoader(),
				new Class[] { RemoteCoordinator.class }, handler);

		registry.putPhysicalInstance(remoteAddr, physical);

		// registry.putRemoteNode(remoteAddr, remoteNode);
		// registry.putParticipant(application, participant);

		return physical;
	}

	public TransactionLoadBalancerInterceptor getLoadBalancerInterceptor() {
		return this.interceptors.get();
	}

	public void setLoadBalancerInterceptor(TransactionLoadBalancerInterceptor interceptor) {
		this.interceptors.set(interceptor);
	}

	public void removeLoadBalancerInterceptor() {
		this.interceptors.remove();
	}

	public RestTemplate getRestTemplate() {
		return restTemplate;
	}

	public void setRestTemplate(RestTemplate restTemplate) {
		this.restTemplate = restTemplate;
	}

	public void setBeanFactory(TransactionBeanFactory tbf) {
		this.beanFactory = tbf;
	}

	public TransactionBeanFactory getBeanFactory() {
		return beanFactory;
	}

	public Environment getEnvironment() {
		return environment;
	}

	public void setEnvironment(Environment environment) {
		this.environment = environment;
	}

}

{'repo_name': 'liuyangming/ByteJTA', 'stars': '200', 'repo_language': 'Java', 'file_name': 'XAConnectionImpl.java', 'mime_type': 'text/x-java', 'hash': -9220901990123415971, 'source_dataset': 'data'}


{'repo_name': 'duckduckgo/tracker-radar', 'stars': '478', 'repo_language': 'None', 'file_name': 'Avis Budget Group.json', 'mime_type': 'text/plain', 'hash': 804808736122345922, 'source_dataset': 'data'}


#include <initguid.h>

#include "configxml.h"
#include "imcrvtip.h"

HINSTANCE g_hInst;

LPCWSTR TextServiceDesc = TEXTSERVICE_DESC;
LPCWSTR LangbarItemDesc = L"ver. " TEXTSERVICE_VER;
LPCWSTR CandidateWindowClass = TEXTSERVICE_NAME L"CandidateWindow";
LPCWSTR InputModeWindowClass = TEXTSERVICE_NAME L"InputModeWindow";

#ifndef _DEBUG

// {EAEA0E29-AA1E-48ef-B2DF-46F4E24C6265}
const GUID c_clsidTextService =
{0xeaea0e29, 0xaa1e, 0x48ef, {0xb2, 0xdf, 0x46, 0xf4, 0xe2, 0x4c, 0x62, 0x65}};

// {956F14B3-5310-4cef-9651-26710EB72F3A}
const GUID c_guidProfile =
{0x956f14b3, 0x5310, 0x4cef, {0x96, 0x51, 0x26, 0x71, 0x0e, 0xb7, 0x2f, 0x3a}};

// {6C205850-4DF5-4F11-B0AE-6E94BA9C8865}
const GUID c_guidPreservedKeyOn =
{0x6c205850, 0x4df5, 0x4f11, {0xb0, 0xae, 0x6e, 0x94, 0xba, 0x9c, 0x88, 0x65}};

// {BA178F26-486B-4824-8DA9-5060A11DC35B}
const GUID c_guidPreservedKeyOff =
{0xba178f26, 0x486b, 0x4824, {0x8d, 0xa9, 0x50, 0x60, 0xa1, 0x1d, 0xc3, 0x5b}};

// {3E45E83F-C786-485f-8B66-B7EAD509F960}
const GUID c_guidLangBarItemButton =
{0x3e45e83f, 0xc786, 0x485f, {0x8b, 0x66, 0xb7, 0xea, 0xd5, 0x09, 0xf9, 0x60}};

// {3F821491-1536-4bc9-B4CA-080947B00F64}
const GUID c_guidCandidateListUIElement =
{0x3f821491, 0x1536, 0x4bc9, {0xb4, 0xca, 0x08, 0x09, 0x47, 0xb0, 0x0f, 0x64}};

// {72A02805-47AF-4133-AFA6-BF6B20FB6723}
const GUID c_guidDisplayAttributeInputMark =
{0x72a02805, 0x47af, 0x4133, {0xaf, 0xa6, 0xbf, 0x6b, 0x20, 0xfb, 0x67, 0x23}};

// {7FE29429-CB73-43f0-B481-BC220B68F2E3}
const GUID c_guidDisplayAttributeInputText =
{0x7fe29429, 0xcb73, 0x43f0, {0xb4, 0x81, 0xbc, 0x22, 0x0b, 0x68, 0xf2, 0xe3}};

// {22CF49AD-8D24-4DEA-B420-C7D8DB4D2A12}
const GUID c_guidDisplayAttributeInputOkuri =
{0x22cf49ad, 0x8d24, 0x4dea, {0xb4, 0x20, 0xc7, 0xd8, 0xdb, 0x4d, 0x2a, 0x12}};

// {3F45C819-C7A4-47D1-BB86-2F3E00C4729F}
const GUID c_guidDisplayAttributeConvMark =
{0x3f45c819, 0xc7a4, 0x47d1, {0xbb, 0x86, 0x2f, 0x3e, 0x00, 0xc4, 0x72, 0x9f}};

// {EBFDDF5D-E34E-409e-8C93-9FE92DB32FB5}
const GUID c_guidDisplayAttributeConvText =
{0xebfddf5d, 0xe34e, 0x409e, {0x8c, 0x93, 0x9f, 0xe9, 0x2d, 0xb3, 0x2f, 0xb5}};

// {3C1D9F80-CB33-43CF-9F00-F38F397B671A}
const GUID c_guidDisplayAttributeConvOkuri =
{0x3c1d9f80, 0xcb33, 0x43cf, {0x9f, 0x00, 0xf3, 0x8f, 0x39, 0x7b, 0x67, 0x1a}};

// {ACEDB943-CFD1-4588-89DD-B80E5720CBC7}
const GUID c_guidDisplayAttributeConvAnnot =
{0xacedb943, 0xcfd1, 0x4588, {0x89, 0xdd, 0xb8, 0x0e, 0x57, 0x20, 0xcb, 0xc7}};

#else

// {4D97960C-1D59-4466-BEFE-4C1328D2550D}
const GUID c_clsidTextService =
{0x4d97960c, 0x1d59, 0x4466, {0xbe, 0xfe, 0x4c, 0x13, 0x28, 0xd2, 0x55, 0x0d}};

// {820E9894-024B-4bd1-98AF-3942B772CFF1}
const GUID c_guidProfile =
{0x820e9894, 0x024b, 0x4bd1, {0x98, 0xaf, 0x39, 0x42, 0xb7, 0x72, 0xcf, 0xf1}};

// {4D10F34B-5C4E-4121-8795-C480110A644B}
const GUID c_guidPreservedKeyOn =
{0x4d10f34b, 0x5c4e, 0x4121, {0x87, 0x95, 0xc4, 0x80, 0x11, 0x0a, 0x64, 0x4b}};

// {6B6743B3-2D6F-4BB9-9D74-7007928C1E94}
const GUID c_guidPreservedKeyOff =
{0x6b6743b3, 0x2d6f, 0x4bb9, {0x9d, 0x74, 0x70, 0x07, 0x92, 0x8c, 0x1e, 0x94}};

// {F4BF0D3C-D4CE-456f-837E-FE6712C6A8C3}
const GUID c_guidLangBarItemButton =
{0xf4bf0d3c, 0xd4ce, 0x456f, {0x83, 0x7e, 0xfe, 0x67, 0x12, 0xc6, 0xa8, 0xc3}};

// {25A6388F-D3CB-4866-A2C3-94E00970BF45}
const GUID c_guidCandidateListUIElement =
{0x25a6388f, 0xd3cb, 0x4866, {0xa2, 0xc3, 0x94, 0xe0, 0x09, 0x70, 0xbf, 0x45}};

// {CB22C53A-AD57-485A-A6CF-20390A0D5098}
const GUID c_guidDisplayAttributeInputMark =
{0xcb22c53a, 0xad57, 0x485a, {0xa6, 0xcf, 0x20, 0x39, 0x0a, 0x0d, 0x50, 0x98}};

// {6F99E3F1-36AC-4015-B334-211CFFCB3262}
const GUID c_guidDisplayAttributeInputText =
{0x6f99e3f1, 0x36ac, 0x4015, {0xb3, 0x34, 0x21, 0x1c, 0xff, 0xcb, 0x32, 0x62}};

// {D2176C6C-8758-40C6-9612-5832FA315879}
const GUID c_guidDisplayAttributeInputOkuri =
{0xd2176c6c, 0x8758, 0x40c6, {0x96, 0x12, 0x58, 0x32, 0xfa, 0x31, 0x58, 0x79}};

// {B564E740-166D-45B1-AF44-7CCC7F75A807}
const GUID c_guidDisplayAttributeConvMark =
{0xb564e740, 0x166d, 0x45b1, {0xaf, 0x44, 0x7c, 0xcc, 0x7f, 0x75, 0xa8, 0x07}};

// {6877D302-1C51-4ba4-9329-2F80B5E3A4E7}
const GUID c_guidDisplayAttributeConvText =
{0x6877d302, 0x1c51, 0x4ba4, {0x93, 0x29, 0x2f, 0x80, 0xb5, 0xe3, 0xa4, 0xe7}};

// {F99304F1-9F91-439E-8446-6FE0F8A98EDC}
const GUID c_guidDisplayAttributeConvOkuri =
{0xf99304f1, 0x9f91, 0x439e, {0x84, 0x46, 0x6f, 0xe0, 0xf8, 0xa9, 0x8e, 0xdc}};

// {C6040719-6FF3-4b92-A589-36E93BFD53EC}
const GUID c_guidDisplayAttributeConvAnnot =
{0xc6040719, 0x6ff3, 0x4b92, {0xa5, 0x89, 0x36, 0xe9, 0x3b, 0xfd, 0x53, 0xec}};

#endif

LPCWSTR markNo = L":";
LPCWSTR markAnnotation = L";";
LPCWSTR markCursor = L"|";
LPCWSTR markSqbL = L"[";
LPCWSTR markSqbR = L"]";
LPCWSTR markSP = L"\x20";
LPCWSTR markNBSP = L"\u00A0";
LPCWSTR markHM = L"\x2D";
LPCWSTR markMidashi = L"▽";
LPCWSTR markHenkan = L"▼";
LPCWSTR markOkuri = L"*";

const DISPLAYATTRIBUTE_INFO c_gdDisplayAttributeInfo[DISPLAYATTRIBUTE_INFO_NUM] =
{
	{
		ValueDisplayAttrInputMark, c_guidDisplayAttributeInputMark,
		c_daDisplayAttributeSeries[0], c_daDisplayAttributeInputMark
	},
	{
		ValueDisplayAttrInputText, c_guidDisplayAttributeInputText,
		c_daDisplayAttributeSeries[1], c_daDisplayAttributeInputText
	},
	{
		ValueDisplayAttrInputOkuri, c_guidDisplayAttributeInputOkuri,
		c_daDisplayAttributeSeries[2], c_daDisplayAttributeInputOkuri
	},
	{
		ValueDisplayAttrConvMark, c_guidDisplayAttributeConvMark,
		c_daDisplayAttributeSeries[3], c_daDisplayAttributeConvMark
	},
	{
		ValueDisplayAttrConvText, c_guidDisplayAttributeConvText,
		c_daDisplayAttributeSeries[4], c_daDisplayAttributeConvText
	},
	{
		ValueDisplayAttrConvOkuri, c_guidDisplayAttributeConvOkuri,
		c_daDisplayAttributeSeries[5], c_daDisplayAttributeConvOkuri
	},
	{
		ValueDisplayAttrConvAnnot, c_guidDisplayAttributeConvAnnot,
		c_daDisplayAttributeSeries[6], c_daDisplayAttributeConvAnnot
	}
};

// added in Windows 8 SDK
#ifndef _WIN32_WINNT_WIN8

const GUID GUID_TFCAT_TIPCAP_IMMERSIVESUPPORT =
{0x13A016DF, 0x560B, 0x46CD, {0x94, 0x7A, 0x4C, 0x3A, 0xF1, 0xE0, 0xE3, 0x5D}};

const GUID GUID_TFCAT_TIPCAP_SYSTRAYSUPPORT =
{0x25504FB4, 0x7BAB, 0x4BC1, {0x9C, 0x69, 0xCF, 0x81, 0x89, 0x0F, 0x0E, 0xF5}};

const GUID GUID_LBI_INPUTMODE =
{0x2C77A81E, 0x41CC, 0x4178, {0xA3, 0xA7, 0x5F, 0x8A, 0x98, 0x75, 0x68, 0xE6}};

const IID IID_ITfFnGetPreferredTouchKeyboardLayout =
{0x5F309A41, 0x590A, 0x4ACC, {0xA9, 0x7F, 0xD8, 0xEF, 0xFF, 0x13, 0xFD, 0xFC}};

#endif //_WIN32_WINNT_WIN8

{'repo_name': 'nathancorvussolis/corvusskk', 'stars': '115', 'repo_language': 'C', 'file_name': 'license.rtf', 'mime_type': 'text/rtf', 'hash': -1517912888193144546, 'source_dataset': 'data'}


function checkVisible(elm) {
  var rect = elm.getBoundingClientRect();
  var viewHeight = Math.max(document.documentElement.clientHeight, window.innerHeight);
  return !(rect.bottom < 0 || rect.top - viewHeight >= 0);
}

function drawRocket(ctx, x, y, rocketTime = 0, scale = 1, period = 5) {
  //move canvas to the ship and compress in the horizontal direction
  ctx.save();
  ctx.translate(x, y);
  ctx.scale(scale, 1);
  //rocket fins
  ctx.fillStyle = "#D90429";
  ctx.beginPath();
  ctx.moveTo(20, 10);
  ctx.lineTo(-20, -10);
  ctx.quadraticCurveTo(20, -20, 100, 10);
  ctx.closePath();
  ctx.fill();
  //lower fin
  ctx.beginPath();
  ctx.moveTo(20, 90);
  ctx.lineTo(-20, 110);
  ctx.quadraticCurveTo(20, 120, 100, 90);
  ctx.closePath();
  ctx.fill();
  //rocket body
  ctx.fillStyle = "#EDF2F4";
  ctx.beginPath();
  ctx.moveTo(0, 10);
  ctx.quadraticCurveTo(140, -30, 200, 50);
  ctx.quadraticCurveTo(140, 130, 0, 90);
  ctx.closePath();
  ctx.fill();
  //nose
  ctx.fillStyle = "#D90429";
  ctx.globalCompositeOperation = "source-atop";
  ctx.fillRect(180, 29, 20, 42);
  ctx.globalCompositeOperation = "source-over";
  // ctx.beginPath();
  // ctx.moveTo(180, 28);
  // ctx.quadraticCurveTo(203, 49, 200, 50);
  // ctx.quadraticCurveTo(203, 49, 180, 73);
  // ctx.closePath();
  // ctx.fill();

  //clock outline
  ctx.fillStyle = "#D3DBDE";
  ctx.beginPath();
  ctx.arc(80, 50, 45, 0, 2 * Math.PI);
  ctx.fill();
  //clock
  ctx.fillStyle = "#2B2D42";
  ctx.beginPath();
  ctx.moveTo(80, 50);
  // ctx.arc(80, 50, 45, 0, Math.floor(time % (period * 2 * Math.PI * 10)) / 10 / period);
  const percentCircle = ((rocketTime / 60) / period) % 1
  ctx.arc(80, 50, 45, 0, percentCircle * 2 * Math.PI);
  ctx.fill();
  //undo canvas transformations
  ctx.restore();
}

let solver = function () {
  const rockets = {
    gamma: 0,
    t1: 0,
    t2: 0,
    isOn: true
  };

  function update() {
    const v = document.getElementById("velocity").value;
    if (1 - v * v != 0) {
      const time = Number(document.getElementById("time").value);
      const dist = Number(document.getElementById("length").value);
      const mass = Number(document.getElementById("mass").value);
      rockets.gamma = 1 / Math.sqrt(1 - v * v);
      const vTime = time * rockets.gamma;
      const vDist = dist / rockets.gamma;
      const vMass = mass * rockets.gamma;
      document.getElementById("velocity2").value = v * 3;
      document.getElementById("gamma").value = Math.round(rockets.gamma * 1000000000000) / 1000000000000;
      document.getElementById("v_time").value = vTime.toFixed(4);
      document.getElementById("v_length").value = vDist.toFixed(4);
      document.getElementById("v_mass").value = vMass.toFixed(4);
      // document.getElementById("length1").style.width = dist * 10 + "px";
      // document.getElementById("length2").style.width = vDist * 10 + "px";
    }
  }

  function updateMoving() {
    const v = document.getElementById("velocity").value;
    if (1 - v * v != 0) {
      rockets.gamma = 1 / Math.sqrt(1 - v * v);
      const vTime = Number(document.getElementById("v_time").value);
      const vDist = Number(document.getElementById("v_length").value);
      const vMass = Number(document.getElementById("v_mass").value);
      const time = vTime / rockets.gamma;
      const dist = vDist * rockets.gamma;
      const mass = vMass / rockets.gamma;
      document.getElementById("velocity2").value = v * 3;
      document.getElementById("gamma").value = Math.round(rockets.gamma * 1000000000000) / 1000000000000;
      document.getElementById("time").value = time.toFixed(4);
      document.getElementById("length").value = dist.toFixed(4);
      document.getElementById("mass").value = mass.toFixed(4);
      // document.getElementById("length1").style.width = dist * 10 + "px";
      // document.getElementById("length2").style.width = vDist * 10 + "px";
    }
  }

  function convertVelocity() {
    const v = document.getElementById("velocity2").value / 3;
    document.getElementById("velocity").value = v;
    update();
  }

  function convertGamma() {
    const g = document.getElementById("gamma").value;
    document.getElementById("velocity").value = Math.sqrt(1 - (1 / g) * (1 / g));
    update();
  }
  update();

  document.getElementById("velocity").addEventListener("input", update);
  document.getElementById("velocity2").addEventListener("input", convertVelocity);
  document.getElementById("gamma").addEventListener("input", convertGamma);
  document.getElementById("time").addEventListener("input", update);
  document.getElementById("length").addEventListener("input", update);
  document.getElementById("mass").addEventListener("input", update);
  document.getElementById("v_time").addEventListener("input", updateMoving);
  document.getElementById("v_length").addEventListener("input", updateMoving);
  document.getElementById("v_mass").addEventListener("input", updateMoving);

  //draw the clocks
  var canvas = document.getElementById("rockets");
  var ctx = canvas.getContext("2d");

  canvas.addEventListener("click", function () {
    if (rockets.isOn) {
      rockets.isOn = false;
      ctx.clearRect(0, 0, canvas.width, canvas.height);
      drawRocket(ctx, 20, 20, rockets.t1, 1 / rockets.gamma);
      drawRocket(ctx, 320, 20, rockets.t2, 1);
    } else {
      rockets.isOn = true;
    }
  });

  //___________________animation loop ___________________
  const fpsCap = 60;
  const fpsInterval = 1000 / fpsCap;
  let then = Date.now();
  requestAnimationFrame(cycle); //starts game loop

  function cycle() {
    requestAnimationFrame(cycle);
    const now = Date.now();
    const elapsed = now - then; // calc elapsed time since last loop
    if (elapsed > fpsInterval) { // if enough time has elapsed, draw the next frame
      then = now - (elapsed % fpsInterval); // Get ready for next frame by setting then=now.   Also, adjust for fpsInterval not being multiple of 16.67

      //frame capped code here
      if (checkVisible(canvas) && rockets.isOn) {
        if (document.getElementById("time").value != 0) {
          rockets.t1 += 1 / rockets.gamma;
          rockets.t2 += 1;
        }
        ctx.clearRect(0, 0, canvas.width, canvas.height);
        drawRocket(ctx, 20, 20, rockets.t1, 1 / rockets.gamma, Number(document.getElementById("v_time").value / rockets.gamma));
        drawRocket(ctx, 320, 20, rockets.t2, 1, Number(document.getElementById("time").value));
      }
    }
  }

};
solver();

//_____________________________________________________________________
//_____________________________________________________________________
//_____________________________________________________________________
//_____________________________________________________________________
//relative motion
const relative = function () {
  var canvas = document.getElementById("relative");
  var ctx = canvas.getContext("2d");
  canvas.width = window.innerWidth;

  const settings = {
    wallWidth: 200,
    time: 0,
    moveScale: 2
  };

  const stars = [];
  for (let i = 0; i < 50; i++) {
    stars[i] = {
      x: canvas.width * Math.random(),
      y: canvas.height * Math.random()
    }
  }

  function drawStars() {
    ctx.globalCompositeOperation = "destination-over";
    ctx.beginPath();
    for (let i = 0, len = stars.length; i < len; i++) {
      ctx.moveTo(stars[i].x, stars[i].x)
      ctx.arc(stars[i].x, stars[i].y, 1, 0, 2 * Math.PI);
    }
    ctx.fillStyle = "#fff"
    ctx.fill();
    ctx.globalCompositeOperation = "source-over";
  }

  const rocket1 = {
    position: {
      x: canvas.width / 2 - 300,
      y: 25
    },
    velocity: {
      x: 0.95,
      y: 0
    },
    pov: false,
    wall: function () {
      if (this.position.x < -settings.wallWidth) this.position.x = canvas.width + settings.wallWidth;
      if (this.position.x > canvas.width + settings.wallWidth) this.position.x = -settings.wallWidth;
    }
  };

  const rocket2 = {
    position: {
      x: canvas.width / 2 - 300,
      y: 175
    },
    velocity: {
      x: 0.4,
      y: 0
    },
    pov: false,
    wall: function () {
      if (this.position.x < -settings.wallWidth) this.position.x = canvas.width + settings.wallWidth;
      if (this.position.x > canvas.width + settings.wallWidth) this.position.x = -settings.wallWidth;
    }
  };

  const earth = {
    position: {
      x: canvas.width / 2,
      y: 350
    },
    velocity: {
      x: 0,
      y: 0
    },
    pov: true,
    wall: function () {
      if (this.position.x < -settings.wallWidth) this.position.x = canvas.width + settings.wallWidth;
      if (this.position.x > canvas.width + settings.wallWidth) this.position.x = -settings.wallWidth;
    },
    draw: function (x, y, r = 240, color = "#69c") {
      ctx.fillStyle = color;
      ctx.beginPath();
      ctx.arc(x, y + 200, r, 0, 2 * Math.PI * 60);
      ctx.fill();
    }
  };

  //___________________get mouse input___________________
  const mouse = {
    x: 0,
    y: 0
  };
  canvas.onmousemove = function (e) {
    var rect = canvas.getBoundingClientRect();
    mouse.x = e.clientX - rect.left;
    mouse.y = e.clientY - rect.top;
    //cycle observers
    if (mouse.y > 150) {
      if (mouse.y > 300) {
        rocket1.pov = false;
        rocket2.pov = false;
        earth.pov = true;
      } else {
        rocket1.pov = false;
        rocket2.pov = true;
        earth.pov = false;
      }
    } else {
      rocket1.pov = true;
      rocket2.pov = false;
      earth.pov = false;
    }
  };

  function drawFocus() {
    if (rocket1.pov) {
      ctx.strokeStyle = "#2B2D42" //"#D90429"
      ctx.lineWidth = 3
      ctx.beginPath();
      ctx.arc(rocket1.position.x + 80, rocket1.position.y + 50, 45, 0, 2 * Math.PI);
      ctx.stroke();
    }
    if (rocket2.pov) {
      ctx.strokeStyle = "#2B2D42" //"#D90429"
      ctx.lineWidth = 3
      ctx.beginPath();
      ctx.arc(rocket2.position.x + 80, rocket2.position.y + 50, 45, 0, 2 * Math.PI);
      ctx.stroke();
    }
    if (earth.pov) {
      ctx.strokeStyle = "#9cf"
      ctx.lineWidth = 5
      ctx.beginPath();
      ctx.arc(earth.position.x, earth.position.y + 200, 240, 0, 2 * Math.PI);
      ctx.stroke();
    }
  }

  //___________________animation loop ___________________
  function cycle() {
    if (checkVisible(canvas)) {
      ctx.clearRect(0, 0, canvas.width, canvas.height);
      drawRocket(ctx, rocket1.position.x, rocket1.position.y, settings.time);
      drawRocket(ctx, rocket2.position.x, rocket2.position.y, settings.time);
      earth.draw(earth.position.x, earth.position.y);
      drawStars();
      //move
      settings.time++;
      rocket1.position.x += settings.moveScale * (rocket1.velocity.x * !rocket1.pov - rocket2.velocity.x * rocket2.pov - earth.velocity.x * earth.pov);
      rocket2.position.x += settings.moveScale * (rocket2.velocity.x * !rocket2.pov - rocket1.velocity.x * rocket1.pov - earth.velocity.x * earth.pov);
      earth.position.x += settings.moveScale * (earth.velocity.x * !earth.pov - rocket1.velocity.x * rocket1.pov - rocket2.velocity.x * rocket2.pov);
      //wall teleport
      rocket1.wall();
      rocket2.wall();
      earth.wall();
      drawFocus();
    }
    requestAnimationFrame(cycle);
  }
  requestAnimationFrame(cycle);
};
relative();

//_____________________________________________________________________
//_____________________________________________________________________
//_____________________________________________________________________
//_____________________________________________________________________
//_____________________________________________________________________
//special relativity motion
const special = function () {
  var canvas = document.getElementById("special");
  var ctx = canvas.getContext("2d");
  canvas.width = window.innerWidth;

  const settings = {
    wallWidth: 200,
    time: 0,
    moveScale: 1.4
  };

  //velocities are in terms of c
  const gammaCal = function (v1, v2) {
    const v = v1 - v2;
    return 1 / Math.sqrt(1 - v * v);
  };

  const stars = [];
  for (let i = 0; i < 50; i++) {
    stars[i] = {
      x: canvas.width * Math.random(),
      y: canvas.height * Math.random()
    }
  }

  function drawStars() {
    ctx.globalCompositeOperation = "destination-over";
    ctx.beginPath();
    for (let i = 0, len = stars.length; i < len; i++) {
      ctx.moveTo(stars[i].x, stars[i].x)
      ctx.arc(stars[i].x, stars[i].y, 1, 0, 2 * Math.PI);
    }
    ctx.fillStyle = "#fff"
    ctx.fill();
    ctx.globalCompositeOperation = "source-over";
  }

  const rocket1 = {
    position: {
      x: canvas.width / 2 - 300,
      y: 25
    },
    velocity: {
      x: 0.95,
      y: 0
    },
    time: 0,
    pov: false,
    wall: function () {
      if (this.position.x < -settings.wallWidth) this.position.x = canvas.width + settings.wallWidth;
      if (this.position.x > canvas.width + settings.wallWidth) this.position.x = -settings.wallWidth;
    }
  };

  const rocket2 = {
    position: {
      x: canvas.width / 2 - 300,
      y: 175
    },
    velocity: {
      x: 0.4,
      y: 0
    },
    time: 0,
    pov: false,
    wall: function () {
      if (this.position.x < -settings.wallWidth) this.position.x = canvas.width + settings.wallWidth;
      if (this.position.x > canvas.width + settings.wallWidth) this.position.x = -settings.wallWidth;
    }
  };

  const earth = {
    position: {
      x: canvas.width / 2,
      y: 350
    },
    velocity: {
      x: 0,
      y: 0
    },
    time: 0,
    pov: true,
    wall: function () {
      if (this.position.x < -settings.wallWidth) this.position.x = canvas.width + settings.wallWidth;
      if (this.position.x > canvas.width + settings.wallWidth) this.position.x = -settings.wallWidth;
    },
    draw: function (x, y, scale) {
      ctx.save();
      ctx.translate(x, y + 200);
      ctx.scale(scale, 1);
      ctx.fillStyle = "#69c";
      ctx.beginPath();
      ctx.arc(0, 0, 240, 0, 2 * Math.PI * 60);
      ctx.fill();
      ctx.restore();
    }
  };

  //___________________get mouse input___________________
  const mouse = {
    x: 0,
    y: 0
  };
  canvas.onmousemove = function (e) {
    const rect = canvas.getBoundingClientRect();
    mouse.x = e.clientX - rect.left;
    mouse.y = e.clientY - rect.top;
    //cycle observers
    if (mouse.y > 150) {
      if (mouse.y > 300) {
        rocket1.pov = false;
        rocket2.pov = false;
        earth.pov = true;
      } else {
        rocket1.pov = false;
        rocket2.pov = true;
        earth.pov = false;
      }
    } else {
      rocket1.pov = true;
      rocket2.pov = false;
      earth.pov = false;
    }
  };

  function drawFocus() {
    if (rocket1.pov) {
      ctx.strokeStyle = "#2B2D42" //"#D90429"
      ctx.lineWidth = 3
      ctx.beginPath();
      ctx.arc(rocket1.position.x + 80, rocket1.position.y + 50, 45, 0, 2 * Math.PI);
      ctx.stroke();
    }
    if (rocket2.pov) {
      ctx.strokeStyle = "#2B2D42" //"#D90429"
      ctx.lineWidth = 3
      ctx.beginPath();
      ctx.arc(rocket2.position.x + 80, rocket2.position.y + 50, 45, 0, 2 * Math.PI);
      ctx.stroke();
    }
    if (earth.pov) {
      ctx.strokeStyle = "#9cf"
      ctx.lineWidth = 5
      ctx.beginPath();
      ctx.arc(earth.position.x, earth.position.y + 200, 240, 0, 2 * Math.PI);
      ctx.stroke();
    }
  }

  //___________________animation loop ___________________
  function cycle() {
    if (checkVisible(canvas)) {
      //move
      rocket1.time += 1 / gammaCal(rocket1.velocity.x * !rocket1.pov, rocket2.velocity.x * rocket2.pov + earth.velocity.x * earth.pov);
      rocket2.time += 1 / gammaCal(rocket2.velocity.x * !rocket2.pov, rocket1.velocity.x * rocket1.pov + earth.velocity.x * earth.pov);
      earth.time += 1 / gammaCal(earth.velocity.x * !earth.pov, rocket2.velocity.x * rocket2.pov + rocket1.velocity.x * rocket1.pov);
      rocket1.position.x += settings.moveScale * (rocket1.velocity.x * !rocket1.pov - rocket2.velocity.x * rocket2.pov - earth.velocity.x * earth.pov);
      rocket2.position.x += settings.moveScale * (rocket2.velocity.x * !rocket2.pov - rocket1.velocity.x * rocket1.pov - earth.velocity.x * earth.pov);
      earth.position.x += settings.moveScale * (earth.velocity.x * !earth.pov - rocket1.velocity.x * rocket1.pov - rocket2.velocity.x * rocket2.pov);
      //wall teleport
      rocket1.wall();
      rocket2.wall();
      earth.wall();
      //draw
      ctx.clearRect(0, 0, canvas.width, canvas.height);
      drawRocket(
        ctx,
        rocket1.position.x,
        rocket1.position.y,
        rocket1.time,
        1 / gammaCal(rocket1.velocity.x * !rocket1.pov, rocket2.velocity.x * rocket2.pov + earth.velocity.x * earth.pov)
      );

      drawRocket(
        ctx,
        rocket2.position.x,
        rocket2.position.y,
        rocket2.time,
        1 / gammaCal(rocket2.velocity.x * !rocket2.pov, rocket1.velocity.x * rocket1.pov + earth.velocity.x * earth.pov)
      );
      earth.draw(
        earth.position.x,
        earth.position.y,
        1 / gammaCal(earth.velocity.x * !earth.pov, rocket2.velocity.x * rocket2.pov + rocket1.velocity.x * rocket1.pov)
      );
      drawStars();
      drawFocus();
    }
    requestAnimationFrame(cycle);
  }
  requestAnimationFrame(cycle);
};
special();

{'repo_name': 'landgreen/landgreen.github.io', 'stars': '119', 'repo_language': 'JavaScript', 'file_name': 'potential1.js', 'mime_type': 'text/plain', 'hash': -6831745763368983389, 'source_dataset': 'data'}


#pragma once

#include "../Include/Winheaders.h"
#include "../Include/Macro.h"
#include "../Include/Types.h"
#include "../Include/CallResult.h"

#include <stdint.h>
#include <memory>

namespace blackbone
{

/// <summary>
/// Get rid of EXECUTABLE flag if DEP isn't enabled
/// </summary>
/// <param name="prot">Memory protection flags</param>
/// <param name="bDEP">DEP flag</param>
/// <returns>New protection flags</returns>
inline DWORD CastProtection( DWORD prot, bool bDEP )
{
    if (bDEP == true)
    {
        return prot;
    }
    else
    {
        if (prot == PAGE_EXECUTE_READ)
            return PAGE_READONLY;
        else if (prot == PAGE_EXECUTE_READWRITE)
            return PAGE_READWRITE;
        else if (prot == PAGE_EXECUTE_WRITECOPY)
            return PAGE_WRITECOPY;
        else
            return prot;
    }
}

class MemBlock
{
public:
    class MemBlockImpl
    {
        friend class MemBlock;

    public:
        MemBlockImpl() = default;

        /// <summary>
        /// MemBlock_p ctor
        /// </summary>
        /// <param name="mem">Process memory routines</param>
        /// <param name="ptr">Memory address</param>
        /// <param name="size">Block size</param>
        /// <param name="prot">Memory protection</param>
        /// <param name="own">true if caller will be responsible for block deallocation</param>
        MemBlockImpl( class ProcessMemory* mem, ptr_t ptr, size_t size, DWORD prot, bool own = true, bool physical = false );

        ~MemBlockImpl()
        {
            if (_own)
                Free();
        }

        /// <summary>
        /// Free memory
        /// </summary>
        /// <param name="size">Size of memory chunk to free. If 0 - whole block is freed</param>
        NTSTATUS Free( size_t size = 0 );

    private:
        ptr_t  _ptr = 0;                // Raw memory pointer
        size_t _size = 0;               // Region size
        DWORD  _protection = 0;         // Region protection
        bool   _own = true;             // Memory will be freed in destructor
        bool   _physical = false;       // Memory allocated as direct physical
        class ProcessMemory* _memory;   // Target process routines
    };

public:
    /// <summary>
    /// MemBlock ctor
    /// </summary>
    BLACKBONE_API MemBlock() = default;

    /// <summary>
    /// MemBlock ctor
    /// </summary>
    /// <param name="mem">Process memory routines</param>
    /// <param name="ptr">Memory address</param>
    /// <param name="own">true if caller will be responsible for block deallocation</param>
    BLACKBONE_API MemBlock( class ProcessMemory* mem, ptr_t ptr, bool own = true );

    /// <summary>
    /// MemBlock ctor
    /// </summary>
    /// <param name="mem">Process memory routines</param>
    /// <param name="ptr">Memory address</param>
    /// <param name="size">Block size</param>
    /// <param name="prot">Memory protection</param>
    /// <param name="own">true if caller will be responsible for block deallocation</param>
    BLACKBONE_API MemBlock( class ProcessMemory* mem, ptr_t ptr, size_t size, DWORD prot, bool own = true, bool physical = false );

    /// <summary>
    /// Move ctor
    /// </summary>
    /// <param name="rhs">Move from</param>
    BLACKBONE_API MemBlock( MemBlock&& rhs ) { _pImpl.swap( rhs._pImpl ); }
    BLACKBONE_API MemBlock& operator = ( MemBlock&& rhs )
    {
        // Self assign
        if (_pImpl == rhs._pImpl)
            return *this;

        _pImpl.swap( rhs._pImpl );
        return *this;
    }

    /// <summary>
    /// Allocate new memory block
    /// </summary>
    /// <param name="process">Process memory routines</param>
    /// <param name="size">Block size</param>
    /// <param name="desired">Desired base address of new block</param>
    /// <param name="protection">Win32 Memory protection flags</param>
    /// <param name="own">false if caller will be responsible for block deallocation</param>
    /// <returns>Memory block. If failed - returned block will be invalid</returns>
    BLACKBONE_API static call_result_t<MemBlock> Allocate(
        class ProcessMemory& process,
        size_t size,
        ptr_t desired = 0,
        DWORD protection = PAGE_EXECUTE_READWRITE,
        bool own = true
        );

    /// <summary>
    /// Reallocate existing block for new size
    /// </summary>
    /// <param name="size">New block size</param>
    /// <param name="desired">Desired base address of new block</param>
    /// <param name="protection">Memory protection</param>
    /// <returns>New block address</returns>
    BLACKBONE_API call_result_t<ptr_t> Realloc( size_t size, ptr_t desired = 0, DWORD protection = PAGE_EXECUTE_READWRITE );

    /// <summary>
    /// Change memory protection
    /// </summary>
    /// <param name="protection">New protection flags</param>
    /// <param name="offset">Memory offset in block</param>
    /// <param name="size">Block size</param>
    /// <param name="pOld">Old protection flags</param>
    /// <returns>Status</returns>
    BLACKBONE_API NTSTATUS Protect( DWORD protection, uintptr_t offset = 0, size_t size = 0, DWORD* pOld = nullptr );

    /// <summary>
    /// Free memory
    /// </summary>
    /// <param name="size">Size of memory chunk to free. If 0 - whole block is freed</param>
    BLACKBONE_API NTSTATUS Free( size_t size = 0 );

    /// <summary>
    /// Read data
    /// </summary>
    /// <param name="offset">Data offset in block</param>
    /// <param name="size">Size of data to read</param>
    /// <param name="pResult">Output buffer</param>
    /// <param name="handleHoles">
    /// If true, function will try to read all committed pages in range ignoring uncommitted.
    /// Otherwise function will fail if there is at least one non-committed page in region.
    /// </param>
    /// <returns>Status</returns>
    BLACKBONE_API NTSTATUS Read( uintptr_t offset, size_t size, PVOID pResult, bool handleHoles = false );

    /// <summary>
    /// Write data
    /// </summary>
    /// <param name="offset">Data offset in block</param>
    /// <param name="size">Size of data to write</param>
    /// <param name="pData">Buffer to write</param>
    /// <returns>Status</returns>
    BLACKBONE_API NTSTATUS Write( uintptr_t offset, size_t size, const void* pData );

    /// <summary>
    /// Read data
    /// </summary>
    /// <param name="offset">Data offset in block</param>
    /// <param name="def_val">Defult return value if read has failed</param>
    /// <returns>Read data</returns>
    template<typename T>
    T Read( uintptr_t offset, const T& def_val )
    {
        T res = def_val;
        Read( offset, sizeof( T ), &res );
        return res;
    }

    /// <summary>
    /// Read data
    /// </summary>
    /// <param name="offset">Data offset in block</param>
    /// <param name="def_val">Read data</param>
    /// <returns>Status code</returns>
    template<typename T>
    NTSTATUS Read( size_t offset, T& val )
    {
        return Read( offset, sizeof( val ), &val );
    }

    /// <summary>
    /// Write data
    /// </summary>
    /// <param name="offset">Offset in block</param>
    /// <param name="data">Data to write</param>
    /// <returns>Status</returns>
    template<typename T>
    NTSTATUS Write( uintptr_t offset, const T& data )
    {
        return Write( offset, sizeof( data ), &data );
    }

    /// <summary>
    /// Try to free memory and reset pointers
    /// </summary>
    BLACKBONE_API void Reset();

    /// <summary>
    /// Memory will not be deallocated upon object destruction
    /// </summary>
    BLACKBONE_API inline void Release() { if (_pImpl) _pImpl->_own = false; }

    /// <summary>
    /// Get memory pointer
    /// </summary>
    /// <returns>Memory pointer</returns>
    template<typename T = ptr_t>
    inline T ptr() const { return _pImpl ? (T)_pImpl->_ptr : T( 0 ); }

    /// <summary>
    /// Get block size
    /// </summary>
    /// <returns>Block size</returns>
    BLACKBONE_API inline size_t size() const { return _pImpl ? _pImpl->_size : 0; }

    /// <summary>
    /// Get block memory protection
    /// </summary>
    /// <returns>Memory protection flags</returns>
    BLACKBONE_API inline DWORD  protection() const { return _pImpl ? _pImpl->_protection : 0; }

    /// <summary>
    /// Validate memory block
    /// <returns>true if memory pointer isn't 0</returns>
    BLACKBONE_API inline bool valid() const { return( _pImpl.get() != nullptr && _pImpl->_ptr != 0); }

    /// <summary>
    /// Get memory pointer
    /// </summary>
    /// <returns>Memory pointer</returns>
    BLACKBONE_API inline operator ptr_t() const  { return _pImpl ? _pImpl->_ptr : 0; }

private:
    std::shared_ptr<MemBlockImpl> _pImpl;
};

}

{'repo_name': 'DarthTon/Blackbone', 'stars': '2316', 'repo_language': 'C++', 'file_name': 'diacreate.h', 'mime_type': 'text/x-c', 'hash': 1111165561280007022, 'source_dataset': 'data'}


#!/usr/bin/env perl
#
# This file is part of moses.  Its use is licensed under the GNU Lesser General
# Public License version 2.1 or, at your option, any later version.

use warnings;

# experiment.perl support script
# get filtered rule and reordering tables and place them into a configuration file

if (scalar @ARGV < 1 || ! -e $ARGV[0]) {
  die("ERROR: could not find pseudo-config with filtered tables");
}

# read config sections about filtered tables
my @arr;
open(FILTERED, $ARGV[0]) or die "Cannot open: $!";
my $feature_section = 0;
while(my $line = <FILTERED>) {
  chomp($line);
  if ($line =~ /^\[(.+)\]/) {
    $feature_section = ($1 eq "feature");
  }
  next unless $feature_section;
  if ($line =~ /PhraseDictionary/ || $line =~ /RuleTable/ || $line =~ /ProbingPT/ ) {
    print STDERR "pt:$line \n";
    push(@arr, $line);
  }
  elsif ($line =~ /LexicalReordering/) {
    print STDERR "ro:$line \n";
    push(@arr, $line);
  }
}
close(FILTERED);

# pass through master config file and replace table sections
my $ind = 0;
$feature_section = 0;
while(my $line = <STDIN>) {
  chomp($line);
  if ($line =~ /^\[(.+)\]/) {
    $feature_section = ($1 eq "feature");
  }
  if ($feature_section && ($line =~ /PhraseDictionary/ || $line =~ /RuleTable/ || $line =~ /ProbingPT/ )) {
    print $arr[$ind]."\n";
    ++$ind;
  }
  elsif ($feature_section && $line =~ /LexicalReordering/) {
    print $arr[$ind]."\n";
    ++$ind;
  }
  else {
    print "$line\n";
  }
}

{'repo_name': 'moses-smt/mosesdecoder', 'stars': '1181', 'repo_language': 'Roff', 'file_name': 'normal_test.sh', 'mime_type': 'text/x-shellscript', 'hash': 4322571297632810445, 'source_dataset': 'data'}


/* Generated by RuntimeBrowser
   Image: /System/Library/PrivateFrameworks/PassKitCore.framework/PassKitCore
 */

@interface PKPeerPaymentDeviceMetadata : NSObject <NSSecureCoding> {
    NSString * _deviceName;
    NSString * _phoneNumber;
    NSString * _secureElementIdentifier;
    NSString * _serialNumber;
    NSString * _uniqueDeviceIdentifier;
}

@property (nonatomic, copy) NSString *deviceName;
@property (nonatomic, copy) NSString *phoneNumber;
@property (nonatomic, copy) NSString *secureElementIdentifier;
@property (nonatomic, copy) NSString *serialNumber;
@property (nonatomic, copy) NSString *uniqueDeviceIdentifier;

+ (id)deviceMetadataForCurrentDevice;
+ (bool)supportsSecureCoding;

- (void).cxx_destruct;
- (id)description;
- (id)deviceName;
- (id)dictionaryRepresentation;
- (void)encodeWithCoder:(id)arg1;
- (unsigned long long)hash;
- (id)initWithCoder:(id)arg1;
- (bool)isEqual:(id)arg1;
- (bool)isEqualToPeerPaymentDeviceMetadata:(id)arg1;
- (id)phoneNumber;
- (id)secureElementIdentifier;
- (id)serialNumber;
- (void)setDeviceName:(id)arg1;
- (void)setPhoneNumber:(id)arg1;
- (void)setSecureElementIdentifier:(id)arg1;
- (void)setSerialNumber:(id)arg1;
- (void)setUniqueDeviceIdentifier:(id)arg1;
- (id)uniqueDeviceIdentifier;

@end

{'repo_name': 'nst/iOS-Runtime-Headers', 'stars': '7551', 'repo_language': 'Objective-C', 'file_name': 'NPNameParser.h', 'mime_type': 'text/plain', 'hash': -1805818290699716781, 'source_dataset': 'data'}


/*
 * Copyright (C) 2013-2015 RoboVM AB
 *
 * 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 org.robovm.apple.intents;

/*<imports>*/
import java.io.*;
import java.nio.*;
import java.util.*;
import org.robovm.objc.*;
import org.robovm.objc.annotation.*;
import org.robovm.objc.block.*;
import org.robovm.rt.*;
import org.robovm.rt.annotation.*;
import org.robovm.rt.bro.*;
import org.robovm.rt.bro.annotation.*;
import org.robovm.rt.bro.ptr.*;
import org.robovm.apple.foundation.*;
import org.robovm.apple.eventkit.*;
import org.robovm.apple.corelocation.*;
/*</imports>*/

/*<javadoc>*/
/**
 * @since Available in iOS 10.0 and later.
 */
/*</javadoc>*/
/*<annotations>*//*</annotations>*/
/*<visibility>*/public/*</visibility>*/ interface /*<name>*/INSetSeatSettingsInCarIntentHandling/*</name>*/
    /*<implements>*/extends NSObjectProtocol/*</implements>*/ {

    /*<ptr>*/
    /*</ptr>*/
    /*<bind>*/
    /*</bind>*/
    /*<constants>*//*</constants>*/
    /*<properties>*/

    /*</properties>*/
    /*<methods>*/
    @Method(selector = "handleSetSeatSettingsInCar:completion:")
    void handleSetSeatSettingsInCar(INSetSeatSettingsInCarIntent intent, @Block VoidBlock1<INSetSeatSettingsInCarIntentResponse> completion);
    @Method(selector = "confirmSetSeatSettingsInCar:completion:")
    void confirmSetSeatSettingsInCar(INSetSeatSettingsInCarIntent intent, @Block VoidBlock1<INSetSeatSettingsInCarIntentResponse> completion);
    @Method(selector = "resolveEnableHeatingForSetSeatSettingsInCar:withCompletion:")
    void resolveEnableHeatingForSetSeatSettingsInCar(INSetSeatSettingsInCarIntent intent, @Block VoidBlock1<INBooleanResolutionResult> completion);
    @Method(selector = "resolveEnableCoolingForSetSeatSettingsInCar:withCompletion:")
    void resolveEnableCoolingForSetSeatSettingsInCar(INSetSeatSettingsInCarIntent intent, @Block VoidBlock1<INBooleanResolutionResult> completion);
    @Method(selector = "resolveEnableMassageForSetSeatSettingsInCar:withCompletion:")
    void resolveEnableMassageForSetSeatSettingsInCar(INSetSeatSettingsInCarIntent intent, @Block VoidBlock1<INBooleanResolutionResult> completion);
    @Method(selector = "resolveSeatForSetSeatSettingsInCar:withCompletion:")
    void resolveSeatForSetSeatSettingsInCar(INSetSeatSettingsInCarIntent intent, @Block VoidBlock1<INCarSeatResolutionResult> completion);
    @Method(selector = "resolveLevelForSetSeatSettingsInCar:withCompletion:")
    void resolveLevelForSetSeatSettingsInCar(INSetSeatSettingsInCarIntent intent, @Block VoidBlock1<INIntegerResolutionResult> completion);
    @Method(selector = "resolveRelativeLevelSettingForSetSeatSettingsInCar:withCompletion:")
    void resolveRelativeLevelSettingForSetSeatSettingsInCar(INSetSeatSettingsInCarIntent intent, @Block VoidBlock1<INRelativeSettingResolutionResult> completion);
    /**
     * @since Available in iOS 12.0 and later.
     */
    @Method(selector = "resolveCarNameForSetSeatSettingsInCar:withCompletion:")
    void resolveCarNameForSetSeatSettingsInCar(INSetSeatSettingsInCarIntent intent, @Block VoidBlock1<INSpeakableStringResolutionResult> completion);
    /*</methods>*/
    /*<adapter>*/
    /*</adapter>*/
}

{'repo_name': 'MobiVM/robovm', 'stars': '566', 'repo_language': 'Java', 'file_name': 'DebuggerDebugVariableInfo.java', 'mime_type': 'text/plain', 'hash': 798080735691435146, 'source_dataset': 'data'}


/*
 Copyright (c) 2012-2016, Stephane Sudre
 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 WhiteBox 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 OWNER 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.
*/

/*void usage_add(void);

void usage_add_missing_object(void);

void usage_remove(void);

void usage_remove_missing_object(void);

void usage_help(void);

void usage_verb(const char * inError);*/

void usage_get_project(void);

void usage_get_package(void);

void usage_get(void);

void usage_set_project(void);

void usage_set_package(void);

void usage_set(void);

void usage(void);

{'repo_name': 'packagesdev/packages', 'stars': '146', 'repo_language': 'Objective-C', 'file_name': 'Script.xcscheme', 'mime_type': 'text/xml', 'hash': 5422111326808144343, 'source_dataset': 'data'}


// Copyright 2014 Unknwon
//
// 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 ini

import (
	"errors"
	"fmt"
	"strconv"
	"strings"
	"time"
)

// Key represents a key under a section.
type Key struct {
	s               *Section
	name            string
	value           string
	isAutoIncrement bool
	isBooleanType   bool

	isShadow bool
	shadows  []*Key

	Comment string
}

// newKey simply return a key object with given values.
func newKey(s *Section, name, val string) *Key {
	return &Key{
		s:     s,
		name:  name,
		value: val,
	}
}

func (k *Key) addShadow(val string) error {
	if k.isShadow {
		return errors.New("cannot add shadow to another shadow key")
	} else if k.isAutoIncrement || k.isBooleanType {
		return errors.New("cannot add shadow to auto-increment or boolean key")
	}

	shadow := newKey(k.s, k.name, val)
	shadow.isShadow = true
	k.shadows = append(k.shadows, shadow)
	return nil
}

// AddShadow adds a new shadow key to itself.
func (k *Key) AddShadow(val string) error {
	if !k.s.f.options.AllowShadows {
		return errors.New("shadow key is not allowed")
	}
	return k.addShadow(val)
}

// ValueMapper represents a mapping function for values, e.g. os.ExpandEnv
type ValueMapper func(string) string

// Name returns name of key.
func (k *Key) Name() string {
	return k.name
}

// Value returns raw value of key for performance purpose.
func (k *Key) Value() string {
	return k.value
}

// ValueWithShadows returns raw values of key and its shadows if any.
func (k *Key) ValueWithShadows() []string {
	if len(k.shadows) == 0 {
		return []string{k.value}
	}
	vals := make([]string, len(k.shadows)+1)
	vals[0] = k.value
	for i := range k.shadows {
		vals[i+1] = k.shadows[i].value
	}
	return vals
}

// transformValue takes a raw value and transforms to its final string.
func (k *Key) transformValue(val string) string {
	if k.s.f.ValueMapper != nil {
		val = k.s.f.ValueMapper(val)
	}

	// Fail-fast if no indicate char found for recursive value
	if !strings.Contains(val, "%") {
		return val
	}
	for i := 0; i < _DEPTH_VALUES; i++ {
		vr := varPattern.FindString(val)
		if len(vr) == 0 {
			break
		}

		// Take off leading '%(' and trailing ')s'.
		noption := strings.TrimLeft(vr, "%(")
		noption = strings.TrimRight(noption, ")s")

		// Search in the same section.
		nk, err := k.s.GetKey(noption)
		if err != nil {
			// Search again in default section.
			nk, _ = k.s.f.Section("").GetKey(noption)
		}

		// Substitute by new value and take off leading '%(' and trailing ')s'.
		val = strings.Replace(val, vr, nk.value, -1)
	}
	return val
}

// String returns string representation of value.
func (k *Key) String() string {
	return k.transformValue(k.value)
}

// Validate accepts a validate function which can
// return modifed result as key value.
func (k *Key) Validate(fn func(string) string) string {
	return fn(k.String())
}

// parseBool returns the boolean value represented by the string.
//
// It accepts 1, t, T, TRUE, true, True, YES, yes, Yes, y, ON, on, On,
// 0, f, F, FALSE, false, False, NO, no, No, n, OFF, off, Off.
// Any other value returns an error.
func parseBool(str string) (value bool, err error) {
	switch str {
	case "1", "t", "T", "true", "TRUE", "True", "YES", "yes", "Yes", "y", "ON", "on", "On":
		return true, nil
	case "0", "f", "F", "false", "FALSE", "False", "NO", "no", "No", "n", "OFF", "off", "Off":
		return false, nil
	}
	return false, fmt.Errorf("parsing \"%s\": invalid syntax", str)
}

// Bool returns bool type value.
func (k *Key) Bool() (bool, error) {
	return parseBool(k.String())
}

// Float64 returns float64 type value.
func (k *Key) Float64() (float64, error) {
	return strconv.ParseFloat(k.String(), 64)
}

// Int returns int type value.
func (k *Key) Int() (int, error) {
	return strconv.Atoi(k.String())
}

// Int64 returns int64 type value.
func (k *Key) Int64() (int64, error) {
	return strconv.ParseInt(k.String(), 10, 64)
}

// Uint returns uint type valued.
func (k *Key) Uint() (uint, error) {
	u, e := strconv.ParseUint(k.String(), 10, 64)
	return uint(u), e
}

// Uint64 returns uint64 type value.
func (k *Key) Uint64() (uint64, error) {
	return strconv.ParseUint(k.String(), 10, 64)
}

// Duration returns time.Duration type value.
func (k *Key) Duration() (time.Duration, error) {
	return time.ParseDuration(k.String())
}

// TimeFormat parses with given format and returns time.Time type value.
func (k *Key) TimeFormat(format string) (time.Time, error) {
	return time.Parse(format, k.String())
}

// Time parses with RFC3339 format and returns time.Time type value.
func (k *Key) Time() (time.Time, error) {
	return k.TimeFormat(time.RFC3339)
}

// MustString returns default value if key value is empty.
func (k *Key) MustString(defaultVal string) string {
	val := k.String()
	if len(val) == 0 {
		k.value = defaultVal
		return defaultVal
	}
	return val
}

// MustBool always returns value without error,
// it returns false if error occurs.
func (k *Key) MustBool(defaultVal ...bool) bool {
	val, err := k.Bool()
	if len(defaultVal) > 0 && err != nil {
		k.value = strconv.FormatBool(defaultVal[0])
		return defaultVal[0]
	}
	return val
}

// MustFloat64 always returns value without error,
// it returns 0.0 if error occurs.
func (k *Key) MustFloat64(defaultVal ...float64) float64 {
	val, err := k.Float64()
	if len(defaultVal) > 0 && err != nil {
		k.value = strconv.FormatFloat(defaultVal[0], 'f', -1, 64)
		return defaultVal[0]
	}
	return val
}

// MustInt always returns value without error,
// it returns 0 if error occurs.
func (k *Key) MustInt(defaultVal ...int) int {
	val, err := k.Int()
	if len(defaultVal) > 0 && err != nil {
		k.value = strconv.FormatInt(int64(defaultVal[0]), 10)
		return defaultVal[0]
	}
	return val
}

// MustInt64 always returns value without error,
// it returns 0 if error occurs.
func (k *Key) MustInt64(defaultVal ...int64) int64 {
	val, err := k.Int64()
	if len(defaultVal) > 0 && err != nil {
		k.value = strconv.FormatInt(defaultVal[0], 10)
		return defaultVal[0]
	}
	return val
}

// MustUint always returns value without error,
// it returns 0 if error occurs.
func (k *Key) MustUint(defaultVal ...uint) uint {
	val, err := k.Uint()
	if len(defaultVal) > 0 && err != nil {
		k.value = strconv.FormatUint(uint64(defaultVal[0]), 10)
		return defaultVal[0]
	}
	return val
}

// MustUint64 always returns value without error,
// it returns 0 if error occurs.
func (k *Key) MustUint64(defaultVal ...uint64) uint64 {
	val, err := k.Uint64()
	if len(defaultVal) > 0 && err != nil {
		k.value = strconv.FormatUint(defaultVal[0], 10)
		return defaultVal[0]
	}
	return val
}

// MustDuration always returns value without error,
// it returns zero value if error occurs.
func (k *Key) MustDuration(defaultVal ...time.Duration) time.Duration {
	val, err := k.Duration()
	if len(defaultVal) > 0 && err != nil {
		k.value = defaultVal[0].String()
		return defaultVal[0]
	}
	return val
}

// MustTimeFormat always parses with given format and returns value without error,
// it returns zero value if error occurs.
func (k *Key) MustTimeFormat(format string, defaultVal ...time.Time) time.Time {
	val, err := k.TimeFormat(format)
	if len(defaultVal) > 0 && err != nil {
		k.value = defaultVal[0].Format(format)
		return defaultVal[0]
	}
	return val
}

// MustTime always parses with RFC3339 format and returns value without error,
// it returns zero value if error occurs.
func (k *Key) MustTime(defaultVal ...time.Time) time.Time {
	return k.MustTimeFormat(time.RFC3339, defaultVal...)
}

// In always returns value without error,
// it returns default value if error occurs or doesn't fit into candidates.
func (k *Key) In(defaultVal string, candidates []string) string {
	val := k.String()
	for _, cand := range candidates {
		if val == cand {
			return val
		}
	}
	return defaultVal
}

// InFloat64 always returns value without error,
// it returns default value if error occurs or doesn't fit into candidates.
func (k *Key) InFloat64(defaultVal float64, candidates []float64) float64 {
	val := k.MustFloat64()
	for _, cand := range candidates {
		if val == cand {
			return val
		}
	}
	return defaultVal
}

// InInt always returns value without error,
// it returns default value if error occurs or doesn't fit into candidates.
func (k *Key) InInt(defaultVal int, candidates []int) int {
	val := k.MustInt()
	for _, cand := range candidates {
		if val == cand {
			return val
		}
	}
	return defaultVal
}

// InInt64 always returns value without error,
// it returns default value if error occurs or doesn't fit into candidates.
func (k *Key) InInt64(defaultVal int64, candidates []int64) int64 {
	val := k.MustInt64()
	for _, cand := range candidates {
		if val == cand {
			return val
		}
	}
	return defaultVal
}

// InUint always returns value without error,
// it returns default value if error occurs or doesn't fit into candidates.
func (k *Key) InUint(defaultVal uint, candidates []uint) uint {
	val := k.MustUint()
	for _, cand := range candidates {
		if val == cand {
			return val
		}
	}
	return defaultVal
}

// InUint64 always returns value without error,
// it returns default value if error occurs or doesn't fit into candidates.
func (k *Key) InUint64(defaultVal uint64, candidates []uint64) uint64 {
	val := k.MustUint64()
	for _, cand := range candidates {
		if val == cand {
			return val
		}
	}
	return defaultVal
}

// InTimeFormat always parses with given format and returns value without error,
// it returns default value if error occurs or doesn't fit into candidates.
func (k *Key) InTimeFormat(format string, defaultVal time.Time, candidates []time.Time) time.Time {
	val := k.MustTimeFormat(format)
	for _, cand := range candidates {
		if val == cand {
			return val
		}
	}
	return defaultVal
}

// InTime always parses with RFC3339 format and returns value without error,
// it returns default value if error occurs or doesn't fit into candidates.
func (k *Key) InTime(defaultVal time.Time, candidates []time.Time) time.Time {
	return k.InTimeFormat(time.RFC3339, defaultVal, candidates)
}

// RangeFloat64 checks if value is in given range inclusively,
// and returns default value if it's not.
func (k *Key) RangeFloat64(defaultVal, min, max float64) float64 {
	val := k.MustFloat64()
	if val < min || val > max {
		return defaultVal
	}
	return val
}

// RangeInt checks if value is in given range inclusively,
// and returns default value if it's not.
func (k *Key) RangeInt(defaultVal, min, max int) int {
	val := k.MustInt()
	if val < min || val > max {
		return defaultVal
	}
	return val
}

// RangeInt64 checks if value is in given range inclusively,
// and returns default value if it's not.
func (k *Key) RangeInt64(defaultVal, min, max int64) int64 {
	val := k.MustInt64()
	if val < min || val > max {
		return defaultVal
	}
	return val
}

// RangeTimeFormat checks if value with given format is in given range inclusively,
// and returns default value if it's not.
func (k *Key) RangeTimeFormat(format string, defaultVal, min, max time.Time) time.Time {
	val := k.MustTimeFormat(format)
	if val.Unix() < min.Unix() || val.Unix() > max.Unix() {
		return defaultVal
	}
	return val
}

// RangeTime checks if value with RFC3339 format is in given range inclusively,
// and returns default value if it's not.
func (k *Key) RangeTime(defaultVal, min, max time.Time) time.Time {
	return k.RangeTimeFormat(time.RFC3339, defaultVal, min, max)
}

// Strings returns list of string divided by given delimiter.
func (k *Key) Strings(delim string) []string {
	str := k.String()
	if len(str) == 0 {
		return []string{}
	}

	vals := strings.Split(str, delim)
	for i := range vals {
		// vals[i] = k.transformValue(strings.TrimSpace(vals[i]))
		vals[i] = strings.TrimSpace(vals[i])
	}
	return vals
}

// StringsWithShadows returns list of string divided by given delimiter.
// Shadows will also be appended if any.
func (k *Key) StringsWithShadows(delim string) []string {
	vals := k.ValueWithShadows()
	results := make([]string, 0, len(vals)*2)
	for i := range vals {
		if len(vals) == 0 {
			continue
		}

		results = append(results, strings.Split(vals[i], delim)...)
	}

	for i := range results {
		results[i] = k.transformValue(strings.TrimSpace(results[i]))
	}
	return results
}

// Float64s returns list of float64 divided by given delimiter. Any invalid input will be treated as zero value.
func (k *Key) Float64s(delim string) []float64 {
	vals, _ := k.parseFloat64s(k.Strings(delim), true, false)
	return vals
}

// Ints returns list of int divided by given delimiter. Any invalid input will be treated as zero value.
func (k *Key) Ints(delim string) []int {
	vals, _ := k.parseInts(k.Strings(delim), true, false)
	return vals
}

// Int64s returns list of int64 divided by given delimiter. Any invalid input will be treated as zero value.
func (k *Key) Int64s(delim string) []int64 {
	vals, _ := k.parseInt64s(k.Strings(delim), true, false)
	return vals
}

// Uints returns list of uint divided by given delimiter. Any invalid input will be treated as zero value.
func (k *Key) Uints(delim string) []uint {
	vals, _ := k.parseUints(k.Strings(delim), true, false)
	return vals
}

// Uint64s returns list of uint64 divided by given delimiter. Any invalid input will be treated as zero value.
func (k *Key) Uint64s(delim string) []uint64 {
	vals, _ := k.parseUint64s(k.Strings(delim), true, false)
	return vals
}

// TimesFormat parses with given format and returns list of time.Time divided by given delimiter.
// Any invalid input will be treated as zero value (0001-01-01 00:00:00 +0000 UTC).
func (k *Key) TimesFormat(format, delim string) []time.Time {
	vals, _ := k.parseTimesFormat(format, k.Strings(delim), true, false)
	return vals
}

// Times parses with RFC3339 format and returns list of time.Time divided by given delimiter.
// Any invalid input will be treated as zero value (0001-01-01 00:00:00 +0000 UTC).
func (k *Key) Times(delim string) []time.Time {
	return k.TimesFormat(time.RFC3339, delim)
}

// ValidFloat64s returns list of float64 divided by given delimiter. If some value is not float, then
// it will not be included to result list.
func (k *Key) ValidFloat64s(delim string) []float64 {
	vals, _ := k.parseFloat64s(k.Strings(delim), false, false)
	return vals
}

// ValidInts returns list of int divided by given delimiter. If some value is not integer, then it will
// not be included to result list.
func (k *Key) ValidInts(delim string) []int {
	vals, _ := k.parseInts(k.Strings(delim), false, false)
	return vals
}

// ValidInt64s returns list of int64 divided by given delimiter. If some value is not 64-bit integer,
// then it will not be included to result list.
func (k *Key) ValidInt64s(delim string) []int64 {
	vals, _ := k.parseInt64s(k.Strings(delim), false, false)
	return vals
}

// ValidUints returns list of uint divided by given delimiter. If some value is not unsigned integer,
// then it will not be included to result list.
func (k *Key) ValidUints(delim string) []uint {
	vals, _ := k.parseUints(k.Strings(delim), false, false)
	return vals
}

// ValidUint64s returns list of uint64 divided by given delimiter. If some value is not 64-bit unsigned
// integer, then it will not be included to result list.
func (k *Key) ValidUint64s(delim string) []uint64 {
	vals, _ := k.parseUint64s(k.Strings(delim), false, false)
	return vals
}

// ValidTimesFormat parses with given format and returns list of time.Time divided by given delimiter.
func (k *Key) ValidTimesFormat(format, delim string) []time.Time {
	vals, _ := k.parseTimesFormat(format, k.Strings(delim), false, false)
	return vals
}

// ValidTimes parses with RFC3339 format and returns list of time.Time divided by given delimiter.
func (k *Key) ValidTimes(delim string) []time.Time {
	return k.ValidTimesFormat(time.RFC3339, delim)
}

// StrictFloat64s returns list of float64 divided by given delimiter or error on first invalid input.
func (k *Key) StrictFloat64s(delim string) ([]float64, error) {
	return k.parseFloat64s(k.Strings(delim), false, true)
}

// StrictInts returns list of int divided by given delimiter or error on first invalid input.
func (k *Key) StrictInts(delim string) ([]int, error) {
	return k.parseInts(k.Strings(delim), false, true)
}

// StrictInt64s returns list of int64 divided by given delimiter or error on first invalid input.
func (k *Key) StrictInt64s(delim string) ([]int64, error) {
	return k.parseInt64s(k.Strings(delim), false, true)
}

// StrictUints returns list of uint divided by given delimiter or error on first invalid input.
func (k *Key) StrictUints(delim string) ([]uint, error) {
	return k.parseUints(k.Strings(delim), false, true)
}

// StrictUint64s returns list of uint64 divided by given delimiter or error on first invalid input.
func (k *Key) StrictUint64s(delim string) ([]uint64, error) {
	return k.parseUint64s(k.Strings(delim), false, true)
}

// StrictTimesFormat parses with given format and returns list of time.Time divided by given delimiter
// or error on first invalid input.
func (k *Key) StrictTimesFormat(format, delim string) ([]time.Time, error) {
	return k.parseTimesFormat(format, k.Strings(delim), false, true)
}

// StrictTimes parses with RFC3339 format and returns list of time.Time divided by given delimiter
// or error on first invalid input.
func (k *Key) StrictTimes(delim string) ([]time.Time, error) {
	return k.StrictTimesFormat(time.RFC3339, delim)
}

// parseFloat64s transforms strings to float64s.
func (k *Key) parseFloat64s(strs []string, addInvalid, returnOnInvalid bool) ([]float64, error) {
	vals := make([]float64, 0, len(strs))
	for _, str := range strs {
		val, err := strconv.ParseFloat(str, 64)
		if err != nil && returnOnInvalid {
			return nil, err
		}
		if err == nil || addInvalid {
			vals = append(vals, val)
		}
	}
	return vals, nil
}

// parseInts transforms strings to ints.
func (k *Key) parseInts(strs []string, addInvalid, returnOnInvalid bool) ([]int, error) {
	vals := make([]int, 0, len(strs))
	for _, str := range strs {
		val, err := strconv.Atoi(str)
		if err != nil && returnOnInvalid {
			return nil, err
		}
		if err == nil || addInvalid {
			vals = append(vals, val)
		}
	}
	return vals, nil
}

// parseInt64s transforms strings to int64s.
func (k *Key) parseInt64s(strs []string, addInvalid, returnOnInvalid bool) ([]int64, error) {
	vals := make([]int64, 0, len(strs))
	for _, str := range strs {
		val, err := strconv.ParseInt(str, 10, 64)
		if err != nil && returnOnInvalid {
			return nil, err
		}
		if err == nil || addInvalid {
			vals = append(vals, val)
		}
	}
	return vals, nil
}

// parseUints transforms strings to uints.
func (k *Key) parseUints(strs []string, addInvalid, returnOnInvalid bool) ([]uint, error) {
	vals := make([]uint, 0, len(strs))
	for _, str := range strs {
		val, err := strconv.ParseUint(str, 10, 0)
		if err != nil && returnOnInvalid {
			return nil, err
		}
		if err == nil || addInvalid {
			vals = append(vals, uint(val))
		}
	}
	return vals, nil
}

// parseUint64s transforms strings to uint64s.
func (k *Key) parseUint64s(strs []string, addInvalid, returnOnInvalid bool) ([]uint64, error) {
	vals := make([]uint64, 0, len(strs))
	for _, str := range strs {
		val, err := strconv.ParseUint(str, 10, 64)
		if err != nil && returnOnInvalid {
			return nil, err
		}
		if err == nil || addInvalid {
			vals = append(vals, val)
		}
	}
	return vals, nil
}

// parseTimesFormat transforms strings to times in given format.
func (k *Key) parseTimesFormat(format string, strs []string, addInvalid, returnOnInvalid bool) ([]time.Time, error) {
	vals := make([]time.Time, 0, len(strs))
	for _, str := range strs {
		val, err := time.Parse(format, str)
		if err != nil && returnOnInvalid {
			return nil, err
		}
		if err == nil || addInvalid {
			vals = append(vals, val)
		}
	}
	return vals, nil
}

// SetValue changes key value.
func (k *Key) SetValue(v string) {
	if k.s.f.BlockMode {
		k.s.f.lock.Lock()
		defer k.s.f.lock.Unlock()
	}

	k.value = v
	k.s.keysHash[k.name] = v
}

{'repo_name': 'bndw/pick', 'stars': '345', 'repo_language': 'Go', 'file_name': 'safe.go', 'mime_type': 'text/plain', 'hash': 8715859093506799340, 'source_dataset': 'data'}


from fastapi import FastAPI

app = FastAPI()

@app.get("/items/", operation_id="some_specific_id_you_define")
async def read_items():
    return [{"item_id": "Foo"}]

{'repo_name': 'tiangolo/fastapi', 'stars': '18021', 'repo_language': 'Python', 'file_name': 'tutorial005.py', 'mime_type': 'text/x-python', 'hash': -4979248922361274354, 'source_dataset': 'data'}


#ifndef BOOST_SERIALIZATION_UNORDERED_COLLECTIONS_LOAD_IMP_HPP
#define BOOST_SERIALIZATION_UNORDERED_COLLECTIONS_LOAD_IMP_HPP

// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
# pragma warning (disable : 4786) // too long name, harmless warning
#endif

/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// unordered_collections_load_imp.hpp: serialization for loading stl collections

// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (C) Copyright 2014 Jim Bell
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

//  See http://www.boost.org for updates, documentation, and revision history.

// helper function templates for serialization of collections

#include <boost/assert.hpp>
#include <cstddef> // size_t
#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
    using ::size_t;
} // namespace std
#endif
#include <boost/detail/workaround.hpp>

#include <boost/archive/detail/basic_iarchive.hpp>
#include <boost/serialization/access.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/detail/stack_constructor.hpp>
#include <boost/serialization/collection_size_type.hpp>
#include <boost/serialization/item_version_type.hpp>

namespace boost{
namespace serialization {
namespace stl {

//////////////////////////////////////////////////////////////////////
// implementation of serialization for STL containers
//
template<class Archive, class Container, class InputFunction>
inline void load_unordered_collection(Archive & ar, Container &s)
{
    collection_size_type count;
    collection_size_type bucket_count;
    boost::serialization::item_version_type item_version(0);
    boost::archive::library_version_type library_version(
        ar.get_library_version()
    );
    // retrieve number of elements
    ar >> BOOST_SERIALIZATION_NVP(count);
    ar >> BOOST_SERIALIZATION_NVP(bucket_count);
    if(boost::archive::library_version_type(3) < library_version){
        ar >> BOOST_SERIALIZATION_NVP(item_version);
    }
    s.clear();
    s.rehash(bucket_count);
    InputFunction ifunc;
    while(count-- > 0){
        ifunc(ar, s, item_version);
    }
}

} // namespace stl
} // namespace serialization
} // namespace boost

#endif //BOOST_SERIALIZATION_UNORDERED_COLLECTIONS_LOAD_IMP_HPP

{'repo_name': 'CheckPointSW/InviZzzible', 'stars': '246', 'repo_language': 'C++', 'file_name': 'stack.hpp', 'mime_type': 'text/x-c', 'hash': -7616057212863149213, 'source_dataset': 'data'}


param(
    [Parameter(Mandatory=$true)][String]$PluginDir
)

$DeinVimRepo = "https://github.com/Shougo/dein.vim"

# Convert the installation directory to absolute path and create plugin directory
$PluginDir = (New-Item -Type Directory -Force $PluginDir).FullName

$InstallDir = Join-Path $PluginDir "repos/github.com/Shougo/dein.vim"
Write-Output "Install to `"$InstallDir`"..."
if (Test-Path $InstallDir) {
    Write-Output "`"$InstallDir`" already exists!"
}

# check git command
if (!(Get-Command git -ErrorAction SilentlyContinue -OutVariable $_)) {
    throw 'Please install git or update your path to include the git executable!'
}
Write-Output ""

# make plugin dir and fetch dein
Write-Output "Begin fetching dein..."
git clone $DeinVimRepo $InstallDir
Write-Output "Done.`n"

Write-Host -ForegroundColor Yellow "Please add the following settings for dein to the top of your vimrc (Vim) or init.vim (NeoVim) file:"

Write-Output ""
Write-Output ""
Write-Output "`"dein Scripts-----------------------------"
Write-Output "if &compatible"
Write-Output "  set nocompatible               `" Be iMproved"
Write-Output "endif"
Write-Output ""
Write-Output "`" Required:"
Write-Output "set runtimepath+=$InstallDir"
Write-Output ""
Write-Output "`" Required:"
Write-Output "if dein#load_state('$PluginDir')"
Write-Output "  call dein#begin('$PluginDir')"
Write-Output ""
Write-Output "  `" Let dein manage dein"
Write-Output "  `" Required:"
Write-Output "  call dein#add('$InstallDir')"
Write-Output ""
Write-Output "  `" Add or remove your plugins here like this:"
Write-Output "  `"call dein#add('Shougo/neosnippet.vim')"
Write-Output "  `"call dein#add('Shougo/neosnippet-snippets')"
Write-Output ""
Write-Output "  `" Required:"
Write-Output "  call dein#end()"
Write-Output "  call dein#save_state()"
Write-Output "endif"
Write-Output ""
Write-Output "`" Required:"
Write-Output "filetype plugin indent on"
Write-Output "syntax enable"
Write-Output ""
Write-Output "`" If you want to install not installed plugins on startup."
Write-Output "`"if dein#check_install()"
Write-Output "`"  call dein#install()"
Write-Output "`"endif"
Write-Output ""
Write-Output "`"End dein Scripts-------------------------"
Write-Output ""
Write-Output ""

Write-Output "Done."

Write-Output "Complete setup dein!"

{'repo_name': 'SpaceVim/SpaceVim', 'stars': '14199', 'repo_language': 'Vim script', 'file_name': 'about.md', 'mime_type': 'text/plain', 'hash': -3650770205292314124, 'source_dataset': 'data'}