text:
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Renci.SshNet.Common;
using Renci.SshNet.Tests.Common;
using Renci.SshNet.Tests.Properties;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Linq;

namespace Renci.SshNet.Tests.Classes
{
    ///
    /// Provides client connection to SSH server.
    ///
    [TestClass]
    public class SshClientTest : TestBase
    {
        [TestMethod]
        [TestCategory("Authentication")]
        [TestCategory("integration")]
        public void Test_Connect_Using_Correct_Password()
        {
            var host = Resources.HOST;
            var username = Resources.USERNAME;
            var password = Resources.PASSWORD;

            #region Example SshClient(host, username) Connect
            using (var client = new SshClient(host, username, password))
            {
                client.Connect();
                //  Do something here
                client.Disconnect();
            }
            #endregion
        }

        [TestMethod]
        [TestCategory("Authentication")]
        [TestCategory("integration")]
        public void Test_Connect_Handle_HostKeyReceived()
        {
            var host = Resources.HOST;
            var username = Resources.USERNAME;
            var password = Resources.PASSWORD;
            var hostKeyValidated = false;

            #region Example SshClient Connect HostKeyReceived
            using (var client = new SshClient(host, username, password))
            {
                client.HostKeyReceived += delegate(object sender, HostKeyEventArgs e)
                {
                    hostKeyValidated = true;

                    if (e.FingerPrint.SequenceEqual(new byte[] { 0x00, 0x01, 0x02, 0x03 }))
                    {
                        e.CanTrust = true;
                    }
                    else
                    {
                        e.CanTrust = false;
                    }
                };
                client.Connect();
                //  Do something here
                client.Disconnect();
            }
            #endregion

            Assert.IsTrue(hostKeyValidated);
        }

        [TestMethod]
        [TestCategory("Authentication")]
        [TestCategory("integration")]
        public void Test_Connect_Timeout()
        {
            var host = Resources.HOST;
            var username = Resources.USERNAME;
            var password = Resources.PASSWORD;

            #region Example SshClient Connect Timeout
            var connectionInfo = new PasswordConnectionInfo(host, username, password);

            connectionInfo.Timeout = TimeSpan.FromSeconds(30);

            using (var client = new SshClient(connectionInfo))
            {
                client.Connect();
                //  Do something here
                client.Disconnect();
            }
            #endregion
            Assert.Inconclusive();
        }

        [TestMethod]
        [TestCategory("Authentication")]
        [TestCategory("integration")]
        public void Test_Connect_Handle_ErrorOccurred()
        {
            var host = Resources.HOST;
            var username = Resources.USERNAME;
            var password = Resources.PASSWORD;
            var exceptionOccured = false;

            #region Example SshClient Connect ErrorOccurred
            using (var client = new SshClient(host, username, password))
            {
                client.ErrorOccurred += delegate(object sender, ExceptionEventArgs e)
                {
                    Console.WriteLine("Error occured: " + e.Exception);
                    exceptionOccured = true;
                };

                client.Connect();
                //  Do something here
                client.Disconnect();
            }
            #endregion
            Assert.IsTrue(exceptionOccured);
        }

        [TestMethod]
        [TestCategory("Authentication")]
        [TestCategory("integration")]
        [ExpectedException(typeof(SshAuthenticationException))]
        public void Test_Connect_Using_Invalid_Password()
        {
            using (var client = new SshClient(Resources.HOST, Resources.USERNAME, "invalid password"))
            {
                client.Connect();
                client.Disconnect();
            }
        }

        [TestMethod]
        [TestCategory("Authentication")]
        [TestCategory("integration")]
        public void Test_Connect_Using_Rsa_Key_Without_PassPhrase()
        {
            var host = Resources.HOST;
            var username = Resources.USERNAME;
            MemoryStream keyFileStream = new MemoryStream(Encoding.ASCII.GetBytes(Resources.RSA_KEY_WITHOUT_PASS));

            #region Example SshClient(host, username) Connect PrivateKeyFile
            using (var client = new SshClient(host, username, new PrivateKeyFile(keyFileStream)))
            {
                client.Connect();
                client.Disconnect();
            }
            #endregion
        }

        [TestMethod]
        [TestCategory("Authentication")]
        [TestCategory("integration")]
        public void Test_Connect_Using_RsaKey_With_PassPhrase()
        {
            var host = Resources.HOST;
            var username = Resources.USERNAME;
            var passphrase = Resources.PASSWORD;
            MemoryStream keyFileStream = new MemoryStream(Encoding.ASCII.GetBytes(Resources.RSA_KEY_WITH_PASS));

            #region Example SshClient(host, username) Connect PrivateKeyFile PassPhrase
            using (var client = new SshClient(host, username, new PrivateKeyFile(keyFileStream, passphrase)))
            {
                client.Connect();
                client.Disconnect();
            }
            #endregion
        }

        [TestMethod]
        [TestCategory("Authentication")]
        [TestCategory("integration")]
        [ExpectedException(typeof(SshPassPhraseNullOrEmptyException))]
        public void Test_Connect_Using_Key_With_Empty_PassPhrase()
        {
            MemoryStream keyFileStream = new MemoryStream(Encoding.ASCII.GetBytes(Resources.RSA_KEY_WITH_PASS));
            using (var client = new SshClient(Resources.HOST, Resources.USERNAME, new PrivateKeyFile(keyFileStream, null)))
            {
                client.Connect();
                client.Disconnect();
            }
        }

        [TestMethod]
        [TestCategory("Authentication")]
        [TestCategory("integration")]
        public void Test_Connect_Using_DsaKey_Without_PassPhrase()
        {
            MemoryStream keyFileStream = new MemoryStream(Encoding.ASCII.GetBytes(Resources.DSA_KEY_WITHOUT_PASS));
            using (var client = new SshClient(Resources.HOST, Resources.USERNAME, new PrivateKeyFile(keyFileStream)))
            {
                client.Connect();
                client.Disconnect();
            }
        }

        [TestMethod]
        [TestCategory("Authentication")]
        [TestCategory("integration")]
        public void Test_Connect_Using_DsaKey_With_PassPhrase()
        {
            MemoryStream keyFileStream = new MemoryStream(Encoding.ASCII.GetBytes(Resources.DSA_KEY_WITH_PASS));
            using (var client = new SshClient(Resources.HOST, Resources.USERNAME, new PrivateKeyFile(keyFileStream, Resources.PASSWORD)))
            {
                client.Connect();
                client.Disconnect();
            }
        }

        [TestMethod]
        [TestCategory("Authentication")]
        [TestCategory("integration")]
        [ExpectedException(typeof(SshAuthenticationException))]
        public void Test_Connect_Using_Invalid_PrivateKey()
        {
            MemoryStream keyFileStream = new MemoryStream(Encoding.ASCII.GetBytes(Resources.INVALID_KEY));
            using (var client = new SshClient(Resources.HOST, Resources.USERNAME, new PrivateKeyFile(keyFileStream)))
            {
                client.Connect();
                client.Disconnect();
            }
        }

        [TestMethod]
        [TestCategory("Authentication")]
        [TestCategory("integration")]
        public void Test_Connect_Using_Multiple_PrivateKeys()
        {
            using (var client = new SshClient(Resources.HOST, Resources.USERNAME,
                new PrivateKeyFile(new MemoryStream(Encoding.ASCII.GetBytes(Resources.INVALID_KEY))),
                new PrivateKeyFile(new MemoryStream(Encoding.ASCII.GetBytes(Resources.DSA_KEY_WITH_PASS)), Resources.PASSWORD),
                new PrivateKeyFile(new MemoryStream(Encoding.ASCII.GetBytes(Resources.RSA_KEY_WITH_PASS)), Resources.PASSWORD),
                new PrivateKeyFile(new MemoryStream(Encoding.ASCII.GetBytes(Resources.RSA_KEY_WITHOUT_PASS))),
                new PrivateKeyFile(new MemoryStream(Encoding.ASCII.GetBytes(Resources.DSA_KEY_WITHOUT_PASS)))
                ))
            {
                client.Connect();
                client.Disconnect();
            }
        }

        [TestMethod]
        [TestCategory("Authentication")]
        [TestCategory("integration")]
        public void Test_Connect_Then_Reconnect()
        {
            using (var client = new SshClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
            {
                client.Connect();
                client.Disconnect();
                client.Connect();
                client.Disconnect();
            }
        }

        [TestMethod]
        public void CreateShellStream1_NeverConnected()
        {
            using (var client = new SshClient(Resources.HOST, Resources.USERNAME, "invalid password"))
            {
                const string terminalName = "vt100";
                const uint columns = 80;
                const uint rows = 25;
                const uint width = 640;
                const uint height = 480;
                const int bufferSize = 4096;

                try
                {
                    client.CreateShellStream(terminalName, columns, rows, width, height, bufferSize);
                    Assert.Fail();
                }
                catch (SshConnectionException ex)
                {
                    Assert.IsNull(ex.InnerException);
                    Assert.AreEqual("Client not connected.", ex.Message);
                }
            }
        }

        [TestMethod]
        public void CreateShellStream2_NeverConnected()
        {
            using (var client = new SshClient(Resources.HOST, Resources.USERNAME, "invalid password"))
            {
                const string terminalName = "vt100";
                const uint columns = 80;
                const uint rows = 25;
                const uint width = 640;
                const uint height = 480;
                var terminalModes = new Dictionary<TerminalModes, uint>();
                const int bufferSize = 4096;

                try
                {
                    client.CreateShellStream(terminalName, columns, rows, width, height, bufferSize, terminalModes);
                    Assert.Fail();
                }
                catch (SshConnectionException ex)
                {
                    Assert.IsNull(ex.InnerException);
                    Assert.AreEqual("Client not connected.", ex.Message);
                }
            }
        }

        ///
        ///A test for CreateShellStream
        ///
        [TestMethod]
        [Ignore] // placeholder for actual test
        public void CreateShellStreamTest()
        {
            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
            SshClient target = new SshClient(connectionInfo); // TODO: Initialize to an appropriate value
            string terminalName = string.Empty; // TODO: Initialize to an appropriate value
            uint columns = 0; // TODO: Initialize to an appropriate value
            uint rows = 0; // TODO: Initialize to an appropriate value
            uint width = 0; // TODO: Initialize to an appropriate value
            uint height = 0; // TODO: Initialize to an appropriate value
            int bufferSize = 0; // TODO: Initialize to an appropriate value
            IDictionary<TerminalModes, uint> terminalModeValues = null; // TODO: Initialize to an appropriate value
            ShellStream expected = null; // TODO: Initialize to an appropriate value
            ShellStream actual;
            actual = target.CreateShellStream(terminalName, columns, rows, width, height, bufferSize, terminalModeValues);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        ///
        ///A test for CreateShellStream
        ///
        [TestMethod]
        [Ignore] // placeholder for actual test
        public void CreateShellStreamTest1()
        {
            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
            SshClient target = new SshClient(connectionInfo); // TODO: Initialize to an appropriate value
            string terminalName = string.Empty; // TODO: Initialize to an appropriate value
            uint columns = 0; // TODO: Initialize to an appropriate value
            uint rows = 0; // TODO: Initialize to an appropriate value
            uint width = 0; // TODO: Initialize to an appropriate value
            uint height = 0; // TODO: Initialize to an appropriate value
            int bufferSize = 0; // TODO: Initialize to an appropriate value
            ShellStream expected = null; // TODO: Initialize to an appropriate value
            ShellStream actual;
            actual = target.CreateShellStream(terminalName, columns, rows, width, height, bufferSize);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        [TestMethod]
        public void CreateShell1_NeverConnected()
        {
            using (var client = new SshClient(Resources.HOST, Resources.USERNAME, "invalid password"))
            {
                var encoding = Encoding.UTF8;
                const string input = "INPUT";
                var output = new MemoryStream();
                var extendedOutput = new MemoryStream();

                try
                {
                    client.CreateShell(encoding, input, output, extendedOutput);
                    Assert.Fail();
                }
                catch (SshConnectionException ex)
                {
                    Assert.IsNull(ex.InnerException);
                    Assert.AreEqual("Client not connected.", ex.Message);
                }
            }
        }

        [TestMethod]
        public void CreateShell2_NeverConnected()
        {
            using (var client = new SshClient(Resources.HOST, Resources.USERNAME, "invalid password"))
            {
                var encoding = Encoding.UTF8;
                const string input = "INPUT";
                var output = new MemoryStream();
                var extendedOutput = new MemoryStream();
                const string terminalName = "vt100";
                const uint columns = 80;
                const uint rows = 25;
                const uint width = 640;
                const uint height = 480;
                var terminalModes = new Dictionary<TerminalModes, uint>();

                try
                {
                    client.CreateShell(
                        encoding,
                        input,
                        output,
                        extendedOutput,
                        terminalName,
                        columns,
                        rows,
                        width,
                        height,
                        terminalModes);
                    Assert.Fail();
                }
                catch (SshConnectionException ex)
                {
                    Assert.IsNull(ex.InnerException);
                    Assert.AreEqual("Client not connected.", ex.Message);
                }
            }
        }

        [TestMethod]
        public void CreateShell3_NeverConnected()
        {
            using (var client = new SshClient(Resources.HOST, Resources.USERNAME, "invalid password"))
            {
                var encoding = Encoding.UTF8;
                const string input = "INPUT";
                var output = new MemoryStream();
                var extendedOutput = new MemoryStream();
                const string terminalName = "vt100";
                const uint columns = 80;
                const uint rows = 25;
                const uint width = 640;
                const uint height = 480;
                var terminalModes = new Dictionary<TerminalModes, uint>();
                const int bufferSize = 4096;

                try
                {

                    client.CreateShell(
                        encoding,
                        input,
                        output,
                        extendedOutput,
                        terminalName,
                        columns,
                        rows,
                        width,
                        height,
                        terminalModes,
                        bufferSize);
                    Assert.Fail();
                }
                catch (SshConnectionException ex)
                {
                    Assert.IsNull(ex.InnerException);
                    Assert.AreEqual("Client not connected.", ex.Message);
                }
            }
        }

        [TestMethod]
        public void CreateShell4_NeverConnected()
        {
            using (var client = new SshClient(Resources.HOST, Resources.USERNAME, "invalid password"))
            {
                var input = new MemoryStream();
                var output = new MemoryStream();
                var extendedOutput = new MemoryStream();

                try
                {

                    client.CreateShell(input, output, extendedOutput);
                    Assert.Fail();
                }
                catch (SshConnectionException ex)
                {
                    Assert.IsNull(ex.InnerException);
                    Assert.AreEqual("Client not connected.", ex.Message);
                }
            }
        }

        [TestMethod]
        public void CreateShell5_NeverConnected()
        {
            using (var client = new SshClient(Resources.HOST, Resources.USERNAME, "invalid password"))
            {
                var input = new MemoryStream();
                var output = new MemoryStream();
                var extendedOutput = new MemoryStream();
                const string terminalName = "vt100";
                const uint columns = 80;
                const uint rows = 25;
                const uint width = 640;
                const uint height = 480;
                var terminalModes = new Dictionary<TerminalModes, uint>();

                try
                {
                    client.CreateShell(
                        input,
                        output,
                        extendedOutput,
                        terminalName,
                        columns,
                        rows,
                        width,
                        height,
                        terminalModes);
                    Assert.Fail();
                }
                catch (SshConnectionException ex)
                {
                    Assert.IsNull(ex.InnerException);
                    Assert.AreEqual("Client not connected.", ex.Message);
                }
            }
        }

        [TestMethod]
        public void CreateShell6_NeverConnected()
        {
            using (var client = new SshClient(Resources.HOST, Resources.USERNAME, "invalid password"))
            {
                var input = new MemoryStream();
                var output = new MemoryStream();
                var extendedOutput = new MemoryStream();
                const string terminalName = "vt100";
                const uint columns = 80;
                const uint rows = 25;
                const uint width = 640;
                const uint height = 480;
                var terminalModes = new Dictionary<TerminalModes, uint>();
                const int bufferSize = 4096;

                try
                {

                    client.CreateShell(
                        input,
                        output,
                        extendedOutput,
                        terminalName,
                        columns,
                        rows,
                        width,
                        height,
                        terminalModes,
                        bufferSize);
                    Assert.Fail();
                }
                catch (SshConnectionException ex)
                {
                    Assert.IsNull(ex.InnerException);
                    Assert.AreEqual("Client not connected.", ex.Message);
                }
            }
        }

        ///
        ///A test for CreateShell
        ///
        [TestMethod]
        [Ignore] // placeholder for actual test
        public void CreateShellTest()
        {
            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
            SshClient target = new SshClient(connectionInfo); // TODO: Initialize to an appropriate value
            Encoding encoding = null; // TODO: Initialize to an appropriate value
            string input = string.Empty; // TODO: Initialize to an appropriate value
            Stream output = null; // TODO: Initialize to an appropriate value
            Stream extendedOutput = null; // TODO: Initialize to an appropriate value
            Shell expected = null; // TODO: Initialize to an appropriate value
            Shell actual;
            actual = target.CreateShell(encoding, input, output, extendedOutput);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        ///
        ///A test for CreateShell
        ///
        [TestMethod]
        [Ignore] // placeholder for actual test
        public void CreateShellTest1()
        {
            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
            SshClient target = new SshClient(connectionInfo); // TODO: Initialize to an appropriate value
            Encoding encoding = null; // TODO: Initialize to an appropriate value
            string input = string.Empty; // TODO: Initialize to an appropriate value
            Stream output = null; // TODO: Initialize to an appropriate value
            Stream extendedOutput = null; // TODO: Initialize to an appropriate value
            string terminalName = string.Empty; // TODO: Initialize to an appropriate value
            uint columns = 0; // TODO: Initialize to an appropriate value
            uint rows = 0; // TODO: Initialize to an appropriate value
            uint width = 0; // TODO: Initialize to an appropriate value
            uint height = 0; // TODO: Initialize to an appropriate value
            IDictionary<TerminalModes, uint> terminalModes = null; // TODO: Initialize to an appropriate value
            Shell expected = null; // TODO: Initialize to an appropriate value
            Shell actual;
            actual = target.CreateShell(encoding, input, output, extendedOutput, terminalName, columns, rows, width, height, terminalModes);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        ///
        ///A test for CreateShell
        ///
        [TestMethod]
        [Ignore] // placeholder for actual test
        public void CreateShellTest2()
        {
            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
            SshClient target = new SshClient(connectionInfo); // TODO: Initialize to an appropriate value
            Encoding encoding = null; // TODO: Initialize to an appropriate value
            string input = string.Empty; // TODO: Initialize to an appropriate value
            Stream output = null; // TODO: Initialize to an appropriate value
            Stream extendedOutput = null; // TODO: Initialize to an appropriate value
            string terminalName = string.Empty; // TODO: Initialize to an appropriate value
            uint columns = 0; // TODO: Initialize to an appropriate value
            uint rows = 0; // TODO: Initialize to an appropriate value
            uint width = 0; // TODO: Initialize to an appropriate value
            uint height = 0; // TODO: Initialize to an appropriate value
            IDictionary<TerminalModes, uint> terminalModes = null; // TODO: Initialize to an appropriate value
            int bufferSize = 0; // TODO: Initialize to an appropriate value
            Shell expected = null; // TODO: Initialize to an appropriate value
            Shell actual;
            actual = target.CreateShell(encoding, input, output, extendedOutput, terminalName, columns, rows, width, height, terminalModes, bufferSize);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        ///
        ///A test for CreateShell
        ///
        [TestMethod]
        [Ignore] // placeholder for actual test
        public void CreateShellTest3()
        {
            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
            SshClient target = new SshClient(connectionInfo); // TODO: Initialize to an appropriate value
            Stream input = null; // TODO: Initialize to an appropriate value
            Stream output = null; // TODO: Initialize to an appropriate value
            Stream extendedOutput = null; // TODO: Initialize to an appropriate value
            Shell expected = null; // TODO: Initialize to an appropriate value
            Shell actual;
            actual = target.CreateShell(input, output, extendedOutput);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        ///
        ///A test for CreateShell
        ///
        [TestMethod]
        [Ignore] // placeholder for actual test
        public void CreateShellTest4()
        {
            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
            SshClient target = new SshClient(connectionInfo); // TODO: Initialize to an appropriate value
            Stream input = null; // TODO: Initialize to an appropriate value
            Stream output = null; // TODO: Initialize to an appropriate value
            Stream extendedOutput = null; // TODO: Initialize to an appropriate value
            string terminalName = string.Empty; // TODO: Initialize to an appropriate value
            uint columns = 0; // TODO: Initialize to an appropriate value
            uint rows = 0; // TODO: Initialize to an appropriate value
            uint width = 0; // TODO: Initialize to an appropriate value
            uint height = 0; // TODO: Initialize to an appropriate value
            IDictionary<TerminalModes, uint> terminalModes = null; // TODO: Initialize to an appropriate value
            Shell expected = null; // TODO: Initialize to an appropriate value
            Shell actual;
            actual = target.CreateShell(input, output, extendedOutput, terminalName, columns, rows, width, height, terminalModes);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        ///
        ///A test for CreateShell
        ///
        [TestMethod]
        [Ignore] // placeholder for actual test
        public void CreateShellTest5()
        {
            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
            SshClient target = new SshClient(connectionInfo); // TODO: Initialize to an appropriate value
            Stream input = null; // TODO: Initialize to an appropriate value
            Stream output = null; // TODO: Initialize to an appropriate value
            Stream extendedOutput = null; // TODO: Initialize to an appropriate value
            string terminalName = string.Empty; // TODO: Initialize to an appropriate value
            uint columns = 0; // TODO: Initialize to an appropriate value
            uint rows = 0; // TODO: Initialize to an appropriate value
            uint width = 0; // TODO: Initialize to an appropriate value
            uint height = 0; // TODO: Initialize to an appropriate value
            IDictionary<TerminalModes, uint> terminalModes = null; // TODO: Initialize to an appropriate value
            int bufferSize = 0; // TODO: Initialize to an appropriate value
            Shell expected = null; // TODO: Initialize to an appropriate value
            Shell actual;
            actual = target.CreateShell(input, output, extendedOutput, terminalName, columns, rows, width, height, terminalModes, bufferSize);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        [TestMethod]
        public void CreateCommand_CommandText_NeverConnected()
        {
            using (var client = new SshClient(Resources.HOST, Resources.USERNAME, "invalid password"))
            {
                try
                {
                    client.CreateCommand("ls");
                    Assert.Fail();
                }
                catch (SshConnectionException ex)
                {
                    Assert.IsNull(ex.InnerException);
                    Assert.AreEqual("Client not connected.", ex.Message);
                }
            }
        }

        [TestMethod]
        public void CreateCommand_CommandTextAndEncoding_NeverConnected()
        {
            using (var client = new SshClient(Resources.HOST, Resources.USERNAME, "invalid password"))
            {
                try
                {
                    client.CreateCommand("ls", Encoding.UTF8);
                    Assert.Fail();
                }
                catch (SshConnectionException ex)
                {
                    Assert.IsNull(ex.InnerException);
                    Assert.AreEqual("Client not connected.", ex.Message);
                }
            }
        }

        ///
        ///A test for CreateCommand
        ///
        [TestMethod]
        [Ignore] // placeholder for actual test
        public void CreateCommandTest()
        {
            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
            SshClient target = new SshClient(connectionInfo); // TODO: Initialize to an appropriate value
            string commandText = string.Empty; // TODO: Initialize to an appropriate value
            Encoding encoding = null; // TODO: Initialize to an appropriate value
            SshCommand expected = null; // TODO: Initialize to an appropriate value
            SshCommand actual;
            actual = target.CreateCommand(commandText, encoding);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        ///
        ///A test for CreateCommand
        ///
        [TestMethod]
        [Ignore] // placeholder for actual test
        public void CreateCommandTest1()
        {
            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
            SshClient target = new SshClient(connectionInfo); // TODO: Initialize to an appropriate value
            string commandText = string.Empty; // TODO: Initialize to an appropriate value
            SshCommand expected = null; // TODO: Initialize to an appropriate value
            SshCommand actual;
            actual = target.CreateCommand(commandText);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        [TestMethod]
        public void AddForwardedPort_NeverConnected()
        {
            using (var client = new SshClient(Resources.HOST, Resources.USERNAME, "invalid password"))
            {
                var port = new ForwardedPortLocal(50, "host", 8080);

                try
                {
                    client.AddForwardedPort(port);
                    Assert.Fail();
                }
                catch (SshConnectionException ex)
                {
                    Assert.IsNull(ex.InnerException);
                    Assert.AreEqual("Client not connected.", ex.Message);
                }
            }
        }

        ///
        ///A test for AddForwardedPort
        ///
        [TestMethod]
        [Ignore] // placeholder for actual test
        public void AddForwardedPortTest()
        {
            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
            SshClient target = new SshClient(connectionInfo); // TODO: Initialize to an appropriate value
            ForwardedPort port = null; // TODO: Initialize to an appropriate value
            target.AddForwardedPort(port);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }

        ///
        ///A test for SshClient Constructor
        ///
        [TestMethod]
        [Ignore] // placeholder for actual test
        public void SshClientConstructorTest()
        {
            string host = string.Empty; // TODO: Initialize to an appropriate value
            string username = string.Empty; // TODO: Initialize to an appropriate value
            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
            SshClient target = new SshClient(host, username, keyFiles);
            Assert.Inconclusive("TODO: Implement code to verify target");
        }

        ///
        ///A test for SshClient Constructor
        ///
        [TestMethod]
        [Ignore] // placeholder for actual test
        public void SshClientConstructorTest1()
        {
            string host = string.Empty; // TODO: Initialize to an appropriate value
            int port = 0; // TODO: Initialize to an appropriate value
            string username = string.Empty; // TODO: Initialize to an appropriate value
            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
            SshClient target = new SshClient(host, port, username, keyFiles);
            Assert.Inconclusive("TODO: Implement code to verify target");
        }

        ///
        ///A test for SshClient Constructor
        ///
        [TestMethod]
        [Ignore] // placeholder for actual test
        public void SshClientConstructorTest2()
        {
            string host = string.Empty; // TODO: Initialize to an appropriate value
            string username = string.Empty; // TODO: Initialize to an appropriate value
            string password = string.Empty; // TODO: Initialize to an appropriate value
            SshClient target = new SshClient(host, username, password);
            Assert.Inconclusive("TODO: Implement code to verify target");
        }

        ///
        ///A test for SshClient Constructor
        ///
        [TestMethod]
        [Ignore] // placeholder for actual test
        public void SshClientConstructorTest3()
        {
            string host = string.Empty; // TODO: Initialize to an appropriate value
            int port = 0; // TODO: Initialize to an appropriate value
            string username = string.Empty; // TODO: Initialize to an appropriate value
            string password = string.Empty; // TODO: Initialize to an appropriate value
            SshClient target = new SshClient(host, port, username, password);
            Assert.Inconclusive("TODO: Implement code to verify target");
        }

        ///
        ///A test for SshClient Constructor
        ///
        [TestMethod]
        [Ignore] // placeholder for actual test
        public void SshClientConstructorTest4()
        {
            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
            SshClient target = new SshClient(connectionInfo);
            Assert.Inconclusive("TODO: Implement code to verify target");
        }

        ///
        ///A test for RemoveForwardedPort
        ///
        [TestMethod]
        [Ignore] // placeholder for actual test
        public void RemoveForwardedPortTest()
        {
            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
            SshClient target = new SshClient(connectionInfo); // TODO: Initialize to an appropriate value
            ForwardedPort port = null; // TODO: Initialize to an appropriate value
            target.RemoveForwardedPort(port);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }

        [TestMethod]
        public void RunCommand_CommandText_NeverConnected()
        {
            using (var client = new SshClient(Resources.HOST, Resources.USERNAME, "invalid password"))
            {
                try
                {
                    client.RunCommand("ls");
                    Assert.Fail();
                }
                catch (SshConnectionException ex)
                {
                    Assert.IsNull(ex.InnerException);
                    Assert.AreEqual("Client not connected.", ex.Message);
                }
            }
        }

        ///
        ///A test for RunCommand
        ///
        [TestMethod]
        [Ignore] // placeholder for actual test
        public void RunCommandTest()
        {
            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
            SshClient target = new SshClient(connectionInfo); // TODO: Initialize to an appropriate value
            string commandText = string.Empty; // TODO: Initialize to an appropriate value
            SshCommand expected = null; // TODO: Initialize to an appropriate value
            SshCommand actual;
            actual = target.RunCommand(commandText);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        ///
        ///A test for ForwardedPorts
        ///
        [TestMethod]
        [Ignore] // placeholder for actual test
        public void ForwardedPortsTest()
        {
            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
            SshClient target = new SshClient(connectionInfo); // TODO: Initialize to an appropriate value
            IEnumerable<ForwardedPort> actual;
            actual = target.ForwardedPorts;
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

    }
}


text:
WIP golang simple media framework

## Requirements

Golang 1.5+

[SDL2](https://www.libsdl.org):
The window package requires SDL2 Development libraries/framework to be installed in order the compile. SDL2 is used for it's cross platform window management and input handling.

### Windows only

MinGW: Make sure you have the bin folder set in your PATH. Ensure you can run gcc and that the SDL2 include folder and libraries are in the Mingw include and lib folders. The arch for mingw and sdl2 must match up in order to compile properly.

After successful compiling, you will need to have the SDL2.dll in the same folder as the .exe

redpajama_set_name: RedPajamaGithub


text:
var rest = require('restler');

function getRequest(url, offset, limit, callback) {
    rest.get(url + "?offset=" + offset + "&limit=" + limit).on('complete', function(response) {
        if (response instanceof Error) {
            callback(response, null);
        }
        else {
            callback(null, response);
        }
    });
}

module.exports = getRequest;


text:
"""
    MLP(input, spec; hidden_activation = :relu, prefix)

Construct a multi-layer perceptron. A MLP is a multi-layer neural network with
fully connected layers.

# Arguments:
* `input::SymbolicNode`: the input to the mlp.
* `spec`: the mlp specification, a list of hidden dimensions. For example,
          `[128, (512, :sigmoid), 10]`. The number in the list indicate the
          number of hidden units in each layer. A tuple could be used to specify
          the activation of each layer. Otherwise, the default activation will
          be used (except for the last layer).
* `hidden_activation::Symbol`: keyword argument, default `:relu`, indicating
          the default activation for hidden layers. The specification here could be overwritten
          by layer-wise specification in the `spec` argument. Also activation is not
          applied to the last, i.e. the prediction layer. See [`Activation`](@ref) for a
          list of supported activation types.
* `prefix`: keyword argument, default `gensym()`, used as the prefix to
          name the constructed layers.

Returns the constructed MLP.
"""
function MLP(input, spec; hidden_activation::Symbol=:relu, prefix=gensym())
  spec = convert(Vector{Union{Int,Tuple}}, spec)

  n_layer = length(spec)
  for (i, s) in enumerate(spec)
    if isa(s, Tuple)
      n_unit, act_type = s
    else
      n_unit = s
      act_type = hidden_activation
    end
    input = FullyConnected(input, name=Symbol(prefix, "fc$i"), num_hidden=n_unit)
    if i < n_layer || isa(s, Tuple)
      # will not add activation unless the user explicitly specified
      input = Activation(input, name=Symbol(prefix, "$act_type$i"), act_type=act_type)
    end
  end

  return input
end


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.09.04 at 11:40:23 AM BST
//

package ru.surfstudio.codegenerator.serialization;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for method complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="method">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="parameter" maxOccurs="unbounded" minOccurs="0">
 *           <complexType>
 *             <complexContent>
 *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                 <attribute name="type" use="required" type="{http://www.w3.org/2001/XMLSchema}anySimpleType" />
 *               </restriction>
 *             </complexContent>
 *           </complexType>
 *         </element>
 *       </sequence>
 *       <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}anySimpleType" />
 *       <attribute name="type" type="{http://www.w3.org/2001/XMLSchema}anySimpleType" />
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "method", propOrder = {
    "parameter"
})
public class Method {

    protected List<Method.Parameter> parameter;
    @XmlAttribute(name = "name", required = true)
    @XmlSchemaType(name = "anySimpleType")
    protected String name;
    @XmlAttribute(name = "type")
    @XmlSchemaType(name = "anySimpleType")
    protected String type;

    /**
     * Gets the value of the parameter property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the parameter property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getParameter().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link Method.Parameter }
     *
     *
     */
    public List<Method.Parameter> getParameter() {
        if (parameter == null) {
            parameter = new ArrayList<Method.Parameter>();
        }
        return this.parameter;
    }

    /**
     * Gets the value of the name property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getName() {
        return name;
    }

    /**
     * Sets the value of the name property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setName(String value) {
        this.name = value;
    }

    /**
     * Gets the value of the type property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getType() {
        return type;
    }

    /**
     * Sets the value of the type property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setType(String value) {
        this.type = value;
    }

    /**
     *
Java class for anonymous complex type.
     *
     *
The following schema fragment specifies the expected content contained within this class.
     *
     *

     * <complexType>
     *   <complexContent>
     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *       <attribute name="type" use="required" type="{http://www.w3.org/2001/XMLSchema}anySimpleType" />
     *     </restriction>
     *   </complexContent>
     * </complexType>
     *

     *
     *
     */
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "")
    public static class Parameter {

        @XmlAttribute(name = "type", required = true)
        @XmlSchemaType(name = "anySimpleType")
        protected String type;

        /**
         * Gets the value of the type property.
         *
         * @return
         *     possible object is
         *     {@link String }
         *
         */
        public String getType() {
            return type;
        }

        /**
         * Sets the value of the type property.
         *
         * @param value
         *     allowed object is
         *     {@link String }
         *
         */
        public void setType(String value) {
            this.type = value;
        }

    }

}


text:
/*
 * Global debugging macros
 * Enable them to debug any subsystem
 *
 * Alternatively you can also enable
 * printfs in a particular file by setting
 * *_DEBUG_LOCAL ...added to each C source
 * file.
 */

#ifndef __USB_DEBUG_H
#define __USB_DEBUG_H

/* Enable it for debugging EHCI module */
//#define EHCI_GLOBAL_DEBUG

/* Enable it for debugging USB manager module */
//#define USB_GLOBAL_DEBUG

/* Enable it for debugging mass storage driver module */
//#define DRIVER_GLOBAL_DEBUG

#endif                          //__USB_DEBUG_H


text:
package org.dyno.visual.swing.layouts;

import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.LayoutManager2;
import java.awt.Rectangle;
import java.io.Serializable;
import java.util.HashMap;

import javax.swing.JComponent;
import javax.swing.SwingConstants;
/**
 *
 * GroupLayout
 *
 * @version 1.0.0, 2008-7-3
 * @author William Chen
 */
public class GroupLayout implements LayoutManager2, Serializable {
	private static final long serialVersionUID = 1L;

	private HashMap<Component, Constraints> constraints;

	public GroupLayout() {
		constraints = new HashMap<Component, Constraints>();
	}

	public Constraints getConstraints(Component comp) {
		return constraints.get(comp);
	}
	public void setConstraints(Component comp, Constraints constraint){
		constraints.put(comp, constraint);
	}

	public void addLayoutComponent(Component comp, Object con) {
		assert con != null && con instanceof Constraints;
		Constraints constraints = (Constraints) con;
		checkPreferredSize(comp, constraints);
		this.constraints.put(comp, constraints);
	}

	private void checkPreferredSize(Component comp, Constraints constraints) {
		Dimension prefs = comp.getPreferredSize();
		Alignment axis = constraints.getHorizontal();
		if (axis instanceof Leading) {
			Leading leading = (Leading) axis;
			int size = leading.getSize();
			if (size == prefs.width)
				leading.setSize(Alignment.PREFERRED);
		} else if (axis instanceof Trailing) {
			Trailing trailing = (Trailing) axis;
			int size = trailing.getSize();
			if (size == prefs.width)
				trailing.setSize(Alignment.PREFERRED);
		} else if (axis instanceof Bilateral) {
			Bilateral bilateral = (Bilateral) axis;
			int pref = bilateral.getSpring().getPreferred();
			if (pref == prefs.width)
				bilateral.getSpring().setPreferred(Alignment.PREFERRED);
		}
		axis = constraints.getVertical();
		if (axis instanceof Leading) {
			Leading leading = (Leading) axis;
			int size = leading.getSize();
			if (size == prefs.height)
				leading.setSize(Alignment.PREFERRED);
		} else if (axis instanceof Trailing) {
			Trailing trailing = (Trailing) axis;
			int size = trailing.getSize();
			if (size == prefs.height)
				trailing.setSize(Alignment.PREFERRED);
		} else if (axis instanceof Bilateral) {
			Bilateral bilateral = (Bilateral) axis;
			int pref = bilateral.getSpring().getPreferred();
			if (pref == prefs.height)
				bilateral.getSpring().setPreferred(Alignment.PREFERRED);
		}
	}

	public float getLayoutAlignmentX(Container target) {
		return 0;
	}

	public float getLayoutAlignmentY(Container target) {
		return 0;
	}

	public void invalidateLayout(Container target) {
	}

	public Dimension maximumLayoutSize(Container target) {
		return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
	}

	public void addLayoutComponent(String name, Component comp) {
	}

	public void layoutContainer(Container parent) {
		int width = parent.getWidth();
		int height = parent.getHeight();
		Dimension min = minimumLayoutSize(parent);
		if (width < min.width)
			width = min.width;
		if (height < min.height)
			height = min.height;
		int count = parent.getComponentCount();
		Insets insets = parent.getInsets();
		for (int i = 0; i < count; i++) {
			Component comp = parent.getComponent(i);
			if (comp == null)
				continue;
			Constraints cons = constraints.get(comp);
			if(cons==null)
				cons = createConstraintsFor(parent, comp);
			Alignment horizontal = cons.getHorizontal();
			Alignment vertical = cons.getVertical();
			Rectangle bounds = comp.getBounds();
			Dimension prefs = comp.getPreferredSize();
			int x = bounds.x, y = bounds.y, w = bounds.width, h = bounds.height;
			if (horizontal instanceof Leading) {
				Leading leading = (Leading) horizontal;
				x = insets.left + leading.getLeading();
				int size = leading.getSize();
				w = size == Alignment.PREFERRED ? prefs.width : size;
			} else if (horizontal instanceof Bilateral) {
				Bilateral bilateral = (Bilateral) horizontal;
				x = insets.left + bilateral.getLeading();
				w = width - x - bilateral.getTrailing() - insets.right;
			} else if (horizontal instanceof Trailing) {
				Trailing trailing = (Trailing) horizontal;
				int size = trailing.getSize();
				w = size == Alignment.PREFERRED ? prefs.width : size;
				x = width - trailing.getTrailing() - w - insets.right;
			}
			if (vertical instanceof Leading) {
				Leading leading = (Leading) vertical;
				y = insets.top + leading.getLeading();
				int size = leading.getSize();
				h = size == Alignment.PREFERRED ? prefs.height : size;
			} else if (vertical instanceof Bilateral) {
				Bilateral bilateral = (Bilateral) vertical;
				y = insets.top + bilateral.getLeading();
				h = height - y - bilateral.getTrailing() - insets.bottom;
			} else if (vertical instanceof Trailing) {
				Trailing trailing = (Trailing) vertical;
				int size = trailing.getSize();
				h = size == Alignment.PREFERRED ? prefs.height : size;
				y = height - trailing.getTrailing() - h - insets.bottom;
			}
			comp.setBounds(x, y, w, h);
		}
	}

	private Constraints createConstraintsFor(Container parent, Component comp) {
		Constraints cons;
		LayoutStyle style = LayoutStyle.getInstance();
		int gap = style.getContainerGap((JComponent)comp, SwingConstants.EAST, parent);
		Rectangle bounds = comp.getBounds();
		Spring spring = new Spring(gap, gap);
		Leading horizontal = new Leading(bounds.x, bounds.width, spring);
		gap = style.getContainerGap((JComponent)comp, SwingConstants.SOUTH, parent);
		spring = new Spring(gap, gap);
		Leading vertical = new Leading(bounds.y, bounds.height, spring);
		cons = new Constraints(horizontal, vertical);
		constraints.put(comp, cons);
		return cons;
	}

	public Dimension minimumLayoutSize(Container parent) {
		int width = 0;
		int height = 0;
		int count = parent.getComponentCount();
		Insets insets = parent.getInsets();
		for (int i = 0; i < count; i++) {
			Component comp = parent.getComponent(i);
			if (comp == null)
				continue;
			Dimension prefs = comp.getPreferredSize();
			Constraints cons = constraints.get(comp);
			if(cons==null)
				cons = createConstraintsFor(parent, comp);
			Alignment horizontal = cons.getHorizontal();
			Alignment vertical = cons.getVertical();
			if (horizontal instanceof Bilateral) {
				Bilateral bialteral = (Bilateral) horizontal;
				if (bialteral.getLeading() + bialteral.getTrailing() + bialteral.getSpring().getMinimum() + insets.left + insets.right > width)
					width = bialteral.getLeading() + bialteral.getTrailing() + bialteral.getSpring().getMinimum() + insets.left + insets.right;
			} else if (horizontal instanceof Leading) {
				Leading leading = (Leading) horizontal;
				int size = leading.getSize() == Alignment.PREFERRED ? prefs.width : leading.getSize();
				if (leading.getLeading() + size + leading.getSpring().getMinimum() + insets.left + insets.right > width)
					width = leading.getLeading() + size + leading.getSpring().getMinimum() + insets.left + insets.right;
			} else if (horizontal instanceof Trailing) {
				Trailing trailing = (Trailing) horizontal;
				int size = trailing.getSize() == Alignment.PREFERRED ? prefs.width : trailing.getSize();
				if (trailing.getTrailing() + size + trailing.getSpring().getMinimum() + insets.left + insets.right > width)
					width = trailing.getTrailing() + size + trailing.getSpring().getMinimum() + insets.left + insets.right;
			}
			if (vertical instanceof Bilateral) {
				Bilateral bilateral = (Bilateral) vertical;
				if (bilateral.getLeading() + bilateral.getTrailing() + bilateral.getSpring().getMinimum() + insets.top + insets.bottom > height)
					height = bilateral.getLeading() + bilateral.getTrailing() + bilateral.getSpring().getMinimum() + insets.top + insets.bottom;
			} else if (vertical instanceof Leading) {
				Leading leading = (Leading) vertical;
				int size = leading.getSize() == Alignment.PREFERRED ? prefs.height : leading.getSize();
				if (leading.getLeading() + size + leading.getSpring().getMinimum() + insets.top + insets.bottom > height)
					height = leading.getLeading() + size + leading.getSpring().getMinimum() + insets.top + insets.bottom;
			} else if (vertical instanceof Trailing) {
				Trailing trailing = (Trailing) vertical;
				int size = trailing.getSize() == Alignment.PREFERRED ? prefs.height : trailing.getSize();
				if (trailing.getTrailing() + size + trailing.getSpring().getMinimum() + insets.top + insets.bottom > height)
					height = trailing.getTrailing() + size + trailing.getSpring().getMinimum() + insets.top + insets.bottom;
			}
		}
		return new Dimension(width, height);
	}

	public Dimension preferredLayoutSize(Container parent) {
		int width = 0;
		int height = 0;
		int count = parent.getComponentCount();
		Insets insets = parent.getInsets();
		for (int i = 0; i < count; i++) {
			Component comp = parent.getComponent(i);
			if (comp == null)
				continue;
			Dimension prefs = comp.getPreferredSize();
			Constraints cons = constraints.get(comp);
			if(cons==null)
				cons = createConstraintsFor(parent, comp);
			Alignment horizontal = cons.getHorizontal();
			Alignment vertical = cons.getVertical();
			if (horizontal instanceof Bilateral) {
				Bilateral bilateral = (Bilateral) horizontal;
				int pref = bilateral.getSpring().getPreferred();
				pref = pref == Alignment.PREFERRED ? prefs.width : pref;
				if (bilateral.getLeading() + bilateral.getTrailing() + pref + insets.left + insets.right > width)
					width = bilateral.getLeading() + bilateral.getTrailing() + pref + insets.left + insets.right;
			} else if (horizontal instanceof Leading) {
				Leading leading = (Leading) horizontal;
				int size = leading.getSize() == Alignment.PREFERRED ? prefs.width : leading.getSize();
				if (leading.getLeading() + size + leading.getSpring().getPreferred() + insets.left + insets.right > width)
					width = leading.getLeading() + size + leading.getSpring().getPreferred() + insets.left + insets.right;
			} else if (horizontal instanceof Trailing) {
				Trailing trailing = (Trailing) horizontal;
				int size = trailing.getSize() == Alignment.PREFERRED ? prefs.width : trailing.getSize();
				if (trailing.getTrailing() + size + trailing.getSpring().getPreferred() + insets.left + insets.right > width)
					width = trailing.getTrailing() + size + trailing.getSpring().getPreferred() + insets.left + insets.right;
			}
			if (vertical instanceof Bilateral) {
				Bilateral bilateral = (Bilateral) vertical;
				int pref = bilateral.getSpring().getPreferred();
				pref = pref == Alignment.PREFERRED ? prefs.height : pref;
				if (bilateral.getLeading() + bilateral.getTrailing() + pref + insets.top + insets.bottom > height)
					height = bilateral.getLeading() + bilateral.getTrailing() + pref + insets.top + insets.bottom;
			} else if (vertical instanceof Leading) {
				Leading leading = (Leading) vertical;
				int size = leading.getSize() == Alignment.PREFERRED ? prefs.height : leading.getSize();
				if (leading.getLeading() + size + leading.getSpring().getPreferred() + insets.top + insets.bottom > height)
					height = leading.getLeading() + size + leading.getSpring().getPreferred() + insets.top + insets.bottom;
			} else if (vertical instanceof Trailing) {
				Trailing trailing = (Trailing) vertical;
				int size = trailing.getSize() == Alignment.PREFERRED ? prefs.height : trailing.getSize();
				if (trailing.getTrailing() + size + trailing.getSpring().getPreferred() + insets.top + insets.bottom > height)
					height = trailing.getTrailing() + size + trailing.getSpring().getPreferred() + insets.top + insets.bottom;
			}
		}
		return new Dimension(width, height);
	}

	public void removeLayoutComponent(Component comp) {
		constraints.remove(comp);
	}
}


text:
import requests
import webbrowser
import json
import urllib.request
import urllib.parse
import re
import time

token = "Bearer " + input("OAuth Token: ") #BQDWxOubOFzx8fjeDi9E3Npt_fd9GiGXVgdiC3tS9LWHgajM3dRe2w3DjVVtjv0ZgHZAKt6zw2cD9PEBcLf-TFxtpOnb89THvPNMH-gbAO9Ho_8eSchxzO7JdaQ1Rg6eLBmzGIPjUp-5NM9Umpk62uKuAwPw7kSB0fb_B1uYdR4YkztfMsW5_OwXJukHyN0Cp2ztHR5V4_-5oFlHuTfPmyDcKZK8yreVwFUZuYB_VMPe_4pNhmu3PwlcePsKel9irRRsw41ly0mk1FcL3XFFHHXMHBHblYEu7hSccB8sqecdVZD9-w7PdcYS"

headers = {
        'Accept': 'application/json',
        'Authorization': token}
params = {
        'country': 'BR',
        'limit': '5',
        'offset' : '1'
        }

r = requests.get('https://api.spotify.com/v1/browse/new-releases', headers=headers, params = params)
print_json = r.json()

albums_name, videos_time = [], []

for i in range(5):
    a = print_json['albums']['items'][i]['name']
    albums_name.append(a)

def youtube(s, videos_time):
    query_string = urllib.parse.urlencode({"search_query" : s})
    html_content = urllib.request.urlopen("http://www.youtube.com/results?" + query_string)
    search_results = re.findall(r'href=\"\/watch\?v=(.{11})', html_content.read().decode())
    return("http://www.youtube.com/watch?v=" + search_results[0])

    query_string1 = urllib.parse.urlencode({"search_query" : s})
    html_content1 = urllib.request.urlopen("http://www.youtube.com/results?" + query_string1)
    search_results1 = re.findall(r'\d{1}:\d{2}', html_content1.read().decode())
    videos_time.append(search_results1[0])

for i in albums_name:
    webbrowser.open(youtube(i, videos_time))
    time.sleep(int(videos_time[albums_name.index(i)][0])*60 + int(videos_time[albums_name.index(i)][2:4]))


text:
package net.geforcemods.securitycraft.compat.lycanitesmobs;

import net.geforcemods.securitycraft.api.IAttackTargetCheck;
import net.minecraft.world.entity.Entity;

public class LycanitesMobsCompat implements IAttackTargetCheck {
	@Override
	public boolean canAttack(Entity potentialTarget) {
		return false;//potentialTarget instanceof BaseCreatureEntity bce && bce.isAggressive();
	}
}


text:
    <ba-card>

          <button type="button" class="btn btn-default" (click)="refresh()"> Refresh</button>

          <button type="button" class="btn btn-primary" routerLink="./new"> New Scope</button>

          <search-panel (filterChange)="filtering($event)"></search-panel>

    </ba-card>
    <ba-card title="Scopes" baCardClass="with-scroll">

            ID
            Scope

              {{scope.id}}

              <app-tag [tags]="scope.value"></app-tag>

{{scope.description}}

                  <button type="button" class="btn btn-info" routerLink="./edit/{{scope.id}}"> Edit</button>

                  <button type="button" class="btn btn-danger" (click)="delete(scope.id)"> Delete</button>

 10">

          <ngb-pagination [collectionSize]="totalSize" [(page)]="page" [boundaryLinks]="true" (pageChange)="pageChange()"></ngb-pagination>

    </ba-card>


text:
//
//  UIView+Extension.h
//  ZQLoopScrollView
//
//  Created by 庄琦 on 16/2/18.
//  Copyright © 2016年 Seven. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface UIView (Extension)

/**
 * @brief Shortcut for frame.origin.x.
 *        Sets frame.origin.x = originX
 */
@property (nonatomic) CGFloat zq_originX;

/**
 * @brief Shortcut for frame.origin.y
 *        Sets frame.origin.y = originY
 */
@property (nonatomic) CGFloat zq_originY;

/**
 * @brief Shortcut for frame.origin.x + frame.size.width
 *       Sets frame.origin.x = rightX - frame.size.width
 */
@property (nonatomic) CGFloat zq_rightX;

/**
 * @brief Shortcut for frame.origin.y + frame.size.height
 *        Sets frame.origin.y = bottomY - frame.size.height
 */
@property (nonatomic) CGFloat zq_bottomY;

/**
 * @brief Shortcut for frame.size.width
 *        Sets frame.size.width = width
 */
@property (nonatomic) CGFloat zq_width;

/**
 * @brief Shortcut for frame.size.height
 *        Sets frame.size.height = height
 */
@property (nonatomic) CGFloat zq_height;

/**
 * @brief Shortcut for center.x
 * Sets center.x = centerX
 */
@property (nonatomic) CGFloat zq_centerX;

/**
 * @brief Shortcut for center.y
 *        Sets center.y = centerY
 */
@property (nonatomic) CGFloat zq_centerY;

/**
 * @brief Shortcut for frame.origin
 */
@property (nonatomic) CGPoint zq_origin;

/**
 * @brief Shortcut for frame.size
 */
@property (nonatomic) CGSize zq_size;

/**
 *  Get/Set the control's corneradus
 *  Default is 0.0
 */
@property (nonatomic, assign) CGFloat zq_corneradus;

/**
 *  Get/Set the control's border color
 *  Default is [UIColor lightGrayColor]
 */
@property (nonatomic, strong) UIColor *zq_borderColor;

/**
 *  Get/Set the control's border width
 *  Default is 0.0
 */
@property (nonatomic, assign) CGFloat zq_borderWidth;

@end


text:
var express = require('express');
var router = express.Router();

router.post('/new', function(req, res) {
  var data_collection = req.app.locals.data_collection;
  data_collection.insertOne(
      {"original_url": req.body.original_url, "id": req.body.id},
      function(err, result) {
        if (!err) {
          res.send(req.body.id);
        }
        else {
          console.error('Adding the new URL to the database was unsuccessful');
          res.status(500);
        }
      }
  );
});

router.post('/update', function(req, res) {
  var data_collection = req.app.locals.data_collection;
  data_collection.updateOne(
      {"original_url": req.body.url},
      { "$set": {"id": req.body.id}},
      function(err, result) {
        if (!err) {
          res.send(req.body.id);
        }
        else {
          console.error('Adding the new URL to the database was unsuccessful');
          res.status(500);
        }
      }
  );
});

router.post('/redirect/:id', function(req, res) {
  var data_collection = req.app.locals.data_collection;
  console.log(req);
  console.log(req.body);
  console.log(req.params.id);

  data_collection.findAndModify(
      { id: req.params.id },     // query
      [],               // represents a sort order if multiple matches
      { $push: {"data": req.body} },   // update statement
      { new: true },    // options - new to return the modified document
      function(err,doc) {
        // doc.value includes the object that has been modified.
        console.log(doc.value);
        res.send(doc.value.original_url);
      }
  );
});

router.get('/manage/:id', function(req, res) {
  var data_collection = req.app.locals.data_collection;

  data_collection.find({id: req.params.id}).toArray(function(err, data) {
    if (err) {
      console.log(err);
      res.sendStatus(500);
    }
    else {
      res.send(data[0]);
    }
  })
});

module.exports = router;


text:
#include <dev/driver.h>
#include <assert.h>
#include <err.h>

extern struct device __devices[];
extern struct device __devices_end[];

status_t device_init_all(void)
{
	status_t res = NO_ERROR;

	struct device *dev = __devices;
	while (dev != __devices_end) {
		status_t code = device_init(dev);

		if (code < 0) {
			TRACEF("Driver init failed for driver \"%s\", device \"%s\", reason %d\n",
					dev->driver->type, dev->name, code);

			res = code;
		}

		dev++;
	}

	return res;
}

status_t device_fini_all(void)
{
	status_t res = NO_ERROR;

	struct device *dev = __devices;
	while (dev != __devices_end) {
		status_t code = device_fini(dev);

		if (code < 0) {
			TRACEF("Driver fini failed for driver \"%s\", device \"%s\", reason %d\n",
					dev->driver->type, dev->name, code);

			res = code;
		}

		dev++;
	}

	return res;
}

status_t device_init(struct device *dev)
{
	if (!dev)
		return ERR_INVALID_ARGS;

	DEBUG_ASSERT(dev->driver);

	const struct driver_ops *ops = dev->driver->ops;

	if (ops && ops->init)
		return ops->init(dev);
	else
		return ERR_NOT_SUPPORTED;
}

status_t device_fini(struct device *dev)
{
	if (!dev)
		return ERR_INVALID_ARGS;

	DEBUG_ASSERT(dev->driver);

	const struct driver_ops *ops = dev->driver->ops;

	if (ops && ops->fini)
		return ops->fini(dev);
	else
		return ERR_NOT_SUPPORTED;
}

status_t device_suspend(struct device *dev)
{
	if (!dev)
		return ERR_NOT_SUPPORTED;

	DEBUG_ASSERT(dev->driver);

	const struct driver_ops *ops = dev->driver->ops;

	if (ops && ops->suspend)
		return ops->suspend(dev);
	else
		return ERR_NOT_SUPPORTED;
}

status_t device_resume(struct device *dev)
{
	if (!dev)
		return ERR_NOT_SUPPORTED;

	DEBUG_ASSERT(dev->driver);

	const struct driver_ops *ops = dev->driver->ops;

	if (ops && ops->resume)
		return ops->resume(dev);
	else
		return ERR_NOT_SUPPORTED;
}


text:
// ****************************************************************************
// <copyright file="AssemblyInfo.cs" company="GalaSoft Laurent Bugnion">
// Copyright © GalaSoft Laurent Bugnion 2009-2011
// </copyright>
// ****************************************************************************
// <author>Laurent Bugnion</author>
// <email>laurent@galasoft.ch</email>
// <date>15.5.2011</date>
// <project>GalaSoft.MvvmLight.Extras</project>
// <web>http://www.galasoft.ch</web>
// <license>
// See license.txt in this project or http://www.galasoft.ch/license_MIT.txt
// </license>
// ****************************************************************************

using System;
using System.Runtime.InteropServices;
using System.Security;

[assembly: Guid("c74a8287-34b3-421a-9980-89d7f46659b4")]


text:
CoreOS is currently in heavy development and actively being tested.  These instructions will walk you through running CoreOS on the Rackspace OpenStack cloud, which differs slightly from the generic OpenStack instructions. There are two ways to launch a CoreOS cluster: launch an entire cluster with Heat or launch machines with Nova.

## Choosing a Channel

CoreOS is designed to be [updated automatically]({{site.baseurl}}/using-coreos/updates) with different schedules per channel. You can [disable this feature]({{site.baseurl}}/docs/cluster-management/debugging/prevent-reboot-after-update), although we don't recommend it. Read the [release notes]({{site.baseurl}}/releases) for specific features and bug fixes.

Stable Channel

Beta Channel

Alpha Channel

The alpha channel closely tracks master and is released to frequently. The newest versions of docker, etcd and fleet will be available for testing.
        {% if site.data.alpha-channel.rackspace-version != site.data.alpha-channel.rackspace-onmetal-version %}
          Current version for Cloud Servers is CoreOS {{site.data.alpha-channel.rackspace-version}} and the current version for OnMetal servers is {{site.data.alpha-channel.rackspace-onmetal-version}}.
        {% elsif site.data.alpha-channel.rackspace-version == site.data.alpha-channel.rackspace-onmetal-version %}
          Current version is CoreOS {{site.data.alpha-channel.rackspace-version}}.
        {% endif %}

            Server Type
            Image ID
            Heat Template

            Cloud Servers
            {{site.data.alpha-channel.rackspace-image-id}}
            heat-alpha.yaml

            OnMetal
            {{site.data.alpha-channel.rackspace-onmetal-id}}
            heat-onmetal-alpha.yaml

The beta channel consists of promoted alpha releases.
        {% if site.data.beta-channel.rackspace-version != site.data.beta-channel.rackspace-onmetal-version %}
          Current version for Cloud Servers is CoreOS {{site.data.beta-channel.rackspace-version}} and the current version for OnMetal servers is {{site.data.beta-channel.rackspace-onmetal-version}}.
        {% elsif site.data.beta-channel.rackspace-version == site.data.beta-channel.rackspace-onmetal-version %}
          Current version is CoreOS {{site.data.beta-channel.rackspace-version}}.
        {% endif %}

            Server Type
            Image ID
            Heat Template

            Cloud Server
            {{site.data.beta-channel.rackspace-image-id}}
            heat-beta.yaml

            OnMetal
            {{site.data.beta-channel.rackspace-onmetal-id}}
            heat-onmetal-beta.yaml

The Stable channel should be used by production clusters. Versions of CoreOS are battle-tested within the Beta and Alpha channels before being promoted.
        {% if site.data.stable-channel.rackspace-version != site.data.stable-channel.rackspace-onmetal-version %}
          Current version for Cloud Servers is CoreOS {{site.data.stable-channel.rackspace-version}} and the current version for OnMetal servers is {{site.data.stable-channel.rackspace-onmetal-version}}.
        {% elsif site.data.stable-channel.rackspace-version == site.data.stable-channel.rackspace-onmetal-version %}
          Current version is CoreOS {{site.data.stable-channel.rackspace-version}}.
        {% endif %}

            Server Type
            Image ID
            Heat Template

            Cloud Server
            {{site.data.stable-channel.rackspace-image-id}}
            heat-stable.yaml

            OnMetal
            {{site.data.stable-channel.rackspace-onmetal-id}}
            heat-onmetal-stable.yaml

## Cloud-Config

CoreOS allows you to configure machine parameters, launch systemd units on startup and more via cloud-config. Jump over to the [docs to learn about the supported features][cloud-config-docs]. Cloud-config is intended to bring up a cluster of machines into a minimal useful state and ideally shouldn't be used to configure anything that isn't standard across many hosts. Once a machine is created on Rackspace, the cloud-config can't be modified.

You can provide cloud-config data via both Heat and Nova APIs. You **cannot** provide cloud-config via the Control Panel. If you launch machines via the UI, you will have to do all configuration manually.

The most common Rackspace cloud-config looks like:

```yaml
#cloud-config

coreos:
  etcd2:
    # generate a new token for each unique cluster from https://discovery.etcd.io/new?size=3
    # specify the initial size of your cluster with ?size=X
    discovery: https://discovery.etcd.io/<token>
    # multi-region and multi-cloud deployments need to use $public_ipv4
    advertise-client-urls: http://$private_ipv4:2379,http://$private_ipv4:4001
    initial-advertise-peer-urls: http://$private_ipv4:2380
    # listen on both the official ports and the legacy ports
    # legacy ports can be omitted if your application doesn't depend on them
    listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
    listen-peer-urls: http://$private_ipv4:2380
  units:
    - name: etcd2.service
      command: start
    - name: fleet.service
      command: start
```

The `$private_ipv4` and `$public_ipv4` substitution variables are fully supported in cloud-config on Rackspace.

[cloud-config-docs]: {{site.baseurl}}/docs/cluster-management/setup/cloudinit-cloud-config

### Mount Data Disk

Certain server flavors have separate system and data disks. To utilize the data disks, they must be mounted with a `.mount` unit. Check to make sure the `Where=` parameter accurately reflects the location of the block device:

```yaml
#cloud-config
coreos:
  units:
    - name: media-data.mount
      command: start
      content: |
        [Mount]
        What=/dev/xvde
        Where=/media/data
        Type=ext3
```

Mounting Cloud Block Storage can be done with a mount unit, but should not be included in cloud-config unless the disk is present on the first boot.

For more general information, check out [mounting storage on CoreOS]({{site.baseurl}}/docs/cluster-management/setup/mounting-storage).

## Launch with Nova

We're going to install `rackspace-novaclient`, upload a keypair and boot the image id from above.

### Install Supernova Tool

The Supernova tool requires Python and `pip`, a Python package manger. If you don't have `pip` installed, install it by running `sudo easy_install pip`. Now let's use `pip` to install Supernova, a tool that lets you easily switch Rackspace regions. Be sure to install these in the order listed:

```sh
sudo pip install keyring
sudo pip install rackspace-novaclient
sudo pip install supernova
```

### Store Account Information

Edit your config file (`~/.supernova`) to store your Rackspace username, API key (referenced as `OS_PASSWORD`) and some other settings. The `OS_TENANT_NAME` should be set to your Rackspace account ID, which can be found by clicking on your Rackspace username in the upper right-hand corner of the cloud control panel UI.

```ini
[production]
OS_AUTH_URL = https://identity.api.rackspacecloud.com/v2.0/
OS_USERNAME = username
OS_PASSWORD = fd62afe2-4686-469f-9849-ceaa792c55a6
OS_TENANT_NAME = 123456
OS_REGION_NAME = DFW
OS_AUTH_SYSTEM = rackspace
```

We're ready to create a keypair then boot a server with it.

### Create Keypair

For this guide, I'm assuming you already have a public key you use for your CoreOS servers. Note that only RSA keypairs are supported. Load the public key to Rackspace:

```sh
supernova production keypair-add --pub-key ~/.ssh/coreos.pub coreos-key
```

Check you make sure the key is in your list by running `supernova production keypair-list`

```
+------------+-------------------------------------------------+
| Name       | Fingerprint                                     |
+------------+-------------------------------------------------+
| coreos-key | d0:6b:d8:3a:3e:6a:52:43:32:bc:01:ea:c2:0f:49:59 |
+------------+-------------------------------------------------+
```

### Boot a Server

Stable Channel

Beta Channel

Alpha Channel

Boot a new Cloud Server with our new keypair and specify optional cloud-config data:

supernova production boot --image {{site.data.alpha-channel.rackspace-image-id}} --flavor performance1-2 --key-name coreos-key --user-data ~/cloud_config.yml --config-drive true My_CoreOS_Server

Boot a new OnMetal Server with our new keypair and specify optional cloud-config data:

supernova production boot --image {{site.data.alpha-channel.rackspace-onmetal-id}} --flavor onmetal-compute1 --key-name coreos-key --user-data ~/cloud_config.yml --config-drive true My_CoreOS_Server

Boot a new Cloud Server with our new keypair and specify optional cloud-config data:

supernova production boot --image {{site.data.beta-channel.rackspace-image-id}} --flavor performance1-2 --key-name coreos-key --user-data ~/cloud_config.yml --config-drive true My_CoreOS_Server

Boot a new Cloud Server with our new keypair and specify optional cloud-config data:

supernova production boot --image {{site.data.stable-channel.rackspace-image-id}} --flavor performance1-2 --key-name coreos-key --user-data ~/cloud_config.yml --config-drive true My_CoreOS_Server

You should now see the details of your new server in your terminal and it should also show up in the control panel:

```
+------------------------+--------------------------------------+
| Property               | Value                                |
+------------------------+--------------------------------------+
| status                 | BUILD                                |
| updated                | 2013-11-02T19:43:45Z                 |
| hostId                 |                                      |
| key_name               | coreos-key                           |
| image                  | CoreOS                               |
| OS-EXT-STS:task_state  | scheduling                           |
| OS-EXT-STS:vm_state    | building                             |
| flavor                 | 512MB Standard Instance              |
| id                     | 82dbe66d-0762-4cba-a286-8c1af8431e47 |
| user_id                | 3c55bca772ba4a4bb6a4eb5b25754738     |
| name                   | My_CoreOS_Server                     |
| adminPass              | mgNqEx7I9pQA                         |
| tenant_id              | 833111                               |
| created                | 2013-11-02T19:43:44Z                 |
| OS-DCF:diskConfig      | MANUAL                               |
| accessIPv4             |                                      |
| accessIPv6             |                                      |
| progress               | 0                                    |
| OS-EXT-STS:power_state | 0                                    |
| metadata               | {}                                   |
+------------------------+--------------------------------------+
```

### Launching More Servers

To launch more servers and have them join your cluster, simply provide the same cloud-config.

## Launch with Heat

We're going to install the `heat` tool, then use it to create a new stack with the specified number of machines, server flavor, SSH key and user-data.

### Install Heat CLI

First, install the [Heat CLI](https://github.com/openstack/python-heatclient) with `sudo pip install python-heatclient`. You can view the [full instructions](http://docs.rackspace.com/orchestration/api/v1/orchestration-getting-started/content/Install_Heat_Client.html) if needed.

Second, verify that you're exporting your credentials for the CLI to use in your `~/bash_profile`:

```sh
export OS_AUTH_URL=https://identity.api.rackspacecloud.com/v2.0/
export OS_USERNAME=<username>
export OS_TENANT_ID=<tenant_id>
export HEAT_URL=https://ord.orchestration.api.rackspacecloud.com/v1/${OS_TENANT_ID}
export OS_PASSWORD=<password>
export OS_AUTH_SYSTEM=rackspace
```

If you have credentials already set up for use with the Nova CLI, they may conflict due to oddities in these tools. Re-source your credentials:

```sh
source ~/.bash_profile
```

### Launch the Stack

Stable Channel

Beta Channel

Alpha Channel

Launch the stack by providing the specified parameters. This command will reference the local file data.yml in the current working directory that contains the cloud-config parameters. $(< data.yaml) prints the contents of this file into our heat command:

heat stack-create Test --template-file https://coreos.com/dist/rackspace/heat-alpha.yaml -P key-name=coreos-key -P flavor='2 GB Performance' -P count=5 -P user-data="$(< data.yaml)" -P name="CoreOS-alpha"

You can view the template here.

To boot an OnMetal cluster, use a slightly modified template:

heat stack-create Test --template-file https://coreos.com/dist/rackspace/heat-onmetal-alpha.yaml -P key-name=coreos-key -P flavor='2 GB Performance' -P count=3 -P user-data="$(< data.yaml)" -P name="CoreOS-alpha"

You can view the template here.

Launch the stack by providing the specified parameters. This command will reference the local file data.yml in the current working directory that contains the cloud-config parameters. $(< data.yaml) prints the contents of this file into our heat command:

heat stack-create Test --template-file https://coreos.com/dist/rackspace/heat-beta.yaml -P key-name=coreos-key -P flavor='2 GB Performance' -P count=5 -P user-data="$(< data.yaml)" -P name="CoreOS-beta"

You can view the template here.

Launch the stack by providing the specified parameters. This command will reference the local file data.yml in the current working directory that contains the cloud-config parameters. $(< data.yaml) prints the contents of this file into our heat command:

heat stack-create Test --template-file https://coreos.com/dist/rackspace/heat-stable.yaml -P key-name=coreos-key -P flavor='2 GB Performance' -P count=5 -P user-data="$(< data.yaml)" -P name="CoreOS-stable"

You can view the template here.

## Launch via Control Panel

You can also launch servers with either the `alpha` and `beta` channel versions via the web-based Control Panel, although you can't provide cloud-config via the UI. To do so:

 1. Log into your Rackspace Control Panel
 2. Click on 'Servers'
 3. Click on 'Create Server'
 4. Choose server name and region
 5. Click on 'Linux', then on 'CoreOS' and finally choose '(alpha)' or '(beta)' version
 ![Control Panel Selection](http://57711b76b91f5d65a382-e5576ae0d6cf44f41aa69b4e6e0902ca.r62.cf1.rackcdn.com/Screen%20Shot%202014-06-30%20at%209.54.43%20AM.png)
 6. Choose flavor and use 'Advanced Options' to select SSH Key -- if available
 7. Click on 'Create Server'

## Using CoreOS

Now that you have a machine booted it is time to play around.
Check out the [CoreOS Quickstart]({{site.baseurl}}/docs/quickstart) guide or dig into [more specific topics]({{site.baseurl}}/docs).


text:
class Wireshark < Formula
  desc "Graphical network analyzer and capture tool"
  homepage "https://www.wireshark.org"
  url "https://www.wireshark.org/download/src/all-versions/wireshark-2.4.5.tar.xz"
  mirror "https://1.eu.dl.wireshark.org/src/wireshark-2.4.5.tar.xz"
  sha256 "b3b2ec29fba0f4a3a590438abe4054e56f19108d440fc2d61492db9d8ff16fd7"
  head "https://code.wireshark.org/review/wireshark", :using => :git

  bottle do
    sha256 "ca1e31fd7fb531c14964f26025b590fab0da494d6a9e1edf4cd8802a22fc78f0" => :high_sierra
    sha256 "88d2140282819858d64da7439a632ffa4d6657625d0b029690114fe05915899e" => :sierra
    sha256 "472614e31560886bc1adcca76767a7876d9fda034f6912abe8fb30681994e051" => :el_capitan
  end

  deprecated_option "with-qt5" => "with-qt"

  option "with-gtk+3", "Build the wireshark command with gtk+3"
  option "with-gtk+", "Build the wireshark command with gtk+"
  option "with-qt", "Build the wireshark command with Qt (can be used with or without either GTK option)"
  option "with-headers", "Install Wireshark library headers for plug-in development"
  option "with-nghttp2", "Enable HTTP/2 header dissection"

  depends_on "cmake" => :build
  depends_on "c-ares"
  depends_on "geoip"
  depends_on "glib"
  depends_on "gnutls"
  depends_on "libgcrypt"
  depends_on "lua"
  depends_on "libsmi" => :optional
  depends_on "libssh" => :optional
  depends_on "nghttp2" => :optional
  depends_on "portaudio" => :optional
  depends_on "qt" => :optional
  depends_on "gtk+3" => :optional
  depends_on "gtk+" => :optional
  depends_on "adwaita-icon-theme" if build.with? "gtk+3"

  def install
    args = std_cmake_args + %w[
      -DENABLE_CARES=ON
      -DENABLE_GEOIP=ON
      -DENABLE_GNUTLS=ON
      -DENABLE_LUA=ON
    ]

    if build.with? "qt"
      args << "-DBUILD_wireshark=ON"
      args << "-DENABLE_APPLICATION_BUNDLE=ON"
      args << "-DENABLE_QT5=ON"
    else
      args << "-DBUILD_wireshark=OFF"
      args << "-DENABLE_APPLICATION_BUNDLE=OFF"
      args << "-DENABLE_QT5=OFF"
    end

    if build.with?("gtk+3") || build.with?("gtk+")
      args << "-DBUILD_wireshark_gtk=ON"
      args << "-DENABLE_GTK3=" + (build.with?("gtk+3") ? "ON" : "OFF")
      args << "-DENABLE_PORTAUDIO=ON" if build.with? "portaudio"
    else
      args << "-DBUILD_wireshark_gtk=OFF"
      args << "-DENABLE_PORTAUDIO=OFF"
    end

    if build.with? "libsmi"
      args << "-DENABLE_SMI=ON"
    else
      args << "-DENABLE_SMI=OFF"
    end

    if build.with? "libssh"
      args << "-DBUILD_sshdump=ON" << "-DBUILD_ciscodump=ON"
    else
      args << "-DBUILD_sshdump=OFF" << "-DBUILD_ciscodump=OFF"
    end

    if build.with? "nghttp2"
      args << "-DENABLE_NGHTTP2=ON"
    else
      args << "-DENABLE_NGHTTP2=OFF"
    end

    system "cmake", *args
    system "make", "install"

    if build.with? "qt"
      prefix.install bin/"Wireshark.app"
      bin.install_symlink prefix/"Wireshark.app/Contents/MacOS/Wireshark" => "wireshark"
    end

    if build.with? "headers"
      (include/"wireshark").install Dir["*.h"]
      (include/"wireshark/epan").install Dir["epan/*.h"]
      (include/"wireshark/epan/crypt").install Dir["epan/crypt/*.h"]
      (include/"wireshark/epan/dfilter").install Dir["epan/dfilter/*.h"]
      (include/"wireshark/epan/dissectors").install Dir["epan/dissectors/*.h"]
      (include/"wireshark/epan/ftypes").install Dir["epan/ftypes/*.h"]
      (include/"wireshark/epan/wmem").install Dir["epan/wmem/*.h"]
      (include/"wireshark/wiretap").install Dir["wiretap/*.h"]
      (include/"wireshark/wsutil").install Dir["wsutil/*.h"]
    end
  end

  def caveats; <<~EOS
    This formula only installs the command-line utilities by default.

    Wireshark.app can be downloaded directly from the website:
      https://www.wireshark.org/

    Alternatively, install with Homebrew-Cask:
      brew cask install wireshark

    If your list of available capture interfaces is empty
    (default macOS behavior), install ChmodBPF:

      brew cask install wireshark-chmodbpf
    EOS
  end

  test do
    system bin/"randpkt", "-b", "100", "-c", "2", "capture.pcap"
    output = shell_output("#{bin}/capinfos -Tmc capture.pcap")
    assert_equal "File name,Number of packets\ncapture.pcap,2\n", output
  end
end


text:
.class Lcom/android/server/InputMethodManagerService$5;
.super Ljava/lang/Object;
.source "InputMethodManagerService.java"

# interfaces
.implements Landroid/content/DialogInterface$OnCancelListener;

# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/android/server/InputMethodManagerService;->showInputMethodMenuInternal(Z)V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field final synthetic this$0:Lcom/android/server/InputMethodManagerService;

# direct methods
.method constructor <init>(Lcom/android/server/InputMethodManagerService;)V
    .locals 0

    .prologue
    .line 2887
    iput-object p1, p0, Lcom/android/server/InputMethodManagerService$5;->this$0:Lcom/android/server/InputMethodManagerService;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

# virtual methods
.method public onCancel(Landroid/content/DialogInterface;)V
    .locals 1
    .param p1, "dialog"    # Landroid/content/DialogInterface;

    .prologue
    .line 2890
    iget-object v0, p0, Lcom/android/server/InputMethodManagerService$5;->this$0:Lcom/android/server/InputMethodManagerService;

    invoke-virtual {v0}, Lcom/android/server/InputMethodManagerService;->hideInputMethodMenu()V

    .line 2891
    return-void
.end method


text:
using AutoFixture;
using AutoFixture.Kernel;
using AutoFixtureUnitTest.Kernel;
using Xunit;

namespace AutoFixtureUnitTest
{
    public class UriSchemeGeneratorTest
    {
        [Fact]
        public void SutIsSpecimenBuilder()
        {
            // Arrange
            // Act
            var sut = new UriSchemeGenerator();
            // Assert
            Assert.IsAssignableFrom<ISpecimenBuilder>(sut);
        }

        [Fact]
        public void CreateWithNullRequestReturnsCorrectResult()
        {
            // Arrange
            var sut = new UriSchemeGenerator();
            // Act
            var dummyContext = new DelegatingSpecimenContext();
            var result = sut.Create(null, dummyContext);
            // Assert
            Assert.Equal(new NoSpecimen(), result);
        }

        [Fact]
        public void CreateWithNullContextDoesNotThrow()
        {
            // Arrange
            var sut = new UriSchemeGenerator();
            var dummyRequest = new object();
            // Act & assert
            Assert.Null(Record.Exception(() => sut.Create(dummyRequest, null)));
        }

        [Fact]
        public void CreateWithNonUriSchemeRequestReturnsCorrectResult()
        {
            // Arrange
            var sut = new UriSchemeGenerator();
            var dummyRequest = new object();
            // Act
            var dummyContext = new DelegatingSpecimenContext();
            var result = sut.Create(dummyRequest, dummyContext);
            // Assert
            var expectedResult = new NoSpecimen();
            Assert.Equal(expectedResult, result);
        }

        [Fact]
        public void CreateWithUriSchemeRequestReturnsCorrectResult()
        {
            // Arrange
            var sut = new UriSchemeGenerator();
            var request = typeof(UriScheme);
            // Act
            var dummyContext = new DelegatingSpecimenContext();
            var result = sut.Create(request, dummyContext);
            // Assert
            var expectedResult = new UriScheme();
            Assert.Equal(expectedResult, result);
        }
    }
}


text:
/*
 * Copyright 2001-2004 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 * $Id: RelativePathPattern.java,v 1.2.4.1 2005/09/02 12:09:38 pvedula Exp $
 */

package com.sun.org.apache.xalan.internal.xsltc.compiler;

/**
 * @author Jacek Ambroziak
 * @author Santiago Pericas-Geertsen
 */
abstract class RelativePathPattern extends LocationPathPattern {}


text:
Get Zulip notifications from your Flock channels.

1. {!create-stream.md!}

1. {!create-bot-construct-url.md!}

1. Click on **Apps** in the bottom-right corner.
   Click on **Admin Panel**, and click on **Webhooks**.
   Next to **Outgoing Webhook**, click on **Add**.

1. Set **Send messages from a channel** to the channel you'd like to be notified about.
   Set **Name that the webhook will post as** to a name of your choice, such as `Zulip`.
   Set **Callback URL** to the URL created above, and click **Save Settings**.

{!congrats.md!}

![](/static/images/integrations/flock/001.png)


text:
/**
 * @fileoverview Tests for no-restricted-modules.
 * @author Christian Schulz
 */

"use strict";

//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------

const rule = require("../../../lib/rules/no-restricted-modules"),
    { RuleTester } = require("../../../lib/rule-tester");

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

const ruleTester = new RuleTester();

ruleTester.run("no-restricted-modules", rule, {
    valid: [
        { code: "require(\"fs\")", options: ["crypto"] },
        { code: "require(\"path\")", options: ["crypto", "stream", "os"] },
        "require(\"fs \")",
        { code: "require(2)", options: ["crypto"] },
        { code: "require(foo)", options: ["crypto"] },
        { code: "var foo = bar('crypto');", options: ["crypto"] },
        { code: "require(\"foo/bar\");", options: ["foo"] },
        { code: "var withPaths = require(\"foo/bar\");", options: [{ paths: ["foo", "bar"] }] },
        { code: "var withPatterns = require(\"foo/bar\");", options: [{ patterns: ["foo/c*"] }] },
        { code: "var withPatternsAndPaths = require(\"foo/bar\");", options: [{ paths: ["foo"], patterns: ["foo/c*"] }] },
        { code: "var withGitignores = require(\"foo/bar\");", options: [{ paths: ["foo"], patterns: ["foo/*", "!foo/bar"] }] }
    ],
    invalid: [{
        code: "require(\"fs\")",
        options: ["fs"],
        errors: [{ message: "'fs' module is restricted from being used.", type: "CallExpression" }]
    }, {
        code: "require(\"os \")",
        options: ["fs", "crypto ", "stream", "os"],
        errors: [{ message: "'os' module is restricted from being used.", type: "CallExpression" }]
    }, {
        code: "require(\"foo/bar\");",
        options: ["foo/bar"],
        errors: [{ message: "'foo/bar' module is restricted from being used.", type: "CallExpression" }]
    }, {
        code: "var withPaths = require(\"foo/bar\");",
        options: [{ paths: ["foo/bar"] }],
        errors: [{ message: "'foo/bar' module is restricted from being used.", type: "CallExpression" }]
    }, {
        code: "var withPatterns = require(\"foo/bar\");",
        options: [{ patterns: ["foo/*"] }],
        errors: [{ message: "'foo/bar' module is restricted from being used by a pattern.", type: "CallExpression" }]
    }, {
        code: "var withPatternsAndPaths = require(\"foo/bar\");",
        options: [{ patterns: ["foo/*"], paths: ["foo"] }],
        errors: [{ message: "'foo/bar' module is restricted from being used by a pattern.", type: "CallExpression" }]
    }, {
        code: "var withGitignores = require(\"foo/bar\");",
        options: [{ patterns: ["foo/*", "!foo/baz"], paths: ["foo"] }],
        errors: [{ message: "'foo/bar' module is restricted from being used by a pattern.", type: "CallExpression" }]
    }, {
        code: "var withGitignores = require(\"foo\");",
        options: [{
            name: "foo",
            message: "Please use 'bar' module instead."
        }],
        errors: [{
            message: "'foo' module is restricted from being used. Please use 'bar' module instead.",
            type: "CallExpression"
        }]
    }, {
        code: "var withGitignores = require(\"bar\");",
        options: [
            "foo",
            {
                name: "bar",
                message: "Please use 'baz' module instead."
            },
            "baz"
        ],
        errors: [{
            message: "'bar' module is restricted from being used. Please use 'baz' module instead.",
            type: "CallExpression"
        }]
    }, {
        code: "var withGitignores = require(\"foo\");",
        options: [{
            paths: [{
                name: "foo",
                message: "Please use 'bar' module instead."
            }]
        }],
        errors: [{
            message: "'foo' module is restricted from being used. Please use 'bar' module instead.",
            type: "CallExpression"
        }]
    }]
});