text:
package org.keycloak.testsuite.model;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.TargetsContainer;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.keycloak.admin.client.resource.UserResource;
import org.keycloak.component.ComponentModel;
import org.keycloak.models.*;
import org.keycloak.models.utils.KeycloakModelUtils;
import org.keycloak.protocol.oidc.OIDCLoginProtocol;
import org.keycloak.representations.idm.RealmRepresentation;
import org.keycloak.services.managers.RealmManager;
import org.keycloak.storage.client.ClientStorageProviderModel;
import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
import org.keycloak.testsuite.arquillian.annotation.ModelTest;
import org.keycloak.testsuite.federation.HardcodedClientStorageProviderFactory;
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;

import java.util.List;
import java.util.concurrent.atomic.AtomicReference;

import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;

/**
 * @author Marek Posolda
 */
public class UserConsentModelTest extends AbstractTestRealmKeycloakTest {

    private static ComponentModel clientStorageComponent;

    @Deployment
    @TargetsContainer(AUTH_SERVER_CURRENT)
    public static WebArchive deploy() {
        return RunOnServerDeployment.create(UserResource.class, UserConsentModelTest.class)
                .addPackages(true,
                        "org.keycloak.testsuite",
                        "org.keycloak.testsuite.model");
    }

    @Before
    public void before() {
        testingClient.server().run(session -> {
            setupEnv(session);
        });
    }

    @After
    public void after() {
        testingClient.server().run(session -> {

            RealmManager realmManager = new RealmManager(session);
            RealmModel realm = realmManager.getRealmByName("original");

            if (realm != null) {

                session.sessions().removeUserSessions(realm);
                UserModel user = session.users().getUserByUsername("user", realm);
                UserModel user1 = session.users().getUserByUsername("user1", realm);
                UserModel user2 = session.users().getUserByUsername("user2", realm);
                UserModel user3 = session.users().getUserByUsername("user3", realm);

                UserManager um = new UserManager(session);
                if (user != null) {
                    um.removeUser(realm, user);
                }
                if (user1 != null) {
                    um.removeUser(realm, user1);
                }
                if (user2 != null) {
                    um.removeUser(realm, user2);
                }
                if (user3 != null) {
                    um.removeUser(realm, user3);
                }
                realmManager.removeRealm(realm);
            }
        });
    }

    public static void setupEnv(KeycloakSession session) {

        KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionEnv) -> {
            KeycloakSession currentSession = sessionEnv;

            RealmManager realmManager = new RealmManager(currentSession);
            RealmModel realm = realmManager.createRealm("original");

            ClientModel fooClient = realm.addClient("foo-client");
            ClientModel barClient = realm.addClient("bar-client");

            ClientScopeModel fooScope = realm.addClientScope("foo");
            fooScope.setProtocol(OIDCLoginProtocol.LOGIN_PROTOCOL);

            ClientScopeModel barScope = realm.addClientScope("bar");
            fooScope.setProtocol(OIDCLoginProtocol.LOGIN_PROTOCOL);

            UserModel john = currentSession.users().addUser(realm, "john");
            UserModel mary = currentSession.users().addUser(realm, "mary");

            UserConsentModel johnFooGrant = new UserConsentModel(fooClient);
            johnFooGrant.addGrantedClientScope(fooScope);
            realmManager.getSession().users().addConsent(realm, john.getId(), johnFooGrant);

            UserConsentModel johnBarGrant = new UserConsentModel(barClient);
            johnBarGrant.addGrantedClientScope(barScope);

            // Update should fail as grant doesn't yet exists
            try {
                realmManager.getSession().users().updateConsent(realm, john.getId(), johnBarGrant);
                Assert.fail("Not expected to end here");
            } catch (ModelException expected) {
            }

            realmManager.getSession().users().addConsent(realm, john.getId(), johnBarGrant);

            UserConsentModel maryFooGrant = new UserConsentModel(fooClient);
            maryFooGrant.addGrantedClientScope(fooScope);
            realmManager.getSession().users().addConsent(realm, mary.getId(), maryFooGrant);

            ClientStorageProviderModel clientStorage = new ClientStorageProviderModel();
            clientStorage.setProviderId(HardcodedClientStorageProviderFactory.PROVIDER_ID);
            clientStorage.getConfig().putSingle(HardcodedClientStorageProviderFactory.CLIENT_ID, "hardcoded-client");
            clientStorage.getConfig().putSingle(HardcodedClientStorageProviderFactory.REDIRECT_URI, "http://localhost:8081/*");
            clientStorage.getConfig().putSingle(HardcodedClientStorageProviderFactory.CONSENT, "true");
            clientStorage.setParentId(realm.getId());
            clientStorageComponent = realm.addComponentModel(clientStorage);

            ClientModel hardcodedClient = currentSession.realms().getClientByClientId("hardcoded-client", realm);

            Assert.assertNotNull(hardcodedClient);

            UserConsentModel maryHardcodedGrant = new UserConsentModel(hardcodedClient);
            realmManager.getSession().users().addConsent(realm, mary.getId(), maryHardcodedGrant);
        });
    }

    @Test
    @ModelTest
    public void basicConsentTest(KeycloakSession session) {

        KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionCT) -> {
            KeycloakSession currentSession = sessionCT;

            RealmModel realm = currentSession.realms().getRealm("original");

            ClientModel fooClient = realm.getClientByClientId("foo-client");
            ClientModel barClient = realm.getClientByClientId("bar-client");

            UserModel john = currentSession.users().getUserByUsername("john", realm);
            UserModel mary = currentSession.users().getUserByUsername("mary", realm);

            UserConsentModel johnFooConsent = currentSession.users().getConsentByClient(realm, john.getId(), fooClient.getId());
            Assert.assertEquals(johnFooConsent.getGrantedClientScopes().size(), 1);
            Assert.assertTrue(isClientScopeGranted(realm, "foo", johnFooConsent));
            Assert.assertNotNull("Created Date should be set", johnFooConsent.getCreatedDate());
            Assert.assertNotNull("Last Updated Date should be set", johnFooConsent.getLastUpdatedDate());

            UserConsentModel johnBarConsent = currentSession.users().getConsentByClient(realm, john.getId(), barClient.getId());
            Assert.assertEquals(johnBarConsent.getGrantedClientScopes().size(), 1);
            Assert.assertTrue(isClientScopeGranted(realm, "bar", johnBarConsent));
            Assert.assertNotNull("Created Date should be set", johnBarConsent.getCreatedDate());
            Assert.assertNotNull("Last Updated Date should be set", johnBarConsent.getLastUpdatedDate());

            UserConsentModel maryConsent = currentSession.users().getConsentByClient(realm, mary.getId(), fooClient.getId());
            Assert.assertEquals(maryConsent.getGrantedClientScopes().size(), 1);
            Assert.assertTrue(isClientScopeGranted(realm, "foo", maryConsent));
            Assert.assertNotNull("Created Date should be set", maryConsent.getCreatedDate());
            Assert.assertNotNull("Last Updated Date should be set", maryConsent.getLastUpdatedDate());

            ClientModel hardcodedClient = currentSession.realms().getClientByClientId("hardcoded-client", realm);
            UserConsentModel maryHardcodedConsent = currentSession.users().getConsentByClient(realm, mary.getId(), hardcodedClient.getId());
            Assert.assertEquals(maryHardcodedConsent.getGrantedClientScopes().size(), 0);
            Assert.assertNotNull("Created Date should be set", maryHardcodedConsent.getCreatedDate());
            Assert.assertNotNull("Last Updated Date should be set", maryHardcodedConsent.getLastUpdatedDate());

            Assert.assertNull(currentSession.users().getConsentByClient(realm, mary.getId(), barClient.getId()));
            Assert.assertNull(currentSession.users().getConsentByClient(realm, john.getId(), hardcodedClient.getId()));
        });
    }

    @Test
    @ModelTest
    public void getAllConsentTest(KeycloakSession session) {

        KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionACT) -> {
            KeycloakSession currentSession = sessionACT;
            RealmModel realm = currentSession.realms().getRealm("original");

            ClientModel fooClient = realm.getClientByClientId("foo-client");

            UserModel john = currentSession.users().getUserByUsername("john", realm);
            UserModel mary = currentSession.users().getUserByUsername("mary", realm);

            List<UserConsentModel> johnConsents = currentSession.users().getConsents(realm, john.getId());
            Assert.assertEquals(2, johnConsents.size());

            ClientModel hardcodedClient = currentSession.realms().getClientByClientId("hardcoded-client", realm);

            List<UserConsentModel> maryConsents = currentSession.users().getConsents(realm, mary.getId());
            Assert.assertEquals(2, maryConsents.size());
            UserConsentModel maryConsent = maryConsents.get(0);
            UserConsentModel maryHardcodedConsent = maryConsents.get(1);
            if (maryConsents.get(0).getClient().getId().equals(hardcodedClient.getId())) {
                maryConsent = maryConsents.get(1);
                maryHardcodedConsent = maryConsents.get(0);

            }
            Assert.assertEquals(maryConsent.getClient().getId(), fooClient.getId());
            Assert.assertEquals(maryConsent.getGrantedClientScopes().size(), 1);
            Assert.assertTrue(isClientScopeGranted(realm, "foo", maryConsent));

            Assert.assertEquals(maryHardcodedConsent.getClient().getId(), hardcodedClient.getId());
            Assert.assertEquals(maryHardcodedConsent.getGrantedClientScopes().size(), 0);
        });
    }

    @Test
    @ModelTest
    public void updateWithClientScopeRemovalTest(KeycloakSession session) {

        KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession removalTestSession1) -> {
            KeycloakSession currentSession = removalTestSession1;
            RealmModel realm = currentSession.realms().getRealm("original");

            ClientModel fooClient = realm.getClientByClientId("foo-client");
            UserModel john = currentSession.users().getUserByUsername("john", realm);

            UserConsentModel johnConsent = currentSession.users().getConsentByClient(realm, john.getId(), fooClient.getId());
            Assert.assertEquals(1, johnConsent.getGrantedClientScopes().size());

            // Remove foo protocol mapper from johnConsent
            ClientScopeModel fooScope = KeycloakModelUtils.getClientScopeByName(realm, "foo");
            johnConsent.getGrantedClientScopes().remove(fooScope);

            currentSession.users().updateConsent(realm, john.getId(), johnConsent);
        });

        KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession removalTestSession2) -> {
            KeycloakSession currentSession = removalTestSession2;
            RealmModel realm = currentSession.realms().getRealm("original");

            ClientModel fooClient = realm.getClientByClientId("foo-client");
            UserModel john = currentSession.users().getUserByUsername("john", realm);
            UserConsentModel johnConsent = currentSession.users().getConsentByClient(realm, john.getId(), fooClient.getId());

            Assert.assertEquals(johnConsent.getGrantedClientScopes().size(), 0);
            Assert.assertTrue("Created date should be less than last updated date", johnConsent.getCreatedDate() < johnConsent.getLastUpdatedDate());
        });
    }

    @Test
    @ModelTest
    public void revokeTest(KeycloakSession session) {

        KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionRT1) -> {
            KeycloakSession currentSession = sessionRT1;
            RealmModel realm = currentSession.realms().getRealm("original");

            ClientModel fooClient = realm.getClientByClientId("foo-client");
            UserModel john = currentSession.users().getUserByUsername("john", realm);
            UserModel mary = currentSession.users().getUserByUsername("mary", realm);

            currentSession.users().revokeConsentForClient(realm, john.getId(), fooClient.getId());
            ClientModel hardcodedClient = currentSession.realms().getClientByClientId("hardcoded-client", realm);
            currentSession.users().revokeConsentForClient(realm, mary.getId(), hardcodedClient.getId());
        });

        KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionRT2) -> {
            KeycloakSession currentSession = sessionRT2;
            RealmModel realm = currentSession.realms().getRealm("original");

            ClientModel fooClient = realm.getClientByClientId("foo-client");
            ClientModel hardcodedClient = currentSession.realms().getClientByClientId("hardcoded-client", realm);

            UserModel john = currentSession.users().getUserByUsername("john", realm);
            Assert.assertNull(currentSession.users().getConsentByClient(realm, john.getId(), fooClient.getId()));
            UserModel mary = currentSession.users().getUserByUsername("mary", realm);
            Assert.assertNull(currentSession.users().getConsentByClient(realm, mary.getId(), hardcodedClient.getId()));
        });
    }

    @Test
    @ModelTest
    public void deleteUserTest(KeycloakSession session) {
        // Validate user deleted without any referential constraint errors
        KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionUT) -> {
            KeycloakSession currentSession = sessionUT;
            RealmModel realm = currentSession.realms().getRealm("original");

            UserModel john = currentSession.users().getUserByUsername("john", realm);
            currentSession.users().removeUser(realm, john);
            UserModel mary = currentSession.users().getUserByUsername("mary", realm);
            currentSession.users().removeUser(realm, mary);
        });
    }

    @Test
    @ModelTest
    public void deleteClientScopeTest(KeycloakSession session) {

        KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionST1) -> {
            KeycloakSession currentSession = sessionST1;
            RealmModel realm = currentSession.realms().getRealm("original");

            ClientScopeModel fooScope = KeycloakModelUtils.getClientScopeByName(realm, "foo");
            realm.removeClientScope(fooScope.getId());
        });

        KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionST2) -> {
            KeycloakSession currentSession = sessionST2;
            RealmModel realm = currentSession.realms().getRealm("original");

            ClientModel fooClient = realm.getClientByClientId("foo-client");

            UserModel john = currentSession.users().getUserByUsername("john", realm);
            UserConsentModel johnConsent = currentSession.users().getConsentByClient(realm, john.getId(), fooClient.getId());

            Assert.assertEquals(johnConsent.getGrantedClientScopes().size(), 0);
        });
    }

    @Test
    @ModelTest
    public void deleteClientTest(KeycloakSession session) {

        AtomicReference<String> barClientID = new AtomicReference<>();

        KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionDCT1) -> {
            KeycloakSession currentSession = sessionDCT1;
            RealmModel realm = currentSession.realms().getRealm("original");

            ClientModel barClient = realm.getClientByClientId("bar-client");
            barClientID.set(barClient.getId());

            realm.removeClient(barClient.getId());
        });

        KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionDCT2) -> {
            KeycloakSession currentSession = sessionDCT2;
            RealmModel realm = currentSession.realms().getRealm("original");

            ClientModel fooClient = realm.getClientByClientId("foo-client");
            Assert.assertNull(realm.getClientByClientId("bar-client"));

            UserModel john = currentSession.users().getUserByUsername("john", realm);
            ClientModel barClient = realm.getClientByClientId("bar-client");

            UserConsentModel johnFooConsent = currentSession.users().getConsentByClient(realm, john.getId(), fooClient.getId());
            Assert.assertEquals(johnFooConsent.getGrantedClientScopes().size(), 1);
            Assert.assertTrue(isClientScopeGranted(realm, "foo", johnFooConsent));

            Assert.assertNull(currentSession.users().getConsentByClient(realm, john.getId(), barClientID.get()));
        });
    }

    @Test
    @ModelTest
    public void deleteClientStorageTest(KeycloakSession session) {

        KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionCST1) -> {
            KeycloakSession currentSession = sessionCST1;
            RealmModel realm = currentSession.realms().getRealm("original");

            realm.removeComponent(clientStorageComponent);
        });

        KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionCST2) -> {
            KeycloakSession currentSession = sessionCST2;
            RealmModel realm = currentSession.realms().getRealm("original");

            ClientModel hardcodedClient = currentSession.realms().getClientByClientId("hardcoded-client", realm);
            Assert.assertNull(hardcodedClient);

            UserModel mary = currentSession.users().getUserByUsername("mary", realm);

            List<UserConsentModel> maryConsents = currentSession.users().getConsents(realm, mary.getId());
            Assert.assertEquals(1, maryConsents.size());
        });
    }

    private boolean isClientScopeGranted(RealmModel realm, String scopeName, UserConsentModel consentModel) {
        ClientScopeModel clientScope = KeycloakModelUtils.getClientScopeByName(realm, scopeName);
        return consentModel.isClientScopeGranted(clientScope);
    }

    @Override
    public void configureTestRealm(RealmRepresentation testRealm) {

    }
}


text:
using UnityEngine;
using System.Collections;

namespace Framework.Resource.Loader
{
    public class AssetLoader : BaseLoader
    {
        public Object asset { private set; get; }

        protected override IEnumerator GenerateLoadProcess ()
        {
            ResourceRequest request = Resources.LoadAsync (path);
            request.allowSceneActivation = false;
            while (request.progress < 0.9f && request.isDone == false)
            {
                progress = request.progress;
                yield return null;
            }
            request.allowSceneActivation = true;

            if (request.asset == null)
            {
                Failed ("NotFound");
                yield break;
            }

            asset = request.asset;
            Successed ();
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
set -e
set -x

conda config --add channels r
conda config --add channels bioconda

git clone https://github.com/daler/hubward-studies.git /tmp/hubward-studies
conda install -y --file /tmp/hubward-studies/requirements.txt

# make a copy of everything to avoid making changes in the current directory
(cd .. && cp -r hubward /tmp/hubward)

cd /tmp/hubward

# Finally run the example
conda install -y --file conda-requirements.txt --file requirements.txt

# Install hubward
python setup.py install

# SSH (to localhost) setup
service ssh start
mkdir -p /root/.ssh
ssh-keygen -f /root/.ssh/id_rsa -N ""
ssh-keyscan -H localhost >> /root/.ssh/known_hosts
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys

cd /tmp/hubward-studies/test
hubward process yip-2012
hubward process lieberman-2009

hubward liftover \
    --from_assembly hg18 \
    --to_assembly hg19 \
    lieberman-2009 \
    lieberman-2009-hg19

cat > group.yaml << EOF
name: "hubward-example"
genome: "hg19"
short_label: "Hubward example"
long_label: "Hubward example tracks"
hub_url: "http://example.com/hubs/example.hub.txt"
email: "dalerr@niddk.nih.gov"

studies:
    - "yip-2012"
    - "lieberman-2009-hg19"
EOF

hubward upload --host localhost --user root --hub_remote $(pwd)/uploaded_hub group.yaml

# check existence of expected files after "upload"
for _filename in \
    lieberman2009.html \
    lieberman2009Anchor_bin.bigBed \
    lieberman2009HiC_chr1152000005299999.bigWig \
    lieberman2009Paired_interactions.bam \
    lieberman2009Paired_interactions.bam.bai \
    trackDb.txt \
    yip2012.html \
    yip2012K562_DRME.bigBed \
    yip2012K562_DRMWE.bigBed \
; do
    filename="$(pwd)/hg19/$_filename"
    [[ -f $filename ]] || (echo "$filename not found"; exit 1)
done
[[ -f "$(pwd)/uploaded_hub" ]] || (echo "$(pwd)/uploaded_hub not found"; exit 1)

rm group.yaml

# Ensure the skeleton itself works
cd /tmp
hubward skeleton demo1
hubward process demo1
hubward upload demo1/example-group.yaml --user root
rm -r demo1

# Skeleton with metadata-builder
hubward skeleton --use-metadata-builder demo2
hubward process demo2
hubward upload demo2/example-group.yaml --user root
rm -r demo2


text:
class Massren < FPM::Cookery::Recipe
  description 'Easily rename multiple files using your text editor'

  name     'massren'
  version  '20161227'
  revision 'sbx'
  homepage 'https://github.com/laurent22/massren'

  source 'https://github.com/laurent22/massren',
    :with => :git, :ref => '4de39fa7117e4a8a40805ec17d8d584aa5253452'

  section 'utilities'

  provides  name
  conflicts name
  replaces  name

  # Define the build and install dependancies for RedHat-a-likes (RPM names)
  platforms [:redhat, :fedora, :centos] do
    build_depends 'golang'
  end

  def build
    ENV['GOPATH'] = builddir
    ENV['GOBIN'] = builddir('bin')
    system "go get"
    system "go build"
  end

  def install
    bin.install builddir("bin/#{name}-HEAD"), name
  end
end


text:
using namespace caf;

using std::endl;

namespace {

struct fixture {
  actor_system_config cfg;

  void test_spawn(message args, bool expect_fail = false) {
    actor_system system{cfg};
    scoped_actor self{system};
    MESSAGE("set aut");
    strong_actor_ptr res;
    std::set<std::string> ifs;
    scoped_execution_unit context{&system};
    actor_config actor_cfg{&context};
    auto aut = system.spawn<actor>("test_actor", std::move(args));
    if (expect_fail) {
      CAF_REQUIRE(!aut);
      return;
    }
    CAF_REQUIRE(aut);
    self->wait_for(*aut);
    MESSAGE("aut done");
  }
};

struct test_actor_no_args : event_based_actor {
  using event_based_actor::event_based_actor;
};

struct test_actor_one_arg : event_based_actor {
  test_actor_one_arg(actor_config& conf, int value) : event_based_actor(conf) {
    CHECK_EQ(value, 42);
  }
};

} // namespace

BEGIN_FIXTURE_SCOPE(fixture)

CAF_TEST(fun_no_args) {
  auto test_actor_one_arg = [] { MESSAGE("inside test_actor"); };
  cfg.add_actor_type("test_actor", test_actor_one_arg);
  test_spawn(make_message());
  MESSAGE("test_spawn done");
}

CAF_TEST(fun_no_args_selfptr) {
  auto test_actor_one_arg = [](event_based_actor*) {
    MESSAGE("inside test_actor");
  };
  cfg.add_actor_type("test_actor", test_actor_one_arg);
  test_spawn(make_message());
}
CAF_TEST(fun_one_arg) {
  auto test_actor_one_arg = [](int i) { CHECK_EQ(i, 42); };
  cfg.add_actor_type("test_actor", test_actor_one_arg);
  test_spawn(make_message(42));
}

CAF_TEST(fun_one_arg_selfptr) {
  auto test_actor_one_arg = [](event_based_actor*, int i) { CHECK_EQ(i, 42); };
  cfg.add_actor_type("test_actor", test_actor_one_arg);
  test_spawn(make_message(42));
}

CAF_TEST(class_no_arg_invalid) {
  cfg.add_actor_type<test_actor_no_args>("test_actor");
  test_spawn(make_message(42), true);
}

CAF_TEST(class_no_arg_valid) {
  cfg.add_actor_type<test_actor_no_args>("test_actor");
  test_spawn(make_message());
}

CAF_TEST(class_one_arg_invalid) {
  cfg.add_actor_type<test_actor_one_arg, const int&>("test_actor");
  test_spawn(make_message(), true);
}

CAF_TEST(class_one_arg_valid) {
  cfg.add_actor_type<test_actor_one_arg, const int&>("test_actor");
  test_spawn(make_message(42));
}

END_FIXTURE_SCOPE()


text:
#include <config.h>

#include <phabos/ara/device.h>

extern struct device_driver tsb_pll_driver;
extern struct device_driver tsb_i2s_driver;

void tsb_driver_register(void)
{
#ifdef CONFIG_TSB_PLL
    device_register_driver(&tsb_pll_driver);
#endif

#ifdef CONFIG_ARCH_CHIP_TSB_I2S
    device_register_driver(&tsb_i2s_driver);
#endif
}


text:
<?php declare(strict_types=1);

namespace PHPUnit\TextUI\XmlConfiguration;

use function count;
use Countable;
use IteratorAggregate;

/**
 * @internal This class is not covered by the backward compatibility promise for PHPUnit
 * @psalm-immutable
 */
final class TestDirectoryCollection implements Countable, IteratorAggregate
{
    /**
     * @var TestDirectory[]
     */
    private $directories;

    /**
     * @param TestDirectory[] $directories
     */
    public static function fromArray(array $directories): self
    {
        return new self(...$directories);
    }

    private function __construct(TestDirectory ...$directories)
    {
        $this->directories = $directories;
    }

    /**
     * @return TestDirectory[]
     */
    public function asArray(): array
    {
        return $this->directories;
    }

    public function count(): int
    {
        return count($this->directories);
    }

    public function getIterator(): TestDirectoryCollectionIterator
    {
        return new TestDirectoryCollectionIterator($this);
    }

    public function isEmpty(): bool
    {
        return $this->count() === 0;
    }
}


text:
#ifndef _PDFENCRYPT_H_
#define _PDFENCRYPT_H_

#include "PdfDefines.h"
#include "PdfString.h"
#include "PdfReference.h"

#include <string.h>

namespace PoDoFo {

class PdfDictionary;
class PdfInputStream;
class PdfObject;
class PdfOutputStream;
class AESCryptoEngine;
#ifndef PODOFO_HAVE_OPENSSL_NO_RC4
class RC4CryptoEngine;
#endif // PODOFO_HAVE_OPENSSL_NO_RC4

/// Class representing PDF encryption methods. (For internal use only)
/// Based on code from Ulrich Telle: http://wxcode.sourceforge.net/components/wxpdfdoc/
/// Original Copyright header:
///////////////////////////////////////////////////////////////////////////////
// Name:        pdfencrypt.h
// Purpose:
// Author:      Ulrich Telle
// Modified by:
// Created:     2005-08-16
// Copyright:   (c) Ulrich Telle
// Licence:     wxWindows licence
///////////////////////////////////////////////////////////////////////////////

/** A class that is used to encrypt a PDF file and
 *  set document permisions on the PDF file.
 *
 *  As a user of this class, you have only to instanciate a
 *  object of this class and pass it to PdfWriter, PdfMemDocument,
 *  PdfStreamedDocument or PdfImmediateWriter.
 *  You do not have to call any other method of this class. The above
 *  classes know how to handle encryption using Pdfencrypt.
 *
 */
class PODOFO_API PdfEncrypt
{
public:

    /** A enum specifying a valid keylength for a PDF encryption key.
     *  Keys must be in the range 40 to 128 bit and have to be a
     *  multiple of 8.
     *
     *  Adobe Reader supports only keys with 40, 128 or 256 bits!
     */
    typedef enum {
        ePdfKeyLength_40  = 40,
        ePdfKeyLength_56  = 56,
        ePdfKeyLength_80  = 80,
        ePdfKeyLength_96  = 96,
        ePdfKeyLength_128 = 128
#ifdef PODOFO_HAVE_LIBIDN
        ,ePdfKeyLength_256 = 256
#endif //PODOFO_HAVE_LIBIDN
    } EPdfKeyLength;

    /** Set user permissions/restrictions on a document
     */
    typedef enum {
        ePdfPermissions_Print		= 0x00000004,  ///< Allow printing the document
        ePdfPermissions_Edit		= 0x00000008,  ///< Allow modifying the document besides annotations, form fields or chaning pages
        ePdfPermissions_Copy		= 0x00000010,  ///< Allow text and graphic extraction
        ePdfPermissions_EditNotes	= 0x00000020,  ///< Add or modify text annoations or form fields (if ePdfPermissions_Edit is set also allow to create interactive form fields including signature)
        ePdfPermissions_FillAndSign	= 0x00000100,  ///< Fill in existing form or signature fields
        ePdfPermissions_Accessible	= 0x00000200,  ///< Extract text and graphics to support user with disabillities
        ePdfPermissions_DocAssembly	= 0x00000400,  ///< Assemble the document: insert, create, rotate delete pages or add bookmarks
        ePdfPermissions_HighPrint	= 0x00000800   ///< Print a high resolution version of the document
    } EPdfPermissions;

    /**
     * The encryption algorithm.
     */
    typedef enum {
#ifndef PODOFO_HAVE_OPENSSL_NO_RC4
        ePdfEncryptAlgorithm_RC4V1 = 1, ///< RC4 Version 1 encryption using a 40bit key
        ePdfEncryptAlgorithm_RC4V2 = 2, ///< RC4 Version 2 encryption using a key with 40-128bit
#endif // PODOFO_HAVE_OPENSSL_NO_RC4
        ePdfEncryptAlgorithm_AESV2 = 4  ///< AES encryption with a 128 bit key (PDF1.6)
#ifdef PODOFO_HAVE_LIBIDN
        ,ePdfEncryptAlgorithm_AESV3 = 8 ///< AES encryption with a 256 bit key (PDF1.7 extension 3) - Support added by P. Zent
#endif //PODOFO_HAVE_LIBIDN
    } EPdfEncryptAlgorithm;

    /** Create a PdfEncrypt object which can be used to encrypt a PDF file.
     *
     *  \param userPassword the user password (if empty the user does not have
     *                      to enter a password to open the document)
     *  \param ownerPassword the owner password
     *  \param protection several EPdfPermissions values or'ed together to set
     *                    the users permissions for this document
     *  \param eAlgorithm the revision of the encryption algorithm to be used
     *  \param eKeyLength the length of the encryption key ranging from 40 to 128 bits
     *                    (only used if eAlgorithm == ePdfEncryptAlgorithm_RC4V2)
     *
     *  \see GenerateEncryptionKey with the documentID to generate the real
     *       encryption key using this information
     */
    static PdfEncrypt * CreatePdfEncrypt( const std::string & userPassword,
                                          const std::string & ownerPassword,
                                          int protection = ePdfPermissions_Print |
                                          ePdfPermissions_Edit |
                                          ePdfPermissions_Copy |
                                          ePdfPermissions_EditNotes |
                                          ePdfPermissions_FillAndSign |
                                          ePdfPermissions_Accessible |
                                          ePdfPermissions_DocAssembly |
                                          ePdfPermissions_HighPrint,
                                          EPdfEncryptAlgorithm eAlgorithm = ePdfEncryptAlgorithm_AESV2,
                                          EPdfKeyLength eKeyLength = ePdfKeyLength_40 );

    /** Initialize a PdfEncrypt object from an encryption dictionary in a PDF file.
     *
     *  This is required for encrypting a PDF file, but handled internally in PdfParser
     *  for you.
     *
     *  Will use only encrypting algorithms that are enabled.
     *
     *  \param pObject a PDF encryption dictionary
     *
     *  \see GetEnabledEncryptionAlgorithms
     */
    static PdfEncrypt * CreatePdfEncrypt( const PdfObject* pObject );

    /** Copy constructor
     *
     *  \param rhs another PdfEncrypt object which is copied
     */
    static PdfEncrypt * CreatePdfEncrypt( const PdfEncrypt & rhs );

    /**
     * Retrieve the list of encryption algorithms that are used
     * when loading a PDF document.
     *
     * By default all alogrithms are enabled.
     *
     * \see IsEncryptionEnabled
     * \see SetEnabledEncryptionAlgorithms
     *
     * \return an or'ed together list of all enabled encryption algorithms
     */
    static int GetEnabledEncryptionAlgorithms();

    /**
     * Specify the list of encryption algorithms that should be used by PoDoFo
     * when loading a PDF document.
     *
     * This can be used to disable for example AES encryption/decryption
     * which is unstable in certain cases.
     *
     * \see GetEnabledEncryptionAlgorithms
     * \see IsEncryptionEnabled
     */
    static void SetEnabledEncryptionAlgorithms(int nEncryptionAlgorithms);

    /**
     * Test if a certain encryption algorithm is enabled for loading PDF documents.
     *
     * \returns ture if the encryption algorithm is enabled
     * \see GetEnabledEncryptionAlgorithms
     * \see SetEnabledEncryptionAlgorithms
     */
    static bool IsEncryptionEnabled(EPdfEncryptAlgorithm eAlgorithm);

    /** Destruct the PdfEncrypt object
     */
    virtual ~PdfEncrypt() = 0;

    /** Generate encryption key from user and owner passwords and protection key
     *
     *  \param documentId the documentId of the current document
     */
    virtual void GenerateEncryptionKey(const PdfString & documentId) = 0;

    /** Fill all keys into a encryption dictionary.
     *  This dictionary is usually added to the PDF files trailer
     *  under the /Encryption key.
     *
     *  \param rDictionary an empty dictionary which is filled with information about
     *                     the used encryption algorithm
     */
    virtual void CreateEncryptionDictionary( PdfDictionary & rDictionary ) const = 0;

    /** Create a PdfOutputStream that encrypts all data written to
     *  it using the current settings of the PdfEncrypt object.
     *
     *  Warning: Currently only RC4 based encryption is supported using output streams!
     *
     *  \param pOutputStream the created PdfOutputStream writes all encrypted
     *         data to this output stream.
     *
     *  \returns a PdfOutputStream that encryts all data.
     */
    virtual PdfOutputStream* CreateEncryptionOutputStream( PdfOutputStream* pOutputStream ) = 0;

    /** Create a PdfInputStream that decrypts all data read from
     *  it using the current settings of the PdfEncrypt object.
     *
     *  Warning: Currently only RC4 based encryption is supported using output streams!
     *
     *  \param pInputStream the created PdfInputStream reads all decrypted
     *         data to this input stream.
     *
     *  \returns a PdfInputStream that decrypts all data.
     */
    virtual PdfInputStream* CreateEncryptionInputStream( PdfInputStream* pInputStream ) = 0;

    /**
     * Tries to authenticate a user using either the user or owner password
     *
     * \param password owner or user password
     * \param documentId the documentId of the PDF file
     *
     * \returns true if either the owner or user password matches password
     */
    virtual bool Authenticate( const std::string & password, const PdfString & documentId ) = 0;

    /** Get the encryption algorithm of this object.
     * \returns the EPdfEncryptAlgorithm of this object
     */
    inline EPdfEncryptAlgorithm GetEncryptAlgorithm() const;

    /** Checks if printing this document is allowed.
     *  Every PDF consuming applications has to adhere this value!
     *
     *  \returns true if you are allowed to print this document
     *
     *  \see PdfEncrypt to set own document permissions.
     */
    inline bool IsPrintAllowed() const;

    /** Checks if modifiying this document (besides annotations, form fields or changing pages) is allowed.
     *  Every PDF consuming applications has to adhere this value!
     *
     *  \returns true if you are allowed to modfiy this document
     *
     *  \see PdfEncrypt to set own document permissions.
     */
    inline bool IsEditAllowed() const;

    /** Checks if text and graphics extraction is allowed.
     *  Every PDF consuming applications has to adhere this value!
     *
     *  \returns true if you are allowed to extract text and graphics from this document
     *
     *  \see PdfEncrypt to set own document permissions.
     */
    inline bool IsCopyAllowed() const;

    /** Checks if it is allowed to add or modify annotations or form fields
     *  Every PDF consuming applications has to adhere this value!
     *
     *  \returns true if you are allowed to add or modify annotations or form fields
     *
     *  \see PdfEncrypt to set own document permissions.
     */
    inline bool IsEditNotesAllowed() const;

    /** Checks if it is allowed to fill in existing form or signature fields
     *  Every PDF consuming applications has to adhere this value!
     *
     *  \returns true if you are allowed to fill in existing form or signature fields
     *
     *  \see PdfEncrypt to set own document permissions.
     */
    inline bool IsFillAndSignAllowed() const;

    /** Checks if it is allowed to extract text and graphics to support users with disabillities
     *  Every PDF consuming applications has to adhere this value!
     *
     *  \returns true if you are allowed to extract text and graphics to support users with disabillities
     *
     *  \see PdfEncrypt to set own document permissions.
     */
    inline bool IsAccessibilityAllowed() const;

    /** Checks if it is allowed to insert, create, rotate, delete pages or add bookmarks
     *  Every PDF consuming applications has to adhere this value!
     *
     *  \returns true if you are allowed  to insert, create, rotate, delete pages or add bookmarks
     *
     *  \see PdfEncrypt to set own document permissions.
     */
    inline bool IsDocAssemblyAllowed() const;

    /** Checks if it is allowed to print a high quality version of this document
     *  Every PDF consuming applications has to adhere this value!
     *
     *  \returns true if you are allowed to print a high quality version of this document
     *
     *  \see PdfEncrypt to set own document permissions.
     */
    inline bool IsHighPrintAllowed() const;

    /// Get the U object value (user)
    const unsigned char* GetUValue() const { return m_uValue; }

    /// Get the O object value (owner)
    const unsigned char* GetOValue() const { return m_oValue; }

    /// Get the encryption key value (owner)
    const unsigned char* GetEncryptionKey() const { return m_encryptionKey; }

    /// Get the P object value (protection)
    pdf_int32 GetPValue() const { return m_pValue; }

    /// Get the revision number of the encryption method
    int GetRevision() const { return m_rValue; }

    /// Get the key length of the encryption key in bits
    int GetKeyLength() const { return m_keyLength*8; }

    /// Is metadata encrypted
    bool IsMetadataEncrypted() const { return m_bEncryptMetadata; }

    /// Encrypt a wxString
    //void Encrypt( std::string & str, pdf_long inputLen ) const;

    /// Encrypt a character string
    // inStr: the input buffer
    // inLen: length of the input buffer
    // outStr: the output buffer
    // outLen: length of the output buffer
    virtual void Encrypt(const unsigned char* inStr, pdf_long inLen,
                         unsigned char* outStr, pdf_long outLen) const = 0;

    /// Decrypt a character string
    // inStr: the input buffer
    // inLen: length of the input buffer
    // outStr: the output buffer
    // outLen: length of the output buffer
    virtual void Decrypt(const unsigned char* inStr, pdf_long inLen,
                         unsigned char* outStr, pdf_long &outLen) const = 0;

    /// Calculate stream size
    virtual pdf_long CalculateStreamLength(pdf_long length) const = 0;

    /// Calculate stream offset
    virtual pdf_long CalculateStreamOffset() const = 0;

    /** Set the reference of the object that is currently encrypted.
     *
     *  This value will be used in following calls of Encrypt
     *  to encrypt the object.
     *
     *  \see Encrypt
     */
    inline void SetCurrentReference( const PdfReference & rRef );

protected:
    PdfEncrypt()
        : m_eAlgorithm( ePdfEncryptAlgorithm_AESV2 ), m_keyLength( 0 ), m_rValue( 0 ), m_pValue( 0 ),
        m_eKeyLength( ePdfKeyLength_128 ), m_bEncryptMetadata(true)
    {
        memset( m_uValue, 0, 48 );
        memset( m_oValue, 0, 48 );
        memset( m_encryptionKey, 0, 32 );
    };

    PdfEncrypt( const PdfEncrypt & rhs );

    /// Check two keys for equality
    bool CheckKey(unsigned char key1[32], unsigned char key2[32]);

    EPdfEncryptAlgorithm m_eAlgorithm;   ///< The used encryption algorithm
    int            m_keyLength;          ///< Length of encryption key
    int            m_rValue;             ///< Revision
    pdf_int32      m_pValue;             ///< P entry in pdf document
    EPdfKeyLength  m_eKeyLength;         ///< The key length
    std::string    m_userPass;           ///< User password
    std::string    m_ownerPass;          ///< Owner password
    unsigned char  m_uValue[48];         ///< U entry in pdf document
    unsigned char  m_oValue[48];         ///< O entry in pdf document
    unsigned char  m_encryptionKey[32];  ///< Encryption key
    PdfReference   m_curReference;       ///< Reference of the current PdfObject
    std::string    m_documentId;         ///< DocumentID of the current document
	bool           m_bEncryptMetadata;   ///< Is metadata encrypted

private:
    static int     s_nEnabledEncryptionAlgorithms; ///< Or'ed int containing the enabled encryption algorithms
};

#ifdef PODOFO_HAVE_LIBIDN
/** A pure virtual class that is used to encrypt a PDF file (AES-256)
 *  This class is the base for classes that implement algorithms based on SHA hashes
 *
 *  Client code is working only with PdfEncrypt class and knows nothing
 *	about PdfEncrypt*, it is created through CreatePdfEncrypt factory method
 *
 */

class PdfEncryptSHABase : public PdfEncrypt {
public:

    PdfEncryptSHABase() {};
    // copy constructor
    PdfEncryptSHABase(const PdfEncrypt &rhs);

    /*
     *	Destruct PdfEncryptAESV2 object
     */
    virtual ~PdfEncryptSHABase() {};

    virtual PdfInputStream* CreateEncryptionInputStream( PdfInputStream* pInputStream ) = 0;
    virtual PdfOutputStream* CreateEncryptionOutputStream( PdfOutputStream* pOutputStream ) = 0;

    virtual void CreateEncryptionDictionary( PdfDictionary & rDictionary ) const;

    virtual bool Authenticate( const std::string & password, const PdfString & documentId ) = 0;

    /// Encrypt a character string
    virtual void Encrypt(const unsigned char* inStr, pdf_long inLen,
                         unsigned char* outStr, pdf_long outLen) const = 0;

    virtual void GenerateEncryptionKey(const PdfString & documentId) = 0;

    /// Get the UE object value (user)
    const unsigned char* GetUEValue() const { return m_ueValue; }

    /// Get the OE object value (owner)
    const unsigned char* GetOEValue() const { return m_oeValue; }

    /// Get the Perms object value (encrypted protection)
    const unsigned char* GetPermsValue() const { return m_permsValue; }

    virtual pdf_long CalculateStreamOffset() const = 0;

    virtual pdf_long CalculateStreamLength(pdf_long length) const = 0;

    bool Authenticate(const std::string & documentID, const std::string & password,
                      const std::string & uValue, const std::string & ueValue,
                      const std::string & oValue, const std::string & oeValue,
                      int pValue, const std::string & permsValue,
                      int lengthValue, int rValue);

protected:

    /// Generate initial vector
    virtual void GenerateInitialVector(unsigned char iv[16]);

    /// Compute encryption key to be used with AES-256
    void ComputeEncryptionKey();

    /// Generate the U and UE entries
    void ComputeUserKey(const unsigned char * userpswd, int len);

    /// Generate the O and OE entries
    void ComputeOwnerKey(const unsigned char * userpswd, int len);

    /// Preprocess password for use in EAS-256 Algorithm
    /// outBuf needs to be at least 127 bytes long
    void PreprocessPassword( const std::string &password, unsigned char* outBuf, int &len);

    unsigned char  m_ueValue[32];        ///< UE entry in pdf document
    unsigned char  m_oeValue[32];        ///< OE entry in pdf document
    unsigned char  m_permsValue[16];     ///< Perms entry in pdf document
};

/** A pure virtual class that is used to encrypt a PDF file (RC4, AES-128)
 *  This class is the base for classes that implement algorithms based on MD5 hashes
 *
 *  Client code is working only with PdfEncrypt class and knows nothing
 *	about PdfEncrypt*, it is created through CreatePdfEncrypt factory method
 *
 */
#endif // PODOFO_HAVE_LIBIDN

/** A pure virtual class that is used to encrypt a PDF file (AES-128/256)
 *  This class is the base for classes that implement algorithms based on AES
 *
 *  Client code is working only with PdfEncrypt class and knows nothing
 *	about PdfEncrypt*, it is created through CreatePdfEncrypt factory method
 *
 */

class PdfEncryptAESBase {
public:
    ~PdfEncryptAESBase();

protected:
    PdfEncryptAESBase();

    void BaseDecrypt(const unsigned char* key, int keylen, const unsigned char* iv,
             const unsigned char* textin, pdf_long textlen,
             unsigned char* textout, pdf_long &textoutlen);
    void BaseEncrypt(const unsigned char* key, int keylen, const unsigned char* iv,
             const unsigned char* textin, pdf_long textlen,
             unsigned char* textout, pdf_long textoutlen);

    AESCryptoEngine*   m_aes;                ///< AES encryptor
};

#ifndef PODOFO_HAVE_OPENSSL_NO_RC4
/** A pure virtual class that is used to encrypt a PDF file (RC4-40..128)
 *  This class is the base for classes that implement algorithms based on RC4
 *
 *  Client code is working only with PdfEncrypt class and knows nothing
 *	about PdfEncrypt*, it is created through CreatePdfEncrypt factory method
 *
 */

class PdfEncryptRC4Base {
public:
    ~PdfEncryptRC4Base();

protected:
    PdfEncryptRC4Base();

    /// AES encryption
    void RC4(const unsigned char* key, int keylen,
             const unsigned char* textin, pdf_long textlen,
             unsigned char* textout, pdf_long textoutlen);

    RC4CryptoEngine*   m_rc4;                ///< AES encryptor
};
#endif // PODOFO_HAVE_OPENSSL_NO_RC4

/*
#ifdef PODOFO_HAVE_OPENSSL_NO_RC4
class PdfEncryptMD5Base : public PdfEncrypt {
#else
class PdfEncryptMD5Base : public PdfEncrypt, public PdfEncryptRC4Base {
#endif // PODOFO_HAVE_OPENSSL_NO_RC4
/*/
class PdfEncryptMD5Base : public PdfEncrypt {
//*/
public:

    PdfEncryptMD5Base() {};
    // copy constructor
    PdfEncryptMD5Base(const PdfEncrypt &rhs);

    /*
     *	Destruct PdfEncryptAESV2 object
     */
    virtual ~PdfEncryptMD5Base() {};

    virtual PdfInputStream* CreateEncryptionInputStream( PdfInputStream* pInputStream ) = 0;
    virtual PdfOutputStream* CreateEncryptionOutputStream( PdfOutputStream* pOutputStream ) = 0;

    virtual void CreateEncryptionDictionary( PdfDictionary & rDictionary ) const;

    virtual bool Authenticate( const std::string & password, const PdfString & documentId ) = 0;

    /// Encrypt a character string
    virtual void Encrypt(const unsigned char* inStr, pdf_long inLen,
                         unsigned char* outStr, pdf_long outLen) const = 0;

    virtual void GenerateEncryptionKey(const PdfString & documentId) = 0;

    /** Create a PdfString of MD5 data generated from a buffer in memory.
     *  \param pBuffer the buffer of which to calculate the MD5 sum
     *  \param nLength the length of the buffer
     *
     *  \returns an MD5 sum as PdfString
     */
    static PdfString GetMD5String( const unsigned char* pBuffer, int nLength );

    virtual pdf_long CalculateStreamOffset() const = 0;

    virtual pdf_long CalculateStreamLength(pdf_long length) const = 0;

    /// Calculate the binary MD5 message digest of the given data
    static void GetMD5Binary(const unsigned char* data, int length, unsigned char* digest);

    bool Authenticate(const std::string & documentID, const std::string & password,
                      const std::string & uValue, const std::string & oValue,
                      int pValue, int lengthValue, int rValue);

protected:

    /// Generate initial vector
    virtual void GenerateInitialVector(unsigned char iv[16]);

    /// Compute owner key
    void ComputeOwnerKey(unsigned char userPad[32], unsigned char ownerPad[32],
                         int keylength, int revision, bool authenticate,
                         unsigned char ownerKey[32]);

    /// Pad a password to 32 characters
    void PadPassword(const std::string& password, unsigned char pswd[32]);

    /// Compute encryption key and user key
    void ComputeEncryptionKey(const std::string & documentID,
                              unsigned char userPad[32], unsigned char ownerKey[32],
                              int pValue, int keyLength, int revision,
                              unsigned char userKey[32], bool bEncryptMetadata);

    /** Create the encryption key for the current object.
     *
     *  \param objkey pointer to an array of at least MD5_HASHBYTES (=16) bytes length
     *  \param pnKeyLen pointer to an integer where the actual keylength is stored.
     */
    virtual void CreateObjKey( unsigned char objkey[16], int* pnKeyLen ) const;

    unsigned char  m_rc4key[16];         ///< last RC4 key
    unsigned char  m_rc4last[256];       ///< last RC4 state table

};

/** A class that is used to encrypt a PDF file (AES-128)
 *
 *  Client code is working only with PdfEncrypt class and knows nothing
 *	about PdfEncryptAES*, it is created through CreatePdfEncrypt factory method
 *
 */

class PdfEncryptAESV2 : public PdfEncryptMD5Base, public PdfEncryptAESBase {
public:
	/*
	*	Constructors of PdfEncryptAESV2
	*/
	PdfEncryptAESV2(PdfString oValue, PdfString uValue, int pValue, bool bEncryptMetadata);
    PdfEncryptAESV2( const PdfEncrypt & rhs ) : PdfEncryptMD5Base(rhs) {}
	PdfEncryptAESV2( const std::string & userPassword,
                   const std::string & ownerPassword,
                   int protection = ePdfPermissions_Print |
                                 ePdfPermissions_Edit |
                                 ePdfPermissions_Copy |
                                 ePdfPermissions_EditNotes |
                                 ePdfPermissions_FillAndSign |
                                 ePdfPermissions_Accessible |
                                 ePdfPermissions_DocAssembly |
                                 ePdfPermissions_HighPrint
                );

	/*
	*	Destruct PdfEncryptAESV2 object
	*/
	virtual ~PdfEncryptAESV2() {};

	virtual PdfInputStream* CreateEncryptionInputStream( PdfInputStream* pInputStream );
	virtual PdfOutputStream* CreateEncryptionOutputStream( PdfOutputStream* pOutputStream );

    virtual bool Authenticate( const std::string & password, const PdfString & documentId );

    /// Encrypt a character string
    virtual void Encrypt(const unsigned char* inStr, pdf_long inLen,
                         unsigned char* outStr, pdf_long outLen) const;
    virtual void Decrypt(const unsigned char* inStr, pdf_long inLen,
                         unsigned char* outStr, pdf_long &outLen) const;

    virtual void GenerateEncryptionKey(const PdfString & documentId);

    virtual pdf_long CalculateStreamOffset() const;

    virtual pdf_long CalculateStreamLength(pdf_long length) const;
};

#ifdef PODOFO_HAVE_LIBIDN
/** A class that is used to encrypt a PDF file (AES-256)
 *
 *  Client code is working only with PdfEncrypt class and knows nothing
 *	about PdfEncryptAES*, it is created through CreatePdfEncrypt factory method
 *
 */

class PdfEncryptAESV3 : public PdfEncryptSHABase, public PdfEncryptAESBase {
public:
    /*
     *	Constructors of PdfEncryptAESV3
     */
    PdfEncryptAESV3(PdfString oValue, PdfString oeValue, PdfString uValue, PdfString ueValue, int pValue, PdfString permsValue);
    PdfEncryptAESV3( const PdfEncrypt & rhs ) : PdfEncryptSHABase(rhs) {}
    PdfEncryptAESV3( const std::string & userPassword,
                  const std::string & ownerPassword,
                  int protection = ePdfPermissions_Print |
                  ePdfPermissions_Edit |
                  ePdfPermissions_Copy |
                  ePdfPermissions_EditNotes |
                  ePdfPermissions_FillAndSign |
                  ePdfPermissions_Accessible |
                  ePdfPermissions_DocAssembly |
                  ePdfPermissions_HighPrint
                  );

    /*
     *	Destruct PdfEncryptAESV3 object
     */
    virtual ~PdfEncryptAESV3() {};

    virtual PdfInputStream* CreateEncryptionInputStream( PdfInputStream* pInputStream );
    virtual PdfOutputStream* CreateEncryptionOutputStream( PdfOutputStream* pOutputStream );

    virtual bool Authenticate( const std::string & password, const PdfString & documentId );

    /// Encrypt a character string
    virtual void Encrypt(const unsigned char* inStr, pdf_long inLen,
                         unsigned char* outStr, pdf_long outLen) const;
    virtual void Decrypt(const unsigned char* inStr, pdf_long inLen,
                         unsigned char* outStr, pdf_long &outLen) const;

    virtual void GenerateEncryptionKey(const PdfString & documentId);

    virtual pdf_long CalculateStreamOffset() const;

    virtual pdf_long CalculateStreamLength(pdf_long length) const;
};

#endif // PODOFO_HAVE_LIBIDN

#ifndef PODOFO_HAVE_OPENSSL_NO_RC4
/** A class that is used to encrypt a PDF file (RC4 40-bit and 128-bit)
 *
 *  Client code is working only with PdfEncrypt class and knows nothing
 *	about PdfEncryptRC4, it is created through CreatePdfEncrypt factory method
 *
 */

class PdfEncryptRC4 : public PdfEncryptMD5Base {
public:
	/*
	*	Constructors of PdfEncryptRC4 objects
	*/
	PdfEncryptRC4(PdfString oValue, PdfString uValue,
		int pValue, int rValue, EPdfEncryptAlgorithm eAlgorithm, long length, bool bEncryptMetadata);
    PdfEncryptRC4( const PdfEncrypt & rhs ) : PdfEncryptMD5Base(rhs) {}
	PdfEncryptRC4( const std::string & userPassword,
                   const std::string & ownerPassword,
                   int protection = ePdfPermissions_Print |
                                 ePdfPermissions_Edit |
                                 ePdfPermissions_Copy |
                                 ePdfPermissions_EditNotes |
                                 ePdfPermissions_FillAndSign |
                                 ePdfPermissions_Accessible |
                                 ePdfPermissions_DocAssembly |
                                 ePdfPermissions_HighPrint,
                  EPdfEncryptAlgorithm eAlgorithm = ePdfEncryptAlgorithm_RC4V1,
                  EPdfKeyLength eKeyLength = ePdfKeyLength_40 );

    /*
     *	Destruct PdfEncryptRC4 object
     */
    virtual ~PdfEncryptRC4() {}

    virtual bool Authenticate( const std::string & password, const PdfString & documentId );

    /// Encrypt a character string
    virtual void Encrypt(const unsigned char* inStr, pdf_long inLen,
                         unsigned char* outStr, pdf_long outLen) const;
    virtual void Decrypt(const unsigned char* inStr, pdf_long inLen,
                         unsigned char* outStr, pdf_long &outLen) const;

	virtual PdfInputStream* CreateEncryptionInputStream( PdfInputStream* pInputStream );
	virtual PdfOutputStream* CreateEncryptionOutputStream( PdfOutputStream* pOutputStream );

    virtual void GenerateEncryptionKey(const PdfString & documentId);

    virtual pdf_long CalculateStreamOffset() const;

    virtual pdf_long CalculateStreamLength(pdf_long length) const;
};
#endif // PODOFO_HAVE_OPENSSL_NO_RC4

// -----------------------------------------------------
//
// -----------------------------------------------------
PdfEncrypt::EPdfEncryptAlgorithm PdfEncrypt::GetEncryptAlgorithm() const
{
    return m_eAlgorithm;
}

// -----------------------------------------------------
//
// -----------------------------------------------------
void PdfEncrypt::SetCurrentReference( const PdfReference & rRef )
{
    m_curReference = rRef;
}

// -----------------------------------------------------
//
// -----------------------------------------------------
bool PdfEncrypt::IsPrintAllowed() const
{
    return (m_pValue & ePdfPermissions_Print) == ePdfPermissions_Print;
}

// -----------------------------------------------------
//
// -----------------------------------------------------
bool PdfEncrypt::IsEditAllowed() const
{
    return (m_pValue & ePdfPermissions_Edit) == ePdfPermissions_Edit;
}

// -----------------------------------------------------
//
// -----------------------------------------------------
bool PdfEncrypt::IsCopyAllowed() const
{
    return (m_pValue & ePdfPermissions_Copy) == ePdfPermissions_Copy;
}

// -----------------------------------------------------
//
// -----------------------------------------------------
bool PdfEncrypt::IsEditNotesAllowed() const
{
    return (m_pValue & ePdfPermissions_EditNotes) == ePdfPermissions_EditNotes;
}

// -----------------------------------------------------
//
// -----------------------------------------------------
bool PdfEncrypt::IsFillAndSignAllowed() const
{
    return (m_pValue & ePdfPermissions_FillAndSign) == ePdfPermissions_FillAndSign;
}

// -----------------------------------------------------
//
// -----------------------------------------------------
bool PdfEncrypt::IsAccessibilityAllowed() const
{
    return (m_pValue & ePdfPermissions_Accessible) == ePdfPermissions_Accessible;
}

// -----------------------------------------------------
//
// -----------------------------------------------------
bool PdfEncrypt::IsDocAssemblyAllowed() const
{
    return (m_pValue & ePdfPermissions_DocAssembly) == ePdfPermissions_DocAssembly;
}

// -----------------------------------------------------
//
// -----------------------------------------------------
bool PdfEncrypt::IsHighPrintAllowed() const
{
    return (m_pValue & ePdfPermissions_HighPrint) == ePdfPermissions_HighPrint;
}

} //end namespace PoDoFo

#endif // _PDFENCRYPT_H_


text:
<?php

namespace Laravel\Spark\Billing;

use Laravel\Spark\Spark;
use Laravel\Cashier\Invoice;
use Illuminate\Support\Facades\Mail;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\View\Expression as ViewExpression;
use Laravel\Spark\Contracts\Billing\InvoiceNotifier;

class EmailInvoiceNotifier implements InvoiceNotifier
{
    /**
     * Notify the given user about a new invoice.
     *
     * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
     * @param  \Laravel\Cashier\Invoice  $invoice
     * @return void
     */
    public function notify(Authenticatable $user, Invoice $invoice)
    {
        $invoiceData = array_merge([
            'vendor' => 'Vendor',
            'product' => 'Product',
            'vat' => new ViewExpression(nl2br(e($user->extra_billing_info))),
        ], Spark::generateInvoicesWith());

        $data = compact('user', 'invoice', 'invoiceData');

        Mail::send('spark::emails.billing.invoice', $data, function ($message) use ($user, $invoice, $invoiceData) {
            $message->to($user->email, $user->name)
                    ->subject('Your '.$invoiceData['product'].' Invoice')
                    ->attachData($invoice->pdf($invoiceData), 'invoice.pdf');
        });
    }
}


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

namespace RandoopTests.Utils
{
    public class SimpleDiff
    {

        public static bool Diff(string file1, string file2)
        {
            if (file1 == null) throw new ArgumentNullException();
            if (file2 == null) throw new ArgumentNullException();

            Common.StringReader reader = new Common.StringReader();
            List<string> lines1 = reader.Read(file1);
            List<string> lines2 = reader.Read(file2);

            int maxLine = Math.Max(lines1.Count - 1, lines2.Count - 1);

            for (int i = 0; i <= maxLine ; i++)
            {
                if (lines1.Count - 1 < i)
                {
                    Console.WriteLine("*** File {0} has fewer lines than file {1}.", file1, file2);
                    Console.WriteLine("*** First line not contained in smaller file:", lines1[i]);
                    return false;
                }

                if (lines2.Count - 1 < i)
                {
                    Console.WriteLine("*** File {0} has fewer lines than file {1}.", file2, file1);
                    Console.WriteLine("*** First line not contained in smaller file:", lines2[i]);
                    return false;
                }

                if (!lines1[i].Equals(lines2[i]))
                {
                    Console.WriteLine("*** Files {0} and {1} differ starting at line {2}.", file1, file2, i);
                    Console.WriteLine("*** File {0} line {1}: {2}.", file1, i, lines1[i]);
                    Console.WriteLine("*** File {0} line {1}: {2}.", file2, i, lines2[i]);
                    return false;
                }
            }

            return true;
        }

    }
}


text:
<!--
  ~ Copyright (c) 2005-2014, 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.
  -->
<component xmlns="http://products.wso2.org/carbon">
	<menus>
        <menu>
            <id>cluster_mgt_menu</id>
            <i18n-key>andes-cluster-mgt.menu</i18n-key>
            <i18n-bundle>org.wso2.carbon.andes.cluster.mgt.ui.i18n.Resources</i18n-bundle>
            <parent-menu>manage_menu</parent-menu>
            <link>#</link>
            <region>region1</region>
            <order>32</order>
            <style-class>home</style-class>
            <icon>../andes-cluster-mgt/images/cluster_info.png</icon>
        </menu>
        <menu>
            <id>node_list</id>
            <i18n-key>nodes.list</i18n-key>
            <i18n-bundle>org.wso2.carbon.andes.cluster.mgt.ui.i18n.Resources</i18n-bundle>
            <parent-menu>cluster_mgt_menu</parent-menu>
            <link>../andes-cluster-mgt/nodesList.jsp</link>
            <region>region1</region>
            <order>10</order>
            <style-class>manage</style-class>
            <icon>../andes-cluster-mgt/images/list.gif</icon>
            <require-permission>/permission/admin/manage/cluster/list</require-permission>
        </menu>

	</menus>
</component>


text:
@interface ReverseGeocoderViewController : UIViewController<NMapViewDelegate, NMapPOIdataOverlayDelegate, MMapReverseGeocoderDelegate>

@end


text:
require 'spec_helper'

describe Shoulda::Matchers::ActionController::SetSessionMatcher do
  context 'a controller that sets a session variable' do
    it 'accepts assigning to that variable' do
      expect(controller_with_session(var: 'hi')).to set_session(:var)
    end

    it 'accepts assigning the correct value to that variable' do
      expect(controller_with_session(var: 'hi')).to set_session(:var).to('hi')
    end

    it 'rejects assigning another value to that variable' do
      expect(controller_with_session(var: 'hi')).not_to set_session(:var).to('other')
    end

    it 'rejects assigning to another variable' do
      expect(controller_with_session(var: 'hi')).not_to set_session(:other)
    end

    it 'accepts assigning nil to another variable' do
      expect(controller_with_session(var: 'hi')).to set_session(:other).to(nil)
    end

    it 'accepts assigning false to that variable' do
      expect(controller_with_session(var: false)).to set_session(:var).to(false)
    end

    it 'accepts assigning to the same value in the test context' do
      expected = 'value'

      expect(controller_with_session(var: expected)).
        to set_session(:var).in_context(self).to { expected }
    end

    it 'rejects assigning to the another value in the test context' do
      expected = 'other'

      expect(controller_with_session(var: 'unexpected')).
        not_to set_session(:var).in_context(self).to { expected }
    end

    def controller_with_session(session_hash)
      build_fake_response do
        session_hash.each do |key, value|
          session[key] = value
        end
      end
    end
  end
end


text:
<!DOCTYPE html>

	<title>Child</title>


text:
struct avlNode
{
    char * avlNodeValue;
    struct avlNode *leftBranch;
    struct avlNode *rightBranch;
    int frequency;
    int height;
};
typedef struct avlNode avlNodeInit;

//struct for the avl tree and root
struct avlTree
{
    struct avlNode *avlRoot;
};

typedef struct avlTree avlTreeInit;

//creates the actual avl tree when the program is initiated,
avlTreeInit *createAVL()
{
    avlTreeInit *tree = NULL;
    if((tree = malloc(sizeof(avlTreeInit))) == NULL)
    {
        return NULL;
    }

    tree->avlRoot = NULL;
    return tree;
}

//called by the insert function that uses the inputed values to create a new node on the avl search tree
avlNodeInit *createAVLNode(char *avlNodeValue)
{
    avlNodeInit *node = NULL;

    if((node = malloc(sizeof(avlNodeInit))) == NULL)
    {
        return NULL;
    }

    node->avlNodeValue = malloc(sizeof(char) * 50);
    node->leftBranch = NULL;
    node->rightBranch = NULL;
    node->height = 1;
    node->frequency = 1;
    strcpy(node->avlNodeValue, avlNodeValue);
    return node;
}

//used to keep track of height while inserting the nodes into the avl tree
//wasnt able to figure out how to implement this into option 5 on the main menu though
int avlHeight(avlNodeInit *node)
{

    int rightBranchHeight = 0;
    int leftBranchHeight = 0;
    if(node->rightBranch)
    {
        rightBranchHeight = avlHeight(node->rightBranch);
    }

    if (node->leftBranch)
    {
        leftBranchHeight = avlHeight(node->leftBranch);
    }

    return rightBranchHeight > leftBranchHeight ? ++rightBranchHeight : ++leftBranchHeight;
}

//keeps track of the avl tree balance and makes sure both sides are evenly split.
int balanceTrack(avlNodeInit *node)
{

    int balanceTrackInt = 0;
    if(node->rightBranch)
    {
        balanceTrackInt = balanceTrackInt - avlHeight(node->rightBranch);
    }

    if(node->leftBranch)
    {
        balanceTrackInt = balanceTrackInt + avlHeight(node->leftBranch);
    }

    return balanceTrackInt;

}

//takes the node inputted and does a right right rotation and returns it
avlNodeInit * doubleRightRotation(avlNodeInit * node)
{

    avlNodeInit *a = node;
    avlNodeInit *b = a->rightBranch;

    a->rightBranch = b->leftBranch;
    b->leftBranch = a;

    return b;
}

//takes the node inputted and does a left left rotation and returns it
avlNodeInit * doubleLeftRotation(avlNodeInit * node)
{

    avlNodeInit *a = node;
    avlNodeInit *b = a->leftBranch;

    a->leftBranch = b->rightBranch;
    b->rightBranch = a;

    return b;
}

//takes the node inputted and does a right left rotation and returns it
avlNodeInit * rightLeftRotation(avlNodeInit * node)
{

    avlNodeInit *a = node;
    avlNodeInit *b = a->rightBranch;
    avlNodeInit *c = b->leftBranch;

    a->rightBranch = c->leftBranch;
    b->leftBranch = c->rightBranch;
    c->rightBranch = b;
    c->leftBranch = a;

    return c;
}

//takes the node inputted and does a left right rotation and returns it
avlNodeInit * leftRightRotation(avlNodeInit * node)
{

    avlNodeInit *a = node;
    avlNodeInit *b = a->leftBranch;
    avlNodeInit *c = b->rightBranch;

    a->leftBranch = c->rightBranch;
    b->rightBranch = c->leftBranch;
    c->leftBranch = b;
    c->rightBranch = a;

    return c;
}

//main brain for balancing the avl tree which recursively calls itself calling the
//aforementioned rotation functions as needed until the avl tree nodes are properly balanced
avlNodeInit * balanceAVLNode (avlNodeInit *node)
{
    avlNodeInit * tempRoot = NULL;

    if(node->rightBranch)
    {
        node->rightBranch = balanceAVLNode(node->rightBranch);
    }
    if(node->leftBranch)
    {
        node->leftBranch = balanceAVLNode(node->leftBranch);
    }
    int balanceTrackInt = balanceTrack(node);

    if(balanceTrackInt <= -2)
    {
        if(balanceTrack(node->rightBranch) >= 1)
        {
            tempRoot = rightLeftRotation(node);
        }
        else
        {
            tempRoot = doubleRightRotation(node);
        }
    }
    else if(balanceTrackInt >= 2)
    {
        if(balanceTrack(node->leftBranch) <= -1)
        {
            tempRoot = leftRightRotation(node);
        }
        else
        {
            tempRoot = doubleLeftRotation(node);
        }
    }
    else
    {
        tempRoot = node;
    }

    return tempRoot;
}

//balances the avl search tree and it's nodes that are inputted into the function
void balanceAVLTree(avlTreeInit *tree)
{
    avlNodeInit *tempRoot = NULL;

    tempRoot = balanceAVLNode(tree->avlRoot);

    if(tempRoot != tree->avlRoot)
    {
        tree->avlRoot = tempRoot;
    }
}

//main function that inserts all the parsed values into the avl search tree and creates the avl search tree
//if it wasnt already there and keeps track of the frequency of each node entered and then proceeds
//to call the main balancing function to balane the tree.
void insert(avlTreeInit *tree, char * avlNodeValue)
{
    avlNodeInit *node = NULL;
    avlNodeInit *last = NULL;
    avlNodeInit *next = NULL;

    if(tree->avlRoot == NULL)
    {
        node = createAVLNode(avlNodeValue);
        strcpy(node->avlNodeValue, avlNodeValue);
        tree->avlRoot = node;
    }
    else
    {
        next = tree->avlRoot;
        while(next != NULL)
        {
            last = next;
            if(strcmp(avlNodeValue, next->avlNodeValue) > 0)
            {
                next = next->rightBranch;
            }
            else if(strcmp(avlNodeValue, next->avlNodeValue) < 0)
            {
                next = next->leftBranch;
            }
            else if(strcmp(avlNodeValue, next->avlNodeValue) == 0)
            {
                next->frequency++;
                printf("Key: %s frequency: [%d]\n", next->avlNodeValue, next->frequency);
                return;
            }
        }
        node = createAVLNode(avlNodeValue);
        strcpy(node->avlNodeValue, avlNodeValue);
        if(strcmp(avlNodeValue, last->avlNodeValue) > 0)
        {
            printf("Key: %s frequency: %d\n", avlNodeValue, last->frequency);
            last->rightBranch = node;
        }
        else if(strcmp(avlNodeValue, last->avlNodeValue) < 0)
        {
            printf("Key: %s frequency: %d\n", avlNodeValue, last->frequency);
            last->leftBranch = node;
        }
        else if(strcmp(avlNodeValue, last->avlNodeValue) == 0)
        {
            last->frequency++;
            return;
        }
    }
    balanceAVLTree(tree);
}

//parses through the text file of data and recursively calls the insert function while parsing each node
//have it set to skip over empty lines in order to prevent seg faults
void initialize (FILE * fp, avlTreeInit * tree)
{
    char line[500];
    char * key;

    while(fgets(line, sizeof(line), fp))
    {
        if (line[strlen(line) - 1] == '\n')
        {
            line[strlen(line) - 1] = '\0';
        }

        key = strtok(line, " ");

        if( key != NULL)
        {
            insert(tree, key);
        }

        while((key = strtok(NULL, " ")) != NULL)
        {
            insert(tree, key);
        }

        memset(line, '\0', strlen(line));
    }

    printf("file successfully inserted and initialized\n");
}

//searches through the entire tree to find the matching value inputted and displays the frequency of that value
void search(avlTreeInit *tree, char * searchValue)
{
    int tempFrequency = -1;
    avlNodeInit * tempRoot = tree->avlRoot;
    while( tempRoot != NULL && (strcmp(tempRoot->avlNodeValue, searchValue) != 0))
    {
        if(strcmp(tempRoot->avlNodeValue, searchValue) < 0)
        {
            if(tempRoot->rightBranch == NULL)
            {
                break;
            }
            tempRoot = tempRoot->rightBranch;
            if(strcmp(tempRoot->avlNodeValue, searchValue) == 0)
            {
                tempFrequency = 0;
                tempFrequency = tempRoot->frequency;
                break;
            }
        }
        else if(strcmp(tempRoot->avlNodeValue, searchValue) > 0)
        {
            if(tempRoot->leftBranch == NULL)
            {
                break;
            }
            tempRoot = tempRoot->leftBranch;
            if(strcmp(tempRoot->avlNodeValue, searchValue) == 0)
            {
                tempFrequency = 0;
                tempFrequency = tempRoot->frequency;

                break;
            }
        }
    }
    if(tempFrequency > 0)
    {
        printf("key: %s, frequency: %d\n", tempRoot->avlNodeValue, tempFrequency);
    }
    else
    {
        printf("no_such_key\n");
    }
}

//searches through the avl search tree to find values that have higher frequencies
//and prints them out for the user (not fully functional)
void frequencySearch(avlTreeInit *tree, int frequencyCompare)
{
    avlNodeInit *tempRoot = tree->avlRoot;

    while (tempRoot != NULL)
    {
        if(frequencyCompare < tempRoot->frequency)
        {
            printf("key: %s, frequency: %d\n", tempRoot->avlNodeValue, tempRoot->frequency);
            tempRoot = tempRoot->rightBranch;

        }
        else
        {
            tempRoot = tempRoot->leftBranch;
        }
    }
}

//searches through the avl search tree to find the inputted value by the user and removes it
//from the avl search tree, reducing the frequency by 1 (not fully functional)
void delete(avlTreeInit *tree, char * keyRemove)
{
    int tempFrequency = -1;
    avlNodeInit * tempRoot = tree->avlRoot;
    while( tempRoot != NULL && (strcmp(tempRoot->avlNodeValue, keyRemove) != 0))
    {
        if(strcmp(tempRoot->avlNodeValue, keyRemove) < 0)
        {
            if(tempRoot->rightBranch == NULL)
            {
                break;
            }
            tempRoot = tempRoot->rightBranch;
            if(strcmp(tempRoot->avlNodeValue, keyRemove) == 0)
            {
                tempFrequency = 0;
                tempFrequency = tempRoot->frequency - 1;
                tempRoot->frequency--;
                free(tempRoot);
                break;
            }
        }
        else if(strcmp(tempRoot->avlNodeValue, keyRemove) > 0)
        {
            if(tempRoot->leftBranch == NULL)
            {
                break;
            }
            tempRoot = tempRoot->leftBranch;
            if(strcmp(tempRoot->avlNodeValue, keyRemove) == 0)
            {
                tempFrequency = 0;
                tempFrequency = tempRoot->frequency - 1;
                tempRoot->frequency--;
                free(tempRoot);
                break;
            }
        }
    }
    if(tempFrequency > -1)
    {
        printf("key: %s, frequency: %d\n", tempRoot->avlNodeValue, tempFrequency);
    }
    else
    {
        printf("no_such_key\n");
    }
}

//main function that holds the switch case that controls all the different functions
int main()
{

    int userInput = 0;
    char fileName[256];
    int frequencyCompare = 0;
    char keyRemove[25];
    char keyInsert[25];
    char keySearch[25];
    avlTreeInit *tree = NULL;
    tree = createAVL();
    insert(tree, "");

    while(userInput != 7)
    {
        printf("1. Initialization\n2. Find\n3. Insert\n4. Remove\n5. Check Height and Size\n6. Find All (above a given frequency)\n7. Exit\n\navl/> ");
        scanf("%d", &userInput);
        switch(userInput)
        {
            case 1:

                printf("filename: ");
                scanf("%s", fileName);
                FILE *fp;
                fp = fopen(fileName, "r");
                if(fp == NULL)
                {
                    printf("could not find file\n");
                    return 0;
                }
                printf("loading...\n");
                initialize(fp, tree);
                fclose(fp);
                break;
            case 2:
                printf("find key: ");
                scanf("%s", keySearch);
                search(tree, keySearch);
                break;
            case 3:
                printf("insert key: ");
                scanf("%s", keyInsert);
                insert(tree, keyInsert);
                break;
            case 4:
                printf("remove key: ");
                scanf("%s", keyRemove);
                delete(tree, keyRemove);
                break;
            case 5:
                printf("could not figure out how to implement in time.\n");
                break;
            case 6:
                printf("frequency: ");
                scanf("%d", &frequencyCompare);
                frequencySearch(tree, frequencyCompare);
                break;
            case 7:
                printf("goodbye!\n");
                exit(1);
                break;
        }
    }
    return 0;
}


text:
<?php

namespace Odysseus\FrontBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class OdysseusFrontBundle extends Bundle
{

}


text:
try:
    from setuptools import setup
except ImportError:
    from distutils.core import setup

setup(
    name='pycoinbase',
    version='0.1.0-dev',
    description='Coinbase API',
    license='MIT',
    url='https://github.com/dmpayton/pycoinbase',
    author='Derek Payton',
    author_email='derek.payton@gmail.com',
    py_modules=['pycoinbase'],
    install_requires=['requests'],
    classifiers=(
        'Development Status :: 2 - Pre-Alpha',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: MIT License',
        'Natural Language :: English',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.6',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.2',
        'Programming Language :: Python :: 3.3',
    ),
)


text:
<?php

namespace Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoice;

use Magento\Framework\App\ResponseInterface;
use Magento\Framework\App\Filesystem\DirectoryList;

abstract class PrintAction extends \Magento\Backend\App\Action
{
    /**
     * @var \Magento\Framework\App\Response\Http\FileFactory
     */
    protected $_fileFactory;

    /**
     * @param \Magento\Backend\App\Action\Context $context
     * @param \Magento\Framework\App\Response\Http\FileFactory $fileFactory
     */
    public function __construct(
        \Magento\Backend\App\Action\Context $context,
        \Magento\Framework\App\Response\Http\FileFactory $fileFactory
    ) {
        $this->_fileFactory = $fileFactory;
        parent::__construct($context);
    }

    /**
     * {@inheritdoc}
     */
    protected function _isAllowed()
    {
        return $this->_authorization->isAllowed('Magento_Sales::sales_invoice');
    }

    /**
     * @return ResponseInterface|void
     */
    public function execute()
    {
        $invoiceId = $this->getRequest()->getParam('invoice_id');
        if ($invoiceId) {
            $invoice = $this->_objectManager->create('Magento\Sales\Model\Order\Invoice')->load($invoiceId);
            if ($invoice) {
                $pdf = $this->_objectManager->create('Magento\Sales\Model\Order\Pdf\Invoice')->getPdf([$invoice]);
                $date = $this->_objectManager->get('Magento\Framework\Stdlib\DateTime\DateTime')->date('Y-m-d_H-i-s');
                return $this->_fileFactory->create(
                    'invoice' . $date . '.pdf',
                    $pdf->render(),
                    DirectoryList::VAR_DIR,
                    'application/pdf'
                );
            }
        } else {
            $this->_forward('noroute');
        }
    }
}


text:
import timeseries as ts
import numpy as np

from ._corr import stand, kernel_corr

import asyncio

# this function is directly used for augmented selects
def proc_main(pk, row, arg):
    #The argument is a time series. But due to serialization it does
    #not come out as the "instance", and must be cast
    print ("RRRRR")
    print (*arg)
    argts = ts.TimeSeries(*arg)
    #compute a standardized time series
    stand_argts = stand(argts, argts.mean(), argts.std())
    # for each row in our select/etc, standardize the time series
    stand_rowts = stand(row['ts'], row['ts'].mean(), row['ts'].std())
    print(stand_argts, stand_rowts)
    #compute the normalozed kernelized cross-correlation
    kerncorr = kernel_corr(stand_rowts, stand_argts, 5)
    # compute a distance from it.
    #The distance is given by np.sqrt(K(x,x) + K(y,y) - 2*K(x,y))
    #since we are normalized the autocorrs are 1
    kerndist = np.sqrt(2*(1-kerncorr))
    return [kerndist]

#the function is wrapped in a coroutine for triggers
async def main(pk, row, arg):
    return proc_main(pk, row, arg)


text:
/*
 * File: app/view/MatrixEx6.js
 *
 * This file was generated by Sencha Architect version 3.2.0.
 * http://www.sencha.com/products/architect/
 *
 * This file requires use of the Ext JS 5.1.x library, under independent license.
 * License of Sencha Architect does not include license for Ext JS 5.1.x. For more
 * details see http://www.sencha.com/license or contact license@sencha.com.
 *
 * This file will be auto-generated each and everytime you save your project.
 *
 * Do NOT hand edit this file.
 */

Ext.define('CalendarMatrix.view.MatrixEx6', {
    extend: 'Ext.container.Container',
    alias: 'widget.matrixex6',

    requires: [
        'CalendarMatrix.view.MatrixEx6ViewModel',
        'CalendarMatrix.view.MatrixEx6ViewController',
        'Ext.toolbar.Toolbar',
        'Ext.button.Button'
    ],

    controller: 'matrixex6',
    viewModel: {
        type: 'matrixex6'
    },
    cls: 'matrix-ex6-cal',
    itemId: 'matrixEx6',
    margin: 5,
    style: 'background-color: white;',
    layout: 'border',

    items: [
        {
            xtype: 'container',
            region: 'north',
            html: 'Expedia and Travelocity style date range selector. Also demonstrates the following:
 - Customized month navigation arrows with logic to show hide based on selected dates
 - Demonstrates how to process \'mouseover\' event to dynamically paint range as user hovers
 - Utilizes disableFn config to dynamically disable prior and future dates based on startDate vs. endDate selection mode.',
            style: 'margin: 20px 0; font-size: 18px;'
        },
        {
            xtype: 'toolbar',
            region: 'north',
            height: 60,
            items: [
                {
                    xtype: 'button',
                    reference: 'startBtn',
                    cls: 'inputBtn',
                    height: 45,
                    itemId: 'startBtn',
                    ui: 'plain',
                    width: 150,
                    iconCls: 'fa-icon-calendar',
                    text: 'mm/dd/yyyy',
                    listeners: {
                        click: 'onStartBtnClick'
                    }
                },
                {
                    xtype: 'button',
                    reference: 'endBtn',
                    cls: 'inputBtn',
                    height: 45,
                    itemId: 'endBtn',
                    ui: 'plain',
                    width: 150,
                    iconCls: 'fa-icon-calendar',
                    text: 'mm/dd/yyyy',
                    listeners: {
                        click: 'onEndBtnClick'
                    }
                },
                {
                    xtype: 'button',
                    height: 30,
                    itemId: 'resetBtn',
                    ui: 'plain',
                    width: 30,
                    iconCls: 'fa-icon-remove',
                    listeners: {
                        click: 'onResetBtnClick'
                    }
                },
                {
                    xtype: 'button',
                    reference: 'findBtn',
                    cls: 'find-btn',
                    height: 45,
                    itemId: 'findBtn',
                    ui: 'plain',
                    width: 85,
                    text: 'Search',
                    listeners: {
                        click: 'onFindBtnClick'
                    }
                }
            ]
        },
        {
            xtype: 'container',
            region: 'center'
        }
    ],

    initComponent: function() {
        var me = this;

        me.callParent(arguments);

    }

});


text:
MONIT_USERNAME="root"
MONIT_PASSWORD="toor"

apt-get update

#install nodejs
apt-get install -y python-software-properties python g++ make
add-apt-repository ppa:chris-lea/node.js
apt-get install -y nodejs

#install nginx
apt-get install -y nginx
service nginx start
update-rc.d nginx defaults

#configure nginx
mv /etc/nginx/sites-available/default /etc/nginx/sites-available/default.BAK
cat > /etc/nginx/sites-available/default << "EOL"
upstream app_nodejs {
server 127.0.0.1:3000;
}
server {
    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;
        proxy_pass http://app_nodejs;
        proxy_redirect off;
    }
}
EOL
/etc/init.d/nginx restart

#create default node server
mkdir -p /var/www
cat > /var/www/server.js << EOL
    var http = require('http');
    var server = http.createServer(function (request, response) {
      response.writeHead(200, {"Content-Type": "text/plain"});
      response.end("Default node server\n");
    });
    server.listen(3000);
    console.log("Server running at http://127.0.0.1:3000/");
EOL

#starting nodeserver
start nodeserver

#create nodeserver upstart script
cat > /etc/init/nodeserver.conf << EOL
#!upstart
    description "Node server"
    author "Sylvain Boucher"

    start on runlevel [2345]
    stop on runlevel [^2345]

    # Restart when job dies
    respawn

    # Give up restart after 5 respawns in 60 seconds
    respawn limit 5 60

    # vars
    env NODE_BIN=/usr/bin/node
    env APP_DIR=/var/www
    env SCRIPT_FILE="server.js"
    env LOG_FILE="/var/log/nodeserver.log"
    env RUN_AS="vagrant"
    #env NODE_ENV="development"
    #env SITE_URL="http://sandbox:8080"

    script
      touch $LOG_FILE
      chown $RUN_AS:$RUN_AS $LOG_FILE
      chdir $APP_DIR
      exec sudo -u $RUN_AS -E sh -c "$NODE_BIN $SCRIPT_FILE >> $LOG_FILE  2>&1"

    end script

pre-start script
# Date format same as (new Date()).toISOString() for consistency
echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Starting" >> $LOG_FILE
end script

pre-stop script
echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Stopping" >> $LOG_FILE
end script

post-start script
echo "===== App restarted =====" >> $LOG_FILE
end script
EOL

#install and configure monit
apt-get install -y monit
cat > /etc/monit/monitrc << EOL
set daemon 60

set httpd port 2812 and
    allow $MONIT_USERNAME:$MONIT_PASSWORD

check system nodeserver_system
      start "/sbin/start nodeserver" with timeout 60 seconds
      stop "/sbin/stop nodeserver"

check process nginx with pidfile /var/run/nginx.pid
    start program = "/etc/init.d/nginx start"
    stop program = "/etc/init.d/nginx stop"

check host nodeserver_http with address 127.0.0.1
      start "/sbin/start nodeserver" with timeout 60 seconds
      stop "/sbin/stop nodeserver"
      if failed port 80 protocol HTTP
        request /
        with timeout 5 seconds
        then restart
EOL
chmod 700 /etc/monit/monitrc
monit reload
monit start all


text:
import { FunctionModel, BasicModel } from "objectmodel";

const Numb = BasicModel(Number).assert(Number.isFinite);
const Operator = BasicModel(["+", "-", "*", "/"]);

const Calculator = FunctionModel(Numb, Operator, Numb).return(Numb);

const calc = new Calculator((a, operator, b) => eval(a + operator + b));

calc(3, "+", 1);
// 4
calc(6, "*", null);
// TypeError: expecting arguments[2] to be Number, got null
calc(1, "/", 0);
// TypeError: assertion "isFinite" returned false for value Infinity


text:
@interface CalendarDateView ()

@property (nonatomic, strong, readwrite) UILabel *weakLabel;
@property (nonatomic, strong, readwrite) UILabel *dayLabel;
@property (nonatomic, strong, readwrite) UILabel *colorLabel;

@end

@implementation CalendarDateView

#pragma Mark
#pragma Make Init
- (instancetype)init
{
    self = [super init];
    if (self)
    {
        [self commonInit];
    }
    return self;
}

- (instancetype)initWithCoder:(NSCoder *)coder
{
    self = [super initWithCoder:coder];
    if (self)
    {
        [self commonInit];
    }
    return self;
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        [self commonInit];
    }
    return self;
}

- (void)commonInit
{
    _weakLabel = [UILabel new];
    _dayLabel = [UILabel new];
    _colorLabel = [UILabel new];
    _weakLabel.textAlignment = NSTextAlignmentCenter;
    _dayLabel.textAlignment = NSTextAlignmentCenter;
    _colorLabel.textAlignment = NSTextAlignmentCenter;

    _fontSize = 9;
    _colorLabelHeight = 3;
    _weakLabelColor = [UIColor grayColor];
    _dayLabelColor = _weakLabelColor;
    _colorLabelColor = [UIColor clearColor];

    [self addSubview:_weakLabel];
    [self addSubview:_dayLabel];
    [self addSubview:_colorLabel];
}

#pragma Mark
#pragma Mark Renders

- (void)layoutSubviews
{
    [super layoutSubviews];

    CGFloat colorHeight = _colorLabelHeight;
    CGFloat width = CGRectGetWidth(self.bounds);
    CGFloat height = (CGRectGetHeight(self.bounds) - colorHeight) / 2;

    _weakLabel.frame = CGRectMake(0, 0, width, height - margin);
    _dayLabel.frame = CGRectMake(0, height - margin, width, height - margin);
    _colorLabel.frame = CGRectMake(margin, height * 2 , width-2*margin, colorHeight);

    _weakLabel.font = [UIFont systemFontOfSize:_fontSize];
    _dayLabel.font = [UIFont systemFontOfSize:_fontSize];

    _weakLabel.textColor = _weakLabelColor;
    _dayLabel.textColor = _dayLabelColor;
    _colorLabel.backgroundColor = _colorLabelColor;

    if (_weakLabelText.length > 0)
    {
        _weakLabel.text = _weakLabelText;
    }
    if (_dayLabelText.length > 0)
    {
        _dayLabel.text = _dayLabelText;
    }
}

@end


text:
package springfox.documentation.swagger.web;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class SecurityConfiguration {
  public static final SecurityConfiguration DEFAULT = new SecurityConfiguration();

  private String clientId;
  private String clientSecret;
  private String realm;
  private String appName;
  private String apiKey;
  private String scopeSeparator;

  private SecurityConfiguration() {
    this(null, null, null, null, null, ",");
  }

  public SecurityConfiguration(String clientId, String clientSecret, String realm, String appName, String apiKey,
                               String scopeSeparator) {
    this.clientId = clientId;
    this.clientSecret = clientSecret;
    this.realm = realm;
    this.appName = appName;
    this.apiKey = apiKey;
    this.scopeSeparator = scopeSeparator;
  }

  @JsonProperty("clientId")
  public String getClientId() {
    return clientId;
  }

  @JsonProperty("realm")
  public String getRealm() {
    return realm;
  }

  @JsonProperty("appName")
  public String getAppName() {
    return appName;
  }

  @JsonProperty("apiKey")
  public String getApiKey() {
    return apiKey;
  }

  @JsonProperty("clientSecret")
  public String getClientSecret() {
    return clientSecret;
  }

  @JsonProperty("scopeSeparator")
  public String scopeSeparator() {
    return scopeSeparator;
  }
}


text:
function getRandomNumber( lower, upper ) {
  return Math.floor(Math.random() * (upper - lower + 1)) + lower;
}

console.log( getRandomNumber( 'nine', 24 ) );
console.log( getRandomNumber( 1, 100 ) );
console.log( getRandomNumber( 200, 'five hundred' ) );
console.log( getRandomNumber( 1000, 20000 ) );
console.log( getRandomNumber( 50, 100 ) );


text:
<project>
    <target name="bower">
        <antcall target="bower-build"></antcall>
        <antcall target="bower-clone-repo"></antcall>
        <antcall target="bower-copy-files"></antcall>
        <antcall target="bower-commit-repo"></antcall>
        <antcall target="bower-remove-repo"></antcall>
    </target>

    <target name="bower-build">
        <echo message="Making bower build" />
        <exec executable="bash" dir="app">
            <arg value="-c"/>
            <arg value="gulp bower"/>
        </exec>
    </target>

    <target name="bower-clone-repo">
        <echo message="Downloading ${bower.repo}" />
        <exec executable="bash">
            <arg value="-c"/>
            <arg value="git clone --depth=1 ${bower.repo} ${bower.folder}"/>
        </exec>
    </target>

    <target name="bower-copy-files">
        <copy todir="${bower.folder}" overwrite="true">
            <fileset dir="app/dist"></fileset>
        </copy>

        <copy todir="${bower.folder}" overwrite="true">
            <fileset file="app/bower.json"></fileset>
        </copy>

        <replace file="${bower.folder}/bower.json">
            <replacefilter token='"version": "0.0.0"' value='"version": "${project.version}"' />
        </replace>
    </target>

    <target name="bower-commit-repo">
        <echo message="Committing to ${bower.repo}" />

        <exec executable="bash" dir="${bower.folder}">
            <arg value="-c"/>
            <arg value="git add ."/>
        </exec>

        <exec executable="bash" dir="${bower.folder}">
            <arg value="-c"/>
            <arg value="git commit -m 'Version ${project.version} added'"/>
        </exec>

        <exec executable="bash" dir="${bower.folder}">
            <arg value="-c"/>
            <arg value="git tag ${project.version}"/>
        </exec>

        <exec executable="bash" dir="${bower.folder}">
            <arg value="-c"/>
            <arg value="git push origin master --tags"/>
        </exec>
    </target>

    <target name="bower-remove-repo">
        <exec executable="bash">
            <arg value="-c"/>
            <arg value="rm -rf triangular-bower"/>
        </exec>
    </target>
</project>