text:
package org.botdefender.collector;

public class CollectorConfiguration {
    private int listenerPort;
    private int messageQueueSize;
    private int messageWriterMaxBatchSize;
    private String writerCollectionName;
    private String writerDatabaseName;
    private long writerMaxCollectionSizeBytes;

    public int getListenerPort() {
        return listenerPort;
    }

    public void setListenerPort(int listenerPort) {
        this.listenerPort = listenerPort;
    }

    public int getMessageQueueSize() {
        return messageQueueSize;
    }

    public void setMessageQueueSize(int messageQueueSize) {
        this.messageQueueSize = messageQueueSize;
    }

    public int getMessageWriterMaxBatchSize() {
        return messageWriterMaxBatchSize;
    }

    public void setMessageWriterMaxBatchSize(int messageWriterMaxBatchSize) {
        this.messageWriterMaxBatchSize = messageWriterMaxBatchSize;
    }

    public String getWriterCollectionName() {
        return writerCollectionName;
    }

    public void setWriterCollectionName(String writerCollectionName) {
        this.writerCollectionName = writerCollectionName;
    }

    public String getWriterDatabaseName() {
        return writerDatabaseName;
    }

    public void setWriterDatabaseName(String writerDatabaseName) {
        this.writerDatabaseName = writerDatabaseName;
    }

    public long getWriterMaxCollectionSizeBytes() {
        return writerMaxCollectionSizeBytes;
    }

    public void setWriterMaxCollectionSizeBytes(long writerMaxCollectionSizeBytes) {
        this.writerMaxCollectionSizeBytes = writerMaxCollectionSizeBytes;
    }
}


text:
Bathchat facilitates non-committal multimedia communication while bathing via an iPhone app, for software designers and developers.

This was a class assignment. The [final presentation](https://speakerdeck.com/theopak/bathchat) was given on the same day that Snapchat shipped Chat and video Chat :sweat:

## Authors

- [Trevor Phillippi](http://trev.guru): design lead
- [Derek Schultz](http://derek-schultz.net): iOS development lead
- [Theo Pak](http://theopak.com): person that did all the work that the class actually graded us on. also wrote a couple small things.

redpajama_set_name: RedPajamaGithub


text:
namespace Envoy {
namespace Fuzz {

void Runner::execute(const uint8_t* buf, size_t len) {
  Envoy::Base64::encode(reinterpret_cast<const char*>(buf), len);
}

} // namespace Fuzz
} // namespace Envoy


text:
cask 'google-play-music-desktop-player' do
  version '3.5.0'
  sha256 'b1b636bbf56e159552053288a7a131432d7292bde210b741d801da12c955fe17'

  # github.com/MarshallOfSound/Google-Play-Music-Desktop-Player-UNOFFICIAL- was verified as official when first introduced to the cask
  url "https://github.com/MarshallOfSound/Google-Play-Music-Desktop-Player-UNOFFICIAL-/releases/download/v#{version}/Google.Play.Music.Desktop.Player.OSX.zip"
  appcast 'https://github.com/MarshallOfSound/Google-Play-Music-Desktop-Player-UNOFFICIAL-/releases.atom',
          checkpoint: 'e22408e2c086ba374e354e87cc27986a8a15462e750e8bd2ac70180c66c8d82d'
  name 'Google Play Music Desktop Player'
  homepage 'https://www.googleplaymusicdesktopplayer.com/'
  license :mit

  app 'Google Play Music Desktop Player.app'

  zap delete: [
                '~/Library/Application\ Support/Google\ Play\ Music\ Desktop\ Player',
                '~/Library/Application\ Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/google-play-music-desktop-player.sfl',
                '~/Library/Application\ Support/google-play-music-desktop-player.ShipIt',
                '~/Library/Caches/Google\ Play\ Music\ Desktop\ Player',
                '~/Library/Caches/google-play-music-desktop-player',
                '~/Library/Cookies/google-play-music-desktop-player.binarycookies',
                '~/Library/Preferences/google-play-music-desktop-player.plist',
                '~/Library/Saved\ Application\ State/google-play-music-desktop-player.savedState',
              ]
end


text:
String.prototype.replaceAll = function(search, replacement) {
    let target = this;
    return target.replace(new RegExp(search, 'g'), replacement);
};


text:
package org.arakhne.afc.inputoutput.xml;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import java.util.UUID;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.w3c.dom.Element;

@SuppressWarnings("all")
public class XMLValueConstraintTest {

	private String name;

	private UUID value;

	private XMLValueConstraint<UUID> constraint;

	@Before
	public void setUp() {
		this.name = UUID.randomUUID().toString();
		this.value = UUID.randomUUID();
		this.constraint = new XMLValueConstraint<UUID>(this.name, this.value) {

			@Override
			protected UUID convertValue(String stringValue) {
				return UUID.fromString(stringValue);
			}

		};
	}

	@After
	public void tearDown() {
		this.constraint = null;
		this.name = null;
	}

	@Test
	public void isValidElement_valid() {
		Element element = mock(Element.class);
		when(element.getAttribute(anyString())).then((inv) -> {
			if (this.name.equals(inv.getArgument(0))) {
				return this.value.toString();
			}
			fail("Invalid attribute name"); //$NON-NLS-1$
			return null;
		});
		assertTrue(this.constraint.isValidElement(element));
	}

	@Test
	public void isValidElement_invalid() {
		Element element = mock(Element.class);
		when(element.getAttribute(anyString())).then((inv) -> {
			if (this.name.equals(inv.getArgument(0))) {
				return UUID.randomUUID().toString();
			}
			fail("Invalid attribute name"); //$NON-NLS-1$
			return null;
		});
		assertFalse(this.constraint.isValidElement(element));
	}

}


text:
using System;
using System.Diagnostics.CodeAnalysis;

namespace Core.Common.Exceptions
{
    [ExcludeFromCodeCoverage]
    [Serializable]
    public class ResourceNotFoundException : Exception
    {
        public ResourceNotFoundException(string message) : base(message)
        {

        }
    }
}


text:
package com.netflix.governator.lifecycle;

import static org.objectweb.asm.ClassReader.SKIP_CODE;

import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.netflix.governator.internal.scanner.ClasspathUrlDecoder;
import com.netflix.governator.internal.scanner.DirectoryClassFilter;

import org.objectweb.asm.ClassReader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.URL;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Set;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;

/**
 * Utility to find annotated classes
 */
public class ClasspathScanner {
    private static final Logger log = LoggerFactory.getLogger(ClasspathScanner.class);
    protected final ClassLoader classLoader;

    private final Set<Class<?>> classes;
    private final Set<Constructor> constructors;
    private final Set<Method> methods;
    private final Set<Field> fields;

    /**
     * @param basePackages list of packages to search (recursively)
     * @param annotations class annotations to search for
     */
    public ClasspathScanner(Collection<String> basePackages, Collection<Class<? extends Annotation>> annotations) {
        this(basePackages, annotations, Thread.currentThread().getContextClassLoader());
    }

    /**
     * @param basePackages list of packages to search (recursively)
     * @param annotations class annotations to search for
     * @param classLoader ClassLoader containing the classes to be scanned
     */
    public ClasspathScanner(Collection<String> basePackages, Collection<Class<? extends Annotation>> annotations, final ClassLoader classLoader)  {
        Preconditions.checkNotNull(annotations, "annotations cannot be null");
        Preconditions.checkNotNull(classLoader, "classLoader cannot be null");

        log.debug("Starting classpath scanning...");
        this.classLoader = classLoader;

        Set<Class<?>>       localClasses = Sets.newHashSet();
        Set<Constructor>    localConstructors = Sets.newHashSet();
        Set<Method>         localMethods = Sets.newHashSet();
        Set<Field>          localFields = Sets.newHashSet();

        doScanning(basePackages, annotations, localClasses, localConstructors, localMethods, localFields);

        classes = ImmutableSet.copyOf(localClasses);
        constructors = ImmutableSet.copyOf(localConstructors);
        methods = ImmutableSet.copyOf(localMethods);
        fields = ImmutableSet.copyOf(localFields);

        log.debug("Classpath scanning done");
    }

    /**
     * @return the found classes
     */
    public Set<Class<?>> getClasses() {
        return classes;
    }

    public Set<Constructor> getConstructors() {
        return constructors;
    }

    public Set<Method> getMethods() {
        return methods;
    }

    public Set<Field> getFields() {
        return fields;
    }

    protected void doScanning(Collection<String> basePackages, Collection<Class<? extends Annotation>> annotations, Set<Class<?>> localClasses, Set<Constructor> localConstructors, Set<Method> localMethods, Set<Field> localFields) {
        if ( basePackages.isEmpty() ) {
            log.warn("No base packages specified - no classpath scanning will be done");
            return;
        }
        log.info("Scanning packages : " + basePackages + " for annotations " + annotations);

        for ( String basePackage : basePackages )  {
            try {
            	String basePackageWithSlashes = basePackage.replace(".", "/");
            	Enumeration<URL> resources = classLoader.getResources(basePackageWithSlashes);
                while ( resources.hasMoreElements() ) {
                    URL url = resources.nextElement();
                    try {
                        if ( isJarURL(url)) {
                            String jarPath = url.getFile();
                            if ( jarPath.contains("!") ) {
                                jarPath = jarPath.substring(0, jarPath.indexOf("!"));
                                url = new URL(jarPath);
                            }
                            File file = ClasspathUrlDecoder.toFile(url);
                            try (JarFile jar = new JarFile(file)) {
                                for ( Enumeration<JarEntry> list = jar.entries(); list.hasMoreElements(); ) {
                                    JarEntry entry = list.nextElement();
                                    try {
                                        if ( entry.getName().endsWith(".class") && entry.getName().startsWith(basePackageWithSlashes)) {
                                            AnnotationFinder finder = new AnnotationFinder(classLoader, annotations);
                                            new ClassReader(jar.getInputStream(entry)).accept(finder, SKIP_CODE);

                                            applyFinderResults(localClasses, localConstructors, localMethods, localFields, finder);
                                        }
                                    }
                                    catch (Exception e) {
                                        log.debug("Unable to scan JarEntry '{}' in '{}'. {}", new Object[]{entry.getName(), file.getCanonicalPath(), e.getMessage()});
                                    }
                                }
                            }
                            catch (Exception e ) {
                                log.debug("Unable to scan '{}'. {}", new Object[]{file.getCanonicalPath(), e.getMessage()});
                            }
                        }
                        else {
                            DirectoryClassFilter filter = new DirectoryClassFilter(classLoader);
                            for ( String className : filter.filesInPackage(url, basePackage) ) {
                                AnnotationFinder finder = new AnnotationFinder(classLoader, annotations);
                                new ClassReader(filter.bytecodeOf(className)).accept(finder, SKIP_CODE);

                                applyFinderResults(localClasses, localConstructors, localMethods, localFields, finder);
                            }
                        }
                    }
                    catch (Exception e) {
                        log.debug("Unable to scan jar '{}'. {} ", new Object[]{url, e.getMessage()});
                    }
                }
            }
            catch ( Exception e ) {
                throw new RuntimeException("Classpath scanning failed for package \'" + basePackage + "\'", e);
            }
        }
    }

    private void applyFinderResults(Set<Class<?>> localClasses, Set<Constructor> localConstructors, Set<Method> localMethods, Set<Field> localFields, AnnotationFinder finder) {
        for (Class<?> cls : finder.getAnnotatedClasses()) {
            if (localClasses.contains(cls)) {
                log.debug(String.format("Duplicate class found for '%s'", cls.getCanonicalName()));
            }
            else {
                localClasses.add(cls);
            }
        }

        for (Method method : finder.getAnnotatedMethods()) {
            if (localMethods.contains(method)) {
                log.debug(String.format("Duplicate method found for '%s:%s'", method.getClass().getCanonicalName(), method.getName()));
            }
            else {
                localMethods.add(method);
            }
        }

        for (Constructor<?> ctor : finder.getAnnotatedConstructors()) {
            if (localConstructors.contains(ctor)) {
                log.debug(String.format("Duplicate constructor found for '%s:%s'", ctor.getClass().getCanonicalName(), ctor.toString()));
            }
            else {
                localConstructors.add(ctor);
            }
        }

        for (Field field : finder.getAnnotatedFields()) {
            if (localFields.contains(field)) {
                log.debug(String.format("Duplicate field found for '%s:%s'", field.getClass().getCanonicalName(), field.toString()));
            }
            else {
                localFields.add(field);
            }
        }
    }

    private boolean isJarURL(URL url) {
        String protocol = url.getProtocol();
        return "zip".equals(protocol) || "jar".equals(protocol) ||
                ("file".equals(protocol) && url.getPath().endsWith(".jar"));
    }
}


text:
package com.zandero.rest.injection;

import java.util.HashMap;

/**
 *
 */
public class Settings extends HashMap<String, String> {
}


text:
package mx.itesm.logistics.vehicle_tracking.model;

import android.os.Parcel;

import com.loopj.android.http.RequestParams;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.HashMap;

import edu.mit.lastmite.insight_library.model.Location;
import edu.mit.lastmite.insight_library.model.User;

public class Driver extends User {
    public static final String JSON_WRAPPER = "driver";
    public static final String JSON_ID = "id_driver";

    public Driver() {

    }

    public Driver(JSONObject json) throws JSONException {
        JSONObject object = json;
        if (json.has(JSON_WRAPPER)) {
            object = json.getJSONObject(JSON_WRAPPER);
        }

        if (object.has(JSON_EMAIL) && !object.isNull(JSON_EMAIL)) {
            mEmail = object.getString(JSON_EMAIL);
        }

        if (object.has(JSON_ID) && !object.isNull(JSON_ID)) {
            mId = object.getLong(JSON_ID);
        }

        if (object.has(JSON_COMPANY_ID) && !object.isNull(JSON_COMPANY_ID)) {
            mCompanyId = object.getLong(JSON_COMPANY_ID);
        }

        if (object.has(JSON_ACCESS_TOKEN) && !object.isNull(JSON_ACCESS_TOKEN)) {
            mAccessToken = object.getString(JSON_ACCESS_TOKEN);
        }

        if (object.has(JSON_PASSWORD)  && !object.isNull(JSON_PASSWORD)) {
            mPassword = object.getString(JSON_PASSWORD);
        }
    }

    public Driver(Parcel in) {
        mId = in.readLong();
        mAccessToken = in.readString();
        mEmail = in.readString();
        mCompanyId = in.readLong();
        mPassword = in.readString();
    }

    public JSONObject toJSON() throws JSONException {
        JSONObject wrapper = new JSONObject();
        wrapper.put(JSON_WRAPPER, toJSONWithoutWrapper());
        return wrapper;
    }

    public JSONObject toJSONWithoutWrapper() throws JSONException {
        JSONObject object = new JSONObject();
        object.put(JSON_ID, mId);
        object.put(JSON_ACCESS_TOKEN, mAccessToken);
        object.put(JSON_EMAIL, mEmail);
        object.put(JSON_COMPANY_ID, mCompanyId);
        object.put(JSON_PASSWORD, mPassword);

        return object;
    }

    public RequestParams buildParams() {
        HashMap<String, Object> object = new HashMap<>();
        object.put(JSON_ID, mId);
        object.put(JSON_ACCESS_TOKEN, mAccessToken);
        object.put(JSON_EMAIL, mEmail);
        object.put(JSON_COMPANY_ID, mCompanyId);
        object.put(JSON_PASSWORD, mPassword);

        RequestParams params = new RequestParams();
        params.put(JSON_WRAPPER, object);
        return params;
    }

    @Override
    public int describeContents() {
        return hashCode();
    }

    @Override
    public void writeToParcel(Parcel out, int flags) {
        out.writeLong(mId);
        out.writeString(mAccessToken);
        out.writeString(mEmail);
        out.writeLong(mCompanyId);
        out.writeString(mPassword);
    }

    public static final Creator CREATOR = new Creator() {
        public Driver createFromParcel(Parcel in) {
            return new Driver(in);
        }

        public Driver[] newArray(int size) {
            return new Driver[size];
        }
    };
}


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

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

/**
 *

 * The cross-origin resource sharing (CORS)
 * settings for your Lambda function URL. Use CORS to grant access to your function URL from any origin. You can also
 * use CORS to control access for specific HTTP headers and methods in requests to your function URL.
 *

 *
 * @see AWS API Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class Cors implements Serializable, Cloneable, StructuredPojo {

    /**
     *

     * Whether to allow cookies or other credentials in requests to your function URL. The default is false
     * .
     *

     */
    private Boolean allowCredentials;
    /**
     *

     * The HTTP headers that origins can include in requests to your function URL. For example: Date,
     * Keep-Alive, X-Custom-Header.
     *

     */
    private com.amazonaws.internal.SdkInternalList<String> allowHeaders;
    /**
     *

     * The HTTP methods that are allowed when calling your function URL. For example: GET,
     * POST, DELETE, or the wildcard character (*).
     *

     */
    private com.amazonaws.internal.SdkInternalList<String> allowMethods;
    /**
     *

     * The origins that can access your function URL. You can list any number of specific origins, separated by a comma.
     * For example: https://www.example.com, http://localhost:60905.
     *

     *

     * Alternatively, you can grant access to all origins using the wildcard character (*).
     *

     */
    private com.amazonaws.internal.SdkInternalList<String> allowOrigins;
    /**
     *

     * The HTTP headers in your function response that you want to expose to origins that call your function URL. For
     * example: Date, Keep-Alive, X-Custom-Header.
     *

     */
    private com.amazonaws.internal.SdkInternalList<String> exposeHeaders;
    /**
     *

     * The maximum amount of time, in seconds, that web browsers can cache results of a preflight request. By default,
     * this is set to 0, which means that the browser doesn't cache results.
     *

     */
    private Integer maxAge;

    /**
     *

     * Whether to allow cookies or other credentials in requests to your function URL. The default is false
     * .
     *

     *
     * @param allowCredentials
     *        Whether to allow cookies or other credentials in requests to your function URL. The default is
     *        false.
     */

    public void setAllowCredentials(Boolean allowCredentials) {
        this.allowCredentials = allowCredentials;
    }

    /**
     *

     * Whether to allow cookies or other credentials in requests to your function URL. The default is false
     * .
     *

     *
     * @return Whether to allow cookies or other credentials in requests to your function URL. The default is
     *         false.
     */

    public Boolean getAllowCredentials() {
        return this.allowCredentials;
    }

    /**
     *

     * Whether to allow cookies or other credentials in requests to your function URL. The default is false
     * .
     *

     *
     * @param allowCredentials
     *        Whether to allow cookies or other credentials in requests to your function URL. The default is
     *        false.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Cors withAllowCredentials(Boolean allowCredentials) {
        setAllowCredentials(allowCredentials);
        return this;
    }

    /**
     *

     * Whether to allow cookies or other credentials in requests to your function URL. The default is false
     * .
     *

     *
     * @return Whether to allow cookies or other credentials in requests to your function URL. The default is
     *         false.
     */

    public Boolean isAllowCredentials() {
        return this.allowCredentials;
    }

    /**
     *

     * The HTTP headers that origins can include in requests to your function URL. For example: Date,
     * Keep-Alive, X-Custom-Header.
     *

     *
     * @return The HTTP headers that origins can include in requests to your function URL. For example:
     *         Date, Keep-Alive, X-Custom-Header.
     */

    public java.util.List<String> getAllowHeaders() {
        if (allowHeaders == null) {
            allowHeaders = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return allowHeaders;
    }

    /**
     *

     * The HTTP headers that origins can include in requests to your function URL. For example: Date,
     * Keep-Alive, X-Custom-Header.
     *

     *
     * @param allowHeaders
     *        The HTTP headers that origins can include in requests to your function URL. For example: Date
     *        , Keep-Alive, X-Custom-Header.
     */

    public void setAllowHeaders(java.util.Collection<String> allowHeaders) {
        if (allowHeaders == null) {
            this.allowHeaders = null;
            return;
        }

        this.allowHeaders = new com.amazonaws.internal.SdkInternalList<String>(allowHeaders);
    }

    /**
     *

     * The HTTP headers that origins can include in requests to your function URL. For example: Date,
     * Keep-Alive, X-Custom-Header.
     *

     *

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

     *
     * @param allowHeaders
     *        The HTTP headers that origins can include in requests to your function URL. For example: Date
     *        , Keep-Alive, X-Custom-Header.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Cors withAllowHeaders(String... allowHeaders) {
        if (this.allowHeaders == null) {
            setAllowHeaders(new com.amazonaws.internal.SdkInternalList<String>(allowHeaders.length));
        }
        for (String ele : allowHeaders) {
            this.allowHeaders.add(ele);
        }
        return this;
    }

    /**
     *

     * The HTTP headers that origins can include in requests to your function URL. For example: Date,
     * Keep-Alive, X-Custom-Header.
     *

     *
     * @param allowHeaders
     *        The HTTP headers that origins can include in requests to your function URL. For example: Date
     *        , Keep-Alive, X-Custom-Header.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Cors withAllowHeaders(java.util.Collection<String> allowHeaders) {
        setAllowHeaders(allowHeaders);
        return this;
    }

    /**
     *

     * The HTTP methods that are allowed when calling your function URL. For example: GET,
     * POST, DELETE, or the wildcard character (*).
     *

     *
     * @return The HTTP methods that are allowed when calling your function URL. For example: GET,
     *         POST, DELETE, or the wildcard character (*).
     */

    public java.util.List<String> getAllowMethods() {
        if (allowMethods == null) {
            allowMethods = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return allowMethods;
    }

    /**
     *

     * The HTTP methods that are allowed when calling your function URL. For example: GET,
     * POST, DELETE, or the wildcard character (*).
     *

     *
     * @param allowMethods
     *        The HTTP methods that are allowed when calling your function URL. For example: GET,
     *        POST, DELETE, or the wildcard character (*).
     */

    public void setAllowMethods(java.util.Collection<String> allowMethods) {
        if (allowMethods == null) {
            this.allowMethods = null;
            return;
        }

        this.allowMethods = new com.amazonaws.internal.SdkInternalList<String>(allowMethods);
    }

    /**
     *

     * The HTTP methods that are allowed when calling your function URL. For example: GET,
     * POST, DELETE, or the wildcard character (*).
     *

     *

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

     *
     * @param allowMethods
     *        The HTTP methods that are allowed when calling your function URL. For example: GET,
     *        POST, DELETE, or the wildcard character (*).
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Cors withAllowMethods(String... allowMethods) {
        if (this.allowMethods == null) {
            setAllowMethods(new com.amazonaws.internal.SdkInternalList<String>(allowMethods.length));
        }
        for (String ele : allowMethods) {
            this.allowMethods.add(ele);
        }
        return this;
    }

    /**
     *

     * The HTTP methods that are allowed when calling your function URL. For example: GET,
     * POST, DELETE, or the wildcard character (*).
     *

     *
     * @param allowMethods
     *        The HTTP methods that are allowed when calling your function URL. For example: GET,
     *        POST, DELETE, or the wildcard character (*).
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Cors withAllowMethods(java.util.Collection<String> allowMethods) {
        setAllowMethods(allowMethods);
        return this;
    }

    /**
     *

     * The origins that can access your function URL. You can list any number of specific origins, separated by a comma.
     * For example: https://www.example.com, http://localhost:60905.
     *

     *

     * Alternatively, you can grant access to all origins using the wildcard character (*).
     *

     *
     * @return The origins that can access your function URL. You can list any number of specific origins, separated by
     *         a comma. For example: https://www.example.com, http://localhost:60905.

     *

     *         Alternatively, you can grant access to all origins using the wildcard character (*).
     */

    public java.util.List<String> getAllowOrigins() {
        if (allowOrigins == null) {
            allowOrigins = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return allowOrigins;
    }

    /**
     *

     * The origins that can access your function URL. You can list any number of specific origins, separated by a comma.
     * For example: https://www.example.com, http://localhost:60905.
     *

     *

     * Alternatively, you can grant access to all origins using the wildcard character (*).
     *

     *
     * @param allowOrigins
     *        The origins that can access your function URL. You can list any number of specific origins, separated by a
     *        comma. For example: https://www.example.com, http://localhost:60905.

     *

     *        Alternatively, you can grant access to all origins using the wildcard character (*).
     */

    public void setAllowOrigins(java.util.Collection<String> allowOrigins) {
        if (allowOrigins == null) {
            this.allowOrigins = null;
            return;
        }

        this.allowOrigins = new com.amazonaws.internal.SdkInternalList<String>(allowOrigins);
    }

    /**
     *

     * The origins that can access your function URL. You can list any number of specific origins, separated by a comma.
     * For example: https://www.example.com, http://localhost:60905.
     *

     *

     * Alternatively, you can grant access to all origins using the wildcard character (*).
     *

     *

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

     *
     * @param allowOrigins
     *        The origins that can access your function URL. You can list any number of specific origins, separated by a
     *        comma. For example: https://www.example.com, http://localhost:60905.

     *

     *        Alternatively, you can grant access to all origins using the wildcard character (*).
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Cors withAllowOrigins(String... allowOrigins) {
        if (this.allowOrigins == null) {
            setAllowOrigins(new com.amazonaws.internal.SdkInternalList<String>(allowOrigins.length));
        }
        for (String ele : allowOrigins) {
            this.allowOrigins.add(ele);
        }
        return this;
    }

    /**
     *

     * The origins that can access your function URL. You can list any number of specific origins, separated by a comma.
     * For example: https://www.example.com, http://localhost:60905.
     *

     *

     * Alternatively, you can grant access to all origins using the wildcard character (*).
     *

     *
     * @param allowOrigins
     *        The origins that can access your function URL. You can list any number of specific origins, separated by a
     *        comma. For example: https://www.example.com, http://localhost:60905.

     *

     *        Alternatively, you can grant access to all origins using the wildcard character (*).
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Cors withAllowOrigins(java.util.Collection<String> allowOrigins) {
        setAllowOrigins(allowOrigins);
        return this;
    }

    /**
     *

     * The HTTP headers in your function response that you want to expose to origins that call your function URL. For
     * example: Date, Keep-Alive, X-Custom-Header.
     *

     *
     * @return The HTTP headers in your function response that you want to expose to origins that call your function
     *         URL. For example: Date, Keep-Alive, X-Custom-Header.
     */

    public java.util.List<String> getExposeHeaders() {
        if (exposeHeaders == null) {
            exposeHeaders = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return exposeHeaders;
    }

    /**
     *

     * The HTTP headers in your function response that you want to expose to origins that call your function URL. For
     * example: Date, Keep-Alive, X-Custom-Header.
     *

     *
     * @param exposeHeaders
     *        The HTTP headers in your function response that you want to expose to origins that call your function URL.
     *        For example: Date, Keep-Alive, X-Custom-Header.
     */

    public void setExposeHeaders(java.util.Collection<String> exposeHeaders) {
        if (exposeHeaders == null) {
            this.exposeHeaders = null;
            return;
        }

        this.exposeHeaders = new com.amazonaws.internal.SdkInternalList<String>(exposeHeaders);
    }

    /**
     *

     * The HTTP headers in your function response that you want to expose to origins that call your function URL. For
     * example: Date, Keep-Alive, X-Custom-Header.
     *

     *

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

     *
     * @param exposeHeaders
     *        The HTTP headers in your function response that you want to expose to origins that call your function URL.
     *        For example: Date, Keep-Alive, X-Custom-Header.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Cors withExposeHeaders(String... exposeHeaders) {
        if (this.exposeHeaders == null) {
            setExposeHeaders(new com.amazonaws.internal.SdkInternalList<String>(exposeHeaders.length));
        }
        for (String ele : exposeHeaders) {
            this.exposeHeaders.add(ele);
        }
        return this;
    }

    /**
     *

     * The HTTP headers in your function response that you want to expose to origins that call your function URL. For
     * example: Date, Keep-Alive, X-Custom-Header.
     *

     *
     * @param exposeHeaders
     *        The HTTP headers in your function response that you want to expose to origins that call your function URL.
     *        For example: Date, Keep-Alive, X-Custom-Header.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Cors withExposeHeaders(java.util.Collection<String> exposeHeaders) {
        setExposeHeaders(exposeHeaders);
        return this;
    }

    /**
     *

     * The maximum amount of time, in seconds, that web browsers can cache results of a preflight request. By default,
     * this is set to 0, which means that the browser doesn't cache results.
     *

     *
     * @param maxAge
     *        The maximum amount of time, in seconds, that web browsers can cache results of a preflight request. By
     *        default, this is set to 0, which means that the browser doesn't cache results.
     */

    public void setMaxAge(Integer maxAge) {
        this.maxAge = maxAge;
    }

    /**
     *

     * The maximum amount of time, in seconds, that web browsers can cache results of a preflight request. By default,
     * this is set to 0, which means that the browser doesn't cache results.
     *

     *
     * @return The maximum amount of time, in seconds, that web browsers can cache results of a preflight request. By
     *         default, this is set to 0, which means that the browser doesn't cache results.
     */

    public Integer getMaxAge() {
        return this.maxAge;
    }

    /**
     *

     * The maximum amount of time, in seconds, that web browsers can cache results of a preflight request. By default,
     * this is set to 0, which means that the browser doesn't cache results.
     *

     *
     * @param maxAge
     *        The maximum amount of time, in seconds, that web browsers can cache results of a preflight request. By
     *        default, this is set to 0, which means that the browser doesn't cache results.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public Cors withMaxAge(Integer maxAge) {
        setMaxAge(maxAge);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getAllowCredentials() != null)
            sb.append("AllowCredentials: ").append(getAllowCredentials()).append(",");
        if (getAllowHeaders() != null)
            sb.append("AllowHeaders: ").append(getAllowHeaders()).append(",");
        if (getAllowMethods() != null)
            sb.append("AllowMethods: ").append(getAllowMethods()).append(",");
        if (getAllowOrigins() != null)
            sb.append("AllowOrigins: ").append(getAllowOrigins()).append(",");
        if (getExposeHeaders() != null)
            sb.append("ExposeHeaders: ").append(getExposeHeaders()).append(",");
        if (getMaxAge() != null)
            sb.append("MaxAge: ").append(getMaxAge());
        sb.append("}");
        return sb.toString();
    }

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

        if (obj instanceof Cors == false)
            return false;
        Cors other = (Cors) obj;
        if (other.getAllowCredentials() == null ^ this.getAllowCredentials() == null)
            return false;
        if (other.getAllowCredentials() != null && other.getAllowCredentials().equals(this.getAllowCredentials()) == false)
            return false;
        if (other.getAllowHeaders() == null ^ this.getAllowHeaders() == null)
            return false;
        if (other.getAllowHeaders() != null && other.getAllowHeaders().equals(this.getAllowHeaders()) == false)
            return false;
        if (other.getAllowMethods() == null ^ this.getAllowMethods() == null)
            return false;
        if (other.getAllowMethods() != null && other.getAllowMethods().equals(this.getAllowMethods()) == false)
            return false;
        if (other.getAllowOrigins() == null ^ this.getAllowOrigins() == null)
            return false;
        if (other.getAllowOrigins() != null && other.getAllowOrigins().equals(this.getAllowOrigins()) == false)
            return false;
        if (other.getExposeHeaders() == null ^ this.getExposeHeaders() == null)
            return false;
        if (other.getExposeHeaders() != null && other.getExposeHeaders().equals(this.getExposeHeaders()) == false)
            return false;
        if (other.getMaxAge() == null ^ this.getMaxAge() == null)
            return false;
        if (other.getMaxAge() != null && other.getMaxAge().equals(this.getMaxAge()) == false)
            return false;
        return true;
    }

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

        hashCode = prime * hashCode + ((getAllowCredentials() == null) ? 0 : getAllowCredentials().hashCode());
        hashCode = prime * hashCode + ((getAllowHeaders() == null) ? 0 : getAllowHeaders().hashCode());
        hashCode = prime * hashCode + ((getAllowMethods() == null) ? 0 : getAllowMethods().hashCode());
        hashCode = prime * hashCode + ((getAllowOrigins() == null) ? 0 : getAllowOrigins().hashCode());
        hashCode = prime * hashCode + ((getExposeHeaders() == null) ? 0 : getExposeHeaders().hashCode());
        hashCode = prime * hashCode + ((getMaxAge() == null) ? 0 : getMaxAge().hashCode());
        return hashCode;
    }

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

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


text:
using System.Diagnostics;

namespace Discord
{
    /// <summary>
    ///     An activity object found in a sent message.
    /// </summary>
    /// <remarks>
    ///     <para>
    ///         This class refers to an activity object, visually similar to an embed within a message. However, a message
    ///         activity is interactive as opposed to a standard static embed.
    ///     </para>
    ///     <para>For example, a Spotify party invitation counts as a message activity.</para>
    /// </remarks>
    [DebuggerDisplay(@"{DebuggerDisplay,nq}")]
    public class MessageActivity
    {
        /// <summary>
        ///     Gets the type of activity of this message.
        /// </summary>
        public MessageActivityType Type { get; internal set; }
        /// <summary>
        ///     Gets the party ID of this activity, if any.
        /// </summary>
        public string PartyId { get; internal set; }

        private string DebuggerDisplay
            => $"{Type}{(string.IsNullOrWhiteSpace(PartyId) ? "" : $" {PartyId}")}";

        public override string ToString() => DebuggerDisplay;
    }
}


text:
var mongoose = require('mongoose')
  , schemaTranslation = require('./schema_translation')
  ;

var schemaAnime = mongoose.Schema({
	id: Number,
	titles: {},
	type: Number,
	episodes_released: Number,
	episodes_total: Number,
	status: Number,
	airing_start: Date,
	airing_end: Date,
	producers: [String],
	genres: [Number],
	episode_duration: Number,
	content_rating: Number,
	synopsis: String,
	adapted_type: Number,
	adapted_from: Number,
	anime_related: [Number],
	anime_sidestory: [Number],
	anime_spinoff: [Number],
	parent_type: Number,
	parent_id: Number
}, { collection: 'anime' });

var ModelAnime = mongoose.model('ModelAnime', schemaAnime);

/* Module Export */
if (typeof module !== 'undefined' && module.exports) {
	module.exports = ModelAnime;
}


text:
WARNING: old repository. See https://github.com/jonathanslenders/pymux instead!

Pymux
=====

Pure-Python TMUX clone.

About
-----

Right now this is still experimental, but I the target is to create a fully
functional tmux clone in pure Python.

The intention is to have a clean separation between a reusable libary that
implements a terminal multiplexer and an application that uses it and could
replace tmux. Another application would be a Python debugger where the
application runs in one pane and the debugger in the other pane.

Dependencies
------------

- asyncio: It requires the asyncio library for event handling. This means it
  will also require Python 3.3, but Python 3.4 is recommended. (At least the Hg
  version of 10/01/2014 required.)
- pyte: A python library for handling vt100 escape codes. (It requires the
  latest  pull requests to be applied.)

Running
-------

Right now, do: ```python run.py```


text:
import Queue
import pickle
import netaddr
import logging
import requests
import ripestat
import threading

class Probes(object):
    '''return a class with all atlas probes'''
    probe_api_url     = 'https://atlas.ripe.net/api/v1/probe/'
    probe_archive_url = 'https://atlas.ripe.net/api/v1/probe-archive/?format=json'

    def __init__(self, refresh=False, probes_file='probes.p', threads=200):
        '''initialise class'''
        self.probes_file = probes_file
        self.logger      = logging.getLogger('atlas-kibana.Probes')
        self.threads     = threads
        self.queue       = Queue.Queue(self.threads * 2)
        self.probes      = set()
        self.load()
        if refresh:
            self.refresh()
        self.save()

    def exists(self, probe_id):
        '''check if we already have this probe'''
        for probe in self.probes.copy():
            if probe.id == int(probe_id):
                return True
        return False

    def get(self, probe_id):
        '''get an probe element'''
        for probe in self.probes.copy():
            if probe.id == int(probe_id):
                return probe
        return False

    def load(self):
        '''load pickle data'''
        try:
            self.logger.info('Loading probes from pickle file')
            self.probes = pickle.load(open(self.probes_file, 'rb'))
            self.logger.info('Finished loading probes')
        except IOError:
            self.logger.warning('unable to load probes file {}'.format(self.probes_file))

    def load_probe(self, force=False):
        '''load a probe from the queue'''
        while True:
            probe = self.queue.get()
            try:
                if not self.exists(probe['id']):
                    self.probes.add(Probe(probe))
                    self.logger.info('{}:Added'.format(probe['id']))
                else:
                    self.logger.debug('{}:Already Exists'.format(probe['id']))
            except Exception as e:
                # This will likly come back and bite me :S
                self.logger.warning('{}:could not process\n{}'.format(probe['id'], e))
            self.queue.task_done()

    def refresh(self, force=False):
        '''load all atlas probes'''
        try:
            self.logger.info('fetching {}'.format(self.probe_archive_url))
            probes = requests.get(self.probe_archive_url, verify=False).json().get(
                    'objects', [])
            self.logger.info('fetched {}'.format(self.probe_archive_url))
        except Exception as e:
            self.logger.error('Could not fetch {0}:\n{1}'.format(self.probe_archive_url, e))
            return False
        for i in range(self.threads):
            thread        = threading.Thread(target=self.load_probe)
            thread.daemon = True
            thread.start()
        if force:
            self.logger.info('Clering all probes')
            self.probes.clear()
        for probe in probes:
            self.queue.put(probe)
        self.queue.join()
        return True

    def save(self):
        '''save the probes data'''
        pickle.dump(self.probes, open(self.probes_file, 'wb'))

class Probe(object):

    def __init__(self, probe):
        self.logger       = logging.getLogger('atlas-kibana.Probe')
        self.status       = probe.get('status_name',  None)
        self.status_since = probe.get('status_since', None)
        self.address_v4   = probe.get('address_v4',   None)
        self.address_v6   = probe.get('address_v6',   None)
        self.asn_v4       = probe.get('asn_v4',       None)
        self.asn_v6       = probe.get('asn_v6',       None)
        self.country_code = probe.get('country_code', None)
        self.latitude     = probe.get('latitude',     None)
        self.longitude    = probe.get('longitude',    None)
        self.prefix_v4    = probe.get('prefix_v4',    None)
        self.prefix_v6    = probe.get('prefix_v6',    None)
        self.id           = probe.get('id',           None)
        self.is_anchor    = probe.get('is_anchor',    None)
        self.is_public    = probe.get('is_public',    None)
        self.resource_uri = probe.get('resource_uri', None)
        self.tooltip      = 'Probe #{0}: https://atlas.ripe.net/probes/{0}/'.format(self.id)
        self.geojson      = [self.longitude, self.latitude]
        self.stat_api     = ripestat.StatAPI('Atlas-Kibana')
        self.tags         = []
        self.tags.extend(probe.get('tags', None))
        self.location     = dict()
        self.asn_v4_name  = None
        self.asn_v6_name  = None
        self.prefixlen_v4 = None
        self.rir_v4       = None
        self.prefixlen_v6 = None
        self.rir_v6       = None

        self.update()

    def __getstate__(self):
        '''remove logger and api from logger'''
        d = dict(self.__dict__)
        del d['logger']
        del d['stat_api']
        return d

    def __setstate__(self, d):
        '''recreate logger and stat_api'''
        d['stat_api'] = ripestat.StatAPI('Atlas-Kibana')
        d['logger']   = logging.getLogger('atlas-kibana.Probe')
        self.__dict__.update(d)

    def __eq__(self, other):
        '''Check equality'''
        if isinstance(other, Probe):
            return self.id == other.id
        return False

    def __ne__(self, other):
        '''Check inequality'''
        if isinstance(other, Probe):
            return not (self.id == other.id)
        return True

    def __repr__(self):
        '''represent object'''
        return 'Probe({})'.format(self.id)

    def __hash__(self):
        '''hash object'''
        return hash(self.__repr__())

    def get_location_meta(self, country_code):
        '''use restcountries.eu to get the location'''
        url = 'http://restcountries.eu/rest/v1/alpha/{}'.format(country_code.lower())
        try:
            location = requests.get(url, verify=False).json()
            self.logger.debug('{}:Add location for {}'.format(self.id, country_code))
            return location
        except Exception as e:
            self.logger.error('Could not fetch {}:{}\n{}'.format(url, location,  e))

    def get_location(self):
        location          = self.get_location_meta(self.country_code)
        return { 'country'  : location['name'],
                'region'    : location['region'],
                'subregion' : location['subregion']}

    def update(self):
        '''update probe metadata'''
        if self.country_code:
            self.location = self.get_location()
        if self.asn_v4:
            self.asn_v4_name  = self.get_asn_name(self.asn_v4)
        if self.asn_v6:
            if self.asn_v6 == self.asn_v4:
                self.asn_v6_name  = self.asn_v4_name
            else:
                self.asn_v6_name  = self.get_asn_name(self.asn_v6)
        if self.prefix_v4:
            self.prefixlen_v4 = self.get_prefix_len(self.prefix_v4)
            self.rir_v4       = self.get_rir(self.prefix_v4)
        if self.prefix_v6:
            self.prefixlen_v6 = self.get_prefix_len(self.prefix_v6)
            self.rir_v6       = self.get_rir(self.prefix_v6)

    def get_rir(self, prefix):
        '''use RIPEstat to get the rir name'''
        try:
            whois = self.stat_api.get_data('whois', {'resource': prefix})
            self.logger.debug('recived ripe stat info:\n{}'.format(whois))
            rir   = u','.join(whois.get('authorities', [])).encode('utf-8')
            self.logger.debug('{}:Add RIR "{}" for {}'.format(self.id, rir, prefix))
            return rir
        except Exception as e:
            self.logger.error('Could not fetch holder for {}:\n{}'.format(prefix, e))

    def get_asn_name(self, asn):
        '''use RIPEstat to get the asn name'''
        try:
            asn_name = self.stat_api.get_data('as-overview',
                {'resource': asn}).get('holder', None).encode('utf-8')
            self.logger.debug('{}:Add AS name "{}" for {}'.format(
                self.id, asn_name, asn))
            return asn_name
        except Exception as e:
            self.logger.error('Could not fetch holder for {}:\n{}'.format(asn, e))

    def get_prefix_len(self, prefix):
        try:
            prefix_len = int(netaddr.IPNetwork(prefix).prefixlen)
            self.logger.debug('{}:Add prefix length "{}" for {}'.format(
                self.id, prefix_len, prefix))
            return prefix_len
        except netaddr.AddrFormatError as e:
            self.logger.warning('could not get prefix length: {}'.format(e))


text:
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <poll.h>

#include "message.h"
#include "marshaller.h"
#include "waltham-client.h"
#include "waltham-connection.h"
#include "waltham-object.h"
#include "waltham-private.h"
#include "waltham-util.h"

struct wth_connection {
	int fd;
	enum wth_connection_side side;

	ClientReader *reader;
	int error;
	struct {
		uint32_t code;
		uint32_t id;
		const char *interface;
	} protocol_error;

	struct wth_display *display;
	struct wth_map map;
	wth_registry_callback_func registry_callback;
	void *registry_callback_user_data;
};

WTH_EXPORT struct wth_connection *
wth_connect_to_server(const char *host, const char *port)
{
	struct wth_connection *conn = NULL;
	int fd;

	fd = connect_to_host(host, port);

	if (fd >= 0)
		conn = wth_connection_from_fd(fd, WTH_CONNECTION_SIDE_CLIENT);

	return conn;
}

WTH_EXPORT struct wth_connection *
wth_accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
{
	struct wth_connection *conn = NULL;
	int fd;

	fd = accept(sockfd, addr, addrlen);

	if (fd >= 0)
		conn = wth_connection_from_fd(fd, WTH_CONNECTION_SIDE_SERVER);

	return conn;
}

/* BEGIN wthp_display client implementation */

static void
display_error(struct wth_display *d, struct wth_object *obj,
              uint32_t code, const char *msg)
{
	struct wth_connection *conn;

	conn = wth_object_get_user_data((struct wth_object *)d);
	fprintf(stderr, "fatal protocol error %d: %s\n", code, msg);
	wth_connection_set_protocol_error(conn, 0xf000dead /* XXX obj->id */,
	                                  "unknown", code);
}

static void
display_delete_id(struct wth_display *d, uint32_t id)
{
	fprintf(stderr, "wth_display.delete_id(%d)\n", id);
}

static void
display_server_version(struct wth_display *d, uint32_t ver)
{
	fprintf(stderr, "wth_display.server_version(%d)\n", ver);
}

static const struct wth_display_listener display_listener = {
	display_error,
	display_delete_id,
	display_server_version
};

/* END wthp_display client implementation */

/* BEGIN wthp_display server implementation */

/* TODO: these three declarations are copied from waltham-server.h, which can't
 * be included together with waltham-client.h.  Find a way to make it possible
 * to include them both, or split this server implementation in another file.
 */

void
wthp_callback_send_done (struct wthp_callback * wthp_callback, uint32_t callback_data);

struct wth_display_interface {
	void (*client_version) (struct wth_display * wth_display, uint32_t client_version);
	void (*sync) (struct wth_display * wth_display, struct wthp_callback * callback);
	void (*get_registry) (struct wth_display * wth_display, struct wthp_registry * registry);
};

static inline void
wth_display_set_interface(struct wth_display *self, const struct wth_display_interface *funcs, void *user_data)
{
	wth_object_set_listener((struct wth_object *)self, (void (**)(void)) funcs, user_data);
}

static void
display_handle_client_version(struct wth_display *wth_display,
                              uint32_t client_version)
{
	wth_object_post_error((struct wth_object *)wth_display, 0,
	                      "unimplemented: %s", __func__);
}

static void
display_handle_sync(struct wth_display *wth_display,
                    struct wthp_callback *callback)
{
	wth_debug("Client requested wth_display.sync");
	wthp_callback_send_done(callback, 0);
	wthp_callback_free(callback);
}

static void
display_handle_get_registry(struct wth_display *wth_display,
                            struct wthp_registry *registry)
{
	struct wth_object *disp_object = (struct wth_object *)wth_display;
	struct wth_connection *conn = disp_object->connection;

	if (conn->registry_callback == NULL)
		wth_abort("Buggy server implementation!  "
		          "wth_connection_set_registry_callback() must be "
		          "called before serving the client.");

	conn->registry_callback(registry, conn->registry_callback_user_data);
}

static const struct wth_display_interface display_implementation = {
	display_handle_client_version,
	display_handle_sync,
	display_handle_get_registry
};

/* END wthp_display server implementation */

WTH_EXPORT struct wth_connection *
wth_connection_from_fd(int fd, enum wth_connection_side side)
{
	struct wth_connection *conn;

	conn = calloc(1, sizeof *conn);

	if (conn == NULL)
		return NULL;

	conn->fd = fd;
	conn->side = side;

	conn->reader = new_reader();
	wth_map_init(&conn->map, side);

	/* id 0 should be NULL, id 1 the display */
	if (side == WTH_CONNECTION_SIDE_CLIENT) {
		wth_map_insert_at(&conn->map, 0, 0, NULL);
		conn->display = (struct wth_display *) wth_object_new(conn);
		wth_display_set_listener(conn->display, &display_listener, conn);
	} else {
		wth_map_reserve_new(&conn->map, 0);
		wth_map_insert_at(&conn->map, 0, 0, NULL);
		conn->display = (struct wth_display *) wth_object_new_with_id(conn, 1);
		wth_display_set_interface(conn->display, &display_implementation, NULL);
	}

	if (conn->display == NULL) {
		free(conn);
		conn = NULL;
	}

	return conn;
}

WTH_EXPORT int
wth_connection_get_fd(struct wth_connection *conn)
{
	return conn->fd;
}

void
wth_connection_insert_new_object(struct wth_connection *conn,
		struct wth_object *obj)
{
	obj->id = wth_map_insert_new(&conn->map, 0, obj);

	wth_debug("%s: new object id: %d", __func__, obj->id);
}

void
wth_connection_insert_object_with_id(struct wth_connection *conn,
		struct wth_object *obj)
{
	wth_debug("%s: %d", __func__, obj->id);

	wth_map_reserve_new(&conn->map, obj->id);
	wth_map_insert_at(&conn->map, 0, obj->id, obj);
}

void
wth_connection_remove_object(struct wth_connection *conn,
		struct wth_object *obj)
{
	/* XXX use _remove when we are ready to reuse ids */
	//wth_map_remove(&conn->map, obj->id);
	wth_map_insert_at(&conn->map, 0, obj->id, NULL);
}

struct wth_object *
wth_connection_get_object(struct wth_connection *conn, uint32_t id)
{
	return wth_map_lookup(&conn->map, id);
}

WTH_EXPORT void
wth_connection_destroy(struct wth_connection *conn)
{
	close(conn->fd);

	wth_object_delete((struct wth_object *) conn->display);
	wth_map_release(&conn->map);
	free_reader(conn->reader);

	free(conn);
}

WTH_EXPORT int
wth_connection_flush(struct wth_connection *conn)
{
	/* FIXME currently we don't use the ringbuffer to send messages,
	 * they are just written to the fd in write_all() in
	 * src/marshaller/marshaller.h. */

	return 0;
}

WTH_EXPORT int
wth_connection_read(struct wth_connection *conn)
{
	/* If the connection is set to EPROTO, we still want to empty the kernel
	 * buffers. We just discard the messages without dispatching them. */
	if (conn->error && conn->error != EPROTO) {
		errno = conn->error;
		return -1;
	}

	if (!reader_pull_new_messages(conn->reader, conn->fd, true)) {
		/* Don't set the connection to error state in case of EAGAIN.
		 * We still return -1, but the user should handle errno == EAGAIN. */
		if (errno != EAGAIN)
			wth_connection_set_error(conn, errno);

		return -1;
	}

	/* Discard read messages without dispatching them if the connection
	 * was set to EPROTO. */
	if (conn->error == EPROTO)
		reader_flush(conn->reader);

	return 0;
}

WTH_EXPORT int
wth_connection_dispatch(struct wth_connection *conn)
{
	int i, complete;

	/* If there is an error, we still want to empty the ringbuffer.
	 * Messages won't be dispatched though, so this should be safe. */

	for (i = 0 ; i < conn->reader->m_complete; i++) {
		msg_t msg;

		reader_map_message(conn->reader, i, &msg);
		wth_debug("Message received on conn %p: (%d) %d bytes",
			  conn, msg.hdr->opcode, msg.hdr->sz);

		/* Don't dispatch more messages after the connection is set
		 * to EPROTO. */
		if (conn->error != EPROTO)
			msg_dispatch(conn, &msg);

		reader_unmap_message(conn->reader, i, &msg);
	}

	complete = conn->reader->m_complete;

	/* Remove processed messages */
	reader_flush(conn->reader);

	/* The connection has been set to error in this call. */
	if (conn->error) {
		errno = conn->error;
		return -1;
	}

	return complete;
}

static void
sync_listener_handle_done(struct wthp_callback *cb, uint32_t arg)
{
	bool *flag = wth_object_get_user_data((struct wth_object *)cb);

	*flag = true;
}

static const struct wthp_callback_listener sync_listener = {
	sync_listener_handle_done
};

WTH_EXPORT int
wth_connection_roundtrip(struct wth_connection *conn)
{
	struct wthp_callback *cb;
	bool flag = false;
	int ret;
	struct pollfd pfd;

	ASSERT_CLIENT_SIDE(conn);

	cb = wth_display_sync(conn->display);
	wthp_callback_set_listener(cb, &sync_listener, &flag);

	pfd.fd = conn->fd;
	pfd.events = POLLIN;

	while (!flag) {
		/* Do not ignore EPROTO */
		if (wth_connection_dispatch(conn) < 0)
			break;

		if (flag)
			break;

		ret = wth_connection_flush(conn);
		if (ret < 0 && errno == EAGAIN) {
			pfd.events = POLLIN | POLLOUT;
		} else if (ret < 0) {
			wth_debug("Roundtrip connection flush failed: %s",
				  strerror(errno));
			break;
		}

		do {
			ret = poll(&pfd, 1, -1);
		} while (ret == -1 && errno == EINTR);
		if (ret == -1) {
			wth_debug("Roundtrip error with poll: %s",
				  strerror(errno));
			break;
		}

		if (pfd.revents & (POLLERR | POLLNVAL)) {
			wth_debug("Roundtrip connection errored out.");
			break;
		}

		if (pfd.revents & POLLOUT) {
			ret = wth_connection_flush(conn);
			if (ret == 0) {
				pfd.events = POLLIN;
			} else if (ret < 0 && errno != EAGAIN) {
				wth_debug("Roundtrip connection re-flush failed: %s",
					strerror(errno));
				break;
			}
		}

		if (pfd.revents & POLLIN) {
			ret = wth_connection_read(conn);
			if (ret < 0) {
				wth_debug("Roundtrip connection read error: %s",
					  strerror(errno));
				break;
			}
		}

		if (pfd.revents & POLLHUP) {
			/* If there was also unread data when HUP
			 * happened, assume POLLIN was also set and
			 * we just read everything already, so the
			 * only thing left is to dispatch it.
			 */
			ret = wth_connection_dispatch(conn);
			if (ret < 0) {
				wth_debug("Roundtrip dispatch error: %s",
					  strerror(errno));
				break;
			}
			break;
		}
	}

	wthp_callback_free(cb);

	return flag ? 0 : -1;
}

WTH_EXPORT void
wth_connection_set_error(struct wth_connection *conn, int err)
{
	if (!conn->error || err == EPROTO)
		conn->error = err;
}

WTH_EXPORT void
wth_connection_set_protocol_error(struct wth_connection *conn,
				  uint32_t object_id,
				  const char *interface,
				  uint32_t error_code)
{
	wth_connection_set_error(conn, EPROTO);
	conn->protocol_error.interface = interface;
	conn->protocol_error.id = object_id;
	conn->protocol_error.code = error_code;
}

WTH_EXPORT int
wth_connection_get_error(struct wth_connection *conn)
{
	return conn->error;
}

WTH_EXPORT uint32_t
wth_connection_get_protocol_error(struct wth_connection *conn,
				  const char **interface,
				  uint32_t *object_id)
{
	*interface = conn->protocol_error.interface;
	*object_id = conn->protocol_error.id;

	return conn->protocol_error.code;
}

static const char *
side_to_str(enum wth_connection_side side)
{
	switch (side) {
	case WTH_CONNECTION_SIDE_CLIENT:
		return "client";
	case WTH_CONNECTION_SIDE_SERVER:
		return "server";
	default:
		return "(invalid)";
	}
}

void
wth_connection_assert_side(struct wth_connection *conn,
			   const char *func,
			   enum wth_connection_side expected)
{
	const char *conn_side;
	const char *expected_side;

	if (conn->side == expected)
		return;

	conn_side = side_to_str(conn->side);
	expected_side = side_to_str(expected);

	wth_abort("function %s is %s-only but it was called on a %s side object",
		  func, expected_side, conn_side);
}

/* BEGIN wthp_display client implementation */

WTH_EXPORT struct wthp_registry *
wth_connection_create_registry(struct wth_connection *conn)
{
	ASSERT_CLIENT_SIDE(conn);

	return wth_display_get_registry(conn->display);
}

WTH_EXPORT struct wthp_callback *
wth_connection_sync(struct wth_connection *conn)
{
	ASSERT_CLIENT_SIDE(conn);

	return wth_display_sync(conn->display);
}

/* END wthp_display client implementation */

/* BEGIN wthp_display server implementation */

/* TODO: this declaration is copied from waltham-server.h, which can't be
 * included together with waltham-client.h.  Find a way to make it possible to
 * include them both, or split this server implementation in another file.
 */

void
wth_display_send_error (struct wth_display * wth_display, struct wth_object * object_id, uint32_t code, const char * message);

WTH_EXPORT void
wth_connection_set_registry_callback(struct wth_connection *conn,
                                     wth_registry_callback_func registry_callback,
                                     void *user_data)
{
	ASSERT_SERVER_SIDE(conn);

	conn->registry_callback = registry_callback;
	conn->registry_callback_user_data = user_data;
}

void
wth_connection_send_error(struct wth_connection *conn, struct wth_object *obj,
                          uint32_t code, const char *str)
{
	wth_display_send_error(conn->display, obj, code, str);
}

WTH_EXPORT void
wth_connection_post_error_no_memory(struct wth_connection *conn)
{
	wth_object_post_error((struct wth_object *) conn->display, 1, "out of memory");
}

/* END wthp_display server implementation */


text:
    // Angular
    import '@angular/platform-browser';
    import '@angular/platform-browser-dynamic';
    import '@angular/core';
    import '@angular/common';
    import '@angular/common/http';
    import '@angular/router';

    // RxJS
    import 'rxjs';

    // Other vendors for example jQuery, Lodash or Bootstrap
    // You can import js, ts, css, sass, ...
    import 'font-awesome/css/font-awesome.css';
    import 'ngx-bootstrap/datepicker/bs-datepicker.css';


text:
using System;
using System.IO;
using System.Threading;
using System.Collections.Generic;
using System.Text;

namespace WebsitePanel.EnterpriseServer
{
    public class SchedulerJob
    {
        private ScheduleInfo scheduleInfo;
        private ScheduleTaskInfo task;

        public ScheduleFinished ScheduleFinishedCallback;

        #region public properties
        public ScheduleInfo ScheduleInfo
        {
            get { return this.scheduleInfo; }
            set { this.scheduleInfo = value; }
        }

        public ScheduleTaskInfo Task
        {
            get { return this.task; }
            set { this.task = value; }
        }
        #endregion

        // Constructor
        public SchedulerJob()
        {
        }

        // Sets the next time this Schedule is kicked off and kicks off events on
        // a seperate thread, freeing the Scheduler to continue
        public void Run()
        {
            // create worker
            Thread worker = new Thread(new ThreadStart(RunSchedule));
            // set worker priority
            switch (scheduleInfo.Priority)
            {
                case SchedulePriority.Highest: worker.Priority = ThreadPriority.Highest; break;
                case SchedulePriority.AboveNormal: worker.Priority = ThreadPriority.AboveNormal; break;
                case SchedulePriority.Normal: worker.Priority = ThreadPriority.Normal; break;
                case SchedulePriority.BelowNormal: worker.Priority = ThreadPriority.BelowNormal; break;
                case SchedulePriority.Lowest: worker.Priority = ThreadPriority.Lowest; break;
            }

            // start worker!
            worker.Start();
        }

        // Implementation of ThreadStart delegate.
        // Used by Scheduler to kick off events on a seperate thread
        private void RunSchedule()
        {
            // impersonate thread
            UserInfo user = PackageController.GetPackageOwner(scheduleInfo.PackageId);
            SecurityContext.SetThreadPrincipal(user.UserId);

            List<BackgroundTaskParameter> parameters = new List<BackgroundTaskParameter>();
            foreach (ScheduleTaskParameterInfo prm in scheduleInfo.Parameters)
            {
                parameters.Add(new BackgroundTaskParameter(prm.ParameterId, prm.ParameterValue));
            }

            TaskManager.StartTask("SCHEDULER", "RUN_SCHEDULE", scheduleInfo.ScheduleName, scheduleInfo.ScheduleId,
                                  scheduleInfo.ScheduleId, scheduleInfo.PackageId, scheduleInfo.MaxExecutionTime,
                                  parameters);

            // run task
            try
            {
                // create scheduled task object
                SchedulerTask objTask = (SchedulerTask)Activator.CreateInstance(Type.GetType(task.TaskType));

                if (objTask != null)
                    objTask.DoWork();
                else
                    throw new Exception(String.Format("Could not create scheduled task of '{0}' type",
                        task.TaskType));
               // Thread.Sleep(40000);
            }
            catch (Exception ex)
            {
                // log error
                TaskManager.WriteError(ex, "Error executing scheduled task");
            }
            finally
            {
                // complete task
                try
                {
                    TaskManager.CompleteTask();
                }
                catch (Exception)
                {
                }
            }
        }
    }
}


text:
package org.apache.camel.component.atom;

import org.apache.camel.builder.RouteBuilder;

/**
 * Unit test for AtomPollingConsumer
 */
public class AtomEndpointTest extends AtomPollingConsumerTest {

    @Override
    protected RouteBuilder createRouteBuilder() {
        return new RouteBuilder() {
            public void configure() throws Exception {
                AtomEndpoint atom = new AtomEndpoint();
                atom.setCamelContext(context);
                atom.setFeedUri("file:src/test/data/feed.atom");
                atom.setSplitEntries(false);

                context.addEndpoint("atomic", atom);

                from("atomic").to("mock:result", "mock:result2");
            }
        };
    }

}


text:
#ifndef MILL_POLLER_INCLUDED
#define MILL_POLLER_INCLUDED

void mill_poller_init(void);

/* poller.c also implements mill_wait() and mill_fdwait() declared
   in libmill.h. */

/* Wait till at least one coroutine is resumed. If block is set to 0 the
   function will poll for events and return immediately. If it is set to 1
   it will block until there's at least one event to process. */
void mill_wait(int block);

/* Called in the child process after fork to create a fresh new pollset
   independent from the parent's pollset. */
void mill_poller_postfork(void);

#endif


text:
[![Gem Version](https://badge.fury.io/rb/git-lighttp.svg)](https://badge.fury.io/rb/git-lighttp)
[![Build Status](https://travis-ci.org/hallison/git-lighttp.svg?branch=master)](https://travis-ci.org/hallison/git-lighttp)
[![Code Climate](https://codeclimate.com/github/hallison/git-lighttp/badges/gpa.svg)](https://codeclimate.com/github/hallison/git-lighttp)
[![Inline docs](http://inch-ci.org/github/hallison/git-lighttp.svg?branch=master)](http://inch-ci.org/github/hallison/git-lighttp)

## DESCRIPTION

This project was inspired in the [Grack][1] Smart-HTTP server handler (written
by [Scott Chacon][2]) but developed using [Sinatra][3] and aims replace the
original `git-http-backend` including new features.

The main goal of the **Git-Lighttp** is implement the following useful features.

- Smart-HTTP, based on _git-http-backend_.
- Authentication flexible based on database or configuration file like `htpasswd`.
- Authorization flexible based on database or configuration file like `htgroup`.
- API to get information about repository (_Treeish_).

## SINOPSIS

Install the Git-Lighttp using [Rubygems][4].

    $ gem install git-lighttp

Or checkout the project hosted on [Gitlab][5] or [Github][6].

    $ git clone https://gitlab.com/hallison/git-lighttp.git
    $ ...
    $ cd git-lighttp
    $ make install

Configure the Rackup file (`config.ru`) using the following instructions:

    # config.ru
    require "git/lighttp"

    Git::Lighttp::HttpBackend.configure do |server|
      server.project_root = "/home/git/repositories"
      server.git_path     = "/usr/bin/git"
      server.get_any_file = true
      server.upload_pack  = true
      server.receive_pack = false
      server.authenticate = true
    end

    run Git::Lighttp::HttpBackend

And run:

    $ rackup --port 9092 --daemonize
    $ git clone http://localhost:9092/mycode.git

You can use the `.netrc` for improve your connection. Put this:

    machine <host> login <username> password <password>

The Git-Lighttp is under development, so there are still many improvements to
be made. Please, help us to improve the project sending your feedback to
[issues][7] or sending email to [hallisonbatista@gmail.com][8].

Discuss in [Google Groups][9].

## AUTHORS

Written by Hallison Batista <hallisonbatista@gmail.com>.

## BUGS

If you find a bug, please report it at the Git-Lighttp project's
issues tracker on [Gitlab][5] or [Github][6].

## LICENSE

Git-Lighttp is Copyright (c) 2011-2016 Hallison Batista.

This is free software, and may be redistributed under the terms specified in
LICENSE.txt.

[1]: http://github.com/schacon/grack
[2]: http://github.com/schacon
[3]: http://www.sinatrarb.com
[4]: http://rubygems.org/gems/git-lighttp
[5]: http://gitlab.com/hallison/git-lighttp
[6]: http://github.com/hallison/git-lighttp
[7]: http://gitlab.com/hallison/git-lighttp/issues
[8]: mailto:hallisonbatista@gmail.com
[9]: http://groups.google.com/group/git-lighttp


text:
require 'spec_helper'

describe "Cmds::capture" do
  it "captures stdout" do
    expect(
      Cmds.new(%{ruby -e '$stdout.puts "hey"'}).capture.out
    ).to eq "hey\n"
  end

  it "captures stderr" do
    expect(
      Cmds.new(%{ruby -e '$stderr.puts "ho"'}).capture.err
    ).to eq "ho\n"
  end

  context "echo_cmd.rb 'hello world!'" do

    shared_examples "executes correctly" do
      it_behaves_like "ok"

      it "should have 'hello world!' as ARGV[0]" do
        expect( JSON.load(result.out)['ARGV'][0] ).to eq "hello world!"
      end
    end # executes correctly

    context "positional args" do
      let(:result) {
        Cmds "./test/echo_cmd.rb <%= arg %>", "hello world!"
      }

      it_behaves_like "executes correctly"
    end

    context "keyword args" do
      let(:result) {
        Cmds "./test/echo_cmd.rb <%= s %>", s: "hello world!"
      }

      it_behaves_like "executes correctly"
    end

  end # context echo_cmd.rb 'hello world!'

  it "is reusable" do
    args_cmd = Cmds.new "./test/echo_cmd.rb <%= arg %>"
    kwds_cmd = Cmds.new "./test/echo_cmd.rb <%= s %>"

    args = ["arg one", "arg two", "arg three"]

    args.each do |arg|
      results = [
        args_cmd.capture(arg),
        kwds_cmd.capture(s: arg)
      ]

      results.each do |result|
        expect( echo_cmd_argv result ).to eq [arg]
      end
    end
  end # is reusable

  context "input" do
    let(:input) {
      <<-BLOCK
        one
        two
        three
        four!
      BLOCK
    }

    it "accepts input via options" do
      cmd = Cmds.new(ECHO_CMD, input: input)
      expect( echo_cmd_stdin cmd.capture ).to eq input
    end

    it "accepts input via block" do
      cmd = Cmds.new ECHO_CMD
      expect( echo_cmd_stdin cmd.capture { input } ).to eq input
    end

    it "accepts input from a stream" do
      File.open "./test/lines.txt" do |f|
        input = f.read
        f.rewind

        cmd = Cmds.new ECHO_CMD
        expect( echo_cmd_stdin cmd.capture { f } ).to eq input
      end
    end
  end # context input
end # Cmds::capture


text:
import React from 'react';
import { LocaleProvider as _LocaleProvider } from 'antd';

class LocaleProvider extends React.Component{
  constructor(props){
    super(props);
  }
  render(){
    return (<_LocaleProvider {...this.props}/>);
  }
}

export default LocaleProvider


text:
using namespace GSparseVolumes;

InternalNodesIterator::InternalNodesIterator(const std::vector<GridPtr>& grids)
{
	m_internalNodes.resize(grids.size());
	m_internalNodeIterators.resize(grids.size());
	for (size_t i = 0; i < grids.size(); ++i)
	{
		m_internalNodeIterators[i] = grids[i]->createInternalNodeIterator();
	}
}

const InternalNodes* InternalNodesIterator::next()
{
	for (size_t i = 0; i < m_internalNodeIterators.size(); ++i)
	{
		m_internalNodes[i] = m_internalNodeIterators[i]->next();
	}

	if (m_internalNodes[0] != 0)
	{
		return &m_internalNodes;
	}
	return 0;
}

bool InternalNodesIterator::hasNext() const
{
	if (!m_internalNodeIterators.empty())
	{
		return m_internalNodeIterators.back()->hasNext();
	}
	return false;
}

LeavesIterator::LeavesIterator(const InternalNodes& internalNodes)
{
	m_leaves.resize(internalNodes.size());
	for (size_t i = 0; i < internalNodes.size(); ++i)
	{
		m_leafIterators.push_back(internalNodes[i]->createLeafIterator());
	}
}

const Leaves* LeavesIterator::next()
{
	for (size_t i = 0; i < m_leafIterators.size(); ++i)
	{
		m_leaves[i] = m_leafIterators[i]->next();
	}

	if (m_leaves[0] != 0)
	{
		return &m_leaves;
	}
	return 0;
}

bool LeavesIterator::hasNext() const
{
	if (!m_leafIterators.empty())
	{
		return m_leafIterators.back()->hasNext();
	}
	return false;
}


text:
var ConsoleModule = (function() {
    function ConsoleModule(container) {
        this.container = $(container);
        return this;
    }

    ConsoleModule.prototype = {
        writeLine: function(message) { _writeLine.call(this, _format(arguments)); },
        writeError: function(message) { _writeError.call(this, _format(arguments)); },
        writeWarning: function(message) { _writeWarning.call(this, _format(arguments)); }
    }

    function _writeLine(message) {
        var span = null;
        if (this.container) {
            if (message) {
                span = $('<span/>').text(message);
            }

            this.container.append(span);
            this.container.append($('<br/>'));
        }
        return span;
    }

    function _writeError(message) {
        var errorMsg = _writeLine.call(this, message);
        if (errorMsg) errorMsg.css('color', 'red');
    }

    function _writeWarning(message) {
        var warningMsg = _writeLine.call(this, message);
        if (warningMsg) warningMsg.css('color', 'yellow');
    }

    function _format(args) {
        if (arguments[0].length == 0) {
            return null;
        }

        var selfArguments = arguments[0];
        var message = arguments[0][0];

        return message.replace(/\{(\d+)\}/g, function (match, arg) {
            return selfArguments[+arg + 1];
        })
    }

    return ConsoleModule;
})();


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
  ~
  ~ WSO2 Inc. 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.
  -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>siddhi</artifactId>
        <groupId>io.siddhi</groupId>
        <version>5.1.20-SNAPSHOT</version>
        <relativePath>../../pom.xml</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>siddhi-query-api</artifactId>
    <name>Siddhi Query API</name>
    <packaging>bundle</packaging>

    <dependencies>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                        <Bundle-Name>${project.artifactId}</Bundle-Name>
                        <Export-Package>
                            io.siddhi.query.api;version="${project.version}",
                            io.siddhi.query.api.*;version="${project.version}"
                        </Export-Package>
                        <Import-Package>
                            *;resolution:=optional
                        </Import-Package>
                        <DynamicImport-Package>*</DynamicImport-Package>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <argLine>${jacoco.agent.argLine}</argLine>
                    <environmentVariables>
                        <testEnvironmentVariable>EnvironmentVariable</testEnvironmentVariable>
                    </environmentVariables>
                    <suiteXmlFiles>
                        <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
                    </suiteXmlFiles>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>jacoco-initialize</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <destFile>${basedir}/target/jacoco.exec</destFile>
                            <propertyName>jacoco.agent.argLine</propertyName>
                        </configuration>
                    </execution>
                    <execution>
                        <id>jacoco-site</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <dataFile>${basedir}/target/jacoco.exec</dataFile>
                            <outputDirectory>${basedir}/target/coverage-reports/site</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <properties>
        <mavan.findbugsplugin.exclude.file>../../findbugs-exclude.xml</mavan.findbugsplugin.exclude.file>
    </properties>

</project>


text:
<?php

declare(strict_types=1);

namespace Sylius\Bundle\CoreBundle\Form\Type\Shipping\Rule;

use Sylius\Bundle\MoneyBundle\Form\Type\MoneyType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

final class OrderTotalLessThanOrEqualConfigurationType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add('amount', MoneyType::class, [
                'label' => 'sylius.form.shipping_method_rule.amount',
                'currency' => $options['currency'],
            ])
        ;
    }

    public function configureOptions(OptionsResolver $resolver): void
    {
        $resolver
            ->setRequired('currency')
            ->setAllowedTypes('currency', 'string')
        ;
    }

    public function getBlockPrefix(): string
    {
        return 'sylius_shipping_method_rule_order_total_less_than_or_equal_configuration';
    }
}


text:
using System;
using System.Windows.Markup;
using System.Xml.Serialization;

namespace SharpLib.Docking
{
    [ContentProperty("Children")]
    [Serializable]
    public class LayoutAnchorGroup : LayoutGroup<LayoutAnchorable>, ILayoutPreviousContainer, ILayoutPaneSerializable
    {
        #region Поля

        private string _id;

        [field: NonSerialized]
        private ILayoutContainer _previousContainer;

        #endregion

        #region Свойства

        [XmlIgnore]
        ILayoutContainer ILayoutPreviousContainer.PreviousContainer
        {
            get { return _previousContainer; }
            set
            {
                if (_previousContainer != value)
                {
                    _previousContainer = value;
                    RaisePropertyChanged("PreviousContainer");
                    var paneSerializable = _previousContainer as ILayoutPaneSerializable;
                    if (paneSerializable != null &&
                        paneSerializable.Id == null)
                    {
                        paneSerializable.Id = Guid.NewGuid().ToString();
                    }
                }
            }
        }

        string ILayoutPaneSerializable.Id
        {
            get { return _id; }
            set { _id = value; }
        }

        string ILayoutPreviousContainer.PreviousContainerId { get; set; }

        #endregion

        #region Методы

        protected override bool GetVisibility()
        {
            return Children.Count > 0;
        }

        public override void WriteXml(System.Xml.XmlWriter writer)
        {
            if (_id != null)
            {
                writer.WriteAttributeString("Id", _id);
            }
            if (_previousContainer != null)
            {
                var paneSerializable = _previousContainer as ILayoutPaneSerializable;
                if (paneSerializable != null)
                {
                    writer.WriteAttributeString("PreviousContainerId", paneSerializable.Id);
                }
            }

            base.WriteXml(writer);
        }

        public override void ReadXml(System.Xml.XmlReader reader)
        {
            if (reader.MoveToAttribute("Id"))
            {
                _id = reader.Value;
            }
            if (reader.MoveToAttribute("PreviousContainerId"))
            {
                ((ILayoutPreviousContainer)this).PreviousContainerId = reader.Value;
            }

            base.ReadXml(reader);
        }

        #endregion
    }
}


text:
package block

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"fmt"
	"io"

	"github.com/go-openapi/runtime"

	strfmt "github.com/go-openapi/strfmt"

	"github.com/victorock/gocoprhd/models"
)

// CreateSnapshotFullCopyReader is a Reader for the CreateSnapshotFullCopy structure.
type CreateSnapshotFullCopyReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the recieved o.
func (o *CreateSnapshotFullCopyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {

	case 202:
		result := NewCreateSnapshotFullCopyAccepted()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil

	default:
		result := NewCreateSnapshotFullCopyDefault(response.Code())
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	}
}

// NewCreateSnapshotFullCopyAccepted creates a CreateSnapshotFullCopyAccepted with default headers values
func NewCreateSnapshotFullCopyAccepted() *CreateSnapshotFullCopyAccepted {
	return &CreateSnapshotFullCopyAccepted{}
}

/*CreateSnapshotFullCopyAccepted handles this case with default header values.

Task Object
*/
type CreateSnapshotFullCopyAccepted struct {
	Payload *models.Task
}

func (o *CreateSnapshotFullCopyAccepted) Error() string {
	return fmt.Sprintf("[POST /block/snapshots/{id}/protection/full-copies.json][%d] createSnapshotFullCopyAccepted  %+v", 202, o.Payload)
}

func (o *CreateSnapshotFullCopyAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.Task)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewCreateSnapshotFullCopyDefault creates a CreateSnapshotFullCopyDefault with default headers values
func NewCreateSnapshotFullCopyDefault(code int) *CreateSnapshotFullCopyDefault {
	return &CreateSnapshotFullCopyDefault{
		_statusCode: code,
	}
}

/*CreateSnapshotFullCopyDefault handles this case with default header values.

Error Message
*/
type CreateSnapshotFullCopyDefault struct {
	_statusCode int

	Payload *models.Error
}

// Code gets the status code for the create snapshot full copy default response
func (o *CreateSnapshotFullCopyDefault) Code() int {
	return o._statusCode
}

func (o *CreateSnapshotFullCopyDefault) Error() string {
	return fmt.Sprintf("[POST /block/snapshots/{id}/protection/full-copies.json][%d] CreateSnapshotFullCopy default  %+v", o._statusCode, o.Payload)
}

func (o *CreateSnapshotFullCopyDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.Error)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}


text:
set -eux
SVCACCT_FILE="dspci-wb-gcr-service-account.json"
GCR_SVCACCT_VAULT="secret/dsde/dsp-techops/common/$SVCACCT_FILE"
VAULT_TOKEN=${VAULT_TOKEN:-$(cat /etc/vault-token-dsde)}

docker run --rm  -e VAULT_TOKEN=$VAULT_TOKEN \
   broadinstitute/dsde-toolbox:latest vault read --format=json ${GCR_SVCACCT_VAULT} \
   | jq .data > ${SVCACCT_FILE}

./script/build.sh jar -d push -g gcr.io/broad-dsp-gcr-public/${PROJECT} -k ${SVCACCT_FILE}

# clean up
rm -f ${SVCACCT_FILE}


text:
#region copyright
// (C) Copyright 2015 Dinu Marius-Constantin (http://dinu.at) and others.
//
// 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.
//
// Contributors:
//     Dinu Marius-Constantin
//     Wurm Florian
#endregion
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using UFO.Server.Dal.Common;
using UFO.Server.Domain;

namespace UFO.Server.Dal.Dummy
{
    class UserDeo : IUserDao
    {
        public DaoResponse<User> Insert(User entity)
        {
            throw new System.NotImplementedException();
        }

        public DaoResponse<User> Update(User entity)
        {
            throw new System.NotImplementedException();
        }

        public DaoResponse<User> Delete(User entity)
        {
            throw new System.NotImplementedException();
        }

        public DaoResponse<List<User>> SelectAll()
        {
            return DaoResponse.QuerySuccessful<List<User>>(DataCollection.Users.ToList());
        }

        public DaoResponse<List<User>> SelectWhere<T>(Expression<Filter<User, T>> filterExpression, T criteria = default(T))
        {
            return DaoResponse.QuerySuccessful<List<User>>(filterExpression.Compile()(DataCollection.Users, criteria).ToList());
        }

        public DaoResponse<User> SelectById(int id)
        {
            throw new System.NotImplementedException();
        }

        public DaoResponse<bool> VerifyAdminCredentials(User user)
        {
            throw new System.NotImplementedException();
        }
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <title>pymatgen.vis.plotters module — pymatgen 2019.7.2 documentation</title>
    <link rel="stylesheet" href="_static/basic.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />

    <link rel="shortcut icon" href="_static/favicon.ico"/>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />

Navigation

          index

          modules |

pymatgen 2019.7.2 documentation »

pymatgen.vis.plotters module¶

class SpectrumPlotter(xshift=0.0, yshift=0.0, stack=False, color_cycle=('qualitative', 'Set1_9'))[source]¶

Bases: object

Class for plotting Spectrum objects and subclasses. Note that the interface
is extremely flexible given that there are many different ways in which
people want to view spectra. The typical usage is:

# Initializes plotter with some optional args. Defaults are usually
# fine,
plotter = SpectrumPlotter()

# Adds a DOS (A kind of spectra) with a label.
plotter.add_spectrum("Total DOS", dos)

# Alternatively, you can add a dict of DOSs. This is the typical
# form returned by CompleteDos.get_spd/element/others_dos().
plotter.add_spectra({"dos1": dos1, "dos2": dos2})

Parameters

xshift (float) – A shift that is applied to the x values. This is
commonly used to shift to an arbitrary zero. E.g., zeroing at the
Fermi energy in DOS, or at the absorption edge in XAS spectra. The
same xshift is applied to all spectra.

yshift (float) – A shift that is applied to the y values. This is
commonly used to displace spectra for easier visualization.
Successive spectra are applied successive shifts.

stack (bool) – Whether to stack plots rather than simply plot them.
For example, DOS plot can usually be stacked to look at the
contribution of each orbital.

color_cycle (str) – Default color cycle to use. Note that this can be
overridden

add_spectra(spectra_dict, key_sort_func=None)[source]¶

Add a dictionary of doses, with an optional sorting function for the
keys.

Parameters

dos_dict – dict of {label: Dos}

key_sort_func – function used to sort the dos_dict keys.

add_spectrum(label, spectrum, color=None)[source]¶

Adds a Spectrum for plotting.

Parameters

label (str) – Label for the Spectrum. Must be unique.

spectrum – Spectrum object

color (str) – This is passed on to matplotlib. E.g., "k–" indicates
a dashed black line. If None, a color will be chosen based on
the default color cycle.

get_plot(xlim=None, ylim=None)[source]¶

Get a matplotlib plot showing the DOS.

Parameters

xlim – Specifies the x-axis limits. Set to None for automatic
determination.

ylim – Specifies the y-axis limits.

save_plot(filename, img_format='eps', **kwargs)[source]¶

Save matplotlib plot to a file.

Parameters

filename – Filename to write to.

img_format – Image format to use. Defaults to EPS.

show(**kwargs)[source]¶

Show the plot using matplotlib.

Navigation

          index

          modules |

pymatgen 2019.7.2 documentation »

        © Copyright 2011, Pymatgen Development Team.
      Created using Sphinx 2.0.1.

This page uses
Google Analytics to collect statistics. You can disable it by blocking
the JavaScript coming from www.google-analytics.com.


text:
/**
 */
package archoptions.tests;

import archoptions.ArchOption;

import junit.framework.TestCase;

/**
 *
 * A test case for the model object 'Arch Option'.
 *
 * @generated
 */
public abstract class ArchOptionTest extends TestCase {

	/**
	 * The fixture for this Arch Option test case.
	 *
	 *
	 * @generated
	 */
	protected ArchOption fixture = null;

	/**
	 * Constructs a new Arch Option test case with the given name.
	 *
	 *
	 * @generated
	 */
	public ArchOptionTest(String name) {
		super(name);
	}

	/**
	 * Sets the fixture for this Arch Option test case.
	 *
	 *
	 * @generated
	 */
	protected void setFixture(ArchOption fixture) {
		this.fixture = fixture;
	}

	/**
	 * Returns the fixture for this Arch Option test case.
	 *
	 *
	 * @generated
	 */
	protected ArchOption getFixture() {
		return fixture;
	}

} //ArchOptionTest