text:
# Object Oriented Ruby Continued

[HackMD Lecture Notes](https://hackmd.io/@dlm/phase-3-lecture-3-object-oriented-ruby-continued-7-21-21)
## 1st Segment - Review of Object Instantiation

Throw out questions:

```rb
class Dog
end

lennon = Dog.new("Lennon Snow", "11 months", "Pomeranian")
```
### What will happen if we try to run the code above?

...
### What do we need to do or change to get this code to work?

...

Say we want to be able to do:

```rb
lennon.name #=> "Lennon Snow"
```
and
```rb
lennon.age #=> "11 months"
```
and
```rb
lennon.breed #=> "Pomeranian
```

### What do we need to add/change in the class to support this?

...

Finally, let's say we want to be able to create a new Dog like this:

```rb
Dog.new(name: "Lennon Snow", age: "11 months", breed: "Pomeranian")
```

How would the class have to change to support this?

## Activity 1

Rework the computer class from yesterday to utilize mass assignment upon initialization. Refactor the code to take advantage of the attribute macros you learned about in labs so we can cut down on the code inside of the class. Run the specs using the `rspec` command to track your progress, you'll be complete when the first 4 specs are passing. (15 minutes in breakouts)

When we return, be prepared to share & discuss your solution with the group.
Confirm:
- Created Instances
- reworked first_computer and second_computer methods to accept a hash of attributes on instantiation.

### What Errors Did you hit?

-

## Discussion Questions

What does the initialize method do?

When does the initialize method get called?

When do we need an initialize method and when can we do without it?

**Take 5 minute break after discussion**

## 2nd Segment - Keeping track of the Computers we create

### Group Discussion in Breakouts - Pick a Scribe and have them [fill in the group's answers here](https://hackmd.io/@dlm/phase3-lecture-3-classes-and-instances-discussion-7-21-21)

### What if we wanted to keep track of all of the computers that we create? Where would we store them and why?

...
### What's the difference between a class variable and an instance variable?

...

### What's the difference between a class method and an instance method? (think both about how they're defined and how they're called)

...

### What does `self` refer to within a class method?

...
### What does `self` refer to within an instance method?

...
### Can we access class variables from instance methods?

...

### Can we access instance variables from class methods?

...

### Setting up Activity

Let's say we add a class variable called `@@all` to the computer class so that we can store an array of the computers we create. After we've done that, we can set up a method called `save` that will store a computer inside of the that array.

What kind of method should `save` be?

What will we be calling `save` on, an instance or the class?

let's code the `save` method together and then breakout again to add some additional functionality.

```rb
def save
  # insert code here
end
```

## Activity 2 - build an all method that returns an array of all saved computers

Now that we've got a save method built out that will store computer instances within a class variable called `@@all`, your tasks will be to:
- add the `#save` method that will store computer instances in `@@all` (if you haven't already)
- add a method called `.all` that will return all of those computers.
- add a method called `.create` that will:
  - accept a hash of attributes (just like initialize)
  - use that hash to create a new computer
  - save the computer to `@@all`
  - return the computer
- add a method called `.backed_up` that will return an array of all computers that have been backed up.

### Final Discussion questions

When did you use the `self` keyword?

What code did you write that didn't use `self` but could have used `self` (to call a method accessible in the same scope)?

How do you determine what `self` will refer to within a method?

What are some examples of metaprogramming that we've used in our code today?


text:
# Encryption-Techniques

## Vigenere Cipher
Vigenère cipher is a method of encryption that utilizes alphabetic substitution system. The Vigenère cipher encrypts alphabetic text by using a series of interwoven Caesar ciphers, based on the letters of a keyword.

### Usage:

#### Encryption
 1. ```import Vigenere```
 2. ```Vigenere.encryption(<Encryption key>, <Plain Text>)```

  ```python
  print('Encrypted Text:', end=' ')
  cipher = Vigenere.encryption('<Encryption key>', '<Your Plain Text Message>')
  print(cipher)
  ```

#### Decryption
 1. ```import Vigenere```
 2. ```Vigenere.decryption(<Encryption key>, <Cipher Text>)```

  ```python
  print('Decrypted Text:', end=' ')
  Message = Vigenere.decryption('<Encryption key>', '<The encrypted cipher>')
  print(Message)
  ```

repository: ifarshgar/Encryption-Techniques

path: /Vigenere cipher/README.md

branch_name: refs/heads/main

extension: md

gha_language: Python

license_type: permissive

repo_name: ifarshgar/Encryption-Techniques


text:
---
id: faq
title: FAQ
sidebar_label: FAQ
custom_edit_url: https://github.com/microsoft/fast-dna/edit/master/sites/website/src/docs/resources/faq.md
---

#### Who is behind FAST?

The Microsoft FAST team, part of the Edge organization, builds and maintains all the `@microsoft/fast-*` packages. We are a collection of UX Engineers and Designers who are passionate about solving real-world UX challenges using web standard technologies. You can find us on GitHub [here](https://github.com/microsoft/fast-dna).

#### What does FAST stand for?

When the project was originally founded, it went by the name FAST-DNA, which stood for "Functional, Adaptive, Secure, and Timeless Design Network Architecture". Over time we began to refer to the project as "FAST" which reflects our desire to create libraries and tools that enable leading designer and developer productivity.

#### How does `fast-element` compare to "Framework X"?

At this time, `fast-element` has a focus that's a bit different from the typical front-end framework. Rather than focusing on being a "mega SPA framework", `fast-element` endeavors to enable the creation of web components. As a result, you can use `fast-element` or any component built on `fast-element` in tandem with your favorite front-end framework.

license: MIT

repository: JamesBurnside/fast-dna

branch_name: refs/heads/master

gha_license_id: MIT

repo_name: JamesBurnside/fast-dna


text:
ember-conekta-service
==============================================================================

`ember-conekta-service` wraps
[Conekta.js](https://developers.conekta.com/libraries/javascript) library and
makes it available through a service in your ember project. Features based in the
[ember-stripe-service](https://github.com/code-corps/ember-stripe-service/blob/master/README.md)
library.

Installation
------------------------------------------------------------------------------

```
ember install ember-conekta-service
```

Features
------------------------------------------------------------------------------

- sets conekta.js script in index.html (test, app)
- initializes conekta with public key
- injects service in controllers which provides promisified method for `Conekta.card.createToken`
- provides debugging logs for easy troubleshooting
- client side validations for card number, expiration dates, card brand and CVC
- lazy load conekta.js

Configuration
------------------------------------------------------------------------------

In order to use Conekta you must set your [public key](https://admin.conekta.com/settings/keys) in `config/environment.js`.

````javascript
ENV.conekta = {
  publicKey: 'meep_thisIsATestKey',
  language: 'en', // defaults 'es' if not added
  debug: false, // turn on debugging
  lazyLoad: false, // lazy load conekta
  mock: false // mock out conekta.js, good for offline testing
};
````

Lazy Loading
------------------------------------------------------------------------------
If `lazyLoad` is set to turn Conekta.js will not be loaded until you call the
`load()` function on the service. It's best to call this function in a route's
beforeModel hook.

```js
// subscription page route

import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import { get } from '@ember/object';

export default Route.extend({
  conekta: service(),

  beforeModel() {
    return get(this, 'conekta').load();
  }
});
```

Example of usage in a route
------------------------------------------------------------------------------
```js
// subscription page route

import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import { get, set } from '@ember/object';

export default Route.extend({
  conekta: service(),

  processCreditCard() {
    let customer = get(this, 'customer');

    // obtain access to the injected service
    let conektaService = get(this, 'conekta');

    // if for example you had the cc set in your route or component
    let card = get(this, 'creditCard');

    return conekta.card.createToken(card).then((token) => {
      // you get access to your newly created token here
      set(customer, 'conektaToken', token.id);
      return customer.save();
    }).then(() => {
      // do more stuff here
    }).catch((error) => {
      // do something with the error
    });
  }
});
```

Debugging
------------------------------------------------------------------------------

By setting `debug: true` in your application configuration you can enable some
debugging messages from the service.

````javascript
var ENV = {
  // some vars...
  conekta: {
    debug: true
  }
  // more config ...
}
````

Validations
------------------------------------------------------------------------------

Conekta has a few client-side validation helpers. See more information
[here](https://developers.conekta.com/libraries/javascript#validations)

* `validateNumber` - Checks that the format of the card number is correct.
* `validateExpirationDate` - Checks that the expiration date is a valid and future date.
* `validateCVC` - Checks that the security code is a valid whole number, 3 to 4 characters long.
* `getBrand` - Returns the type of the card as a string. The possible types are "visa", "mastercard", "amex", "unknown"

Contributing
------------------------------------------------------------------------------

### Installation

* `git clone <repository-url>`
* `cd ember-conekta-service`
* `npm install`

### Linting

* `npm run lint:js`
* `npm run lint:js -- --fix`

### Running tests

* `ember test` – Runs the test suite on the current Ember version
* `ember test --server` – Runs the test suite in "watch mode"
* `npm test` – Runs `ember try:each` to test your addon against multiple Ember versions

### Running the dummy application

* `ember serve`
* Visit the dummy application at [http://localhost:4200](http://localhost:4200).

For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).

License
------------------------------------------------------------------------------

This project is licensed under the [MIT License](LICENSE.md).

repository: esnilara/ember-conekta-service

gha_language: JavaScript

repo_name: esnilara/ember-conekta-service


text:
# Currency Converter
Using this application you can get real time currency rate. In this application fixer.io is being used as third part
service provider.
It is developed using NodeJs, GraphQL and Typescript.

## Steps to Run
Make sure NodeJs is installed on your machine.
* Run `npm install` from root directory currency-converter.
* Rename env.sample file to .env file and add corresponding key values.
* Run `npm run start`. It will start server at specified port.

## Steps to Test
* You can run `npm run test` to run all the test cases and you can see its coverage.

Note : You can also go to currency-converter/coverage/Icov-report path and see the test cases coverage in HTML form.

repository: pateljemin/currency-converter

repo_name: pateljemin/currency-converter


text:
# Accounts Module

This module provides out-of-the-box user accounts for an application:

* Registration and Login features
* Forgotten password tokens
* User roles
* Administrative interface for user management
* Command line tools for user management

## Set-up/configuration

### Quick Start

To support the most basic account capabilities, set the following in your app config:

    ACCOUNT_ENABLE = True
    SECRET_KEY = "something-secret"

and this in your web.py imports:

from octopus.modules.account.account import blueprint as account
app.register_blueprint(account, url_prefix="/account")

Then when you have created a user (see below), you will be able to go to

    /account/login

and log in to the account you created.

### Full Default Set-up

To fully configure the default account system, you can add the following configurations in your app config:

Whether or not to allow previously-unknown users to register for an account:

    ACCOUNT_ALLOW_REGISTER = False

Whether or not to allow an account with the relevant role (list_users) to list the system's user accounts:

    ACCOUNT_LIST_USERS = True

if user listing is enabled, you need to provide a Query endpoint where the data can be retrieved.  This can be
done by providing the following Query Route configuration for ElasticSearch.

First, set it up in your web.py file:

    from octopus.modules.es.query import blueprint as query
    app.register_blueprint(query, url_prefix="/account_query")

Then configure the query route in your app config as follows:

    QUERY_ROUTE = {
        "account_query" : {
            "account" : {
                "auth" : True,
                "role" : "list-users",
                "filters" : [
                     "octopus.modules.account.dao.query_filter"
                 ],
                "dao" : "octopus.modules.account.dao.BasicAccountDAO"
            }
        }
    }

Finally, let the front-end javascript know where you are setting the endpoint:

    CLIENTJS_ACCOUNT_LIST_ENDPOINT = "/account_query/account"

When user's log in or log out, they will be redirected.  This configuration tells the account system which routes
to redirect the user to:

    ACCOUNT_LOGIN_REDIRECT_ROUTE = "index"
    ACCOUNT_LOGOUT_REDIRECT_ROUTE = "index"

## Creating a user

To create a user from the command line, you can use the usermod octopus script:

    python magnificent-octopus/octopus/bin/run.py usermod -e<EMAIL_ADDRESS>-p password -r admin

repository: richard-jones/magnificent-octopus

branch_name: refs/heads/develop

gha_license_id: NOASSERTION

repo_name: richard-jones/magnificent-octopus


text:
## Introduce the hyper-parameter used in DeepSEM

- n_epochs: Number of Epochs for training DeepSEM.
- task: Determine which task to run. Select from (non_celltype_GRN,celltype_GRN,embedding,simulation)
- setting: Determine whether or not to use the default hyper-parameter
- batch_size: The batch size used in the training process.
- data_file: The input scRNA-seq gene expression file.
- net_file: The ground truth of GRN. Only used in GRN inference task if available.
- alpha: The loss coefficient for L1 norm of W, which is same as \alpha used in our paper.
- beta: The loss coefficient for KL term (beta-VAE), which is same as \beta used in our paper.
- lr: The learning rate of used for RMSprop.
- lr_step_size: The step size of LR decay.
- gamma: The decay factor of learning rate.
- n_hidden: The Number of hidden neural used in MLP
- K: The number of Gaussian kernel in GMM, default =1
- K1: The Number of epoch for optimize MLP. Notes that we optimize MLP and W alternately. The default setting denotes
 to optimize MLP for one epoch then optimize W for two epochs.
- K2: The Number of epoch for optimize W. Notes that we optimize MLP and W alternately. The default setting denotes
 to optimize MLP for one epoch then optimize W for two epochs.
- save_name: The directory to save the output file of DeepSEM

## Default hyper-parameter selection

We provide default hyper-parameter in main.py. Therefore, for most situations, directly run main.py with default
hyper-parameter can perform quite well.

Note that, the hyper-parameters used in Figure 2 and Supplementary Figure 1 is **not default hyper-parameters**, which is
selected by cross validation between cell line for fair comparison. For exactly reproducing performance shown in
Figure 2 and Supplementary Figure 1. Please used the following hyper-parameters:

- **Celltype non-specific GRN inference alpha=100,beta=1,n_epochs=90**
- **Celltype specific GRN inference alpha=0.1 beta=0.01 n_epochs=150 for hESC and mHSC-E and alpha=1,beta=0.01,
n_epochs=150 for others**.

You can also use the default hyper-parameter, the overall average performance between the default hyper-parameters and
hyper-parameter determined by cross-validation should be less than 0.5%

## Important hyper-parameter and suggestion for hyper-parameter tuning

Alpha and beta are most important hyper-parameters among all hyper-parameters. Hyper-parameter beta balance the
novelty and similarity when comparision to real cells. More specific hyper-parameter sweeping results are shown in our manuscript (Supplementary Section 7).

Suggestion for hyper-parameter tuning: If the MSE loss does not decrease significantly for a long time during the
training process. Slightly decrease the hyper-parameter beta can solve this problem (hardly ever happened in our
experiments).


text:
---
layout: default
---

# 1994-08-11 - Re: Are Remailers Liable for What They Remail?

## Header Data

From: "L. Todd Masco"<EMAIL_ADDRESS>To<EMAIL_ADDRESS>Message Hash: a08ba3756583edc9b807d7cc574f4c588fbfcaf06a1676996394e7a2a5c44679

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1994-08-11 17:26:28 UTC

Raw Date: Thu, 11 Aug 94 10:26:28 PDT

## Raw message

```
{% raw  %}From: "L. Todd Masco"<EMAIL_ADDRESS>Date: Thu, 11 Aug 94 10:26:28 PDT
To<EMAIL_ADDRESS>Subject: Re: Are Remailers Liable for What They Remail?
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

According to a discussion I had with Dave Lawrence (postmaster at UUNET, as
 well as moderator of news.admin.newgroups), UUNET is registered with the FCC
 as an "Enhanced Service Provider," which, according to Dave, amounts to
 similar protection as "Common Carrier."  ("Common Carrier" seems to not
 be appropriate yet, since Congress is so behind the tech curve)
--
L. Todd Masco  |  Bibliobytes books on computer, on any UNIX host with e-mail
<EMAIL_ADDRESS>| "Information wants to be free, but authors want to be paid."

{% endraw %}
```

## Thread

+ Return to [August 1994](/archive/1994/08)

+ Return to "["L. Todd Masco" <cactus@bb.com>](/authors/l_todd_masco_cactus_at_bb_com_)"

+ 1994-08-11 (Thu, 11 Aug 94 10:26:28 PDT) - Re: Are Remailers Liable for What They Remail? - _"L. Todd Masco"<EMAIL_ADDRESS>


text:
# ignore-node_modules

> Ignores node_modules directories from macOS Spotlight search

I got tired of Spotlight draining battery and CPU. It seems `node_modules` were
partly to blame.

This script signals Spotlight to not index `node_modules` directories.

It works by adding an empty file named `.metadata_never_index` in the top-most
`node_modules` directory found while searching.

## Usage

Stop indexing all `node_modules` directories in your current directory
(recursively):

```bash
./ignore-node_modules
```

Stop indexing all `node_modules` directories found within another directory
(recursively):

```bash
./ignore-node_modules /path/to/folder
```

## Install

You can install using [Homebrew](https://brew.sh/) or manually build from
source:

### Install with Homebrew

Running this in your terminal adds [my
tap](https://github.com/blakek/homebrew-blakek) and installs the package:

```bash
brew tap blakek/blakek && brew install blakek/blakek/ignore-node_modules
```

### Build from Source

1. Either [clone this
   repo](https://help.github.com/articles/cloning-a-repository/) or [download
   the zip
   file](https://github.com/blakek/ignore-node_modules/archive/master.zip)
2. Add `ignore-node_modules` to your \$PATH (e.g. `/usr/local/bin`)
3. Make sure file permissions allow execution (e.g. `chmod +x ignore-node_modules`). This shouldn't be necessary when cloning, but is
   likely when downloading from a browser.

## License

MIT


text:
# Migration from VitePress 0.x

If you're coming from VitePress 0.x version, there're several breaking changes due to new features and enhancement. Please follow this guide to see how to migrate your app over to the latest VitePress.

## App Config

- The internationalization feature is not yet implemented.

## Theme Config

- `sidebar` option has changed its structure.
  - `children` key is now named `items`.
  - Top level item may not contain `link` at the moment. We're planning to bring it back.
- `repo`, `repoLabel`, `docsDir`, `docsBranch`, `editLinks`, `editLinkText` are removed in favor of more flexible api.
  - For adding GitHub link with icon to the nav, use [Social Links](../reference/default-theme-nav#navigation-links) feature.
  - For adding "Edit this page" feature, use [Edit Link](../reference/default-theme-edit-link) feature.
- `lastUpdated` option is now split into `config.lastUpdated` and `themeConfig.lastUpdatedText`.
- `carbonAds.carbon` is changed to `carbonAds.code`.

## Frontmatter Config

- `home: true` option has changed to `layout: home`. Also, many Homepage related settings have been modified to provide additional features. See [Home Page guide](../reference/default-theme-home-page) for details.
- `footer` option is moved to [`themeConfig.footer`](../reference/default-theme-config#footer).

repository: vuejs/vitepress

gha_language: TypeScript

repo_name: vuejs/vitepress


text:
# Simple AJV Errors

[![NPM](https://img.shields.io/npm/v/simple-ajv-errors?label=npm%20install&color=red)](https://www.npmjs.com/package/simple-ajv-errors)
[![SIZE](https://img.shields.io/bundlephobia/min/simple-ajv-errors?label=size&color=blue)](https://www.npmjs.com/package/simple-ajv-errors)
[![SPONSOR](https://img.shields.io/badge/Github-sponsor-blue
)](https://github.com/sponsors/ghmcadams)

A function that accepts an array of errors that were returned from `ajv.validate()`, and returns an array of simplified error messages along with some of the information from the original ajv error.

## Examples

### Example 1

Schema:
```js
// An array of:
//   enum ("tab" or "first")
//   integer
//   object
[
    "tab" | "first" | integer | {
        //...
    }
]
```

Data:
```js
["space", 2]
```

ajv errors:
```
/0 must be equal to one of the allowed values
/0 must be integer
/0 must be object
/0 must match exactly one schema in oneOf
```

Simple AJV Errors:
```
data[0] must be one of the following: 'tab', 'first' or integer or object
```

### Example 2

Schema:
```js
{
  //...
  "maxDepth": integer (x ≥ 1) | "∞",
}
```

Data:
```js
{ maxDepth: true }
```

ajv errors:
```
/maxDepth must be integer
/maxDepth must be string
/maxDepth must be equal to one of the allowed values
/maxDepth must match exactly one schema in oneOf
```

Simple AJV Errors:
```
data.maxDepth must be integer or '∞'
```

### Example 3

Schema:
```js
{
  //...
  "supported": "composition" | "nesting" | {
    (required) "some": "composition" | "nesting"
  } | {
    (required) "every": "composition" | "nesting"
  },
}
```

Data:
```js
{
    //...
    supported: {
    all: 'nesting',
    },
}
```

ajv errors:
```
/supported must be string
/supported must be equal to one of the allowed values
/supported must have required property 'some'
/supported must have required property 'every'
/supported must match exactly one schema in oneOf
```

Simple AJV Errors:
```
data.supported must include property 'some' or include property 'every'
```

### Example 4

Schema:
```js
// An array of unique objects, each requiring properties:
//    either `object` or `property`
//    `message`
[
  {
    (required) "object": string,
    "property": string,
    (required) "message": string
  } | {
    "object": string,
    (required) "property": string,
    (required) "message": string
  }
  # unique
]
```

Data:
```js
[
  {
    property: 'callee',
    message: 'arguments.callee is deprecated',
  },
  {
    message: 'Please use Number.isFinite instead',
  },
  {
    object: 'window',
    property: 'isFinite',
    message: 'Please use Number.isFinite instead',
  },
  {
    object: 'window',
    property: 'isFinite',
    message: 'Please use Number.isFinite instead',
  }
]
```

ajv errors:
```
/1 must have required property 'object'
/1 must have required property 'property'
/1 must match a schema in anyOf
must NOT have duplicate items (items ## 2 and 3 are identical)
```

Simple AJV Errors:
```
data must have all unique items (items 2 and 3 are identical)
data[1] must include property 'object' or include property 'property'
```

## Installation

```shell
npm install simple-ajv-errors
```

## Usage

### API

```ts
getSimpleErrors(errors: ErrorObject[], options?: Options): SimpleError[];
```

### Types

```ts
interface Options {
    // Used in error messages as part of a reference path
    //  EX: `data.someProp[0].prop must not be empty`
    rootVar: string; // default: 'data'
}

interface SimpleError {
    // Simplified error message with clear wording
    //  EX: `data[0] must be string or integer`
    message: string;

    // Copied directly from ajv errors (when available)
    instancePath: string;
    schemaPath: string;
    schema?: any;
    parentSchema?: object;
    data?: any;
}
```

### Implementation

```js
import Ajv from 'ajv';
import { getSimpleErrors } from 'simple-ajv-errors';

const ajv = new Ajv({
    // ...
    allErrors: true,
    verbose: true,
});

const schema = { /* ... */ };
const data = { /* ... */ };

const valid = ajv.validate(schema, data);
if (valid === false) {
    const simpleErrors = getSimpleErrors(ajv.errors, {
        rootVar: 'root'
    });
}
```

## ajv options

Simple AJV Errors supports any/all options passed to `ajv.validate()`.  There are two configuration options, however, that would improve your experience.  Those are `allErrors` and `verbose`.

### allErrors

- Default: `false`
- Suggestion:  `true`

The default value of `allErrors` in ajv is `false`, which directs it to return after the first error found.  Setting this value to `true` directs it to check all rules and collect all errors.  Many might feel this option makes ajv errors too verbose and opt for less information in order to improve their experience, by setting this value to `false`.

Simple AJV Errors solves this by determining which errors are the most applicable and filtering out the noise.

[Read more](https://ajv.js.org/options.html#allerrors) about this option in the ajv documentation.

### verbose

- Default: `false`
- Suggestion:  `true`

Setting this value to `true` directs ajv to include the relevant part of the schema and data with each error.  This gives Simple AJV Errors information to better determine the most applicable errors.  Setting this to `false` will result in less applicable errors, but will still improve the wording.

[Read more](https://ajv.js.org/options.html#verbose) about this option in the ajv documentation.

repository: ghmcadams/vscode-lintlens

repo_name: ghmcadams/vscode-lintlens


text:
```@meta
CurrentModule = Clapeyron
```

## Index

```@index
Pages = ["activity.md"]
```

# Activity Models

There are two alternatives on the definition of an activity model:
- Defining an excess gibbs energy function
- Defining an activity coefficient function

those two can be converted between one form to another via:

``\gamma_{i} = \frac{\partial{G^E}}{\partial{n_i}}``

``\ln{\gamma_{i}} = \frac{1}{RT}\frac{\partial{G^E}}{\partial{n_i}}``

When defining one form, the other is derived automatically.

Those functions can also be derived from any arbitrary equation of state:

``\frac{\partial{G^E}}{\partial{n_i}}= \mu_i - \mu^{0}_i``

Where ``\mu_i`` and ``\mu^{0}_i `` are the mixture and pure chemical potentials of component `i`. in this case, those potentials are dependent of the pressure. whereas activity models are usually only temperature and composition dependent.

```@docs
Clapeyron.Wilson
Clapeyron.NRTL
Clapeyron.aspenNRTL
Clapeyron.UNIQUAC
Clapeyron.ogUNIFAC
Clapeyron.UNIFAC
Clapeyron.PSRKUNIFAC
Clapeyron.VTPRUNIFAC
Clapeyron.UNIFACFV
Clapeyron.UNIFACFVPoly
```

gha_language: Julia


text:
# fastai applications - quick start

fastai's applications all use the same basic steps and code:

- Create appropriate [`DataLoaders`](/data.core.html#DataLoaders)
- Create a [`Learner`](/learner.html#Learner)
- Call a *fit* method
- Make predictions or view results.

In this quick start, we'll show these steps for a wide range of difference applications and datasets. As you'll see, the code in each case is extremely similar, despite the very different models and data being used.

## Computer vision classification

The code below does the following things:

1. A dataset called the [Oxford-IIIT Pet Dataset](http://www.robots.ox.ac.uk/~vgg/data/pets/) that contains 7,349 images of cats and dogs from 37 different breeds will be downloaded from the fast.ai datasets collection to the GPU server you are using, and will then be extracted.
2. A *pretrained model* that has already been trained on 1.3 million images, using a competition-winning model will be downloaded from the internet.
3. The pretrained model will be *fine-tuned* using the latest advances in transfer learning, to create a model that is specially customized for recognizing dogs and cats.

The first two steps only need to be run once. If you run it again, it will use the dataset and model that have already been downloaded, rather than downloading them again.

```python
path = untar_data(URLs.PETS)/'images'

def is_cat(x): return x[0].isupper()
dls = ImageDataLoaders.from_name_func(
    path, get_image_files(path), valid_pct=0.2, seed=42,
    label_func=is_cat, item_tfms=Resize(224))

learn = cnn_learner(dls, resnet34, metrics=error_rate)
learn.fine_tune(1)
```

      epoch
      train_loss
      valid_loss
      error_rate
      time

      0
      0.173790
      0.018827
      0.005413
      00:12

      epoch
      train_loss
      valid_loss
      error_rate
      time

      0
      0.064295
      0.013404
      0.005413
      00:14

You can do inference with your model with the `predict` method:

```python
img = PILImage.create('images/cat.jpg')
img
```

![png](output_6_0.png)

```python
is_cat,_,probs = learn.predict(img)
print(f"Is this a cat?: {is_cat}.")
print(f"Probability it's a cat: {probs[1].item():.6f}")
```

    Is this a cat?: True.
    Probability it's a cat: 0.999722

### Computer vision segmentation

Here is how we can train a segmentation model with fastai, using a subset of the [*Camvid* dataset](http://www0.cs.ucl.ac.uk/staff/G.Brostow/papers/Brostow_2009-PRL.pdf):

```python
path = untar_data(URLs.CAMVID_TINY)
dls = SegmentationDataLoaders.from_label_func(
    path, bs=8, fnames = get_image_files(path/"images"),
    label_func = lambda o: path/'labels'/f'{o.stem}_P{o.suffix}',
    codes = np.loadtxt(path/'codes.txt', dtype=str)
)

learn = unet_learner(dls, resnet34)
learn.fine_tune(8)
```

      epoch
      train_loss
      valid_loss
      time

      0
      2.882460
      2.096923
      00:03

      epoch
      train_loss
      valid_loss
      time

      0
      1.602270
      1.543582
      00:02

      1
      1.417732
      1.225782
      00:02

      2
      1.307454
      1.071090
      00:02

      3
      1.170338
      0.884501
      00:02

      4
      1.047036
      0.799820
      00:02

      5
      0.947965
      0.754801
      00:02

      6
      0.868178
      0.728161
      00:02

      7
      0.804939
      0.720942
      00:02

We can visualize how well it achieved its task, by asking the model to color-code each pixel of an image.

```python
learn.show_results(max_n=6, figsize=(7,8))
```

![png](output_12_1.png)

## Natural language processing

Here is all of the code necessary to train a model that can classify the sentiment of a movie review better than anything that existed in the world just five years ago:

```python
dls = TextDataLoaders.from_folder(untar_data(URLs.IMDB), valid='test')
learn = text_classifier_learner(dls, AWD_LSTM, drop_mult=0.5, metrics=accuracy)
learn.fine_tune(2, 1e-2)
```

      epoch
      train_loss
      valid_loss
      accuracy
      time

      0
      0.594912
      0.407416
      0.823640
      01:35

      epoch
      train_loss
      valid_loss
      accuracy
      time

      0
      0.268259
      0.316242
      0.876000
      03:03

      1
      0.184861
      0.246242
      0.898080
      03:10

      2
      0.136392
      0.220086
      0.918200
      03:16

      3
      0.106423
      0.191092
      0.931360
      03:15

Predictions are done with `predict`, as for computer vision:

```python
learn.predict("I really liked that movie!")
```

    ('pos', tensor(1), tensor([0.0041, 0.9959]))

## Tabular

Building models from plain *tabular* data is done using the same basic steps as the previous models. Here is the code necessary to train a model that will predict whether a person is a high-income earner, based on their socioeconomic background:

```python
path = untar_data(URLs.ADULT_SAMPLE)

dls = TabularDataLoaders.from_csv(path/'adult.csv', path=path, y_names="salary",
    cat_names = ['workclass', 'education', 'marital-status', 'occupation',
                 'relationship', 'race'],
    cont_names = ['age', 'fnlwgt', 'education-num'],
    procs = [Categorify, FillMissing, Normalize])

learn = tabular_learner(dls, metrics=accuracy)
learn.fit_one_cycle(2)
```

      epoch
      train_loss
      valid_loss
      accuracy
      time

      0
      0.372298
      0.359698
      0.829392
      00:06

      1
      0.357530
      0.349440
      0.837377
      00:06

## Recommendation systems

Recommendation systems are very important, particularly in e-commerce. Companies like Amazon and Netflix try hard to recommend products or movies that users might like. Here's how to train a model that will predict movies people might like, based on their previous viewing habits, using the [MovieLens dataset](https://doi.org/10.1145/2827872):

```python
path = untar_data(URLs.ML_SAMPLE)
dls = CollabDataLoaders.from_csv(path/'ratings.csv')
learn = collab_learner(dls, y_range=(0.5,5.5))
learn.fine_tune(6)
```

      epoch
      train_loss
      valid_loss
      time

      0
      1.497551
      1.435720
      00:00

      epoch
      train_loss
      valid_loss
      time

      0
      1.332337
      1.351769
      00:00

      1
      1.180177
      1.046801
      00:00

      2
      0.913091
      0.799319
      00:00

      3
      0.749806
      0.731218
      00:00

      4
      0.686577
      0.715372
      00:00

      5
      0.665683
      0.713309
      00:00

We can use the same `show_results` call we saw earlier to view a few examples of user and movie IDs, actual ratings, and predictions:

```python
learn.show_results()
```

      userId
      movieId
      rating
      rating_pred

      0
      5.0
      3.0
      2.0
      3.985477

      1
      1.0
      62.0
      4.0
      3.629225

      2
      91.0
      81.0
      1.0
      3.476280

      3
      48.0
      26.0
      2.0
      4.043919

      4
      75.0
      54.0
      3.0
      4.023057

      5
      42.0
      22.0
      3.0
      3.509050

      6
      40.0
      59.0
      4.0
      3.686552

      7
      63.0
      77.0
      3.0
      2.862713

      8
      32.0
      61.0
      4.0
      4.356578

repository: iyaja/fastai

repo_name: iyaja/fastai


text:
# About
Simplified JNA is a library that allows for the quick creation of mouse and keyboard hooks in a multithreaded environment. Additionally it provides easy to use methods for sending inputs to window, mouse, and keyboard objects.

# Usage

You can import this with maven via JitPack:

Add the repo to your pom:
```
	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>
```
And add the dependency:
```
	<dependency>
	    <groupId>com.github.Col-E</groupId>
	    <artifactId>Simplified-JNA</artifactId>
	    <version>1.0</version>
	</dependency>
```

#### Examples

In these samples, returing `false` allows the event to be parsed by the system. Chaning the return value to `true` will cancel the event.

> Keyboard Hook
```java
KeyEventReceiver keyHook = new KeyEventReceiver() {
    @Override
    public boolean onKeyUpdate(SystemState sysState, PressState pressState, int time, int vkCode) {
        System.out.println("Is pressed:" + (pressState == PressState.DOWN));
        System.out.println("Alt down:" + (sysState == SystemState.SYSTEM));
        System.out.println("Timestamp:" + time);
        System.out.println("KeyCode:" + vkCode);
        return false;
    }
};
KeyHook.hook(keyHook);
```
> Mouse Hook
```java
MouseEventReceiver mer = new MouseEventReceiver() {
    @Override
    public boolean  boolean onMousePress(MouseButtonType type, HWND hwnd, POINT info) {
        boolean isLeft = type == MouseButtonType.LEFT_DOWN;
        if (isLeft) {
            System.out.println("Left mouse button has been pressed!")
        }
        return false;
    }
    @Override public boolean onMouseRelease(MouseButtonType type, HWND hwnd, POINT info) { return false; }
    @Override public boolean onMouseScroll(boolean down, HWND hwnd, POINT info) { return false;  }
    @Override public boolean boolean onMouseMove(HWND hwnd, POINT info) { return false; }
};
MouseHook.hook(mer);
```

repository: Col-E/Simplified-JNA

gha_language: Java

repo_name: Col-E/Simplified-JNA


text:
## CONS OF RN
* Not great for high performance apps (physics-based games, etc.)
    * Due to the way the native code communicates with the JavaScript thread
* Requires a general knowledge of how React works
* Keeping app up-to-date with latest RN versions is tough


text:
jsonchan
========

[![GoDoc](https://godoc.org/github.com/trapped/jsonchan?status.svg)](https://godoc.org/github.com/trapped/jsonchan)

jsonchan streams JSON from a `chan interface{}` sink. It has no external dependencies.

Install with `go get -u github.com/trapped/jsonchan`.

## Usage

```go
c := make(chan interface{}, 0)
go func() {
	n := 0
	for n < 10 {
		c <- n
	}
	close(c)
}
jsonchan.Stream(os.Stdout, c)
```

repository: trapped/jsonchan

repo_name: trapped/jsonchan


text:
## Keypoint Detection + MCMC to Sim Variables

Idea in this one is to:

1) Train a network to spit out keypoints.
2) From the resulting images, infer the number, poses, + shapes of objects that
could have generated those output images.

My two applications:

1) Amazon prime packages, varying in # / shape / poses
2) Mugs or shoes, varying widely in shape

Spirals:
1) Use Faster or MaskRCNN's bbox detection and assume they're right. Spit out a heatmap
of keypoints as head operating over that bbox. Do MCMC assuming the bbox detection was good
(or totally erroneous), but don't try to associate points with other bboxes.
2) Instead directly estimate a keypoint heatmap on the original image + some
form of part association field, to capture uncertainty over the correspondence
to which object. Do MCMC that uses the PAF.


text:
# Ferrite - Session Type EDSL for Rust

## Build Instructions

The library code requires nightly version of Rust to be compiled.
You can use `rustup` to install Rust nightly as follows:

```bash
# Install rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

rustup default nightly
```

After that, the library can be build with `cargo` as follows:

```bash
cargo build
```

## Runnnig Demo

A number of demo executables are available in the [`src/bin`](src/bin) directory.
To run a particular demo, use `cargo run` with the name of the demo file.
For example:

```bash
cargo run --bin hello
cargo run --bin shared
```

## Code Organization

  - [`src/base`](src/base) - Core constructs for Ferrite
  - [`src/protocol`](src/protocol) - Type definitions for session types
  - [`src/context`](src/context) - Type definitions for linear context
  - [`src/session`](src/session) - Term constructors
  - [`src/session`](src/shared) - Shared session types
  - [`src/public.rs`](src/public.rs) - Public API exposed by Ferrite
  - [`src/bin`](src/bin) - Demo executables

repository: balzers/ferrite

repo_name: balzers/ferrite


text:
[![Build Status](https://travis-ci.org/blockchain-certificates/cert-store.svg?branch=master)](https://travis-ci.org/blockchain-certificates/cert-store)
[![PyPI version](https://badge.fury.io/py/cert-store.svg)](https://badge.fury.io/py/cert-store)

# cert-store

Blockchain certificate storage. This is used as a library in the cert-viewer project.

The certificate storage interface is [simplekv](https://pypi.python.org/pypi/simplekv/). The default configurations
use the FilesystemStore, which is highly recommended if you are getting started. This makes it easier to issue,
copy, and view your Blockchain Certificates.

## Configuration

The certificate storage location can be modified with the following configuration entries in your `conf.ini` file:

- `cert_store_type`: which key-value backing store to use. Current supported values are:
  - `simplekv_fs`: (Default) file system store
  - `simplekv_gridfs`: (Advanced) gridfs store
- `cert_store_path`: file system path if using `simplekv_fs`
- `mongodb_uri`: mongo db uri (including db name) if using `simplekv_gridfs`

Example File System config:

```
cert_store_type = simplekv_fs
cert_store_path = ./cert_data
```

Example GridFS config (Advanced):

```
cert_store_type = simplekv_gridfs
mongodb_uri = mongodb://localhost:27017/test
```

## Legacy options

**Warning**

Most users should ignore these instructions, which are only included as a temporary bridge for earlier users of blockcerts. We recommend migrating to the latest version of Blockcerts.

### V1 Aware Certificate Store

Warning: avoid this option unless you are sure you need it. Earlier versions of the Blockchain Certificate
required a separate storage of the certificate transaction id. That was managed in a `certificates` mongo db table.

The `--v1_aware` flag allows support for these certificates.

## Unit tests

This project uses tox to validate against several python environments.

1. Ensure you have an python environment. [Recommendations](https://github.com/blockchain-certificates/cert-issuer/blob/master/docs/virtualenv.md)

2. Run tests
    ```
    ./run_tests.sh
    ```

## Contact

Contact [info<EMAIL_ADDRESS>with questions

repository: AYCHAIN/CertStore

repo_name: AYCHAIN/CertStore


text:
You already learned how to adjust your url to your site structure using `url:` modifier. If you want to convert link url with some riles globally, this is a chance to do it. You can set a callback to convert URL as you like.

Think about appending URL parameter "lang=en" to all URLs. You should do is only to set a callback to `url_modifier` of Pinoco. Your callback gets formatted URL, then you can change it to any form.

### _app/hooks/_enter.php
```php
<?php
function append_lang_param($url) {
    return $url . ((strpos($url, "?") === FALSE) ? "?" : "&") . "lang=en";
}
$this->url_modifier = "append_lang_param";
```

When "url:" modifier is like as:

```html
<p>Globally modified url: ${url:/foo/bar}.</p>
```

So, it would be:

```html
<p>Globally modified url: /16.urlmod/foo/bar?lang=en.</p>
```

For example, for Cookie-less browsers, it's useful to place session id into URL link to self site. (As you know, take care enough for security.)

Also you can change what should be done by checking original URL.

repository: tanakahisateru/pinoco

gha_language: PHP

repo_name: tanakahisateru/pinoco


text:
[![Build Status](https://drone.io/github.com/mathuin/terroir/status.png)](https://drone.io/github.com/mathuin/terroir/latest)

# Welcome to Terroir!

Terroir uses real data to generate Minecraft worlds which somewhat resemble actual places in the real world.

## Installation

**TODO:** Install Docker, and fetch the pre-built image.

## Requirements

Terroir requires a certain basic set of data in order to generate worlds.

* Raw mapping data
  * Elevation (1/3 arc-second is fine)
  * Landcover (NLCD 2011 is fine)
* Map parameters
  * Projection
  * Landcover translation table
* Local parameters
  * Latlong boundaries
  * Scaling values

**TODO:** Use whatever tools you need to use to retrieve your mapping data.  Example of National Map viewer goes here.

**TODO:** _Any_ example from another country would be very nice!

## Preparation

**TODO:** Run the batch file generator script against your settings.

## Execution

**TODO:** Run the pre-built Docker container with the following parameters.

**TODO:** The output is a ready to use Minecraft world!

## Future work

I am accepting pull requests for bugfixes and features!

I would like to see (and hope to add) additional support for the following:

* Non-US regions (specifically EU)
* Rivers
* Villages

That being said, it is highly unlikely that I will personally add the following features:

* Iconic buildings (bring your own Eiffel Tower!)
* Other planets or moons

I will still accept pull requests for those features, they just aren't interesting enough to me for me to add them!

# License

This software is released under the [MIT license](http://opensource.org/licenses/MIT) as documented [here](../blob/master/LICENSE.md).

repository: mathuin/terroir

gha_language: Go

repo_name: mathuin/terroir


text:
---
date: Tue Sep 12 2017 08:10:05 GMT+1000 (AEST)
---

# drx

one issue I've noticed: because I'm overwriting `DrxComponent.children` from a PropRef to a function, it can no longer be used as a propref. So there's no way to say "use the original children of the parent for the value of this prop".

Is that even a thing you would want to do? Probably at times it's a valid use case. So at very least we need to give a helpful error message, at the moment it will just blow up.

Maybe the solution is to make _all_ prop refs functions (setters) that also have metadata attached.

repository: joshwnj/knowledge

repo_name: joshwnj/knowledge


text:
### [CVE-2022-45406](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-45406)
![](https://img.shields.io/static/v1?label=Product&message=Firefox%20ESR&color=blue)
![](https://img.shields.io/static/v1?label=Product&message=Firefox&color=blue)
![](https://img.shields.io/static/v1?label=Product&message=Thunderbird&color=blue)
![](https://img.shields.io/static/v1?label=Version&message=%3C%20102.5%20&color=brighgreen)
![](https://img.shields.io/static/v1?label=Version&message=%3C%20107%20&color=brighgreen)
![](https://img.shields.io/static/v1?label=Vulnerability&message=Use-after-free%20of%20a%20JavaScript%20Realm&color=brighgreen)

### Description

If an out-of-memory condition occurred when creating a JavaScript global, a JavaScript realm may be deleted while references to it lived on in a BaseShape. This could lead to a use-after-free causing a potentially exploitable crash. This vulnerability affects Firefox ESR < 102.5, Thunderbird < 102.5, and Firefox < 107.

### POC

#### Reference
No PoCs from references.

#### Github
- https://github.com/ARPSyndicate/cvemon
- https://github.com/googleprojectzero/fuzzilli

repository: trickest/cve

gha_language: HTML

repo_name: trickest/cve


text:
**Die, Yenu, Die!** is a 1-D [roguelike-like](http://en.wikipedia.org/wiki/Roguelike) game.

Building
=========

You will need [TypeScript](http://www.typescriptlang.org/) installed. You can obtain it with [node.js](http://nodejs.org/) by running `npm install -g typescript`.

Run `./build.sh` or `build.bat`	depending on your platform.

Open `index.html` in your Web browser.

 If you are a new contributor, please add your name (or nickname) and GitHub URL to `AUTHORS.txt`.

If you're looking for tasks to do, check the issue tracker.

License
========

This project is licensed under the terms of the zlib license, the full text of which can be found in `LICENSE.txt`. By contributing to this project, you agree to license your contributions under the terms of the zlib license.

license: Zlib

repository: darkf/die-yenu-die

repo_name: darkf/die-yenu-die


text:
# cosmos db examples
cosmos-db-examples is a toolset of various cosmos db activities, this repository includes examples of Creating, Deleting and managing containers. Also there are examples of data copying between containers and throughput configuration in databases within a cosmos db account.

Create a random Database name
```
var tempDatabaseId = Guid.NewGuid().ToString();
```
Create a temporary database with random generated GUID and manual Throuput provisioned for shared containers
This temp database will be in the same account as the one we want to optimize and we use it as a temporary database
in order to pull the data from the original one

```
var tempDatabase = await _cosmosDbService.
CreateDatabaseAsync(tempDatabaseId, ThroughputProperties.CreateManualThroughput(_appSettings.TempThroughput));
```

Fetch all collections from the original database that needs optimization , Id and partitionKey
```
var sourceContainers = await _cosmosDbService.ListContainersAsync(_appSettings.DbForOptimization.Name);
```

Foreach collection fetched create the collection in the temp database with the exact same id and partition key path
```
foreach (var sourceContainer in sourceContainers)
{
    await _cosmosDbService.CreateContainerAsync(tempDatabase, sourceContainer.Id, sourceContainer.PartitionKeyPath);
}
```

copy data from source database to the temp database
```
foreach (var sourceContainer in sourceContainers)
{
   await _cosmosBulkExecutor.CopyDocumentsFromSourceToDestinationContainers(_appSettings.DbForOptimization.Name, tempDatabase.Id, sourceContainer.Id, sourceContainer.Id);
}
```

now that all data is moved to the temp database we delete the original one in order to re-create it
with the desired Throuput configuration
```
await _cosmosDbService.DeleteDatabaseAsync(_appSettings.DbForOptimization.Name);
```

recreate the Microservices database with the correct configuration
we create it with high manual throuput to achieve the bulk copy that requires a lot of RUs
```
var optimizedDatabase = await _cosmosDbService.CreateDatabaseAsync(_appSettings.DbForOptimization.Name, ThroughputProperties.CreateManualThroughput(_appSettings.TempThroughput));
```

Fetch all collections from the temp database, Id and partitionKey
```
var tempContainers = await _cosmosDbService.ListContainersAsync(tempDatabaseId);
```

Foreach collection fetched re-create the collection in the optimized database with the exact same id and partition key path
```
foreach (var tempContainer in tempContainers)
{
    await _cosmosDbService.CreateContainerAsync(optimizedDatabase, tempContainer.Id, tempContainer.PartitionKeyPath);
}
```

copy data from temp database to the optimized database
```
foreach (var tempContainer in tempContainers)
{
   await _cosmosBulkExecutor.CopyDocumentsFromSourceToDestinationContainers(tempDatabaseId, optimizedDatabase.Id, tempContainer.Id, tempContainer.Id);
}
```

now drop the temp database
```
await _cosmosDbService.DeleteDatabaseAsync(tempDatabaseId);
```

finally configure the optimized database desired Throughput (20 containers * 100 = 2000RUs)
```
var throughput = tempContainers.Count * _appSettings.DbForOptimization.ThroughputPerContainer;
```

500RUs is the minimum throughput for more than 1 shared Throuput container
```
if (throughput < 500)
   throughput = 500;
await optimizedDatabase.ReplaceThroughputAsync(ThroughputProperties.CreateManualThroughput(throughput));
```

don't forget to check the database in the portal for manual validation
```
_logger.LogInformation($"don't forget to check the database {optimizedDatabase.Id} in the portal for manual validation");
```

repository: sdesyllas/cosmos-db-examples

repo_name: sdesyllas/cosmos-db-examples


text:
# Module 11: Implementing Streaming Solutions with Kafka and HBase

## Demo 1: Creating, configuring, and mirroring a Kafka cluster on HDInsight

### Scenario

In this demonstration, you will see how to:
-	Create an HDInsight cluster that includes Kafka
-	Configure a Kafka cluster using Ambari
-	Use MirrorMaker to mirror a cluster
-	Monitor mirroring activity

>**Note:** This demonstration builds an HDInsight Storm cluster (which includes Kafka), and then uses Ambari to reconfigure the Kafka cluster. If you need to add Kafka to a basic Hadoop or Spark cluster, you can download and install it manually—performing configuration without using Ambari is a nontrivial task.
>
>Additionally, Microsoft will publish a Kafka cluster template for HDInsight but, at the time of writing, this template was not publicly available.

### Create an HDInsight cluster that includes Kafka
1.	Ensure that the **MT17B-WS2016-NAT**, and **20775A-LON-DEV** virtual machines are running, and then log on to **20775A-LON-DEV** as **Admin** with the password **Pa55w.rd**.
2.	On the **20775A-LON-DEV** virtual machine, start Internet Explorer®.
3.	In the address bar, type **http://portal.azure.com** and sign in using the Microsoft account that is associated with your Azure Learning Pass subscription.
4.	Click **+ Create a resource**, in the search box, type **virtual network**, and then press Enter.
5.	In the **Results** list, click **Virtual network**.
6.	In the **Virtual network** blade, click **Create**.
7.	In the **Create virtual network** blade, specify the following values, and then click **Create**.
    -	**Name**: vnet\<your initials\>\<ddmmyyyy\> where \<ddmmyyyy\> is the current date (make sure you include the vnet prefix).
    -	**Address space**: Accept the default value (it should be a /24 address space, allowing 256 addresses).
    -	**Subnet name**: Accept the default value.
    -	**Subnet address range**: Reduce size of the address space for the default subnet to /25. This is important, as it allows space for a VPN gateway subnet to be created later.
    -	**Subscription**: Your subscription.
    -	**Resource group (Create new)**: with name rg<your initials><ddmmyyyy>.
    -	**Location**: Accept the default value.
8.	Click **+ Create a resource**, in the search box, type **HDInsight**, and then press Enter.
9.	In the **Results** list, click **HDInsight**.
10.	In the **HDInsight** blade, click **Create**.
11.	In the **Basics** blade, enter the following values, and then click **Next**:
    -	**Cluster name**: cluster<your initials><ddmmyyyy> where <ddmmyyyy> is the current date.
    -	**Subscription**: Your subscription.
    -	**Cluster type**: Enter the following values, and then click Select:
        -	**Cluster type**: Storm
        -	**Operating system**: Linux
        -	**Version**: Storm 1.1.0 (HDI 3.6)
        -	**Cluster tier**: Standard
    -	**Cluster login name**: admin.
    -	**Cluster login password**: Pa55w.rdPa55w.rd.
    -	**Secure Shell (SSH) username**: sshuser.
    -	**Use same password as cluster login**: selected.
    -	**Resource group (Use existing)**: Specify the resource group you created for the virtual network.
    -	**Location**: Set this to the same location as the location for the virtual network.
12.	In the **Storage Account Settings** blade, under **Select a Storage account**, click **Create new**.
13.	In the **Create a new Storage account** box, enter **sa\<your initials\>\<ddmmyyyy\>**, and then click **Next**.
14.	In the **Cluster summary** blade, in the **Cluster Size** section, click **Edit**.
15.	In the **Cluster size** blade, set the **Number of Supervisor nodes** to **2**, and then click **Next**.
16.	In the **Advanced settings** blade, in the **Virtual network** drop-down list, select the virtual network you created earlier, and then click **Next**.
17.	In the **Cluster summary** blade, click **Create**.
18.	While the cluster is being built, repeat steps 8-17 above and create a second cluster named mirror\<your initials\>\<ddmmyyyy\> in the same resource group as the first cluster and the virtual network, and with a storage account of samirror\<your initials\>\<ddmmyyyy\>. Add the cluster to the virtual network.
19.	Wait for both clusters to be created before continuing.

### Configure a Kafka cluster using Ambari
1.	In the Azure Portal, click **Dashboard**.
2.	Click the tile for the first HDInsight cluster (**cluster\<your initials\>\<ddmmyyyy\>**).
3.	In the **cluster** blade, in the **Quick links** section, click **Cluster dashboard**.
4.	Click **HDInsight cluster dashboard**. This will cause the web browser to start.
5.	In the **Windows Security** message box, in the **User Name** field enter **admin**, in the **Password** field enter **Pa55w.rdPa55w.rd**, and then click **OK**. The Ambari dashboard should appear.
6.	In the left-hand pane, click **Kafka**. The dashboard for the Kafka cluster should appear. There should be two Kafka broker nodes (one for each Storm Supervisor node).
7.	Click **Configs**. The configuration for the Kafka cluster should be displayed. You can use this pane to change any of the configuration parameters for the Kafka cluster except the broker host machines. If you need to add or remove brokers, you must stop the Kafka service, delete it, and recreate it. Note that the brokers are listening on port 9092 (as specified by the **listeners** configuration parameter).
8.	Make a note of the name of the first broker host machine (it will be a long name, ending with internal.cloudapp.net). For the rest of this demo insert this value whenever you see **\<source-kafka-broker\>**.
9.	Click **Service Actions**. You can use this menu to stop, restart, and delete a service (don't change anything at the moment).
10.	In the left-hand pane, click **Actions**. You can reinstall a service using the **Add Service** option in this menu (don't change anything).
11.	Repeat steps 1 to 8 above for the mirror cluster and make a note of the host name of the first computer in the mirror Kafka cluster. For the rest of this demo insert this value whenever you see **\<mirror-kafka-broker\>**.

### Use MirrorMaker to mirror a cluster
1.	Return to the Azure Portal and click **Dashboard**.
2.	Click the tile for the first HDInsight cluster (cluster\<your initials\>\<ddmmyyyy\>).
3.	In the cluster blade, click **Secure Shell (SSH)**.
4.	In the **Secure Shell (SSH)** blade, copy the **Host name** to the clipboard.
5.	Start **PuTTY**.
6.	In the **PuTTY Configuration** window, in the **Host Name (or IP address)** box, paste the host name from the clipboard, and then click **Open**.
7.	In the **PuTTY Security Alert** message box, click **Yes**.
8.	In the PuTTY terminal window, log in as **sshuser** with the password **Pa55w.rdPa55w.rd**.
9.	The following commands can be copied from **E:\Demofiles\Mod11\KafkaCmds.txt**; run the following command to start a bash shell as the
    ```
    superuser:
    sudo bash
    ```
10.	Type the following command to move to the Kafka configuration directory:
    ```
    cd /usr/hdp/current/kafka-broker/config
    ```
11.	Run the following command to create a new file named **source-cluster.properties**:
    ```
    nano source-cluster.properties
    ```
12.	In the editor, add the following text. Replace **\<mirror-kafka-broker\>** with the host name of the first Kafka broker in the mirror cluster.
    ```
    bootstrap.servers=<mirror-kafka-broker>:9092
    ```
13.	Press Ctrl+O, press Enter to save the file, and then press Ctrl+X to close the editor.
14.	Run the following command to create a new file named **dest-cluster.properties**:
    ```
    nano dest-cluster.properties
    ```
15.	In the editor, add the following text. Replace **\<source-kafka-broker\>** with the host name of the first Kafka broker in the original cluster:
    ```
    bootstrap.servers=<source-kafka-broker>:9092
    group.id=mirror-group
    ```
16.	Press Ctrl+O, press Enter to save the file, and then press Ctrl+X to close the editor.
17.	Return to the web browser displaying Ambari for the original cluster.
18.	On the **Kafka Configs** page, make a note of the first ZooKeeper server listed in the **zookeeper.connect** property (it should reference port 2181).
19.	Return to the PuTTY terminal.
20.	Run the following command to move to the Kafka bin directory:
    ```
    cd /usr/hdp/current/kafka-broker/bin
    ```
21.	Run the following command to create a topic named topic1 on the Kafka cluster. Replace **\<zookeeper\>** with the name of the ZooKeeper server you noted earlier:
    ```
    ./kafka-topics.sh --zookeeper <zookeeper>:2181 --create --topic topic1 --partitions 1 –-replication-factor 1
    ```
22.	Run the following command to run MirrorMaker using the configuration files that you created earlier. Messages appearing on topic1 will be mirrored. Note that this command runs MirrorMaker in the background; MirrorMaker must remain running all the time you want to mirror the cluster:
    ```
    ./kafka-mirror-maker.sh --producer.config ../conf/source-cluster.properties --consumer.config ../conf/dest-cluster.properties --whitelist=topic1 &
    ```
23.	Return to the Azure Portal and click **Dashboard**.
24.	Click the tile for the mirror HDInsight cluster (mirror<your initials><ddmmyyyy>cluster).
25.	In the cluster blade, click **Secure Shell (SSH)**.
26.	In the **Secure Shell (SSH)** blade, copy the **Host name** to the clipboard.
27.	Start another instance of PuTTY.
28.	In the **PuTTY Configuration** window, in the **Host Name (or IP address)** box, paste the host name from the clipboard, and then click **Open**.
29.	In the **PuTTY Security Alert** message box, click **Yes**.
30.	In the PuTTY terminal window, log in as **sshuser** with the password **Pa55w.rdPa55w.rd**.
31.	Arrange the two PuTTY instances side by side, so that the second instance (the mirror) is on the right.
32.	Run the following command to start a bash shell as the superuser:
    ```
    sudo bash
    ```
33.	Run the following command to move to the Kafka bin directory:
    ```
    cd /usr/hdp/current/kafka-broker/bin
    ```
34.	Run the following command. Replace \<source-kafka-broker\> with the host name of the first Kafka broker in the mirror cluster. This command runs a test consumer application that listens for messages appearing on topic1 in the mirror cluster:
    ```
    ./kafka-console-consumer.sh --bootstrap-server <source-kafka-broker>:9092 --whitelist topic1 --from-beginning
    ```
35.	Switch to the PuTTY terminal window connected to the Kafka broker being mirrored. This is the first PuTTY window on the left.
36.	Run the following command (there is no prompt). Replace \<source-kafka-broker\> with the host name of the first Kafka broker in the cluster. This command runs a test producer application that connects to the Kafka broker:
    ```
    ./kafka-console-producer.sh --broker-list <source-kafka-broker>:9092 --topic topic1
    ```
37.	Run the following text (there is no prompt):
    ```
    Hello
    World
    Hello
    Kafka
    ```
38.	Verify that these messages appear in the Kafka consumer application running in the other PuTTY terminal window. If the system is configured correctly, the messages are being transmitted from the original Kafka cluster to the mirror cluster, and the consumer is reading them from the mirror cluster. This can take a few minutes to process, and some warning messages may appear, which can be ignored.

### Monitor mirroring activity
1.	Return to the web browser displaying the Ambari page for the source cluster.
2.	In the left-hand pane, click **Kafka**.
3.	On the **Summary** tab, in the **Metrics** pane, note the activity reported in the Broker Topics graph.
4.	Switch to the Ambari page for the mirror cluster, and click **Kafka**.
5.	On the **Summary** tab, in the **Metrics** pane, note the activity reported in the Broker Topics graph. This activity is caused by the mirroring of messages to this cluster.
6.	Close the two PuTTY windows.

>**Note:** At the end of this demonstration, delete the mirror cluster to save costs, as follows:
> 1.	Return to the Azure Portal, and click **Dashboard**.
> 2.	Click the tile for the mirror HDInsight cluster (mirror\<your initials\>\<ddmmyyyy\>).
> 3.	Click **Delete**.
> 4.	In the message box, click **Yes**.
>
> Leave the first cluster running.

## Demo 2: Configuring remote access to a Kafka cluster

### Scenario

This demonstration starts the process of configuring remote access to a Kafka cluster. This process takes around 45 minutes to complete.

### Preparation

Before you can perform the demonstration, you will need to run the **E:\Demofiles\Mod11\Setup.cmd** file as an Administrator.

### Configure remote access to a Kafka cluster – Part 1
1.	In the Azure Portal, click **+ Create a resource**, in the search box, type public, and then press Enter.
2.	In the **Results** list, click **Public IP address**, and click **Create**.
3.	In the **Create public IP address** blade, specify the following values, and then click Create:
    -	**Name**: pip\<your initials\>\<ddmmyyyy\> where \<ddmmyyyy\> is the current date (make sure you include the pip prefix).
    -	**DNS name label**: pip\<your initials\>\<ddmmyyyy\> where \<ddmmyyyy\> is the current date (this name must be regionally unique so, if necessary, append a letter or number).
    -	**Subscription**: Your subscription.
    -	**Resource group (Use existing)**: select the resource group you created for the virtual network.
    -	**Location**: Select your region.
4.	Click **Start**, type **powershell**, and then click **Windows PowerShell ISE**.
5.	In Windows PowerShell ISE, on the **File** menu, click **Open**.
6.	In the **Open** dialog box, navigate to **E:\Demofiles\Mod11**, click **createRootCert.ps1**, and then click **Open**.
7.	On the toolbar, click **Run**.
8.	On the **File** menu, click **Open**.
9.	In the **Open** dialog box, navigate to **E:\Demofiles\Mod11**, click **createClientCert.ps1**, and then click **Open**.
10.	On the toolbar, click **Run**.
11.	Click **Start**, type **certificates**, and then click **Manage user certificates**.
12.	In **Certificate Manager**, expand **Personal**, and then click **Certificates**.
13.	In the certificates list, right-click **P2SRootCert**, and click **Cut**.
14.	Expand **Trusted Root Certification Authorities**, click **Certificates**, right-click **Certificates**, and then click **Paste**.
15.	In the **Security Warning** dialog box, click **Yes**.
16.	In the certificates list, right-click **P2SRootCert**, point to **All Tasks**, and then click **Export**.
17.	In the **Certificate Export Wizard**, on the **Welcome to the Certificate Export Wizard** page, click **Next**.
18.	On the **Export Private Key** page, click **Next**.
19.	On the **Export File Format** page, click **Base-64 encoded X.509 (.CER)**, and then click **Next**.
20.	On the **File to Export** page, click **Browse**.
21.	In the **Save As** dialog box, navigate to **E:\Demofiles\Mod11**, in the **File name** box, type **P2SRootCert**, and then click **Save**.
22.	On the **File to Export** page, click **Next**.
23.	On the **Completing the Certificate Export Wizard** page, click **Finish**.
24.	In the **Certificate Export Wizard** dialog box, click **OK**.
25.	Close Certificate Manager.
26.	Click **Start**, type **notepad**, and then click **Notepad**.
27.	On the **File** menu, click **Open**.
28.	In the **Open** dialog box, navigate to **E:\Demofiles\Mod11**, select **All Files (*.*)**, click **P2SRootCert.cer**, and then click **Open**.
29.	In Notepad, delete the following line:
    ```
    -----BEGIN CERTIFICATE-----
    ```
30.	In Notepad, delete the following line:
    ```
    -----END CERTIFICATE-----
    ```
31.	On the **File** menu, click **Save As**.
32.	In the **Save As** dialog box, in the **File name** box, type **P2SRootCert-edited**, and then click **Save**.
33.	Close Notepad.
34.	Switch to **Windows PowerShell ISE**.
35.	On the **File** menu, click **Open**.
36.	In the **Open** dialog box, navigate to **E:\Demofiles\Mod11**, click **cleanCertificate.ps1**, and then click **Open**.
37.	On the toolbar, click Run.
38.	In the **Open** dialog box, navigate to **E:\Demofiles\Mod11**, click **P2SRootCert-edited.txt**, and then click **Open**.
39.	Click **Start**, type **notepad**, and then click **Notepad**.
40.	On the **File** menu, click **Open**.
41.	In the **Open** dialog box, navigate to **E:\Demofiles\Mod11**, then click **P2SRootCert-edited.txt**, and then click **Open**.
42.	In Notepad, verify that the certificate data is now one single text string; keep Notepad open.
43.	In the Azure Portal, click **+ Create a resource**, in the search box, type **gateway**, and then press Enter.
44.	In the **Results** list, click **Virtual network gateway**, and click **Create**.
45.	In the **Create virtual network gateway** blade, specify the following value, and then click **Choose a virtual network**:
    -	**Name**: gwy\<your initials\>\<ddmmyyyy\> where \<ddmmyyyy\> is the current date (make sure you include the gwy prefix).
    -	**SKU**: VpnGw1.
46.	Click **Choose a virtual network**.
47.	On the **Choose virtual network** blade, select your virtual network.
48.	Click **Choose a public IP address**.
49.	On the **Choose public IP address** blade, select your public IP address.
50.	On the **Create virtual network gateway** blade, specify the following values, and then click **Create**:
    -	**Location**: Select your region.
    -	Leave all other settings at their defaults.

>**Note:** The gateway deployment may take up to 45 minutes to complete; do not start the next part of the demo until the gateway is ready.

>**Note:** Explain that, in order to access Kafka nodes directly, you need to use a Point-to-Site VPN, and this requires deployment of the Azure Virtual network gateway. The gateway can take up to 45 minutes to deploy, so the demonstration has been split into two parts. Explain to students that you are initiating gateway deployment now, and will complete this process in the second part of the demo at the end of this lesson.

## Demo 3: Visualizing data with Kafka clusters and Power BI

### Scenario

Having connected to a Kafka cluster, this second demonstration shows an end-to-end example of producing, processing, and visualizing events using a Kafka cluster and Power BI.

In this demonstration, you will see how to:
-	Complete the process of configuring remote access to a Kafka cluster.
-	Send event data to a Kafka cluster.
-	Perform stream processing.
-	Visualize event data.

### Preparation

You cannot use outlook.com credentials with Power BI; you need an “enterprise” email address. If you do not have a Power BI login, go to **https://Power BI.microsoft.com/en-us/documentation/Power BI-admin-signing-up-for-power-bi-with-a-new-office-365-trial**, and then follow the steps to create an account. This option gives you a sign-in of the form<EMAIL_ADDRESS>
### Configure remote access to a Kafka cluster – Part 2
1.	In the Azure Portal, click **All resources**, and check that the Virtual network gateway has been deployed; if the deployment has not completed, wait before proceeding.
2.	In the Azure Portal, in the **All resources** list, click your Virtual network gateway.
3.	On the **Virtual network gateway** blade, under **SETTINGS**, click **Point-to-site configuration**.
4.	On the **Point-to-site configuration** blade, in the **Address pool** box, type **<IP_ADDRESS>/24**.
5.	Under **Root certificates**, in the **NAME** box, type **P2SRootCert**.
6.	Switch to Notepad.
7.	On the **Edit** menu, click **Select All**.
8.	On the **Edit** menu, click **Copy**.
9.	Switch to Internet Explorer.
10.	In the Azure Portal, on the **Point-to-site configuration** blade, under **Root certificates**, right-click in the **PUBLIC CERTIFICATE DATA** box, and then click **Paste**.
11.	On the **Point-to-site configuration** blade, click **Save**.
12.	When the update to the Virtual network gateway is complete, click **Download VPN client**.
13.	On the **Download VPN client** blade, ensure that **x64** is selected, and then click **Download**.
14.	In the message box, click **Run**.
15.	If the **Windows protected your PC** dialog box appears, click **More info**, and then click **Run anyway**.
16.	In the **User Account Control** dialog box, click **Yes**.
17.	In the **vnet…** dialog box, click **Yes**.
18.	On the taskbar, click **Internet access**, and then click your VPN connection.
19.	On the **Settings** page, click your VPN connection, and then click **Connect**.
20.	In the **VPN** dialog box, click **Connect**.
21.	In the **Connection Manager** dialog box, select the **Do not show this message again for this Connection** check box, and then click **Continue**.
22.	On the **Settings** page, verify that the VPN status is now showing as **Connected**.

### Configure Kafka for IP advertising
1.	In the Azure Portal, click **All resources**, and then click the HDInsight cluster.
2.	On the cluster overview blade, click **Dashboard**.
3.	If the **Windows Security** dialog box appears, enter the following credentials, and then click **OK**:
    -	**User name**: admin
    -	**Password**: Pa55w.rdPa55w.rd
4.	In the Ambari console, in the left menu, click **Kafka**, and then click the **Configs** tab.
5.	In the **Filter** box, type **kafka-env**.
6.	Add the following text to the bottom of the **kafka-env-template**; this can be copied from **E:\Demofiles\Mod11\KafkaIPAdvertising.txt**:
    ```
    # Configure Kafka to advertise IP addresses instead of FQDN
    IP_ADDRESS=$(hostname -i)
    echo advertised.listeners=$IP_ADDRESS
    sed -i.bak -e '/advertised/{/advertised@/!d;}' /usr/hdp/current/kafka-broker/conf/server.properties
    echo "advertised.listeners=PLAINTEXT://$IP_ADDRESS:9092" >> /usr/hdp/current/kafka-broker/conf/server.properties
    ```
7.	Click **Save**.
8.	In the **Save Configuration** dialog box, in the Notes box, type **Advertise Kafka IP**, and then click **Save**.
9.	In the **Save Configuration Changes** dialog box, click **OK**.
10.	In the **Filter** box, type **listeners**.
11.	Change the value in the **listeners** field to the following string:
    ```
    PLAINTEXT://<IP_ADDRESS>:9092
    ```
12.	Click **Save**.
13.	In the **Save Configuration** dialog box, in the **Notes** box, type **Listen on all interfaces**, and then click **Save**.
14.	In the **Save Configuration Changes** dialog box, click **OK**.
15.	Click **Service Actions**, and then click **Turn On Maintenance Mode**.
16.	In the **Confirmation** dialog box, click **OK**.
17.	In the **Information** dialog box, click **OK**.
18.	Click **Restart**, and then click **Restart All Affected**.
19.	In the **Confirmation** dialog box, click **Confirm Restart All**.
20.	Wait for all the operations listed in the **Background Operation Running** dialog box to complete, and then click **OK**.
21.	Click **Service Actions**, and then click **Turn Off Maintenance Mode**.
22.	In the **Confirmation** dialog box, click **OK**.
23.	In the **Information** dialog box, click **OK**.
24.	Switch to the PowerShell ISE.
25.	In Windows PowerShell ISE, on the **File** menu, click **Open**.
26.	In the **Open** dialog box, navigate to **E:\Demofiles\Mod11**, click **ShowNodeIPs.ps1**, and then click **Open**.
27.	Replace **\<resource group\>** with the name of the resource group you created for your virtual network.
28.	On the toolbar, click **Run**.
29.	In the **Windows PowerShell ISE** dialog box, click **OK**.
30.	In the **Microsoft Azure** dialog box, sign in using the Microsoft account that is associated with your Azure Learning Pass subscription.
31.	Make a note of the two worker node IP addresses.

### Send event data to a Kafka cluster
1.	On the desktop, double-click **IntelliJ IDEA Community Edition**.
2.	On the **File** menu, click **Open**.
3.	In the **Open File or Project** dialog box, navigate to **E:\Demofiles\Mod11\Kafka\Streaming\StockMarketEventProducer**, and click **OK**.
4.	In the **Open Project** dialog box, click **This Window.**
5.	Show some of the code in **eventdriver.scala**.
6.	On the **Run** menu, click **Edit Configurations**.
7.	On the **Configuration** tab, edit the **Program arguments**, so that bootstrap server IP addresses are the worker node IP addresses that you noted earlier, and then click **OK**.
8.	On the toolbar, click **Run**.
9.	You should see messages being sent to topic “stocks”.

### Perform stream processing
1.	In IntelliJ IDEA, on the **File** menu, click **Open**.
2.	In the **Open File or Project** dialog box, navigate to **E:\Demofiles\Mod11\Kafka\Streaming\StockMarketStreamer**, and then click **OK**.
3.	In the **Open Project** dialog box, click **New Window**.
4.	Show some of the code in **streamdriver.scala**.

### Visualize event data
1.	In Internet Explorer, create a new tab, and go to **http://www.PowerBI.com**.
2.	Click **Sign in**, and sign in using your Power BI credentials.
3.	Close the **GetData** dialog box.
4.	Click **+ Create**, and click **Streaming dataset**.
5.	On the **New streaming dataset** blade, click **API**, and click **Next**.
6.	On the **New streaming dataset** blade, enter the following details, and then click **Create**:
    -	**Dataset name**: Stock Market Tickers
    -	**Values from stream**:
        -	**Ticker** of type **Text**
        -	**Movements** of type **Number**
        -	**AveragePrice** of type **Number**
7.	Copy the **Push URL** to Notepad.
8.	Click **Done**.
9.	Click **Dashboards**.
10.	Click **+ Create**, and click **Dashboard**.
11.	In the **Create dashboard** dialog box, in the **Dashboard name** box, type **Stock Market Tickers**, and then click **Create**.
12.	Click **+ Add tile**.
13.	In the **Add tile** blade, click **CUSTOM STREAMING DATA**, and then click **Next**.
14.	In the **Add a custom streaming data tile** blade, click **Stock Market Tickers**, and then click **Next**.
15.	In the **Add a custom streaming data tile** blade, in the **Visualization Type** list, click **Card**.
16.	In the **Fields** section, click **+ Add value**.
17.	In the **Fields** list, click **Movements**, and then click **Next**.
18.	In the **Tile details** blade, in the **Title** box, type **Movements**, and then click **Apply**.
19.	Click **+ Add tile**.
20.	In the **Add tile** blade, click **CUSTOM STREAMING DATA**, and then click **Next**.
21.	In the **Add a custom streaming data tile** blade, click **Stock Market Tickers**, and then click **Next**.
22.	In the **Add a custom streaming data tile** blade, in the **Visualization Type** list, click **Card**.
23.	In the **Fields** section, click **+ Add value**.
24.	In the **Fields** list, click **AveragePrice**, and then click **Next**.
25.	In the **Tile details** blade, in the **Title** box, type **Average Price**, and click **Apply**.
26.	Switch to the second instance of IntelliJ IDEA.
27.	On the **Run** menu, click **Edit Configurations**.
28.	On the **Configuration** tab, edit the **Program arguments**, so that bootstrap server IP addresses are the worker node IP addresses that you noted earlier, and paste the URL for the Power BI endpoint, and then click **OK**.
29.	On the toolbar, click **Run**.
30.	Switch to the Power BI dashboard; after a few moments, you should see the Movements and Average Price tiles start to display live real-time data.

>**Note:** At the time of writing, there is a bug in the Microsoft VPN client; if you get an error “Verifying the password”, and then after a timeout “The connection was terminated because the remote computer did not respond in a timely manner. (Error 718)”, use the following workaround:
>
>1.	After installing the VPN package, go to: C:\Users\Admin\AppData\Roaming\Microsoft\Network\Connections\Cm\\<yourconnectionid\>.
>2.	Open \<yourconnectionid\>.cms in a text editor and add the value 13 to the following keys:
>   -	**CustomAuthKey2** (around line 133)
>   -	**CustomAuthKey** (around line 135)
>3.	These keys should then look like:
>   -	CustomAuthKey2=13
>   -	CustomAuthKey=13
>4.	Save the edited cms file, and retry the VPN connection.
>
>At the end of this demonstration, delete the resource group because this will delete everything in that group to save costs, as follows:
>1.	Return to the Azure Portal, and click **Resource groups**.
>2.	Right-click the resource group (rg\<your initials\>\<ddmmyyyy\>), and then click **Delete**.
>3.	Type the resource group name (rg\<your initials\>\<ddmmyyyy\>), and then click **Delete**.

---

©2018 Microsoft Corporation. All rights reserved.

The text in this document is available under the [Creative Commons Attribution 3.0 License](https://creativecommons.org/licenses/by/3.0/legalcode), additional terms may apply. All other content contained in this document (including, without limitation, trademarks, logos, images, etc.) are **not** included within the Creative Commons license grant. This document does not provide you with any legal rights to any intellectual property in any Microsoft product. You may copy and use this document for your internal, reference purposes.

This document is provided "as-is." Information and views expressed in this document, including URL and other Internet Web site references, may change without notice. You bear the risk of using it. Some examples are for illustration only and are fictitious. No real association is intended or inferred. Microsoft makes no warranties, express or implied, with respect to the information provided here.


text:
---
layout: post
Title: how to swim
---

![image title](/images/swimming .jpg)

## how to swim

You can swim by kicking you leg and stroking with your arms.these are thing you can practice. Swimming involves breathing.skills to have how to swim is breath control and also developing a fast strong arm.Read more [here](.LEARN to swim CONFIDENT, FLOAT & BE WATER SAFE in 3 Steps - Tutorial for BEGINNERS (Breathe relax)

![pools](/images/swimming pool.jpg)

## One problem

If you not knew how to swim you can die and also some people pee in the water. If you not knew how to swim you can drown.if you swim 24 can cause trouble breathing.the risks that can happened to you is increase asthma.and also you can get cancer.


text:
# Stock Ticker Volatility Alert

## Install
Clone repository and run

## Demo Account (UPDATE: GOOGLE FINANCE API IS DEPRECATED)
https://volalert.herokuapp.com/

ID<EMAIL_ADDRESS>
Password : demo

## Instruction

- Sign up an account and log in.
- Add interested stock index and ticker (up to ten tickers).
- For each ticker, pick a target volatility you want to be alerted.
  (2% = At least 2% difference in stock price in the previous 1 minute.)
- Click 'Start Watching' - You will automatically be alerted if your volatility is triggered.
- You may stop watching at any time. Your list will be saved.

## Requirements
node 5+

## MongoDB Schema Documentation

![Home View](https://cloud.githubusercontent.com/assets/22410733/25723671/dae4964a-30cd-11e7-988c-2fdb4abf9e3b.png)

Deploy a copy to Heroku :

[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/dougkna/volalert)


text:
### Constraints
* CO-01: `:visited` can *only* be applied via CSS selectors, not inline.
* CO-02: Composition errors based on attribute *values* aren't checkable at compile time.
* CO-03: The type-system of Scala compiler must be leveraged as much as possible.
* CO-04: Where a style is referenced or applied, the dev shall be able to navigate to its definition in a single action in IntelliJ/Eclipse.
* CO-05: Solution shall not impose compliance to the CSS spec. (ie. it shall not prevent CSS hacks.)
* CO-06: Browsers cascade styles (even inline styles) to children and there is nothing we can do about it.

### Functional Requirements
##### Definition
* FR-01: Dev shall be able to define a style that requires a specific configuration of children such that the compiler will enforce that the children are styled.
* FR-02: Dev shall be able to define a style that depends on required input. (ie. a function)
* FR-03: Dev shall be able to define a style that depends on browser/page state (eg. `:hover`, `:visited`)
* FR-04: Dev shall be able to define a style that depends on the current plaform (eg. IE 8, mobile)
* FR-07: Dev shall be able to define custom CSS attributes.
* FR-17: Dev shall be able to define a style that affects unspecified, optionally existant children. (Must like & in LESS. Required for FR-15.)
* FR-20: For styles that require repeated declaration with different keys (eg `-moz-`), Dev shall be able to specify the style and its variants with a single declaration.
* FR-21: Dev shall be able to create a group of styles that can be included into an external project's styles in Ω(1) LoC.

##### Composition
* FR-05: Dev shall be able to compose styles to form a new style.
* FR-06: Dev shall be able to define a style that extends an existing style.
* FR-10: Dev shall be able to specify a composition strategy when merging styles.
* FR-11: Solution shall provide a composition stategy that prevents composition.
* FR-12: Solution shall provide a composition stategy that overrides (i.e. discards one side and chooses the other).
* FR-13: Dev shall be able to create a composition stategy that merges attribute values.
* FR-14: Dev shall be able to specify different composition strategies per attribute type. (i.e. `border-top`, the `margin` family)
* FR-18: When looking at a style definition, Dev shall be able to passively understand if any attributes are being overridden.
* FR-19: When looking at a style definition, Dev shall be able to passively understand which attributes are being overridden. **[pri=low]**

##### Other
* FR-08: Scalac shall prevent compilation without proof that a referenced style exists.
* FR-09: Scalac shall prevent compilation without proof that attributes used in a style are either part of the CSS spec or custom as per FR-7.
* FR-15: Dev shall be able to apply a baseline style (a “css reset”) to a whole page.
* FR-16: Solution shall provide one or more “css resets” that devs can override to customise, then apply to their whole page. **[pri=low]**

### Preferences
* PR-01: It would be better not to push psuedo-selector logic upon devs and have them write code for what the browser already does.
* PR-02: It would be nice to edit a logical style in the browser directly. If styles are inline then one can only modify a single tag's style at a time.
* PR-03: Solution should not require scalajs-react. scalajs-react should depend on Solution with provide a small bridge.
* PR-04: When generating CSS, if the target platform is known, Solution should omit unapplicable platform-specific CSS (FR-20).

### Quality Requirements
* QR-01: A page of 1000 DOM elements with 400 different styles, 20% of elements having 3 styles, 10% having 5, should render in ≤ 2 sec.
* QR-02: The time between changing the styles in Scala, and seeing the result in the browser should be ideally ≤ 3 sec.

repository: CapeSepias/scalacss

gha_language: Scala

repo_name: CapeSepias/scalacss


text:
# Contributing to Twitch-IRC

If you would like to contribute code you can do so through GitHub by forking the repository and sending a pull request.

When submitting code, please make every effort to follow existing conventions and style in order to keep the code as readable as possible.

## License

By contributing your code, you agree to license your contribution under the terms of the MIT License: http://opensource.org/licenses/MIT

All files are released with the MIT License.

If you are adding a new file it should have a header like this:

```
/**
 * The MIT License (MIT)
 *
 * Copyright (c) 2015 Schmoopiie
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
*/
 ```

repository: alissonbovenzo/twitch-irc

repo_name: alissonbovenzo/twitch-irc


text:
---
layout: post
title: How to prevent and cure burnout
tag: culture

excerpt: For founders, protecting the mental health of your team in all of this is a very real responsibility.

---

Burnout is the combination of three emotions: exhaustion, negativity and ineffectiveness. The feelings of negativity and ineffectiveness are what differentiate it from regular tiredness or exhaustion. And it’s different from depression in that it’s purely work-related — you don’t burn out from relationship issues or life stressors

Root causes:

* Their goals and targets feel genuinely unachievable
* Their goalposts for success keep moving
* They don’t have enough autonomy
* They don’t feel like they’re mastering new skills
* Rewards, recognition and workload feel unevenly distributed
* The work culture feels competitive or unsupportive
* Their job requirements don’t fit with their personality and strengths
* Their job requirements don’t fit with their values and dreams

Burnout first aid: time off

* Make it okay to flag when people feel overstretched
* Praise under-promising and over-delivering
* Encourage people to be clearer about their boundaries
* Build holiday time into execution plans
* Protect your team’s time — for example, let them periodically turn off Slack notifications or try ‘Deep Work Wednesdays’

extension: markdown


text:
GDataRuby
    by Dion Almaer
    http://gdata-ruby.rubyforge.net

## DESCRIPTION:

Google GData APIs allow developers to build applications on top of the Google open APIs. This project aims to help with wrappers on top of GData, and higher level libraries on top of each API itself (e.g. Calendar, Spreadsheet, Blogger, etc).

See more information about Google GData APIs at

    http://code.google.com/apis/gdata/

## FEATURES/PROBLEMS:

To start out the API set isn't covered. The aim is to support the GData API itself, and then higher level classes for the various Google APIs.

Current support:

* Google Account Authentication: Handle Google ClientLogin API
* Google Spreadsheet Data API
* Google Webmaster Tools API (partial support)

Future support:

* Google Calendar API
* Google AdSense API
* Google AdWords API
* Google Base Data API
* Blogger Data API
* Google Code Search API
* Google Data APIs

## SYNOPSIS:

  require_gem 'gdata-ruby'

  % gspreadsheet 'sin(0.2)'

## REQUIREMENTS:

* gem

## INSTALL:

    sudo gem install

## LICENSE:

(The MIT License)

Copyright (c) 2007 FIX

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

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

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

repository: gavingmiller/gdata-ruby

repo_name: gavingmiller/gdata-ruby


text:
---
title: Terraform script for Amazon Elasticsearch Service with Cognito authentication
date: "2020-09-24T05:12:01.000Z"
description: "Terraform script for Amazon Elasticsearch Service with Cognito authentication"
slug: 'terraform-aws-elasticsearch'
tags:
  - aws
  - terraform
  - elasticsearch
  - cognito
  - nginx
show: true
author: pari
featuredImage: ./es-terraform.jpg
---

Amazon elasticsearch service is a popular choice for many aws clients for log analytics and visualization use cases. One common scenario is to have elasticsearch (indexing engine) only accessible within vpc and kibana (visualization engine) to be available over the internet through an authentication mechanism.

Amazon elasticsearch service is a combo of elasticsearch and kibana, and we cannot spawn two components separately. However, the aws team provided the hack to achieve the desired setup using Nginx and Cognito authentication.

Detailed documentation available at [aws](https://aws.amazon.com/premiumsupport/knowledge-center/kibana-outside-vpc-nginx-elasticsearch/). I referred the same documentation when I first launched the elasticsearch service, but it is quite a lengthy process to get it running. Hence, I thought of creating a Terraform IaC script, handy, and prod ready for deployment.

We can also use AWS CloudFormation to create an IaC script, but I like the terraform simplicity and philosophy.

Below diagram shows the components and communication between each other.
![](./aws-elasticsearch.png )
- vpc and subnets to restrict the access of components
- elasticsearch service to be created within a private subnet
- cognito service(user pool and identity pool) which is used by elasticsearch service for authentication
- nginx instance will be placed in public subnet, which will act as a proxy for kibana access.
- security groups - kibana is only accessible through nginx over 443 port, and nginx public dns will be accessible over internet from port 443.

Terraform code is available at [github](https://github.com/pariksheet/terraform-aws-elasticsearch)

Terraform quick code walkthrough:
- project structure
    - commons
        - confiugure_nginx.sh
            <p> An userdata script which installs and configures the nginx server. </p>
        - nginx.conf
            <p> Nginx configuration file referred by nginx script. </p>
    - main
        - main.tf
            <p> Launcher terraform script. </p>
        - vars.tf
            <p> List of variables referred in the terraform main script. </p>
        - terraform.tfvars
            <p> Variable values to be passed to terraform main script. </p>
    - modules
        - elasticsearch
            <p> Module consists of three sub modules. </p>
            - cognito
                <p> Create user pool and indentity pool. </p>
            - elasticsearch_domain
                <p> Create elasticsearch domain with cognito authentication. </p>
            - nginx
                <p> Launch nginx instance and configure it to access kibana. </p>
        - vpc
            - vpc_base
                <p> Create vpc, subnets, route tables and internet gatway. </p>
            - vpc_sg
                <p> Create security groups and ingress/egress rules. </p>
- input variables
``` terraform variable "AWS_REGION" { description = "aws region" }
variable "PREFIX" { description = "Typically project name" }
variable "ENV" { description = "Environment Name" }
variable "SUBNET" { description = "VPC CIDR : 10.{var.SUBNET}.0.0/22"}
variable "INSTANCE_KEY_PATH" { description = "path of instance pem file" }
variable "NGINX_INSTANCE" { description = "instance type of nginx"}
variable "ES_INSTANCE" { description = "instance type of elasticsearch"}
variable "ES_VOLUME_GB" { description = "instance volume(gb) of elasticsearch"}
variable "ES_ENCRYPTION" { description = "true/false"}
```
- output variables
``` terraform
elasticsearch = {
  "es_arn" = "arn:aws:es:eu-west-1:856753410642:domain/blog-dev-elastic-search"
  "es_endpoint" = "vpc-blog-dev-elastic-search-wpeo7jzj3s76bgr3porui5e3x4.eu-west-1.es.amazonaws.com"
  "kibana_public_url" = "https://ec2-54-74-236-213.eu-west-1.compute.amazonaws.com"
  "kibana_vpc_url" = "https://vpc-blog-dev-elastic-search-wpeo7jzj3s76bgr3porui5e3x4.eu-west-1.es.amazonaws.com/_plugin/kibana/"
  "user_pool" = "BLOG_DEV_USER_POOL"
}
nginx = {
  "private_ip" = "<IP_ADDRESS>"
  "public_ip" = "<IP_ADDRESS>"
  "ssh_cmd" = "ssh -i ./keypair/nginx-instance ec2-user@i-08fc027f1db5542fc"
}
```
- execution of script
```bash
terraform apply
```

This blog post did not cover terraform basics on how to write each component. There are good materials available over web. I have created a bootcamp for terraform noobs, here is the [github](https://github.com/pariksheet/terraform-bootcamp) link.

Feel free to ask any specific question over comment section.

Cheers. Happy Coding...!!!

repository: abhijeetdhumal/techovercoffee

repo_name: abhijeetdhumal/techovercoffee


text:
# karma-string-replace-preprocessor
> A preprocessor for Karma that does string replacement on module content on the fly.

## Installation

The easiest way is to keep `karma-string-replace-preprocessor` as a devDependency.
You can simple do it by:
```bash
npm install karma-string-replace-preprocessor --save-dev
```

## Configuration

Following code shows the default configuration

```js
// karma.conf.js
module.exports = function(config) {
  config.set({

    preprocessors: {
      'src/**/*.js': [ 'stringreplace' ]
    },

	stringReplacePreprocessor: {
		patterns: [
			{ match: 'stringToReplaceOne', replacement: 'This string has been replace with number one.' },
			{ match: 'stringToReplaceTwo', replacement: 'This string has been replace with number two.' }
		]
	},

	...

  })
}
```

----

## Karma Plugins

See the [Karma Documentation] for additional details on custom - in this case, preprocessor - plugin development.

[Karma Documentation]: https://karma-runner.github.io/latest/dev/plugins.html

## Dependency Injection in Karma

Dependency Injection in Karma is handled by [Node-DI], but that library is deprecated. See the author's readme notes in the repo. Just something to be aware of as this dependency may change in Karma in the future. And, it defines `$inject`, which is something on which this plugin relies.

[Node-DI]: https://github.com/vojtajina/node-di

## Logger

Logger is another dependency of Karma. See [log4js]

[log4js]: https://github.com/log4js-node/log4js-node

----

## License Info
[MIT License](./LICENSE)