text:
**IMPORTANT:** This branch only has an effect for branches that have projects
set up in
https://chrome-internal.googlesource.com/infradata/config/+/HEAD/configs/luci-config/projects.cfg

This directory contains chromium project-wide configurations
for Chrome Operations services.
For example, [cr-buildbucket.cfg](generated/luci/cr-buildbucket.cfg) defines
builders.

Currently active version can be checked at
https://luci-config.appspot.com/#/projects/chromium .

The configuration is written using starlark, which is executed using lucicfg to
generate the raw cfg files located in [generated](generated). See
https://chromium.googlesource.com/infra/luci/luci-go/+/HEAD/lucicfg/doc/README.md
for more information on lucicfg/starlark.

The starlark configuration is rooted in `main.star` and `dev.star`, which
execute other starlark files to generate a subset of the LUCI service
configuration files. A presubmit check enforces that the generated files are
kept in sync with the output of the starlark configuration.

The configuration rooted at [main.star](main.star) defines the LUCI services
configuration for the chromium project on the production instance of LUCI. The
configuration is responsible for generating the raw configuration files that do
not end in -dev.cfg as well as the markdown file
[cq-builders.md](generated/cq-builders.md). Starlark files in the following
directories are consumed by the configuration:

* lib - Utilities for defining LUCI entities.
* subprojects - Definitions of LUCI entities.
* generators - Definitions of lucicfg generators that do various things to
  post-process the LUCI configuration before the output files are generated.
  (e.g. generate no-op jobs to workaround limitations of our recipe config) or
  generate additional files (e.g. the CQ builders markdown document).
* validators - Definitions of lucicfg generators that perform additional
  validation on the the LUCI configuration (e.g. ensure all builders are added
  to at least one console).
* outages - Definitions of config settings for operations common when handling
  outages.

The configuration rooted at [dev.star](dev.star) defines the LUCI services
configuration for the chromium project on the dev instance of LUCI. This
configuration consumes starlark files under the dev directory and is responsible
for generating the raw configuration files ending in -dev.cfg.

repository: chromium/chromium

repo_name: chromium/chromium


text:
# cj-route-admin

<!-- Auto Generated Below -->

## Dependencies

### Depends on

- [auth-admin-user-list](../../../components/AdminUserList)

### Graph
```mermaid
graph TD;
  auth-route-admin-index --> auth-admin-user-list
  auth-admin-user-list --> corejam-box
  auth-admin-user-list --> corejam-type
  auth-admin-user-list --> corejam-base-link
  auth-admin-user-list --> corejam-pagination
  corejam-pagination --> corejam-box
  corejam-pagination --> corejam-base-link
  corejam-pagination --> corejam-type
  style auth-route-admin-index fill:#f9f,stroke:#333,stroke-width:4px
```

----------------------------------------------

*Built with [StencilJS](https://stenciljs.com/)*

license: MIT

repository: corejam/corejam

branch_name: refs/heads/next

extension: md

gha_language: TypeScript

gha_license_id: MIT

license_type: permissive

repo_name: corejam/corejam


text:
# November 30, 2021

**Date:** Novermber 30, 2021, at 8am Pacific (your [timezone](https://arewemeetingyet.com/Los%20Angeles/2021-11-30/8:00/Jupyter%20Community%20Call))

**[Discourse](https://discourse.jupyter.org/t/jupyter-community-calls/668)**

**[YouTube link](https://youtu.be/_YdiFgWUHNI)**

**Please note:**
- Community calls are recorded and posted to this [playlist](https://www.youtube.com/playlist?list=PLUrHeD2K9Cmkoamm4NjLmvXC4Y6E1o8SP)
- These notes will be recorded and posted [here](https://jupyter.readthedocs.io/en/latest/community/community-call-notes/index.html)
- Everyone present is held to the [Jupyter Code of Conduct](https://jupyter.org/conduct)

## Purpose

Think of it as a monthly, virtual JupyterCon. It’s a place to announce and share fun things happening in the Jupyter community.

For more discussion on the format of these calls, see the thread [here](https://discourse.jupyter.org/t/reviving-the-all-jupyter-team-meetings/423).

## Short reports, celebrations, shout-outs

This is a place to make short announcements (without a need for discussion).

* **@loichuder:** Release 1.0.0 of [jupyterlab-h5web](https://github.com/silx-kit/jupyterlab-h5web) bringing support for JLab3 as prebuilt extension 🎉
* **@bollwyvl** `jupyterlite 0.1.0a17` speaks self-hosted/custom wheels and MathJax
  * [offline pyodide](https://jupyterlite--425.org.readthedocs.build/en/425/_static/lab/index.html) coming
    * [jupyter-server-proxy 3.2.0](https://github.com/jupyterhub/jupyter-server-proxy/blob/main/CHANGELOG.md#320---2021-11-29) including full control of request re-writing, sub-paths in Lab launchers

## Agenda Items

* **@ltetrel** jupyter book workflow on [NeuroLibre](https://www.neurolibre.org/)
    * [NeuroLibre Documentation](https://docs.neurolibre.org/en/latest/) (you are welcome to be an alpha tester!))
    * This is the [pull request for initContainer on binderhub](https://github.com/jupyterhub/binderhub/pull/1081). It should be already possible with [Zero to JupyterHub singleuser.initContainers](https://zero-to-jupyterhub.readthedocs.io/en/latest/resources/reference.html#singleuser-initcontainers) but not optimal (better to do our process once during build). The missing piece is to give that initContainer an environment variable ([as discussed on the github issue](https://github.com/jupyterhub/binderhub/issues/1429) and [Jupyter discourse](https://discourse.jupyter.org/t/feature-idea-jupyterhub-binderhub-jupyter-book-as-a-publishing-platform/8359/8?u=ltetrel)).
* **@fcollonval** [WIP RISE in JupyterLab PR](https://github.com/damianavila/RISE/pull/605)

  To test the PR locally, here are the commands to execute:
  ```sh
    yarn
    yarn build
    python3 -m pip install -e .
    jupyter server extension enable --sys-prefix rise
    jupyter serverextension enable --sys-prefix rise
    jupyter labextension develop --overwrite .
  ```

* **@afshin** `[DRAFT]` Jupyter Enhancement Proposal (JEP) for [Jupyter Notebook version 7](https://github.com/jupyter/enhancement-proposals/pull/79)
    * Also mentioned on the [Jupyter Discourse](https://discourse.jupyter.org/t/jep-draft-open-for-the-notebook-v7-transition/11769)

## Other Links Shared

This is a space to store links shared during community call discussions related to or separate from the agenda items.

- [The Journal of Open Source Software](https://joss.theoj.org/)
- [Comment on Jupyter Discourse post Feature Idea: JupyterHub/BinderHub + Jupyter Book as a publishing platform](https://discourse.jupyter.org/t/feature-idea-jupyterhub-binderhub-jupyter-book-as-a-publishing-platform/8359/3)
- [Darian's sweet potato pie recipe](https://food.darian.link/sweet-potato-pie/)
- [Cooking for Engineers](http://www.cookingforengineers.com/)
- [jupyterlab/jupyterlab issue #10207 Side-by-side rendering](https://github.com/jupyterlab/jupyterlab/issues/10207)

## Comments

- Gabriel: being able to draw on the slides in Frederic's demo (over the figures, charts) looked very cool to me

## Attendees

|   Name   |           Institution     | GitHub Handle                     |
|----------|---------------------------|-----------------------------------
|loic tetrel | SIMEXP (UDEM)           | @ltetrel
|jeremy ravenel | Naas          | @jupyter-naas
| Frederic Collonval | QuantStack | @fcollonval
| Afshin T. Darian | Two Sigma | @afshin |
| Zach Sailer         |  Apple          | @Zsailer
| Sarah Gibson | 2i2c | @sgibson91 |
| Martha Cryan | IBM | @marthacryan |
| Karla Spuldaro | IBM | @karlaspuldaro |
| Jessica Xu | | @jess-x |
| Nick Bollweg | Georgia Tech | @bollwyvl @nrbgt |
|   Wayne Decatur |  Upstate Medical Univ. | @fomightez
|Dane Freeman | Georgia Tech | @dfreeman06
|Gabriel Fouasnon|Quansight Labs|@gabalafou
| Rollin Thomas | NERSC | @rcthomas |
| Loic Huder| ESRF | @loichuder |
|Isabela Presedo-Floyd | Quansight Labs | @isabela-pf |

Plus 6 more

repository: jupyter/jupyter

branch_name: refs/heads/master

gha_language: Python

repo_name: jupyter/jupyter


text:
**This is a fork of sudoku library available here: https://github.com/robatron/sudoku.js. It was forked in order to make it UMD friendly and publish in NPM**

Sudoku.js
==========

A Sudoku puzzle **generator** and **solver** JavaScript library.

Check out the [online demo][demo] to see it in action.

Implementation ideas borrowed from
["Solving Every Sudoku Puzzle"][norvig-sudoku] by
[Peter Norvig][norvig], and a [generator/solver][anderson-sudoku] by
[Michael Anderson][anderson].

[demo]:http://htmlpreview.github.com/?https://github.com/robatron/sudoku.js/blob/master/demo/index.html

## Usage

### Browser

Just add a script with the `sudoku.js` file. This will create a global variable `sudoku`.

### Node

```
npm install sudoku-umd --save
```
then
```
// CommonJs
const sudoku = require('sudoko-umd');

// ES6
import sudoku from 'sudoku-umd';
```

API
--------------------------------------------------------------------------------

Puzzles are represented by a string of digits, 1-9, and '.' as spaces. Each
character represents a square, e.g.,

    "52...6.........7.13...........4..8..6......5...........418.........3..2...87....."

Represents the following board:

    5 2 . | . . 6 | . . .
    . . . | . . . | 7 . 1
    3 . . | . . . | . . .
    ------+-------+------
    . . . | 4 . . | 8 . .
    6 . . | . . . | . 5 .
     3 . | . 2 .
    . . 8 | 7 . . | . . .

(See the included [converstion functions](#board-string-%E2%86%94-grid) to
convert between string representations and grids, i.e., two-dimensional arrays.)

Generate a Sudoku puzzle
--------------------------------------------------------------------------------

Generage a Sudoku puzzle of a particular difficulty, e.g,

```javascript
>>> sudoku.generate("easy")
"672819345193..4862485..3197824137659761945283359...714.38..14<IP_ADDRESS>.463...71"

>>> sudoku.generate("medium")
"<IP_ADDRESS>.976.3....5.196....3.7495...692183...4.5726..92483591..169847...753612984"

>>> sudoku.generate("hard")
".17..69..356194.2..89..71.6.65...273872563419.43...685521......798..53..634...59."
```

Valid difficulties are as follows, and represent the number of given squares:

    "easy":         62
    "medium":       53
    "hard":         44
    "very-hard":    35
    "insane":       26
    "inhuman":      17

You may also enter a custom number of squares to give, e.g.,

```javascript
>>> sudoku.generate(60)
"8941376521532687497269548...72.9158.538.4219..19.852..3874.69.52415793689658.34.."
```

The number of givens must be a number between 17 and 81 inclusive. If it's
outside of that range, the number of givens will be set to the closest bound,
e.g., 0 will be treated as 17, and 100 as 81.

By default, the puzzles should have unique solutions, unless you set `unique` to
false, e.g.,

```javascript
sudoku.generate("easy", false)
```

Note: **Puzzle uniqueness is not yet implemented**, so puzzles are *not*
guaranteed to have unique solutions.

Solve a Sudoku puzzle
--------------------------------------------------------------------------------

Solve a Sudoku puzzle given a Sudoku puzzle represented as a string, e.g.,

```javascript
>>> sudoku.solve(".17..69..356194.2..89..71.6.65...273872563419.43...685521......798..53..634...59.");
"217386954356194728489257136165948273872563419943712685521439867798625341634871592"
```

Board string ↔ grid
--------------------------------------------------------------------------------

Board string → grid:

```javascript
>>> sudoku.board_string_to_grid("<IP_ADDRESS>..3259149..76.32.1.....7925.321.4864..68.5317..1....96598721433...9...7")
[
    ["2","3",".","9","4",".","6","7","."],
    ["8",".",".","3","2","5","9","1","4"],
    ["9",".",".","7","6",".","3","2","."],
    ["1",".",".",".",".",".","7","9","2"],
    ["5",".","3","2","1",".","4","8","6"],
    ["4",".",".","6","8",".","5","3","1"],
    ["7",".",".","1",".",".",".",".","9"],
    ["6","5","9","8","7","2","1","4","3"],
    ["3",".",".",".","9",".",".",".","7"]
]
```

Board grid → string:

```javascript
>>> sudoku.board_grid_to_string([
    ["2","3",".","9","4",".","6","7","."],
    ["8",".",".","3","2","5","9","1","4"],
    ["9",".",".","7","6",".","3","2","."],
    ["1",".",".",".",".",".","7","9","2"],
    ["5",".","3","2","1",".","4","8","6"],
    ["4",".",".","6","8",".","5","3","1"],
    ["7",".",".","1",".",".",".",".","9"],
    ["6","5","9","8","7","2","1","4","3"],
    ["3",".",".",".","9",".",".",".","7"]
])
"<IP_ADDRESS>..3259149..76.32.1.....7925.321.4864..68.5317..1....96598721433...9...7"
```

Get candidates
--------------------------------------------------------------------------------

Get a grid of squares and their candidate values, propagating constraints, i.e.,
candidates restrict their peer candidates.

```javascript
>>> sudoku.get_candidates("4.25..389....4.265..523.147..1652.7.6..1945322543876915....3.1....4..9.....8....3")
[
    ["4",     "167",    "2",    "5",  "167",  "16",   "3",   "8",  "9"  ],
    ["13789", "13789",  "3789", "79", "4",    "189",  "2",   "6",  "5"  ],
    ["89",    "689",    "5",    "2",  "3",    "689",  "1",   "4",  "7"  ],
    ["389",   "389",    "1",    "6",  "5",    "2",    "48",  "7",  "48" ],
    ["6",     "78",     "78",   "1",  "9",    "4",    "5",   "3",  "2"  ],
    ["2",     "5",      "4",    "3",  "8",    "7",    "6",   "9",  "1"  ],
    ["5",     "246789", "6789", "79", "267",  "3",    "478", "1",  "468"],
    ["1378",  "123678", "3678", "4",  "1267", "156",  "9",   "25", "68" ],
    ["179",   "124679", "679",  "8",  "1267", "1569", "47",  "25", "3"  ]
]
```

Print a board to the console
----------------------------

```javascript
>>> sudoku.print_board(".17..69..356194.2..89..71.6.65...273872563419.43...685521......798..53..634...59.");
. 1 7   . . 6   9 . .
3 5 6   1 9 4   . 2 .
. 8 9   . . 7   1 . 6

. 6 5   . . .   2 7 3
8 7 2   5 6 3   4 1 9
. 4 3   . . .   6 8 5

5 2 1   . . .   . . .
7 9 8   . . 5   3 . .
6 3 4   . . .   5 9 .
```

References:
-----------

- ["Solving Every Sudoku Puzzle"][norvig-sudoku] by [Peter Norvig][norvig]
- Sudoku [generator/solver][anderson-sudoku] for Mac OS X by [Michael Anderson][anderson]
- [95 Sudoku Puzzles][95-sudokus]
- Andrew Stuart's [online Sudoku Solver][stuart-sudoku]

[norvig-sudoku]: http://norvig.com/sudoku.html
[anderson-sudoku]: https://github.com/andermic/cousins/tree/master/sudoku
[stuart-sudoku]: http://www.sudokuwiki.org/sudoku.htm
[95-sudokus]: http://magictour.free.fr/top95
[norvig]: http://norvig.com
[anderson]: https://github.com/andermic/

License:
--------

The MIT License (MIT)

Copyright (c) 2014 Rob McGuire-Dale

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.

 IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


text:
LayerListItem is the single component used to build out the larger LayerList component.  Each layer in the map has a corresponding LayerListItem component

![Layer List Item](../LayerListItem.png)

repository: CarlyLanglois/sdk

repo_name: CarlyLanglois/sdk


text:
# Failover Leader service

## Overview

This feature is designed to solve the problem with the Leader service in Active Failover mode.
It attaches the `deployment.arangodb.com/leader=true` label to the Leader member of the cluster.
If a member is a Follower, then this label is removed.
Above labels are used by the cluster Services to route the traffic to the Leader member.

In case of double Leader situation (which will be fixed in future versions of ArangoDB),
the operator will remove the `deployment.arangodb.com/leader=true` label from all members,
which will cause the cluster outage.

## How to use

This feature is disabled by default.
To enable it use `--deployment.feature.failover-leadership ` arg, which needs be passed to the operator:

```shell
helm upgrade --install kube-arangodb \
https://github.com/arangodb/kube-arangodb/releases/download/$VER/kube-arangodb-$VER.tgz \
  --set "operator.args={--deployment.feature.force-rebuild-out-synced-shards}"
```

repository: arangodb/kube-arangodb

gha_language: Go

repo_name: arangodb/kube-arangodb


text:
# css-modulesify

[![Build Status](https://travis-ci.org/css-modules/css-modulesify.svg?branch=master)](https://travis-ci.org/css-modules/css-modulesify)

A browserify plugin to load [CSS Modules].

[CSS Modules]: https://github.com/css-modules/css-modules

**Please note that this is still highly experimental.**

## Why CSS Modules?

Normally you need to use a strict naming convention like BEM to ensure that one component's CSS doesn't collide with another's. CSS Modules are locally scoped, which allows you to use names that are meaningful within the context of the component, without any danger of name collision.

Read Mark Dalgleish's excellent ["End of Global CSS"](https://medium.com/seek-ui-engineering/the-end-of-global-css-90d2a4a06284) and check out [css-modules](https://github.com/css-modules/css-modules) for more context.

## Getting started

First install the package: `npm install --save css-modulesify`

Then you can use it as a browserify plugin, eg: `browserify -p [ css-modulesify -o dist/main.css ] example/index.js`

Inside `example/index.js` you can now load css into your scripts.  When you do `var box1 = require('./box1.css')`, `box1` will be an object to lookup the localized classname for one of the selectors in that file.

So to apply a class to an element you can do something like:

```js
var styles = require('./styles.css');
var div = `<div class="${styles.inner}">...</div>`;
```

The generated css will contain locally-scoped versions of any css you have `require`'d, and will be written out to the file you specify in the `--output` or `-o` option.

## API Usage

```js
var b = require('browserify')();

b.add('./main.js');
b.plugin(require('css-modulesify'), {
  rootDir: __dirname,
  output: './path/to/my.css'
});

b.bundle();
```

```js
// or, get the output as a stream
var b = require('browserify')();
var fs = require('fs');

b.add('./main.js');
b.plugin(require('css-modulesify'), {
  rootDir: __dirname
});

var bundle = b.bundle()
b.on('css stream', function (css) {
  css.pipe(fs.createWriteStream('mycss.css'));
});
```

### Options:

- `rootDir`: absolute path to your project's root directory. This is optional but providing it will result in better generated classnames. css-modulesify will try to use the browserify `basedir` if `rootDir` is not specified, if both are not specified it will use the location from which the command was executed.
- `output`: path to write the generated css. If not provided, you'll need to listen to the `'css stream'` event on the bundle to get the output.
- `jsonOutput`: optional path to write a json manifest of classnames.
- `use`: optional array of postcss plugins (by default we use the css-modules core plugins). NOTE: it's safer to use `after`
- `before`:  optional array of postcss plugins to run before the required css-modules core plugins are run.
- `after`:  optional array of postcss plugins to run after the required css-modules core plugins are run.
- `generateScopedName`: (API only) a function to override the default behaviour of creating locally scoped classnames.
- `global`: optional boolean. Set to `true` if you want `css-modulesify` to apply to `node_modules` as well as local files. You can read more about it in the [browserify docs](https://github.com/substack/node-browserify/#btransformtr-opts).
- `filePattern`: optional regular expression string to specify css file names. (default: `\.css$`)
- `cache`: optional object to persist cache between runs.

### Events
- `b.on('css stream', callback)` The callback is called with a readable stream containing the compiled CSS. You can write this to a file.

## Using CSS Modules on the backend

If you want to use CSS Modules in server-generated templates there are a couple of options:

- Option A (nodejs only): register the [require-hook](https://github.com/css-modules/css-modules-require-hook) so that `var styles = require('./foo.css')` operates the same way as on the frontend. Make sure that the `rootDir` option matches to guarantee that the classnames are the same.

- Option B: configure the `jsonOutput` option with a file path and `css-modulesify` will generate a JSON manifest of classnames.

## PostCSS Plugins

The following PostCSS plugins are enabled by default:

  * [postcss-modules-local-by-default]
  * [postcss-modules-extract-imports]
  * [postcss-modules-scope]
  * [postcss-modules-values]

(i.e. the [CSS Modules] specification).

You can override the default PostCSS Plugins (and add your own) by passing `--use|-u` to `css-modulesify`.

Or if you just want to add some extra plugins to run after the default, add them to the `postcssAfter` array option (API only at this time). In the same way, add extra plugins to `postcssBefore` to run the before the defaults.

In addition you may also wish to configure defined PostCSS plugins by passing `--plugin.option true`.

An example of this would be:

```
browserify -p [css-modulesify \
  --after autoprefixer --autoprefixer.browsers '> 5%' \
  -o dist/main.css] -o dist/index.js src/index.js
```

[postcss-modules-local-by-default]: https://github.com/css-modules/postcss-modules-local-by-default
[postcss-modules-extract-imports]: https://github.com/css-modules/postcss-modules-extract-imports
[postcss-modules-scope]: https://github.com/css-modules/postcss-modules-scope
[postcss-modules-values]: https://github.com/css-modules/postcss-modules-values

## Building for production

If you set `NODE_ENV=production` then `css-modulesify` will generate shorter (though less useful) classnames.

You can also manually switch to short names by setting the `generateScopedName` option. Eg:

```
browserify.plugin(cssModulesify, {
  rootDir: __dirname,
  output: './dist/main.css',
  generateScopedName: cssModulesify.generateShortName
})
```

## Example

An example implementation can be found [here](https://github.com/css-modules/browserify-demo).

## Licence

MIT

## With thanks

 - Tobias Koppers
 - Mark Dalgleish
 - Glen Maddern

----
Josh Johnston, 2015.

repository: css-modules/css-modulesify

gha_language: JavaScript

repo_name: css-modules/css-modulesify


text:
CPP Bitstring (C++ Bitstring)
=============

Current build status [![Build Status](https://travis-ci.org/alexandernst/cpp-bitstring.svg?branch=master)](https://travis-ci.org/alexandernst/cpp-bitstring)

[Latest Docs](http://alexandernst.github.io/cpp-bitstring) (Doxygen)

CPP Bitstring is a library that will help you to deal with random data that you need to parse and process.

Inspired by [Python's Bitstring](https://code.google.com/p/python-bitstring/), CPP Bitstring is able to perform
read/write operations on random chunks of data, letting you to seek, rewind, read and patch the data.

This is still a basic library, you'll probably miss quite some things, if so, please use the [New Issue](https://github.com/alexandernst/cpp-bitstring/issues/new) button.

### How to build

You'll need `meson`, `python3` and `ninja-build`. Once you have those, just run:

    mkdir build
    cd build
    meson ..
    ninja

### How to run tests

Build the project, and run `build/unittests`.

license: Unlicense

repository: alexandernst/cpp-bitstring

repo_name: alexandernst/cpp-bitstring


text:
## intent:affirm
- indeed
- correct
- that sounds good
- yes
- yess please
- of course
- yup
- yeah
- yes please
- yes plz
- Sure
- Ok
- sweet
- cool,
- yes...

## intent:ask_transfer_charge
- Will I be charged for transferring money
- do transfers cost something?
- is there a transfer charge?
- Is there a charge
- will i be charged for a transaction?
- do xfers cost something?
- is there a transfer fee
- is there a xfer fee
- how much is the transfer fee

## intent:check_balance
- كم من المال على حسابي؟
- How much money is on my account?
- what's my balance?
- what's my current balance?
- What's left on that account?
- How much do I have on that account?
- What's the balance on that account?
- How much money is left on that account?
- what is my account balance
- what's my account balance?
- what's my account balance
- whats my account balance
- What's my [credit card](account_type) balance
- What's my [credit](account_type) balance
- How much money do I owe on my [credit cards](account_type)
- Show me my [credit card](account_type) balance
- What [credit accounts](account_type) do I have
- Show me my [credit accounts](account_type)
- Whats the balance on my [credit account](account_type)
- What's my [credit account](account_type)
- What's my [credit all](credit_card) balance
- What's my [emblem](credit_card) card balance
- What's the balance on the [credit all](credit_card) account
- Show me my [iron bank](credit_card) balance
- What's my [justice bank](credit_card) balance
- What's the balance on the [justice bank](credit_card) account
- what's my [emblm](credit_card) [credit card](account_type) balance?
- what's my [credit card](account_type) balance?
- what's my [credit card](account_type) account balance?

- How much money have i spent lately>
- I should check my [credit card]{"entity": "account_type", "value": "credit"} balance [first](account_type)
- check my [credit card]{"entity": "account_type", "value": "credit"} balance
- check my [credit card]{"entity": "account_type", "value": "credit"} balance [first](account_type)
- Can you tell me my account balance?
- Hello, I would like to know how much money is in much money is in my account
- hi, whats my account bal please
- so.... what's my balance?
- whats my [current balance](payment_amount)
- What's my balance?
- How much money do I have?
- Yeah, I like coffee 👀 But how much money do I have?
- Yeah, I know 😀 Since it's so nice: How much money do I have?

## intent:check_earnings
- How much money went into my account last month?
- How much money did I make last year?
- What did I earn last month?
- How much did I make last month?
- How much money did I make last week?
- how much was deposited in my account last month?
- how much was deposited in my account in the last two weeks?
- check deposits for last week
- total deposits over last year
- how much was deposited in January
- how much money have I earned?
- what did I earn?
- How much have i earned?

## intent:deny
- not really
- no
- I don't think so
- never
- no way
- nope
- no thanks
- I dunno
- Nothing!
- nevermind

## intent:goodbye
- see you later
- goodbye
- i'm done
- quit
- stop
- bye
- Adios
- BYEE
- GOODBYE
- Thanks a lot. See ya later

## intent:greet
- good morning
- hi
- hey there
- hey
- good evening
- hello
- Hey RASA!
- Hello?
- Hey Sara!
- HEY
- hello are you still there
- hallo
- HI
- Hey
- Hi
- hi!
- hello there
- hi there
- Hello
- hello its hella
- مرحبا
- هلا
- هلو
- السلام عليكم

## intent:inform
- هذا الأسبوع
- $10
- 5000
- 500
- $100
- $500
- 100 dollars
- 1000 dollars
- tomorrow
- next week
- yesterday
- for today
- last week
- the past month
- the past two days
- the last two weeks
- at [amazon](vendor_name)
- [starbucks](vendor_name)
- at [target](vendor_name)
- at [starbucks](vendor_name)
- [target](vendor_name)
- [Amazon](vendor_name)
- [Starbucks](vendor_name)
- [Target](vendor_name)
- I want to pay the [current balance](payment_amount)
- [current balance](payment_amount)
- [minimum balance](payment_amount)
- I want to pay the [minimum balance](payment_amount)
- the [current balance](payment_amount)
- the [minimum balance](payment_amount)
- my [minimum balance](payment_amount)
- my [current balance](payment_amount)
- [emblem](credit_card) card
- [credit all](credit_card) card
- [iron bank](credit_card) card
- [justice bank](credit_card) card
- [emblem](credit_card)
- [credit all](credit_card)
- [iron bank](credit_card)
- [justice bank](credit_card)
- [emblem](credit_card) account
- [credit all](credit_card) account
- [iron bank](credit_card) account
- [justice bank](credit_card) account
- [emblem](credit_card) [credit card](account_type)
- [credit all](credit_card) [credit card](account_type)
- [iron bank](credit_card) [credit card](account_type)
- [justice bank](credit_card) [credit card](account_type)
- my [emblem](credit_card) [credit card](account_type)
- my [credit all](credit_card) [credit card](account_type)
- my [iron bank](credit_card) [credit card](account_type)
- my [justice bank](credit_card) [credit card](account_type)
- my [emblem](credit_card) card
- my [credit all](credit_card) card
- my [iron bank](credit_card) card
- my [justice bank](credit_card) card
- towards my [emblem](credit_card) card
- towards my [credit all](credit_card) card
- towards my [iron bank](credit_card) card
- towards my [justice bank](credit_card) card
- for sunday
- for friday
- for tomorrow
- for saturday
- I want to pay the [minimum balance](payment_amount) on my [emblem](credit_card) [credit card](account_type) today
- today
- Please schedule it for the first of next month
- a hundred dollars
- [mastercard](credit_card)
- [visa](credit_card)
- my [rasa](credit_card) account
- my [credit card]{"entity": "account_type", "value": "credit"} account ending in 4321
- My [Visa](credit_card) account
- A friend.
- Alexandra?

- Pay off my [minimum balance](payment_amount) please
- i would like to pay $1200 to my [credit card]{"entity": "account_type", "value": "credit"}
- I would also like to pay my [visa](credit_card) bill
- Pay off my [credit card]{"entity": "account_type", "value": "credit"}, please
- I guess it is. Since it's so much, let's pay off my [credit](account_type)
- Let's pay that [credit card]{"entity": "account_type", "value": "credit"} bill

## intent:search_transactions
- how much did I spend at [Target](vendor_name) this week?
- what is my typical spending at [Amazon](vendor_name)?
- I want to check my spending history
- how much did I spend at [Starbucks](vendor_name) last week?
- I need to check my spending history
- I want to check my spending
- I want to check my spending history at [starbucks](vendor_name)
- i want to check my spending history
- i want to see my transaction history
- I want to search my past transactions
- can I search my transaction history
- can I look at past transactions
- I want to search my transactions with [amazon](vendor_name)
- can i seem my transactions with [target](vendor_name)
- how much did i spend at [starbucks](vendor_name) last month?
- what did i spend last month?
- How much did I spend last month?
- What did I spend at [Legoland](vendor_name) last month?
- What did I spend at [Legoland](vendor_name) last year?
- how much did i spend at [starbucks](vendor_name) last year
- Yes! How much did I spend on [Starbucks](vendor_name) last month?
- How much did I spend at Burger King last month?
- what places have I spent money?
- كم أنفقت في [ستاربكس](vendor_name) هذا الأسبوع؟

## intent:thankyou
- thank you goodbye
- okay thank you goodbye
- thank you bye
- um okay thank you good bye
- thank you
- and thats all thank you and good bye
- okay thank you
- thanks
- thanks goodbye
- thank you and good bye
- Thanks!

## intent:transfer_money
- I want to pay John
- I want to transfer $100 to Bob
- can i transfer money to Sally
- I want to transfer money
- I want to pay someone
- can I pay someone
- I need to transfer money to a friend
- can I transfer money to my mom
- I want to pay Bill
- pay my friend
- transfer money
- I want to transfer $100 to John
- i want to transfer $400 to Akela
- I want to pay Paula Handy
- pay Katy Parrow $40 please
- transfer $60 to John Jacob
- pay Evan Oslo
- pay Lisa please
- can I transfer money to Kyle Gardner?
- Pay Karen 60 Euros
- pay Lisa $60
- transfer $60 to Sally
- need to transfer money
- II want to transfer to Kelly
- Pay Percy $50
- Pay $50 to Percy
- Ok pay Emma
- pay Emma
- i want to transfer $100 to Jane smith
- i want to transfer $100 to my daughter
- i want to transfer money please
- i mean i want to transfer money
- I need to pay a friend.
- transfer money to evan oslo
- transfer money to sara
- I need to transfer money to my grandma Judith.

## intent:check_recipients
- Who can I send money to?
- Who are my known recipients
- Show me my list of recipients
- Show the recipient list
- Show me people I can send money to
- Who is a valid payee
- who can I pay?
- who can I transfer money?
- who's in my recipient list?
- who can I transfer money to?
- Who is on your list?
- who is in my list of kown recipients?
- Can we please start over?

## intent:help
- help
- what can you do?
- what can I ask you?
- what do you do?
- what can you help me with?
- help me
- help, what do you do
- how do I use this
- how can you help me
- What are the things that you can do?

## intent:human_handoff
- I want a human
- can I speak to an agent
- real agent please
- real human
- chat with a live agent
- give me a person please
- i want to talk to a human
- transfer to a human
- Please give me to a human

## synonym:credit
- credit card
- credit cards
- credit account
- credit accounts

## synonym:emblem
- emblm
- embelm

branch_name: refs/heads/main


text:
# Writing functional tests

Play provides a number of classes and convenience methods that assist with functional testing.  Most of these can be found either in the [`play.api.test`](api/scala/index.html#play.api.test.package) package or in the [`Helpers`](api/scala/index.html#play.api.test.Helpers$) object.  You can add these methods and classes by importing the package and Helper object:

```scala
import play.api.test._
import play.api.test.Helpers._
```

## Testing a template

Since a template is a standard Scala function, you can execute it from your test, and check the result:

```scala
"render index template" in {
  val html = views.html.index("Coco")

  contentType(html) must equalTo("text/html")
  contentAsString(html) must contain("Hello Coco")
}
```

## Testing your controllers

You can call any `Action` code by providing a [`FakeRequest`](api/scala/index.html#play.api.test.FakeRequest):

```scala
"respond to the index Action" in {
  val result = controllers.Application.index("Bob")(FakeRequest())

  status(result) must equalTo(OK)
  contentType(result) must beSome("text/html")
  charset(result) must beSome("utf-8")
  contentAsString(result) must contain("Hello Bob")
}
```

## Testing the router

Instead of calling the `Action` yourself, you can let the `Router` do it:

@[scalafunctionaltest-respondtoroute](code/ScalaFunctionalTestSpec.scala)

## Testing a model

If you are using an SQL database, you can replace the database connection with an in-memory instance of an H2 database using `inMemoryDatabase`.

@[scalafunctionaltest-testmodel](code/ScalaFunctionalTestSpec.scala)

## Starting a real HTTP server

Sometimes you want to test the real HTTP stack from with your test, in which case you can start a test server using [`WithServer`](api/scala/index.html#play.api.test.WithServer):

@[scalafunctionaltest-testpaymentgateway](code/ScalaFunctionalTestSpec.scala)

The `port` value contains the port number the server is running on.  By default this is 19001, however you can change this either by passing the port into the with `WithServer` constructor, or by setting the system property `testserver.port`.  This can be useful for integrating with continuous integration servers, so that ports can be dynamically reserved for each build.

A `FakeApplication` can also be passed to the test server, which is useful for setting up custom routes:

@[scalafunctionaltest-testws](code/ScalaFunctionalTestSpec.scala)

## Testing from within a Web browser.

If you want to test your application using a browser, you can use [Selenium WebDriver](http://code.google.com/p/selenium/?redir=1). Play will start the WebDriver for your, and wrap it in the convenient API provided by [FluentLenium](https://github.com/FluentLenium/FluentLenium).

```scala
"run in a browser" in new WithBrowser {
  browser.goTo("/")
  browser.$("#title").getTexts().get(0) must equalTo("Hello Guest")

  browser.$("a").click()

  browser.url must equalTo("/")
  browser.$("#title").getTexts().get(0) must equalTo("Hello Coco")
}
```

Like `WithServer`, you can change the port, `FakeApplication`, and you can also select the web browser to use:

```scala
"run in a browser" in new WithBrowser(webDriver = FIREFOX) {
  ...
}
```

> **Next:** [[Advanced topics|Iteratees]]

repository: waxzce/playframework

gha_language: Scala

repo_name: waxzce/playframework


text:
# RxWebSocket

[![CI Status](http://img.shields.io/travis/fjcaetano/RxWebSocket.svg?style=flat)](https://travis-ci.org/fjcaetano/RxWebSocket)
[![Version](https://img.shields.io/cocoapods/v/RxWebSocket.svg?style=flat)](http://cocoapods.org/pods/RxWebSocket)
[![License](https://img.shields.io/cocoapods/l/RxWebSocket.svg?style=flat)](http://cocoapods.org/pods/RxWebSocket)
[![Platform](https://img.shields.io/cocoapods/p/RxWebSocket.svg?style=flat)](http://cocoapods.org/pods/RxWebSocket)

------

Reactive extensions for websockets.

A lightweight abstraction layer over [Starscream](https://github.com/daltoniam/Starscream) to make it reactive.

## Installation

RxWebSocket is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

``` ruby
pod "RxWebSocket"
```

## Usage

Every websocket event will be sent to the `stream` which is an `Observable<StreamEvent>`.

``` swift
  public enum StreamEvent {
    case connect
    case disconnect(Error?)
    case pong
    case text(String)
    case data(Data)
  }
```

You may receive and send text events by subscribing to the `text` property:

``` swift
let label = UILabel()
socket.rx.text
    .bindTo(label.rx.text)

sendButton.rx.tap
    .flatMap { textField.text ?? "" }
    .bindTo(socket.rx.text)
```

For further details, check the Example project.

## License

RxWebSocket is available under the MIT license. See the LICENSE file for more info.

repository: mohsinalimat/RxWebSocket

repo_name: mohsinalimat/RxWebSocket


text:
# Opportune

**Author**: Kat Cosgrove, Gene Pieterson, Patricia Raftery, Austin Matteson
**Version**: 1.4.1

## Overview

Opportune is a web application that uses a web scraper and keywords from the user to find jobs in their area related to their chosen search terms. To use, the user must register or log in, choose their location and job keywords, and Opportune will email to them a list of 20 job postings within their specifications. Their results will also be displayed on their profile page. At any time the user can go back and search again, with different keywords/city, or if they use the same they will not get the same job postings again. The user has the ability to delete or add keywords, change their email, or fully delete their account. Data analysis is displayed to the user on salaries for different keyword searches.

## How It Works

This application returns 30 job postings to the user on submit of their location and keyword preferences. It does this by using Beautiful Soup to scrape Indeed.com. The results are stored in a csv file and emailed to the user, and also displayed on their profile page. Data analysis is done on common keyword searches in Seattle comparing salaries using Jupyter Notebook and Bokeh.

## Getting Started

To replicate this app, you would fork and clone our GitHub https://github.com/Mildly-Sketchy/Opportune. Then you would need to start a virtual environment, install the packages to get the dependencies used in this app, and have 3 empty databases set up.

## Architecture

Three SQL databases are used for persistence to store job postings and user data. Pyramid is used for the framework, and the web scraper used is Beautiful Soup. Other technologies used are Python3, Travis CI, Jupyter notebook, pandas, Bokeh, HTML, CSS, and JavaScript. Heroku is used for deployment.

## Change Log

#### Prework

04/10/2018 1400 - Discussed project ideas

04/11/2018 1400 - Selected project idea

04/12/2018 1400 - Did wireframes and planning

04/13/2018 1400 - Created repository

04/13/2018 1400 - Created front-end mock-ups

04/15/2018 1400 - Created Pyramid framework

#### Day 1

04/16/2018 1000 - Deployed scaffolded site with Heroku

04/16/2018 1100 - Travis CI utilized

04/16/2018 1200 - CSV with test data can be successfully emailed to the user

04/16/2018 1300 - Databases dropped and rebuilt

04/16/2018 1400 - Update gitignore

04/16/2018 1430 - Basic web scraper functionality achieved within a jupyter notebook

04/16/2018 1500 - Web scraper transfered to the proper file in Pyramid, still works

#### Day 2

04/17/2018 0900 - Keywords can be stored in the SQL database

04/17/2018 0930 - Web scraper now accepts keywords stored in the database

04/17/2018 1030 - Web scraper can accept a single city and multiple job keywords

04/17/2018 1130 - Basic tests written for views, coverage at 54%

04/17/2018 1245 - Keywords can be deleted from the database

04/17/2018 1330 - Dummy data file created for testing scraper, using the data from Indeed with the python keyword

04/17/2018 1430 - The user can add keywords to their account, they display on their profile page, and can be selectively deleted

04/17/2018 1500 - Test for web scraper works. Test uses monkey patch to direct the scraper to the dummy data

04/17/2018 1600 - User's results are written to a csv and displayed on the profile page

04/17/2018 1700 - More styling and formatting done on the front end to make buttons look more appealing, improve organization

#### Day 3

04/18/2018 0900 - Merge developmenent branch to master branch, redeploy

04/18/2018 1030 - The user can update their email address or delete their entire account

04/18/2018 1130 - Front end styling for search page

04/18/2018 1230 - Testing with fake authenticated user can post keywords, passes

04/18/2018 1300 - Tests broken up in to different files

04/18/2018 1400 - Data Analysis for different properties of dev related keywords

#### Day 4

04/19/2018 0900 - 401 redirect for bad login caught, scraper now returns job summaries

04/19/2018 1000 - Small UI issues corrected, admin permissions for analytics page in place

04/19/2018 1100 - Forbidden view and existing username tests added

04/19/2018 1200 - Mass scraper notebook with CSV files added

04/19/2018 1300 - Data analysis done on the user's keyword searches and is displayed to the user's profile

04/19/2018 1400 - Test coverage is 85%

04/19/2018 1600 - Test coverage is 95%

04/19/2018 1800 - About Us page, pictures and descriptions added, styling done

#### Day 5

04/20/2018 0900 - Bug fixes with scraper and email

04/20/2018 1000 - LinkedIn and GitHub links added to About Us page, better styling done

04/20/2018 1400 - Presentation

repository: Mildly-Sketchy/Opportune

branch_name: refs/heads/development

repo_name: Mildly-Sketchy/Opportune


text:
---
type: rule
archivedreason:
title: Production - Do you use a 'Recording in Progress' sign?
guid: b1d44ac9-5cfe-4571-87e1-f1ff04c4e56c
uri: production-do-you-use-a-recording-in-progress-sign
created: 2011-12-09T05:21:57.0000000Z
authors:
- title: Adam Cogan
  url: https://ssw.com.au/people/adam-cogan
related: []
redirects: []

---

Unwanted noises such as people walking and talking can ruin a recording. If you have this problem, the best way to avoid it is to use a recording in progress sign that informs people who are passing through the area that they need to be quite and/or leave the area.
<!--endintro-->

![](RecordingInProgress_BadExample.jpg)Figure: Bad Example - This design does not imply a sense of alert. You need something that is going to catch the attention of people and imply an important message.

![](Recording sign 2.jpg)Figure: Good Example - this implies a sense of urgency, it implies 'we are recording so don't make noise or ruin the shoot in any way', instead of 'we are shooting and it's really cool so come check it out!'.


text:
---
title: Charleston to Bandon Tour Route
description: >-
  A short spur off the Pacific Coast Scenic Byway, this Route showcases a
  glorious stretch of coastline that includes six state parks, two National
  Wildlife Refuges and America’s first National Estuarine Research Reserve.
durations:
  - full-day
  - half-day
towns:
  - charleston
tripadventures:
  - beach
  - lighthouses
  - scenic-drives
  - state-parks-national-lands
image: /img/wave-crash-charleston-bandon-tour.jpg
---
A short spur off the Pacific Coast Scenic Byway, this Route showcases a glorious stretch of coastline that includes six state parks, two National Wildlife Refuges and America’s first National Estuarine Research Reserve.

### To Coos Head

From North Bend, take Cape Arago Highway to Charleston, a working fishing port and a great point of departure for a charter fishing trip. Soon you’ll pass the Oregon Institute of Marine Biology, a teaching and research extension of the University of Oregon, and Coos Head, which offers a fascinating look at the mouth of this dynamic estuary. Driving south, you’ll reach Bastendorff Beach County Park, a popular surfing spot.

### Out to Cape Arago

A series of beautiful state parks awaits you on this stretch of the Route. First stop is Sunset Bay State Park, which features a beach surrounded by sandstone cliffs that shield this favorite swimming cove from the strongest winds and waves. Three mile farther on you’ll reach Shore Acres State Park, which rests upon a bluff that offers sweeping views of the Pacific. The Park was once the site of a grand estate built by lumber baron, Louis B. Simpson; the restored five acre gardens of the Simpson estate, filled with exotic plants from around the world, are open to the public. The road ends at Cape Arago State Park, poised 200 feet above the Pacific. Watch for seals and sea lions in the surf near Simpson Reef, and for migrating whales farther off the coast in the winter. To reach the next leg of the Route, retrace your route for six miles and then turn right on Seven Devils Road.

### Down to the Lighthouse

Driving south, you’ll come to the South Slough National Estuarine Research Reserve, home to many important species including bald eagles, great blue herons, elk and Dungeness crab; it also offers a number of great hiking and paddling trails. A little farther along, you’ll pass some of Bandon’s celebrated cranberry bogs (Bandon is, after all, the unofficial cranberry capital of the Pacific Northwest). Anchoring the southern leg of the Route is the Coquille River Lighthouse, one of Oregon’s most photographed landmarks. The Route skirts the Bandon Marsh National Wildlife Refuge before going along the edge of Old Town Bandon. The southern end of the Route traces the scenic drive along the cliff, with stunning views of sea stacks and surf.

### Want more details?

Order a free  Oregon Scenic Byways guide, or view a map of the Charleston to Bandon Tour Route online. _Sourced from TravelOregon.com_

repository: echopdx/coosbay

repo_name: echopdx/coosbay


text:
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ukanuk_wplangtools&metric=alert_status)](https://sonarcloud.io/dashboard?id=ukanuk_wplangtools)

# wplangtools
 Wikipedia langauge tools: easily extract article titles from Wikipedia across languages

See [siznax/wptools](https://github.com/siznax/wptools) for more comprehensive tools, although that's intended for humans whereas this project is more suitable for automation.

# Install

1. Download `wplangtools.py` and add it to your python path.
  1. One method is opening the Python IDLE interactive interpreter and executing the following commands, changing the directory to wherever you downloaded the file:
  ```python
  >>>import os
  >>>os.chdir(r'D:\Downloads')
  ```
  1. I hear using virtual environments is more secure, so if you know how to set that up please [create an issue and/or pull request](https://github.com/ukanuk/wplangtools/issues).

# Example

On the English Wikipedia, load Korean langauge information for the countries *Artsakh* and *Georgia* and the capital *Nukuʻalofa*. Note that *Republic of Artsakh* is used, as only *Artsakh* forwards to a disambiguation page which does not have the correct translations. The `languages=[]` parameter is optional, but makes the raw pages easier to understand at a glance. Here's a very simple example:

```python
>>> from wplangtools import WpLangTools
>>> WpLangTools('Republic of Artsakh').translate_title(languages=['fr'])
.
[{'fr': ['Haut-Karabagh']}]
```

A more complex example checking multiple pages at once. This is the preferred method as it reduces load on Wikimedia servers by bundling requests together.
```python
>>> test_titles = ['Republic of Artsakh','georgia','a nonexistent title','capital of tonga','georgia']
>>> results = WpLangTools(*test_titles, languages=['ko'])
>>> for page in results.pages:
	print(page)

{'pageid': 1000530, 'ns': 0, 'title': 'Republic of Artsakh', 'langlinks': [{'lang': 'ko', 'title': '아르차흐 공화국'}]}
{'pageid': 17238515, 'ns': 0, 'title': 'Georgia', 'categories': [{'ns': 14, 'title': 'Category:All disambiguation pages'}], 'langlinks': [{'lang': 'ko', 'title': '조지아'}]}
None
{'pageid': 57356, 'ns': 0, 'title': 'Nukuʻalofa', 'langlinks': [{'lang': 'ko', 'title': '누쿠알로파'}]}
{'pageid': 17238515, 'ns': 0, 'title': 'Georgia', 'categories': [{'ns': 14, 'title': 'Category:All disambiguation pages'}], 'langlinks': [{'lang': 'ko', 'title': '조지아'}]}
```

Check whether page(s) are disambiguation pages instead of regular articles.
```python
>>> results.is_disambiguation()
[False, True, False, False, True]
```

Show loaded translations for each title. This function automatically checks for redirects, so for example the `fr` interwiki language link of `Republic of Artsakh` automatically returns *Haut-Karabagh* rather than *République d'Artsakh* directly form the interwiki language link.
```python
>>> results.translate_title()
....
[{'ko': ['아르차흐 공화국']}, {'ko': ['조지아']}, None, {'ko': ['누쿠알로파']}, {'ko': ['조지아']}]
```

To increase performance, you can disable resolving title translations with `resolve=False`.
```python
>>> WpLangTools('Republic of Artsakh').translate_title(languages=['fr'], resolve=False)
[{'fr': "République d'Artsakh"}]
```

repository: ukanuk/wplangtools

repo_name: ukanuk/wplangtools


text:
## Modalio

### A high *and* low-level library to create and manage in-page modals.

**Modalio** is a tiny library to display, generate, embed, populate, queue, stack or asynchronously load content into modals.
It’s super fast and 100% style-free.

I consider it a low-level plugin *and* a high-level one: it can be used *as-is* or extended, styled and customized in behaviour and appearance. In fact, very little default CSS is used, and it’s 100% overridable.

It differs from most other modal libraries because it even allows the injection of *already-in-page* elements, keeping their event bindings, data-properties and edit status (e.g. inputs).

Another really great feature is stacking: three policies are offered (queue|stack|swap), allowing you to open a modal with the default policy, or a per-modal overridden one. This way, you can choose how to handle the opening of multiple modals at once.

### Main features:

- 3 stacking policies offered
- Out-of-DOM persistence: closed modals are detached from DOM to lower memory consumption, but their state is retained for eventual reopening
- Simple templating engine to clone and populate an empty, structured DOM element used as a template
- Flash message support: you can flag a modal to be automatically opened upon page load
- `window.alert()` replacement for quick informational messages
- Messages can be differentiated by tipe. Every message type has a template you can define or extend from the default one
- Automatic Close button injection (configurable and templatable)
- Can be triggered programmatically or via DOM element’s attributes, without needing a single line of javascript
- Asynchronous loading of modal’s content
- Open modal get focused upon opening (even if no input elements are inside it)
- Modals can be closed by clicking on their bezel, on elements flagged to behave like close buttons (via data-attributes), by clicking on ESC or ENTER. Every option is configurable on a per-modal basis
- Page scroll is disabled when a modal is open (retaining current scroll position)
- Tested on IE 10+, FF, Chrome, Safari, Mobile Safari
- Needs jQuery 1.8+
- When a modal is closed, you can choose whether to process the queue stack (eventually opening the next queued modal) or to clear the queue.

### How-to:

Include assets in your page (*before* initializing Modalio):

```html
<link rel="stylesheet" href="modalio.css">
<script src="modalio.js"></script>
```

You have to initialize Modalio *after* document is ready (or by placing `Modalio.init()` in a `script` tag at the very end of your `body` element):

```js
$(document).ready(function(){
	Modalio.init({options});
});
```

You can test Modalio immediately:

```js
Modalio.message('Hello World!');
```


text:
![badge-platforms](https://img.shields.io/badge/platforms-osx,%20gmail-blue.svg)
![badge-languages](https://img.shields.io/badge/languages-bash-orange.svg)
![badge-requirements](https://img.shields.io/badge/requirements-Homebrew,%20curl,%20wget%20%26%20mpack-green.svg)

# Grab Attachments

This script searches for messages in your gmail "Inbox" folder.  For each matching message, it
downloads it's attachments (if any).  After downloading the attachments for all matching
messages, the messages are moved to the DOWNLOAD_DIR folder.  The messages are moved regardless
of whether any attachments are found.

This script has been tested on Mac OS and uses Homebrew.  It can likely be used on other
platforms with a few modifications but will not work as-is.


text:
Exercise 01 - Implementing the ELBO objective and a simple VAE class
====================================================================

Files
-----

Since this is the first exercise, we will start by reviewing the contents of each file.

* run.py - the top-level script to be run from the command line
* vae.py - contains the definition of the `VAE` class
* models.py - functions for creating a `VAE` instance for MNIST and training a model
* latents.py - contains classes for VAE-style reparameterized latent variables
* priors.py - contains classes for prior distributions (over latent variables)
* likelihoods.py - contains classes for log-likelihood reconstruction error

The VAE class
-------------

Conceptually, a VAE contains two parts: the **recognition model** (`Q`) which maps from data to the _parameters_ of a distribution over latent variables, and the **generative model** (`P`) which maps from the latent variables back to the input space. In practice, we break these two parts down into sub-components and keep track of those:

    Input (flattened images)
       |
       |   Q model (neural net)
       V
    Latent parameters   <--   Prior
       |
       |
       V
    Latent sample(s)
       |
       |   P model (neural net)
       V
    Reconstruction

The role of the `VAE` class in `vae.py` is to wrap these components into a single object. That is, it keeps track of enough information to compute the ELBO objective. In this implementation, we will put some of the heavy-lifting into a `Latent` class to simplify the `VAE` class. For now, assume that `Latent` is handling the prior, drawing samples, and computing KL between the latents' posterior and the prior.

**Implement `VAE.elbo()`.** Use the following functions:

* `self.likelihood.log_prob(x)`, which will return the monte-carlo estimate of the log probability of `x` given the reconstruction.
* `self.latent.sample_kl()` which will return the monte-carlo estimate of the KL term described above.
* You may want to use `K.batch_flatten(self.inpt)` to ensure that the input is flattened.

The DiagonalGaussianLatent class
--------------------------------

We are keeping the implementation general, but focusing on a specific type of latent variable: a `dim`-dimensional gaussian random variable with diagonal covariance. In future exercises, we will create an abstract `Latent` base class, but for now `DiagonalGaussianLatent` is the only one.

Our `Latent` class will take `(batch, N)` flattened input, then effectively create two `Dense` layers projecting to a `self.mean` and `self.log_var` parameter for the `dim`-dimensional mean and log-variance of the posterior respectively. Using *log* variance is safe because it can be any real number, which should be easier for the neural net to produce.

`DiagonalGaussianLatent` extends the `Layer` class from keras. When writing custom layers, keras *requires* that the superclass constructor is called in `__init__`. It also requires a `call(self, x)` function and a `compute_output_shape(self, input_shape)` function. Finally, `build(self, input_shape)` is required for all layers that contain trainable weights. A skeleton of each of these functions is provided for you. `log_prob(self, x)` and `sample_kl(self)` are additional functions specific to a `Latent` for a VAE.

Notice that the constructor takes a `prior` as input. We will assume that `prior` is an instance of a class from `priors.py` and has a `log_prob(x)` function.

**Implement `DiagonalGaussianLatent.build`.** This should create two sets of trainable weights: one that projects from inputs to `self.mean` and one that projects from inputs to `self.log_var`. The actual matrix multiplication will happen later - for now, just create the weights.

* The relevant keras function is `Layer.add_weight(...)`, which you can access as `self.add_weight(...)` here.

**Implement `DiagonalGaussianLatent.call`.** This function determines what is actually produced as the output of this layer and passed as input to the next layer. It should do the following:

1. actually compute `self.mean` and `self.log_var` using the weights created in `build` and `K.dot()`
2. draw and store a _reparameterized sample_ of the latent variables using `K.random_normal` with a mean of `0` and `stddev` of `1`.
3. return the sample so it will then be passed into the next part of the model

**Implement `DiagonalGaussianLatent.log_prob(x)`.** This will return the log probability of (a batch of) data points `x` using `self.mean` and `self.log_var`. When used in a neural network, then, `log_prob(x)` will return different values for the same `x` depending on the inputs to the network, since these will affect `self.mean` and `self.log_var`. Useful functions:

* `K.exp()`
* `K.sum(..., axis=-1)`

**Implement `DiagonalGaussianLatent.sample_kl()`.** Recall that KL(Q||P) is defined as `E_Q[ log (Q(x) / P(x)) ]`, or equivalently `E_Q[ log Q(x) - log P(x) ]`. Since this instance of `Latent` defines `Q`, we already have a sample of `x` in `self.sample`. Use this to compute and return the monte-carlo estimate of the KL term that enters into the EBLO (this is not difficult and can be done in one line).

Build and train a model
-----------------------

This is the last step - open `models.py` and **implement the `gaussian_mnist` function.** This will combine all of the parts described above and return an instance of the `VAE` class. The relevant classes from keras have already been imported for you. In my solutions, I used the following architecture:

1. input is assumed to be flattened `(batch, mnist_pixels)` images
2. the Q model has two `Dense` layers with 64 units each and rectified linear activations
3. two-dimensional latent
4. the P model also has `Dense` layers with 64 units each and rectified linear activations, followed by a final `Dense` layer back up to full-pixel resolution with `mnist_pixels` outputs and sigmoid activation.

To train the model, `cd` into `01 - ELBO in keras` and run `python run.py`.

Bonus exercise(s)
-----------------

Here I have assumed a fixed value for `pixel_std=.05` per pixel, but in general the `P` model may output both a mean reconstruction and standard deviation _per pixel_, allowing it to specify some "confidence" about its own output. See `likelihoods.py` - it accepts a vector for `std`.

Try different numbers of layers and/or hidden units in the Q and P models.

Try changing setting `fit_vae(..., optimizer='sgd')`, or `optimizer='rmsprop'` in `run.py`

In `fit_vae`, create your own class that extends keras' [`EarlyStopping` callback](https://github.com/keras-team/keras/blob/76c5b616f2cac0d4d1852049d98ab8a067142373/keras/callbacks.py#L432) so that training automatically stops when validation loss stops improving. It's common when using keras to look inside their source code for help. (Note: you will need to implement your own since the standard `EarlyStopping` class monitors `val_loss` which is a vector, while we want it to monitor `np.mean(val_loss)`).

url: https://raw.githubusercontent.com/satpreetsingh/vae-tutorial/f1a652905c11a06e9c037f0542b6545360d95916/01 - ELBO in keras/instructions.md

repository: satpreetsingh/vae-tutorial

path: /01 - ELBO in keras/instructions.md

repo_name: satpreetsingh/vae-tutorial


text:
# Westwind.AspNetCore Change Log
<small>[Nuget](https://www.nuget.org/packages/Westwind.AspNetCore.Markdown/) • [Github](https://github.com/RickStrahl/Westwind.AspNetCore.Markdown)</small>

### Version 3.10

* **Add .NET 7.0 Target**
Package now supports .NET 7.0, .NET 6.0, .NET 3.1. Dropped support for 5.0 since it's out of support and throws NuGet and validation warnings.

* **Update Markdig Dependency**
Update Markdig to `0.30.4`.

### Version 3.8

* **Add .NET 6.0 Target**
Updated the target frameworks to support .NET 6.0 and leave 5.0 and 3.1 in place as well.

* **Update Markdig 0.28**
Update Markdig dependency to the latest version.

### Version 3.6

* **Add .NET 5.0 Target removed .NET Core 2.1 Target**
Updated the target frameworks to support .NET 5.0 and at the same time remove support for netcoreapp2.1. 1 version back compatibilty update schedule if there are feature differences as there are with 2.1. Removed 2.1 specific code.

* **Add ParseFile() overloads for IFileInfo**
There are now overloads that allow the various `ParseFile` and`ParseFileAsync()` to work with `IFileInfo` objects to allow loading of virtual resources. ([#22](https://github.com/RickStrahl/Westwind.AspNetCore.Markdown/pull/22))

* **Updated to MarkDig 0.24**
Update to latest version of MarkDig.

### Version 3.3.8

* **Add Theme and SyntaxTheme to MarkdownModel**
Added optional `RenderTheme` and `SyntaxTheme` properties to the folder configuration as optional values that are then passed into the page model for rendering. The target application can then optionally take advantage of the themes via code configuration or dynamically at runtime.

### Version 3.3.6

* **Fix: Disk based Page Parsing Bug**
Fix issue with header parsing.

* **Update to MarkDig 1.18.1**
Updating to the latest version of Markdig

* **Project Targeting Cleanup**
Clean up project targeting for the library project for .NET Core 2.1 and 3.0.

### Version 3.3.0

* **Add support for .NET Core 3.0**
Added support for .NET Core 3.0 by re-configuring the projects and conditionally compiling parts of the application. Thanks to Phil Haack for finding and reporting the incompatibility initially.

* **Multi-Targeted for .NET Core 2.1  and 3.0**
The package now works for both .NET Core 2.1 and .NET Core 3.0. Unfortunately due to some fundamental type changes in .NET Core 3.0 this means the packages no longer can target .NET Standard so the targets now are `netcoreapp2.1` and `netcoreapp3.0`.

### Version 3.2.5

* **Update to latest version of MarkDig**
Update to MarkDig 1.17.1 due to breaking API changes in earlier versions in some of the the MarkDig processor configuration signatures.

* **Add NoHttpException to Parse Methods and TagHelper**
Add optional parameter/property to Parse Methods and TagHelper to control how URL retrieved pages are handled if there's no internet connection or the URL isn't available. With NoHttpExceptions set the parser returns null instead of throwing an exception and into the page.

### Version 3.2.4

* **Update Markdig Dependency**
Update MarkDig version due to breaking change with configuration with the newer version (0.16).

* **Remove HtmlAgilityPack Dependency**
Removed the HtmlAgilityPack dependency which was only used for the Markdown URL fixup helper. Replaced with manual parsing code to avoid extra dependency for such a small feature.

### Version 3.2.2

* **Add Support for BaseUrlProcessing for Url Links and Images**
When using the TagHelper with the `url=` option or `Markdown.ParseFromUrl()` you can now optionally specify to fix up relative Markdown links and images using the `url-fixup-baseurl=` and `fixupBaseUrl` property respectively. The default behavior is to fix up paths.

* **Add Support for Title Detection with === underlines**
Added support for title detection when using a double underscore titles within the first 10 lines of text. Title detection uses Yaml title header first, `#` headers next, and double underscore `===` headers last.

### Version 3.2

* **Add support for replacing Markdown Engine**
Added support for an `IMarkdownParserFactory` to create a custom `IMarkdownParserFactory` and `IMarkdownParser` implementation.
The factory can be applied in the configuration via `config.MarkdownParserFactory` in `Startup.ConfigureServices()` of the application.

* **Add support for loading Markdown from a URL**
The Markdown static class and TagHelper now have support for loading Markdown from a URL. `Markdown.ParseFromUrl()` along with async and HtmlStringVersions as well as a `url=` attribute on the TagHelper allow for loading Markdown from a URL.

* **Fix: Trailing Slash Handling for Markdown Extensionless Urls**
Fixed issue where a trailing slash would not render Markdown document if a matching .md file is found.
**Note:** while pages with backslashes now render, the resulting page may not render properly due to an invalid base path.  This is not related to the component but to HTML pathing - the same is true for MVC views for example with releative paths. I highly recommend you don't use a trailinig slash for Markdown Urls to preserve the proper basepath in your document or you ensure `~/` paths in your document.

* **Markdown TagHelper Filename Property**
You can now include Markdown content from the site's file system using the `<markdown>` TagHelper file the `filename` attribute. This makes it easy to break out large text blocks and edit and maintain them easily in your favorite Markdown editor vs. editing inline the HTML content. Note that related resources are **host page relative**, not relative to the Markdown page so plan accordingly for links and image refs.

* **Markdown.ParseFromFile(), ParseFromFileAsync() and .ParseHtmlStringFromFile()**
Like the TagHelper functions above these static methods allow you to load Markdown from a file within the Web site using virtual path syntax (`~/MarkdownFiles/MarkdownPartial.md`). Note that related resources are **host page relative** rather than markdown page relative.

### Version 3.0.36

* **Add better XSS Support for Markdown Parser**
There's now optional, configurable handling for removing `<script>`,`<iframe>`,`<form>` etc. tags, `javascript:` directives, and `onXXXX` event handlers on raw HTML elements in the document. For more info see blog post: [Markdown and Cross Site Scripting](https://weblog.west-wind.com/posts/2018/Aug/31/Markdown-and-Cross-Site-Scripting).

### Version 3.0.25

* **Add Markdown Page Handler**
Added a new page handler that allows dropping of Markdown documents into a folder to be rendered as HTML using a pre-configured HTML template.

gha_language: C#


text:
---
layout: post
title: Why Its Easy To Let Go of Things
date: 2010-09-11 06:35
author: Kevin Olega
comments: true
categories: [Efficient Light and Fast, minimalism]
---
<img src="http://farm5.static.flickr.com/4145/5053063045_18e157c335.jpg" alt="Buendia Corner Makati Ave14-03-08-2324" />

No matter how important or beautiful we think anything is, we must realize that everything is temporary

When I was a kid, I used to think that I should always have enough and enough means lots of it.

_Note from Present day Kevin: When I say enough, I meant resources._

At this point you would say wait, enough of what?

Lots of what?

My answer would be enough of everything from clothes, to stuff, to information, training, etc.

"Pack rat upgrade junkie!"

I call myself.

I used to think this way, most of the time and I realized that, so do most of the people I get to talk to.

When I went for a minimalist lifestyle, I realized that its ok to actually have stuff.

The general rule I keep is, if I use an item regularly, I get to keep said item, but if I see a desk or a corner of my room with clutter beginning to pile up, then I should start to declutter.

I ended up disposing 90% of my stuff in the process and it was fun.

I decided to get rid of my urge to keep more stuff than I need to.

My dark side, which I also refer to as "the hoarder" asked me this question that stopped me in my tracks:

"What should I do if I need something and I don’t have it?"

My answer: Look for it.

Most of the time, the things that we really need are available.

The reality, based on my experience is that if you really need something, you’ll find it.

Instead of keeping and updating a large database of business prospects, just look for new ones and keep the ones that you like.

Although discarding sounds wasteful, keeping too much of anything weighs us down.

The weight slows us down and often distracts us, robbing us of opportunities.

The idea that we need to "keep a lot," stems from our belief that, "there is not enough for everyone."

Matter of fact is, "there is more than enough."

We just feel that we don’t because we hold on too tightly on what we have even if its more of a hassle than its worth.

Try it for a day.

Try it for a week.

Just try it.

Let go.

Here’s a short list of things I’m sure you can find if you look for:

- New prospects.
- New clients.
- Information about topics you need.
- Specific clothes/accessories..
- Inspiration.
- New Ideas.
- Areas of improvement.
- Reasons to smile.
- Blessings in your life.
- Reasons to thank God.

Its ok to declutter and get rid of the unimportant because if you need anything you can find it.

You don't need to worry about the possibility of getting rid of something important by mistake.

When something is important or necessary to your life, it will find itself back to you.

You can borrow or at the very worst, you can buy again.

I would suggest the cheaper alternative of course.

Lighter load leads to a smoother travel.

Don’t be afraid to let go because you can always find what you need.

**Updated Friday, August 24, 2018 and a Note from present day Kevin:**

I only did minor edits and formatting changes to this post.

I feel the same strong feelings that I did when I wrote this post.

After all, the more items I owned, the more of a slave I was to said items.

I'm not a "minimalist" as I'd like, even now, eight years later but I'm grateful that I'm less dependent on things that I own than I was previously.

These days I'm attempting to  everything I own on my [online store][1]so I'm optimized for travel.

It's not always easy to let go of things.

Some attachments to objects and people are really strong.

But when I remember what I wrote here, I'm less afraid to let go.

I'll see you on the next update.

[1]:	https://ph.carousell.com/kevinolega/

repository: kevinolega/minimalchanges

repo_name: kevinolega/minimalchanges


text:
# @livelybone/data-structure
![typescript](https://img.shields.io/badge/typescript-typescript-blue.svg "typescript")

A practice of data structure

## repository
https://github.com/livelybone/data-structure.git

## Run Example
Your can see the usage by run the example of the module, here is the step:

1. Clone the library `git clone https://github.com/livelybone/data-structure.git`
2. Go to the directory `cd your-module-directory`
3. Install npm dependencies `npm i`(use taobao registry: `npm i --registry=http://registry.npm.taobao.org`)
4. Open service `npm run dev`
5. See the example(usually is `http://<IP_ADDRESS>/examples/test.html`) in your browser

repository: livelybone/data-structure

repo_name: livelybone/data-structure


text:
# Overview

Python module to parse and analyze time allocations recorded in a (mostly
free-form) text-based file format.  This provides basic functionality for
reporting time spent on projects while exporting to Pandas DataFrames to
allow more in depth analysis of trends.

The format was borne out of necessity when working on aging RHEL 5 systems that
could not be updated with external software.  Its simplicity and minimal
overhead resulted in more than a decade's worth of allocations to be recorded
across a variety of projects.  This implementation in Python replaced the
original Perl-based implementation that has been since long lost.

repository: gthomsen/time-allocations

repo_name: gthomsen/time-allocations


text:
## Data Science

Five types of command line tools
* Binary Executable: compiled, cannot read
* Shell Builtin: cd, ls eg
* Interpreted Script: has shebang line to tell how to interpret
* shell function: `fac() { (echo 1; seq $1) | paste -s -d\* - | bc; }`
* alias

```bash
# number of numbers containing 3
seq 100 | grep 3 | wc -l

# no trailing newline
echo -n "Hello"

# check first 20 lines of manual
man cat | head -n 20
help cd | head -n 20
```

### Chapter 3

gha_language: HTML


text:
# BeaconKnowledgeMapStatement

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**subject** | [**BeaconKnowledgeMapSubject**](BeaconKnowledgeMapSubject.md) |  |  [optional]
**predicate** | [**BeaconKnowledgeMapPredicate**](BeaconKnowledgeMapPredicate.md) |  |  [optional]
**object** | [**BeaconKnowledgeMapObject**](BeaconKnowledgeMapObject.md) |  |  [optional]
**frequency** | **Integer** | the frequency of statements of the specified relationship within the given beacon  |  [optional]
**description** | **String** | a description of the nature of the relationship  |  [optional]

repository: NCATS-Tangerine/tkbio

branch_name: refs/heads/develop

gha_language: Java

gha_license_id: NOASSERTION

repo_name: NCATS-Tangerine/tkbio


text:
# K-Means clustering

[![Andrew Ng explains Clustering](https://img.youtube.com/vi/hDmNF9JG3lo/0.jpg)](https://youtu.be/hDmNF9JG3lo "Andrew Ng explains Clustering")

> 🎥 Click the image above for a video: Andrew Ng explains clustering

## [Pre-lecture quiz](https://jolly-sea-0a877260f.azurestaticapps.net/quiz/29/)

In this lesson, you will learn how to create clusters using Scikit-learn and the Nigerian music dataset you imported earlier. We will cover the basics of K-Means for Clustering. Keep in mind that, as you learned in the earlier lesson, there are many ways to work with clusters and the method you use depends on your data. We will try K-Means as it's the most common clustering technique. Let's get started!

Terms you will learn about:

- Silhouette scoring
- Elbow method
- Inertia
- Variance

## Introduction

[K-Means Clustering](https://wikipedia.org/wiki/K-means_clustering) is a method derived from the domain of signal processing. It is used to divide and partition groups of data into 'k' clusters using a series of observations. Each observation works to group a given datapoint closest to its nearest 'mean', or the center point of a cluster.

The clusters can be visualized as [Voronoi diagrams](https://wikipedia.org/wiki/Voronoi_diagram), which include a point (or 'seed') and its corresponding region.

![voronoi diagram](images/voronoi.png)

> infographic by [Jen Looper](https://twitter.com/jenlooper)

The K-Means clustering process [executes in a three-step process](https://scikit-learn.org/stable/modules/clustering.html#k-means):

1. The algorithm selects k-number of center points by sampling from the dataset. After this, it loops:
    1. It assigns each sample to the nearest centroid.
    2. It creates new centroids by taking the mean value of all of the samples assigned to the previous centroids.
    3. Then, it calculates the difference between the new and old centroids and repeats until the centroids are stablized.

One drawback of using K-Means includes the fact that you will need to establish 'k', that is the number of centroids. Fortunately the  'elbow method' helps to estimate a good starting value for 'k'. You'll try it in a minute.

## Prerequisite

You will work in this lesson's _notebook.ipynb_ file that includes the data import and preliminary cleaning you did in the last lesson.

## Exercise - preparation

Start by taking another look at the songs data.

1. Create a boxplot, calling `boxplot()` for each column:

    ```python
    plt.figure(figsize=(20,20), dpi=200)

    plt.subplot(4,3,1)
    sns.boxplot(x = 'popularity', data = df)

    plt.subplot(4,3,2)
    sns.boxplot(x = 'acousticness', data = df)

    plt.subplot(4,3,3)
    sns.boxplot(x = 'energy', data = df)

    plt.subplot(4,3,4)
    sns.boxplot(x = 'instrumentalness', data = df)

    plt.subplot(4,3,5)
    sns.boxplot(x = 'liveness', data = df)

    plt.subplot(4,3,6)
    sns.boxplot(x = 'loudness', data = df)

    plt.subplot(4,3,7)
    sns.boxplot(x = 'speechiness', data = df)

    plt.subplot(4,3,8)
    sns.boxplot(x = 'tempo', data = df)

    plt.subplot(4,3,9)
    sns.boxplot(x = 'time_signature', data = df)

    plt.subplot(4,3,10)
    sns.boxplot(x = 'danceability', data = df)

    plt.subplot(4,3,11)
    sns.boxplot(x = 'length', data = df)

    plt.subplot(4,3,12)
    sns.boxplot(x = 'release_date', data = df)
    ```

    This data is a little noisy: by observing each column as a boxplot, you can see outliers.

    ![outliers](images/boxplots.png)

You could go through the dataset and remove these outliers, but that would make the data pretty minimal.

1. For now, choose which columns you will use for your clustering exercise. Pick ones with similar ranges and encode the `artist_top_genre` column as numeric data:

    ```python
    from sklearn.preprocessing import LabelEncoder
    le = LabelEncoder()

    X = df.loc[:, ('artist_top_genre','popularity','danceability','acousticness','loudness','energy')]

    y = df['artist_top_genre']

    X['artist_top_genre'] = le.fit_transform(X['artist_top_genre'])

    y = le.transform(y)
    ```

1. Now you need to pick how many clusters to target. You know there are 3 song genres that we carved out of the dataset, so let's try 3:

    ```python
    from sklearn.cluster import KMeans

    nclusters = 3
    seed = 0

    km = KMeans(n_clusters=nclusters, random_state=seed)
    km.fit(X)

    # Predict the cluster for each data point

    y_cluster_kmeans = km.predict(X)
    y_cluster_kmeans
    ```

You see an array printed out with predicted clusters (0, 1,or 2) for each row of the dataframe.

1. Use this array to calculate a 'silhouette score':

    ```python
    from sklearn import metrics
    score = metrics.silhouette_score(X, y_cluster_kmeans)
    score
    ```

## Silhouette score

Look for a silhouette score closer to 1. This score varies from -1 to 1, and if the score is 1, the cluster is dense and well-separated from other clusters. A value near 0 represents overlapping clusters with samples very close to the decision boundary of the neighboring clusters.[source](https://dzone.com/articles/kmeans-silhouette-score-explained-with-python-exam).

Our score is **.53**, so right in the middle. This indicates that our data is not particularly well-suited to this type of clustering, but let's continue.

### Exercise - build a model

1. Import `KMeans` and start the clustering process.

    ```python
    from sklearn.cluster import KMeans
    wcss = []

    for i in range(1, 11):
        kmeans = KMeans(n_clusters = i, init = 'k-means++', random_state = 42)
        kmeans.fit(X)
        wcss.append(kmeans.inertia_)

    ```

    There are a few parts here that warrant explaining.

    > 🎓 range: These are the iterations of the clustering process

    > 🎓 random_state: "Determines random number generation for centroid initialization."[source](https://scikit-learn.org/stable/modules/generated/sklearn.cluster.KMeans.html#sklearn.cluster.KMeans)

    > 🎓 WCSS: "within-cluster sums of squares" measures the squared average distance of all the points within a cluster to the cluster centroid.[source](https://medium.com/@ODSC/unsupervised-learning-evaluating-clusters-bd47eed175ce).

    > 🎓 Inertia: K-Means algorithms attempt to choose centroids to minimize 'inertia', "a measure of how internally coherent clusters are."[source](https://scikit-learn.org/stable/modules/clustering.html). The value is appended to the wcss variable on each iteration.

    > 🎓 k-means++: In [Scikit-learn](https://scikit-learn.org/stable/modules/clustering.html#k-means) you can use the 'k-means++' optimization, which "initializes the centroids to be (generally) distant from each other, leading to probably better results than random initialization.

### Elbow method

Previously, you surmised that, because you have targeted 3 song genres, you should choose 3 clusters. But is that the case?

1. Use the 'elbow method' to make sure.

    ```python
    plt.figure(figsize=(10,5))
    sns.lineplot(range(1, 11), wcss,marker='o',color='red')
    plt.title('Elbow')
    plt.xlabel('Number of clusters')
    plt.ylabel('WCSS')
    plt.show()
    ```

    Use the `wcss` variable that you built in the previous step to create a chart showing where the 'bend' in the elbow is, which indicates the optimum number of clusters. Maybe it **is** 3!

    ![elbow method](images/elbow.png)

## Exercise - display the clusters

1. Try the process again, this time setting three clusters, and display the clusters as a scatterplot:

    ```python
    from sklearn.cluster import KMeans
    kmeans = KMeans(n_clusters = 3)
    kmeans.fit(X)
    labels = kmeans.predict(X)
    plt.scatter(df['popularity'],df['danceability'],c = labels)
    plt.xlabel('popularity')
    plt.ylabel('danceability')
    plt.show()
    ```

1. Check the model's accuracy:

    ```python
    labels = kmeans.labels_

    correct_labels = sum(y == labels)

    print("Result: %d out of %d samples were correctly labeled." % (correct_labels, y.size))

    print('Accuracy score: {0:0.2f}'. format(correct_labels/float(y.size)))
    ```

    This model's accuracy is not very good, and the shape of the clusters gives you a hint why.

    ![clusters](images/clusters.png)

    This data is too imbalanced, too little correlated and there is too much variance between the column values to cluster well. In fact, the clusters that form are probably heavily influenced or skewed by the three genre categories we defined above. That was a learning process!

    In Scikit-learn's documentation, you can see that a model like this one, with clusters not very well demarcated, has a 'variance' problem:

    ![problem models](images/problems.png)
    > Infographic from Scikit-learn

## Variance

Variance is defined as "the average of the squared differences from the Mean."[source](https://www.mathsisfun.com/data/standard-deviation.html) In the context of this clustering problem, it refers to data that the numbers of our dataset tend to diverge a bit too much from the mean.

✅ This is a great moment to think about all the ways you could correct this issue. Tweak the data a bit more? Use different columns? Use a different algorithm? Hint: Try [scaling your data](https://www.mygreatlearning.com/blog/learning-data-science-with-k-means-clustering/) to normalize it and test other columns.

> Try this '[variance calculator](https://www.calculatorsoup.com/calculators/statistics/variance-calculator.php)' to understand the concept a bit more.

---

## 🚀Challenge

Spend some time with this notebook, tweaking parameters. Can you improve the accuracy of the model by cleaning  the data more (removing outliers, for example)? You can use weights to give more weight to given data samples. What else can you do to create better clusters?

Hint: Try to scale your data. There's commented code in the notebook that adds standard scaling to make the data columns resemble each other more closely in terms of range. You'll find that while the silhouette score goes down, the 'kink' in the elbow graph smooths out. This is because leaving the data unscaled allows data with less variance to carry more weight. Read a bit more on this problem [here](https://stats.stackexchange.com/questions/21222/are-mean-normalization-and-feature-scaling-needed-for-k-means-clustering/21226#21226).

## [Post-lecture quiz](https://jolly-sea-0a877260f.azurestaticapps.net/quiz/30/)

## Review & Self Study

Take a look at Stanford's K-Means Simulator [here](https://stanford.edu/class/engr108/visualizations/kmeans/kmeans.html). You can use this tool to visualize sample data points and determine its centroids. With fresh data, click 'update' to see how long it takes to find convergence. You can edit the data's randomness, numbers of clusters and numbers of centroids. Does this help you get an idea of how the data can be grouped?

Also, take a look at [this handout on k-means](https://stanford.edu/~cpiech/cs221/handouts/kmeans.html) from Stanford.

## Assignment

[Try different clustering methods](assignment.md)