text:
PrePress Tricks Library
=======================
Box of Tricks for common PrePress related tasks.

## Table of Contents

- [Purpose](#purpose)
- [Installation](#installation)
- [Basic Usage](#basic-usage---xpif-ticket-maker)

## Purpose

If you have ever asked any of the following question, this collection of Classes might be for you.

Pages Class

- I need to scale this picture. At what percent will it fit inside this box?

Boxes Class

- How do clean up a range of pages to something readable e.g. '3,4,6,12,13,10-20,1,2,8' => '1-4,6,8,10-20'?

Ticketing Classes

- How do I generate an XPIF ticket for Xerox Printing Devices?

## Installation

The recommended method of installation is via Composer.

```json
{
  "require": {
    "php": ">=8.0",
    "arajcany/pre-press-tricks": ""
  }
}
```
Version compatibility
```text
PHP 7.4 (last compatible version for PHP 7.4)
composer require arajcany/pre-press-tricks:^0.0.7

PHP 8.x
composer require arajcany/pre-press-tricks:^1.0.0
```

## Basic Usage - XPIF Ticket Maker

### Example 1 - Base Ticket

```php
<?php
use arajcany\PrePressTricks\Ticketing\XPIF\XpifTicket;

/*
 * Probably the most basic ticket you can make.
 *
 * Notes:
 * Finishing values of
 *  28 = staple-dual-left
 *  92 = punch-4-hole
 *  93 = punch-left
 * The 'media' is defined as 'A4-White-80gsm' as my RIP has a stock catalogue with such defined
 *
 */

//create a ticket object based on a specific XPIF version
$ticket = new XpifTicket('2.082a');

//populate the ticket with properties
$ticket
    ->setJobName("For_the_Term_of_His_Natural_Life.pdf")
    ->setRequestingUserName("John Smith")
    ->setCopies(2)
    ->setFinishings([28, 93, 92])
    ->setSheetCollate('collated')
    ->setSides('two-sided-long-edge')
    ->setMedia('A4-White-80gsm');

//render the ticket (returns xml string AND optionally writes to filesystem)
$string = $ticket->render("C:\\tmp\\Example_01.xpf");
```

`$string` contains the following XML

```xml
<?xml version="1.0"?>
<!DOCTYPE xpif SYSTEM "xpif-v02082a.dtd">
<xpif version="1.0" cpss-version="2.082a" xml:lang="en">
    <xpif-operation-attributes>
        <job-name syntax="name" xml:space="preserve">For_the_Term_of_His_Natural_Life.pdf</job-name>
        <requesting-user-name syntax="name" xml:space="preserve">John Smith</requesting-user-name>
    </xpif-operation-attributes>
    <job-template-attributes>
        <copies syntax="integer">2</copies>
        <finishings syntax="1setOf">
            <value syntax="enum">28</value>
            <value syntax="enum">93</value>
            <value syntax="enum">92</value>
        </finishings>
        <sheet-collate syntax="keyword">collated</sheet-collate>
        <sides syntax="keyword">two-sided-long-edge</sides>
        <media syntax="keyword">A4-White-80gsm</media>
    </job-template-attributes>
</xpif>

```

### Example 2 - Base Ticket Supported Properties

The XPIF Specification supports almost 650 properties inside the ticket. You can control standard properties such as '
copies' to exotic properties such as 'rgb-monochrome-grayline-mapping'. I have selected a handful of the most commonly
used properties and created concrete methods around setting those properties. For settings rarely used properties, see
Example 3.

```php
<?php
//name of the job, typically the filename
$ticket->setJobName("For_the_Term_of_His_Natural_Life.pdf");

//name of user printing the job
$ticket->setRequestingUserName("Joe Citizen");

//number of copies
$ticket->setCopies(2);

//print only the pages within this range inclusive
$ticket->setPageRanges([1, 77]);

//the finishing values, you will need to know what each number represents
$ticket->setFinishings([28, 93, 92]);

//mime type
$ticket->setDocumentFormat("application/pdf");

//name of the stock as defined in the RIP or printer
$ticket->setMedia('Plain-White-A4-80gsm');

//print the job as 'color' │ 'monochrome-grayscale'
$ticket->setColorEffectsType('color');

//id for accounting / reconciliation purposes
$ticket->setJobAccountId('123');

//user id requesting job accounting data
$ticket->setJobAccountingUserId('AU004133');

//extra data that is useful for accounting and reconciliation purposes
$ticket->setJobAccountingData("From Web-2-Portal System A");

//name of the user that will receive the job
$ticket->setJobRecipientName("Jane Doe");

//message that is passed to the RIP or printer with the job, typically printed on a banner page
$ticket->setJobSheetMessage("Please refer to work ticket for additional instructions");

//message that is passed to the RIP or printer with the job, typically displayed to the operator
$ticket->setJobMessageToOperator("Urgent and fussy client");

//use the indicated orientation (portrait, landscape,  reverse-landscape, reverse-portrait)
$ticket->setOrientationRequested(3);

//job collation
$ticket->setSheetCollate("Collated");

//sides to print on 'one-sided' │ 'two-sided' │ 'two-sided-short-edge' │ 'two-sided-long-edge'
$ticket->setSides("one-sided");

//commonly used in forcing a page to print on the RHS for double sided printing (i.e. chapter starts)
$ticket->setForceFrontSide([1, 5, 9, 12]);

//render the ticket (returns xml string AND optionally writes to filesystem)
$string = $ticket->render("C:\\tmp\\Example_02.xpf");
```

### Example 3 - Setting Additional Properties

For setting properties that do not have a concrete methods, you can use the generic set `setProperty()` method.

```php
<?php
/*
 * The following examples achieve the same result
 */

//concrete method
$ticket->setJobName("For the Term of His Natural Life");
//generic
$ticket->setProperty("job-name", "For the Term of His Natural Life");

//concrete method
$ticket->setSides("one-sided");
//generic
$ticket->setProperty("sides", "one-sided");

//concrete method
$ticket->setSheetCollate("Collated");
//generic
$ticket->setProperty("sheet-collate", "Collated");

//example of other properties you might like to set
$ticket->setProperty("file-name", "For_the_Term_of_His_Natural_Life.pdf");
$ticket->setProperty("job-id-from-client", "D704432_SEQ001");
$ticket->setProperty("printer-resolution", "1200");
```

### Example 4 - Issues With Setting Additional Properties

The `setProperty()` may or may not work for a given property. This is because the code uses some smarts to try and
figure out the attributes of the property in question. This is done via the published `xpif.dtd` files (which I auto
convert to JSON format for easy reading).

Consider the following XPIF ticket

```xml
<?xml version="1.0"?>
<!DOCTYPE xpif SYSTEM "xpif-v02082a.dtd">
<xpif version="1.0" cpss-version="2.082a" xml:lang="en">
    <xpif-operation-attributes>
        <job-name syntax="name" xml:space="preserve">For_the_Term_of_His_Natural_Life.pdf</job-name>
        <requesting-user-name syntax="name" xml:space="preserve">John Smith</requesting-user-name>
    </xpif-operation-attributes>
    <job-template-attributes>
        <copies syntax="integer">2</copies>
        <finishings syntax="1setOf">
            <value syntax="enum">28</value>
            <value syntax="enum">93</value>
            <value syntax="enum">92</value>
        </finishings>
        <page-ranges syntax="1setOf">
            <value syntax="rangeOfInteger">
                <lower-bound syntax="integer">1</lower-bound>
                <upper-bound syntax="integer">50</upper-bound>
            </value>
        </page-ranges>
        <sheet-collate syntax="keyword">collated</sheet-collate>
        <sides syntax="keyword">two-sided-long-edge</sides>
        <media syntax="keyword">A4-White-80gsm</media>
        <pad-printing>
            <pad-printing-type syntax="keyword">pads-single-back-cover</pad-printing-type>
            <number-of-sheets-per-pad syntax="integer">50</number-of-sheets-per-pad>
        </pad-printing>
        <finishings-col>
            <finishings-media-sheets-min-max>
                <upper-bound syntax="integer">1</upper-bound>
                <lower-bound syntax="integer">50</lower-bound>
            </finishings-media-sheets-min-max>
        </finishings-col>
    </job-template-attributes>
</xpif>
```

**Issue 1 - Ambiguous Properties**
If you try to set a 'lower-bound' property as follows, `$ticket->setProperty('lower-bound', 1)` are you setting it
for:
`/xpif/job-template-attributes/finishings-col/finishings-media-sheets-min-max/lower-bound` or
`/xpif/job-template-attributes/page-ranges/value/lower-bound`?

**Solution**
Use dot-notation to explicitly define the path. Notice the dot-notation in the first argument:
`$ticket->setProperty('finishings-media-sheets-min-max.lower-bound', 1)`
This clearly defines which 'lower-bound' to use in the `xpif.dtd` file.

You could go all out and use the full xPath in dot-notation format
`$ticket->setProperty('xpif.job-template-attributes.finishings-col.finishings-media-sheets-min-max.lower-bound', 1)`
but it is rarely more than necessary to define the parent and grand-parent.

**Issue 2 - Undefined Children of 'Value'**
For whatever reason, the Xerox `xpif.dtd` files do not publish what the valid child nodes of 'value' are. Looking at the
example XPIF above :
`/xpif/job-template-attributes/finishings/value` contains text values 28, 93 and 92.
`/xpif/job-template-attributes/page-ranges/value`  contains child nodes of 'lower-bound' and 'upper-bound'.
This is super confusing as literally 'value' can contain anything, it is not defined in the xpif.dtd.

**Solution**
Unfortunately, you just have to know the XPIF structure post 'value' of the following properties:

```
 xpif.job-template-attributes.finishings.value
 xpif.job-template-attributes.page-ranges.value
 xpif.job-template-attributes.force-front-side.value
 xpif.job-template-attributes.insert-sheet.value
 xpif.job-template-attributes.page-overrides.value
 xpif.job-template-attributes.job-save-disposition.save-info.value
 xpif.job-template-attributes.pages-per-subset.value
 xpif.job-template-attributes.finishings-col.stitching.stitching-locations.value
 xpif.job-template-attributes.finishings-col.creasing-col.crease-position-specifications-col.value
 xpif.job-template-attributes.resource-cleanup.value
 xpif.job-template-attributes.pdl-init-file.value
 xpif.job-template-attributes.forms-col.value
 xpif.job-template-attributes.job-offset.value
 xpif.job-template-attributes.form-save.form-save-info.value
 xpif.job-template-attributes.imposition-mark-front.value
 xpif.job-template-attributes.pcl-paper-source-col.value
 xpif.job-template-attributes.edge-enhancement-disable.value
 xpif.job-template-attributes.job-print-with-saved-jobs.value
 xpif.job-template-attributes.adjust-custom-color-col.value
 xpif.job-template-attributes.natural-language-adjustment-col.natural-language-adjustment-string.value
 xpif.job-template-attributes.fax-out-col.recipients-col.value
 xpif.job-template-attributes.output-gloss-col.value
 xpif.job-template-attributes.edge-enhancement-col.value
 xpif.job-template-attributes.black-enhancement-col.value
 xpif.job-template-attributes.colorant-set-col.colorant-col.value
 xpif.job-template-attributes.output-white-col.value
```

I have coded in some tricks that you can use:

```php
<?php
//concrete methods for 3 of the most common undefined children of value

//concrete method
$ticket->setFinishings([28, 93, 92]);
//generic equivalent
$ticket->setProperty('xpif.job-template-attributes.finishings.value.0', '28', ['syntax' => "enum"]);
$ticket->setProperty('xpif.job-template-attributes.finishings.value.1', '93', ['syntax' => "enum"]);
$ticket->setProperty('xpif.job-template-attributes.finishings.value.2', '92', ['syntax' => "enum"]);

//concrete method
$ticket->setPageRanges([1, 50]);
//generic equivalent
$ticket->setProperty('xpif.job-template-attributes.page-ranges.value.lower-bound', '1');
$ticket->setProperty('xpif.job-template-attributes.page-ranges.value.upper-bound', '50');

//concrete method
$ticket->setForceFrontSide([1, 10, 19, 32]);
//generic equivalent
$ticket->setProperty('xpif.job-template-attributes.force-front-side.value.0', '1', ['syntax' => "integer"]);
$ticket->setProperty('xpif.job-template-attributes.force-front-side.value.2', '10', ['syntax' => "integer"]);
$ticket->setProperty('xpif.job-template-attributes.force-front-side.value.3', '19', ['syntax' => "integer"]);
$ticket->setProperty('xpif.job-template-attributes.force-front-side.value.4', '32', ['syntax' => "integer"]);
```

### Example 5 - Handling Media and Media Collection

Depending on the RIP you use, you can either use Media or Media Collection:

**Media** Use this when your RIP has a defined media catalogue and you know the name of that media in the catalogue.

```php
<?php
use arajcany\PrePressTricks\Ticketing\XPIF\XpifTicket;

$ticket = new XpifTicket('2.082a');
$ticket->setJobName("For_the_Term_of_His_Natural_Life.pdf");
$ticket->setMedia('Plain-White-A4-80gsm');
```

```xml
<?xml version="1.0"?>
<!DOCTYPE xpif SYSTEM "xpif-v02082a.dtd">
<xpif version="1.0" cpss-version="2.082a" xml:lang="en">
    <xpif-operation-attributes>
        <job-name syntax="name" xml:space="preserve">For_the_Term_of_His_Natural_Life.pdf</job-name>
    </xpif-operation-attributes>
    <job-template-attributes>
        <media syntax="keyword">Plain-White-A4-80gsm</media>
    </job-template-attributes>
</xpif>
```

**Media Collection** Use this when your RIP does not have a defined media catalogue and you need to set the properties
of the stock.

```php
<?php
use arajcany\PrePressTricks\Ticketing\XPIF\XpifTicket;
use arajcany\PrePressTricks\Ticketing\XPIF\XpifMediaCollection;

$mediaCollection = new XpifMediaCollection('2.082a');
$mediaCollection
    ->setMediaKey('plain-white-a4-80gsm')
    ->setMediaType('plain')
    ->setMediaInfo('This is our standard white paper')
    ->setMediaColor('white')
    ->setMediaPrePrinted('blank')
    ->setMediaHoleCount(0)
    ->setMediaOrderCount(1)
    ->setMediaSize([21000, 29700])
    ->setMediaWeightMetric(80)
    ->setMediaBackCoating('plain')
    ->setMediaFrontCoating('plain')
    ->setMediaRecycled('')
    ->setMediaDescription('')
    ->setMediaTooth('')
    ->setMediaGrain('')
    ->setMediaMaterial('')
    ->setMediaThickness('')
    ->setMediaSizeName('A4')
    ->setInputTray('')
    ->setTrayFeed('')
    ->setFeedOrientation('')
    ->setMediaMismatchPropertyPolicy('')
    ->setMediaMismatchSizePolicy('');
//note: the above is a complete list of concrete methods, you do not need to set all of them!

$ticket = new XpifTicket('2.082a');
$ticket->setJobName("For_the_Term_of_His_Natural_Life.pdf");
$ticket->setMediaCollection($mediaCollection);
```

```xml
<?xml version="1.0"?>
<!DOCTYPE xpif SYSTEM "xpif-v02082a.dtd">
<xpif version="1.0" cpss-version="2.082a" xml:lang="en">
    <xpif-operation-attributes>
        <job-name syntax="name" xml:space="preserve">For_the_Term_of_His_Natural_Life.pdf</job-name>
    </xpif-operation-attributes>
    <job-template-attributes>
        <media-col syntax="collection">
            <media-key syntax="keyword">plain-white-a4-80gsm</media-key>
            <media-type syntax="keyword">plain</media-type>
            <media-info syntax="text" xml:space="preserve">This is our standard white paper</media-info>
            <media-color syntax="keyword">white</media-color>
            <media-pre-printed syntax="keyword"/>
            <media-hole-count syntax="integer">0</media-hole-count>
            <media-order-count syntax="integer">1</media-order-count>
            <media-size syntax="collection">
                <x-dimension syntax="integer">21000</x-dimension>
                <y-dimension syntax="integer">29700</y-dimension>
            </media-size>
            <media-weight-metric syntax="integer">80</media-weight-metric>
            <media-back-coating syntax="keyword">plain</media-back-coating>
            <media-front-coating syntax="keyword">plain</media-front-coating>
            <media-recycled syntax="keyword"/>
            <media-description syntax="keyword"/>
            <media-tooth syntax="keyword"/>
            <media-grain syntax="keyword"/>
            <media-material syntax="keyword"/>
            <media-thickness syntax="integer"/>
            <media-size-name syntax="keyword">A4</media-size-name>
            <input-tray syntax="keyword"/>
            <tray-feed syntax="keyword"/>
            <feed-orientation syntax="keyword"/>
            <media-mismatch-property-policy syntax="keyword"/>
            <media-mismatch-size-policy syntax="keyword"/>
        </media-col>
    </job-template-attributes>
</xpif>
```

Media Collections are awesome because you can clone/modify/reuse them:

```php
<?php
use arajcany\PrePressTricks\Ticketing\XPIF\XpifMediaCollection;

$whiteMediaCollection = new XpifMediaCollection('2.082a');
$whiteMediaCollection
    ->setMediaType('plain')
    ->setMediaColor('white')
    ->setMediaPrePrinted(false)
    ->setMediaSize([21000, 29700])
    ->setMediaWeightMetric(80);

$pinkMediaCollection = (clone $whiteMediaCollection)->setMediaColor('pink');
$greenMediaCollection = (clone $whiteMediaCollection)->setMediaColor('green');
$blueMediaCollection = (clone $whiteMediaCollection)->setMediaColor('blue');
$yellowMediaCollection = (clone $whiteMediaCollection)->setMediaColor('yellow');

$blueCoverMediaCollection = (clone $blueMediaCollection)->setMediaWeightMetric(200);
$greenCoverMediaCollection = (clone $greenMediaCollection)->setMediaWeightMetric(200);
```

To see how to reuse Media Collections refer to [Example 6](#example-6---collections).

### Example 6 - Other Collections

In addition to the Media Collection the following collections are also available:

- Front Cover Collection
- Back Cover Collection
- Insert Sheet Collection
- Page Overrides Collection

```php
<?php
use arajcany\PrePressTricks\Ticketing\XPIF\XpifCoverFrontCollection;
use arajcany\PrePressTricks\Ticketing\XPIF\XpifCoverBackCollection;
use arajcany\PrePressTricks\Ticketing\XPIF\XpifInsertSheetCollection;
use arajcany\PrePressTricks\Ticketing\XPIF\XpifPageOverridesCollection;

//front cover collection
$coverFrontCollection = new XpifCoverFrontCollection('2.082a');
$coverFrontCollection
    ->setCoverType('print-both')
    ->setMediaCollection($blueCoverMediaCollection) //we created $blueCoverMedia in Example 5
    ->setMedia('the-name-of-the-stock'); //not necessary if you use setMediaCollection()

//back cover collection
$coverBackCollection = new XpifCoverBackCollection('2.082a');
$coverBackCollection
    ->setCoverType('print-both')
    ->setMediaCollection($greenCoverMediaCollection) //we created $greenCoverMedia in Example 5
    ->setMedia('the-name-of-the-stock'); //not necessary if you use setMediaCollection()

//insert sheet collection
$pinkInsertSheetCollection = new XpifInsertSheetCollection('2.082a');
$pinkInsertSheetCollection
    ->setInsertAfterPageNumber('0')
    ->setInsertCount(1)
    ->setMediaCollection($pinkMediaCollection) //we created $pinkMediaCollection in Example 5
    ->setMedia('the-name-of-the-stock'); //not necessary if you use setMediaCollection()

//page overrides collection
$yellowPageOverridesCollection = new XpifPageOverridesCollection('2.082a');
$yellowPageOverridesCollection
    ->setPages('1-5')
    ->setMediaCollection($yellowMediaCollection) //we created $yellowMediaCollection in Example 5
    ->setMedia('the-name-of-the-stock'); //not necessary if you use setMediaCollection()

//insert the above 4 collections into your xpif ticket with the following 4 concrete methods
$ticket->setCoverFrontCollection($coverFrontCollection);
$ticket->setCoverBackCollection($coverBackCollection);
$ticket->setInsertSheetCollection($pinkInsertSheetCollection);
$ticket->setPageOverridesCollection($yellowPageOverridesCollection);

```

### Example 7 - Using Collections In Your XPIF Tickets (the kitchen sink)

In case you got lost in Example 6 about Media Collections, here is a visual on where Media Collections can sit inside an
XPIF Ticket:

```
xpif
├── Media Collection
│
├── Cover Front Collection
│   └── Media Collection
│
├── Cover Back Collection
│   └── Media Collection
│
├── Slip Sheets (many)
│   ├── Insert Sheet Collection
│   │   └── Media Collection
│   ├── Insert Sheet Collection
│   │   └── Media Collection
│   │
│   ├── <...>
│   │
│   └── Insert Sheet Collection
│       └── Media Collection
│
└── Page Exceptions (many)
    ├── Page Overrides Collection
    │   └── Media Collection
    ├── Page Overrides Collection
    │   └── Media Collection
    │
    ├── <...>
    │
    └── Page Overrides Collection
        └── Media Collection
```

From the representation above, you can probably see why I said Collections are awesome:

- They allow you to write less code.
- You don't need to know the full xPath of the property you are trying to set - done automatically by the Collection.
- Create a base Collection then clone/modify/reuse that Collection in different parts of the ticket.

So here is a Collections kitchen sink example, I imagine that this will cover about 90% of what you need to do with xpif
ticketing. This kitchen sink example is based on the historical fiction "For The Term of His Natural Life" by Marcus
Clarke (public domain). You can download a copy of this classic novel
here https://adc.library.usyd.edu.au/data-2/p00023.pdf

**The PDF has the following properties:**

- The PDF has 433 pages
- The PDF has 8 has parts
    - TITLE & IMPRINT
    - PREFACE
    - PROLOGUE
    - BOOK I.—THE SEA. 1827.
    - BOOK II.—MACQUARIE HARBOUR. 1833.
    - BOOK III. PORT ARTHUR 1838.
    - BOOK IV. NORFOLK ISLAND 1846.
    - EPILOGUE
- Each of the above BOOKS has several chapters

**I want the xpif to print the PDF as follows:**

- Printed double-sided on A4 white 80gsm paper
- 4 hole punched as it needs to be inserted into a binder
- FRONT COVER is the first page of the PDF, printed single-sided on A4 blue 200gsm card
- Print the IMPRINT page single-sided on A4 white 80gsm paper
- Print the PREFACE on A4 pink 80gsm paper
- For the PROLOGUE, EPILOGUE and each of 4 BOOKS, insert an A4 yellow 200gsm divider card
- For each of the CHAPTERS, print the first 2 pdf-pages on A4 pink 80gsm paper
- BACK COVER required, use a piece of A4 blue 200gsm card (i.e. no printing)

```php
<?php
use arajcany\PrePressTricks\Ticketing\XPIF\XpifTicket;
use arajcany\PrePressTricks\Ticketing\XPIF\XpifMediaCollection;
use arajcany\PrePressTricks\Ticketing\XPIF\XpifCoverFrontCollection;
use arajcany\PrePressTricks\Ticketing\XPIF\XpifCoverBackCollection;
use arajcany\PrePressTricks\Ticketing\XPIF\XpifInsertSheetCollection;
use arajcany\PrePressTricks\Ticketing\XPIF\XpifPageOverridesCollection;

$titleStart = '1';
$imprintStart = '2';
$prefaceStart = '3';
$prologueStart = '4';
$bookStarts ='13,79,173,331';
$chapterStarts ='14,21,28,31,35,41,49,56,62,67,75,78,80,83,86,95,98,101,108,113,118,123,129,140,147,151,158,164,168,174,185,194,201,208,212,217,221,225,233,243,245,249,253,260,265,269,273,276,279,282,290,300,305,311,315,325,332,341,351,357,361,365,371,375,379,383,389,392,397,402,410,415,418,423';
$epilogueStart = '428';

//Start by setting up a default white media collection.
$defaultWhiteMediaCollection = (new XpifMediaCollection('2.082a'))
    ->setMediaType('plain')
    ->setMediaColor('white')
    ->setMediaPrePrinted(false)
    ->setMediaSize([21000, 29700])
    ->setMediaWeightMetric(80);

//Create the other needed media collections by cloning and modifying
$blueCoverMediaCollection = (clone $defaultWhiteMediaCollection)->setMediaColor('blue')->setMediaWeightMetric(200);
$yellowDividerMediaCollection = (clone $defaultWhiteMediaCollection)->setMediaColor('yellow')->setMediaWeightMetric(200);
$pinkMediaCollection = (clone $defaultWhiteMediaCollection)->setMediaColor('pink');

//Create the exception and insert pages that don't require looping
$frontCoverException = (new XpifCoverFrontCollection())
    ->setCoverType('print-front')
    ->setMediaCollection($blueCoverMediaCollection);

$backCoverException = (new XpifCoverBackCollection())
    ->setCoverType('print-none')
    ->setMediaCollection($blueCoverMediaCollection);

$imprintException = (new XpifPageOverridesCollection())
    ->setPages($imprintStart)
    ->setSides('one-sided');

$prefaceException = (new XpifPageOverridesCollection())
    ->setPages($prefaceStart)
    ->setMediaCollection($pinkMediaCollection);

$prologueInsert = (new XpifInsertSheetCollection())
    ->setInsertBeforePageNumber($prologueStart)
    ->setMediaCollection($yellowDividerMediaCollection);

$epilogueInsert = (new XpifInsertSheetCollection())
    ->setInsertBeforePageNumber($epilogueStart)
    ->setMediaCollection($yellowDividerMediaCollection);

//Create the ticket and set the properties created so far
$ticket = (new XpifTicket('2.082a'))
  ->setJobName("For_the_Term_of_His_Natural_Life.pdf")
  ->setMediaCollection($defaultWhiteMediaCollection)
  ->setCoverFrontCollection($frontCoverException)
  ->setCoverBackCollection($backCoverException)
  ->setPageOverridesCollection($imprintException)
  ->setPageOverridesCollection($prefaceException)
  ->setInsertSheetCollection($prologueInsert)
  ->setInsertSheetCollection($epilogueInsert)
  ;

//we need to loop the book starts
foreach (explode(',', $bookStarts) as $bookStart) {
    $bookStartInsert = (new XpifInsertSheetCollection('2.082a'))
        ->setInsertBeforePageNumber($bookStart)
        ->setInsertCount(1)
        ->setMediaCollection($yellowDividerMediaCollection);

    //push into the xpif ticket
    $ticket = $ticket->setInsertSheetCollection($bookStartInsert);
}

//we need to loop the chapter starts
foreach (explode(',', $chapterStarts) as $chapterStart) {
    $chapterStartException = (new XpifPageOverridesCollection('2.082a'))
        ->setPages([$chapterStart, $chapterStart + 1])
        ->setMediaCollection($pinkMediaCollection);

    //push into the xpif ticket
    $ticket = $ticket->setPageOverridesCollection($chapterStartException);
}

$xpifXml = $ticket->render();
print_r($xpifXml);

```

repository: arajcany/PrePressTricks

repo_name: arajcany/PrePressTricks


text:
### Description

View all or some frog tissues and adjust the translucency of the tissues.

Sliders are provided in the right-hand window to to control the opacity of the individual tissues.

This example extends [Frog](../Frog) by providing user control over opacity.

repository: numminorih/vtk-examples

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: numminorih/vtk-examples


text:
# Local Development

## Publish jar to local Maven repository

Configure `build.gradle` to publish to Maven.
(The "local" part is specified in build command.)
This must be configured separately for each module (agent, sdk, and common).

```groovy
// ./myModule/build.gradle
plugins {
    id "maven-publish"
}

def artifactName = "honeycomb-opentelemetry-${yourModule}"

jar {
    archivesBaseName = "${artifactName}"
}

publishing {
    publications {
        mavenJava(MavenPublication) {
            artifactId = "${artifactName}"
            from components.java
        }
    }
}
```

From project root, build all jars and publish to local maven repository:

```sh
./gradlew publishToMavenLocal -Pskip.signing
```

You can also specify a single build target:

```sh
./gradlew sdk:publishToMavenLocal -Pskip.signing
```

### Test signing

If you want to test signing the local artifacts, you can omit the `-Pskip-signing`, and export `GPG_BASE64` and `GPG_PASSPHRASE` to your shell env.
To get GPG_BASE64, you can generate a GPG key, and export the secret key:

```sh
gpg --armor --export-secret-keys KEY_ID | base64
```

Note: if you're not on OSX, you may need to use `base64 -w0` to disable line wrapping.

### Verify local artifacts

Your local Maven repository is located at `~/.m2/repository/`.
Go there to inspect your build artifacts:

```sh
$ cd ~/.m2/repository/io/honeycomb/honeycomb-opentelemetry-sdk/0.4.0
$ ls -1
honeycomb-opentelemetry-sdk-0.4.0.jar
honeycomb-opentelemetry-sdk-0.4.0.module
honeycomb-opentelemetry-sdk-0.4.0.pom
maven-metadata-local.xml
```

## Use packages published to Maven local

Configure your test application's Gradle file
to point to your local Maven repository:

```groovy
// ~/exampleApp/build.gradle
repositories {
    mavenCentral()
    // etc.
    mavenLocal()
}

dependencies {
    implementation('io.honeycomb:honeycomb-opentelemetry-sdk:0.4.0')
}
```

repository: jessitron/honeycomb-opentelemetry-java

branch_name: refs/heads/main

repo_name: jessitron/honeycomb-opentelemetry-java


text:
## How can I contribute?

### Report a Bug.
- [Open a bug report](https://github.com/hypar-io/Elements/issues/new?assignees=&labels=&template=bug_report.md&title=).

### Request a Feature.
- [Open an feature request](https://github.com/hypar-io/Elements/issues/new?assignees=&labels=&template=feature_request.md&title=).

### Create a pull request.
Submissions to Elements will only be reviewed as a pull request. All pull requests will be expected to include tests that will run as part of the standard test suite. We have many examples of tests, and would be happy to give guidance on how to create worthwhile tests for your functionality.
- [Create a pull request](https://github.com/hypar-io/Elements/compare).

license: MIT

repository: hypar-io/Elements

gha_language: C#

gha_license_id: MIT

repo_name: hypar-io/Elements


text:
# Google Analytics Badges

![Pageviews](https://kubo.vercel.app/api/analytics?viewId=235430310&metric=ga:pageviews&title=pageviews&style=flat&color=blue)

Node.js wrapper serverless service to generate Shields IO-style badges for Google Analytics. Authenticates with the Reporting API using JWT tokens and uses shields to generate badges for traffic stats. Fully customizable. Works with Universal Analytics but not GA4 properties.

## Quickstart

### Obtain service account credentials

Google service account credentials are needed for JWT authentication.

1. Visit `Google Cloud Platform > APIs & Services > Credentials` or [console.cloud.google.com/apis/credentials](https://console.cloud.google.com/apis/credentials).
2. If you do not already have a project. Click `Create project` and give it a name. Refresh the page if changes aren't showing.
3. With the project selected, add an API by clicking `Dashboard > Enable APIs and services`. Find the Google Analytics Reporting API and enable it.
4. Select `Create credentials > Service account`, give the account a name. Click continue to skip through the optional steps.
5. Click your newly created service account and scroll to the `Keys` section. Select `Add key > Create new key > JSON`, a file will be downloaded.

Your file will look like this. `client_email` and `private_key` are the values you'll need for the next steps.

```
{
  "type": "service_account",
  "project_id": "id-of-project",
  "private_key_id": "a1b2c3d4e5f6",
  "private_key": "<REDACTED_PRIVATE_KEY>\n",
  "client_email"<EMAIL_ADDRESS>  "client_id": "1234567890",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/at8/analyticsdummy.gserviceaccount.com"
}
```

### Add users to Analytics

To allow the service account access to your analytics data, you need to add it as a user. Full instructions can be found on [Google's documentation](https://support.google.com/analytics/answer/1009702?hl=en). A summary of the steps is shown below.

1. Sign in to Google Analytics. Click `Admin > Account User Management`.
2. In the Account permissions list, click +, then click Add users.
3. Enter the `client_email` for the service account. In the example file above, this would be<EMAIL_ADDRESS>4. Make sure the `Read & Analyze` permission is checked. Then click Add.

Now the setup is complete, time to deploy our serverless functions.

## Deployment

This Node.js project was built with serverless hosting in mind. However, it is also possible to integrate this into your current hosted projects.

### Integrate into existing Node server

Adapt the code in `integrate.js` into your existing server code. Full documentation about the Core Reporting API can be [found here](https://developers.google.com/analytics/devguides/reporting/core/v3/reference).

### Deploying a serverless instance

Since it requires private keys, the best way is to deploy your own instance of this service. We will be using Vercel for free serverless deployments.

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https%3A%2F%2Fgithub.com%2Feightants%2Fanalytics-badge&env=CLIENT_EMAIL,PRIVATE_KEY&envDescription=These%20values%20are%20defined%20in%20the%20JSON%20file%20downloaded%20from%20your%20service%20account&envLink=https%3A%2F%2Fgithub.com%2Feightants%2Fanalytics-badge&project-name=analytics&repo-name=analytics-badge)

_Automate steps 1-5 with the button above_

1. Fork the https://github.com/eightants/analytics-badge project to your GitHub account.
2. Create an account on Vercel.
3. From the dashboard page click Import Project then specify the URL to your fork of the project on GitHub.
4. Add the required environment variables CLIENT_EMAIL and PRIVATE_KEY. These values correspond to `client-email` and `private-key` above.

(In this example, the values would be<EMAIL_ADDRESS>and `<REDACTED_PRIVATE_KEY>\n`)

5. Deploy and visit your application at `<deploy-id>.vercel.app`.

Visit your Google Analytics dashboard and obtain the `viewId` for your project of interest from `Admin > View > View Settings > View ID`. You can now generate shields.io badges for any of your Analytics projects with this endpoint.

```
https://<deploy-id>.vercel.app/api/analytics?viewId=<VIEWID>&metric=<METRIC>&startDate=<STARTDATE>&endDate=<ENDDATE>&title=<TITLE>&unit=<UNIT>&color=<COLOR>&style=<STYLE>&si=<SI>
```

**Query Parameters**
| Param | Description |
| ----------- | ----------- |
| viewId | (Required) The View ID of your Google Analytics property |
| metric | The metric id as specified in [Google dev tools](https://ga-dev-tools.appspot.com/dimensions-metrics-explorer/). Default: `ga:users` |
| startDate | Start date for fetching Analytics data. Requests can specify a start date formatted as `YYYY-MM-DD`, or as a relative date (e.g., `today`, `yesterday`, or `NdaysAgo` where `N` is a positive integer). Default: `7daysAgo`|
| endDate | End date for fetching Analytics data. Requests can specify a start date formatted as `YYYY-MM-DD`, or as a relative date (e.g., `today`, `yesterday`, or `NdaysAgo` where `N` is a positive integer). Default: `today`|
| title | Title for Shields.io badge. Default: `users` |
| unit | Unit of metric displayed on badge, e.g. 20k/week, 300/month. Special characters need to be URL encoded. Default: `%2Fweek` |
| color | Color of shield. Default: `green` |
| style | Shield style according to Shields.io documentation. Default: `plastic` |
| si | Whether to use SI abbreviations for numbers, e.g. 20k, 4M, 8B. Default: `true` |

## Examples

Using analytics data from my project Whisperify.

### Default shield for users per week

In Markdown: `![Users](https://<deploy-id>.vercel.app/api/analytics?viewId=211113681)`

In HTML: `<img src="https://<deploy-id>.vercel.app/api/analytics?viewId=211113681"/>`

![Users Shield](https://kubo.vercel.app/api/analytics?viewId=211113681)

### Pageviews per month

`https://<deploy-id>.vercel.app/api/analytics?viewId=211113681&metric=ga:pageviews&startDate=30daysAgo&title=pageviews&unit=%2Fmonth`

![Views Shield](https://kubo.vercel.app/api/analytics?viewId=211113681&metric=ga:pageviews&startDate=30daysAgo&title=pageviews&unit=%2Fmonth)

### Bounce Rate over the past day with badge styles

`https://<deploy-id>.vercel.app/api/analytics?viewId=211113681&metric=ga:bounceRate&startDate=yesterday&title=Bounce%20Rate&unit=%25&style=for-the-badge&color=blue`

![Shield](https://kubo.vercel.app/api/analytics?viewId=211113681&metric=ga:bounceRate&startDate=yesterday&title=Bounce%20Rate&unit=%25&style=for-the-badge&color=blue)

## Contribute

Feel free to contribute corrections in this guide or provide documentation on how to set up this project on other serverless platforms such as GCP or AWS Lambda.

![Analytics](https://ga-beacon.appspot.com/UA-132344171-6/github.com/Naereen/badges/README.md?pixel)


text:
# Basic-Assembler
This is an assembler written in Python for a very basic Domain Specific Language (DSL).

This DSL, which we call Basic Assembly, is a minimal assembly language for a hypothetical minimal Instruction Set Architecture (ISA).

Further details can be found in a [blog post](https://formydeskdrawer.wordpress.com/2020/07/03/a-domain-specific-assembly-language-and-assembler/).

## Implementation
The Basic Assembler is implemented in Python 3, using the [textX](https://github.com/textX/textX) module for parsing.

## Basic Assembly Language

The basic assembly language was inspired by x86 and ARM assembly. It _does not_ use any form of line ending symbol (no `;`), and generally ignores extra whitespace.

### Number Representation

Only integers are supported, which can be specified in three ways: decimal (`12`), hexidecimal (`0xC`), or binary (`0b1100`).

### Labels

A Label consists of a string of numbers and characters followed by a `:`.

```
Example_label:
    add 1, 1
```

### Operations

Operations are in the format `mnemonic (arg1) (arg2)` and are typically written one-per-line.

#### No Operation

The no operation command is simply `nop`

The following is an example of a do-nothing loop:

```
loop_start:
    nop
    jmp loop_start
```

#### Arithmetic

The arithmetic operations are generic addition and subtraction operators - they do not specify what is done with the result.

| Operation | Mnemonic | Arg 1    | Arg 2      |
|-----------|----------|----------|------------|
| Add       | add      | Addend 1 | Addend 2   |
| Subtract  | sub      | Minuend  | Subtrahend |

Example:

```
    add 1, 0x01
    sub 0b1010, 2
```

#### Jump

The jump command is `jmp` followed by the label to jump to.

Example of an infinite loop:

```
Start:
    // Do somehting we wish to repeat
    jmp Start
```

### Comments

Only `//`-style comments are supported.

```
// This is a comment
```

## Instruction Set Architecture
The ISA is big-endian.

### Instruction Format
Arithmetic operations with two arguments:

| Opcode  | Arg 1  | Arg 2  |
|---------|--------|--------|
| 16 bits | 8 bits | 8 bits |

Jump Instructions:

| Opcode  | Destination   |
|---------|---------------|
| 16 bits | 16 bits       |

Nop instruction:

| Opcode  | Zeros   |
|---------|---------------|
| 16 bits | 16 bits       |

16-bit opcodes are not necessary, but they make the full instruction fit nicely into a 32-bit word.

### Instruction Set
| Command      | Mnemonic | Opcode |
|--------------|----------|--------|
| Add          | add      | 0b00   |
| Subtract     | sub      | 0b01   |
| Jump         | jmp      | 0b10   |
| No Operation | nop      | 0b11   |

The remaining 14 bits of the opcode are filled with zeros.

## Other Resources

[Quick Domain-Specific Languages in Python with textX](https://tomassetti.me/quick-domain-specific-languages-in-python-with-textx/)

[ppci Creating a toy language](https://ppci.readthedocs.io/en/latest/howto/toy.html)

repository: seogier/Basic-Assembler

gha_language: Python

repo_name: seogier/Basic-Assembler


text:
# Rule Of Product / Sum
The rule of product states that if there are `n` ways of doing something, and `m` ways of doing another thing after that,
then there are `n*m` ways to perform both of these actions.

The rule of sum is a basic counting approach in combinatorics. A basic statement of the rule is that if there are `n`
choices for one action and `m` choices for another action, and the two actions cannot be done at the same time,
then there are `n+m` ways to choose one of these actions.

# Principle of inclusion and exclusion
The principle of inclusion and exclusion (PIE) is a counting technique that computes the number of elements that satisfy
at least one of several properties while guaranteeing that elements satisfying more than one property are not counted twice.

## Prerequisites

* None

## Objectives
* Rule Of Product
* Rule Of Sum
* Principle of inclusion and exclusion

## Videos

[![](https://img.youtube.com/vi/7qQCQlSHsjU/0.jpg)](https://www.youtube.com/watch?v=7qQCQlSHsjU)

Snake Rana from Arabella solved using Inclusion and Exclusion

https://codeforces.com/gym/101350/problem/G

[![](https://img.youtube.com/vi/OHI5AFUee04/0.jpg)](https://www.youtube.com/watch?v=OHI5AFUee04)

## Practice Problems:

Pashmak and Flowers: [https://codeforces.com/problemset/problem/459/B]

KPRIMESB - Almost Prime Numbers Again [https://www.spoj.com/problems/KPRIMESB/]

IITKWPCH - Find Number Of Pair of Friends [https://www.spoj.com/problems/IITKWPCH/]

Snake Rana: [https://codeforces.com/gym/101350/problem/G]

**Authors:**
* Mohammad AbuAboud


text:
### [.foo](test/fixtures/comments-1.js#L20)

* `a` **{String}**: Pass a string.
* `b` **{Object}**: Pass an object.
* `c` **{Array}**: Pass an array.
* `returns`: {*}

Do stuff with a, b, and c

### [.bar](test/fixtures/comments-1.js#L34)

* `a` **{String}**: Pass a string.
* `b` **{Object}**: Pass an object.
* `c` **{Array}**: Pass an array.
* `returns`: {*}

Do stuff with a, b, and c

repository: jonschlinkert/template-utils

gha_language: JavaScript

repo_name: jonschlinkert/template-utils


text:
# Bahia nudicaulis var. desertorum (M.E.Jones) Cronquist VARIETY

#### Status
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
A. Cronquist et al. , Intermountain fl. 5:114. 1994

#### Original name
null

### Remarks
null

repository: mdoering/backbone

path: /life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Platyschkuhria/Platyschkuhria integrifolia/ Syn. Bahia nudicaulis desertorum/README.md

repo_name: mdoering/backbone


text:
---
title: 'What is Application Release Orchestration'
weight: 1
---

Hopefully not another three letter acronym we all have to learn ?.  Application Release Orchestration is a subcategory of Developer Operations focused on helping development teams eliminate the hassle of releasing software. Our mission is to make each one of your releases a success, and that starts with removing the time consuming & tedious aspects every release requires. For example versioning your release and generating release notes for it that can be used to communicate to others what’s changed.


text:
---
title: "Upgrade from v6 to v7"
linkTitle: "Upgrade from v6 to v7"
#weight:
date: 2022-02-04
tags:
description: >
  This document describes the process for upgrading a Stroom single node docker stack from v6.x to v7.x.

---

{{% page-warning %}}
Before comencing an upgrade to v7 you should upgrade Stroom to the latest minor and patch version of v6.
{{% /page-warning %}}

## Differences between v6 and v7

Stroom v7 has significant differences to v6 which make the upgrade process a little more complicated.

* v6 handled authentication using a separate application, _stroom-auth-service_, with its own database.
  In v7 authentication is handled either internally in stroom (the default) or by an external identity provider such as google or AWS Cognito.
* v6 used a stroom.conf file or environment variables for configuration.
  In v7 stroom uses a config.yml file for its configuration (see [Properties]({{< relref "../../user-guide/properties.md" >}}))
* v6 used upper case and heavily abbreviated names for its tables.
  In v7 clearer and lower case table names are used.
  As a result ALL v6 tables get renamed with the prefix `OLD_`, the new tables created and any content copied over.
  As the database will be holding two copies of most data you need to ensure you have space to accomodate it.

## Pre-Upgrade tasks

The following steps are required to be performed before migrating from v6 to v7.

### Download migration scripts

Download the migration SQL scripts from https://github.com/gchq/stroom/blob/STROOM_VERSION/scripts
e.g. https://github.com/gchq/stroom/blob/v7.0-beta.133/scripts

These scripts will be used in the steps below.

### Pre-migration database checks

Run the pre-migration checks script on the running database.

{{< command-line "stroomuser" "localhost" >}}
docker exec \
-i \
stroom-all-dbs \
mysql --table -u"stroomuser" -p"stroompassword1" stroom \
< v7_db_pre_migration_checks.sql
{{</ command-line >}}

This will produce a report of items that will not be migrated or need attention before migration.

### Stop processing

Before shutting stroom down it is wise to turn off stream processing and let all outstanding server tasks complete.

*TODO* clairfy steps for this.

### Stop the stack

Stop the stack (stroom and the database) then start up the database.
Do this using the v6 stack.
This ensures that stroom is not trying to access the database.

{{< command-line "stroomuser" "localhost" >}}
./stop.sh
./start.sh stroom-all-dbs
{{</ command-line >}}

### Backup the databases

Backup all the databases for the different components.
Typically these will be `stroom`, `stats` and `auth`.

If you are running in a docker stack then you can run the `./backup_databases.sh` script.

### Stop the database

Stop the database using the v6 stack.

{{< command-line "stroomuser" "localhost" >}}
./stop.sh
{{</ command-line >}}

### Deploy and configure v7

Deploy the v7 stack.
*TODO* - more detail

Verify the database connection configuration for the stroom and stats databases.
Ensure that there is NOT any configuration for a separate auth database as this will now be in stroom.

### Running `mysql_upgrade`

Stroom v6 ran on mysql v5.6.
Stroom v7 runs on mysql v8.
The upgrade path for MySQL is 5.6 => 5.7.33 => 8.x

To ensure the database is up to date `mysql_upgrade` neeeds to be run using the 5.7.33 binaries, see the {{< external-link "MySQL documentation" "https://dev.mysql.com/doc/refman/8.0/en/mysql-upgrade.html" >}}.

This is the process for upgrading the database. All of these commands are using the v7 stack.

{{< command-line "stroomuser" "localhost" >}}
# Set the version of the MySQL docker image to use
export MYSQL_TAG=5.7.33
(out)
# Start MySQL at v5.7, this will recreate the container
./start.sh stroom-all-dbs
(out)
# Run the upgrade from 5.6 => 5.7.33
docker exec -it stroom-all-dbs mysql_upgrade -u"root" -p"my-secret-pw"
(out)
# Stop MySQL
./stop.sh
(out)
# Unset the tag variable so that it now uses the default from the stack (8.x)
unset MYSQL_TAG
(out)
# Start MySQL at v8.x, this will recreate the container and run the upgrade from 5.7.33=>8
./start.sh stroom-all-dbs
(out)
./stop.sh
{{</ command-line >}}

### Rename legacy stroom-auth tables

Run this command to connect to the `auth` database and run the pre-migration SQL script.

{{< command-line "stroomuser" "localhost" >}}
docker exec \
-i \
stroom-all-dbs \
mysql --table -u"authuser" -p"stroompassword1" auth \
< v7_auth_db_table_rename.sql
{{</ command-line >}}

This will rename all but one of the tables in the `auth` database.

### Copy the `auth` database content to `stroom`

Having run the table rename perform another backup of just the `auth` database.

{{< command-line "stroomuser" "localhost" >}}
./backup_databases.sh . auth

{{</ command-line >}}
Now restore this backup into the `stroom` database.
You can use the v7 stack scripts to do this.

{{< command-line "stroomuser" "localhost" >}}
./restore_database.sh stroom auth_20210312143513.sql.gz
{{</ command-line >}}

You should now see the following tables in the `stroom` database:

```text
OLD_AUTH_json_web_key
OLD_AUTH_schema_version
OLD_AUTH_token_types
OLD_AUTH_tokens
OLD_AUTH_users
```

This can be checked by running the following in the v7 stack.

{{< command-line "stroomuser" "localhost" >}}
echo 'select table_name from information_schema.tables where table_name like "OLD_AUTH%"' \
| ./database_shell.sh
{{</ command-line >}}

### Drop unused databases

There may be a number of databases that are no longer used that can be dropped prior to the upgrade.
Note the use of the `--force` argument so it copes with users that are not there.

{{< command-line "stroomuser" "localhost" >}}
docker exec \
-i \
stroom-all-dbs \
mysql --force -u"root" -p"my-secret-pw" \
< v7_drop_unused_databases.sql
{{</ command-line >}}

Verify it worked with:

{{< command-line "stroomuser" "localhost" >}}
echo 'show databases;' | docker exec -i stroom-all-dbs mysql -u"root" -p"my-secret-pw"
{{</ command-line >}}

## Performing the upgrade

To perform the stroom schema upgrade to v7 run the migrate command which will migrate the database then exit.
For a large upgrade like this is it is preferable to run the migrate command rather than just starting stroom as stroom will only migrate the parts of the schema as it needs to use them.
Running migrate ensures all parts of the migration are completed when the command is run and no other parts of stroom will be started.

{{< command-line "stroomuser" "localhost" >}}
./migrate.sh
{{</ command-line >}}

## Post-Upgrade tasks

*TODO* remove auth* containers,images,volumes


text:
# k8s-lab
A repo where I keep all configs for a k8s cluster playground.

# installation
- 2 GB RAM, 2 vCPU per host
- ubuntu 18
- 1 master, 2 workers on LAN
- disable swap
- cri docker https://kubernetes.io/docs/setup/production-environment/container-runtimes
- cni flannel https://github.com/coreos/flannel
- k8s 1.18 (kubelet, kubeadm, kubectl)

# dummy app
I'll use a dummy blogging app to test things. It'll be as simple as possible. See app/README.md

# todos
- [ ] verify cluster integrity https://github.com/vmware-tanzu/sonobuoy
- [ ] terraform
- [ ] everything as code for maximum reproducability
- [ ] traefik
- [ ] iptables
- [ ] namespaces
- [ ] add worker node post setup
- [ ] logging
- [ ] sysdig cloud
- [ ] fault tolerance
- [ ] bump k8s version i.e kubeadm upgrade
- [ ] persistant storage
- [ ] ci/cd
- [ ] tracing
- [ ] metrics (k8s objects, host, app, db, 4 goldens sigs)
- [x] rolling updates
- [ ] rollback
- [ ] synthetic traffic
- [ ] run custom registry https://docs.docker.com/registry/deploying/
- [x] remote kubectl
- [ ] k8s events
- [ ] drain a node https://kubernetes.io/docs/tasks/administer-cluster/safely-drain-node/ (cordon, drain, uncordon node)
- [ ] pod Disruption Budget https://kubernetes.io/docs/tasks/run-application/configure-pdb/
- [ ] create dev role

# license
MIT


text:
# Anthemis chia subsp. visianii (E.Weiss) Nyman SUBSPECIES

#### Status
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
null

#### Original name
null

### Remarks
null

path: /life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Anthemis/Anthemis chia/ Syn. Anthemis chia visianii/README.md


text:
---
id: architecture
title: Architecture
---

## How rendering works

Renderer architecture displayed on the scheme:

![](/img/architecture.png)

[Source](https://www.figma.com/file/URczwfB64Pn6SlFICHKh6y/React-Figma?node-id=0%3A1)

## File structure

* **/src**
  - **/components** - concrete components like Frame, Rectangle etc. that exported as a part of package API
  - **/helpers** - utility functions
  - **/hooks** - React hooks for components
  - **/mixins** - common functions for renderers that set some attributes to Figma nodes.
  Part of it is related to mixin interface inside Figma API.
  As an example `baseNodeMixin` related to `BaseNodeMixin`.
  - **/renderers** - functions that can create/update specific Figma nodes
  - **/styleTransformers** - functions for transforming set of component style
  - **index** - root of package export
  - **renderer** - core of renderer based on react-reconciler.
  - **types** - common props of components

repository: react-figma/react-figma

gha_language: TypeScript

repo_name: react-figma/react-figma


text:
# Running Benchmarks
This document explains how to benchmark the codebase and read benchmarks' results. It also provides a step-by-step tutorial to run benchmarks on [Amazon Web Services (AWS)](https://aws.amazon.com) accross multiple data centers (WAN).

## Local Benchmarks
When running benchmarks, the codebase is automatically compiled with the feature flag `benchmark`. This enables the node to print some special log entries that are then read by the python scripts and used to compute performance. These special log entries are clearly indicated with comments in the code: make sure to not alter them (otherwise the benchmark scripts will fail to interpret the logs).

### Parametrize the benchmark
After cloning the repo and [installing all dependencies](https://github.com/asonnino/narwhal#quick-start), you can use [Fabric](http://www.fabfile.org/) to run benchmarks on your local machine.  Locate the task called `local` in the file [fabfile.py](https://github.com/asonnino/narwhal/blob/master/benchmark/fabfile.py):
```python
@task
def local(ctx):
    ...
```
The task specifies two types of parameters, the *benchmark parameters* and the *nodes parameters*. The benchmark parameters look as follows:
```python
bench_params = {
    'nodes': 4,
    'workers': 1,
    'rate': 50_000,
    'tx_size': 512,
    'faults': 0,
    'duration': 20,
}
```
They specify the number of primaries (`nodes`) and workers per primary (`workers`) to deploy, the input rate (tx/s) at which the clients submits transactions to the system (`rate`), the size of each transaction in bytes (`tx_size`), the number of faulty nodes ('faults), and the duration of the benchmark in seconds (`duration`). The minimum transaction size is 9 bytes, this ensure that the transactions of a client are all different. The benchmarking script will deploy as many clients as workers and divide the input rate equally amongst each client. For instance, if you configure the testbed with 4 nodes, 1 worker per node, and an input rate of 1,000 tx/s (as in the example above), the scripts will deploy 4 clients each submitting transactions to one node at a rate of 250 tx/s. When the parameters `faults` is set to `f > 0`, the last `f` nodes and clients are not booted; the system will thus run with `n-f` nodes (and `n-f` clients).

The nodes parameters determine the configuration for the primaries and workers:
```python
node_params = {
    'header_size': 1_000,
    'max_header_delay': 100,
    'gc_depth': 50,
    'sync_retry_delay': 10_000,
    'sync_retry_nodes': 3,
    'batch_size': 500_000,
    'max_batch_delay': 100
}
```
They are defined as follows:
* `header_size`: The preferred header size. The primary creates a new header when it has enough parents and enough batches' digests to reach `header_size`. Denominated in bytes.
* `max_header_delay`: The maximum delay that the primary waits between generating two headers, even if the header did not reach `max_header_size`. Denominated in ms.
* `gc_depth`: The depth of the garbage collection (Denominated in number of rounds).
* `sync_retry_delay`: The delay after which the synchronizer retries to send sync requests. Denominated in ms.
* `sync_retry_nodes`: Determine with how many nodes to sync when re-trying to send sync-request. These nodes are picked at random from the committee.
* `batch_size`: The preferred batch size. The workers seal a batch of transactions when it reaches this size. Denominated in bytes.
* `max_batch_delay`: The delay after which the workers seal a batch of transactions, even if `max_batch_size` is not reached. Denominated in ms.

### Run the benchmark
Once you specified both `bench_params` and `node_params` as desired, run:
```
$ fab local
```
This command first recompiles your code in `release` mode (and with the `benchmark` feature flag activated), thus ensuring you always benchmark the latest version of your code. This may take a long time the first time you run it. It then generates the configuration files and keys for each node, and runs the benchmarks with the specified parameters. It finally parses the logs and displays a summary of the execution similarly to the one below. All the configuration and key files are hidden JSON files; i.e., their name starts with a dot (`.`), such as `.committee.json`.
```
-----------------------------------------
 SUMMARY:
-----------------------------------------
 + CONFIG:
 Faults: 0 node(s)
 Committee size: 4 node(s)
 Worker(s) per node: 1 worker(s)
 Collocate primary and workers: True
 Input rate: 50,000 tx/s
 Transaction size: 512 B
 Execution time: 19 s

 Header size: 1,000 B
 Max header delay: 100 ms
 GC depth: 50 round(s)
 Sync retry delay: 10,000 ms
 Sync retry nodes: 3 node(s)
 batch size: 500,000 B
 Max batch delay: 100 ms

 + RESULTS:
 Consensus TPS: 46,478 tx/s
 Consensus BPS: 23,796,531 B/s
 Consensus latency: 464 ms

 End-to-end TPS: 46,149 tx/s
 End-to-end BPS: 23,628,541 B/s
 End-to-end latency: 557 ms
-----------------------------------------
```
The 'Consensus TPS' and 'Consensus latency' respectively report the average throughput and latency without considering the client. The consensus latency thus refers to the time elapsed between the block's creation and its commit. In contrast, 'End-to-end TPS' and 'End-to-end latency' report the performance of the whole system, starting from when the client submits the transaction. The end-to-end latency is often called 'client-perceived latency'. To accurately measure this value without degrading performance, the client periodically submits 'sample' transactions that are tracked across all the modules until they get committed into a block; the benchmark scripts use sample transactions to estimate the end-to-end latency.

## AWS Benchmarks
This repo integrates various python scripts to deploy and benchmark the codebase on [Amazon Web Services (AWS)](https://aws.amazon.com). They are particularly useful to run benchmarks in the WAN, across multiple data centers. This section provides a step-by-step tutorial explaining how to use them.

### Step 1. Set up your AWS credentials
Set up your AWS credentials to enable programmatic access to your account from your local machine. These credentials will authorize your machine to create, delete, and edit instances on your AWS account programmatically. First of all, [find your 'access key id' and 'secret access key'](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html#cli-configure-quickstart-creds). Then, create a file `~/.aws/credentials` with the following content:
```
[default]
aws_access_key_id = YOUR_ACCESS_KEY_ID
aws_secret_access_key = YOUR_SECRET_ACCESS_KEY
```
Do not specify any AWS region in that file as the python scripts will allow you to handle multiple regions programmatically.

### Step 2. Add your SSH public key to your AWS account
You must now [add your SSH public key to your AWS account](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html). This operation is manual (AWS exposes little APIs to manipulate keys) and needs to be repeated for each AWS region that you plan to use. Upon importing your key, AWS requires you to choose a 'name' for your key; ensure you set the same name on all AWS regions. This SSH key will be used by the python scripts to execute commands and upload/download files to your AWS instances.
If you don't have an SSH key, you can create one using [ssh-keygen](https://www.ssh.com/ssh/keygen/):
```
$ ssh-keygen -f ~/.ssh/aws
```

### Step 3. Configure the testbed
The file [settings.json](https://github.com/asonnino/narwhal/blob/master/benchmark/settings.json) (located in [narwhal/benchmarks](https://github.com/asonnino/narwhal/blob/master/benchmark)) contains all the configuration parameters of the testbed to deploy. Its content looks as follows:
```json
{
    "key": {
        "name": "aws",
        "path": "/absolute/key/path"
    },
    "port": 5000,
    "repo": {
        "name": "narwhal",
        "url": "https://github.com/asonnino/narwhal.git",
        "branch": "master"
    },
    "instances": {
        "type": "m5d.8xlarge",
        "regions": ["us-east-1", "eu-north-1", "ap-southeast-2", "us-west-1", "ap-northeast-1"]
    }
}
```
The first block (`key`) contains information regarding your SSH key:
```json
"key": {
    "name": "aws",
    "path": "/absolute/key/path"
},
```
Enter the name of your SSH key; this is the name you specified in the AWS web console in step 2. Also, enter the absolute path of your SSH private key (using a relative path won't work).

The second block (`ports`) specifies the TCP ports to use:
```json
"port": 5000,
```
Narwhal requires a number of TCP ports, depening on the number of workers per node, Each primary requires 2 ports (one to receive messages from other primaties and one to receive messages from its workers), and each worker requires 3 ports (one to receive client transactions, one to receive messages from its primary, and one to receive messages from other workers). Note that the script will open a large port range (5000-7000) to the WAN on all your AWS instances.

The third block (`repo`) contains the information regarding the repository's name, the URL of the repo, and the branch containing the code to deploy:
```json
"repo": {
    "name": "narwhal",
    "url": "https://github.com/asonnino/narwhal.git",
    "branch": "master"
},
```
Remember to update the `url` field to the name of your repo. Modifying the branch name is particularly useful when testing new functionalities without having to checkout the code locally.

The the last block (`instances`) specifies the [AWS instance type](https://aws.amazon.com/ec2/instance-types) and the [AWS regions](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html#concepts-available-regions) to use:
```json
"instances": {
    "type": "m5d.8xlarge",
    "regions": ["us-east-1", "eu-north-1", "ap-southeast-2", "us-west-1", "ap-northeast-1"]
}
```
The instance type selects the hardware on which to deploy the testbed. For example, `m5d.8xlarge` instances come with 32 vCPUs (16 physical cores), 128 GB of RAM, and guarantee 10 Gbps of bandwidth. The python scripts will configure each instance with 300 GB of SSD hard drive. The `regions` field specifies the data centers to use. If you require more nodes than data centers, the python scripts will distribute the nodes as equally as possible amongst the data centers. All machines run a fresh install of Ubuntu Server 20.04.

### Step 4. Create a testbed
The AWS instances are orchestrated with [Fabric](http://www.fabfile.org) from the file [fabfile.py](https://github.com/asonnino/narwhal/blob/master/benchmark/fabfile.pyy) (located in [narwhal/benchmarks](https://github.com/asonnino/narwhal/blob/master/benchmark)); you can list all possible commands as follows:
```
$ cd narwhal/benchmark
$ fab --list
```
The command `fab create` creates new AWS instances; open [fabfile.py](https://github.com/asonnino/narwhal/blob/master/benchmark/fabfile.py) and locate the `create` task:
```python
@task
def create(ctx, nodes=2):
    ...
```
The parameter `nodes` determines how many instances to create in *each* AWS region. That is, if you specified 5 AWS regions as in the example of step 3, setting `nodes=2` will creates a total of 10 machines:
```
$ fab create

Creating 10 instances |██████████████████████████████| 100.0%
Waiting for all instances to boot...
Successfully created 10 new instances
```
You can then clone the repo and install rust on the remote instances with `fab install`:
```
$ fab install

Installing rust and cloning the repo...
Initialized testbed of 10 nodes
```
This may take a long time as the command will first update all instances.
The commands `fab stop` and `fab start` respectively stop and start the testbed without destroying it (it is good practice to stop the testbed when not in use as AWS can be quite expensive); and `fab destroy` terminates all instances and destroys the testbed. Note that, depending on the instance types, AWS instances may take up to several minutes to fully start or stop. The command `fab info` displays a nice summary of all available machines and information to manually connect to them (for debug).

### Step 5. Run a benchmark
After setting up the testbed, running a benchmark on AWS is similar to running it locally (see [Run Local Benchmarks](https://github.com/asonnino/narwhal/tree/master/benchmark#local-benchmarks)). Locate the task `remote` in [fabfile.py](https://github.com/asonnino/narwhal/blob/master/benchmark/fabfile.py):
```python
@task
def remote(ctx):
    ...
```
The benchmark parameters are similar to [local benchmarks](https://github.com/asonnino/narwhal/tree/master/benchmark#local-benchmarks) but allow to specify the number of nodes and the input rate as arrays to automate multiple benchmarks with a single command. The parameter `runs` specifies the number of times to repeat each benchmark (to later compute the average and stdev of the results), and the parameter `collocate` specifies whether to collocate all the node's workers and the primary on the same machine. If `collocate` is set to `False`, the script will run one node per data center (AWS region), with its primary and each of its worker running on a dedicated instance.
```python
bench_params = {
    'nodes': [10, 20, 30],
    'workers: 2,
    'collocate': True,
    'rate': [20_000, 30_000, 40_000],
    'tx_size': 512,
    'faults': 0,
    'duration': 300,
    'runs': 2,
}
```
Similarly to local benchmarks, the scripts will deploy as many clients as workers and divide the input rate equally amongst each client. Each client is colocated with a worker, and only submit transactions to the worker with whom they share the machine.

Once you specified both `bench_params` and `node_params` as desired, run:
```
$ fab remote
```
This command first updates all machines with the latest commit of the GitHub repo and branch specified in your file [settings.json](https://github.com/asonnino/narwhal/blob/master/benchmark/settings.json) (step 3); this ensures that benchmarks are always run with the latest version of the code. It then generates and uploads the configuration files to each machine, runs the benchmarks with the specified parameters, and downloads the logs. It finally parses the logs and prints the results into a folder called `results` (which is automatically created if it doesn't already exists). You can run `fab remote` multiple times without fearing to override previous results, the command either appends new results to a file containing existing ones or prints them in separate files. If anything goes wrong during a benchmark, you can always stop it by running `fab kill`.

### Step 6. Plot the results
Once you have enough results, you can aggregate and plot them:
```
$ fab plot
```
This command creates a latency graph, a throughput graph, and a robustness graph in a folder called `plots` (which is automatically created if it doesn't already exists). You can adjust the plot parameters to filter which curves to add to the plot:
```python
plot_params = {
    'faults': [0],
    'nodes': [10, 20, 50],
    'workers': [1],
    'collocate': True,
    'tx_size': 512,
    'max_latency': [3_500, 4_500]
}
```

The first graph ('latency') plots the latency versus the throughput. It shows that the latency is low until a fairly neat threshold after which it drastically increases. Determining this threshold is crucial to understand the limits of the system.

Another challenge is comparing apples-to-apples between different deployments of the system. The challenge here is again that latency and throughput are interdependent, as a result a throughput/number of nodes chart could be tricky to produce fairly. The way to do it is to define a maximum latency and measure the throughput at this point instead of simply pushing every system to its peak throughput (where latency is meaningless). The second graph ('tps') plots the maximum achievable throughput under a maximum latency for different numbers of nodes.

repository: facebookresearch/narwhal

gha_language: Rust

repo_name: facebookresearch/narwhal


text:
# Requests and Responses

Everything in joy revolves around request and response maps.

## Requests

Requests in joy look like this:

```clojure
{:uri "/"
 :method "GET"
 :headers {"Accept" "text/html"}}
```

Keep that structure in your mind because it gets passed to every route and every handler and every middleware function and every form helper, it's everywhere. It ties the whole thing together and makes everything work.

Here's what I mean.

Take a look at this route:

```clojure
(defroutes app
  [:get "/" home])
```

Now take a look at this handler

```clojure
(defn home [request]
  {:status 200 :body "home" :headers {"Content-Type" "text/plain"}})
```

That `request` argument to that function has the structure from before:

```clojure
(defn home [{:uri uri :method method :headers headers}]
  {:status 200 :body "home" :headers {"Content-Type" "text/plain"}})
```

### Responses

If you were so inclined to destructure it, that's what it looks like. Now take a closer look at that response, they always have this structure:

```clojure
{:status 200
 :body "body"
 :headers {"Content-Type" "application/json"}}
```

That's pretty much all there is to joy, it's dictionaries in and dictionaries out for the most part. The thing that makes the framework a framework is the [middleware](middleware.md) and to some extent the various helpers that help with [routing](routing.md) and [form submission](form-submission.md).

repository: joy-framework/joy

gha_language: Clojure

repo_name: joy-framework/joy


text:
# A classical (non-quantum) implementation of the (quantum) Grover's algorithm

This is a classical (non-quantum) implementation of the (quantum) Grover's algorithm. The Grover's algorithm (https://en.wikipedia.org/wiki/Grover%27s_algorithm) is an algorithm that, with high probability, identifies a solution to a black box function. Thanks to Yihui Quek (https://github.com/yquek) for explaining the algorithm to me.

## Introduction
For a black box function `f(x)` with `N` potential solutions `[x1,x2,...,xN]` (among which `k` are correct), the Grover's algorithm can with high probability identify one of the correct solutions in order `sqrt(N)` steps. This is a significant speedup compared to the order `N` steps required by the classical approach, which generally involves checking all potential solutions.

## Classical representation of the quantum states and operators
This implementation is classical -- it runs on a classical computer. It therefore has to (expensively) simulate the quantum states and operators that would normally be implemented automatically by the virtue of nature being quantum. For the `N` potential solutions, we can use `N_q = ceil(log_2(N))` qubits, which are specified by `2^(N_q)` complex numbers (minus the normalization).

The `N_qubit` quantum state is represented as a *vector* of `2^N_qubit` complex numbers whose magnitudes sum to 1 (probability normalization) (https://en.wikipedia.org/wiki/Quantum_state).

Operations on the quantum state are represented as unitary `2^N_qubit x 2^N_qubit` matrices (https://en.wikipedia.org/wiki/Operator_(physics)#Operators_in_quantum_mechanics). To evolve the quantum state, you can matrix-multiply its vector with the corresponding matrix.

In the final step, the probability that a particular answer comes out after measuring the resulting quantum state is the square of the norm of the corresponding complex number in the vector representation of the quantum state.

## The program
The number of pontential solutions is specified by `N_potential_solutions` and the number of correct ones is `N_correct_solutions`. The expected number of steps to run the algorithm for is calculated in `steps_to_stop`.

The program finds a solution to an example problem and generates 2 plots: a) the gradual rotation of the quantum state towards the subspace of correct solutions, and b) the gradual concentration of amplitude on the correct solutions.

## Examples of state rotation towards correct solutions
![State rotation, example 1](grovers_rotation_20_1.png)
![State rotation, example 2](grovers_rotation_100_1.png)
![State rotation, example 2](grovers_rotation_500_1.png)

## Examples of amplitude concentration on the correct solution
![Amplitude concentration, example 1](grovers_probs_20_2.png)


text:
# System Wizualizacji Rozdzielni (switchgear visualisation system)

## Table of contents
* [General info](#general-info)
* [Features](#features)
* [Screenshots](#screenshots)
* [Technologies](#technologies)
* [Setup](#setup)
* [Status](#status)
* [Contact](#contact)

## General info
Switchgear visualisation system - my project made for study subject called "Advanced internet programming technologies". It's simple web application written in PHP, it uses SQLite database to store information and GD2 library for dynamic image generation. For front-end only basic HTML and CSS was used.

This is my first encounter with PHP and the code is a bit messy. Despite this I managed to get the highest mark and distinction by teacher for making this project.

## Features
* graphical visualisation of switchgear - includes information about status, number and type of bay; shows information about devices installed in each bay (dynamic generation of picture using GD2 library and information stored in database)
* user control panel for system management, two types of accounts with different permission - normal user can add, edit and delete information about bays and devices; administrator can additionaly add, edit or delete users
* each user can change own password
* data stored in SQLite database (connection to database established using PDO library)

## Screenshots

### Homepage of the project
![screenshot](./img/1.JPG)

### Login page
![screenshot](./img/2.JPG)

### User control panel page
![screenshot](./img/3.JPG)

### Bay list page
![screenshot](./img/4.JPG)

### Bay management page
![screenshot](./img/5.JPG)

## Technologies
* HTML 5
* CSS 3
* PHP 7 (with PDO and GD2 libraries)
* SQLite 3

## Setup
1. Copy all files to your PHP-configured web server.
2. Remove semicolons in following lines in your php.ini file to enable required extensions:
`;extension_dir = "ext"`
`;extension=gd2`
`;extension=pdo_sqlite`
3. Accounts in default database:
  * `username: admin1`
`password: !admin111`
  * `username: admin2`
`password: @admin222`
  * `username: user1`
`password: !user111`
  * `username: user2`
`password: @user222`

## Status
Project is: **finished**

## Contact
Created by [@RafalMroz94](https://github.com/RafalMroz94)
Feel free to contact me via e-mail<EMAIL_ADDRESS>


text:
# Supported query string

Here the list of supported query string parameters

## layout

Specify the layout to use

```
...?layout=top
```

> **Available values** : top | right | bottom | left | vertical | horizontal

## cwd

Set the working directory for the code-playground to look for the ```code-playground.config.js``` file etc...

```
...?cwd=/Users/cooluser/cool-project
```

> If you have specify the ```config.secret``` config, this parameter has to be passed encrypted and will be decrypted by the server. This is made in order to not expose your server folder structure to the public.
> The encryption/decryption is made with the [cryptr npm package](https://www.npmjs.com/package/cryptr).

## demo

Specify the demo in the current app that you want to display. The demo need to be registered through the ```config.demos``` config like so:

```
...?demo=demo1
```

```js
module.exports = {
	demos: {
		demo1: {
			title: 'Demo #1',
			editors: {
				html: {
					language: 'html',
					data: `<h1>My cool demo</h1>`
				}
			}
		}
	}
}
```

## app

Specify the app that you want to target. The app has to be registered through the ```config.apps``` config like so:

```
...?app=my-cool-app
```

```js
module.exports = {
	apps : {
		'my-cool-app' : '/Users/cooluser/my-cool-app'
	}
};
```

repository: jd-buzz/coffeekraken

repo_name: jd-buzz/coffeekraken


text:
# Project 3: Restaurant Reviews

This is the third project as part of the Udacity Senior Web Developer Nano Degree.

This is restaurant reviews application that collects reviews from users and provides them alongside basic information about each restaurant (restaurant names, a photograph, address and operating hours).

**Accessible:** The focus of this project is to ensure that this site is current with web accissiblity standards.  This site demonstrates accessiblity across several areas.

## Features
**Accesibility Features**

1. **Images**
	All content-related images include appropriate alternate text.

2. **Focus**
	Focus is appropriately managed allowing users to noticeably tab through each of the important elements of the page.

3. **Elements**
	Elements on the page use the appropriate semantic elements. For those elements in which a semantic element is not available, appropriate `ARIA roles` are defined.

4. **Design**
	Color selections and contrast are made with accessibility in mind.

**Basic Features**

1. **Responsiveness**
	App is equally functional on mobile and desktop, using responsive design to ensure its displayed in a useable state.

## Instructions

1. **Clone the repository**

	`git clone <git@github.com:ianemcallister/Restaurant_Reviews.git>`

2. **Install the dependencies**

	To install the required dependencies call `npm install` from the root directory.

4. **Launch the server and run the client site**

	Run `gulp serve:production` or `npm start` to serve the project up. The server will start listening on port 3000.

	In your browser navicate to `localhost:3000`.

## Hosted Site

TBD

## Dependencies

This project utilizes a number of dependencies that can be thorougly expored in the package.json file.

## Credits

Thank you to [Swiip](https://github.com/Swiip) and the [generator-gulp-angular](https://github.com/Swiip/generator-gulp-angular) team.  I enjoyed using the angular-gulp generator to get my project up and running.

## License

Copyright © 2016 Ian McAllister. This source code is licensed under the [MIT license](https://en.wikipedia.org/wiki/MIT_License).


text:
# Operating Systems

## Window Managers

* bspwm — A tiling window manager based on binary space partitioning
  https://github.com/baskerville/bspwm
* i3wm — improved tiling wm
  https://i3wm.org/

## Nix

* I was Wrong about Nix
  https://christine.website/blog/i-was-wrong-about-nix-2020-02-10

repository: maciejsmolinski/learnings

repo_name: maciejsmolinski/learnings


text:
# Provisioning Service

A quick and dirty provisioning service to manage the lifecycle of Impala clusters.  See
[provisioner.yaml](./provisioner.yaml) for the Altus-style API specification.  In a proper
implementation this would be split into an Altus API gateway and backend provisioning service.

## Development

```sh
npm install
node server.js
```

## Deployment


text:
  A food delivery system - Delivery in minutes to your Home

  Features   |
  Repositories   |
  License

## :pizza: About the project

**Foodiee** is a food delivery system built using only the JavaScript programming language. In this system, the administrator can register new restaurants, employees can register new products, customers can place orders and much more! The stack chosen to create this system was: React, to create the web pages. Express, to create the REST API. React Native, to create mobile apps. The web client, the REST API and the mobile client were developed using TypeScript and TDD.

## :rocket: Features

- **React Js** — A JavaScript library for building user interfaces
- **React Native** — A lib that provides a way to create native apps for Android and iOS
- **Express** — A web framework for Node

## :information_source: Repositories

To make this project more organized, I moved the applications **(rest api, admin website, tenants website, customer mobile app)** to 4 different repositories.

Here are the links to them

- [REST API](https://github.com/greysonmrx/foodiee-backend)
- [Admin Website](https://github.com/greysonmrx/foodiee-admin)
- [Tenants Website](https://github.com/greysonmrx/foodiee-tenants)
- [Mobile client](https://github.com/greysonmrx/foodiee-customer)

## :memo: License

This project is licensed under the MIT License - see the [LICENSE.md](./LICENSE.md) file for details.

---

Made with :hearts: by Greyson :wave: [See my linkedin](https://www.linkedin.com/in/greyson-mascarenhas-5a21ab1a2/)

repository: greysonmrx/foodiee

repo_name: greysonmrx/foodiee


text:
## dots / brew / readme

there appears to be a limitation when installing `Lulu.app` (and/or) ∨ `Rectangle.app` using `brew install --cask` that prevents the apps from launching on **boo👻oooot.**

  > 🌶  **fix** install the apps using the dmgs from the github releases for the time being.

repository: ipatch/dotfiles

gha_language: Vim script

repo_name: ipatch/dotfiles


text:
We are always refining our UI and UX, to achieve the best and smoothest experience possible,
but at the same time give you enough room for experimentation and customization.

Because of the very reason of us believing that you should be able to do everything you want with Bitrise,
it can seem a bit complex in a few parts.

This guide will help you get your first app up and running on Bitrise. Let's dive in!

First of all you have to open the [Add New App page](https://www.bitrise.io/apps/add),
either by clicking the `Add` button on the [Dashboard](https://www.bitrise.io/dashboard),
or selecting the `Add new App` option in the Account drop down menu (top right corner).

## 1. Code repository setup

The first step of adding an app is to specify where its code is stored.

You have two main options here:

1. You store your code on [GitHub.com](https://github.com/), [Bitbucket.org](https://bitbucket.org/) or [GitLab.com](https://gitlab.com/)
1. You store your code somewhere else

### GitHub / Bitbucket / GitLab

This is fairly easy. Just click on the tab where you have the repo you want to add to Bitrise.
If you haven't connected your GitHub, Bitbucket or GitLab account, click on the green button to do so.
After that you'll see all your repos listed with an option to filter them.
Your personal repos are separated from the ones that belong to an organization or other user.
If you hover on the repository names, you can get a glimpse of its description, too.
Select the repository from the list to proceed to the next step.

!!! note "Why does Bitrise need write permissions on Github/Bitbucket/GitLab?"
    There are two things that Bitrise couldn't do without write permissions:

    - Adding an SSH key to the selected repository
    - Registering a Webhook for the repository

    Please note, that __if you want to avoid giving Bitrise write permissions,
    you can select the `Other / Manual` option__, and do the setup yourself.

### Other / Manual setup option

On this tab, you just have to paste your HTTPS git clone URL where Bitrise can access your code.
Paste the URL and click on `Next` to proceed.

## 2. Setup repository access

### Auto-add the SSH key Bitrise generated for you

_This option is available for GitHub, Bitbucket and GitLab.com repositories,
if you have your account connected to your Bitrise account._

This is the easieast, fastest way. You can just click on `Auto add`
__if you have admin rights to the repo__ you selected.

### Copy the public key Bitrise generated

Copy the __public key__ to your provider's account (*not* as a deployment key).
You can use this option if you don't have admin rights to the repo,
or if the repository is not hosted on GitHub, Bitbucket or GitLab.com.

Choose this option also if you use submodules and want to use the same SSH key for multiple repositories.
If you use submodules or private Cocoapods,
use this guide: [Adding projects with submodules](/faq/adding-projects-with-submodules/)

### Use your own keypair

You can paste your existing SSH __private key__ to the text area on the bottom of this section.
__Make sure it is an RSA private key without a passphrase,__
otherwise you won't be able to use it on Bitrise.

You can find a guide [here](/faq/how-to-generate-ssh-keypair/) about
how you can generate an SSH key like this.

If you use submodules, private Cocoapods,
or have to access more than one private repository
during the build, you should check this guide: [Adding projects with submodules](/faq/adding-projects-with-submodules/)

## 3. Validation setup

In this section you have to specify a branch, which will be used in the next step:
your repository will be cloned, the specified branch will be checked out,
and our [open source project scanner](https://github.com/bitrise-core/bitrise-init)
will scan through the repository, and will construct base configuration(s)
appropriate for your project.

*You can choose to configure your project manually.
This is only recommended if you can't use the automatic
project scanner to generate a good base configuration for you.
Choose this option only if you really know what you're doing,
or if you can't use the automatic scanner!*

## 4. Validating repository

You don't have to do anything in this section. A validation
is started automatically after you finished in the previous section.
You can check the progress and the logs of the validation while it runs,
and the errors and warnings in case the scanner would generate any.

## 5. Project build configuration

Platform selection: We try to detect on validation whether you added an Android, iOS, or Xamarin project,
or any other project type the [scanner](https://github.com/bitrise-core/bitrise-init) supports.
If we succeed, only the one, corresponding tab will be active.
If we fail to detect it, you have to select one and configure it manually.

We will also try to detect your build configuration automatically, based on your project settings / project
files in the repository.

## 6. Webhook setup

If we have support for adding webhooks automatically to the source code hosting
service you use, you can add the webhook in this section with a single click.

!!! warning "Error: Webhook registration failed"
    If you see a message like this, that means that you don't have admin rights to the repo,
    so no webhook could be created. Contact the administrator, register the webhook manually as described below
    or skip this step if you're OK with starting builds manually (not advised).

Otherwise you'll see information about how you can do this manually in this section.

You can find the webhook setup guide [here](/webhooks/),
if you'd have to do this manually.

## 7. Finishing

After you finish in the "webhook" section, a build is triggered automatically
for your app, with the base configuration detected and generated by
the "Repository validator / scanner". At this point you should have
a base working configuration, which you'll be able to improve and change
to fit your project's development process.

repository: DanielMSchmidt/devcenter

gha_language: HTML

repo_name: DanielMSchmidt/devcenter


text:
# Builder.io Kontent.ai plugin

Connect your Kontent.ai project data to your Builder.io project!

## Installation

Go to [builder.io/account/space](https://builder.io/account/space) and type<EMAIL_ADDRESS>in the text input.

![Installation screenshot](https://cdn.builder.io/api/v1/image/assets%2Fe85723a1cdde410591c232f4b375ef9b%2F9521aee97c2c40fa95750c2841e57f37)

Then hit save, you'll be prompted for to enter your `projectId`, which you can get from your ["Project Settings" > "API keys" in Kontent.ai application](https://kontent.ai/learn/tutorials/develop-apps/get-content/get-content-items/#a-1-find-your-project-id).

![Configuration screenshot](https://cdn.builder.io/api/v1/image/assets%2Fe85723a1cdde410591c232f4b375ef9b%2F2ce86dc1cd334f0980403cc5a57aa385)

## Usage

When you have data that resides in Kontent.ai that you want to use in your Builder app, you can use Builder's data provider plugin to fetch and display it on your site.

> For following showcase we are using tha sample project created in [Kontent.ai](https://kontent.ai/) for demonstration purposes - it's project ID is `975bf280-fd91-488c-994c-2f04416e5ee3`.

Once you have your plugin configured, your Builder.io project allow you to select items you what to use on your site.

First, create a new page and insert a text block to your page.

![Adding first text block](https://cdn.builder.io/api/v1/image/assets%2Fe85723a1cdde410591c232f4b375ef9b%2F449d4c0c99d2482bb824ea10d1cd87df)

Now let's connect data from Kontent.ai with Builder's page. Select data tab and use "Connect data" button to select Kontent.ai.

![Connect Kontent.ai with Builder.io's page](https://cdn.builder.io/api/v1/image/assets%2F0b9554e4c74747a08f247f55227230e0%2Fb6e1c8592d9a435c9ec936b5fb54db71)

Then pick the [content type](https://kontent.ai/learn/tutorials/references/terminology/#a-content-type) you want to select item(s) based on (i.e. `Article`).

![Picking content type](https://cdn.builder.io/api/v1/image/assets%2Fe85723a1cdde410591c232f4b375ef9b%2Ffcac7f18a9544a41b1f92b24ad760d07)

Pick a [content item](https://kontent.ai/learn/tutorials/references/terminology/#a-content-item) (entry) base on the content type you picked (i.e. `Coffee processing techniques`).

![Picking content item](https://cdn.builder.io/api/v1/image/assets%2Fe85723a1cdde410591c232f4b375ef9b%2Fe167b0d2ca7b4892afa2c55f6a4a53ec)

Edit text block properties (by double click on in) and select "Edit bindings".

![Open text block bindings settings](https://cdn.builder.io/api/v1/image/assets%2Fe85723a1cdde410591c232f4b375ef9b%2F168b8937434a4b8099204c0fb1f150f3)

Select the value of element (i.e. `title`'s value) - you can use search box for easier selection.

![Select title value to bindings](https://cdn.builder.io/api/v1/image/assets%2Fe85723a1cdde410591c232f4b375ef9b%2Feeb2c7fa678c422d8f3e83245b595366)

Now repeat for second text element (you don't need to pick an entry again) and set text clock binding to other element's value (i.e. `body_copy`).

![Setting second text block bindings](https://cdn.builder.io/api/v1/image/assets%2F0b9554e4c74747a08f247f55227230e0%2F0f18dfebebcf4ba99700eb5c3e83796d)

Finally tune up a style a little - set heading fon size to 32px site and edit layout around of the article to have 640px width and center it horizontally and here we go:

![Final article showcase](https://cdn.builder.io/api/v1/image/assets%2F0b9554e4c74747a08f247f55227230e0%2F2198adfdaf814cf3a85494477a0af1fb)

repository: BuilderIO/builder

repo_name: BuilderIO/builder


text:
## uodashboard
UO Dashboard for allowing external agencies to view the images being captured in real-time

> Note:
> - The cam_name for metadata is obtained from the filename. Make sure it is consistent with image capture script.
The format is <img count>_<cam name>_<time since epoch>.
> - `cam name` is the last octet of the mac address (consistent with [`cuip`](https://github.com/Mohitsharma44/cuip))


text:
# Data Exploration
Automated data exploration in R

## Getting Started

Using this tool is a simple as importing the ```dataExporation.R``` functions and passing in a DataFrame of interest.

```
data <- read.csv("your_data_file.csv")

source("dataExplore.R")
dataExplore(data)
```

Note that the scripts and RMD files need to be in the working directory for this to work.

#### Prerequisites

Required: ```R, RStudio``` are needed, and the ```dataExporation.R, univarient.R, bivarient.R, main.RMD``` files should be in the working directory.

## Analysis

The tool creates a data summary, a univarient (distribution) analysis and a bivarient (correlation and regression) analysis. Full example outputs are available for [the Titanic dataset](http://www.grantholtes.com/Titanic.html?) and [macroeconomic data](http://www.grantholtes.com/Swiss.html?)

#### Data summary
High level information about the dataset.

![UniVar Summary](https://github.com/Gholtes/dataExploration/blob/master/images/highLevel.PNG)

#### Univarient analysis
Detailed analysis of each variable and their distributions.

![UniVar Summary](https://github.com/Gholtes/dataExploration/blob/master/images/uniVar.PNG)

#### Bivarient analysis
Analysis of the relationships between variables using correlation, regression and scatter plots.

![UniVar Summary](https://github.com/Gholtes/dataExploration/blob/master/images/biVar1.PNG)

![UniVar Summary](https://github.com/Gholtes/dataExploration/blob/master/images/biVar2.PNG)

## License

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details

repository: Gholtes/dataExploration

repo_name: Gholtes/dataExploration


text:
# splashcard
A simple card-based splash page template

## What?
I find myself making a lot of quick and dirty splash pages based on a single, centered card layout. This is a simple template that I can use as a foundation.

## But why?
Never spend five minutes doing something when you can spend five hours failing to automate it.

## There are already so many of these.
I know, but this is one is *mine*.

## Alright fine, but why doesn't it support...?
Probably becuase I haven't needed that thing yet.

## Licensing
I can't imagine anyone else will actually use this, but nonetheless this project is licensed under the terms of the MIT license.

repository: culturestate/splashcard

repo_name: culturestate/splashcard


text:
# Session 2 Part 1

So far, our circuit simulation has been running sequentially. In this session, we'll work on parallelizing the code. This will require us to do two things. First, we must describe how regions are *partitioned* (decomposed into pieces), so that Regent can determine what portions of the computation may run in parallel. Second, we'll need to update the tasks to use these newly partitioned regions.

Let's start with partitioning.

Partitioning is critical in Regent for two reasons. First, partitioning determines what data parallelism is available in the application (if any). Second, partitioning limits the amount of data movement required to perform a computation. Therefore, it will be important to think carefully about the access patterns (read and write sets) of each task in order to construct a good partitioning.

Generally speaking, we'll start by creating an initial *independent* partition of the data (i.e. a partition which does not depend on other partitions). We can make this partition intelligent by, for example, running METIS and partitioning based on the result. But for this exercise, we'll assume that a simple *equal* partition will suffice. An example of such a partition might look like this:

Equal Partition of Nodes

Now, if the application required no communication between tasks, this might be the only partition we would need. However, the circuit simulation requires communication: updates to nodes in the graph generally require access to the values stored on adjacent nodes. Conceptually, we could solve this by taking the partition above and bloating it by one node in each direction. But this could be really inefficient, because it would require the runtime to move much more data than actually required for the computation. Critically, the only data that *must* move is data for nodes connected to nodes of a different color.

This requires the use of *dependent* partitions (i.e. partitions computed from other partitions). With the *preimage* operator, we can obtain a partition of edges where each edge has the color of its `in_node` field (shown on the left, below). Then we can use the *image* operator to follow the `out_node` field back to nodes (shown in the center, below). Note in particular that nodes marked with multiple colors are exactly the nodes which will be involved in communication. With a little more work, we can obtain a partition of crossing nodes (shown on the right, below).

Preimage (Partition of Wires)

Image (Partition of Nodes)

Crossing (Partition of Nodes)

With this in mind, we can now compute three new partitions (which will actually be used directly in the application):

Private (Partition of Nodes)

Shared (Partition of Nodes)

Ghost (Partition of Nodes)

When take all nodes of a color (e.g. red) together, you'll see that they correspond to the bloated set of nodes required for task (as we noted above). However (and this is important for performance) only the shared and ghost partitions must be communicated. The private partition is non-overlapping with the other two, and thus it can safely stay put for the duration of the simulation.

Your goal is to construct the four partitions above (private, shared and ghost nodes, and wires). You may find it helpful to construct several intermediate partitions, such as the image, preimage, and crossing partition above. (Note that there are multiple valid solutions; your intermediate partitions might look different from those above.) We have given you an initial equal partition of the nodes to help you get started.

## Syntax Guide


text:
# YOLO tools

download from http://www.agentspace.org/download/YOLOtools-1.0.0.zip
(and update from http://www.agentspace.org/download/YOLOtools-1.1.0.update.zip)

or a bigger package including darknet for windows and example pictures and videos
http://www.agentspace.org/download/darknet.zip

unpack and launch record.bat, make order in annotator\data (remove samples and transfer there your images)
and launch annotate.bat

The result can be used by DarkNet to produce your model of the YOLO detector,
see https://pjreddie.com/darknet/yolo/

An example of the result:

[![custom YOLO detector](https://img.youtube.com/vi/odZIUhqXA8A/0.jpg)](https://www.youtube.com/watch?v=odZIUhqXA8A)

repository: andylucny/YOLOtools

repo_name: andylucny/YOLOtools