text:
import sys, os
#sys.path.append('/home/tobias/data/git/wodore-gae/main/')
#sys.path.append('./')
#sys.path.append('./main')
#sys.path.append('./model')

#import logging
import unittest

from google.appengine.ext import ndb#, testbed

#from waypoint import WayPoint
#from tag import TagStructure, Tag, TagRelation

class TestWayPoint(unittest.TestCase):
  # enable the datastore stub
  nosegae_datastore_v3 = True
  nosegae_memcache = True
  #import model # does not work yet

  def setUp(self):
    global config
    global model
    import config
    import model
    self.colg = model.Collection.top_key()
    self.col1 = ndb.Key('Collection','one')
    self.col2 = ndb.Key('Collection','two')
    self.col3 = ndb.Key('Collection','three')
    self.col1a = ndb.Key('Collection','one A')
    self.col2a = ndb.Key('Collection','two A')
    self.col3a = ndb.Key('Collection','three A')

  def tearDown(self):
    # TODO should not be necessary!!!
    # every new test should start fresh
    #apiproxy_stub_map.apiproxy._APIProxyStubMap__stub_map['datastore_v3'].Clear()
    ndb.delete_multi(model.WayPoint.query().fetch(keys_only=True))
    ndb.delete_multi(model.Tag.query().fetch(keys_only=True))
    ndb.delete_multi(model.TagRelation.query().fetch(keys_only=True))

  def test_init_waypoint(self):
    P1 = model.WayPoint(name='P1',collection=self.col1)
    P1.put()
    assert P1 is not None
    self.assertEqual(P1.name, 'P1')
    self.assertEqual(P1.collection, self.col1)

  def test_add_geo_coordinates_waypoint(self):
    P1 = model.WayPoint(name='P1',collection=self.col1)
    P1.geo = ndb.GeoPt(52.37, 4.88)
    key = P1.put()
    P2 = key.get()
    self.assertEqual(P2.geo, ndb.GeoPt(52.37, 4.88))

  def test_waypoint_tags(self):
    demo1 = model.WayPoint(name='demo1',collection=self.col1)
    demo1.add_tags(['one'])
    demo1.put()
    # show tags and relations
    tag_dbs = model.Tag.qry().fetch()
    self.assertEqual(len(tag_dbs), 2)
    #model.Tag.print_list(tag_dbs)
    rel_dbs = model.TagRelation.qry().fetch()
    self.assertEqual(len(rel_dbs), 0)
    #model.TagRelation.print_list(rel_dbs)
    # ADD tags
    demo1.add_tags(['two','three'])
    # show tags
    tag_dbs = model.Tag.qry().fetch()
    self.assertEqual(len(tag_dbs), 6)
    #model.Tag.print_list(tag_dbs)
    rel_dbs = model.TagRelation.qry().fetch()
    self.assertEqual(len(rel_dbs), 2*6)
    #model.TagRelation.print_list(rel_dbs)

    # REMOVE tags
    demo1.remove_tags(['two'])
    # show tags
    tag_dbs = model.Tag.qry().fetch()
    #model.Tag.print_list(tag_dbs)
    self.assertEqual(len(tag_dbs), 4)
    rel_dbs = model.TagRelation.qry().fetch()
    self.assertEqual(len(rel_dbs), 2*2)
    #model.TagRelation.print_list(rel_dbs)

    # UPDATE tags
    demo1.update_tags(['two','three','four'])
    # show tags
    tag_dbs = model.Tag.qry().fetch()
    #model.Tag.print_list(tag_dbs)
    self.assertEqual(len(tag_dbs), 6)
    rel_dbs = model.TagRelation.qry().fetch()
    self.assertEqual(len(rel_dbs), 2*6)
    #model.TagRelation.print_list(rel_dbs)

  def test_waypoint_query(self):
    demo1 = model.WayPoint(name='demo1',collection=self.col1)
    demo1.add_tags(['one'])
    demo1.put()
    demo2 = model.WayPoint(name='demo2',collection=self.col1)
    demo2.add_tags(['one', 'two','three'])
    key2 = demo2.put()
    demo3 = model.WayPoint(name='demo3',collection=self.col1)
    demo3.add_tags(['two','three'])
    key3 = demo3.put()
    demo4 = model.WayPoint(name='demo1',collection=self.col2)
    demo4.add_tags(['three', 'four'])
    demo4.put()

    dbs = model.WayPoint.qry(name='demo1').fetch()
    #model.WayPoint.print_list(dbs)
    self.assertEqual(len(dbs), 2)
    self.assertEqual(dbs[0].name,'demo1')
    self.assertEqual(dbs[0].collection,self.col2)
    self.assertEqual(dbs[1].collection,self.col1)

    dbs = model.WayPoint.qry(tag='three').fetch()
    #model.WayPoint.print_list(dbs)
    self.assertEqual(len(dbs), 3)
    self.assertEqual(dbs[0].name,'demo1')
    self.assertEqual(dbs[0].collection,self.col2)

    dbs = model.WayPoint.qry(collection=self.col1).fetch()
    #model.WayPoint.print_list(dbs)
    self.assertEqual(len(dbs), 3)

    demo2 = key2.get()
    demo2.update_tags(['three','two','one'])
    demo2.put()
    dbs = model.WayPoint.qry(collection=self.col1,tag='two',order_by_date='created').fetch()
    #model.WayPoint.print_list(dbs)
    self.assertEqual(len(dbs), 2)
    self.assertEqual(dbs[0].name,'demo3')
    self.assertEqual(dbs[1].name,'demo2')
    dbs = model.WayPoint.qry(collection=self.col1,tag='two',order_by_date='modified').fetch()
    #model.WayPoint.print_list(dbs)
    self.assertEqual(dbs[0].name,'demo2')
    self.assertEqual(dbs[1].name,'demo3')

if __name__ == "__main__":
  unittest.main()


text:
import React from "react"
import { Link, graphql } from "gatsby"

import Layout from "../components/layout"
import SEO from "../components/seo"

class ConfirmPage extends React.Component {
  render() {
    const { data } = this.props
    const siteTitle = data.site.siteMetadata.title

    return (
      <Layout location={this.props.location} title={siteTitle}>
        <SEO title="Aashni" />

Success!

          Yay! Your form was submitted successfully! Please check your emails
          for a confirmation link to complete your registration.

          Why not read some <Link to={"/blog"}>blog posts</Link> in the
          meantime?

      </Layout>
    )
  }
}

export default ConfirmPage

export const pageQuery = graphql`
  query {
    site {
      siteMetadata {
        title
      }
    }
  }
`

redpajama_set_name: RedPajamaGithub


text:
AuthGateway is a flexible authentication helper for HTTPS proxies to add user authentication and
verification to all requests received by the proxy before they are sent to upsteram HTTP(S) apps.

AuthGateway also provides some basic authorisation logic.

The aims of this project are to:

* Easily ensure HTTPS requests are authenticated.
* Easily add request auditing to your setup.
* Decuple the HTTP(S) proxy from the authentication proxy.
  * Combine any supported HTTPS proxy with any supprted authentication proxy.

## Architecture

![AuthGateway architecture diagram](./authgateway.png)

AuthGatheway is a middleware to combine an HTTP(S) proxy with an authentication proxy.

For components to integrate correctly they must support interfaces that AuthGateway can work with:

* An HTTP(S) Proxy able to delegate authentication using the [NGINX auth_request] protocol.
* A supported authentication proxy that can verify users and return some identity information.

Supported authentication proxies:
* [OAuth2 Proxy](https://oauth2-proxy.github.io/oauth2-proxy/)

Some HTTP(S) Proxies that support `auth_request`:
* [ingress-nginx](https://kubernetes.github.io/ingress-nginx/).
* [NGINX](https://www.nginx.com/).

## Configuration
AuthGateway's configuration is loaded from a YAML file.
By default this is `authgateway.yaml` and a different file can be specified with `--config FILE`.

The configuration options available in this file are the serialised versions of the
rust structrues in the `src/config/` directoy, with the `Config` structure being the root document.

As an example configuration check out the [`authgateway.yaml`](./authgateway.yaml) file
at the root of this repo.

### Rules
In addition to the main configuration file AuthGateway supports rules to customise its
behaviour when processing requests.

Rules are applied at different phases were each phase has access to more context.
In the last phase rules can modify even the authentication response.

1. `pre-auth` rules are applied before the request is checked with the auth proxy.
2. `post-auth` rules are applied after the request is checked with the auth proxy.
3. `enrich-response` rules are able to modify AuthGateway's responses.

Rules are loaded in order from a list of files specified in the main config file.

## Deploying
The latest version of AuthGateway is intended mainly to be used in Kubernetes as an
authentication gateway for the NGINX ingress.
By design however AuthGateway works with any HTTPS proxy that implements
the [NGINX auth_request] protocol.

An example of AuthGateway used with NGINX proxy is in the `devenv/` directory.

### As a container
A distroless Container Image for AuthGateway is available on
[docker hub](https://hub.docker.com/r/spogliani/auth-gateway).

To use this image:

1. Write a configuration file for AuthGateway.
2. Optionally write any rules file you wish to use.
3. Run the docker container.
4. Point your HTTPS proxy to AuthGateway (for example NGINX Ingress).

```bash
$ docker run --rm -it \
  -v "$PWD/authgateway.yaml:/authgateway.yaml" \
  -v "$PWD/ruleset-1.yaml:/ruleset-1.yaml" \
  -v "$PWD/ruleset-2.yaml:/ruleset-2.yaml" \
  docker.io/spogliani/auth-gateway:latest
```

## Apps Catalogue
Up to version 0.4.x of AuthGateway a built-in Applications Catalogue was available.
Since version 0.5.0 onward the entire interface was removed and only the proxy API is provided.

To provide a simple catalouge similar to what used to be provided you can use static
site generators tools.
The [AuthGateway Portal Theme] for [Hugo] enables this quickly.

The Applications Catalogue was removed from the proxy process for a few reasons:

* AuthGateway is now simpler and has less to focus on.
* Other catalogue solutions can be used in more complex/dynamic setups.
* The built-in catalogue did not work well with the desired to use of Kubernetes service ingress.

## Roadmap
This project is a one-person hobby operation.
And this one person has other hobby projects to work on.
As a result desired but not essential features of AuthGateway won't be available for a while.

This roadmap hopes to track what will hopefully be added.

* GitHub Actions for tests and code linting.
* Full Kubernetes ingress demo.
* Introspection with OpenTelemetry integration.
* (Possibly) HTTPS Proxy configuration helper utility.

[AuthGateway Portal Theme]: https://github.com/stefano-pogliani/auth-gateway-portal-hugotheme
[Hugo]: https://gohugo.io/
[NGINX auth_request]: https://nginx.org/en/docs/http/ngx_http_auth_request_module.html


text:
SailPoint Active / Indicator Plugin

## Synopsis

This is a proof of concept javascript snipped, utilized by the SailPoint Plugin Framework for SailPoint IdentityIQ. The snippet will replace the "Inactive" column on the identity.jsf page with a more useful information.

## Installation

The installation of the plugin does not differ from the installation of other plugins. Head to the plugins page of IdentityIQ and drop the zip file to the drop area.
To activate the True/False indicators on the identity list page (define/identity.jsf), you will also need to modify your UI-Configuration. Lookup the configuration for the identity list view and add one of the supplied renderer to your attribute.
In example, to show the reversed inactive (=active) state, you would add something like
```xml
<ColumnConfig dataIndex="inactive" headerKey="Active" hideable="true" property="inactive" renderer="SailPoint.Define.Grid.Identity.reverseTrueFalseRenderer" sortProperty="inactive" sortable="true" stateId="inactive"/>
```

## License
Copyright (c) 2016 Mario Enrico Ragucci, SailPoint Technologies GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


text:
namespace MqttController {
    partial class Form1 {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing) {
            if (disposing && (components != null)) {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent() {
            this.btnClear = new System.Windows.Forms.Button();
            this.txtData = new System.Windows.Forms.TextBox();
            this.btnStart = new System.Windows.Forms.Button();
            this.txtTopicName = new System.Windows.Forms.TextBox();
            this.label2 = new System.Windows.Forms.Label();
            this.txtThreshold = new System.Windows.Forms.TextBox();
            this.label3 = new System.Windows.Forms.Label();
            this.txtPhoneNumber = new System.Windows.Forms.TextBox();
            this.label4 = new System.Windows.Forms.Label();
            this.txtMessage = new System.Windows.Forms.TextBox();
            this.label5 = new System.Windows.Forms.Label();
            this.btnEnableTwilio = new System.Windows.Forms.Button();
            this.txtStatus = new System.Windows.Forms.TextBox();
            this.SuspendLayout();
            //
            // btnClear
            //
            this.btnClear.Location = new System.Drawing.Point(841, 191);
            this.btnClear.Name = "btnClear";
            this.btnClear.Size = new System.Drawing.Size(208, 87);
            this.btnClear.TabIndex = 17;
            this.btnClear.Text = "Clear";
            this.btnClear.UseVisualStyleBackColor = true;
            this.btnClear.Click += new System.EventHandler(this.btnClear_Click);
            //
            // txtData
            //
            this.txtData.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
            | System.Windows.Forms.AnchorStyles.Left)));
            this.txtData.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.txtData.Location = new System.Drawing.Point(12, 320);
            this.txtData.Multiline = true;
            this.txtData.Name = "txtData";
            this.txtData.ReadOnly = true;
            this.txtData.ScrollBars = System.Windows.Forms.ScrollBars.Both;
            this.txtData.Size = new System.Drawing.Size(1037, 330);
            this.txtData.TabIndex = 15;
            this.txtData.WordWrap = false;
            //
            // btnStart
            //
            this.btnStart.Location = new System.Drawing.Point(841, 5);
            this.btnStart.Name = "btnStart";
            this.btnStart.Size = new System.Drawing.Size(208, 87);
            this.btnStart.TabIndex = 14;
            this.btnStart.Text = "Start";
            this.btnStart.UseVisualStyleBackColor = true;
            this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
            //
            // txtTopicName
            //
            this.txtTopicName.Location = new System.Drawing.Point(163, 12);
            this.txtTopicName.Name = "txtTopicName";
            this.txtTopicName.Size = new System.Drawing.Size(636, 35);
            this.txtTopicName.TabIndex = 13;
            this.txtTopicName.Text = "gb/np2/temp";
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(6, 13);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(75, 29);
            this.label2.TabIndex = 12;
            this.label2.Text = "Topic";
            //
            // txtThreshold
            //
            this.txtThreshold.Location = new System.Drawing.Point(163, 62);
            this.txtThreshold.Name = "txtThreshold";
            this.txtThreshold.Size = new System.Drawing.Size(636, 35);
            this.txtThreshold.TabIndex = 20;
            this.txtThreshold.Text = "60";
            //
            // label3
            //
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(6, 64);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(123, 29);
            this.label3.TabIndex = 19;
            this.label3.Text = "Threshold";
            //
            // txtPhoneNumber
            //
            this.txtPhoneNumber.Location = new System.Drawing.Point(163, 114);
            this.txtPhoneNumber.Name = "txtPhoneNumber";
            this.txtPhoneNumber.Size = new System.Drawing.Size(636, 35);
            this.txtPhoneNumber.TabIndex = 23;
            this.txtPhoneNumber.Text = "+61403809914";
            //
            // label4
            //
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(6, 116);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(83, 29);
            this.label4.TabIndex = 22;
            this.label4.Text = "Phone";
            //
            // txtMessage
            //
            this.txtMessage.Location = new System.Drawing.Point(163, 164);
            this.txtMessage.Name = "txtMessage";
            this.txtMessage.Size = new System.Drawing.Size(636, 35);
            this.txtMessage.TabIndex = 25;
            this.txtMessage.Text = "Please check the heating it has suddenly got very hot in here";
            //
            // label5
            //
            this.label5.AutoSize = true;
            this.label5.Location = new System.Drawing.Point(6, 167);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(112, 29);
            this.label5.TabIndex = 24;
            this.label5.Text = "Message";
            //
            // btnEnableTwilio
            //
            this.btnEnableTwilio.Location = new System.Drawing.Point(841, 98);
            this.btnEnableTwilio.Name = "btnEnableTwilio";
            this.btnEnableTwilio.Size = new System.Drawing.Size(208, 87);
            this.btnEnableTwilio.TabIndex = 27;
            this.btnEnableTwilio.Text = "Enable Twillio";
            this.btnEnableTwilio.UseVisualStyleBackColor = true;
            this.btnEnableTwilio.Click += new System.EventHandler(this.button3_Click);
            //
            // txtStatus
            //
            this.txtStatus.Location = new System.Drawing.Point(163, 223);
            this.txtStatus.Name = "txtStatus";
            this.txtStatus.ReadOnly = true;
            this.txtStatus.Size = new System.Drawing.Size(636, 35);
            this.txtStatus.TabIndex = 28;
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(14F, 29F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(1399, 662);
            this.Controls.Add(this.txtStatus);
            this.Controls.Add(this.btnEnableTwilio);
            this.Controls.Add(this.txtMessage);
            this.Controls.Add(this.label5);
            this.Controls.Add(this.txtPhoneNumber);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.txtThreshold);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.btnClear);
            this.Controls.Add(this.txtData);
            this.Controls.Add(this.btnStart);
            this.Controls.Add(this.txtTopicName);
            this.Controls.Add(this.label2);
            this.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
            this.Name = "Form1";
            this.Text = "Form1";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Button btnClear;
        private System.Windows.Forms.TextBox txtData;
        private System.Windows.Forms.Button btnStart;
        private System.Windows.Forms.TextBox txtTopicName;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.TextBox txtThreshold;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.TextBox txtPhoneNumber;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.TextBox txtMessage;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.Button btnEnableTwilio;
        private System.Windows.Forms.TextBox txtStatus;
    }
}


text:
package com.gemstone.gemfire.internal.cache;

import java.util.concurrent.atomic.AtomicInteger;

import org.apache.logging.log4j.Logger;

import com.gemstone.gemfire.cache.EntryNotFoundException;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.internal.SystemTimer;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
import com.gemstone.gemfire.internal.logging.LogService;
import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;

/**
 * ExpirationScheduler uses a single instance of java.util.Timer (and
 * therefore a single thread) per VM to schedule and execute region and
 * entry expiration tasks.
 */

public class ExpirationScheduler
  {
  private static final Logger logger = LogService.getLogger();

  private final SystemTimer timer;
  private final AtomicInteger pendingCancels = new AtomicInteger();
  private static final int MAX_PENDING_CANCELS = Integer.getInteger("gemfire.MAX_PENDING_CANCELS", 10000).intValue();

  public ExpirationScheduler(InternalDistributedSystem ds) {
    this.timer = new SystemTimer(ds, true);
  }

  public void forcePurge() {
    pendingCancels.getAndSet(0);
    this.timer.timerPurge();
  }
  /**
   * Called when we have cancelled a scheduled timer task.
   * Do work, if possible to fix bug 37574.
   */
  public void incCancels() {
    int pc = pendingCancels.incrementAndGet();
    if (pc > MAX_PENDING_CANCELS) {
      pc = pendingCancels.getAndSet(0);
      if (pc > MAX_PENDING_CANCELS) {
        this.timer.timerPurge();
//        int purgedCancels = CFactory.timerPurge(this.timer);
        // we could try to do some fancy stuff here but the value
        // of the atomic is just a hint so don't bother adjusting it
//         // take the diff between the number of actual cancels we purged
//         // "purgedCancels" and the number we said we would purge "pc".
//         int diff = purgedCancels - pc;
      } else {
        // some other thread beat us to it so add back in the cancels
        // we just removed by setting it to 0
        pendingCancels.addAndGet(pc);
      }
    }
  }

  /** schedules the given expiration task */
  public ExpiryTask addExpiryTask(ExpiryTask task) {
    try {
      if(logger.isTraceEnabled()) {
        logger.trace(LocalizedMessage.create(LocalizedStrings.ExpirationScheduler_SCHEDULING__0__TO_FIRE_IN__1__MS, new Object[] {task, Long.valueOf(task.getExpiryMillis())}));
      }
      // To fix bug 52267 do not create a Date here; instead calculate the relative duration.
      timer.schedule(task, task.getExpiryMillis());
    }
    catch (EntryNotFoundException e) {
      // ignore - there are unsynchronized paths that allow an entry to
      // be destroyed out from under us.
      return null;
    }
    catch (IllegalStateException e) {
      // task must have been cancelled by another thread so don't schedule it
      return null;
    }
    return task;
  }

  /** schedules the given entry expiration task and returns true; returns false if not scheduled */
  public boolean addEntryExpiryTask(EntryExpiryTask task) {
    return addExpiryTask(task) != null;
  }

  /** @see java.util.Timer#cancel() */
  public void cancel() {
    timer.cancel();
  }
}


text:
package org.jcodec.codecs.mpeg4.mp4;

import java.nio.ByteBuffer;

import org.jcodec.codecs.mpeg4.es.DecoderConfig;
import org.jcodec.codecs.mpeg4.es.DecoderSpecific;
import org.jcodec.codecs.mpeg4.es.Descriptor;
import org.jcodec.codecs.mpeg4.es.ES;
import org.jcodec.codecs.mpeg4.es.SL;
import org.jcodec.common.io.BitWriter;
import org.jcodec.containers.mp4.boxes.Box;
import org.jcodec.containers.mp4.boxes.FullBox;
import org.jcodec.containers.mp4.boxes.Header;

/**
 * This class is part of JCodec ( www.jcodec.org ) This software is distributed
 * under FreeBSD License
 *
 * MPEG 4 elementary stream descriptor
 *
 * @author The JCodec project
 *
 */
public class EsdsBox extends FullBox {

    private ByteBuffer streamInfo;
    private int objectType;
    private int bufSize;
    private int maxBitrate;
    private int avgBitrate;
    private int trackId;

    public static String fourcc() {
        return "esds";
    }

    public EsdsBox(Header atom) {
        super(atom);
    }

    public EsdsBox() {
        super(new Header(fourcc()));
    }

    public EsdsBox(ByteBuffer streamInfo, int objectType, int bufSize, int maxBitrate, int avgBitrate, int trackId) {
        super(new Header(fourcc()));
        this.objectType = objectType;
        this.bufSize = bufSize;
        this.maxBitrate = maxBitrate;
        this.avgBitrate = avgBitrate;
        this.trackId = trackId;
        this.streamInfo = streamInfo;
    }

    @Override
    protected void doWrite(ByteBuffer out) {
        super.doWrite(out);

        if (streamInfo != null && streamInfo.remaining() > 0)
            new ES(trackId, new DecoderConfig(objectType, bufSize, maxBitrate, avgBitrate, new DecoderSpecific(
                    streamInfo)), new SL()).write(out);
        else
            new ES(trackId, new DecoderConfig(objectType, bufSize, maxBitrate, avgBitrate), new SL()).write(out);
    }

    public void parse(ByteBuffer input) {
        super.parse(input);
        ES es = (ES) Descriptor.read(input);

        trackId = es.getTrackId();
        DecoderConfig decoderConfig = Descriptor.find(es, DecoderConfig.class, DecoderConfig.tag());
        objectType = decoderConfig.getObjectType();
        bufSize = decoderConfig.getBufSize();
        maxBitrate = decoderConfig.getMaxBitrate();
        avgBitrate = decoderConfig.getAvgBitrate();
        DecoderSpecific decoderSpecific = Descriptor.find(decoderConfig, DecoderSpecific.class, DecoderSpecific.tag());
        streamInfo = decoderSpecific.getData();
    }

    public ByteBuffer getStreamInfo() {
        return streamInfo;
    }

    public int getObjectType() {
        return objectType;
    }

    public int getBufSize() {
        return bufSize;
    }

    public int getMaxBitrate() {
        return maxBitrate;
    }

    public int getAvgBitrate() {
        return avgBitrate;
    }

    public int getTrackId() {
        return trackId;
    }

    public static Box fromADTS(org.jcodec.codecs.aac.ADTSParser.Header hdr) {
    	ByteBuffer si = ByteBuffer.allocate(2);
    	BitWriter wr = new BitWriter(si);
    	wr.writeNBit(hdr.getObjectType(), 5);
    	wr.writeNBit(hdr.getSamplingIndex(), 4);
    	wr.writeNBit(hdr.getChanConfig(), 4);
    	wr.flush();
    	si.clear();

        return new EsdsBox(si, hdr.getObjectType() << 5, 0, 210750, 133350, 2);
    }
}


text:
package com.ibm.streamsx.watsonexplorer.test;

import static org.mockserver.model.HttpRequest.request;
import static org.mockserver.model.HttpResponse.response;
import static org.mockserver.model.Parameter.param;
import static org.mockserver.model.ParameterBody.params;

import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
import java.util.concurrent.TimeUnit;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockserver.model.NottableString;

import com.ibm.streams.operator.OutputTuple;
import com.ibm.streams.operator.Tuple;
import com.ibm.streams.operator.Type;
import com.ibm.streams.watsonexplorer.operators.WEXPushOperator;
import com.ibm.streams.watsonexplorer.operators.WEXQueryOperator;
import com.ibm.streamsx.topology.TStream;
import com.ibm.streamsx.topology.context.StreamsContext;
import com.ibm.streamsx.topology.context.StreamsContextFactory;
import com.ibm.streamsx.topology.function.BiFunction;
//import com.ibm.streamsx.topology.internal.tester.TupleCollection;
import com.ibm.streamsx.topology.spl.JavaPrimitive;
import com.ibm.streamsx.topology.spl.SPLStream;
import com.ibm.streamsx.topology.spl.SPLStreams;
import com.ibm.streamsx.topology.tester.Condition;

public class WatsonExplorerPushTest extends AbstractOperatorTest {

	private String wexPushResponseXMLStr;

	@Before
	public void setup() throws Exception {
		super.setup();
		wexPushResponseXMLStr = new String(Files.readAllBytes(Paths.get("impl/test/resources/responses/wexpush_response.txt")));
	}

	@Override
	protected void initClient() {
	}

	@Test
	public void wexPushGreenthread() throws Exception {
		client
		.when(request()
				.withMethod("POST")
				.withPath("/vivisimo/cgi-bin/velocity")
				.withHeader("Content-Type", "application/x-www-form-urlencoded; charset=ISO-8859-1")
				.withBody(params(
					param("collection", "test"),
					param("v.app", "api-rest"),
					param("v.username", "guest"),
					param("v.password", "guest"),
					param("v.function", "search-collection-enqueue"),
					param("crawl-urls", "<crawl-url status=\"complete\" url=\"ref://my_url\" synchronization=\"indexed\" enqueue-type=\"reenqueued\">\n" +
							"  <crawl-data>\n" +
							"    <text>test</text>\n" +
							"  </crawl-data>\n" +
							"</crawl-url>")
				))
		)
		.respond(response()
				.withStatusCode(200)
				.withBody(wexPushResponseXMLStr));

		TStream<String> src = topo.strings("test");
		SPLStream splStream = SPLStreams.convertStream(src, new StringStreamToSPLQuery(), Type.Factory.getStreamSchema("tuple<rstring data, rstring url>"));

		opParams.put("username", "guest");
		opParams.put("password", "guest");
		opParams.put("collection", "test");

		JavaPrimitive.invokeJavaPrimitive(WEXPushOperator.class, splStream, OUTPUT_SCHEMA, opParams);
		StreamsContext<?> context = StreamsContextFactory.getStreamsContext(com.ibm.streamsx.topology.context.StreamsContext.Type.EMBEDDED_TESTER); //.submit(topo, new HashMap<String, Object>()).get();
		topo.getTester().complete(context);
	}

	@Test
	public void wexPushDuplicatesProcessing() throws Exception {
		client
		.when(request()
				.withMethod("POST")
				.withPath("/vivisimo/cgi-bin/velocity")
				.withHeader("Content-Type", "application/x-www-form-urlencoded; charset=ISO-8859-1")
				.withBody(params(
					param("collection", "test"),
					param("v.app", "api-rest"),
					param("v.username", "guest"),
					param("v.password", "guest"),
					param("v.function", "search-collection-enqueue"),
					param("crawl-urls", "<crawl-url status=\"complete\" url=\"ref://my_url\" synchronization=\"none\" enqueue-type=\"none\">\n" +
							"  <crawl-data>\n" +
							"    <text>test</text>\n" +
							"  </crawl-data>\n" +
							"</crawl-url>")
				))
		)
		.respond(response()
				.withStatusCode(200)
				.withBody(wexPushResponseXMLStr));

		TStream<String> src = topo.strings("test");
		SPLStream splStream = SPLStreams.convertStream(src, new StringStreamToSPLQuery(), Type.Factory.getStreamSchema("tuple<rstring data, rstring url>"));

		opParams.put("username", "guest");
		opParams.put("password", "guest");
		opParams.put("collection", "test");
		opParams.put("duplicates", "skip");
		opParams.put("processing", "fast");
		JavaPrimitive.invokeJavaPrimitive(WEXPushOperator.class, splStream, OUTPUT_SCHEMA, opParams);
		StreamsContext<?> context = StreamsContextFactory.getStreamsContext(com.ibm.streamsx.topology.context.StreamsContext.Type.EMBEDDED_TESTER); //.submit(topo, new HashMap<String, Object>()).get();
		topo.getTester().complete(context);
	}

	@Test
	public void wexPushAdditionalParams() throws Exception {
		client
		.when(request()
				.withMethod("POST")
				.withPath("/vivisimo/cgi-bin/velocity")
				.withHeader("Content-Type", "application/x-www-form-urlencoded; charset=ISO-8859-1")
				.withBody(params(
					param("collection", "test"),
					param("v.app", "api-rest"),
					param("v.username", "guest"),
					param("v.password", "guest"),
					param("v.function", "search-collection-enqueue"),
					param("crawl-urls", "<crawl-url status=\"complete\" url=\"ref://my_url\" synchronization=\"indexed\" enqueue-type=\"reenqueued\">\n" +
							"  <crawl-data>\n" +
							"    <text>test</text>\n" +
							"  </crawl-data>\n" +
							"</crawl-url>"),
					param("foo", "123"),
					param("bar", "987")
				))
		)
		.respond(response()
				.withStatusCode(200)
				.withBody(wexPushResponseXMLStr));

		TStream<String> src = topo.strings("test");
		SPLStream splStream = SPLStreams.convertStream(src, new StringStreamToSPLQuery(), Type.Factory.getStreamSchema("tuple<rstring data, rstring url>"));

		opParams.put("username", "guest");
		opParams.put("password", "guest");
		opParams.put("collection", "test");
		opParams.put("additionalParams", new String[] {"foo=123", "bar=987"});
		JavaPrimitive.invokeJavaPrimitive(WEXPushOperator.class, splStream, OUTPUT_SCHEMA, opParams);
		StreamsContext<?> context = StreamsContextFactory.getStreamsContext(com.ibm.streamsx.topology.context.StreamsContext.Type.EMBEDDED_TESTER); //.submit(topo, new HashMap<String, Object>()).get();
		topo.getTester().complete(context);
	}

	private static class StringStreamToSPLQuery implements BiFunction<String, OutputTuple, OutputTuple> {
		private static final long serialVersionUID = 1L;

		@Override
		public OutputTuple apply(String data, OutputTuple outTuple) {
			outTuple.setString("data", data);
			outTuple.setString("url", "my_url");
			return outTuple;
		}
	}
}


text:
package zip

import (
	"archive/zip"
	"errors"
	"io"
	"io/ioutil"
	"os"
)

var (
	// ErrFileNotFound indicates that we reached the end of the archive without finding the file.
	ErrFileNotFound = errors.New("file not found in the archive")
)

// zipFileReader reads a certain file from a ZIP archive.
type zipFileReader struct {
	archive *zip.Reader
	file    string // The path to the file inside the archive.

	found io.ReadCloser // The file object if it has been found.

	tmp *os.File // The temporary file the archive is saved to.
}

// NewZipFileReader returns a new Reader which reads a specific file from a .zip archive.
func NewZipFileReader(r io.Reader, f string) (io.ReadCloser, error) {
	tmp, err := ioutil.TempFile(os.TempDir(), "gitbin_")
	if err != nil {
		return nil, err
	}

	n, err := io.Copy(tmp, r)
	if err != nil {
		return nil, err
	}

	archive, err := zip.NewReader(tmp, n)
	if err != nil {
		return nil, err
	}

	return &zipFileReader{
		archive: archive,
		file:    f,

		tmp: tmp,
	}, nil
}

func (r *zipFileReader) Read(p []byte) (int, error) {
	// The file is already found
	if r.found != nil {
		return r.found.Read(p)
	}

	// Iterate through the files in the archive
	for _, f := range r.archive.File {
		if f.Name == r.file {
			fr, err := f.Open()
			if err != nil {
				return 0, err
			}

			r.found = fr

			return fr.Read(p)
		}
	}

	return 0, ErrFileNotFound
}

func (r *zipFileReader) Close() error {
	r.tmp.Close()
	os.Remove(r.tmp.Name())

	if r.found != nil {
		r.found.Close()
	}

	return nil
}


text:
<!DOCTYPE html>
<head>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
  <script src="/js/parallax/parallax.min.js"></script>
  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
  <link rel="stylesheet" type="text/css" href="/css/animate.css">
  <script src="/js/wow.min.js"></script>
  <script>new WOW().init();</script>
  <script src="/js/sweetalert.min.js"></script>
  <link rel="stylesheet" type="text/css" href="/css/sweetalert.css">
  <link rel="stylesheet" href="/css/contact.css">

</head>

<html class="no-js">
  {% include head.html %}
  <body>

    {% include header.html %}

    <div class="content">

      {{ content }}
    </div>
    {% include footer.html %}

  </body>
</html>


text:
              			<?php $this->load->view('front/agent/agent_profile_menu/side_menu'); ?>

History

                                <?php if(empty($post_details)) {?>

This page displays your referral posting and bidding history.

                                 <?php } ?>
                                    <?php
                                    if(!empty($post_details)){?>

                                                <?php foreach($post_details as $post_detail) { ?>

                                                                <a target="_blank" href="<?php echo base_url() ?>review-bids/<?php echo $post_detail['referral_post_id'] ?>"><?php echo $post_detail['referral_post_title']; ?>
                                                                <?php echo get_date($post_detail['publish_date']); ?>
                                                                <a target="_blank" href="<?php echo base_url() ?>review-bids/<?php echo $post_detail['referral_post_id'] ?>"><?php echo ($post_detail['total_bids'] == 1 || $post_detail['total_bids'] == 0)?$post_detail['total_bids'].' '. 'Bid':$post_detail['total_bids'].' '.'Bids' ?>
                                                                <?php
                                                                if($post_detail['is_bidding_expired'] == 1){
                                                                    echo "Expired";
                                                                } else if($post_detail['referral_post_status'] == 1){
                                                                    echo "Active";
                                                                } else if($post_detail['referral_post_status'] == 8){
                                                                    echo 'Awarded to '.get_user_name($post_detail['awarded_to']);
                                                                } else {
                                                                    echo "Pending";
                                                                }
                                                                ?>

                                                    <?php $signature_status = $this->Agreement_model->get_agreement($post_detail['referral_post_id']);
                                                        if($signature_status){?>

Referral Agreement Signature Status <a target="_blank" href="<?php echo $this->Agreement_model->get_agreement_url($post_detail['referral_post_id'], 'referring_agent', 1) ?>">Page1  <a target="_blank" href="<?php echo $this->Agreement_model->get_agreement_url($post_detail['referral_post_id'], 'referring_agent', 2) ?>">Page2

Bidding Agent  Completed

Bidding Broker <?php echo ($signature_status[0]->receiving_broker)?'Completed':'Pending'; ?>

Posting Agent  Completed

Posting Broker <?php echo ($signature_status[0]->referring_broker)?'Completed':'Pending'; ?>

                                                        <?php } else {?>

Agreement form not sent

                                                        <?php }
                                                    ?>

                                                <?php } ?>

                                    <?php
                                    } ?>


text:
import Gaffer
import GafferUI
import GafferScene

Gaffer.Metadata.registerNode(

	GafferScene.FilterSwitch,

	"description",
	"""
	Chooses between multiple input filters, passing the chosen
	filter through to the output.
	""",

	plugs = {

		"in*" : [

			"plugValueWidget:type", "",

		],

		"index" : [

			"description",
			"""
			The index of the input which is passed through. A value
			of 0 chooses the first input, 1 the second and so on. Values
			larger than the number of available inputs wrap back around to
			the beginning.
			""",

			"nodule:type", "",
			"plugValueWidget:type", "GafferUI.NumericPlugValueWidget",

		],

	},

)


text:
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';

export default class ExampleRoute extends Route {
  @service indexedDb;
  @service store;

  beforeModel() {
    let { indexedDb } = this;
    return indexedDb.setupTask.perform();
  }

  model() {
    let { store } = this;
    return store.findAll('item');
  }
}


text: Swagen generators for Angular 1.x $http and Angular 2+ HTTP services.


text:
namespace content {

namespace {

mojo::PendingRemote<media::mojom::AudioInputStreamClient>
CreateRemoteAndStoreReceiver(
    mojo::PendingReceiver<media::mojom::AudioInputStreamClient>* receiver_out) {
  mojo::PendingRemote<media::mojom::AudioInputStreamClient> remote;
  *receiver_out = remote.InitWithNewPipeAndPassReceiver();
  return remote;
}

}  // namespace

AudioInputStreamHandle::AudioInputStreamHandle(
    mojo::PendingRemote<blink::mojom::RendererAudioInputStreamFactoryClient>
        client_pending_remote,
    media::MojoAudioInputStream::CreateDelegateCallback
        create_delegate_callback,
    DeleterCallback deleter_callback)
    : stream_id_(base::UnguessableToken::Create()),
      deleter_callback_(std::move(deleter_callback)),
      client_remote_(std::move(client_pending_remote)),
      stream_(pending_stream_.InitWithNewPipeAndPassReceiver(),
              CreateRemoteAndStoreReceiver(&pending_stream_client_),
              std::move(create_delegate_callback),
              base::BindOnce(&AudioInputStreamHandle::OnCreated,
                             base::Unretained(this)),
              base::BindOnce(&AudioInputStreamHandle::CallDeleter,
                             base::Unretained(this))) {
  // Unretained is safe since |this| owns |stream_| and |client_remote_|.
  DCHECK(client_remote_);
  DCHECK(deleter_callback_);
  client_remote_.set_disconnect_handler(base::BindOnce(
      &AudioInputStreamHandle::CallDeleter, base::Unretained(this)));
}

AudioInputStreamHandle::~AudioInputStreamHandle() {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
}

void AudioInputStreamHandle::SetOutputDeviceForAec(
    const std::string& raw_output_device_id) {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  stream_.SetOutputDeviceForAec(raw_output_device_id);
}

void AudioInputStreamHandle::OnCreated(
    media::mojom::ReadOnlyAudioDataPipePtr data_pipe,
    bool initially_muted) {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  DCHECK(client_remote_);
  DCHECK(deleter_callback_)
      << "|deleter_callback_| was called, but |this| hasn't been destructed!";
  client_remote_->StreamCreated(
      std::move(pending_stream_), std::move(pending_stream_client_),
      std::move(data_pipe), initially_muted, stream_id_);
}

void AudioInputStreamHandle::CallDeleter() {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  DCHECK(deleter_callback_);
  std::move(deleter_callback_).Run(this);
}

}  // namespace content