text:
package org.nd4j.jdbc.loader.impl;

import com.mchange.v2.c3p0.ComboPooledDataSource;
import org.nd4j.jdbc.driverfinder.DriverFinder;
import org.nd4j.jdbc.loader.api.JDBCNDArrayIO;
import org.nd4j.linalg.api.complex.IComplexNDArray;
import org.nd4j.linalg.api.ndarray.INDArray;
import org.nd4j.linalg.factory.Nd4j;

import javax.sql.DataSource;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.sql.*;

/**
 * Base class for loading ndarrays via org.nd4j.jdbc
 *
 * @author Adam Gibson
 */

public abstract class BaseLoader implements JDBCNDArrayIO {

    protected String tableName, columnName, idColumnName, jdbcUrl;
    protected DataSource dataSource;

    protected BaseLoader(DataSource dataSource, String jdbcUrl, String tableName, String idColumnName,
                    String columnName) throws Exception {
        this.dataSource = dataSource;
        this.jdbcUrl = jdbcUrl;
        this.tableName = tableName;
        this.columnName = columnName;
        this.idColumnName = idColumnName;
        if (dataSource == null) {
            dataSource = new ComboPooledDataSource();
            ComboPooledDataSource c = (ComboPooledDataSource) dataSource;
            c.setJdbcUrl(jdbcUrl);
            c.setDriverClass(DriverFinder.getDriver().getClass().getName());

        }
    }

    protected BaseLoader(String jdbcUrl, String tableName, String idColumnName, String columnName) throws Exception {
        this.jdbcUrl = jdbcUrl;
        this.tableName = tableName;
        this.columnName = columnName;
        dataSource = new ComboPooledDataSource();
        ComboPooledDataSource c = (ComboPooledDataSource) dataSource;
        c.setJdbcUrl(jdbcUrl);
        c.setDriverClass(DriverFinder.getDriver().getClass().getName());
        this.idColumnName = idColumnName;

    }

    protected BaseLoader(DataSource dataSource, String jdbcUrl, String tableName, String columnName) throws Exception {
        this(dataSource, jdbcUrl, tableName, "id", columnName);

    }

    /**
     * Convert an ndarray to a blob
     *
     * @param toConvert the complex ndarray to convert
     * @return the converted complex ndarray
     */
    @Override
    public Blob convert(IComplexNDArray toConvert) throws IOException, SQLException {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        DataOutputStream dos = new DataOutputStream(bos);

        Nd4j.writeComplex(toConvert, dos);

        byte[] bytes = bos.toByteArray();
        Connection c = dataSource.getConnection();
        Blob b = c.createBlob();
        b.setBytes(1, bytes);
        c.close();
        return b;
    }

    /**
     * Convert an ndarray to a blob
     *
     * @param toConvert the ndarray to convert
     * @return the converted ndarray
     */
    @Override
    public Blob convert(INDArray toConvert) throws SQLException, IOException {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        DataOutputStream dos = new DataOutputStream(bos);

        Nd4j.write(toConvert, dos);

        byte[] bytes = bos.toByteArray();
        Connection c = dataSource.getConnection();
        Blob b = c.createBlob();
        b.setBytes(1, bytes);
        c.close();
        return b;
    }

    /**
     * Load an ndarray from a blob
     *
     * @param blob the blob to load from
     * @return the loaded ndarray
     */
    @Override
    public INDArray load(Blob blob) throws SQLException, IOException {
        if (blob == null)
            return null;
        DataInputStream dis = new DataInputStream(blob.getBinaryStream());
        return Nd4j.read(dis);
    }

    /**
     * Load a complex ndarray from a blob
     *
     * @param blob the blob to load from
     * @return the complex ndarray
     */
    @Override
    public IComplexNDArray loadComplex(Blob blob) throws SQLException, IOException {
        DataInputStream dis = new DataInputStream(blob.getBinaryStream());
        return Nd4j.readComplex(dis);
    }

    /**
     * Save the ndarray
     *
     * @param save the ndarray to save
     */
    @Override
    public void save(INDArray save, String id) throws SQLException, IOException {
        doSave(save, id);

    }

    /**
     * Save the ndarray
     *
     * @param save the ndarray to save
     */
    @Override
    public void save(IComplexNDArray save, String id) throws IOException, SQLException {
        doSave(save, id);
    }

    private void doSave(INDArray save, String id) throws SQLException, IOException {
        Connection c = dataSource.getConnection();
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        DataOutputStream dos = new DataOutputStream(bos);
        if (save instanceof IComplexNDArray) {
            IComplexNDArray c2 = (IComplexNDArray) save;
            Nd4j.writeComplex(c2, dos);
        } else
            Nd4j.write(save, dos);

        byte[] bytes = bos.toByteArray();

        PreparedStatement preparedStatement = c.prepareStatement(insertStatement());
        preparedStatement.setString(1, id);
        preparedStatement.setBytes(2, bytes);
        preparedStatement.executeUpdate();
        preparedStatement.close();
        c.close();

    }

    /**
     * Load an ndarray blob given an id
     *
     * @param id the id to load
     * @return the blob
     */
    @Override
    public Blob loadForID(String id) throws SQLException {
        Connection c = dataSource.getConnection();
        PreparedStatement preparedStatement = c.prepareStatement(loadStatement());
        preparedStatement.setString(1, id);
        ResultSet r = preparedStatement.executeQuery();
        if (r.wasNull() || !r.next()) {
            c.close();
            r.close();
            preparedStatement.close();

            return null;
        } else {
            Blob first = r.getBlob(2);
            c.close();
            r.close();
            preparedStatement.close();
            return first;
        }

    }

    /**
     * Delete the given ndarray
     *
     * @param id the id of the ndarray to delete
     */
    @Override
    public void delete(String id) throws SQLException {
        Connection c = dataSource.getConnection();
        PreparedStatement p = c.prepareStatement(deleteStatement());
        p.setString(1, id);
        p.execute();
        p.close();

    }
}


text:
There is a newer version over here (with fewer features but does the job) https://github.com/revolting/bbs

[![Build Status](https://travis-ci.org/bigboringsystem/bigboringsystem.svg)](https://travis-ci.org/bigboringsystem/bigboringsystem) [![Dependency Status](https://david-dm.org/bigboringsystem/bigboringsystem.svg)](https://david-dm.org/bigboringsystem/bigboringsystem)  [![devDependency Status](https://david-dm.org/bigboringsystem/bigboringsystem/dev-status.svg)](https://david-dm.org/bigboringsystem/bigboringsystem#info=devDependencies)

## Feel like contributing?

Please review https://github.com/bigboringsystem/bigboringsystem/blob/master/CONTRIBUTING.md

## Setup

After cloning the repo, install dependencies and copy the local configuration file:

    npm install
    cp local.json-dist local.json

Create a Twilio account. After you create it, go to https://www.twilio.com/user/account/ to get the SID and Auth Token. Enter these into local.json

Make sure that `twilioNumber` in local.json is the full number obtained
from Twilio including the country code. For example, a United States based
number needs to be prefixed by '1' and the area code, i.e. "1NNNNNNNNNN".

Then start the server:

    npm start

Visit http://localhost:3000 in your browser.

## Development Setup

If you are trying to set up b.b.s. for local development only, you can use `npm run dev` instead of `npm start` to bypass certain requirements. For instance:

* You won't need to set up Twilio credentials at all
* In fact, you don't even need to have a local.json file. Dev mode will just use some simple defaults if you don't create one.
* To log into the system, you can go directly to /authenticate and type in the PIN that's listed on the page for you. Or enter a valid-looking phone number on the home page to get to /authenticate, but you'll always use the listed dummy dev PIN.

## Ops

Make sure to add yourself as an op in local.json by entering your UID. You can find this on your http://localhost:3000/profile page near the top.

> This version of [Big Boring System](http://bigboringsystem.com) intentionally has
> no threading. Check [this post][post_no_threading] for more details.

[post_no_threading]: http://bigboringsystem.com/post/user!2c0346c9-6434-41aa-8ee8-4167c1af5b70!1419794369

## Tests

    npm test

## OMG DOCKER

If you want to deploy your bbs in less than 10 minutes it is fairly trivial with docker!  A really simple way to get started is by using the docker application image on Digital Ocean.

Clone this repo, and create a local.json.

**Build a container:**

```bash
docker build -t bbs-container .
```
**Run the container:**
```

docker run -d -p 80:3000 --name bbs -v $PWD/db:/db bbs-container
```

**-d** *runs the container as a daemon process*

**-p 80:3000** *binds port 3000 of the app to port 80 on our server*

**--name bbs** *a name we can use to refer to this process*

**-v $PWD/db:/db** *mount the db folder in our present working directory to the db folder used by the app (makes database persistent)*

**bbs-container** *the name of the container to use*

You can now easily stop and start this process with ```docker stop bbs && docker start bbs```

If you make changes you will need to rebuild the container.

redpajama_set_name: RedPajamaGithub


text:
/*
 * @test
 * @bug 4634892
 * @summary Ensure that setting com.sun.security.sasl.digest.utf8 to "false"
 *      for the SASL server causes server to not issue a charset=utf-8 directive.
 */
/**
 * Default is to use UTF-8 (server will by default issue charset directive).
 * Can set logging to FINEST to view exchange.
 */

import javax.security.sasl.*;
import javax.security.auth.callback.*;
import java.security.Security;
import java.util.*;

public class AuthNoUtf8 {
    private static final String MECH = "DIGEST-MD5";
    private static final String SERVER_FQDN = "machineX.imc.org";
    private static final String PROTOCOL = "jmx";

    private static final byte[] EMPTY = new byte[0];

    private static String pwfile, namesfile, proxyfile;
    private static boolean auto;
    private static boolean verbose = false;

    private static void init(String[] args) throws Exception {
        if (args.length == 0) {
            pwfile = "pw.properties";
            namesfile = "names.properties";
            auto = true;
        } else {
            int i = 0;
            if (args[i].equals("-m")) {
                i++;
                auto = false;
            }
            if (args.length > i) {
                pwfile = args[i++];

                if (args.length > i) {
                    namesfile = args[i++];

                    if (args.length > i) {
                        proxyfile = args[i];
                    }
                }
            } else {
                pwfile = "pw.properties";
                namesfile = "names.properties";
            }
        }
    }

    public static void main(String[] args) throws Exception {

        init(args);

        CallbackHandler clntCbh = new ClientCallbackHandler(auto);

        CallbackHandler srvCbh =
            new PropertiesFileCallbackHandler(pwfile, namesfile, proxyfile);

        Map props = new HashMap();
        props.put("com.sun.security.sasl.digest.utf8", "false");

        SaslClient clnt = Sasl.createSaslClient(
            new String[]{MECH}, null, PROTOCOL, SERVER_FQDN, null, clntCbh);

        SaslServer srv = Sasl.createSaslServer(MECH, PROTOCOL, SERVER_FQDN, props,
            srvCbh);

        if (clnt == null) {
            throw new IllegalStateException(
                "Unable to find client impl for " + MECH);
        }
        if (srv == null) {
            throw new IllegalStateException(
                "Unable to find server impl for " + MECH);
        }

        byte[] response = (clnt.hasInitialResponse()?
            clnt.evaluateChallenge(EMPTY) : EMPTY);
        byte[] challenge;

        while (!clnt.isComplete() || !srv.isComplete()) {
            challenge = srv.evaluateResponse(response);

            if (challenge != null) {
                response = clnt.evaluateChallenge(challenge);
            }
        }

        if (clnt.isComplete() && srv.isComplete()) {
            if (verbose) {
                System.out.println("SUCCESS");
                System.out.println("authzid is " + srv.getAuthorizationID());
            }
        } else {
            throw new IllegalStateException("FAILURE: mismatched state:" +
                " client complete? " + clnt.isComplete() +
                " server complete? " + srv.isComplete());
        }

        clnt.dispose();
        srv.dispose();
    }
}


text:
/**
 * View
 *
 * Manage application scopes and different views
 */
window.ls.container.set('view', function(http, container) {
    let stock = {};

    let execute = function(view, node, container) {
        container.set('element', node, true, false);

        container.resolve(view.controller);

        if(true !== view.repeat) { // Remove view that should not repeat itself
            node.removeAttribute(view.selector);
        }
    };

    let parse = function (node, skip, callback) {

        if(node.tagName === 'SCRIPT') {
            return;
        }

        if(node.attributes && skip !== true) {
            let attrs = [];
            let attrsLen = node.attributes.length;

            for (let x = 0; x < attrsLen; x++) {
                attrs.push(node.attributes[x].nodeName);
            }

            if(1 !== node.nodeType) { // Skip text nodes
                return;
            }

            //console.log('in DOM?', document.body.contains(node), node, node.nodeType);

            if(attrs && attrsLen) { // Loop threw child attributes

                // if(node && node.parentNode && node.parentNode.replaceChild) { // Remove previous refs
                //     console.info('Clean DOM Node (single)', node);

                //     let new_element = node.cloneNode(true);

                //     node.parentNode.replaceChild(new_element, node);
                //     node = new_element;

                //     console.info('empty node', node);
                // }

                for (let x = 0; x < attrsLen; x++) {

                    if (node.$lsSkip === true) { // Stop render if comp has set $lsSkip
                        break;
                    }

                    let pointer = (!/Edge/.test(navigator.userAgent)) ? x : (attrsLen -1) - x;
                    let length  = attrsLen;
                    let attr    = attrs[pointer];

                    if(!stock[attr]) {
                        continue; // No such view component
                    }

                    let comp = stock[attr];

                    if (typeof comp.template === "function") { // If template is function and not string resolve it first
                        comp.template = container.resolve(comp.template);
                    }

                    if(!comp.template) { // Execute with no template
                        (function (comp, node, container) {
                            execute(comp, node, container);
                        })(comp, node, container);

                        if(length !== attrsLen) {
                            x--;
                        }

                        if(callback) {
                            callback();
                        }

                        continue;
                    }

                    node.classList.remove('load-end');
                    node.classList.add('load-start');

                    node.$lsSkip = true;

                    // Load new view template
                    http.get(comp.template)
                        .then(function(node, comp) {
                                return function(data){
                                    node.$lsSkip = false;

                                    node.innerHTML = data;

                                    node.classList.remove('load-start');
                                    node.classList.add('load-end');

                                    (function (comp, node, container) { // Execute after template has been loaded
                                        execute(comp, node, container);
                                    })(comp, node, container);

                                    // re-render specific scope children after template is loaded
                                    parse(node, true);

                                    if(callback) {
                                        callback();
                                    }
                                }
                            }(node, comp),
                            function(error) {
                                throw new Error('Failed to load comp template: ' + error.message);
                            }
                        );
                }
            }
        }

        if(true === node.$lsSkip) { // ELEMENT told not to render child nodes
            return;
        }

        let list = (node) ? node.childNodes : [];

        if(node.$lsSkip === true) {
            list = [];
        }

        // Run on tree
        for (let i = 0; i < list.length; i++) { // Loop threw all DOM children
            let child = list[i];
            parse(child);
        }
    };

    return {

        stock: stock,

        /**
         * Add View
         *
         * Adds a new comp definition to application comp stack.
         *
         * @param object
         * @returns {add}
         */
        add: function(object) {

            if(typeof object !== 'object') {
                throw new Error('object must be of type object');
            }

            let defaults = {
                'selector': '',
                'controller': function () {},
                'template': '',
                'repeat': false,
                'protected': false
            };

            for (let prop in defaults) {
                if (!defaults.hasOwnProperty(prop)) {
                    continue;
                }

                if (prop in object) {
                    continue;
                }

                object[prop] = defaults[prop];
            }

            if(!object.selector) {
                throw new Error('View component is missing a selector attribute');
            }

            stock[object.selector] = object;

            return this;
        },

        /**
         * Render
         *
         * Render all view components in a given scope.
         *
         * @param element
         * @returns view
         */
        render: function(element, callback) {
            parse(element, false, callback);
            element.dispatchEvent(new window.Event('rendered', {bubbles: false}));
        }
    }
}, true, false);


text:
<?php

namespace Aws\CloudTrail\Exception;

/**
 * Exception that occurs when a TrailNotProvidedException error is encountered
 */
class TrailNotProvidedException extends CloudTrailException {}


text:
void appSend() {
	char     sendData[12];
	char     testStr[] = "test";
	char     iStr[3];
	uint8_t  i = 0;
	uint16_t pause_time = 5000;
    uint16_t destETX = 0;
	uint16_t estimatedETX = 0;
	uint16_t ETXdiff = 0;
	uint16_t ETXarr[5]; //storing ETX values for exponential averaging
	uint16_t previousETX = 0;
	uint8_t  arrCount;
	uint8_t  alpha = 8; //how much important of the current value to the previous values
	uint8_t  setup_time = 0; //need around 10 seconds to get everything up
	// uint16_t power = 10; // Transmit power

	// Avoid signal interference with default channel (26) and wi-fi
	// cc2420_set_channel(26);

	// Set transmit power to low-power mode
	//com_ioctl(IFACE_RADIO, CC2420_LOW_POWER_MODE);
	// com_ioctl_IFACE_RADIO (CC2420_TX_POWER, 30); //set the tx power from 0 (min) to 31 (max)
	// net_ioctl(CTP_PROTO_ID, CTP_SET_TESTBED);
	// net_ioctl(CTP_PROTO_ID, CTP_SET_POWER, power);

	printf("Opening connection on port %d... \n", TRANSPORT_LISTENING_PORT);
	connect(TRANSPORT_LISTENING_PORT, 0);
	printf("Opened connection on port %d \n", TRANSPORT_LISTENING_PORT);

	while (true) {
		// Send data to base
		memset(sendData, 0, sizeof(sendData));
		strcpy(sendData, testStr);
		itoa(i, iStr, 10);
		strcat(sendData, iStr);

		// Stop sending if pause_time more than 30 seconds
		if (pause_time < 30000) {
			printf("Calling sendPacket() for: %s \n", sendData);
			sendPacket(TRANSPORT_LISTENING_PORT, sendData, sizeof(sendData), 0);
		} else {
			mos_thread_sleep(50000); //sleep 50 seconds (and hope the link better afterwards)
			pause_time -= 500; //increase send rate a bit, otherwise the program is locked
			break; //and then back to the loop again
		}

		i++;
		// Reset counter
		if (i >= 60) {
			i = 0;
		}

		setup_time++;

		if (setup_time > 10)
			setup_time = 13; //protect a wrap-around

		if (pause_time < 0)
			pause_time = 0; //pause_time can never be less than 0 (send continuously)

		mos_thread_sleep(pause_time); //adaptive send rate

		if (arrCount == 5)
			arrCount = 0;
	}

	// Close connection to destination (last) node; port 0
	closeConn(0, 3);
	printf("Closed connection on port %d \n", TRANSPORT_LISTENING_PORT);
}

void start(void) {
	uint16_t power = 30; // Transmit power

	mos_node_id_set(6);
	transportInit(false);
	// net_ioctl(CTP_PROTO_ID, CTP_SET_TESTBED);
	net_ioctl(CTP_PROTO_ID, CTP_SET_POWER, power);

	// Sleep for 20 sec to allow CTP++ routing to stabilize
	mos_thread_sleep(20000);

	mos_thread_new(appSend, 384, PRIORITY_NORMAL);
}