text:
![LambdaTest Logo](https://www.lambdatest.com/static/images/logo.svg)
---
# Jest Tutorial For Selenium Test Automation

![Jest Tutorial](https://www.lambdatest.com/blog/wp-content/uploads/2020/04/Jest-Tutorial.jpg)

Jest is  an open source javascript testing framework developed by Facebook.Jest has exceptional  benefits of  easy set up, super fast execution,and provides an excellent combination of a test runner & an assertion library.

This tutorial will help you run Jest automation scripts over LambdaTest Selenium Grid.
## Prerequisites for Jest tutorial

**1.** Download an IDE. You can use **[Visual Studio IDE](https://code.visualstudio.com/download)** for your operating system.

**2. Node.js and Package Manager (npm)** : Install Node.js from their [official website](https://nodejs.org/en/download/) Or Install Node.js using command line. Go to the terminal or command prompt & run the below command.
```
$ install node
```
* If you already have Node.js installed then check the version using the command:
```
$ node -v
```
* If node isn’t of the latest version then you can update it using the below command.
```
$ npm install npm@latest -g
```
**3.** Next, you need to **install Jest**. Run the below command to install Jest:
```
$ npm install --save-dev jest
```
**4. LambdaTest Authentication Credentials**: Make sure you have your LambdaTest credentials with you to run test automation scripts with Jest on LambdaTest Selenium Grid. You can obtain these credentials from the [LambdaTest Automation Dashboard](https://automation.lambdatest.com/) or through [LambdaTest Profile](https://accounts.lambdatest.com/detail/profile).

Set **LambdaTest Username** and **Access Key** in environment variables.

  - For linux/mac
    ```
    export LT_USERNAME="YOUR_USERNAME"
    export LT_ACCESS_KEY="YOUR ACCESS KEY"
    ```
  - For Windows
    ```
    set LT_USERNAME="YOUR_USERNAME"
    set LT_ACCESS_KEY="YOUR ACCESS KEY"
    ```
## Setting Up The Project For Selenium Jest Tutorial In IDE

**Step 1** : After installation of the Visual Studio IDE, create a folder in your local system to save all the projects.

**Step 2** : Install the below extensions for JavaScript from ‘Extensions’ in VScode Editor.
         * Code Runner
         * JavaScript( ES6) code snippet
         * ES Lint

**Step 3**: Press ‘Ctrl+Shift+P’ and search for git:clone. Paste the URL of this repository(https://github.com/LambdaTest/jest-selenium-webdriver-sample.git) to clone.

**Step 4**: Press ENTER and save Jest project  in the above created folder.

**Step 5**: Open project directory **jest-selenium-webdriver-sample** in VScode.

**Step 6**: Create a project directory named  **‘jest-selenium-webdriver-sample’** and then we will create a subfolder named **‘test’**  with a test script name **‘single.test.js’** inside it.

**Step 7**: Finally, we will initialize our project by hitting the command npm init. This will create a package.json file in an interactive way, which will contain all our required project configurations. It will be required to execute our test script single.test.js. Here is that  **package.json**.
```
{
  "name": "jest-selenium-webdriver-sample",
  "version": "0.1.0",
  "description": "How to use Jest with Selenium tests on lambdatest",
  "keywords": [
    "javascript",
    "selenium",
    "local",
    "test",
    "jest"
  ],
  "scripts": {
    "test": "jest"
  },
  "author": "lambda qa",
  "license": "MIT",
  "devDependencies": {
    "babel-eslint": "^10.0.1",
    "babel-jest": "^24.8.0",
    "babel-plugin-external-helpers": "^6.22.0",
    "babel-plugin-transform-object-rest-spread": "^6.26.0",
    "babel-preset-env": "^1.7.0",
    "chromedriver": "^74.0.0",
    "eslint": "^5.16.0",
    "eslint-config-airbnb-base": "^13.1.0",
    "eslint-config-prettier": "^4.3.0",
    "eslint-plugin-import": "^2.17.3",
    "eslint-plugin-jest": "^22.6.4",
    "eslint-plugin-prettier": "^3.1.0",
    "jasmin": "0.0.2",
    "jasmine": "^3.4.0",
    "jest": "^24.9.0",
    "jest-environment-webdriver": "^0.2.0",
    "jsdom": "^15.1.1",
    "prettier": "^1.17.1",
    "rimraf": "^2.6.3",
    "selenium-webdriver": "^4.0.0-alpha.7"
  },
  "jest": {
    "setupTestFrameworkScriptFile": "./jest.config.js",
    "testEnvironment": "jest-environment-webdriver",
    "testEnvironmentOptions": {
      "browser": "chrome"
    }
  },
  "dependencies": {
    "@lambdatest/node-rest-client": "^1.0.0"
  },
  "main": "jest.config.js",
  "directories": {
    "test": "test"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/LambdaTest/jest-selenium-webdriver-sample.git"
  },
  "bugs": {
    "url": "https://github.com/LambdaTest/jest-selenium-webdriver-sample/issues"
  },
  "homepage": "https://github.com/LambdaTest/jest-selenium-webdriver-sample#readme"
}
```
## Executing First Script For Jest & Selenium Testing

**Test Scenario**: In this Jest tutorial, we will be creating a script that will invoke the browser launch with [LambdaTest TodoList Sample App](https://lambdatest.github.io/sample-todo-app/) that includes functionalities like check the box, typing text to add more items in the list, click  on Add button to add it into the list and will be  using assertions to verify the test cases. If assert returns true,  the test cases  pass successfully and show up in the automation logs dashboard, else if assert returns false, the test case fails, and the errors will be displayed in the automation log.

**Test Configurations**: The test will run over Google Chrome browser running on Windows 10.

```
const webdriver = require('selenium-webdriver');
const { until } = require('selenium-webdriver');
const { By } = require('selenium-webdriver');
const LambdaTestRestClient = require('@lambdatest/node-rest-client');

const username =  'LT_Username';          // Your LambdaTest Username
const accessKey ='LT_Access_Key';         // Your LambdaTest Access Key

const AutomationClient = LambdaTestRestClient.AutomationClient({
  username,
  accessKey
});
const capabilities = {                             // Desired Capabilities Class obtained From LambdaTest Capabilities Generator
  build: 'jest-LambdaTest-Single',
  browserName: 'Firefox',
  version: 'latest',
  platform: 'WIN8.1',
  video: true,
  network: true,
  console: true,
  visual: true
};

const getElementById = async (driver, id, timeout = 2000) => {
  const el = await driver.wait(until.elementLocated(By.id(id)), timeout);
  return await driver.wait(until.elementIsVisible(el), timeout);
};

const getElementByName = async (driver, name, timeout = 2000) => {
  const el = await driver.wait(until.elementLocated(By.name(name)), timeout);
  return await driver.wait(until.elementIsVisible(el), timeout);
};

const getElementByXpath = async (driver, xpath, timeout = 2000) => {
  const el = await driver.wait(until.elementLocated(By.xpath(xpath)), timeout);
  return await driver.wait(until.elementIsVisible(el), timeout);
};

let sessionId = null;

describe('webdriver', () => {
  let driver;
  beforeAll(async () => {
    driver = new webdriver.Builder()
      .usingServer(
        'https://' + username + ':' + accessKey +<EMAIL_ADDRESS>      )
      .withCapabilities(capabilities)
      .build();
    await driver.getSession().then(function(session) {
      sessionId = session.id_;
    });
    // eslint-disable-next-line no-undef
    await driver.get(`https://lambdatest.github.io/sample-todo-app/`);
  }, 30000);

  afterAll(async () => {
    await driver.quit();
  }, 40000);

  test('test', async () => {
    try {
      const lnk = await getElementByName(driver, 'li1');
      await lnk.click();

      const lnk1 = await getElementByName(driver, 'li2');
      await lnk1.click();

      const inpf = await getElementById(driver, 'sampletodotext');
      await inpf.clear();
      await inpf.sendKeys("Yey, Let's add it to list");

      const btn = await getElementById(driver, 'addbutton');
      await btn.click();

      const output = await getElementByXpath(
        driver,
        '//html/body/div/div/div/ul/li[6]/span'
      );
      const outputVal = await output.getText();
      expect(outputVal).toEqual("Yey, Let's add it to list");
      await updateJob(sessionId, 'passed');
    } catch (err) {
      await webdriverErrorHandler(err, driver);
      throw err;
    }
  }, 35000);
});

async function webdriverErrorHandler(err, driver) {
  console.error('Unhandled exception! ' + err.message);
  if (driver && sessionId) {
    try {
      await driver.quit();
    } catch (_) {}
    await updateJob(sessionId, 'failed');
  }
}
function updateJob(sessionId, status) {
  return new Promise((resolve, reject) => {
    AutomationClient.updateSessionById(
      sessionId,
      { status_ind: status },
      err => {
        if (err) return reject(err);
        return resolve();
      }
    );
  });
}

```
> The capabilities class was generated from the [LambdaTest Desired Capabilities Generator](https://www.lambdatest.com/capabilities-generator/).

## Running The Jest Script On LambdaTest Selenium Grid

Open the command line in the same directory where the GitHub repository for jest sample code is  cloned, navigate to the **test** folder & run the below command.
```
npm test single.test.js
```
Once the test case is executed, you can assess its status over the LambdaTest Automation Dashboard. You can figure out whether the test has passed or failed, and can review the various kinds of test logs such as network logs, command logs, raw Selenium logs, and even video recording of the entire test execution. You will see the test result in the [lambdatest Dashboard](https://automation.lambdatest.com).
![LambdaTest Automation Dashboard](https://github.com/LambdaTest/jest-selenium-webdriver-sample/blob/master/tutorial-images/automation-dashboard.PNG)

If you notice your console output in the command line or terminal. You will find the below output.
![Command Line Output For Jest Tutorial Script](https://github.com/LambdaTest/jest-selenium-webdriver-sample/blob/master/tutorial-images/console_output.PNG)

## Test Your Locally Hosted Web Applications

You can also perform cross browser testing of your [locally hosted web application using Lambda Tunnel](https://www.lambdatest.com/support/docs/testing-locally-hosted-pages/). Lambda Tunnel establishes a secure shell connection between your localhost and our cloud servers to help you execute Selenium test automation for privately hosted projects.

All you need to do is set the tunnel variable as true in your desired capabilities for running your Selenium script with Lambda Tunnel.

* Set **tunnel = true**
* Set **truetunnelName = 'Identifier name'** (Recommended in case more than 1 tunnels are connected.)

For example, to run the above test script through your localhost, your desired capabilities will be:

```
const capabilities = {
        platform: 'windows 10',
        browserName: 'firefox',
        version: 'latest',
        resolution: '1280x800',
        network: false,
        visual: false,
        console: false,
        video: true,
        tunnel: true,         // flag to run Selenium script on Lambda Tunnel
        name: 'Test 1',
        build: 'Jest build'
}
```
> Note: You need to download the Lambda Tunnel binary file for your operating system. Refer to our support documentation for more information on [Lambda Tunnel](https://www.lambdatest.com/support/docs/testing-locally-hosted-pages/).

> OS specific instructions to download and setup tunnel binary can be found at the following links.
>    - [Windows](https://www.lambdatest.com/support/docs/display/TD/Local+Testing+For+Windows)
>    - [Mac](https://www.lambdatest.com/support/docs/display/TD/Local+Testing+For+MacOS)
>    - [Linux](https://www.lambdatest.com/support/docs/display/TD/Local+Testing+For+Linux)

### Important Note:
Some Safari & IE browsers, doesn't support automatic resolution of the URL string "localhost". Therefore if you test on URLs like "http://localhost/" or "http://localhost:8080" etc, you would get an error in these browsers. A possible solution is to use "localhost.lambdatest.com" or replace the string "localhost" with machine IP address. For example if you wanted to test "http://localhost/dashboard" or, and your machine IP is <IP_ADDRESS> you can instead test on "http://<IP_ADDRESS>/dashboard" or "http://localhost.lambdatest.com/dashboard".

## Running The Test Script In Local Browser
You can run the same script in the locally  installed browser of your system. Here is the code sample for Google Chrome browser, you can change the browser as per your usecase.

```
const webdriver = require('selenium-webdriver');
const { until } = require('selenium-webdriver');
const { By } = require('selenium-webdriver');

const getElementById = async (driver, id, timeout = 2000) => {
  const el = await driver.wait(until.elementLocated(By.id(id)), timeout);
  return await driver.wait(until.elementIsVisible(el), timeout);
};

const getElementByName = async (driver, name, timeout = 2000) => {
  const el = await driver.wait(until.elementLocated(By.name(name)), timeout);
  return await driver.wait(until.elementIsVisible(el), timeout);
};

const getElementByXpath = async (driver, xpath, timeout = 2000) => {
  const el = await driver.wait(until.elementLocated(By.xpath(xpath)), timeout);
  return await driver.wait(until.elementIsVisible(el), timeout);
};

describe('webdriver', () => {
  let driver;

  beforeAll(async () => {
    driver = new webdriver.Builder().forBrowser('chrome').build();  // Specify Your Local Browser

    // eslint-disable-next-line no-undef
    await driver.get(`https://lambdatest.github.io/sample-todo-app/`);
  }, 10000);

  afterAll(async () => {
    await driver.quit();
  }, 15000);

  test('test', async () => {
    const lnk = await getElementByName(driver, 'li1');
    await lnk.click();

    const lnk1 = await getElementByName(driver, 'li2');
    await lnk1.click();

    const inpf = await getElementById(driver, 'sampletodotext');
    await inpf.clear();
    await inpf.sendKeys("Yey, Let's add it to list");

    const btn = await getElementById(driver, 'addbutton');
    await btn.click();

    const output = await getElementByXpath(
      driver,
      '//html/body/div/div/div/ul/li[6]/span'
    );
    const outputVal = await output.getText();
    expect(outputVal).toEqual("Yey, Let's add it to list");
  }, 10000);
});
```

Navigate to  the test folder and run the below command:
```
npm test local.test.js
```

## About LambdaTest

[LambdaTest](https://www.lambdatest.com/) is a cloud based selenium grid infrastructure that can help you run automated cross browser compatibility tests on 2000+ different browser and operating system environments. LambdaTest supports all programming languages and frameworks that are supported with Selenium, and have easy integrations with all popular CI/CD platforms. It's a perfect solution to bring your [selenium automation testing](https://www.lambdatest.com/selenium-automation) to cloud based infrastructure that not only helps you increase your test coverage over multiple desktop and mobile browsers, but also allows you to cut down your test execution time by running tests on parallel.

### Resources

##### [SeleniumHQ Documentation](http://www.seleniumhq.org/docs/)
##### [Jest Documentation](https://jestjs.io/en/)


text:
Please use this as a chance to showcase your personality.

This command should be invoked via a simple command such as `factoid` and will then display a randomly chosen factoid. See simple example below

```
# factoid
> Hulk Hogan vs Andre the Giant was featured at WrestleMania 3
```

The point of this test is to understand how you approach a technical problem. The way you code is just as important as your solution.

We expect this test to take you about 4 - 8 hours. Given that most people are busy, We'd like to hear back from you within 72 hours of starting.

#### As soon as you begin:
* [ ] Fork this repository into a public repository on your github/etc account

#### While working on this, please:
* [ ] Commit early and often. I'll likely be following along with your progress.

#### Upon completing this, please post to us:
* [ ] A link to your git repository such that we may view your code.
* [ ] A link to somewhere where we may download and install your package

## Requirements

The underpinnings of the Commands functionality may be written in whatever language you choose, so long as it is operable on apt repo (beware libraries that do not come installed by default)

#### Command Line Interface
* [ ] Using the command `factoid` should return to you a randomly chosen fact.
* [ ] Using the command `factoid -n 1` (with option n specified and argument integer passed) should show you the nth factoid in the bunch
  * [ ] Please handle options that are not defined or malformed

#### Packaging
* [ ] Provide use of this command via a apt repo style package.
* [ ] The package must function on any currently available OS of your choosing.

#### Reproducibility
* [ ] Use a make file to create your package

## BONUS

If you're too cool for school and knocked all the above out already, consider adding some improvements to what you've made.

### Suggestions for improvements
* [ ] How about color the output using an external dependency?
* [ ] Edit this ReadMe with new suggestions for how to improve this code test

license: MIT

repository: ultamatt/linuxtest

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: ultamatt/linuxtest


text:
# Kaggle-data-downloader
An unofficial Kaggle datasets downloader very much inspired by [kaggle-cli](https://github.com/floydwch/kaggle-cli)

## Installation

```
$ pip install -U git+https://github.com/EKami/kaggle-data-downloader.git
```

Depending on the format of your archive you may need to install some tools
on your computer.

 - For 7-zip archives: You need the `7za` program from p7zip.
    - On macOS: `brew install p7zip`
    - On Ubuntu: `sudo apt-get install p7zip-full`

## Usage
Please note that accepting the competition rules before your commands is mandatory.

Usage example:
```
from kaggle_data.downloader import KaggleDataDownloader

destination_path = "input/"

downloader = KaggleDataDownloader("Ekami", "somePassword", "planet-understanding-the-amazon-from-space")
output_path = downloader.download_dataset("test-jpg-additional.tar.7z", destination_path)
downloader.decompress(output_path, destination_path)
downloader.decompress(destination_path + "test-jpg-additional.tar", destination_path)
```


text:
# Discriminators

To create a new discriminator create a `.py` file in this directory.
This file should specify a class `Wrapper` with three static methods:

* `get_params()` -- declares arguments for your embedder
    * takes `utils.argparse_utils.MyArgumentParser` instance as an input
    * appends arguments to the parser, that may/should be specified in the config file
* `get_net()` -- returns an instance of Discriminator class inherited from `torch.nn.Module`
* `get_optimizer()` -- returns a `torch.optim.Optimizer`. Takes the discriminator `torch.nn.Module` and the arguments via `utils.argparse_utils.MyArgumentParser`.

Discriminators' `forward()` methods should take a dictionary with all data `data_dict` (initially provided by a [dataloader](../dataloaders)) augmented with outputs of [generator](../generators) and [embedder](../embedders). Discriminator adds to `data_dict` any data needed to calculate adversarial and other loss values for both generator loss and discriminator loss.

In addition, discriminators have to define `enable_finetuning(self, data_dict=None)` (see the [documentation for generators](../generators)).

repository: ribeiro-hugo/latent-pose-reenactment

gha_language: Python

repo_name: ribeiro-hugo/latent-pose-reenactment


text:
[psycopg2](http://initd.org/psycopg/) is a compiled Python's driver for SQL. That is why when you deploy it to AWS Lambda you probably get an error:
> _psycopg2.so file had incorrect ELF headers

or

> No module named _psycopg

Check [Stack](https://stackoverflow.com/questions/36607952/using-psycopg2-with-lambda-to-update-redshift-python) for more about this.

---

`psycopg2/` and `psycopg2-3.6/` are already compiled versiones of lib [psycopg2](http://initd.org/psycopg/) for AWS Linux.
Just download it, put it into your `vendored/` folder and import into your source code:

```
here = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(here, "./vendored"))
```

Feel free to compile it yourself with a Docker with [this tutorial](https://serverlesscode.com/post/deploy-scikitlearn-on-lamba/).

Enjoy!


text:
# Rtings
This is a process for getting new Rtings measurements and updating pre-computed results

1. Run Rtings pipeline: `python rtings/rtings_crawler.py`
2. Run results update: `python results/update.py --new_only --rtings`
3. Update indexes: `python results/update_indexes.py`
4. Add files to git: `git add results/rtings results/README.md results/INDEX.md rtings/links.json rtings/data rtings/name_index.tsv`
5. Commit: `git commit -m "New Rtings measurements with pre-computed results."`
6. Push: `git push`

repository: KriswiffaK/AutoEq

repo_name: KriswiffaK/AutoEq


text:
This an implementation of a simple email service API.
The content type for responses is application/json.

The result of a request to the API i.e. the response, will be directly reflected by the HTTP response code i.e. 2XX for successes, 4XX for user errors, 5XX for internal server errors.

Generally, successful responses (2XX’s) will be formatted like;
```
{
    'data' : [
        {

        },
        {

        },
    ],
    'meta' : {
    }
}
```
The `data` key will contain the result of the request. In the case of a request that results in a collection, e.g. retrieving all mails, the data key will contain an `array` of individual items/objects. The meta key/field will only exist in this case to provide context to the result of the request. it contains pagination info, with fields such as total pages, page count, etc.

Other HTTP responses (4XX’s, 5XX’s) will have an `error` key/object instead of the `data` key/object which  will contain the `HTTP code`, the `error message`, and an `validation_error` field in the case of validation errors, which individually provide more context for the error.

Error responses are shown in the examples below;
```
{
    'error' : {
        'http_code' : 404,
        'message' : "Mail not found"
    }
}
```
#### OR
```
{
  "error": {
    "http_code": 400,
    "message": "Wrong Argument",
    "validation_errors": {
      "archive": {
        "message": [
          "The archive value must be provided"
        ]
      }
    }
  }
}
```
## Authorization
The API requires an authorization key for accepting requests. Authorization key should be provided in the request header with key `Authorization` and value as the authorization code (test code is 12345678). Not including an authorization code/token in the header with result in an HTTP Unauthorized response.
```
{
  "error": {
    "http_code": 401,
    "message": "Please provide an appropriate Authorization header."
  }
}
```

## Endpoints
This API provides four endpoints for interacting with the service.

### GET /mails
A `GET` request to this endpoint retrieves a paginated list of all mails. Each object of the message has a “read” field that indicates that the message has been read.
Additional parameters `page` and `limit` which accepts integer values can be used to paginate the result of the request.
##### Sample Request & Response
` curl -X GET -H "Authorization: 12345678" "http://api.oberlo.mailbox.dev/mails?page=1&limit=2" `
```
{
  "data": [
    {
      "uid": 21,
      "sender": "Ernest Hemingway",
      "subject": "animals",
      "message": "This is a tale about nihilism. The story is about a combative nuclear engineer who hates animals. It starts in a ghost town on a world of forbidden magic. The story begins with a legal dispute and ends with a holiday celebration.",
      "time_sent": "2016-03-29 08:24:27",
      "read": false,
      "created_at": "2016-11-12 20:20:51",
      "updated_at": "2016-11-12 20:20:51"
    },
    {
      "uid": 22,
      "sender": "Stephen King",
      "subject": "adoration",
      "message": "The story is about a fire fighter, a naive bowman, a greedy fisherman, and a clerk who is constantly opposed by a heroine. It takes place in a small city. The critical element of the story is an adoration.",
      "time_sent": "2016-03-29 10:52:27",
      "read": false,
      "created_at": "2016-11-12 20:20:51",
      "updated_at": "2016-11-12 20:20:51"
    }
  ],
  "meta": {
    "pagination": {
      "total": 6,
      "count": 2,
      "per_page": 2,
      "current_page": 1,
      "total_pages": 3,
      "links": {
        "next": "http://api.oberlo.mailbox.dev/mails?page=2"
      }
    }
  }
}
```
### GET /archives
This endpoint responds to a `GET` request and returns a paginated list of achieved mails with the “archived” field indicating the messages that have been archived. The read status of the mail is also returned via the read key. Passing the `page` & `limit` parameter in the query limits the result of the request.
 It takes place in a small city. The critical element of the story is an adoration.",
      "time_sent": "2016-03-29 10:52:27",
      "read": false,
      "created_at": "2016-11-12 20:20:51",
      "updated_at": "2016-11-12 20:23:06"
    }
  ],
  "meta": {
    "pagination": {
      "total": 1,
      "count": 1,
      "per_page": 2,
      "current_page": 1,
      "total_pages": 1,
      "links": []
    }
  }
}
```
### GET /mails/id
This endpoint retrieves a mail specified by the ID.
##### Sample Request & Response
` curl -X GET -H "Authorization: 12345678" "http://api.oberlo.mailbox.dev/mails/21" `
```
{
  "data": {
    "uid": 21,
    "sender": "Ernest Hemingway",
    "subject": "animals",
    "message": "This is a tale about nihilism. The story is about a combative nuclear engineer who hates animals. It starts in a ghost town on a world of forbidden magic. The story begins with a legal dispute and ends with a holiday celebration.",
    "time_sent": "2016-03-29 08:24:27",
    "read": false,
    "archived": true,
    "created_at": "2016-11-12 20:20:51",
    "updated_at": "2016-11-12 20:23:51"
  }
}
```
### PATCH /mails/id
This endpoint is used to make updates to individual mails. Available options are `read` and `archive` which accepts only boolean values true or false.
##### Sample Request & Response
` curl -X PATCH -H "Authorization: 12345678" -H "Content-Type: application/json" -d '{"archive": true }' "http://api.oberlo.mailbox.dev/mails/21" `
```
{
  "data": {
    "status": true,
    "message": "Successful"
  }
}
```

### OTHER INFORMATION
This repo comes with a mail samples that can be easily imported to the database to try out the functionalities described in this documentation. Please follow the following steps to test the API.

1. Download the repo to your preferred web server
2. run `composer install` to install all dependencies
3. Create another copy of the `.env.example` file in the root directory as `.env`. Open the `.env` update your database configuration. Also provide a 32 character long `APP_KEY`.
4. From the CLI, go to the project root and run `php artisan import:test_messages` to import the sample mails.
5. Visit the endpoints using any means of your choice.

repository: MalikAbiola/SimpleMailboxApi

repo_name: MalikAbiola/SimpleMailboxApi


text:
# [Adam's Brain](http://alexa.amazon.com/#skills/amzn1.ask.skill.4a6480c7-956f-48cb-9c93-ee12914a5947)
![1 stars](../../images/ic_star_black_18dp_1x.png)![1 stars](../../images/ic_star_border_black_18dp_1x.png)![1 stars](../../images/ic_star_border_black_18dp_1x.png)![1 stars](../../images/ic_star_border_black_18dp_1x.png)![1 stars](../../images/ic_star_border_black_18dp_1x.png) 1

To use the Adam's Brain skill, try saying...

* *Alexa ask Adam's Brain what the square root of pi is*

* *Alexa ask Adam's Brain when his birthday is*

* *Alexa ask Adam's Brain what the meaning to life the universe and everything is*

Adam knows a few things and forgets the rest. Ask Adam a question, but expect that he doesn't know the answer.

***

### Skill Details

* **Invocation Name:** adam's brain
* **Category:** null
* **ID:** amzn1.ask.skill.4a6480c7-956f-48cb-9c93-ee12914a5947
* **ASIN:** B01N4EX9YB
* **Author:** Adam Schmitz
* **Release Date:** December 21, 2016 @ 06:49:38
* **In-App Purchasing:** No


text:
## Intro
This is a seed project for setting up a Win 10 virtual machine with vagrant.

## Script Dependencies

  - [Git bash][git-bash-downloads]
  - [Virtualbox][virtualbox-downloads]
  - [Vagrant][vagrant-downloads]

## Project Directory Contents
  - Win10-Dev                    # project root
    - infrastructure             # contains the VM installation scripts
      - Vagrantfile              # the Vagrant manifest with VM configuration
      - do_privileged.ps1        # a script run as root when the VM is provisioned
    - share                      # a directory that is shared between host OS and guest VM

## Installation
Open the git bash terminal, start the vagrant script to initialize the VM, and restart the VM. Follow commands emitted by the script for allowing vagrant to connect to the VM and for resizing the VM hard drive.
```sh
$ cd infrastructure
$ vagrant up
```

## Login to the VM
The username and password for the VM are IEUser / Passw0rd!

## Memory Settings
The VM memory settings are configured in the Vagrantfile. By default, memory is set to 8GB.

## Shared Folder
The _share_ folder in the project root is shared between the host OS and guest VM. It maps to the folder _/home/vagrant/share_ in the VM.

## Software Installed by default in the VM
  - 7zip (Zip utility)
  - Bing Desktop (wallpaper)
  - Chrome (web browser)
  - Notepad++ (text editor)
  - Sublime Text (text editor)
  - Visual Studio 17
  - Resharper 17
  - SQL Server Management Studio
  - Office 365
  - anything else you add to the provisioning scripts

License
----

MIT

[//]: # (These are reference links used in the body of this note and get stripped out when the markdown processor does its job. There is no need to format nicely because it shouldn't be seen. Thanks SO - http://stackoverflow.com/questions/4823468/store-comments-in-markdown-syntax)

   [git-bash-downloads]: <https://git-scm.com/download/win>
   [vagrant-downloads]: <https://www.vagrantup.com/downloads.html>
   [virtualbox-downloads]: <https://www.virtualbox.org/wiki/Downloads>

repository: timezra/vagrant-seeds

repo_name: timezra/vagrant-seeds


text:
Schramm-Loewner Evolution Visualiser
====================================

A Python program for displaying [Schramm-Loewner Evolution](https://en.wikipedia.org/wiki/Schramm%E2%80%93Loewner_evolution). Set up to use the driving function of brownian motion.

Can be run from the command line as `./animate.py` or within Python using `animate.draw_sle()`

`levy()` uses brownian motion with randomly added jumps (the sizes of the jumps follow a normal distribution).

It should be easy to change the resolution (both space and time), the scale of the brownian motion driving it, and the driving function itself. The colouring shouldn't be too hard to change.

sample commands:
`python3 animate.py`
see a full list of options
`python3 animate.py --help`
adjust the brownian motion scale
`python3 animate.py --kappa=2`

increase time resolution
`python3 animate.py --dt 0.0001`
increase spatial resolution
`python3 animate.py --xn 500`

enter a custom driving function
`python3 animate.py --zeta "lambda t: t**0.5"`

driven by a levy process with no brownian motion component
`python3 animate.py --zeta "levy(kappa=0, jumpfreq=3)" --scale "lambda t:t" --dt 0.0002`

another levy process
`python3 animate.py --zeta "levy(kappa=0, jumpfreq=5, jumpdist=lambda rng:rng.exponential())" --scale "lambda t:t" --dt 0.0002 --xmin -0.1 --xmax 10 --ymax 2 --xn 500`

note: draw.py is out of date. You're better off adapting animate.py.

repository: penteract/sle

repo_name: penteract/sle


text:
### Puzzle solver for https://yppedia.puzzlepirates.com/Patching
A basic solver which will calculate the best move (it thinks) using multi threaded random simulations to gather the longest path.
Discussion thread https://bot-supply.com/forum/development/13919-patching-bot-logic-[c-].html

### Building (Windows / Linux)
For windows, be sure to install ```make``` and ```g++``` using ```Cygwin``` https://www.cygwin.com/.
To build this you will need to run ```make``` within the root directory

### How to use
Inputting parameters into the program will appear to be complicated.
You will need to look at ```Definitions.hpp``` and lookup pieces of your board according to it to find the corresponding character representation.

For example, imagine you have the piece
![banner](http://i.imgur.com/dB3zN31.png)
This piece is considered a ```SPOOL_LEFT``` (read the comments and illustrations in ```Definitions.hpp```).

The define in ```Definitions.hpp``` tells us that this piece has a character representation of ```'A'```.
```
#define SPOOL_LEFT 0              // --0-      // A
```
Please note that the conversion from visual to textual can be quite confusing for the human brain the way I have done it so expect to make mistakes the first time you try to use this program.

Here is an example of parsing an entire board:
Visual representation

![banner](http://i.imgur.com/Jssxw37.jpg)

Character representation
```
IIIIIII
IOYPONI
IMPFZYI
INYPMAI
IYNONMI
IIIIIII
```

Program input
```
IIIIIIIIOYPONIIMPFZYIINYPMAIIYNONMIIIIIIII
```

Example output
```
IIIIIIIIOYPONIIMPFZYIINYPMAIIYNONMIIIIIIII
main() : creating thread, 0
main() : creating thread, 1
main() : creating thread, 2
main() : creating thread, 3
main() : creating thread, 4
main() : creating thread, 5
main() : creating thread, 6
main() : creating thread, 7
5
IIIIIIIIPOPOOIIMOFZYIIZZMMAIIMPNMZIIIIIIII
7
IIIIIIIINPPYOIIYNFPNIINMMMAIIZZOPZIIIIIIII
9
IIIIIIIIMPOMZIIPNFMPIIMYYYAIIYOPMMIIIIIIII
11
IIIIIIIIOPOOMIIPNFMZIIZMPYAIIMYNYMIIIIIIII
```
Input to the program a series of 42 alphabetical characters to represent the board state.

The program will continuously apply random moves to find better solutions on the go and output them in the same format as input.

### Testing
Testing is currently in progress..

gha_license_id: MIT


text:
Title: Fun with an iPhone Accelerometer
Date: 2011-08-03 03:24:00
Tags: free fall, Bohn, SHO, accelerometer, iphone, pendulum
Category: old
Slug: fun-with-an-iphone-accelerometer
Author: Bohn

[![image](http://2.bp.blogspot.com/-f7mSv8QGLGs/Tj9_a2qp1SI/AAAAAAAAAEY/Ax5EEw8Cjmg/s320/accelerometer.jpg)](http://2.bp.blogspot.com/-f7mSv8QGLGs/Tj9_a2qp1SI/AAAAAAAAAEY/Ax5EEw8Cjmg/s1600/accelerometer.jpg)
The iPhone 3GS has a built-in [accelerometer, the
LIS302DL](http://pdf1.alldatasheet.com/datasheet-pdf/view/236640/STMICROELECTRONICS/LIS302DL.html),
which is primarily used for detecting device orientation. I wanted to
come up with something interesting to do with it, but first I had to see
how it did on some basic tests. It turns out that the tests gave really
interesting results themselves! A drop test gave clean results and a
spring test gave fantastic data; however a pendulum test gave some
problems. You might guess the accelerometer would give a reading of 0 in
all axes when the device is sitting on a desk. However, this
accelerometer measures "proper acceleration," which essentially is a
measure of acceleration relative to free-fall. So the device will read
-1 in the z direction (in units where 1 corresponds to 9.8 m/s^2, the
acceleration due to gravity at the surface of Earth). Armed with this
knowledge, let's take a look at the drop test: To perform this test, I
stood on the couch which was in my office (before it was taken away from
us!), and dropped my phone hopefully into the hands of my officemate. I
suspected that the device would read magnitude 1 before dropping, 0
during the drop, and a large spike for the large deceleration when the
phone was caught.
[![image](http://2.bp.blogspot.com/-g8pt_dT0gR8/Tj9D2GTkc6I/AAAAAAAAADw/1iwHCsPixtY/s400/DropTest.png)](http://2.bp.blogspot.com/-g8pt_dT0gR8/Tj9D2GTkc6I/AAAAAAAAADw/1iwHCsPixtY/s1600/DropTest.png)
As you can see, the results were basically as expected. The purple line
shows the magnitude of the acceleration relative to free-fall. Before
the drop, the magnitude bounces around 1, which is due to my inability
to hold something steadily. The drop occurred near time 12.6, but I
wasn't able to move my hand arbitrarily quickly so there's not a sharp
drop to 0 magnitude. The phone fell for around 0.4 seconds corresponding
to $$y = \frac{1}{2} g t^2 = \frac{1}{2} (9.8 \frac{m}{s^2})*(0.4
s)^2 = 0.784 m = 2.57 feet $$ As for the spike at 13 seconds, the raw
data shows that the catch occurs in $$ t = 0.02 \pm 0.01 s $$. In order
for the device to come to rest in such a short amount of time, there
needs to be a large deceleration provided by my officemate's hands. Now
the pendulum test consisted of taping my phone to the bottom of a 20
foot pendulum.
[![image](http://2.bp.blogspot.com/-7uO_824O6t4/Tj9Q1crvlUI/AAAAAAAAAD4/uO3YsrXStak/s400/pendulum.png)](http://2.bp.blogspot.com/-7uO_824O6t4/Tj9Q1crvlUI/AAAAAAAAAD4/uO3YsrXStak/s1600/pendulum.png)
I didn't think enough about this, but the period of a pendulum, assuming
we have a small amplitude, is given by: $$T = 2 \pi
\sqrt{\frac{L}{g}}$$ which is about 5 seconds. With a relatively small
amplitude, the acceleration in the x direction will be small. Basically
I'm reaching the limit of the resolution of the acceleration device. It
appears that the smallest increment the device can measure is 0.0178 g.
This happens to match the specifications from the spec sheet I linked at
the top of the page, where they specify a minimum of 0.0162 g, and a
typical sensitivity of 0.018 g! Now we come to the most exciting test,
the spring test! Setup: I taped my phone to the end of a spring and let
it go. Ok. Here is the actual acceleration data:
[![image](http://3.bp.blogspot.com/-3qbU9p2I3sE/Tj9a7-eOk-I/AAAAAAAAAEA/0ByUQ039dio/s400/springdata.png)](http://3.bp.blogspot.com/-3qbU9p2I3sE/Tj9a7-eOk-I/AAAAAAAAAEA/0ByUQ039dio/s1600/springdata.png)
The first thing I see is that the oscillation frequency looks constant,
as it should be for a simple harmonic oscillator. There is also a decay
which looks exponential! Let's see how well the data fits if we have a
frictional term proportional to the velocity of the phone. This gives is
a differential equation which looks like this: $$ m \ddot{x} +
F\dot{x} + k x = 0 $$ Now we can plug in an ansatz (educated guess) to
solve this equation: $$ x(t) = A*e^{i b t} $$ $$-b^2 mx(t) + i b
Fx(t) + kx(t) = 0$$ $$-m b^2+iFb+k = 0$$ We can solve this equation for
b with the quadratic equation: $$ b = \frac{\sqrt{4km - F^2}}{2m} +
i\frac{F}{2m} \equiv \omega + i \gamma $$ where I defined two new
constants here. So we see that our ansatz does solve the differential
equation. Now we want acceleration, which is the second time derivative
of position with respect to time. $$a(t) \equiv \ddot{x} = -b^2 A
e^{ibt} $$ Now are only interested in the real part of this solution,
which gives us (adding in a couple of constants to make the solution
more general): $$a(t) = -(\omega^2 - \gamma^2) A e^{-\gamma t}
cos(\omega t + \phi) + C $$ Let's redefine the coefficient of this
acceleration to make things a little cleaner! $$a(t) = B e^{-\gamma t}
cos(\omega t + \phi) + C $$ Ok, with that math out of the way (for
now), we can try to fit this data. I actually used Excel to fit this
data using a not-so-well-known tool called Solver. This allows you to
maximize or minimize one cell while Excel varies other cells. In this
case, I defined a cell which is the [Residual Sum of
Squares](http://en.wikipedia.org/wiki/Residual_sum_of_squares) of my fit
versus the actual data, and I tell Excel to vary the 5 constants which
make the fit! The values jump around for a little while then it gives up
when it thinks it converged to a solution. Using this you can fit
arbitrary functions, neato! With this, I come up with the following
plot:
[![image](http://1.bp.blogspot.com/-23lXSPVOwuY/Tj9a8Curm3I/AAAAAAAAAEI/F5Fb9dxdvDs/s400/springlineardamp.png)](http://1.bp.blogspot.com/-23lXSPVOwuY/Tj9a8Curm3I/AAAAAAAAAEI/F5Fb9dxdvDs/s1600/springlineardamp.png)
$$B = 0.633740943$$ $$\gamma = 0.012097581 $$ $$\omega = 8.599670376
$$ $$\phi = 0.693075811 $$ $$C =-1.004454967 $$ with an R^2 value of
0.968! At this point it should be noted that if I discretize my smooth
fit to have the same resolution (0.0178 g) as the accelerometer, then
see what the error is comparing the smooth fit to its own
discretization, I get an R^2 of 0.967! This means that there is a
decent amount of built-in error to these fits due to discretization on
the order of the error we're seeing for our actual fits. Immediately we
can recognize that C should be -1, since this is just a factor relating
"free-fall" acceleration to actual iPhone acceleration. If we wanted, we
could solve for the ratio of the spring constant to the mass, but I'll
leave that as [an exercise for the
reader.](http://www.amazon.com/Classical-Electrodynamics-Third-David-Jackson/dp/047130932X)
If you look closely, you can see that the frequency appears to match
very well. The two lines don't go out of phase. One problem with the fit
is the decay. The beginning and the end of the data are too high
compared to the fit, which is a problem. This implies that there is some
other kind of friction at work. Some larger objects or faster moving
objects tend to experience a frictional force proportional to the square
of the velocity. I don't think my iPhone is large or fast (compared to a
plane for example), but I'll try it anyway. The differential equation
is: $$ m \ddot{x} + F\dot{x}^2 + k x = 0 $$ yikes. This is a tough
one because of the velocity squared term. [One trick I found
here](http://www.jstor.org/pss/3620747) attempts a general solution for
a similar equation. They make an approximation in order to solve it, but
the approximation is pretty good in our case. Take a look at the paper
if you're interested. The basic idea is to note that the friction term
is the only one that affects the energy. So, assuming that the energy
losses are small in a cycle, we can look at a small change in energy
with respect to a small change in time due to this force term. This
gives us an equation which can let us solve for the amplitude as a
function of time approximately! Really interesting idea. So I plugged
the following equation into the Excel Solver: $$a(t) = \frac{A
cos(\omega t + \phi)}{\gamma t + 1} + B$$ Here's the fit:
[![image](http://2.bp.blogspot.com/-fCXr2CkPGE4/Tj9a8pH2KFI/AAAAAAAAAEQ/XaulleF3xK4/s400/springsqdamp.png)](http://2.bp.blogspot.com/-fCXr2CkPGE4/Tj9a8pH2KFI/AAAAAAAAAEQ/XaulleF3xK4/s1600/springsqdamp.png)
Which uses these values: $$A = 0.772773705 $$ $$\gamma = 0.029745368 $$
$$\omega = 8.600177692 $$ $$\phi = 0.688610161 $$ $$B = -1.004530009
$$ with an R^2 value of 0.964! This fit seems to have the opposite
effect. The middle of the data is too high compared to the fit, while
the beginning and end of the data seems too low. This makes me think
that the actual friction terms involved in this problem are possibly a
sum of a linear term and a squared term. I don't know how to make
progress on that differential equation, so I wasn't able to fit
anything. If you try the same trick I mentioned earlier, you run into a
problem where you can't separate some variables which you need to
separate in the derivation unfortunately. So there you have it, I wanted
to find something neat to do, and I got really cool data from just
testing the accelerometer. Stay tuned for an interesting challenge
involving some physical data from my accelerometer!

repository: alexalemi/virtuosi

gha_language: CSS

repo_name: alexalemi/virtuosi


text:
# InfiCell
InfiCell is a reflective mono DLL injector for Dungeon of the Endless that doesn't modify any of the source files or includes them. It uses a minified version of [Harpoon](https://github.com/nielsbishere/harpoon) and uses it to attach to or launch a new game.

InfiCell could in the future allow you to modify common features, like modules, rooms, NPCs, monsters and so on. This doesn't require any knowledge about how DotE's source code is structured. However, features that aren't supported by InfiCell can still be accessed through C# reflection.

InfiCell's Listeners allow you to listen to events happening in the dungeon; currently it can only know if you finish a dungeon, enter a dungeon and leave a dungeon. But it could also listen to things such as rooms opening, crystal being carried, monsters spawning, rooms spawning, etc. This can prove very useful when you want to add custom game modes, custom events and so on. However, do note that you should implement networking correctly when doing so. [Harmony](https://github.com/pardeike/Harmony) is primarily used for the listeners.

## How to use the launcher
You can pull the repo and make sure Visual Studio 15 2017 is installed. Along with VS, you require DotE to be installed through steam (or it has to be opened already).
![References](References.PNG)
To set up the project, you have to set up the references. UnityEngine.dll, Assembly-CSharp.dll and Assembly-CSharp-firstpass.dll are located at `%STEAM%/steamapps/common/Dungeon of the Endless/DungeonoftheEndless_Data/Managed`, where `%STEAM%` is your steam directory. Only then can the project build.
DotE runs 32-bit, so I recommend setting your configuration to Release x86 (Debug doesn't do a lot for us).
If we build it, it should give us the 'InfiCell.exe' file under the Release folder. If you run this, it will insert the mods from the mods folder into the running application (or it will start the application through steam).
You can check if the launcher worked correctly by going to your steam directory and finding the "output_log.txt" file. It should tell you that it found Harpoon.Core.dll and that it is now scanning the mods folder.
The 'mods' folder is located next to the executable and all mod assemblies are injected when you run the launcher; allowing them to modify the game.

## How to add a mod
The following is an example of a mod:
```cs
using Harpoon.Core;
using System;
using System.Reflection;

namespace MyNamespace
{
    class MyMod : InfiCellMod, IDungeonListener
    {

        public override ModMetadata Metadata =>
            new ModMetadata
            {
                AuthorName = "Nielsbishere",
                ModDescription = "This is my mod",
                ModName = "MyMod",
                ModVersion = "0.0.1"
            };

        public override void Initialize()
        {
            //Initialize everything
        }

        public void OnEnter(Dungeon dungeon)
        {
            Console.WriteLine("Hey dungeon");
            dungeon.AddDust(40);
        }

        public void OnLeave(Dungeon dungeon)
        {
            Console.WriteLine("Bye dungeon");
        }

        public void OnWin(Dungeon dungeon, bool isLastLevel)
        {
            Console.WriteLine($"Finished floor; lastFloor = {isLastLevel}");
        }

    }
}
```
This test mod adds 40 dust everytime you enter a dungeon; it also logs if you leave/enter or win a dungeon.
Right now those are the current abilities of InfiCell; but the listener system is expandible, so pull requests are appreciated.
This mod requires references to DotE as well as InfiCell.Core. When you build it, you can put it into the mods directory.

## Contribution
Contributing to this project can be done by expanding it through pull requests. I will check for consistency with the source code and if it runs. If you want to learn how to mod, you can check the [documentation](https://github.com/Nielsbishere/InfiCell/blob/master/docs/main.md). If you know how to use Harmony, you can look at our [mod class](https://github.com/Nielsbishere/InfiCell/blob/master/InfiCell.Core/Core/InfiCellMod.cs) that handles hooks and interfaces. Inspecting the original DotE code can be done by loading the dll (stored in the steam folder) into dnSpy. I'd suggest entrypoints such as Dungeon, Hero, Room and Module.

## APIs used
[Harpoon](https://github.com/nielsbishere/harpoon) for reflective DLL mono injection.
[Harmony](https://github.com/pardeike/Harmony) for C# bytecode injection.

repository: Nielsbishere/InfiCell

repo_name: Nielsbishere/InfiCell


text:
# helium
---
Minimalistic react boilerplate for beginners that gets you up and running.
```
npm install
npm run watch
```
### What's in it?
- Stylus
- React Router

### Licence
MIT

### Note
This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app).

More information [here](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md).


text:
# CoreOS Vagrant - For Windows 7

This repo provides a template Vagrantfile to create a CoreOS virtual machine using the VirtualBox software hypervisor.
After setup is complete you will have a coreos cluster of 3 virtual machines running with folder syncronization using rsync running on your local Windows 7 machine.

## Streamlined setup

1) Install dependencies

* [VirtualBox][virtualbox] 4.3.10 or greater.
* [Vagrant][vagrant] 1.6 or greater.
* [GitHub][GitHub Desktop]
* [PuTTY][PuTTY] 0.64 or greater.
* [Cygwin][cwgwin]   (see: http://www.howtogeek.com/175008/the-non-beginners-guide-to-syncing-data-with-rsync/)
* [apple Bonjour][bonjour]

2) Clone this project and get it running!

```
git clone https://github.com/jschott2/coreos-vagrant/
cd coreos-vagrant
```

3) Startup and SSH

The Windows 7 "provider" for Vagrant is VirtualBox:

**VirtualBox Provider**

The VirtualBox provider is the default Vagrant provider. Use this if you are unsure.

```
vagrant up
```

``vagrant up`` triggers vagrant to download the CoreOS image (if necessary) and (re)launch the instance

The SSH client used in this scenario is PuTTY which provides a client interface.  PuTTY is a Windows focused tool.
You can set up command line launching but it does not seem to be high value over launching from taskbar.
Configuration of the PuTTY session includes transforming the insecure_private_key to a PuTTY format; importing that key into the session; defining the IP; defining the port; and giving the session a name so it can be saved for loading later.
Once saved the configuration is stored in PuTTY so you can always return to this machine from PuTTY or right-click the PuTTY Configuration icon on the task bar and select a recent session.

4) Get started [using CoreOS][using-coreos]

[virtualbox]: https://www.virtualbox.org/
[vagrant]: https://www.vagrantup.com/downloads.html
[using-coreos]: http://coreos.com/docs/using-coreos/
[GitHub Desktop]: https://desktop.github.com/
[PuTTY]: http://www.putty.org/
[cwgwin]: https://cygwin.com/install.html
[bonjour]: https://support.apple.com/kb/DL999?locale=en_US

#### Shared Folder Setup

There is optional shared folder setup.
You can try it out by adding a section to your Vagrantfile like this.

```
config.vm.synced_folder "./shared", "/home/core/share2/", type: "rsync"
config.vm.synced_folder "./shared", "/home/core/share/", type: "rsync"
```

After a 'vagrant reload'.

The Guest folders will be refreshed from the Host shared folders.

Windows 7 also requires using rsync that was retrieved in Cygwin install.  There are utilities that are provided to assist in setting up users on the guest with the insecure_private_key SSH keys and the rsync command to synchronize to the host.
Find user_up.sh in the shared folder.
Find rsyncvmshare.bat in the coreos-vagrant folder.

Copy helper.rb.jschott2.endstate.clean to 'C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.7.4\plugins\synced_folders\rsync\'
Or you can modify the helper.rb file in that directory adding 'hostpath = "/cygdrive" + hostpath' as shown below.
        if Vagrant::Util::Platform.windows?
          # rsync for Windows expects cygwin style paths, always.
          hostpath = Vagrant::Util::Platform.cygwin_path(hostpath)
           hostpath = "/cygdrive" + hostpath
        end

#### Provisioning with user-data

The Vagrantfile will provision your CoreOS VM(s) with [coreos-cloudinit][coreos-cloudinit] if a `user-data` file is found in the project directory.
coreos-cloudinit simplifies the provisioning process through the use of a script or cloud-config document.

To get started, copy `user-data.jschott2.endstate` to `user-data` and make any necessary modifications.
Check out the [coreos-cloudinit documentation][coreos-cloudinit] to learn about the available features.

[coreos-cloudinit]: https://github.com/coreos/coreos-cloudinit

#### Configuration

The Vagrantfile will parse a `config.rb` file containing a set of options used to configure your CoreOS cluster.
See `config.rb.sample` for more information.
Copy 'config.rb.jschott2.endstate' to 'config.rb'

## Cluster Setup

Launching a CoreOS cluster on Vagrant is as simple as configuring `$num_instances` in a `config.rb` file to 3 (or more!) and running `vagrant up`.
Make sure you provide a fresh discovery URL in your `user-data` if you wish to bootstrap etcd in your cluster.

## Cluster / VM destroy

Cygwin Specific Instructions
When you issue a 'vagrant destroy' command and then desire to refresh the environment you need to mofify the 'known_hosts' file.  This will remove the old SSH fingerprints for the cluster machine names and allow you to rsync from the Guest to the Host.

## New Box Versions

CoreOS is a rolling release distribution and versions that are out of date will automatically update.
If you want to start from the most up to date version you will need to make sure that you have the latest box file of CoreOS.
Simply remove the old box file and vagrant will download the latest one the next time you `vagrant up`.

```
vagrant box remove coreos --provider virtualbox
```

## Docker Forwarding
## Not yet tested by this author.
By setting the `$expose_docker_tcp` configuration value you can forward a local TCP port to docker on
each CoreOS machine that you launch. The first machine will be available on the port that you specify
and each additional machine will increment the port by 1.

Follow the [Enable Remote API instructions][coreos-enabling-port-forwarding] to get the CoreOS VM setup to work with port forwarding.

[coreos-enabling-port-forwarding]: https://coreos.com/docs/launching-containers/building/customizing-docker/#enable-the-remote-api-on-a-new-socket

Then you can then use the `docker` command from your local shell by setting `DOCKER_HOST`:

    export DOCKER_HOST=tcp://localhost:2375


text:
# "Hotdog or Not" Using Azure Custom Vision, CoreML, and Xamarin

**TL;DR** I used Microsoft's Custom Vision service to train a CoreML model and wrote an iOS app in Xamarin to execute it in less than two hours. It has a loose tie-in with a popular television show. [Code on GitHub](https://github.com/praeclarum/HotDogOrNot)

## Machine Learning Is Easy Now?

Microsoft released a webapp called [Custom Vision](https://www.customvision.ai) as a part of their Azure Cognitive Services. While Microsoft has been a player in machine learning for awhile now with all their offerings, this new service is special for one reason: it can export CoreML models.

CoreML is a new feature of iOS 11 that enables apps to execute neural networks (and other ML models) locally on the device. While this has always been possible, **Apple made execution *easy*.**

All you need is a trained model and all of a sudden your app can do some fancy AI tricks - all locally without needing a network connection and without sharing information with third parties.

The only trick is that you need to train a model. While there are certainly pre-trained models online that you can download, chances are they won't do exactly what you want.

To train a CoreML model, you would follow the Keras tutorials and examples. Keras, while amazingly powerful, is neither easy to learn nor easy to use even once you've learned it. Eventually your skills increase and you can use it, but it does take quite some effort. It also takes some money - training deep networks is slow on standard PC hardware. Soon you'll be buying fast GPUs or paying for virtual machines out in the cloud.

Now with Custom Vision, **Microsoft has made training *easy*.** Instead of learning Keras and finding some fast GPUs to run it on, you can just use Microsoft's web app. They use Azure's infrastructure to find machines and, most importantly, they don't require that you learn how to train networks manually. Instead, there is a GUI that holds your hand, lets you experiment, and keeps everything organized for you.

In this version, they made training easy only for a particular kind of model: **recognizing the dominant object in a scene**. This is a classic task for CNN based neural networks to solve because they're really good at it and it's a useful capability with numerous real-world applications. It's a great choice for Microsoft to lead with this type of model.

So that's the hype. But does it work?

I tried training a new model and writing app to execute it to find out. Since I wasn't confident in my success (and perhaps had too many beers while extolling the virtues of ML to friends), I decided to make it an easy problem: **hot dog or not**. The app would take a picture and decide if the dominant object in the scene is a hotdog. Yes mom and dad, I'm really putting my degree to use.

I wrote my experience below as a tutorial for doing these kinds of trainings yourself. If you follow along, you'll be able to write an iOS ML app yourself.

## Step 1. Gather Training Data

No matter how skilled you are as a data scientist you will always be terrible at one thing - gathering training data.

We need two sets of images to train our model: one set of hotdogs and another of *not* hotdogs.

Sounds easy right? Well sure it is until you start actually doing it. Quickly you'll run up against questions and troubling biases:

1. Is a drawing of a hotdog a hotdog? (Aristotle would be proud.)
2. Are two hotdogs a hotdog? (What about 3?)
3. Should I have an equal number of hotdogs with mustard as hotdogs with ketchup? (Should you bias the network towards your *a priori* view of the world? Are your biases personal or universal?)
4. Should I have an equal number of images of hotdogs and not hotdogs? (Since nearly all objects in the universe are not hotdogs, just how strong should our bias be?)
5. Why do people dress up their dogs as hotdogs?

The list goes on and on. You will confront your biases when collecting training data. Those biases will then be passed onto the network you train. You've been warned.

Thankfully the nature of this app precludes the need to do much soul searching for biases towards hotdogs. So I made some executive decisions:

1. No, drawings are not hotdogs
2. Yes, many hotdogs are a hotdog
3. Bias towards ketchup because it's better
4. Bias towards not hotdogs since people love to try to trick these kinds of apps
5. Just accept it

Data collection takes a long time too even with Google's assistance. After an hour of dragging and dropping, I ended up with **75 images of hotdogs and 175 images of not hotdogs**. (I could have written a script but we all know how deep that rabbit hole is.)

For anyone who's trained a CNN before, you know that this is a very small training set. Even more absurdly, Custom Vision only **requires 5 images** of each type. What's going on here?

While Microsoft doesn't explain the details, my guess is that they are **fine-tuning** a model already trained on images. The idea is that you take a trained model and then re-train only a part of it on new data. The hope is that the majority of the model is general purpose and can be reused. This saves training time and also reduces the required training set size. I'm not sure if this is what they're doing, but I'm relieved that I don't have to gather tens of thousands of images.

Of course with all ML, more data is better. But my fingers were getting tired. (Also, Custom Vision is currently capped at 1,000 training images.)

## Step 2. Create a Project

You will want a project for each network you train. Projects hold all of your images and your trained models. You will end up training multiple times because it's good to experiment with different training set sizes and compositions.

1. Create an account on [https://www.customvision.ai](https://www.customvision.ai). It's free!
2. Create a **New Project**.

![New Project](NewProject.png)

I named the project **MyHotDogOrNot**, gave it a banal description, and then chose the domain **General (compact)**.

Domains are starting points for your trained model. If you are using cognitive services as a web API, then you should choose whichever domain most closely matches your training data.

General (compact) is the only domain that supports CoreML export so we must choose that. Hopefully Microsoft will allow us to use the other domains in the future in order to improve accuracy.

## Step 3. Create Tags

When you're viewing your project, you will see a list of tags. We need to make this list match the types of training images gathered.

1. Click the **+** at the top of the **Tags** list.
2. Create two tags: **hotdog** and **not-hotdog**.

![New Tag](NewTag.png)

When you're done, you'll see a list of your tags. The (0) means there are no images yet associated with the tags.

![Tags Without Images](TagsWithoutImages.png)

## Step 4. Upload Training Data

You can upload all the images with the same tag using just one command.

1. Choose **Add images** from the toolbar and select all of your hotdog images.
2. Add the tag **hotdog**.
3. Click **Upload files**.
4. Repeat for the tag **not-hotdog**.

![Upload Hotdogs](UploadHotdogs.png)

## Step 5. Train the Model

So let's train this thing already.

1. Click the big green **Train** button.
2. Go to the **Performance** tab and wait for your "Iteration" to finish.

![Performance](Performance.png)

When training is complete you will see the performance screen with the overall Precision and Recall of the model. In my case, I get slightly better results detecting not-hotdog than hotdog but they're both great numbers so why fret.

Of course, these numbers don't mean your network will work in the real world since the performance is measured against images you hand selected (with all your gross human biases). That said, you can use them as rough indicators of the relative performance of one training iteration against another.

## Step 6. Export the CoreML Model

Finally, we can retrieve the CoreML file.

1. Click **Export** from your iteration's performance screen.
2. Choose **iOS 11 (CoreML)** from the platform selection screen.
3. Click **Export**.
4. Click **Download**.

You will now have a fancy **.mlmodel** model file. Rename it to something nice.

If you open it with Xcode you will see its inputs and outputs.

![CoreML model in Xcode](XcodeModel.png)

We can see that its input is a 227 x 227 pixel image named **data** and its output includes a **classLabel** string that will be the model's best judgement and also a **loss** output that will give a closeness measure for each of our tags.

## Step 7. Write an App

At this point we have a model file and just need to put a UI on it.

To keep the code to a minimum, I'm going to use the **Vision** framework to execute the CoreML model. This framework makes resizing images to our required 227x227 dimensions easy and also takes care of numerical and pixel format conversions.

I will also use ARKit to display the camera on the screen. This is most definitely overkill, but it greatly reduces the amount of code we need to write to deal with the camera.

First, create a new Single View app.

Modify `ViewController.cs` to add an AR view.

    // In ViewController
    readonly ARSCNView cameraView = new ARSCNView ();
    public override void ViewDidLoad ()
    {
        base.ViewDidLoad ();
        cameraView.Frame = View.Bounds;
        cameraView.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;
        View.AddSubview (cameraView);
    }

Perform the standard management of that view. This is all we need to get a live camera preview.

    // In ViewController
    public override void ViewWillAppear (bool animated)
    {
        base.ViewWillAppear (animated);
        var config = new ARWorldTrackingConfiguration {
            WorldAlignment = ARWorldAlignment.Gravity,
        };
        cameraView.Session.Run (config, (ARSessionRunOptions)0);
    }

    public override void ViewWillDisappear (bool animated)
    {
        base.ViewWillDisappear (animated);
        cameraView.Session.Pause ();
    }

Add the model to the resources section of your app.

![Project with model added as a resource](ModelResource.png)

Add code to load the model. Models need to be compiled before they can be loaded. If you have access to Xcode, you can pre-compile your models. Compiling on the device is pretty fast so we won't bother with that optimization. (I do this loading in the view controller's `ViewDidLoad` method but you should architect your app better by doing this work on a background task.)

This also includes code to initialize the Vision request that we will make. Requests can be used for multiple images so we initialize it once. When a request completes, `HandleVNRequest` will be called.

    // In ViewController
    MLModel model;
    VNCoreMLRequest classificationRequest;

    // In ViewController.ViewDidLoad ()
    var modelUrl = NSBundle.MainBundle.GetUrlForResource (
        "HotDogOrNot", "mlmodel");
    var compiledModelUrl = MLModel.CompileModel (modelUrl, out var error);
    if (error == null) {
        model = MLModel.Create (compiledModelUrl, out error);
        if (error == null) {
            var nvModel = VNCoreMLModel.FromMLModel (model, out error);
            if (error == null) {
                classificationRequest = new VNCoreMLRequest (nvModel, HandleVNRequest);
            }
        }
    }

Add a tap handler that will respond to any taps on the screen (I like simple UIs). When a tap is detected, the Vision framework will be used to perform the model execution.

    // In ViewController.ViewDidLoad ()
    cameraView.AddGestureRecognizer (new UITapGestureRecognizer (HandleTapped));

    // In ViewController
    void HandleTapped ()
    {
        var image = cameraView.Session?.CurrentFrame?.CapturedImage;
        if (image == null) return;

        var handler = new VNImageRequestHandler (image, CGImagePropertyOrientation.Up, new VNImageOptions ());

        Task.Run (() => {
            handler.Perform (new[] { classificationRequest }, out var error);
        });
    }

    void HandleVNRequest (VNRequest request, NSError error)
    {
        if (error != null) return;

        var observations =
            request.GetResults<VNClassificationObservation> ()
                .OrderByDescending (x => x.Confidence);

        ShowObservation (observations.First ());
    }

Finally, in `ShowObervation` we present an alert of the model's best guess.

    // In ViewController
    void ShowObservation (VNClassificationObservation observation)
    {
        var good = observation.Confidence > 0.9;
        var name = observation.Identifier.Replace ('-', ' ');
        var title = good ? $"{name}" : $"maybe {name}";
        var message = $"I am {Math.Round (observation.Confidence * 100)}% sure.";

        BeginInvokeOnMainThread (() => {
            var alert = UIAlertController.Create (title, message, UIAlertControllerStyle.Alert);
            alert.AddAction (UIAlertAction.Create ("OK", UIAlertActionStyle.Default, _ => { }));
            PresentViewController (alert, true, null);
        });
    }

And that's it, we now have an app that can detect hot dogs (or not)!

![App detecting a hotdog](Results.jpg)

You can find the [complete source code on GitHub](https://github.com/praeclarum/HotDogOrNot).

## Conclusion

It's great to see Microsoft and Apple technologies working together to make adding a powerful feature to apps easier. If you made it this far, you saw how I was able to build the app in less than two hours and I think you can see that it's pretty easy to make your own ML apps.

repository: ncunning/HotDogOrNot

repo_name: ncunning/HotDogOrNot


text:
# Prepare to deploy 1Password SCIM Bridge

*Learn how to prepare your environment and 1Password account to use 1Password SCIM Bridge for automated user provisioning.*

## Overview

1Password SCIM Bridge uses [System for Cross-domain Identity Management](https://en.wikipedia.org/wiki/System_for_Cross-domain_Identity_Management) (SCIM) to act as an intermediary between your identity provider, such as Okta or Azure Directory, and your 1Password instance. It allows you to centralize user management to your identity provider so you can automatically provision and manage users and groups in 1Password based on assignments in your identity provider.

> **Note**
>
> In code and on the command line, "1Password" is often referred to as `op`. For example, `op-scim`.

### Technical components

For general deployment, the SCIM bridge requires these components:

* the `op-scim` service
* a [redis](https://redis.io/) cache
* a domain name (for example, `op-scim-bridge.example.com`)

### DNS record

You'll need to create a DNS record with your SCIM bridge domain name after the bridge is deployed. Follow the steps in each respective deployment guide to finish setting up your DNS record at the appropriate time.

### TLS certificate

Identity providers typically require a TLS certificate when communicating with the SCIM bridge. By default, TLS certificates are handled by a complimentary [Let's Encrypt](https://letsencrypt.org/) service integration, which automatically generates and renews a certificate based on the domain you're using.

If you require TLS certificate management, there are two ways you can use the Let's Encrypt service to issue a certificate for your SCIM bridge:

#### TLS-ALPN-01

The default and easiest option is the [TLS-ALPN-01](https://letsencrypt.org/docs/challenge-types/#tls-alpn-01) challenge type. When you set up the SCIM bridge, you'll set the `OP_TLS_DOMAIN` configuration variable to the domain name you've selected for your bridge (for example, `op-scim-bridge.example.com`).

In the background, Let's Encrypt will initiate an inbound HTTPS connection to your SCIM bridge on port 443 to verify the domain name and issue the SCIM bridge a new TLS certificate, which is automatically loaded and stored in the Redis cache.

To continue using this challenge type, you'll need to **keep port 443 accessible to the internet at all times**. If you have specific requirements, such as an internally-hosted identity provider, this can become an issue, so you may want to provide your own certificates or consider DNS-01.

#### DNS-01

While not as convenient as `TLS-ALPN-01`, the `DNS-01` challenge provides alternatives for your deployment environment. This challenge type does not require your SCIM bridge to be accessible by Let's Encrypt, and allows you to use your own certificate and/or more strictly constrain your firewall if preferred or required.

With this method, the SCIM bridge must be able to communicate with one of the DNS providers currently supported. As of April 2023, the supported providers are Google Cloud DNS, CloudFlare DNS, and Azure DNS.

Importantly, each DNS service tends to have its own unique way of configuring credentials to authenticate with them. For example, CloudFlare DNS typically only requires an API key (1 credential), whereas Azure DNS requires five separate configuration parameters to fully authenticate with the service.

During the authentication procedure with Let's Encrypt, the SCIM bridge modifies the DNS records of a given name (for example, `op-scim-bridge.example.com`) with certain records that Let's Encrypt is expecting to confirm DNS ownership. Once DNS ownership is confirmed, Let's Encrypt issues a certificate as usual, and the SCIM bridge removes those temporary DNS records.

To use this method, you'll provide secrets for the DNS service you choose during the setup process. You can find an example configuration file at the root of this repository: [`dns01.example.json`](/dns01.example.json).

## Considerations

There are a few things to consider before you deploy 1Password SCIM Bridge:

* You'll be provided with a bearer token, which contains the credentials for the automated provisioning integration. This integration will create, confirm, and suspend users, and create and manage access to groups. These secrets are required to connect to the 1Password service. Learn more [about 1Password SCIM Bridge security](https://support.1password.com/scim-security/).
* After you turn on provisioning, your identity provider will become the _authoritative source_ of user and group information for your 1Password account. You'll need to change the _display name_ and _account status_ of users in your identity provider; it's not currently possible to do this on 1Password.com when provisioning is turned on. You can still [recover accounts](https://support.1password.com/recovery/) for users who can't sign in.
* Do not attempt to perform a provisioning sync until the setup has been completed.
* You should only have one instance of 1Password SCIM Bridge running at a time. The SCIM bridge is not considered a high-availability service and running multiple SCIM bridges is not supported.
* 1Password SCIM Bridge Version 1.6.0 and newer allow you to enforce email address changes through your identity provider. When you do, users will be required to confirm email changes the next time they sign in to 1Password since their email address is used when generating the encryption keys for their account.

For more information on our security model, you can read the [1Password Security Design White Paper](https://1passwordstatic.com/files/security/1password-white-paper.pdf).

## Clone this repository

Before you start the deployment, clone this repository to make sure you have all the files you need and familiarize yourself with the contents of the deployment method you've selected.

From the command line:

```
git clone https://github.com/1Password/scim-examples.git
```

Alternatively, you can download a .zip of the repo by choosing Code > Download ZIP.

## Prepare your 1Password account

To begin setting up automated provisioning, sign in to your 1Password account on 1Password.com and click [Integrations](https://start.1password.com/integrations/directory/) in the sidebar, then choose your identity provider and follow the onscreen instructions. Deploy your SCIM bridge using an example listed in the [README](/README.md#before-you-begin) for this repo.

Learn more [automating provisioning with 1Password using SCIM](https://support.1password.com/scim/).

gha_language: HCL


text:
---
title: Click
description: Perform a click on a WebElement or the web page
categories: [steps]
keywords: [steps,click]
menu:
  docs:
    parent: "steps"
    weight: 4
draft: false
toc: true
---

If a WebElement location is given `click` waits until the WebElement become clickable before performing click unless
`ignore_clickable` has been set `true`

{{% note %}}
Avoid using `ignore_clickable` property unless you really have to. Each WebElement has to be checked if it is clickable before performing click on it.

If the flag has been set to `true` and the WebElement is not present in the DOM or is not clickable the scenario will fail which may cause confusion.
{{% /note %}}

There are some preconditions for an element to be clickable

* The WebElement must be visible
* It must have a height and width greater then 0.

`click` can be performed on one WebElement at a time to avoid any ambiguity, therefore, if multiple WebElements located the scenario will fail unless `resolve` property has been set.

If the location is not given or its value is `document` a click is performed on the webpage at the mouse current position and there is no pre-condition to perform a click.

## Properties

Name|Description|Type|Required
---|---|---|---
location|Web Element location|`string`|`false`
selector|Methods by which to find elements|`string`|`false`
resolve|Resolver|`string`|`false`
button|Mouse left, right or middle button to click|`string`|`false`
hold|Hold down keys or modifier while performing click. See the list of [Special Keys](/action/special)|`string`|`false`
timeout|The amount of time to wait until Web Element becomes clickable|`Duration`|`false`
ignore_clickable|Perform click on Web Element without expecting element to be clickable|`bool`|`false`

## Syntax

`click` accepts a string or a map of values

### Inline

Use inline syntax to perform a click on a WebElement using provided location and the default selector or on the webpage at the mouse current position.
Please make sure you are precise on your selection to target only one Web Element,
otherwise the test will fail in case of multiple elements found.

```yaml
- click: <string> | $submit_btn
```

### Mapping

Use mapping syntax to configure available properties

```yaml
- click:
    location: <string> | $element_location
    selector: <string>
    resolve: <string>
    ignore_clickable: <bool>
    button: <string>
    hold: <string>
    timeout: <Duration> | $timeout
```

## Basic Usage

Say there is a WebElement in the DOM and we want to perform a simple mouse left button click on it

```yaml
- click: .confirm_btn
```

this will wait until there is a button in the DOM with class name `.confirm_btn`, wait until it is clickable and perform the click

or

```yaml
- click:
    location: .confirm_btn
    selector: css
```

or on webpage at the mouse current position

```yaml
- click: document
```

## Hold Keys

Hold keys or modifiers while performing a click on a WebElement

```yaml
- click:
    location: .confirm_btn
    hold: @ctrl @shirt
```

This will make sure the Element presence, clickability, hold down `ctrl+shift` [Keys](/action/special), perform the click and release the keys afterwards.

## Mouse Button

Perform mouse `left`, `middle` or `right` click on a WebElement or webpage at the mouse current position

```yaml
- click:
    location: document
    button: left | middle | right
```

## Resolve

In case of multiple elements found, resolve provides a way to specify to which WebElement resolve and perform the click before

```yaml
- click:
    location: .confirm_btn
    resolve: first | last
    selector: css
```

## Timeout

Set waiting `timeout` until the WebElement becomes clickable. Does not make sense if `ignore_clickable` has been set to `true`

```yaml
- click:
    timeout: 10s | 1m | 250ms | $timeout
    location: .confirm_btn
    selector: css
```

gha_language: HTML


text:
## Express REST API with Mongo DB
Two Mongoose Schema models are created (resources) to route and manipulate through an express server.

###Dependencies
   * Body-Parser
   * Express
   * Gulp
   * Mongo
   * Mongoose

##Dev dependencies
   * Chai
   * Chai-Http
   * Gulp-Eslint
   * Gulp-Mocha
   * Mocha

The databases can be
located at ```localhost:4020```

```/api/rabbits``` and ```api/slugs```

#### Authorization
Uses jsonwebtoken and bcrypt to build a token and store it for user sign in and sign up.


text:
---
category: Blog
tag: Computer Vision
comments: true
date: 2012-06-25 18:05:53
layout: post
slug: configuring-boostpython-and-hello-boost
title: Configuring Boost::Python and Hello Boost
---

In my recent blog posts, I have mentioned that python is quite slow and I need to find an option to increase run-time speed of my python port of OpenTLD. I need to extend Python with C++ and hence I was looking at all the available options. I have once used **swig bindings**. I can't say anything about it's performance, but it was kind of boring to use swig. I had to make few files and then compile and make. So I started looking at other options. **Python/C API** is good but you need to pass pointer reference, objects and sometimes it just becomes messy. I have never tried **Cython**. I might give it a shot.

Moving on to **Boost::Python**. Python already provides an API for gluing together Python and C. Boost::Python is a wrapper for Python/C API. Using the Python/C API, you have to deal with passing pointers back and forth between Python and C, and worry about pointers hanging out in one place when the object they point to has been thrown away.
Boost:Python takes care of all of that and lets you write operations on Python objects in C++ in OOP style.

For example, using the Python/C API, to do the C++ equivalent of "y = object_x[i]", you might do:

`y = PySequence_GetItem(object_x, i);`

By contrast, in Boost::Python, you can just do:

`y = object_x[i];`

Boost:Python makes it very easy to export C++ classes into Python. Boost::Python is designed in such a way that users never need to use **PyObject***

#### **Configure Boost::Python on Ubuntu 12.04**:

This is the official page of Boost about configuring Boost::Python http://www.boost.org/doc/libs/1_41_0/libs/python/doc/building.html . I tried to follow that, but couldn't understand much. I visited pages of pyopencv and pyopencl on code.google.com, where I found a very easy way to install and configure Boost::Python.

> **sudo apt-get install libboost1.48-all-dev**

That's it. Boost::Python is install and automatically configured. It also require some bjam library, but it turns out that either it's available in libboost1.48-dev or it has been obsoleted. No problems there.

#### **Hello Boost**:

I have found this link very helpful in making hello world program using Boost::Python. http://www.shocksolution.com/python-basics-tutorials-and-examples/linking-python-and-c-with-boostpython/

Writing a **Hello World** program using Boost::Python.

Create a file named **hello_ext.c**

    char const* greet()
    {
        return "hello, world";
    }

    #include<boost/python.hpp>

    BOOST_PYTHON_MODULE(hello_ext)
    {
        using namespace boost::python;
        def("greet",greet);
    }

After making the C++ file, we need to make .so file. For that we need to make it.
Create a **Makefile**

    PYTHON_VERSION = 2.7
    PYTHON_INCLUDE = /usr/include/python$(PYTHON_VERSION)

    # location of the Boost Python include files and library

    BOOST_INC = /usr/include
    BOOST_LIB = /usr/lib

    # compile mesh classes
    TARGET = hello_ext

    $(TARGET).so: $(TARGET).o
    	g++ -shared -Wl,--export-dynamic $(TARGET).o -L$(BOOST_LIB) -lboost_python -L/usr/lib/python$(PYTHON_VERSION)/config -lpython$(PYTHON_VERSION) -o $(TARGET).so

    $(TARGET).o: $(TARGET).c
    	g++ -I$(PYTHON_INCLUDE) -I$(BOOST_INC) -fPIC -c $(TARGET).c

**Makefile** is ready. Now, make it and import hello_ext in python.

> **make**

    import hello_ext
    print hello_ext.greet()

**This python file has to be in the same directory as that of hello_ext.so**.
Or, you can copy hello_ext.so to /usr/local/lib/python2.7/dist-packages/

> **sudo cp hello_ext.so /usr/local/lib/python2.7/dist-packages/**

Now, since you have added **hello_ext.so**to PYTHON_PATH, you can **import hello_ext**.

So, Hello Boost done. I'll move on to classes and other stuff. Final goal: Using Boost::Python to port OpenTLD to python.

P.S. I'll be getting SimpleCV t-shirt and stickers in few days. yay.

extension: markdown

gha_language: JavaScript


text:
# How To Design A Photo Sharing App Like Instagram

## Scope
A photo sharing app will have features like
- Users can follow each other, like/comment theirs pictures
- Upload and render pictures
- Explore the picture pool
- Advertisement
We will focus on the fundamental phote feeds feature.

## System
### Basic Data Model
- User table containing id, email, profile, etc.
- Picture table containing id, caption, picture binary, picture metadata, hash tag etc.
- User relationship, such as Alice follows Bob.
- User-picture relationship, Alice posts a new picture.

## Solution
To check a user’s feed, we can fetch all pictures from people he follows.
### Timeline Feeds
- The straighforward chronological order, might not be the best approach.
- A common optimization is to come up with a scoring mechanism that takes various features as signals and computes a final score for each picture.
### Image Optimization
- A good storage system like Amazon S3.
- Static image data can be optimized by cache (speed) and replication (robustness).
- Image compression.

## Scalability
- Feeds could go slow if a user follows many people with frequent posts.
  - Search top most relevant pictures with infinite scroll.
  - Offline pipeline to precalcuate.
- Architecture with well designed components which easily get horizontally sharded.
- Database partitioning (vertical) and sharding (horizontal).

[Reference](http://blog.gainlo.co/index.php/2016/03/01/system-design-interview-question-create-a-photo-sharing-app/)

branch_name: refs/heads/main


text:
# Parallel
A parallel runs all actions right after each other, even if they return a promise.

```js
import {parallel} from 'cerebral'
import someAsyncAction from '../actions/someAsyncAction'
import someOtherAsyncAction from '../actions/someOtherAsyncAction'

export default parallel([
  someAsyncAction,
  someOtherAsyncAction
])
```

You can name a parallel, which will be displayed in debugger:
```js
import {parallel} from 'cerebral'
import someAsyncAction from '../actions/someAsyncAction'
import someOtherAsyncAction from '../actions/someOtherAsyncAction'

export default parallel('my parallel', [
  someAsyncAction,
  someOtherAsyncAction
])
```

You can compose parallel into any existing sequence:
```js
import {parallel} from 'cerebral'
import someAction from '../actions/someAction'
import someAsyncAction from '../actions/someAsyncAction'
import someOtherAsyncAction from '../actions/someOtherAsyncAction'

export default [
  someAction,
  parallel('my parallel', [
    someAsyncAction,
    someOtherAsyncAction
  ])
]
```

repository: DmitryPopov/cerebral

repo_name: DmitryPopov/cerebral


text:
# Corticiruptor abeloneae (P.M. Jørg.) Wedin & Hafellner SPECIES

#### Status
ACCEPTED

#### According to
Index Fungorum

#### Published in
Lichenologist 30(1): 88 (1998)

#### Original name
Arthonia abeloneae P.M. Jørg.

### Remarks
null

repository: mdoering/backbone

repo_name: mdoering/backbone


text:
Turbo Pascal Compiler
---------------------

This is a Node.js and web-based Pascal compiler and UCSD p-code interpreter that runs a subset of Turbo Pascal 5.5 code.

See the [full write-up](http://www.teamten.com/lawrence/projects/turbo_pascal_compiler/) or
[try it now](http://mikeralphson.github.io/turbopascal/)!

To run the compiler from the command-line use the `turbo` command. This uses `tpc.js` which is a shell around the actual compiler and runtime.

To run the web version locally, run the "arapaho" script to start a web server and go to
http://localhost:3000

Go to http://localhost:3000/unit.html to run the unit tests.

See the LICENSE file for the BSD 2-clause license.

repository: MikeRalphson/turbopascal

repo_name: MikeRalphson/turbopascal


text:
# Beam-me-up
## A project for heroku replacement
### WARNING: This was made for a school project and is considered extremely insecure by its authors, see below for details[^1]

### Requirements
  - AWS account
  - node/npm installed locally
  - github repo with an express server

# Getting started
In this section we will
- Created an IAM user that our software can interact with your AWS account through
- Pulled that credential pair down to your local machine
- Cloned down the repo locally
- Installed dependancies
- Launched an EC2 Cloud server
- Configured security groups so that the service would be reachable

## Step by step instructions
  - open AWS account
  - Create an IAM user for programmatic access (the aws-sdk will pull creds from your local computer)
  - leave that window open while you run aws configure from your local development command line
  - from local shell type
  ```
  aws configure
  ```
  - you will see the following prompt
  ```
AWS Access Key ID [****************ESHN]:
AWS Secret Access Key [****************Em9v]:
Default region name [us-west-2]:
Default output format [text]:
```
  - enter your access key when prompted and same for your secret access key
  - region should be us-west-2 for this demo
  - clone down this repo locally
  ```
  git clone https://github.com/401-midterms-kramer/beam-me-up
  ```
  - cd into the directory
  ```
  cd beam_me_up
  ```
  - run an npm i
  ```
  npm install
  ```
  - **TECH DEBT** make sure the terminate line in app.js is commented out (line 16 app.js)
  - run the node command to create a server from our pre-formatted ami[^1]
  ```
node app.js
  ```
  - **TECH DEBT** this may return a DNS name or it may not no biggie
  - Go back to the AWS EC2 console and select the newly launching instance
  - Click the instances checkbox
  - Click on the security group settings (**launch-wizard-1** in this case)
  ![img](resources/securitynav.png)
  - Click on inbound rules
  - Modify the instances security group rules to match these (port 22 rule is optional)
![img](resources/securitygroups.png)

  - Now you are ready to interact with the service!

# Interacting with the service

- After completing above getting set up steps
- **TECH DEBT** run
```
node promt-commands/prompt-inquirer/prompt-inquirer.js
OR
npm start
```
- This will prompt you for a github repo the proper syntax for this entry is[^2]
```
https://github.com/401-midterms-kramer/demo-1
```
- support for .env files right now requires the .env file to be in the same folder from where you run the node command above (path to the command will be different if you are not running it from the root directory of the repo)

- after a short wait you will get back a link to your live site!
- thats it, you have a live website

[^1]: This project uses basic authentication to validate permission against the server. The intention was to make this very easy to interact with for the end user, as a result the code for this repository has credentials hard coded. We ran out of time to automate short term credentials on this project and left a default user with username:password combo of lee:lee. We are well aware of how bad that is.

[^2]: Feel free to fork our example for static websites!

branch_name: refs/heads/dev


text:
# Python project template
![Github CI](https://github.com/KirovVerst/python-project-template/workflows/Github%20CI/badge.svg)
[![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/)
[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://lbesson.mit-license.org/)

pre-commit-hooks:
1. flake8
2. reorder-python-imports

## Licensing
The code in this project is licensed under MIT license.

repository: KirovVerst/python-project-template

repo_name: KirovVerst/python-project-template


text:
# Themes

If user want to apply css for **ReactTree**, consider to include these files to your web app:

* node_modules/jstree/dist/themes/**default**/style.min.css
* node_modules/jstree/dist/themes/**default-dark**/style.min.css

with additional options in `core` object, for instance with **default-dark** theme:

```js
const CORE = {
  data: [
    'Simple root node',
    {
      text: 'Root node 2',
      state: {
        opened: true,
        selected: true
      },
      children: [
        {
          text: 'Child 1'
        },
        'Child 2'
      ]
    }
  ],
  themes: {
    name: 'default-dark'
  }
};
```

If you are using React ES6 with [webpack](https://github.com/webpack/webpack),
you can add these themes easily by using [css-loader](https://github.com/webpack/css-loader):

```js
import 'node_modules/jstree/dist/themes/default/style.min.css';
import 'node_modules/jstree/dist/themes/default-dark/style.min.css';
```

*You only need to `import` these themes one time.*


text:
gooda-to-afdo-converter
=======================

Simple utility application to convert Gooda Spreadsheets to AFDO (Google Patch to add sampling profiling to GCC).

Build
-----

To build the application, CMake 2.8 and GCC 4.7 are necessary. Boost >= 1.41 is also necessary.

    git clone git://github.com/wichtounet/gooda-to-afdo-converter.git
    cd gooda-to-afdo-converter
    cmake .
    make

The application make uses of objdump during the execution. It is necessary to install objdump prior to use this converter.

Gooda
-----

Gooda is necessary for the profiling steps.

You can download Gooda on the official repository (https://code.google.com/p/gooda/) and install it following the instructions that are available in the tarball.

GCC-AutoFDO
-----------

This tool only works with a special version of GCC, the one from the Google branch. If you do not plan to test the loop fusion and cache misses features, you can ignore the two patches that are not necessary for simple PGO.

    mkdir gcc_build
    mkdir gcc_install
    svn co svn://gcc.gnu.org/svn/gcc/branches/google/gcc-4_7 gcc_src
    cd gcc_src
    patch -p0 -i gcc_misses.diff
    patch -p0 -i loop_fusion.diff
    cd ../gcc_build/
    ../gcc_src/configure --prefix=`readlink ../gcc_install/`
    cores=`cat /proc/cpuinfo | grep processor | wc -l`
    threads=$(($cores+1))
    make -j$threads
    make install

Usage
-----

Once built, the application can be used to perform several tasks.

To profile your application with Gooda and generate AFDO data use:

    ./bin/converter --afdo --gooda=gooda_director --profile your_application [your_options]

or

    ./bin/converter --afdo --gooda=gooda_director --lbr --profile your_application [your_options]

to use LBR.

If the --afdo option is not set with the --profile option, it just runs the collection script and gooda on the given program.

If GOODA_DIR environemnt variable is set to the Gooda directory, there is no need to use the --gooda option.

To read existing spreadsheets and convert them to AFDO data:

    ./bin/converter spreadsheets_directory

Again, use --lbr to activate LBR mode.

AFDO data can also be dumped to the console:

    ./bin/converter --dump spreadsheets_directory

Use --full-dump to have all the data printed oud.

repository: wichtounet/gooda-to-afdo-converter

repo_name: wichtounet/gooda-to-afdo-converter


text:
# nexus-proxy

_This project is a fork of the original [nexus-proxy (by travelaudience)](https://github.com/travelaudience/nexus-proxy) which allowed optional authentication
against the Google Cloud IAM. It is not hard-wired to Google Cloud IAM anymore. You can use it with any IDP which supports the OAuth2 Code Authorization Flow.
Furthermore the docker proxy was removed since we only needed authentication for npm and gradle/maven._

A proxy for Nexus Repository Manager that allows for optional authentication against an external identity provider (which implements OAuth2/OpenID).

## Pre-requisites

For building the project:

* JDK 8.

For basic proxying:

* A domain name configured with an `A` and a `CNAME` records pointing to the proxy.
  * For local testing one may create two entries on `/etc/hosts` pointing to `<IP_ADDRESS>`.
* A running and properly configured instance of Nexus.
  * One may use the default `8081` port for the HTTP connector.

For opt-in authentication against an IDP:

* All of the above.
* A properly configured IDP, e.g. Keycloak
* A set of credentials (`CLIENT_ID` & `CLIENT_SECRET`)
* OAuth2 Endpoint URLs (`AUTHORIZE_ENDPOINT`, `TOKEN_ENDPOINT`, `JWK_URL`)
* Proper configuration of the resulting client's `REDIRECT_URL`.

## Running the proxy

## Running the proxy with OpenID Authentication

The following command will run the proxy on port `8080` with
authentication against an OpenID IDP enabled and pointing to a local Nexus instance:

```bash
$ BIND_PORT="8080" \
  CLOUD_IAM_AUTH_ENABLED="true" \
  CLIENT_ID="my-client-id" \
  CLIENT_SECRET="my-client-secret" \
  NEXUS_HTTP_HOST="nexus.example.com" \
  REDIRECT_URL="https://nexus.example.com/oauth/callback" \
  SESSION_TTL="1440000" \
  UPSTREAM_HTTP_PORT="8081" \
  UPSTREAM_HOST="localhost" \
  TOKEN_ENDPOINT="https://<sso-base-url>/openid-connect/token" \
  JWK_URL="https://<sso-base-url>/openid-connect/certs" \
  TOKEN_ENDPOINT="https://<sso-base-url>/openid-connect/auth" \
  java -jar ./build/libs/nexus-proxy-2.3.0.jar
```

## Environment Variables

| Name                                | Description |
|-------------------------------------|-------------|
| `BIND_HOST`                         | The interface on which to listen for incoming requests. Defaults to `<IP_ADDRESS>`. |
| `BIND_PORT`                         | The port on which to listen for incoming requests. |
| `CLIENT_ID`                         | The application's OAuth2 client ID|
| `CLIENT_SECRET`                     | The abovementioned application's client secret. |
| `CLOUD_IAM_AUTH_ENABLED`            | Whether to enable authentication against an IDP. |
| `LOG_LEVEL`                         | The desired log level (i.e., `trace`, `debug`, `info`, `warn` or `error`). Defaults to `info`. |
| `NEXUS_HTTP_HOST`                   | The host used to access the Nexus UI and Maven repositories. |
| `REDIRECT_URL`                      | The URL where to redirect users after the OAuth2 consent screen. |
| `SESSION_TTL`                       | The TTL (in _milliseconds_) of a user's session. |
| `UPSTREAM_HTTP_PORT`                | The port where the proxied Nexus instance listens. |
| `UPSTREAM_HOST`                     | The host where the proxied Nexus instance listens. |
| `AUTHORIZE_ENDPOINT`                | The OAuth2/OpenID auth endpoint for the Authorize Flow |
| `TOKEN_ENDPOINT`                    | The OAuth2/OpenID token endpoint for the Authorize Flow |
| `JWK_URL`                           | URL where the server can receive the IDP's JWK. Needed for verifying the tokens signature.  |

repository: fino-digital/nexus-proxy

gha_language: Java

repo_name: fino-digital/nexus-proxy