text:
using System;
using System.IO;
using Aspose.Pdf.Annotations;
using Aspose.Pdf;

namespace Aspose.Pdf.Examples.CSharp.AsposePDF.Bookmarks
{
    public class InheritZoom
    {
        public static void Run()
        {
            // ExStart:InheritZoom
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_Bookmarks();

            // Open document
            Document doc = new Document(dataDir + "input.pdf");

            // Get outlines/bookmarks collection of PDF file
            OutlineItemCollection item = new OutlineItemCollection(doc.Outlines);
            // Set zoom level as 0
            XYZExplicitDestination dest = new XYZExplicitDestination(2, 100, 100, 0);
            // Add XYZExplicitDestination as action to outlines collection of PDF
            item.Action = new GoToAction(dest);
            // Add item to outlines collection of PDF file
            doc.Outlines.Add(item);

            dataDir = dataDir + "InheritZoom_out.pdf";
            // Save output
            doc.Save(dataDir);
            // ExEnd:InheritZoom
            Console.WriteLine("\nBookmarks updated successfully.\nFile saved at " + dataDir);

        }
    }
}


text:
from JumpScale import j

class system_docgenerator(j.code.classGetBase()):

    def __init__(self):
        self._te = {}
        self.actorname = "docgenerator"
        self.appname = "system"

    def getDocForActor(self, actorname, **args):
        apppart, actorpart = actorname.split('__')
        j.core.portal.active.actorsloader.getActor(apppart, actorpart)
        actorjson = {'swaggerVersion': '1.1', 'basePath': '/',
                     'resourcePath': '/%s' % actorname, 'apis': []}
        routes = j.core.portal.active.routes
        for path, route in routes.iteritems():
            (ttype,app, actor, method) = path.split('_')
            if actor == actorname.split('__')[1]:
                methodjson = {'path': '/restmachine/%s/%s/%s' % (app, actor, method), 'description': route[4], 'operations': []}
                operationjson = {'httpMethod': 'GET', 'summary': route[4], 'notes': route[4], 'nickname': method.replace('.', '_')}
                if route[2]:
                    operationjson['parameters'] = list()
                    for paramname, paramdoc in route[2].iteritems():
                        paramjson = {'name': paramname, 'description': paramdoc, 'paramType': 'query',
                                     'required': paramdoc.find('optional') == -1, 'allowMultiple': False, 'dataType': 'string'}
                        operationjson['parameters'].append(paramjson)
                methodjson['operations'].append(operationjson)
                actorjson['apis'].append(methodjson)
        return actorjson

    def prepareCatalog(self, **args):
        catalog = {'swaggerVersion': '1.1', 'basePath': '/restmachine/system/docgenerator/getDocForActor?format=jsonraw&actorname='}
        catalog['apis'] = list()
        if 'actors' in args and args['actors']:
            actors = args['actors'].split(',')
        else:
            actors = j.core.portal.active.getActors()

        for actor in sorted(actors):
            catalog['apis'].append({'path': '%s' % actor})
        return catalog

redpajama_set_name: RedPajamaGithub


text:
@extends('user.layout.layout')
@section('styles')

@endsection

@section('breadcrumbs')

申请成为服务商

@endsection

@section('content')

		                <form action="/user/api/video-upload" type="post" class="sky-form" id="certificationForm">

		                    <fieldset>

					                        选择服务类目

		                                      <select class="parent" name="parent" >

		                                      </select>

					                            <select class="child" name="child">

					                            </select>

			                        简述你可以提供的服务

			                            <textarea name="service_desc" rows="3"></textarea>

提示:

			                        服务团队规模

			                                <input type="radio" name="size" value="one" >1个人
			                                <input type="radio" name="size" value="lessten">10人以内
			                                <input type="radio" value="tenmore" name="size">10人以上

			                        选择服务付费类型

			                                <input value="free" type="radio" name="service_type">在符合我条件的情况下,我可以提供免费服务
			                                <input value="pay" type="radio" name="service-type">无论如何我只提供付费服务

提示:

									所在地

			                                          <select name="province" class="prov">
			                                          </select>

			                                         <select name="city" class="city">
			                                         </select>

			                                      <select name="country" class="dist">
			                                      </select>

提示:

		                    </fieldset>

		                    <fieldset>

			                             真实姓名

                                           <input type="text" name="truename">

		                        	上传认证材料

                                                 <button id="frontuploader" href="javascript:;" style="padding:6px 47px;" class="btn btn-info" type="button"> 上传身份证正面图片</button>

          												<input type="text" name="front_data" style="opacity: 0">

                                                  <button id="backuploader" href="javascript:;" style="padding:6px 47px;" class="btn btn-info" type="button"> 上传身份证反面图片</button>

           												<input type="text" name="back_data" style="opacity: 0">

		                    </fieldset>

		                    	<input type="hidden" name="type" value="service">
		                        <button type="submit" class="btn-u pull-right">提交</button>

		                </form>

@endsection
@section('scripts')

@endsection

@section('jquery')

  ProfileSocial.setPicker();
  ProfileSocial.certificantUpload();
  ProfileSocial.certificantForm();

@endsection


text:
.. -*- coding: utf-8 -*-
.. URL: https://docs.docker.com/get-started/09_image_best/
   doc version: 20.10
      https://github.com/docker/docker.github.io/blob/master/get-started/09_image_best.md
.. check date: 2022/09/20
.. Commits on Aug 17, 2022 f9ea6f2175eb7d693f2fbc8d32dcce4c82354958
.. -----------------------------------------------------------------------------

.. Image-building best practices
.. _image-building-best-practices:

========================================
イメージ構築のベストプラクティス
========================================

.. sidebar:: 目次

   .. contents::
       :depth: 2
       :local:

.. Security scanning
.. _security-scanning:

:ruby:`安全性の検査 <security scanning>`
========================================

.. When you have built an image, it is a good practice to scan it for security vulnerabilities using the docker scan command. Docker has partnered with Snyk to provide the vulnerability scanning service.

イメージの構築時、イメージのセキュリティ脆弱性を :ruby:`検査 <scan>` するために ``docker scan`` コマンドを使うベストプラクティスがあります。Docker は脆弱性検査サービスを提供する `Snyk <https://snyk.io/>`_ と提携しています。

..    Note
    You must be logged in to Docker Hub to scan your images. Run the command docker scan --login, and then scan your images using docker scan <image-name>.

.. note::

   イメージの検査には Docker Hubへのログインが必要です。 ``docker scan --login`` コマンドを実行してから、 ``docker scan <イメージ名>`` を使ってイメージを検査します。

.. For example, to scan the getting-started image you created earlier in the tutorial, you can just type

たとえば、これまでのチュートリアルの始めに作成した ``getting-started`` イメージを検査するには、次のコマンドを実行するだけです。

.. code-block:: dockerfile

   $ docker scan getting-started

.. The scan uses a constantly updated database of vulnerabilities, so the output you see will vary as new vulnerabilities are discovered, but it might look something like this:

検査には定期的に更新される脆弱性データベースを使いますので、様々な新しい脆弱性が発見されたと表示されるでしょう。表示されるのは、以下のようなものです。

.. code-block:: bash

   ✗ Low severity vulnerability found in freetype/freetype
     Description: CVE-2020-15999
     Info: https://snyk.io/vuln/SNYK-ALPINE310-FREETYPE-1019641
     Introduced through: freetype/freetype@2.10.0-r0, gd/libgd@2.2.5-r2
     From: freetype/freetype@2.10.0-r0
     From: gd/libgd@2.2.5-r2 > freetype/freetype@2.10.0-r0
     Fixed in: 2.10.0-r1

   ✗ Medium severity vulnerability found in libxml2/libxml2
     Description: Out-of-bounds Read
     Info: https://snyk.io/vuln/SNYK-ALPINE310-LIBXML2-674791
     Introduced through: libxml2/libxml2@2.9.9-r3, libxslt/libxslt@1.1.33-r3, nginx-module-xslt/nginx-module-xslt@1.17.9-r1
     From: libxml2/libxml2@2.9.9-r3
     From: libxslt/libxslt@1.1.33-r3 > libxml2/libxml2@2.9.9-r3
     From: nginx-module-xslt/nginx-module-xslt@1.17.9-r1 > libxml2/libxml2@2.9.9-r3
     Fixed in: 2.9.9-r4

.. The output lists the type of vulnerability, a URL to learn more, and importantly which version of the relevant library fixes the vulnerability.

出力の一覧には、脆弱性のタイプ、URL には詳細、そして重要な、脆弱性を修正するのに妥当なライブラリのバージョンがあります。

.. There are several other options, which you can read about in the docker scan documentation.

他にもいくつかのオプションがあり、 :doc:`docker scan のドキュメント </engine/scan>` から確認できます。

.. As well as scanning your newly built image on the command line, you can also configure Docker Hub to scan all newly pushed images automatically, and you can then see the results in both Docker Hub and Docker Desktop.

コマンドライン上で新しく構築するイメージを検査するのと同じように、 :doc:`Docker Hub の設定 </docker-hub/vulnerability-scanning>` でも、直近に送信したイメージすべてを自動的に検索できます。そして、その結果は Docker Hub と Docker Desktop の両方で確認できます。

.. image:: ./images/hvs.png
   :scale: 60%
   :alt: Dockre Hub 脆弱性検査

.. Image layering
.. _image-layering:

イメージの :ruby:`階層化 <layering>`
========================================

.. Did you know that you can look at what makes up an image? Using the docker image history command, you can see the command that was used to create each layer within an image.

どのようにしてイメージが構成されたのか、調べる方法があるのを知っていますか。 ``docker image history`` コマンドを使うと、イメージ内の各レイヤーが作成時に使われたコマンドを表示できます。

..    Use the docker image history command to see the layers in the getting-started image you created earlier in the tutorial.

1. ``docker image history`` コマンドを使い、チュートリアルのはじめの方で作成した ``getting-started`` イメージ内のレイヤーを見ます。

   .. code-block:: bash

      $ docker image history getting-started

   .. You should get output that looks something like this (dates/IDs may be different).

   すると、次のような出力が見えるでしょう(日付や ID は異なるでしょう)。

   .. code-block:: bash

      IMAGE               CREATED             CREATED BY                                      SIZE                COMMENT
      a78a40cbf866        18 seconds ago      /bin/sh -c #(nop)  CMD ["node" "src/index.j…    0B
      f1d1808565d6        19 seconds ago      /bin/sh -c yarn install --production            85.4MB
      a2c054d14948        36 seconds ago      /bin/sh -c #(nop) COPY dir:5dc710ad87c789593…   198kB
      9577ae713121        37 seconds ago      /bin/sh -c #(nop) WORKDIR /app                  0B
      b95baba1cfdb        13 days ago         /bin/sh -c #(nop)  CMD ["node"]                 0B
      <missing>           13 days ago         /bin/sh -c #(nop)  ENTRYPOINT ["docker-entry…   0B
      <missing>           13 days ago         /bin/sh -c #(nop) COPY file:238737301d473041…   116B
      <missing>           13 days ago         /bin/sh -c apk add --no-cache --virtual .bui…   5.35MB
      <missing>           13 days ago         /bin/sh -c #(nop)  ENV YARN_VERSION=1.21.1      0B
      <missing>           13 days ago         /bin/sh -c addgroup -g 1000 node     && addu…   74.3MB
      <missing>           13 days ago         /bin/sh -c #(nop)  ENV NODE_VERSION=12.14.1     0B
      <missing>           13 days ago         /bin/sh -c #(nop)  CMD ["/bin/sh"]              0B
      <missing>           13 days ago         /bin/sh -c #(nop) ADD file:e69d441d729412d24…   5.59MB

   .. Each of the lines represents a layer in the image. The display here shows the base at the bottom with the newest layer at the top. Using this, you can also quickly see the size of each layer, helping diagnose large images.

   それぞれの行がイメージ内のレイヤーに相当します。この表示が示すのは、一番下が :ruby:`土台 <base>` となり、最新のレイヤーが一番上にあります。これを使えば、各レイヤーの容量も素早く見られるため、大きなイメージの特定に役立ちます。

.. You'll notice that several of the lines are truncated. If you add the --no-trunc flag, you'll get the full output (yes... funny how you use a truncated flag to get untruncated output, huh?)

2. いくつかの行が :ruby:`省略されている <trancated>` のに気が付くでしょう。 ``--no-trunc`` フラグを使えば、全てを表示できます(それにしても……省略を意味する "trancated" フラグを使って、省略されていない出力をするのは、面白いですね?)。

   .. code-block:: bash

    $ docker image history --no-trunc getting-started

.. Layer caching
.. _layer-caching:

レイヤーのキャッシュ
====================

.. Now that you've seen the layering in action, there's an important lesson to learn to help decrease build times for your container images.

これまでレイヤーがどのようになっているかを見てきました。次は、コンテナ イメージの構築回数を減らすために役立つ、重要な知見を学びます。

.. note::

   .. Once a layer changes, all downstream layers have to be recreated as well

   あるレイヤーを変更すると、 :ruby:`以降に続く <downstream>` 全てのレイヤーも同様に再作成されます。

.. Let's look at the Dockerfile we were using one more time...

それでは、使用していた Dockerfile をもう一度見てみましょう……。

.. code-block:: dockerfile

   # syntax=docker/dockerfile:1
   FROM node:12-alpine
   RUN apk add --no-cache python2 g++ make
   WORKDIR /app
   COPY . .
   RUN yarn install --production
   CMD ["node", "src/index.js"]

.. Going back to the image history output, we see that each command in the Dockerfile becomes a new layer in the image. You might remember that when we made a change to the image, the yarn dependencies had to be reinstalled. Is there a way to fix this? It doesn't make much sense to ship around the same dependencies every time we build, right?

イメージ履歴の出力にさかのぼると、 Dockerfile の各命令が、イメージ内の新しいレイヤーになりました。イメージに変更を加えたとき、yarn の依存関係も再インストールされたのを覚えていますでしょうか。これを修正する方法はないでしょうか。使おうとする度に、毎回同じ依存関係を構築するのはイマイチではないでしょうか?

.. To fix this, we need to restructure our Dockerfile to help support the caching of the dependencies. For Node-based applications, those dependencies are defined in the package.json file. So, what if we copied only that file in first, install the dependencies, and then copy in everything else? Then, we only recreate the yarn dependencies if there was a change to the package.json. Make sense?

これに対応するには、依存関係のキャッシュをサポートするのに役立つように、 Dockerfile を再構成する必要があります。Node をベースとするアプリケーションでは、各依存関係は ``package.json`` ファイルで定義されています。そのため、何よりもまず第一にこのファイルをコピーし、依存関係をインストールし、「それから」他の全てをコピーします。そうすると、 ``package.json`` を変更した時だけ、 yarn の依存関係を再作成します。わかりましたか?

..    Update the Dockerfile to copy in the package.json first, install dependencies, and then copy everything else in.

1.  ``package.json`` ファイルを第一にコピーし、依存関係をインストールし、以降で他に必要な全てのものをコピーするよう、 Docker ファイルを更新します。

   .. code-block:: dockerfile

      # syntax=docker/dockerfile:1
      FROM node:12-alpine
      RUN apk add --no-cache python2 g++ make
      WORKDIR /app
      COPY package.json yarn.lock ./
      RUN yarn install --production
      COPY . .
      CMD ["node", "src/index.js"]

.. Create a file named .dockerignore in the same folder as the Dockerfile with the following contents.

2. Dockerfile と同じディレクトリ内に ``.dockerignore`` という名前でファイルを作成し、内容を以下のようにします。

   ::

      node_modules

   .. .dockerignore files are an easy way to selectively copy only image relevant files. You can read more about this here. In this case, the node_modules folder should be omitted in the second COPY step because otherwise, it would possibly overwrite files which were created by the command in the RUN step. For further details on why this is recommended for Node.js applications and other best practices, have a look at their guide on Dockerizing a Node.js web app.

   イメージに関係あるファイルだけ選んでコピーするには、 ``.dockerignore`` ファイルの利用が簡単です。 :ref:`こちら <dockerignore-file>` で詳しく読めます。今回の場合、2つめの ``COPY`` ステップで ``node_modulers`` フォルダは無視されます。これは、そうしなければ、 ``RUN`` ステップ中の命令で作成されるファイルにより、上書きされる可能性があるためです。どうして Node.js アプリケーションにこのような推奨をするのかや、他のペストプラクティスといった詳細は、Node.js のガイド `Dockerizing a Node.js web app <https://nodejs.org/en/docs/guides/nodejs-docker-webapp/>`_ をご覧ください。

.. Build a new image using docker build.

3. ``docker build`` を使って新しいイメージを構築します。

   .. code-block:: dockerfile

      $ docker build -t getting-started .

   .. You should see output like this...

   次のような出力が見えるでしょう……

   .. code-block:: bash

      Sending build context to Docker daemon  219.1kB
      Step 1/6 : FROM node:12-alpine
      ---> b0dc3a5e5e9e
      Step 2/6 : WORKDIR /app
      ---> Using cache
      ---> 9577ae713121
      Step 3/6 : COPY package.json yarn.lock ./
      ---> bd5306f49fc8
      Step 4/6 : RUN yarn install --production
      ---> Running in d53a06c9e4c2
      yarn install v1.17.3
      [1/4] Resolving packages...
      [2/4] Fetching packages...
      info fsevents@1.2.9: The platform "linux" is incompatible with this module.
      info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
      [3/4] Linking dependencies...
      [4/4] Building fresh packages...
      Done in 10.89s.
      Removing intermediate container d53a06c9e4c2
      ---> 4e68fbc2d704
      Step 5/6 : COPY . .
      ---> a239a11f68d8
      Step 6/6 : CMD ["node", "src/index.js"]
      ---> Running in 49999f68df8f
      Removing intermediate container 49999f68df8f
      ---> e709c03bc597
      Successfully built e709c03bc597
      Successfully tagged getting-started:latest

   .. You'll see that all layers were rebuilt. Perfectly fine since we changed the Dockerfile quite a bit.

   すべてのレイヤーが再構築されるのが見えるでしょう。Dockerfile に少し手を加えただけで、全て完全に作り直されました。

.. Now, make a change to the src/static/index.html file (like change the <title> to say "The Awesome Todo App").

4. 次は ``src/static/index.html`` に変更を加えます( ``<title>`` を「The Awesome Todo App」のように変えます )。

.. Build the Docker image now using docker build -t getting-started . again. This time, your output should look a little different.

5. ``docker build -t getting-started .`` を使って Docker イメージを再構築します。今回は、先ほどとは出力が変わります。

   .. code-block:: bash

      Sending build context to Docker daemon  219.1kB
      Step 1/6 : FROM node:12-alpine
      ---> b0dc3a5e5e9e
      Step 2/6 : WORKDIR /app
      ---> Using cache
      ---> 9577ae713121
      Step 3/6 : COPY package.json yarn.lock ./
      ---> Using cache
      ---> bd5306f49fc8
      Step 4/6 : RUN yarn install --production
      ---> Using cache
      ---> 4e68fbc2d704
      Step 5/6 : COPY . .
      ---> cccde25a3d9a
      Step 6/6 : CMD ["node", "src/index.js"]
      ---> Running in 2be75662c150
      Removing intermediate container 2be75662c150
      ---> 458e5c6f080c
      Successfully built 458e5c6f080c
      Successfully tagged getting-started:latest

   ..   First off, you should notice that the build was MUCH faster! And, you'll see that steps 1-4 all have Using cache. So, hooray! We're using the build cache. Pushing and pulling this image and updates to it will be much faster as well. Hooray!

   まず、かなり構築が早くなったのが分かるでしょう! そして、ステップ1~4がすべて ``Using cache`` (キャッシュを使用中)になっています。やりました! 構築キャッシュを使ったのです。このイメージを更新するための送信や取得が、より早くなりました! やったね!

.. Multi-stage builds
.. _get-started-multi-stage-build:

:ruby:`マルチステージ ビルド <multi-stage build>`
==================================================

.. While we're not going to dive into it too much in this tutorial, multi-stage builds are an incredibly powerful tool to help use multiple stages to create an image. There are several advantages for them:

このチュートリアル内ではあまり深く扱いませんが、イメージ作成時に複数の :ruby:`段階 <stage>` を使える大変強力なツールが :ruby:`マルチステージ ビルド <multi-stage build>` です。いくつかの利点があります。

..    Separate build-time dependencies from runtime dependencies
    Reduce overall image size by shipping only what your app needs to run

* 構築時の依存関係と、実行時の依存関係を分離できる
* アプリケーションが実行に必要なもの「だけ」送るので、イメージ全体の容量を削減できる

.. Maven/Tomcat example
.. _get-started-maven-tomcat-example:

Maven/Tomcat 例
--------------------

.. When building Java-based applications, a JDK is needed to compile the source code to Java bytecode. However, that JDK isn't needed in production. Also, you might be using tools like Maven or Gradle to help build the app. Those also aren't needed in our final image. Multi-stage builds help.

Java をベースとしたアプリケーションの構築時、ソースコードを Java バイトコードにコンパイルするため JDK が必要です。ですが、JDK は本番環境では不要です。また、 Maven や Grandle のようなツールをアプリの構築に使うかもしれません。ですが、これらは最終イメージでは不要です。マルチステージ ビルドは、このような場面で役立ちます。

.. code-block:: dockerfile

   # syntax=docker/dockerfile:1
   FROM maven AS build
   WORKDIR /app
   COPY . .
   RUN mvn package

   FROM tomcat
   COPY --from=build /app/target/file.war /usr/local/tomcat/webapps

.. In this example, we use one stage (called build) to perform the actual Java build using Maven. In the second stage (starting at FROM tomcat), we copy in files from the build stage. The final image is only the last stage being created (which can be overridden using the --target flag).

この例では、1つめのステージ( ``build`` と呼びます)で、実際に Java の構築を Maven を使って処理します。2つめのステージ( ``FROM tomcat`` で始まります)に、 ``build`` ステージからファイルをコピーします。最終イメージには、最後のステージに作成されたものだけです( ``--target`` フラグを使い、上書きできます)。

.. React example
.. _get-started-react-example:

React 例
----------

.. When building React applications, we need a Node environment to compile the JS code (typically JSX), SASS stylesheets, and more into static HTML, JS, and CSS. If we aren't doing server-side rendering, we don't even need a Node environment for our production build. Why not ship the static resources in a static nginx container?

React アプリケーションの構築時、 JS コード(通常は JSC)、SASS スタイルシート、その他 HTML、JS、CSS を Node 環境にコンパイルする必要があります。サーバ側でのレンダリングをしないのであれば、本番環境の構築で Node 環境は不要です。どうして静的なリソースを静的な nginx コンテナに入れないのでしょうか。

.. code-block:: dockerfile

   # syntax=docker/dockerfile:1
   FROM node:12 AS build
   WORKDIR /app
   COPY package* yarn.lock ./
   RUN yarn install
   COPY public ./public
   COPY src ./src
   RUN yarn run build

   FROM nginx:alpine
   COPY --from=build /app/build /usr/share/nginx/html

.. Here, we are using a node:12 image to perform the build (maximizing layer caching) and then copying the output into an nginx container. Cool, huh?

ここでは、 ``node:12`` イメージを使って構築(レイヤーのキャッシュを最大限活用)を処理し、それから出力を nginx コンテナにコピーします。すごいでしょ?

.. Recap
.. _part9-recap:

まとめ
==========

.. By understanding a little bit about how images are structured, we can build images faster and ship fewer changes. Scanning images gives us confidence that the containers we are running and distributing are secure. Multi-stage builds also help us reduce overall image size and increase final container security by separating build-time dependencies from runtime dependencies.

イメージがどのようにして構築されているかを少々学びましたので、ちょっとした変更でも、イメージを早く構築し、送り出せるようになります。イメージの検査によって、コンテナの実行や配布が安全だという信頼性をもたらします。また、マルチステージ ビルドによって、構築時の依存関係と実行時の依存関係を分けられるため、イメージ全体の容量を減らしたり、最終コンテナの安全を高められます。

.. seealso::

   Image-building best practices
      https://docs.docker.com/get-started/09_image_best/


text:
import glob from "glob";
import {PlatformTools} from "../platform/PlatformTools";
import {EntitySchema} from "../index";
import {Logger} from "../logger/Logger";
/**
 * Loads all exported classes from the given directory.
 */
export function importClassesFromDirectories(logger: Logger, directories: string[], formats = [".js", ".cjs", ".ts"]): Function[] {

    const logLevel = "info";
    const classesNotFoundMessage = "No classes were found using the provided glob pattern: ";
    const classesFoundMessage = "All classes found using provided glob pattern";
    function loadFileClasses(exported: any, allLoaded: Function[]) {
        if (typeof exported === "function" || exported instanceof EntitySchema) {
            allLoaded.push(exported);

        } else if (Array.isArray(exported)) {
            exported.forEach((i: any) => loadFileClasses(i, allLoaded));

        } else if (typeof exported === "object" && exported !== null) {
            Object.keys(exported).forEach(key => loadFileClasses(exported[key], allLoaded));

        }
        return allLoaded;
    }

    const allFiles = directories.reduce((allDirs, dir) => {
        return allDirs.concat(glob.sync(PlatformTools.pathNormalize(dir)));
    }, [] as string[]);

    if (directories.length > 0 && allFiles.length === 0) {
        logger.log(logLevel, `${classesNotFoundMessage} "${directories}"`);
    } else if (allFiles.length > 0) {
        logger.log(logLevel, `${classesFoundMessage} "${directories}" : "${allFiles}"`);
    }
    const dirs = allFiles
        .filter(file => {
            const dtsExtension = file.substring(file.length - 5, file.length);
            return formats.indexOf(PlatformTools.pathExtname(file)) !== -1 && dtsExtension !== ".d.ts";
        })
        .map(file => require(PlatformTools.pathResolve(file)));

    return loadFileClasses(dirs, []);
}

/**
 * Loads all json files from the given directory.
 */
export function importJsonsFromDirectories(directories: string[], format = ".json"): any[] {

    const allFiles = directories.reduce((allDirs, dir) => {
        return allDirs.concat(glob.sync(PlatformTools.pathNormalize(dir)));
    }, [] as string[]);

    return allFiles
        .filter(file => PlatformTools.pathExtname(file) === format)
        .map(file => require(PlatformTools.pathResolve(file)));
}


text:
__author__ = 'Taio'

# collections.defaultdict

import collections, itertools

value_to_numeric_map = collections.defaultdict(itertools.count().next)

print value_to_numeric_map['a']
print value_to_numeric_map['b']
print value_to_numeric_map['c']
print value_to_numeric_map['a']
print value_to_numeric_map['b']


text:
SOURCES-y+=twofish.o

include $(CRYPTO_LIB)/build.src.mk


text:
namespace app
{
  class COGLDev41MotionBlurApp : public CApp
  {
    protected:
    ogl::CPointLight* pPointLight;

    ogl::CCamera*           pCamera;
    app::CCameraController* pCameraController;

    ogl::CObject* pObjectP;
    ogl::CObject* pObject0;

    ogl::CMotionBlurRenderer* pRenderer;

    public:
    COGLDev41MotionBlurApp()
    {
      pPointLight       = nullptr;
      pCamera           = nullptr;
      pCameraController = nullptr;
      pObjectP          = nullptr;
      pObject0          = nullptr;
      pRenderer         = nullptr;

      std::cout << "app::COGLDev41MotionBlurApp::COGLDev41MotionBlurApp()" << std::endl;
      mConfig.mOpenGL.mMajor   = 4;
      mConfig.mOpenGL.mMinor   = 2;
      mConfig.mWidth           = 640;
      mConfig.mHeight          = 480;
      strcpy(mConfig.mTitle, "COGLDev41MotionBlurApp");
    }

    protected:
    void onInit()
    {
      std::cout << "app::COGLDev41MotionBlurApp::onInit() " << std::endl;

      init_cameras();

      init_programs();

      init_lights();

      init_objects();

      init_renderers();
    }

    void onDraw(int nTime)
    {
      float fTime = nTime / 1000.0f;
      std::cout << "app::COGLDev41MotionBlurApp::onDraw(nTime) > " << fTime << std::endl;

      CEventManager::getInstance()->trigger(new CUpdateEvent(fTime)); // must

      /////////////////////////////////////////////////////

      pPointLight->mPosition = math::vec3(sin(fTime) * 1.5f, 1.5f, cos(fTime) * 1.5f);

      // TODO: move this in CModelController::update() or something like that
      ogl::CTransformHistory::getInstance()->set(pObject0, ogl::CTransform(pObject0->mScale, pObject0->mOrientation, pObject0->mPosition));
      ogl::CTransformHistory::getInstance()->set(pObjectP, ogl::CTransform(pObjectP->mScale, pObjectP->mOrientation, pObjectP->mPosition));

      // need motion for motion blur to be visible
      pObject0->mPosition = math::vec3(sin(fTime * 2.0f) * 1.5f, 0.0f, cos(fTime * 2.0f) * 1.5f);
      pObjectP->mOrientation = math::quat(sin(fTime * 2.0f) * 90.0f, math::Y);

      /////////////////////////////////////////////////////

      pRenderer->setCamera(pCamera);
      pRenderer->addLight(pPointLight);
      pRenderer->addDrawable(pObjectP);
      pRenderer->addDrawable(pObject0);
      pRenderer->render();

      glCheckError();

      // CApp::exit();
    }

    void onStop()
    {
      std::cout << "app::COGLDev41MotionBlurApp::onStop()" << std::endl;

      _DELETE(pPointLight);

      _DELETE(pCamera);
      _DELETE(pCameraController);

      _DELETE(pRenderer);

      _DELETE(pObjectP);
      _DELETE(pObject0);

      ogl::CProgramManager::freeInstance();
      app::CEventManager::freeInstance();
      ogl::CTransformHistory::freeInstance();
    }

    private:
    void init_lights()
    {
      std::cout << "app::COGLDev41MotionBlurApp::init_lights()" << std::endl;

      pPointLight                    = new ogl::CPointLight;
      pPointLight->mColor            = math::vec3(1.0f, 0.25f, 0.25f);
      pPointLight->mPosition         = math::vec3(2.5f, 2.5f, 2.5f);
      pPointLight->mDiffuseIntensity = 0.8f;
      pPointLight->mAmbientIntensity = 0.2f;
    }

    void init_cameras()
    {
      pCamera           = new ogl::CCamera(math::vec3(0.0f, -1.5f, -3.5f));
      pCameraController = new CCameraController(pCamera);
    }

    void init_programs()
    {
      ogl::CFileShaderBuilder*     pShaderBuilder = new ogl::CFileShaderBuilder;
      ogl::CShaderProgramBuilder* pProgramBuilder = new ogl::CShaderProgramBuilder;
      ogl::CProgramDescriptor* pProgramDescriptor = new ogl::CProgramDescriptor;
      ogl::CProgram*                     pProgram = nullptr;
      ogl::CProgramManager*       pProgramManager = ogl::CProgramManager::getInstance();

      ogl::CShader* pVShader = nullptr;
      ogl::CShader* pFShader = nullptr;

      { // null shader
        std::cout << "> INFO: null_01" << std::endl;

        pShaderBuilder->setType(GL_VERTEX_SHADER);
        pShaderBuilder->setFile("null_01.vs.glsl");
        pVShader = pShaderBuilder->build();
        pShaderBuilder->setType(GL_FRAGMENT_SHADER);
        pShaderBuilder->setFile("null_01.fs.glsl");
        pFShader = pShaderBuilder->build();

        pProgramBuilder->addShader(pVShader);
        pProgramBuilder->addShader(pFShader);

        pProgramBuilder->addUniform("u_mMVP", new ogl::CUniform(GL_FLOAT_MAT4));

        pProgramBuilder->setCallback([](ogl::CRenderer* pRenderer, ogl::CDrawCommand* pDrawCommand) -> void {
          std::cout << "> INFO: running null_01" << std::endl;

          ogl::CForwardRenreder* pForwardRenderer = dynamic_cast<ogl::CForwardRenreder*>(pRenderer);
          ogl::CProgram*      pProgram            = pForwardRenderer->getProgram();
          ogl::CCamera*       pCamera             = pForwardRenderer->getCamera();

          math::mat4 mM = pDrawCommand->mModelMatrix;
          math::mat4 mV = pCamera->getViewMatrix();
          math::mat4 mP = pCamera->getProjectionMatrix();

          pProgram->setUniform("u_mMVP", mP * mV * mM);
        });

        pProgram = pProgramBuilder->build();
        pProgramDescriptor->setRenderingScope(ogl::ERenderingScope::NONE);
        pProgramDescriptor->setDrawStrategyType(ogl::EDrawStrategyType::SINGLE);
        pProgramDescriptor->setShadingMode(ogl::EShadingMode::NONE);
        pProgramDescriptor->setLightingPass(ogl::ELightingPass::NONE);
        pProgramManager->addProgram(*pProgramDescriptor, pProgram);

        delete pVShader; delete pFShader;
      }
      { // simple shader
        std::cout << "> INFO: simple_01" << std::endl;

        pShaderBuilder->setType(GL_VERTEX_SHADER);
        pShaderBuilder->setFile("simple_01.vs.glsl");
        pVShader = pShaderBuilder->build();
        pShaderBuilder->setType(GL_FRAGMENT_SHADER);
        pShaderBuilder->setFile("simple_01.fs.glsl");
        pFShader = pShaderBuilder->build();

        pProgramBuilder->addShader(pVShader);
        pProgramBuilder->addShader(pFShader);

        pProgramBuilder->addUniform("u_mMV",        new ogl::CUniform(GL_FLOAT_MAT4));
        pProgramBuilder->addUniform("u_mP",         new ogl::CUniform(GL_FLOAT_MAT4));
        pProgramBuilder->addUniform("u_bWireframe", new ogl::CUniform(GL_BOOL));

        pProgramBuilder->setCallback([](ogl::CRenderer* pRenderer, ogl::CDrawCommand* pDrawCommand) -> void {
          std::cout << "> INFO: running simple_01" << std::endl;

          ogl::CForwardRenreder* pForwardRenderer = dynamic_cast<ogl::CForwardRenreder*>(pRenderer);
          ogl::CProgram*      pProgram      = pForwardRenderer->getProgram();
          ogl::CCamera*       pCamera       = pForwardRenderer->getCamera();

          math::mat4 mM = pDrawCommand->mModelMatrix;
          math::mat4 mV = pCamera->getViewMatrix();
          math::mat4 mP = pCamera->getProjectionMatrix();

          pProgram->setUniform("u_mMV", mV * mM);
          pProgram->setUniform("u_mP",  mP);

          pProgram->setUniform("u_bWireframe", (bool)(pForwardRenderer->getOptions() & ogl::EDrawOptions::WIREFRAME));
        });

        pProgram = pProgramBuilder->build();
        pProgramDescriptor->setRenderingScope(ogl::ERenderingScope::FORWARD);
        pProgramDescriptor->setDrawStrategyType(ogl::EDrawStrategyType::SINGLE);
        pProgramDescriptor->setShadingMode(ogl::EShadingMode::FLAT);
        pProgramDescriptor->setLightingPass(ogl::ELightingPass::NONE);
        pProgramManager->addProgram(*pProgramDescriptor, pProgram);

        delete pVShader; delete pFShader;
      }
      { // motion blur quad shader
        std::cout << "> INFO: motion_blur_quad" << std::endl;

        pShaderBuilder->setType(GL_VERTEX_SHADER);
        pShaderBuilder->setFile("motion_blur_quad.vs.glsl");
        pVShader = pShaderBuilder->build();
        pShaderBuilder->setType(GL_FRAGMENT_SHADER);
        pShaderBuilder->setFile("motion_blur_quad.fs.glsl");
        pFShader = pShaderBuilder->build();

        pProgramBuilder->addShader(pVShader);
        pProgramBuilder->addShader(pFShader);

        pProgramBuilder->setCallback([](ogl::CRenderer* pRenderer, ogl::CDrawCommand* pDrawCommand) -> void {
          std::cout << "> INFO: running motion_blur_quad" << std::endl;
        });

        pProgram = pProgramBuilder->build();
        pProgramDescriptor->setRenderingScope(ogl::ERenderingScope::MOTION_BLUR);
        pProgramDescriptor->setDrawStrategyType(ogl::EDrawStrategyType::NONE);
        pProgramDescriptor->setShadingMode(ogl::EShadingMode::NONE);
        pProgramDescriptor->setLightingPass(ogl::ELightingPass::NONE);
        pProgramDescriptor->setRenderingOptions((uint)(ogl::ERenderingOptions::NONE));
        pProgramManager->addProgram(*pProgramDescriptor, pProgram);

        delete pVShader; delete pFShader;
      }
      { // motion blur color shader
        std::cout << "> INFO: motion_blur_color" << std::endl;

        pShaderBuilder->setType(GL_VERTEX_SHADER);
        pShaderBuilder->setFile("motion_blur_color.vs.glsl");
        pVShader = pShaderBuilder->build();
        pShaderBuilder->setType(GL_FRAGMENT_SHADER);
        pShaderBuilder->setFile("motion_blur_color.fs.glsl");
        pFShader = pShaderBuilder->build();

        pProgramBuilder->addShader(pVShader);
        pProgramBuilder->addShader(pFShader);

        pProgramBuilder->addUniform("u_mPrevM", new ogl::CUniform(GL_FLOAT_MAT4));
        pProgramBuilder->addUniform("u_mCurrM", new ogl::CUniform(GL_FLOAT_MAT4));
        pProgramBuilder->addUniform("u_mV",     new ogl::CUniform(GL_FLOAT_MAT4));
        pProgramBuilder->addUniform("u_mP",     new ogl::CUniform(GL_FLOAT_MAT4));

        pProgramBuilder->setCallback([](ogl::CRenderer* pRenderer, ogl::CDrawCommand* pDrawCommand) -> void {
          std::cout << "> INFO: running motion_blur_color" << std::endl;
          ogl::CObject*  pObject  = dynamic_cast<ogl::CObject*>(pDrawCommand->mDrawable);
          ogl::CProgram* pProgram = pRenderer->getProgram();
          ogl::CCamera*  pCamera  = pRenderer->getCamera();

          math::mat4 mPrevM = ogl::CTransformHistory::getInstance()->get(pObject).getModelMatrix();
          math::mat4 mCurrM = pDrawCommand->mModelMatrix;
          math::mat4 mV     = pCamera->getViewMatrix();
          math::mat4 mP     = pCamera->getProjectionMatrix();

          pProgram->setUniform("u_mPrevM", mPrevM);
          pProgram->setUniform("u_mCurrM", mCurrM);
          pProgram->setUniform("u_mV",     mV);
          pProgram->setUniform("u_mP",     mP);
        });

        pProgram = pProgramBuilder->build();
        pProgramDescriptor->setRenderingScope(ogl::ERenderingScope::FORWARD);
        pProgramDescriptor->setDrawStrategyType(ogl::EDrawStrategyType::SINGLE);
        pProgramDescriptor->setShadingMode(ogl::EShadingMode::FLAT);
        pProgramDescriptor->setLightingPass(ogl::ELightingPass::NONE);
        pProgramDescriptor->setRenderingOptions((uint)(ogl::ERenderingOptions::MOTION_BLUR));
        pProgramManager->addProgram(*pProgramDescriptor, pProgram);

        delete pVShader; delete pFShader;
      }

      _DELETE(pShaderBuilder);
      _DELETE(pProgramBuilder);
      _DELETE(pProgramDescriptor);
    }

    void init_objects()
    {
      std::cout << "app::COGLDev41MotionBlurApp::init_objects()" << std::endl;
      { // plane
        ogl::CPlaneObjectBuilder* pObjectBuilder = new ogl::CPlaneObjectBuilder;
        pObjectBuilder->setWidth(10.0f);
        pObjectBuilder->setHeight(10.0f);
        pObjectBuilder->setSubdivisions(10);
        pObjectBuilder->setTextureScale(0.5f);
        pObjectBuilder->addOption(ogl::CPlaneObjectBuilder::REPEAT_UV);
        pObjectBuilder->addOption(ogl::CPlaneObjectBuilder::TANGENTS);
        // pObjectBuilder->addOption(ogl::CObjectBuilder::INVERTED);
        pObjectP = pObjectBuilder->build();

        ogl::CTgaTextureBuilder* pTextureBuilder = new ogl::CTgaTextureBuilder;
        pTextureBuilder->setFile("ground/concrete_d.tga");
        pObjectP->getShape(0)->getMaterial()->setTexture(ogl::CTexture::EScope::DIFFUSE, pTextureBuilder->build());
        pTextureBuilder->setFile("ground/concrete_n.tga");
        pObjectP->getShape(0)->getMaterial()->setTexture(ogl::CTexture::EScope::NORMALS, pTextureBuilder->build()); // bump

        // TODO: move this inside CObject or in a CObjectBuilder
        ogl::CTransformHistory::getInstance()->set(pObjectP, ogl::CTransform(pObjectP->mScale, pObjectP->mOrientation, pObjectP->mPosition));

        glExitIfError();

        delete pObjectBuilder;
        delete pTextureBuilder;
      }
      { // boblampclean
        ogl::CMd5ObjectBuilder* pObjectBuilder = new ogl::CMd5ObjectBuilder;
        pObjectBuilder->setFile("boblampclean/boblampclean.md5mesh");
        pObjectBuilder->addOption(ogl::CObjectBuilder::NORMALIZED);
        //pObjectBuilder->addOption(ogl::CObjectBuilder::ADJACENCY); // TODO: unfuck up the MD5 parser
        pObject0 = pObjectBuilder->build();

        // TODO: need better normalization
        pObject0->scale(2.0f);
        pObject0->rotate(math::quat(-90.0f, math::X) * math::quat(180.0f, math::Z));

        // Remember previous transformation
        ogl::CTransformHistory::getInstance()->set(pObject0, ogl::CTransform(pObject0->mScale, pObject0->mOrientation, pObject0->mPosition));

        glExitIfError();

        delete pObjectBuilder;
      }
    }

    void init_renderers()
    {
      std::cout << "app::COGLDev41MotionBlurApp::init_renderers()" << std::endl;

      pRenderer = new ogl::CMotionBlurRenderer(mConfig.mWidth, mConfig.mHeight);
    }
  };
}

#endif // __APP_COGLDEV41MOTIONBLURAPP_HPP__


text:
@extends('admin.layouts.modal') @section('content')

{{
			Lang::get("admin/modal.general") }}

<form id="deleteForm" class="form-horizontal" method="post"
	action="@if (isset($user)){{ URL::to('admin/users/' . $user->id . '/delete') }}@endif"
	autocomplete="off">

	<input type="hidden" name="_token" value="{{{ csrf_token() }}}" /> <input
		type="hidden" name="id" value="{{ $user->id }}" />

			{{ Lang::get("admin/modal.delete_message") }}

			<element class="btn btn-warning btn-sm close_popup">
			 {{
			Lang::get("admin/modal.cancel") }}</element>
			<button type="submit" class="btn btn-sm btn-danger">
				 {{
				Lang::get("admin/modal.delete") }}
			</button>

</form>
@stop


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

    <title>Room362.com</title>
    <meta name="description" content="Blathering of a security addict" />

    <meta name="HandheldFriendly" content="True" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <link rel="shortcut icon" href="//blog.room362.com/themes/ichi/favicon.ico">

    <link rel="stylesheet" type="text/css" href="//blog.room362.com/themes/ichi/assets/css/normalize.css?v=1.0.0" />
    <link rel="stylesheet" type="text/css" href="//blog.room362.com/themes/ichi/assets/css/foundation.min.css?v=1.0.0" />

    <link rel="stylesheet" type="text/css" href="//blog.room362.com/themes/ichi/assets/fonts/foundation-icons/foundation-icons.css?v=1.0.0" />
    <link rel="stylesheet" type="text/css" href="//blog.room362.com/themes/ichi/assets/css/styles.css?v=1.0.0" />
    <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans:300,700,400|Source+Sans+Pro:300,400,600,700,900,300italic,400italic,600italic,700italic,900italic" />

    <link rel="canonical" href="http://blog.room362.com" />
    <link rel="next" href="http://blog.room362.com/page/2/" />
    <meta name="generator" content="Ghost ?" />
    <link rel="alternate" type="application/rss+xml" title="Room362.com" href="http://blog.room362.com/rss" />
    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/default.min.css">

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

    <button type="button" class="overlay-close">Close</button>

Home

Room362.com

Blathering of a security addict

            <time datetime="2015-02-17">17 Feb 2015</time>

pfSense without Internets

A while back I needed to set up a pfSense box for CTF/example stuff that didn’t and wouldn’t ever have Internet connectivity. Doesn’t seem like much of a task right? Just pop it in and go. Problem is that you loose the use of the packages that help make pfSense so awesome. Once I figured it out at that time, I made a Forum post so that anyone running into the same issue wouldn&#…

        Read more
        Posted on howto,  pfsense

            <time datetime="2015-01-13">13 Jan 2015</time>

2015 ShmooCon Hiring

It’s often tough from both hiring and job hunters to find one another at conferences. I think this is mostly because of a couple things. No one wants to stand at a both on either side and talk job stuff in front of a bunch of people and people at booths rarely get the chance to get away. It’s hard to know "who" to talk to. So I created a very simple Google doc to help put twitter hand…

        Read more
        Posted on shmoocon,  community

            <time datetime="2015-01-12">12 Jan 2015</time>

Powershell Popups + Capture

Metasploit Minute has entered into it’s 3rd "season". And we kick it off with using the Metasploit capture modules to capture creds from this powershell popup. The cool thing about this is you can leave it to execute on a system without any other code on disk and get creds constantly as any level of user. No admin, no UAC bypass needed. Just a bunch of creds for free.. over SSL. ;-) Here is…

        Read more
        Posted on powershell,  metasploit,  creds,  howto

            <time datetime="2014-09-15">15 Sep 2014</time>

Full Disclosure - SingleClick Connect

Update: I originally posted this to the Full Disclosure mailing list but for some reason it wasn’t accepted via the moderator so I’m posting it here. First, so that the information does get out there, and second to see if anyone knows why it may have been rejected. I was helping out a family member with their computer when it came up that they "already had remote help software" (Singl…

        Read more
        Posted on full disclosure,  singleclick

            <time datetime="2014-09-09">09 Sep 2014</time>

OSX Persistence via PHP Webshell

As I learn more and more about OSX I find things that surprise me. For instance, in this post I will be showing you how to, with root or sudo priviledge, enable the built-in apache server on OSX and it’s PHP module…. I am working with OSX Mavericks so your locations may vary based on the version of OSX your target it. First things first is to enable the PHP module for the Apach…

        Read more
        Posted on osx,  persistence,  php,  howto,  webshell

    Page 1 of 4

Proudly published with HubPress

All content copyright Room362.com © 2015

Theme (download here) developed by Alexis Degryse


text:
package patterns.settings.item;

/**
 * Use this class to notify exceptions related to ItemService.
 *
 * @author Ruben
 * @since 5/6/2015
 */
@SuppressWarnings("UnusedDeclaration")
public class ItemServiceException extends RuntimeException {

	public ItemServiceException(String message) {
		super(message);
	}

	public ItemServiceException(String message, Object... params) {
		super(String.format(message, params));
	}

	public ItemServiceException(Throwable throwable, String message) {
		super(message, throwable);
	}

	public ItemServiceException(Throwable throwable, String message, Object... params) {
		super(String.format(message, params), throwable);
	}
}


text:
import { Arch } from "../metadata"
import { smarten, TargetEx } from "../platformPackager"
import { use, exec } from "../util/util"
import * as path from "path"
import { getBin } from "../util/binDownload"
import {  readFile, outputFile } from "fs-extra-p"
import BluebirdPromise from "bluebird-lst-c"
import { LinuxTargetHelper, installPrefix } from "./LinuxTargetHelper"
import * as errorMessages from "../errorMessages"
import { TmpDir } from "../util/tmp"
import { LinuxPackager } from "../linuxPackager"

const template = require("lodash.template")

const fpmPath = (process.platform === "win32" || process.env.USE_SYSTEM_FPM === "true") ?
  BluebirdPromise.resolve("fpm") : downloadFpm()

// can be called in parallel, all calls for the same version will get the same promise - will be downloaded only once
function downloadFpm(): Promise<string> {
  const version = process.platform === "darwin" ? "fpm-1.6.3-20150715-2.2.2" : "fpm-1.6.3-2.3.1"
  const osAndArch = process.platform === "darwin" ? "mac" : `linux-x86${process.arch === "ia32" ? "" : "_64"}`
  //noinspection SpellCheckingInspection
  const sha2 = process.platform === "darwin" ? "1b13080ecfd2b6fddb984ed6e1dfcb38cdf5b051a04d609c2a95227ed9a5ecbc" :
    (process.arch === "ia32" ? "b55f25749a27097140171f073466c52e59f733a275fea99e2334c540627ffc62" : "4c6fc529e996f7ff850da2d0bb6c85080e43be672494b14c0c6bdcc03bf57328")

  return getBin("fpm", version, `https://dl.bintray.com/electron-userland/bin/${version}-${osAndArch}.7z`, sha2)
    .then(it => path.join(it, "fpm"))
}

export default class FpmTarget extends TargetEx {
  private readonly options = Object.assign({}, this.packager.platformSpecificBuildOptions, (<any>this.packager.devMetadata.build)[this.name])

  private readonly scriptFiles: Promise<Array<string>>
  private readonly desktopEntry: Promise<string>

  constructor(name: string, private packager: LinuxPackager, private helper: LinuxTargetHelper, private outDir: string) {
    super(name)

    this.scriptFiles = this.createScripts()
    this.desktopEntry = helper.computeDesktopEntry(this.options)
  }

  private async createScripts(): Promise<Array<string>> {
    const defaultTemplatesDir = path.join(__dirname, "..", "..", "templates", "linux")

    const packager = this.packager
    const templateOptions = Object.assign({
      // old API compatibility
      executable: this.packager.executableName,
    }, packager.platformSpecificBuildOptions)

    function getResource(value: string | n, defaultFile: string) {
      if (value == null) {
        return path.join(defaultTemplatesDir, defaultFile)
      }
      return path.resolve(packager.projectDir, value)
    }

    const afterInstallFilePath = writeConfigFile(packager.info.tempDirManager, getResource(packager.platformSpecificBuildOptions.afterInstall, "after-install.tpl"), templateOptions)
    const afterRemoveFilePath = writeConfigFile(packager.info.tempDirManager, getResource(packager.platformSpecificBuildOptions.afterRemove, "after-remove.tpl"), templateOptions)

    return await BluebirdPromise.all<string>([afterInstallFilePath, afterRemoveFilePath])
  }

  async build(appOutDir: string, arch: Arch): Promise<any> {
    const target = this.name
    const destination = path.join(this.outDir, this.packager.generateName(target, arch, true /* on Linux we use safe name — without space */))

    const scripts = await this.scriptFiles
    const packager = this.packager
    const appInfo = packager.appInfo

    const projectUrl = await appInfo.computePackageUrl()
    if (projectUrl == null) {
      throw new Error("Please specify project homepage, see https://github.com/electron-userland/electron-builder/wiki/Options#AppMetadata-homepage")
    }

    const options = this.options
    let author = options.maintainer
    if (author == null) {
      const a = appInfo.metadata.author!
      if (a.email == null) {
        throw new Error(errorMessages.authorEmailIsMissed)
      }
      author = `${a.name} <${a.email}>`
    }

    const synopsis = options.synopsis
    const args = [
      "-s", "dir",
      "-t", target,
      "--architecture", arch === Arch.ia32 ? "i386" : (arch === Arch.x64 ? "amd64" : "armv7l"),
      "--name", appInfo.name,
      "--force",
      "--after-install", scripts[0],
      "--after-remove", scripts[1],
      "--description", smarten(target === "rpm" ? options.description! : `${synopsis || ""}\n ${options.description}`),
      "--maintainer", author,
      "--vendor", options.vendor || author,
      "--version", appInfo.version,
      "--package", destination,
      "--url", projectUrl,
    ]

    const packageCategory = options.packageCategory
    if (packageCategory != null && packageCategory !== null) {
      args.push("--category", packageCategory)
    }

    if (target === "deb") {
      args.push("--deb-compression", options.compression || (packager.devMetadata.build.compression === "store" ? "gz" : "xz"))
    }
    else if (target === "rpm") {
      // args.push("--rpm-compression", options.compression || (this.devMetadata.build.compression === "store" ? "none" : "xz"))
      args.push("--rpm-os", "linux")

      if (synopsis != null) {
        args.push("--rpm-summary", smarten(synopsis))
      }
    }

    let depends = options.depends
    if (depends == null) {
      if (target === "deb") {
        depends = ["libappindicator1", "libnotify-bin"]
      }
      else {
        depends = []
      }
    }
    else if (!Array.isArray(depends)) {
      if (typeof depends === "string") {
        depends = [<string>depends]
      }
      else {
        throw new Error(`depends must be Array or String, but specified as: ${depends}`)
      }
    }

    for (let dep of depends) {
      args.push("--depends", dep)
    }

    use(packager.appInfo.metadata.license || packager.devMetadata.license, it => args.push("--license", it!))
    use(appInfo.buildNumber, it => args.push("--iteration", it!))

    use(options.fpm, it => args.push(...<any>it))

    args.push(`${appOutDir}/=${installPrefix}/${appInfo.productFilename}`)
    for (let mapping of (await this.helper.icons)) {
      args.push(mapping.join("=/usr/share/icons/hicolor/"))
    }

    args.push(`${await this.desktopEntry}=/usr/share/applications/${appInfo.productFilename}.desktop`)

    await exec(await fpmPath, args)

    this.packager.dispatchArtifactCreated(destination)
  }
}

async function writeConfigFile(tmpDir: TmpDir, templatePath: string, options: any): Promise<string> {
  const config = template(await readFile(templatePath, "utf8"),
    {
      // set interpolate explicitly to avoid troubles with templating of installer.nsi.tpl
      interpolate: /<%=([\s\S]+?)%>/g
    })(options)

  const outputPath = await tmpDir.getTempFile(path.basename(templatePath, ".tpl"))
  await outputFile(outputPath, config)
  return outputPath
}


text:
/****************************************************************************
 * Included Files
 ****************************************************************************/

#include <nuttx/config.h>

#include <stdio.h>
#include <string.h>
#include <ctype.h>

#include "fsutils/passwd.h"

#include "nsh.h"
#include "nsh_console.h"

#ifdef CONFIG_NSH_TELNET_LOGIN

/****************************************************************************
 * Pre-processor Definitions
 ****************************************************************************/

#define TELNET_IAC              255
#define TELNET_WILL             251
#define TELNET_WONT             252
#define TELNET_DO               253
#define TELNET_DONT             254
#define TELNET_USE_ECHO         1
#define TELNET_NOTUSE_ECHO      0

/****************************************************************************
 * Private Functions
 ****************************************************************************/

/****************************************************************************
 * Name: nsh_telnetecho
 ****************************************************************************/

static void nsh_telnetecho(FAR struct console_stdio_s *pstate,
                           uint8_t is_use)
{
  uint8_t optbuf[4];
  optbuf[0] = TELNET_IAC;
  optbuf[1] = (is_use == TELNET_USE_ECHO) ? TELNET_WILL : TELNET_DO;
  optbuf[2] = 1;
  optbuf[3] = 0;
  fputs((char *)optbuf, pstate->cn_outstream);
  fflush(pstate->cn_outstream);
}

/****************************************************************************
 * Name: nsh_telnettoken
 ****************************************************************************/

static void nsh_telnettoken(FAR struct console_stdio_s *pstate,
                            FAR char *buffer, size_t buflen)
{
  FAR char *start;
  FAR char *endp1;
  bool quoted = false;

  /* Find the start of token.  Either (1) the first non-white space
   * character on the command line or (2) the character immediately after
   * a quotation mark.
   */

  for (start = pstate->cn_line; *start; start++)
    {
      /* Does the token open with a quotation mark */

      if (*start == '"')
        {
          /* Yes.. break out with start set to the character after the
           * quotation mark.
           */

          quoted = true;
          start++;
          break;
        }

      /* No, then any non-whitespace is the first character of the token */

      else if (!isspace(*start))
        {
          /* Break out with start set to the first character of the token */

          break;
        }
    }

  /* Find the terminating character after the token on the command line.  The
   * terminating character is either (1) the matching quotation mark, or (2)
   * any whitespace.
   */

  for (endp1 = start; *endp1; endp1++)
    {
      /* Did the token begin with a quotation mark? */

      if (quoted)
        {
          /* Yes.. then only the matching quotation mark (or end of string)
           * terminates
           */

          if (*endp1 == '"')
            {
              /* Break out... endp1 points to closing quotation mark */

              break;
            }
        }

      /* No.. any whitespace (or end of string) terminates */

      else if (isspace(*endp1))
        {
          /* Break out... endp1 points to first while space encountered */

           break;
        }
    }

  /* Replace terminating character with a NUL terminator */

  *endp1 = '\0';

  /* Copied the token into the buffer */

  strncpy(buffer, start, buflen);
}

/****************************************************************************
 * Public Functions
 ****************************************************************************/

/****************************************************************************
 * Name: nsh_telnetlogin
 ****************************************************************************/

int nsh_telnetlogin(FAR struct console_stdio_s *pstate)
{
  char username[16];
  char password[16];
  int i;

  /* Present the NSH Telnet greeting */

  fputs(g_telnetgreeting, pstate->cn_outstream);
  fflush(pstate->cn_outstream);

  /* Loop for the configured number of retries */

  for (i = 0; i < CONFIG_NSH_LOGIN_FAILCOUNT; i++)
    {
      /* Ask for the login username */

      fputs(g_userprompt, pstate->cn_outstream);
      fflush(pstate->cn_outstream);

      username[0] = '\0';
      if (fgets(pstate->cn_line, CONFIG_NSH_LINELEN,
                INSTREAM(pstate)) != NULL)
        {
          /* Parse out the username */

          nsh_telnettoken(pstate, username, sizeof(username));
        }

      /* Ask for the login password */

      fputs(g_passwordprompt, pstate->cn_outstream);
      fflush(pstate->cn_outstream);
      nsh_telnetecho(pstate, TELNET_NOTUSE_ECHO);

      password[0] = '\0';
      if (fgets(pstate->cn_line, CONFIG_NSH_LINELEN,
                INSTREAM(pstate)) != NULL)
        {
          /* Parse out the password */

          nsh_telnettoken(pstate, password, sizeof(password));

          /* Verify the username and password */

#if defined(CONFIG_NSH_LOGIN_PASSWD)
          if (PASSWORD_VERIFY_MATCH(passwd_verify(username, password)))
#elif defined(CONFIG_NSH_LOGIN_PLATFORM)
          if (PASSWORD_VERIFY_MATCH(platform_user_verify(username,
                                                         password)))
#elif defined(CONFIG_NSH_LOGIN_FIXED)
          if (strcmp(password, CONFIG_NSH_LOGIN_PASSWORD) == 0 &&
              strcmp(username, CONFIG_NSH_LOGIN_USERNAME) == 0)
#else
#  error No user verification method selected
#endif
            {
              fputs(g_loginsuccess, pstate->cn_outstream);
              fflush(pstate->cn_outstream);
              nsh_telnetecho(pstate, TELNET_USE_ECHO);
              return OK;
            }
          else
            {
              fputs(g_badcredentials, pstate->cn_outstream);
              fflush(pstate->cn_outstream);
#if CONFIG_NSH_LOGIN_FAILDELAY > 0
              usleep(CONFIG_NSH_LOGIN_FAILDELAY * 1000L);
#endif
            }
        }

      nsh_telnetecho(pstate, TELNET_USE_ECHO);
    }

  /* Too many failed login attempts */

  fputs(g_loginfailure, pstate->cn_outstream);
  fflush(pstate->cn_outstream);
  return -1;
}

#endif /* CONFIG_NSH_TELNET_LOGIN */


text:
Pokemon Showdown Development Bot
================================

This bot receives commit data from GitHub, and posts in the Showdown chat.

It can be configured using `npm config set psdevbot:PROPERTY_NAME`. There are
properties that can be configured for a bot.

-   `nickname` - specifies nickname used for the bot on Showdown
-   `password` - specifies password of given account
-   `room` - specifies room to join
-   `secret` - secret specified during webhook creation. To generate one, use
    `ruby -rsecurerandom -e 'puts SecureRandom.hex(20)'` command.
-   `webhookport` - port on which bot listens (default 3420)
-   `server` - server address (default sim.smogon.com)
-   `serverport` - server port (default 8000)
-   `serverid` - server identifier used for logins (default showdown)

To set repository to trigger bot, access settings panel, pick "Webhooks
& Services", select "Add webhook", set payload URL to
`http://bot-hosting-url.example:3420/github/callback`, leave content type as
`application/json`, set secret to specified value, and pick "Push" and
"Pull Request" events as events to react to.

To run the bot, use `npm start`.


text:
from glance.api.v2 import image_data
from glance.api.v2 import image_members
from glance.api.v2 import image_tags
from glance.api.v2 import images
from glance.api.v2 import metadef_namespaces
from glance.api.v2 import metadef_objects
from glance.api.v2 import metadef_properties
from glance.api.v2 import metadef_resource_types
from glance.api.v2 import schemas
from glance.api.v2 import tasks
from glance.common import wsgi

class API(wsgi.Router):

    """WSGI router for Glance v2 API requests."""

    def __init__(self, mapper):
        custom_image_properties = images.load_custom_properties()
        reject_method_resource = wsgi.Resource(wsgi.RejectMethodController())

        schemas_resource = schemas.create_resource(custom_image_properties)
        mapper.connect('/schemas/image',
                       controller=schemas_resource,
                       action='image',
                       conditions={'method': ['GET']})
        mapper.connect('/schemas/image',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET',
                       conditions={'method': ['POST', 'PUT', 'DELETE',
                                              'PATCH', 'HEAD']})
        mapper.connect('/schemas/images',
                       controller=schemas_resource,
                       action='images',
                       conditions={'method': ['GET']})
        mapper.connect('/schemas/images',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET',
                       conditions={'method': ['POST', 'PUT', 'DELETE',
                                              'PATCH', 'HEAD']})
        mapper.connect('/schemas/member',
                       controller=schemas_resource,
                       action='member',
                       conditions={'method': ['GET']})
        mapper.connect('/schemas/member',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET',
                       conditions={'method': ['POST', 'PUT', 'DELETE',
                                              'PATCH', 'HEAD']})

        mapper.connect('/schemas/members',
                       controller=schemas_resource,
                       action='members',
                       conditions={'method': ['GET']})
        mapper.connect('/schemas/members',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET',
                       conditions={'method': ['POST', 'PUT', 'DELETE',
                                              'PATCH', 'HEAD']})

        mapper.connect('/schemas/task',
                       controller=schemas_resource,
                       action='task',
                       conditions={'method': ['GET']})
        mapper.connect('/schemas/task',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET',
                       conditions={'method': ['POST', 'PUT', 'DELETE',
                                              'PATCH', 'HEAD']})
        mapper.connect('/schemas/tasks',
                       controller=schemas_resource,
                       action='tasks',
                       conditions={'method': ['GET']})
        mapper.connect('/schemas/tasks',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET',
                       conditions={'method': ['POST', 'PUT', 'DELETE',
                                              'PATCH', 'HEAD']})

        mapper.connect('/schemas/metadefs/namespace',
                       controller=schemas_resource,
                       action='metadef_namespace',
                       conditions={'method': ['GET']})
        mapper.connect('/schemas/metadefs/namespace',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET',
                       conditions={'method': ['POST', 'PUT', 'DELETE',
                                              'PATCH', 'HEAD']})

        mapper.connect('/schemas/metadefs/namespaces',
                       controller=schemas_resource,
                       action='metadef_namespaces',
                       conditions={'method': ['GET']})
        mapper.connect('/schemas/metadefs/namespaces',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET',
                       conditions={'method': ['POST', 'PUT', 'DELETE',
                                              'PATCH', 'HEAD']})

        mapper.connect('/schemas/metadefs/resource_type',
                       controller=schemas_resource,
                       action='metadef_resource_type',
                       conditions={'method': ['GET']})
        mapper.connect('/schemas/metadefs/resource_type',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET',
                       conditions={'method': ['POST', 'PUT', 'DELETE',
                                              'PATCH', 'HEAD']})

        mapper.connect('/schemas/metadefs/resource_types',
                       controller=schemas_resource,
                       action='metadef_resource_types',
                       conditions={'method': ['GET']})
        mapper.connect('/schemas/metadefs/resource_types',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET',
                       conditions={'method': ['POST', 'PUT', 'DELETE',
                                              'PATCH', 'HEAD']})

        mapper.connect('/schemas/metadefs/property',
                       controller=schemas_resource,
                       action='metadef_property',
                       conditions={'method': ['GET']})
        mapper.connect('/schemas/metadefs/property',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET',
                       conditions={'method': ['POST', 'PUT', 'DELETE',
                                              'PATCH', 'HEAD']})

        mapper.connect('/schemas/metadefs/properties',
                       controller=schemas_resource,
                       action='metadef_properties',
                       conditions={'method': ['GET']})
        mapper.connect('/schemas/metadefs/properties',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET',
                       conditions={'method': ['POST', 'PUT', 'DELETE',
                                              'PATCH', 'HEAD']})

        mapper.connect('/schemas/metadefs/object',
                       controller=schemas_resource,
                       action='metadef_object',
                       conditions={'method': ['GET']})
        mapper.connect('/schemas/metadefs/object',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET',
                       conditions={'method': ['POST', 'PUT', 'DELETE',
                                              'PATCH', 'HEAD']})

        mapper.connect('/schemas/metadefs/objects',
                       controller=schemas_resource,
                       action='metadef_objects',
                       conditions={'method': ['GET']})
        mapper.connect('/schemas/metadefs/objects',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET',
                       conditions={'method': ['POST', 'PUT', 'DELETE',
                                              'PATCH', 'HEAD']})

        # Metadef resource types
        metadef_resource_types_resource = (
            metadef_resource_types.create_resource())

        mapper.connect('/metadefs/resource_types',
                       controller=metadef_resource_types_resource,
                       action='index',
                       conditions={'method': ['GET']})
        mapper.connect('/metadefs/resource_types',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET',
                       conditions={'method': ['POST', 'PUT', 'DELETE',
                                              'PATCH', 'HEAD']})

        mapper.connect('/metadefs/namespaces/{namespace}/resource_types',
                       controller=metadef_resource_types_resource,
                       action='show',
                       conditions={'method': ['GET']})
        mapper.connect('/metadefs/namespaces/{namespace}/resource_types',
                       controller=metadef_resource_types_resource,
                       action='create',
                       conditions={'method': ['POST']})
        mapper.connect('/metadefs/namespaces/{namespace}/resource_types',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET, POST',
                       conditions={'method': ['PUT', 'DELETE',
                                              'PATCH', 'HEAD']})

        mapper.connect('/metadefs/namespaces/{namespace}/resource_types/'
                       '{resource_type}',
                       controller=metadef_resource_types_resource,
                       action='delete',
                       conditions={'method': ['DELETE']})
        mapper.connect('/metadefs/namespaces/{namespace}/resource_types/'
                       '{resource_type}',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='DELETE',
                       conditions={'method': ['GET', 'POST', 'PUT',
                                              'PATCH', 'HEAD']})

        # Metadef Namespaces
        metadef_namespace_resource = metadef_namespaces.create_resource()
        mapper.connect('/metadefs/namespaces',
                       controller=metadef_namespace_resource,
                       action='index',
                       conditions={'method': ['GET']})
        mapper.connect('/metadefs/namespaces',
                       controller=metadef_namespace_resource,
                       action='create',
                       conditions={'method': ['POST']})
        mapper.connect('/metadefs/namespaces',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET, POST',
                       conditions={'method': ['PUT', 'DELETE',
                                              'PATCH', 'HEAD']})

        mapper.connect('/metadefs/namespaces/{namespace}',
                       controller=metadef_namespace_resource,
                       action='show',
                       conditions={'method': ['GET']})
        mapper.connect('/metadefs/namespaces/{namespace}',
                       controller=metadef_namespace_resource,
                       action='update',
                       conditions={'method': ['PUT']})
        mapper.connect('/metadefs/namespaces/{namespace}',
                       controller=metadef_namespace_resource,
                       action='delete',
                       conditions={'method': ['DELETE']})
        mapper.connect('/metadefs/namespaces/{namespace}',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET, PUT, DELETE',
                       conditions={'method': ['POST', 'PATCH', 'HEAD']})

        # Metadef namespace properties
        metadef_properties_resource = metadef_properties.create_resource()
        mapper.connect('/metadefs/namespaces/{namespace}/properties',
                       controller=metadef_properties_resource,
                       action='index',
                       conditions={'method': ['GET']})
        mapper.connect('/metadefs/namespaces/{namespace}/properties',
                       controller=metadef_properties_resource,
                       action='create',
                       conditions={'method': ['POST']})
        mapper.connect('/metadefs/namespaces/{namespace}/properties',
                       controller=metadef_namespace_resource,
                       action='delete_properties',
                       conditions={'method': ['DELETE']})
        mapper.connect('/metadefs/namespaces/{namespace}/properties',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET, POST, DELETE',
                       conditions={'method': ['PUT', 'PATCH', 'HEAD']})

        mapper.connect('/metadefs/namespaces/{namespace}/properties/{'
                       'property_name}',
                       controller=metadef_properties_resource,
                       action='show',
                       conditions={'method': ['GET']})
        mapper.connect('/metadefs/namespaces/{namespace}/properties/{'
                       'property_name}',
                       controller=metadef_properties_resource,
                       action='update',
                       conditions={'method': ['PUT']})
        mapper.connect('/metadefs/namespaces/{namespace}/properties/{'
                       'property_name}',
                       controller=metadef_properties_resource,
                       action='delete',
                       conditions={'method': ['DELETE']})
        mapper.connect('/metadefs/namespaces/{namespace}/properties/{'
                       'property_name}',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET, PUT, DELETE',
                       conditions={'method': ['POST', 'PATCH', 'HEAD']})

        # Metadef objects
        metadef_objects_resource = metadef_objects.create_resource()
        mapper.connect('/metadefs/namespaces/{namespace}/objects',
                       controller=metadef_objects_resource,
                       action='index',
                       conditions={'method': ['GET']})
        mapper.connect('/metadefs/namespaces/{namespace}/objects',
                       controller=metadef_objects_resource,
                       action='create',
                       conditions={'method': ['POST']})
        mapper.connect('/metadefs/namespaces/{namespace}/objects',
                       controller=metadef_namespace_resource,
                       action='delete_objects',
                       conditions={'method': ['DELETE']})
        mapper.connect('/metadefs/namespaces/{namespace}/objects',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET, POST, DELETE',
                       conditions={'method': ['PUT', 'PATCH', 'HEAD']})

        mapper.connect('/metadefs/namespaces/{namespace}/objects/{'
                       'object_name}',
                       controller=metadef_objects_resource,
                       action='show',
                       conditions={'method': ['GET']})
        mapper.connect('/metadefs/namespaces/{namespace}/objects/{'
                       'object_name}',
                       controller=metadef_objects_resource,
                       action='update',
                       conditions={'method': ['PUT']})
        mapper.connect('/metadefs/namespaces/{namespace}/objects/{'
                       'object_name}',
                       controller=metadef_objects_resource,
                       action='delete',
                       conditions={'method': ['DELETE']})
        mapper.connect('/metadefs/namespaces/{namespace}/objects/{'
                       'object_name}',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET, PUT, DELETE',
                       conditions={'method': ['POST', 'PATCH', 'HEAD']})

        images_resource = images.create_resource(custom_image_properties)
        mapper.connect('/images',
                       controller=images_resource,
                       action='index',
                       conditions={'method': ['GET']})
        mapper.connect('/images',
                       controller=images_resource,
                       action='create',
                       conditions={'method': ['POST']})
        mapper.connect('/images',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET, POST',
                       conditions={'method': ['PUT', 'DELETE', 'PATCH',
                                              'HEAD']})

        mapper.connect('/images/{image_id}',
                       controller=images_resource,
                       action='update',
                       conditions={'method': ['PATCH']})
        mapper.connect('/images/{image_id}',
                       controller=images_resource,
                       action='show',
                       conditions={'method': ['GET']})
        mapper.connect('/images/{image_id}',
                       controller=images_resource,
                       action='delete',
                       conditions={'method': ['DELETE']})
        mapper.connect('/images/{image_id}',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET, PATCH, DELETE',
                       conditions={'method': ['POST', 'PUT', 'HEAD']})

        image_data_resource = image_data.create_resource()
        mapper.connect('/images/{image_id}/file',
                       controller=image_data_resource,
                       action='download',
                       conditions={'method': ['GET']})
        mapper.connect('/images/{image_id}/file',
                       controller=image_data_resource,
                       action='upload',
                       conditions={'method': ['PUT']})
        mapper.connect('/images/{image_id}/file',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET, PUT',
                       conditions={'method': ['POST', 'DELETE', 'PATCH',
                                              'HEAD']})

        image_tags_resource = image_tags.create_resource()
        mapper.connect('/images/{image_id}/tags/{tag_value}',
                       controller=image_tags_resource,
                       action='update',
                       conditions={'method': ['PUT']})
        mapper.connect('/images/{image_id}/tags/{tag_value}',
                       controller=image_tags_resource,
                       action='delete',
                       conditions={'method': ['DELETE']})
        mapper.connect('/images/{image_id}/tags/{tag_value}',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='PUT, DELETE',
                       conditions={'method': ['GET', 'POST', 'PATCH',
                                              'HEAD']})

        image_members_resource = image_members.create_resource()
        mapper.connect('/images/{image_id}/members',
                       controller=image_members_resource,
                       action='index',
                       conditions={'method': ['GET']})
        mapper.connect('/images/{image_id}/members',
                       controller=image_members_resource,
                       action='create',
                       conditions={'method': ['POST']})
        mapper.connect('/images/{image_id}/members',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET, POST',
                       conditions={'method': ['PUT', 'DELETE', 'PATCH',
                                              'HEAD']})

        mapper.connect('/images/{image_id}/members/{member_id}',
                       controller=image_members_resource,
                       action='show',
                       conditions={'method': ['GET']})
        mapper.connect('/images/{image_id}/members/{member_id}',
                       controller=image_members_resource,
                       action='update',
                       conditions={'method': ['PUT']})
        mapper.connect('/images/{image_id}/members/{member_id}',
                       controller=image_members_resource,
                       action='delete',
                       conditions={'method': ['DELETE']})
        mapper.connect('/images/{image_id}/members/{member_id}',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET, PUT, DELETE',
                       conditions={'method': ['POST', 'PATCH', 'HEAD']})

        tasks_resource = tasks.create_resource()
        mapper.connect('/tasks',
                       controller=tasks_resource,
                       action='create',
                       conditions={'method': ['POST']})
        mapper.connect('/tasks',
                       controller=tasks_resource,
                       action='index',
                       conditions={'method': ['GET']})
        mapper.connect('/tasks',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET, POST',
                       conditions={'method': ['PUT', 'DELETE', 'PATCH',
                                              'HEAD']})

        mapper.connect('/tasks/{task_id}',
                       controller=tasks_resource,
                       action='get',
                       conditions={'method': ['GET']})
        mapper.connect('/tasks/{task_id}',
                       controller=tasks_resource,
                       action='delete',
                       conditions={'method': ['DELETE']})
        mapper.connect('/tasks/{task_id}',
                       controller=reject_method_resource,
                       action='reject',
                       allowed_methods='GET, DELETE',
                       conditions={'method': ['POST', 'PUT', 'PATCH',
                                              'HEAD']})

        super(API, self).__init__(mapper)


text:
#ifndef AI_OGREPARSINGUTILS_H_INC
#define AI_OGREPARSINGUTILS_H_INC

#ifndef ASSIMP_BUILD_NO_OGRE_IMPORTER

#include <assimp/ParsingUtils.h>
#include <cstdint>
#include <algorithm>
#include <cctype>
#include <functional>
#include <sstream>

namespace Assimp {
namespace Ogre {

/// Returns if @c s ends with @c suffix. If @c caseSensitive is false, both strings will be lower cased before matching.
static inline bool EndsWith(const std::string &s, const std::string &suffix, bool caseSensitive = true) {
    if (s.empty() || suffix.empty()) {
        return false;
    } else if (s.length() < suffix.length()) {
        return false;
    }

    if (!caseSensitive) {
        return EndsWith(ai_tolower(s), ai_tolower(suffix), true);
    }

    size_t len = suffix.length();
    std::string sSuffix = s.substr(s.length() - len, len);

    return (ASSIMP_stricmp(sSuffix, suffix) == 0);
}

// Skips a line from current @ss position until a newline. Returns the skipped part.
static inline std::string SkipLine(std::stringstream &ss) {
    std::string skipped;
    getline(ss, skipped);
    return skipped;
}

// Skips a line and reads next element from @c ss to @c nextElement.
/** @return Skipped line content until newline. */
static inline std::string NextAfterNewLine(std::stringstream &ss, std::string &nextElement) {
    std::string skipped = SkipLine(ss);
    ss >> nextElement;
    return skipped;
}

} // namespace Ogre
} // namespace Assimp

#endif // ASSIMP_BUILD_NO_OGRE_IMPORTER
#endif // AI_OGREPARSINGUTILS_H_INC


text:
namespace net {

class EpollServer;
class QuicRandom;

namespace tools {

class AckAlarm;
class RetransmissionAlarm;
class SendAlarm;
class TimeoutAlarm;

class QuicEpollConnectionHelper : public QuicConnectionHelperInterface {
 public:
  QuicEpollConnectionHelper(int fd, EpollServer* eps);
  QuicEpollConnectionHelper(QuicPacketWriter* writer, EpollServer* eps);
  virtual ~QuicEpollConnectionHelper();

  // QuicEpollConnectionHelperInterface
  virtual void SetConnection(QuicConnection* connection) OVERRIDE;
  virtual const QuicClock* GetClock() const OVERRIDE;
  virtual QuicRandom* GetRandomGenerator() OVERRIDE;
  virtual int WritePacketToWire(const QuicEncryptedPacket& packet,
                                int* error) OVERRIDE;
  virtual bool IsWriteBlockedDataBuffered() OVERRIDE;
  virtual bool IsWriteBlocked(int error) OVERRIDE;
  virtual void SetRetransmissionAlarm(QuicTime::Delta delay) OVERRIDE;
  virtual void SetSendAlarm(QuicTime alarm_time) OVERRIDE;
  virtual void SetTimeoutAlarm(QuicTime::Delta delay) OVERRIDE;
  virtual bool IsSendAlarmSet() OVERRIDE;
  virtual void UnregisterSendAlarmIfRegistered() OVERRIDE;
  virtual void SetAckAlarm(QuicTime::Delta delay) OVERRIDE;
  virtual void ClearAckAlarm() OVERRIDE;

  EpollServer* epoll_server() { return epoll_server_; }

 private:
  friend class QuicConnectionPeer;

  QuicPacketWriter* writer_;  // Not owned
  EpollServer* epoll_server_;  // Not owned.
  int fd_;

  // An alarm which fires if we've hit a timeout on sending an ack.
  scoped_ptr<AckAlarm> ack_alarm_;

  scoped_ptr<RetransmissionAlarm> retransmission_alarm_;

  // An alarm which fires when the connection may have timed out.
  scoped_ptr<TimeoutAlarm> timeout_alarm_;

  // An alarm that is scheduled when the sent scheduler requires a
  // a delay before sending packets and fires when the packet may be sent.
  scoped_ptr<SendAlarm> send_alarm_;

  QuicConnection* connection_;
  const QuicEpollClock clock_;
  QuicRandom* random_generator_;

  DISALLOW_COPY_AND_ASSIGN(QuicEpollConnectionHelper);
};

}  // namespace tools
}  // namespace net

#endif  // NET_TOOLS_QUIC_QUIC_EPOLL_CONNECTION_HELPER_H_


text:
using System.Collections.Generic;
using UnityEngine;
using ff.vr.annotate;
using ff.nodegraph;
using ff.vr.interaction;
using System;
using System.IO;
using ff.location;
using ff.utils;
using ff.vr.annotate.datamodel;
using ff.vr.annotate.helpers;
using ff.nodegraph.interaction;
using System.Collections;
using UnityEngine.Networking;

namespace ff.vr.annotate.viz
{
    /**
        A singleton, that handles loading and adding annotations
        - Can be selected.
        - Can be hovered.
        - We be generated on the fly
        - Is grouped under a Annotations-Group
    */

    public class AnnotationManager : Singleton<AnnotationManager>
    {
        public string SimulatedYear = "300 BC";
        public string SimulatedTimeOfDay = "18:23:12";

        private List<AnnotationGizmo> AllAnnotationGizmos = new List<AnnotationGizmo>();

        public AnnotationGizmo _annotationGizmoPrefab;

        void Start()
        {
            InitGizmoContainer();
            _keyboardEnabler = FindObjectOfType<KeyboardEnabler>();
            _keyboardEnabler.Hide();
            _keyboardEnabler.InputCompleted += HandleInputCompleted;
            _keyboardEnabler.InputChanged += HandleInputChanged;
        }

        private void InitGizmoContainer()
        {
            _gizmoContainer = new GameObject();
            _gizmoContainer.name = "GizmoContainer";
            _gizmoContainer.transform.SetParent(this.transform, false);
        }

        private void HandleInputCompleted()
        {
            _keyboardEnabler.Hide();
            _lastCreatedAnnotation.Text = _keyboardEnabler._inputField.text;
            var databaseLocation = _lastCreatedAnnotation.TargetNode.UnityObj.GetComponentInParent<Target>().DataBaseLocationToUse;

            switch (databaseLocation)
            {
                case Target.DataBaseLocation.localDirectory:
                    Serialization.WriteAnnotationToLocalDirectory(_lastCreatedAnnotation);
                    break;
                case Target.DataBaseLocation.REST:
                    StartCoroutine(Serialization.WriteAnnotationToServer(_lastCreatedAnnotation));
                    break;
            }
        }

        private void HandleInputChanged(string newText)
        {
            if (_focusedAnnotationGizmo)
                _focusedAnnotationGizmo.UpdateBodyText(newText);
        }

        public void CreateAnnotation(Node contextNode, Vector3 position)
        {
            var newAnnotation = new Annotation()
            {
                TargetNode = contextNode,
                JsonLdId = new LinkedDataID(LinkedDataID.IDType.Annotation),

                AnnotationPosition = new GeoCoordinate() { position = position },
                ViewPortPosition = new GeoCoordinate() { position = Camera.main.transform.position },

                Author = CurrentUserDefinition._instance != null
                        ? CurrentUserDefinition._instance.CurrentUser
                        : Person.AnonymousUser,
                CreatedAt = DateTime.Now,
            };
            Debug.Log("Created new annotation: " + newAnnotation.JsonLdId);

            _lastCreatedAnnotation = newAnnotation;
            _focusedAnnotationGizmo = CreateAnnotationGizmo(newAnnotation);
            _keyboardEnabler.Show();
        }

        public AnnotationGizmo CreateAnnotationGizmo(Annotation annotation)
        {
            if (_gizmoContainer == null)
                InitGizmoContainer();

            var newAnnotationGizmo = Instantiate(_annotationGizmoPrefab);
            newAnnotationGizmo.transform.position = annotation.AnnotationPosition.position;
            newAnnotationGizmo.transform.SetParent(_gizmoContainer.transform, false);
            newAnnotationGizmo.Annotation = annotation;
            AllAnnotationGizmos.Add(newAnnotationGizmo);
            return newAnnotationGizmo;
        }

        public void GoToNextAnnotation(Teleportation teleportation)
        {
            var selectedAnnotationGizmo = SelectionManager.Instance.SelectedAnnotationGizmo;
            if (selectedAnnotationGizmo == null)
                return;

            var nextGizmo = GetNextAnnotationGizmoOnNode(selectedAnnotationGizmo);
            SelectionManager.Instance.SetSelectedItem(nextGizmo);
            teleportation.JumpToPosition(nextGizmo.Annotation.ViewPortPosition.position);
        }

        public AnnotationGizmo GetNextAnnotationGizmoOnNode(AnnotationGizmo gizmo)
        {
            var relevantAnnotations = GetAllAnnotationsGizmosOnNode(gizmo.Annotation.TargetNode);
            int i = 0;
            while (relevantAnnotations[i] != gizmo)
                i++;
            return relevantAnnotations[(i + 1) % relevantAnnotations.Count];
        }

        public void GoToPreviousAnnotation(Teleportation teleportation)
        {
            var selectedAnnotationGizmo = SelectionManager.Instance.SelectedAnnotationGizmo;
            if (selectedAnnotationGizmo == null)
                return;

            var nextGizmo = GetPreviousAnnotationGizmoOnNode(selectedAnnotationGizmo);
            SelectionManager.Instance.SetSelectedItem(nextGizmo);
            teleportation.JumpToPosition(nextGizmo.Annotation.ViewPortPosition.position);
        }

        public AnnotationGizmo GetPreviousAnnotationGizmoOnNode(AnnotationGizmo gizmo)
        {
            var relevantAnnotations = GetAllAnnotationsGizmosOnNode(gizmo.Annotation.TargetNode);
            int i = 0;
            while (relevantAnnotations[i] != gizmo)
                i++;
            return relevantAnnotations[(i - 1 + relevantAnnotations.Count) % relevantAnnotations.Count];
        }

        public List<AnnotationGizmo> GetAllAnnotationsGizmosOnNode(Node node)
        {
            List<AnnotationGizmo> annotationsThatTargetNode = new List<AnnotationGizmo>();
            foreach (var a in GetComponentsInChildren<AnnotationGizmo>())
            {
                if (a.Annotation.TargetNode == node)
                    annotationsThatTargetNode.Add(a);
            }
            return annotationsThatTargetNode;
        }

        private Annotation _lastCreatedAnnotation;
        private AnnotationGizmo _focusedAnnotationGizmo;
        private GameObject _gizmoContainer;
        private KeyboardEnabler _keyboardEnabler;
    }
}


text:
package at.int32.android.utils.ui.binding.bindable;

import java.util.Date;

import at.int32.android.utils.ui.binding.Bindable;

public class DateBindable extends Bindable<Date> {

	public DateBindable() {
		super();
	}

	public DateBindable(Date defaultValue) {
		super(defaultValue);
	}

}