text:
---
layout: page
title: Research
permalink: /research/
order: 2
---

[See my current publications here](/publications)

Broadly, my career has focused on lithium-ion battery lifetime, failure, quality, and reliability,
with an emphasis on data-driven techniques.

## Tesla
As a member of the Cell Qualification team, I worked at the intersection of lab testing, cell production,
and field quality to understand and prevent key lithium-ion battery failure modes.
In addition, my team developed data-driven techniques for characterizing
cell performance, lifetime, quality, and variabiliity.

## Graduate school
As a PhD student in the [Stanford Department of Materials Science and Engineering](https://mse.stanford.edu),
I worked with [Prof. William Chueh](https://chuehlab.stanford.edu) on
**making lithium-ion batteries last longer** and **charge faster.**
My work aimed to combine fundamental and applied approaches to
study battery degradation.

My primary projects included:

1. **Data-driven mehtods for predicting and optimizing battery lifetime during fast charging.**
Fast charging is important for widespread adaptation of electric vehicles, but it
generally reduces battery lifetime.
Multistep charging protocols can achieve both low charging time and high lifetime,
but this optimization problem is expensive due to the long testing time
and large number of experiments required.
In our work, [we first developed machine learning models to predict the final lifetime (1000s of cycles) using data from the first 100 cycles.](/articles/2019/04/09/data-driven.html)
Then, [we used optimal experimental design to efficiently find the highest-lifetime charging protocols.](/articles/2020/02/27/closed-loop-optimization.html)
This work was published in [*Nature*](https://doi.org/10.1038/s41586-020-1994-5)
and [*Nature Energy*](https://doi.org/10.1038/s41560-019-0356-8)
and covered by outlets such as
[*WIRED*](https://www.wired.com/story/ai-is-throwing-battery-development-into-overdrive/)
and the [*WSJ*](https://www.wsj.com/articles/electric-car-batteries-get-a-boost-from-artificial-intelligence-11604422792).

    ![OED](/img/OED_figure.svg)

2. **Characterizing the growth of the
[solid-electrolyte interphase](https://en.wikipedia.org/wiki/Lithium-ion_battery#Electrolytes) (SEI).**
SEI growth is a major degradation mode in lithium-ion batteries.
This process is similar to iron oxidation (i.e. rusting); a surface layer forms that both
consumes material (lithium or iron) and also prevents further growth (termed self-passivation).
We characterized SEI growth via both
[microscopic](/articles/2019/08/20/SEI-cryo.html) and
[electrochemical](/articles/2019/03/01/SEI-electrochem.html) techniques.
Notably, we discovered that the growth of this layer occurs much faster during battery charging
than battery discharging.

    ![SEI](/img/SEI.svg)

repository: petermattia/petermattia

repo_name: petermattia/petermattia


text:
---
layout: post
title: "Normalizing flows for novelty detection in industrial time series data"
date: 2019-06-17 08:52:22
categories: arXiv_AI
tags: arXiv_AI Object_Detection Detection
author: Maximilian Schmidt, Marko Simic
mathjax: true
---

* content
{:toc}

##### Abstract
Flow-based deep generative models learn data distributions by transforming a simple base distribution into a complex distribution via a set of invertible transformations. Due to the invertibility, such models can score unseen data samples by computing their exact likelihood under the learned distribution. This makes flow-based models a perfect tool for novelty detection, an anomaly detection technique where unseen data samples are classified as normal or abnormal by scoring them against a learned model of normal data. We show that normalizing flows can be used as novelty detectors in time series. Two flow-based models, Masked Autoregressive Flows and Free-form Jacobian of Reversible Dynamics restricted by autoregressive MADE networks, are tested on synthetic data and motor current data from an industrial machine and achieve good results, outperforming a conventional novelty detection method, the Local Outlier Factor.

##### Abstract (translated by Google)

##### URL
[http://arxiv.org/abs/1906.06904](http://arxiv.org/abs/1906.06904)

##### PDF
[http://arxiv.org/pdf/1906.06904](http://arxiv.org/pdf/1906.06904)

license: MIT

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
# npm-bug
Demonstrates npm install problem/bug

# steps to reproduce

* `npm install`
* `npm list --depth 0`
* observe how the necessary **lodash** for **redux** is missing

# tried configurations

* `node 6.0.0` with `npm 3.8.9`

license: ISC

repository: AnimiVulpis/npm-bug

repo_name: AnimiVulpis/npm-bug


text:
# Contributing

If you want to contribute to this project, here's a quick guide:
1. Fork the repository
1. Develop your code changes
1. Ensure eslint is happy: `npm run lint`
1. Ensure the tests pass: `npm test`
1. Commit your changes
1. Push to your fork
1. Submit a pull request

## Creating a new map
### Map file
* Name the file `[country].js` in Kebab case. For example: `new-zealand.js`
* Use `Map of [Country]` as `label`
* Adjust the `viewBox` to have no empty space on each side (top, bottom, left, right)
* Use English `name`s by default in `[country].js`
* Create a specific `[country].[lang].js` file to use another language. For example: `taiwan.zh.js`, `france.fr.js`...
* Use semantic `id`s (shortnames or full names in Kebab case). For example: `ny` for New York, `taipei-city` for Taipei City...
* Add the map in `/src/maps/`
* Import and export the map in `/src/index.js`

### Tests
* Add a test in `/__tests__/svg-map.test.js` for this map: `displays map of [Country]` (in alphabetical order)
* Update the snapshots with `npm run build-tests`
* Run ESLint with `npm run lint`
* Run the tests with `npm test`

### Documentation
* Add the country with the list of locations alphabetically sorted in the [existing maps section](https://github.com/VictorCazanave/react-svg-map#existing-maps)

## Reporting a bug
[Open an issue](https://github.com/VictorCazanave/react-svg-map/issues/new).

repository: Brainway-LTD/react-svg-map

gha_language: JavaScript

gha_license_id: MIT

repo_name: Brainway-LTD/react-svg-map


text:
### Exercise 7.06 - Adding metadata to methods

1. Install dependencies with `npm i`.
2. Execute the program with `npx ts-node calculator-metadata.ts`.

repository: MarcosGual/The-TypeScript-Workshop

repo_name: MarcosGual/The-TypeScript-Workshop


text:
---
title: How to implement custom notifications
---
import Prerequisites from '../../connecting_to_your_data/components/prerequisites.jsx'

If you would like to implement custom notifications that include a link to Data Docs, you can access the Data Docs URL for the respective Validation Results page from your Data Context after a validation run following the steps below. This will work to get the URLs for any type of Data Docs site setup, e.g. S3 or local setup.

<Prerequisites>

  - [Set up a working deployment of Great Expectations](../../../tutorials/getting_started/intro.md)
  - [Created an Expectation Suite to use for validation](../../../tutorials/getting_started/create_your_first_expectations.md)

</Prerequisites>

1. First, this is the standard boilerplate to load a Data Context and run validation on a Batch:

    ```python
    import great_expectations as ge

    # Load the Data Context
    context = ge.data_context.DataContext()

    # The batch_kwargs will differ depending on the type of Datasource,
    # see the docs for help
    batch_kwargs = {'table': 'my_table', 'datasource': 'my_datasource'}
    batch = context.get_batch(batch_kwargs, 'my_suite')

    # Run validation on your Batch
    results = context.run_validation_operator(
        "action_list_operator",
        assets_to_validate=[batch],
        run_id='my_run_id')
    ```

2. Next, get the list of IDs of the Validation Results. ``results`` is a list that might have multiple elements if you validate multiple Batches, so we'll have to iterate over it. In this example, we'll just grab the only element:

    ```python
    validation_ids = [res for res in results['run_results']]
    validation_id = validation_ids[0]
    ```

3. Finally, use the ``validation_id`` as an argument to the Data Context's ``get_docs_sites_urls()`` method, and get the right element from the resulting list to access its ``site_url``:

    ```python
    url_dicts = context.get_docs_sites_urls(resource_identifier=validation_id)
    # The method returns a list of dictionaries like so:
    # [{'site_name': 'local_site',
    #  'site_url': 'file://validations/my_suite/my_run_id/20200811T181225.859901Z/123456.html'}]

    # The list will have multiple elements if you have multiple sites set up, e.g.
    # S3 and a local site. In this example, we'll just grab the only element again:
    validation_site_url = url_dicts[0]['site_url']
    ```

4. You can now include ``validation_site_url`` as a link in your custom notifications, e.g. in an email,  which will allow users to jump straight to the relevant Validation Results page.

branch_name: refs/heads/main


text:
## :warning: Plugin moved to Elasticsearch

The HDFS Snapshot/Restore plugin has been [_moved_](https://github.com/elastic/elasticsearch/issues/15191) into Elasticsearch proper.

More information can be found [here](https://www.elastic.co/guide/en/elasticsearch/plugins/master/repository-hdfs.html).


text:
# `@UseMiddleware` Decorator
With the `@UseMiddleware` decorator, you can target [Mandarine-powered middleware](/docs/mandarine/custom-middleware) or [non-component middleware](/docs/mandarine/non-component-middleware) to HTTP handlers or controllers.

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

> `@UseMiddleware` only receives non-component **mandarine** middleware or _Mandarine-powered middleware_. This means, you cannot use external middleware such as Oak middleware.

## Overview
Mandarine provides you with two different types of Middleware: A [Mandarine-powered middleware](/docs/mandarine/custom-middleware) or a non-component middleware with access to the request context. In some scenarios, the _regular expression_ taken by a [Mandarine-powered middleware](/docs/mandarine/custom-middleware) will be enough. Although, this process can perhaps make your code less readable as it grows, for that reason, the `@UseMiddleware` decorator is available.

`@UseMiddleware` decorator allows you to positionate your middleware in the code you are targetting without having to split it in different files or without having to deal with the boilerplate of a regular expression that intercepts a request based on a route. This way, you can have an assumption of what is happening under the hood at a controller level or HTTP handler level at first sight.

## Syntax
Targets: HTTP Handler | Controller
```typescript
@UseMiddleware(middlewareList: Array<NonComponentMiddlewareTarget | any>)
```
- `@UseMiddleware` targets a controller or HTTP handler or a mix of both.
- `@UseMiddleware` executes the list of middleware in the order they were added.
    - If one middleware fails, the rest of them will fail. This means, all middleware must succeed (return true) in order to allow the request to take place.

## Usage

```typescript
export const nonComponentMiddlewareContinueFalse = {
    onPreRequest: (request: Mandarine.Types.CurrentRequest, response: Mandarine.Types.CurrentResponse) => { console.log("OnPreRequest"); return true; },
    onPostRequest: (request: Mandarine.Types.CurrentRequest, response: Mandarine.Types.CurrentResponse) => console.log("OnPostRequest")
}

@Middleware()
export class MyMandarinePoweredMiddleware {
    public onPreRequest(@ResponseParam() response: any): boolean {
        console.log("pre-request()");
        return true;
    }
    public onPostRequest(): void {
        console.log("post-request()");
    }
}

@Controller()
@UseMiddleware([MyMandarinePoweredMiddleware])
export class MyController2 {
    @GET('/hello-world')
    @UseMiddleware([nonComponentMiddlewareContinueFalse, MyMandarinePoweredMiddleware])
    public handler() {
        return "Middleware list passed";
    }
}
```

repository: Fusselwurm/mandarinets

repo_name: Fusselwurm/mandarinets


text:
# RobotFramework-EclipseIDE

RobotFramework-EclipseIDE is an Eclipse IDE plugin for the [Robot Framework test automation tool](https://code.google.com/p/robotframework/)

Robot Framework is a generic test automation framework for acceptance testing and acceptance test-driven development (ATDD). [Acceptance Test-Driven Development](http://testobsessed.com/2008/12/acceptance-test-driven-development-atdd-an-overview/) is a process used to construct executable requirements before the implementation starts.

This plugin helps you to write tests with Robot Framework directly from the comfort of your Eclipse IDE.

## IDE Features

* Support for <code>.txt</code> files using the "two spaces or tab" format
* Syntax coloring
* Hyperlinks to keyword definitions
* Hyperlinks to global variable definitions
* Hyperlinks to resource files
* Hyperlinks to variable files
* Code completion for keyword calls
* Code completion for global variables
* Error checking (experimental)

## Requirements

* Eclipse 3.7+ (earlier might work, untested)

## Installation

See [Installation instructions](/NitorCreations/RobotFramework-EclipseIDE/wiki/Installation).

## Usage

See [Usage](/NitorCreations/RobotFramework-EclipseIDE/wiki/Usage).

repository: pombredanne/RobotFramework-EclipseIDE

repo_name: pombredanne/RobotFramework-EclipseIDE


text:
# Isomorphic Vue
Isomorphic Vue is an opinionated boilerplate for web
development built on top of [Node.js](https://nodejs.org/),
[Express](http://expressjs.com/) and
[Vue 2](https://vuejs.org/), containing modern web development
tools such as [Webpack 3](http://webpack.github.io/), [Babel 6](https://babeljs.io/)
and [Browsersync](http://www.browsersync.io/). Helping you to stay productive
following the best practices. A solid starting point for both professionals
and newcomers to the industry.

[![Build Status](https://travis-ci.org/wujjpp/isomorphic-vue.svg?branch=master)](https://travis-ci.org/wujjpp/isomorphic-vue)

## Features
- [vue 2](https://vuejs.org/)
- [vuex](https://vuex.vuejs.org/)
- [vue-router](https://router.vuejs.org/)
- [vue-server-renderer](https://ssr.vuejs.org)
- [webpack 3](https://webpack.js.org/)
- [babel 6](https://babeljs.io/)
- Support client live reload
- Supports server auto compile and restart
- Support [less](http://lesscss.org/), [sass](https://sass-lang.com/)

## How to Install
```shell
$ git clone https://github.com/wujjpp/isomorphic-vue.git
$ cd isomorphic-vue
$ npm install
```

## How to Run and Build
#### Run
```shell
$ npm start
 ```

#### Build
```shell
$ npm run build
```

#### Run in dist
```shell
$ npm run start:dist
```

#### About CDN
Sometimes, we should host our static files(js,css,image and etc) in CDN, for this case you should change seetings in  `/cdn_config.js`,
for example: if our CDN root is `http://cache.mycdn.com/`, change `//cache.YourCDN.com` to `//cache.mycdn.com`

__/cdn_settings.js__
```javascript
export default {
  dev: {
    publicPath: '/'
  },

  sit: {
    publicPath: '//sitcache.mycdn.com/'
  },

  uat: {
    publicPath: '//uatcache.mycdn.com/'
  },

  prod: {
    publicPath: '//cache.mycdn.com/'
  }
}

```
then use the following command for building, after built, upload the `/build/public` folder to CDN,  thats all.
```shell
$ npm run build -- prod
```
NOTE: double dashes are required and there is a `blank` between `--` and `prod`

## Analyse webpack stats
We have integrated tools for analysing bundled file, after run `npm run build`, try to type the following command in your terminal.

```shell
$ npm run analyse:client
```

```shell
$ npm run analyse:server
```

```shell
$ npm run analyse
```

## About Browsersync
Navigate to [http://localhost:3001](http://localhost:3001) to open Browsersync control panel

## Directory Layout
```
.
├── /public/                     # Static files which are copied into the /build/public folder
├── /src/                        # The source code of the application
│   ├── /components/             # Top level vue components
│   ├── /core/                   # Core module or utility library
│   ├── /routes/                 # Routes or pages
│   │   ├── /apis/               # Backend apis
│   │   ├── /test/               # Example page
│   │   │   ├── /components      # Page level compoment
│   │   │   ├── /images          # Page level images
│   │   │   ├── component.js     # Vue component js
│   │   │   ├── index.vue        # Vue component template
│   │   │   └── style.scss       # Page level style
│   │   └── /xxxx/               # xxxx page
│   ├── /service/                # isomorphic api service interface entry
│   ├── /store/                  # vuex store
│   ├── /styles/                 # Global stylesheets
│   ├── /assets-loader.js        # Loader for loading assets.json
│   ├── /client.js               # Client entry
│   ├── /create-app.js           # Create Vue App
│   ├── /create-router.js        # Create Vue Router
│   ├── /router-api.js           # Attach backended api modules
│   └── /server.js               # Express server app
├── /tests/                      # Unit and end-to-end tests
├── /tools/                      # Build automation scripts and utilities
│   ├── /analyse/                # analyse tools for webpack stats
│   ├── /libs/                   # Library for build system
│   ├── /loaders/                # Custom webpack loader
│   ├── /plugins/                # Custom webpack plugin
│   ├── /webpack/                # Webpack config files
│   ├── /build-client.js         # Scripts for build client app
│   ├── /build-server.js         # Scripts for build server app
│   ├── /build.js                # Scripts for build client and server
│   ├── /clean.js                # Cleans up for the output (build) folder
│   ├── /config.js               # Build config file
│   ├── /copy.js                 # Copy package.json, public folder and assets.json
│   ├── /post.config.js          # Configuration for transforming styles with PostCSS
│   ├── /run.js                  # Helper function for running build automation tasks
│   ├── /start.js                # Launches the development web server with "live reload"
│   └── /watch.js                # watch public folder, if changed copy files to dist/public folder
├── cdn-settings.js              # Config CDN for each ENV
├── entry-settings.js            # Configure client entry for built
├── package.json                 # The list of 3rd party libraries and utilities
└── port-settings.js             # Configure front and backend port for development
```

## How to Update
```shell
$ git checkout master
$ git pull origin master
$ npm install
```

Made with ♥ by Wu Jian Ping

Feel free to contact me if you have any problem [830390<EMAIL_ADDRESS>

repository: wujjpp/isomorphic-vue

repo_name: wujjpp/isomorphic-vue


text:
> The Default theme from Oh My Fish is now avaiable for [Fisher][fisher-link]

## Install

```fish
$ fisher ibstall re3turn/fish-git-util
$ fisher install cbsghost/fisher-omfdefaulttheme
```

## Features

* All the things you need to know about Git in a glance.
* A subtle timestamp hanging out off to the right.
* Previous command status.

## Screenshot

## Configuration

Only display the folder name:
```
  set -g theme_short_path yes
```

# License

[MIT][mit] © [bpinto][author] et [al][contributors]

[mit]:            http://opensource.org/licenses/MIT
[author]:         http://github.com/bpinto
[contributors]:   https://github.com/oh-my-fish/theme-default/graphs/contributors
[fisher-link]:    https://github.com/jorgebucaran/fisher

repository: cbsghost/fisher-omfdefaulttheme

repo_name: cbsghost/fisher-omfdefaulttheme


text:
## Messenger

[![Build Status](https://travis-ci.org/droibit/messenger.svg?branch=develop)](https://travis-ci.org/droibit/messenger) [![](https://jitpack.io/v/droibit/messenger.svg)](https://jitpack.io/#droibit/messenger) [![Software License](https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg)](https://github.com/droibit/messenger/blob/develop/LICENSE.txt)

Library for easy use of the Message API of Android. Especially when using multiple paths, it is freed from many of the branch.

## Download
Add the following code to your build.gradle.

```
allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}

dependencies {
    compile 'com.github.droibit:messenger:3.0.0'
}
```

## License

    Copyright 2015 Shinya Kumagai

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

repository: droibit/messenger

repo_name: droibit/messenger


text:
# Info

This playbook clones git repos to the remote hosts and sets the folders and files privileges

Currently, it supports:
+ angular framework
  + it builds code for final deployment server

# Run

First you need to set the proper JSON file.

There are few now:

+ local_builds-list-litterra.json
+ local_builds-list-psc.json

rename one of them into `local_builds-list.json`

```sh
ansible-playbook -i variables/hosts.yaml -e 'ansible_ssh_user=orchestrator' --private-key ~/.ssh/orchestration-iaas-no.pem --extra-vars '{"active_hosts_groups": ["litterra"]}' playbooks/local_builds.yml
```

# Examples

```json
    // build Angular frontend app
    {
        // name of the dashboard
        "key": "litterra-dashboard",
        // local path to the dashboard
        "path": "../../../../infrastructure-2/semanticMediator/src/frontend/apps/ace-mediator/",
        // online path (deeplink) to the dashboard
        "basehref": "/dashboard/",
        // only for `colaboflow` tag or general (non-tags provided)
        "_tags": [
            "colaboflow"
        ]
    }
```


text:
### Binary Tree

| Binary Tree Methods               | Functionality                                                                                |
|-----------------------------------|---------------------------------------------------------------------------------------------------------------|
| `inOrder(List<Long>, Node node)`  | Returns a `List<Long>` holding the value of all Nodes in the tree ordered Left Branches, root, Right Branches |
| `preOrder(List<Long>, Node node)` | Returns a `List<Long>` holding the value of all Nodes in the tree ordered Node, Left Branches, Right Branches |
| `postOrder(List<Long>, Node node)`| Returns a `List<Long>` holding the value of all Nodes in the tree orderd Left Branches, Right Branches, Root  |
| `BFSOrder()`                      | Prints to the console every node in the tree following a left to right, breadth first approach                |
| `findMaxBTree()`                  | Returns an int value matching the highest value in the tree.                                                  |

| Binary Search Tree Methods  | Functionality                                                                                |
|-----------------------------|-------------------------------------------------------------------------------------------------------------------------------|
| `add(int value)`            | Adds a node with value int as a leaf on the appropriate branches                                                              |
| `contains(int target)`      | Searchs the Binary Search Tree for a int value                                                                                |
| `generate()`                | Generates a Binary Search Tree with value 0-100. I made this just to reduce how much I had to manually fill a tree            |
| `FizzBuzz(BinarySearchTree)`| Transforms a Binary Search Tree into a FizzBuzz Tree where factors of 3 are now Fizz, 5 are now Buzz, and 15 are now FizzBuzz |

### Research
https://codereview.stackexchange.com/questions/60145/which-fizzbuzz-is-better-and-why

Looking for how to get a Java Object to hold either a String or int, and still be able to compare it, I found the above resource which
has the super optimized switch case solution with a standard array based fizzbuzz

https://www.geeksforgeeks.org/level-order-tree-traversal/

I could not conceptualize how a BFS would work in my head, the above resource was very helpful in getting me into the realm of understanding
### Assets
[FizzBuzzTree Whiteboard](https://github.com/MichaelJahns/codeChallenges/blob/master/java/src/assets/FizzBuzz.jpg)

[BreadthFirstTravesals Whiteboard](https://github.com/MichaelJahns/codeChallenges/blob/master/java/src/assets/BreadthFirstTravesal.jpg)

[FindMaxValueBinaryTree Whiteboard](https://github.com/MichaelJahns/codeChallenges/blob/master/java/src/assets/findMaxValueBTree.jpg)

repository: MichaelJahns/codeChallenges

gha_language: Java

repo_name: MichaelJahns/codeChallenges


text:
# Use Devise for authentication

**Date: 2020-11-16**

## Status

**Decided**

## Parties Involved

 * Alex Bowen
 * Cesidio Di Landa
 * Christian Sutter
 * Connor McQuillan
 * David Mears
 * Davide Dippolito
 * Joe Hull

## Context

Teaching Vacancies will soon start to develop a new set of features which ultimately will allow job seekers to apply for jobs directly on the TVS website.

This feature constitutes an important milestone for the service and will require job seekers users to create accounts to manage their job applications. Account functionality will permit teachers to initiate web sessions on TVS website as well as manage their account (password resets, email verification and account closing).

## Options considered

| Name      | Link                                     | Notes                                                                                |
| --------- | ---------------------------------------- | ---------------------------------------------------------------------------------------- |
| Devise    | https://github.com/heartcombo/devise     | Widely adopted in the Ruby on Rails community. Easily available documentation and features covering most TVS needs |
| Clearance | https://github.com/thoughtbot/clearance  | Easy to integrate and configure, not as feature rich as Devise                           |
| Authlogic | https://github.com/binarylogic/authlogic | Little support                                                                                |
| Rodauth   | https://github.com/jeremyevans/rodauth   | Scarcely adopted                                                                                |

**Note:**

The team considered the pros and cons of adopting a "in house" build strategy opposed to buying and integrating with off the shelf solutions. You can read more about it [in this document](https://docs.google.com/document/d/1bhdvsP4EDoFVO3FAhH-0ECoBBS6xPjf8thzpD1ay3b0)
## Decision

TVS will adopt Devise as authentication library.

## Considerations and consequences

Devise is the de facto standard solution for Ruby on Rails applications. It has been already successfully adopted by other teams within DfE
* https://github.com/DFE-Digital/apply-for-teacher-training
* https://github.com/DFE-Digital/childrens-social-care-placement
* https://github.com/DFE-Digital/npd-find-and-explore

It provides plug-in modules to better refine authentication options allowing storing encrypted passwords, support for Omniauth providers, passwords recovery and so on.

Given its modular structure, it's fairly straightforward to isolate code relative to authentication. This allows a painless transition to a different solution in case TVS would want to evaluate a SaaS option in case the department wants to adopt a more strategical approach to authentication for job seekers.

repository: RoseMackworth/teaching-vacancies

repo_name: RoseMackworth/teaching-vacancies


text:
[![Build Status](https://badge.buildkite.com/5945b9820092260cdc05fc0c736f50df313e15929dd0c864c4.svg?branch=master)](https://buildkite.com/prysmatic-labs/go-ssz)
[![codecov](https://codecov.io/gh/prysmaticlabs/go-ssz/branch/master/graph/badge.svg)](https://codecov.io/gh/prysmaticlabs/go-ssz)
[![Documentation](https://godoc.org/github.com/prysmatic-labs/go-ssz?status.svg)](http://godoc.org/github.com/prysmatic-labs/go-ssz)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/prysmaticlabs/geth-sharding?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

# Simple Serialize (SSZ)
Simple Serialize is the serialization algorithm standard for all data structures common across Ethereum 2.0 client implementations. It is outlined in the official [Ethereum 2.0 specification](https://github.com/ethereum/eth2.0-specs/blob/master/specs/simple-serialize.md).

## Functionality

### Marshal & Unmarshal
Our simple serialize API is designed to match the syntax of the popular JSON [marshal](https://golang.org/pkg/encoding/json/#Marshal) / [unmarshal](https://golang.org/pkg/encoding/json/#Unmarshal) API from the [Go](https://golang.org) standard library. Below are samples of each in use:

`marshal` example:
```go
// Marshal val and output the result.
func Marshal(val interface{}) ([]byte, error)
```
`unmarshal` example:
```go
// Unmarshal data from input and output it into the object pointed by pointer val.
func Unmarshal(input []byte, val interface{}) error
```
## Usage examples
**Notice:** SSZ supports `bool`, `uint8`, `uint16`, `uint32`, `uint64`, `slice`, `array`, `struct` and `pointer` data types.

### Encoding an object (Marshal)

1. To begin, we create this basic struct:

```go
type exampleStruct1 struct {
    Field1 uint8
    Field2 []byte
}
````

2. Next, we can encode the defined object like so:

```go
e1 := exampleStruct1{
    Field1: 10,
    Field2: []byte{1, 2, 3, 4},
}
encoded, err := Marshal(e1)
if err != nil {
    return fmt.Errorf("failed to marshal: %v", err)
}
```

### Decoding an object (Unmarshal)

1. Similarly, you can `unmarshal` encoded bytes into its original form:

```go
var e2 exampleStruct
if err = Unmarshal(encoded, &e2); err != nil {
    return fmt.Errorf("failed to unmarshal: %v", err)
}
reflect.DeepEqual(e1, e2) // Returns true as e2 now has the same content as e1.
```

## Contributing
We have put all of our contribution guidelines into [CONTRIBUTING.md](https://github.com/prysmaticlabs/prysm/blob/master/CONTRIBUTING.md)! Check it out to get started.

## License

Brought to you by [Prysmatic Labs](https://prysmaticlabs.com) with a permissive [Apache License 2.0](license.md).

repository: leofisG/go-ssz

repo_name: leofisG/go-ssz


text:
# MachineLearning-BigData-Project
The first part of this project is about providing a GUI that interfaces with a custom implementation of a HashTable Algorithm, different similarity metrics used in big data analytics and machine learning, and very large data sets from the Kepler Object API. The GUI will allow the user to display all the Kepler Objects of Interest, display only Kepler Objects of Interest with selected features, or finding the most similar Kepler Object of Interest to the one selected. An additional feature was also added to find the 2 most similar Kepler Objects of Interest in the entire data set if needed.

The second part of this project is about implementing a custom persistent BTree structure as well as a hash-based cache, interfacing it with the current state of the program and utilize k-means-clustering and z-score normalization to display the clustering of the data to the user. The user may then select the number of clusters they want to make and which ones they want to see.
# Instructions After Downloading
```
---> cd 365
---> gradlew run
```

## Project Decomposition
### Assignment One
Task Number | Task Title | COMPLETED
----------- | ---------- | ---------
1 | Find An Online API For Keyed Data | X
2 | Implement A Custom HashTable Class | X
3 | Create Classes For The Data Being Modeled | X
4 | Parse The Online Data Through The API | X
5 | Create A GUI To Display The Data | X
6 | Implement Similarity Metrics For The Data | X
7 | Edit The GUI To Take A Key And Display The Most Similar Piece Of Data | X

### Assignment Two
Task Number | Task Title | COMPLETED
----------- | ---------- | ---------
1 | Create A Hash-Based Cache For The Data | X
2 | Create A Persistent BTree Class Of Keys, With Values In A Separate Persistent Structure Or Files | X
3 | Preload At Least 1000 Key-Value Pairs | X
4 | Pre-Categorize Keys Into Clusters Using K-Means Clustering Or A Similar Metric | X
5 | Edit The GUI To Display The Clustering Of The Objects In The Data | X

## Latest Stable Copy
[Class Project Zip](http://cs.oswego.edu/~kzeller/Portfolio/coursework/csc365/MachineLearning-BigData-Project.zip)


text:
---
home: true
heroText: flowter
tagline: Flowchart made in Vue
footer: MIT Licensed | Copyright © 2019-present briwa
---

<div style="display: flex; justify-content: center;">
  <flowcharts-home />
</div>

## Quick start

``` bash
## install the package
npm install --save @flowter/flowchart
```

``` javascript
// somewhere in your entry file
import '<EMAIL_ADDRESS>import Flowchart from '@flowter/flowchart'

Vue.component('flowchart', Flowchart)
```

<<< @/docs/.vuepress/components/flowcharts/home.vue

repository: briwa/flowter

gha_language: TypeScript

repo_name: briwa/flowter


text:
# arm-templator-transpiler (prototype)

## Testing
Run the following to watch a .arm file and create a same-named .json whenever there are changes:

```
npm install
npm run watch <path to .arm file>
```

e.g. the following will watch `tests/basic.arm` file and transpile to `tests/basic.json` when changes are detected:
```
npm install
npm run watch tests/basic.arm
```

## Syntax highlighting
Copy the `vscode-armlang` folder into your [VSCode extension folder](https://vscode-docs.readthedocs.io/en/stable/extensions/install-extension/#your-extensions-folder).

## Language changes
1. Edit `src\antlr4\ArmLang.g4`.
2. Run `npm run antlr` to compile and generate Typescript.

repository: jorgecotillo/arm-templator-transpiler

repo_name: jorgecotillo/arm-templator-transpiler


text:
---
title: Tilesets
description: Learn how to draw tiles from a tileset image
next_topic: text
layout: learn
---

Tilesets are images containing multiple unique tiles. These tiles can be drawn to the screen multiple times in interesting combinations to produce things like backgrounds or draw larger objects.

Let's start with the 2x2 tileset below which has with 4 different tiles:

Each tile is 84 pixels tall and wide so this is what we'll set our tile width and height to be. The tileset image has a 1 pixel padding around the entire image and a 2 pixel spacing between each tile, so we'll set those values as well. Let's define our tileset using our image:

```ruby
tileset = Tileset.new(
  'tileset.png',
  tile_width: 84,
  tile_height: 84,
  padding: 1,
  spacing: 2,
)
```

Now that our tileset is defined we can define our individual tiles by giving them a name and specifying their x and y co-ordinates, here we go:

```ruby
tileset.define_tile('red', 0, 0)
tileset.define_tile('blue', 1, 0)
tileset.define_tile('green', 0, 1)
tileset.define_tile('purple', 1, 1)
```

Now that we have defined some tiles we can draw them to the screen. Let's draw our blue and red tiles:

```ruby
tileset.set_tile('blue', [
    { x: 0,  y: 0 },
    { x: 84, y: 0 },
    { x: 0,  y: 84 }
])

tileset.set_tile('red', [
    { x: 84,  y: 84 }
])
```

Our tiles now look like this drawn to the screen:

One more thing we can do with tilesets is scale/rotate and flip them.

### Scaling

We can scale all of our tiles by specifying the scale attribute (default: 1) on our tileset:

```ruby
tileset = Tileset.new(
  'tileset.png',
  tile_width: 84,
  tile_height: 84,
  padding: 1,
  spacing: 2,
  scale: 2
)
```

By setting our scale to 2, each tile will be drawn with twice the width and height, in our example that would result in 168x168 pixel tiles

### Rotating

We can rotate our tiles by setting the `rotate` attribute when defining them

```ruby
tileset.define_tile('red', 0, 0, rotate: 90)
```

### Flipping

We can set the `flip` attribute to flip our tiles. It can either be set to `horizontal`, `vertical` or `both`

```ruby
tileset.define_tile('red', 0, 0, flip: :both)
```

Continue to the [next topic ▸](/learn/{{ page.next_topic }})

gha_language: SCSS


text:
# rcr/stata Stata package for RCR

This folder contains the Stata package and its supporting files:

  - stata.toc
  - rcr.pkg
  - rcr.ado
  - rcr_estat.ado
  - rcr_gnu.ado
  - rcr_predict.ado
  - rcrplot.ado
  - test_betax.ado
  - rcr.hlp
  - rcr_postestimation.hlp
  - rcrplot.hlp
  - test_betax.hlp
  - rcr_example.do
  - rcr_example.dta
  - installation.do

## Installing the package from Stata

Instructions so be added.

## Installing the package by hand

Instructions to be added.

repository: arlionn/rcr

repo_name: arlionn/rcr


text:
# JobEvent

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**flags** | **String** | Event flags. |
**fmtType** | **String** | A string representation of the type of the data value. |
**id** | **Integer** | Job event ID. |
**jobId** | **Integer** | Job ID. |
**jobType** | **String** | Job Type. |
**key** | **String** | Event key name. |
**phase** | **Integer** | Job phase number at time of event. |
**rawType** | **Integer** | An integer representation of the type of the data value. |
**time** | **Integer** | Time of event in Unix epoch seconds. |
**value** | **String** | Event value. |  [optional]


text:
# `<myuw-search>`

## Getting Started

Add the following import to your page's `<head>`:

```html
<script type="module" src="https://unpkg.com/@myuw-web-components/myuw-search@^1?module"></script>
<script nomodule src="https://unpkg.com/@myuw-web-components/myuw-search@^1"></script>
```

**Important:** For responsive features to work properly, ensure your application includes the viewport meta tag:

```html
<meta name="viewport" content="width=device-width, initial-scale=1">
```

Use the component's HTML tag wherever you want:

```html
<myuw-search
    input-label="Search MyUW"
    button-label="Submit search"
    icon="search">
</myuw-search>
```

Listen for the `myuw-search` CustomEvent and process the value how you like:

```js
/*
    1. Listen for myuw-search event
    2. Get the event data from event.detail.value
    3. Do what you want with the search term!
*/
document.body.addEventListener('myuw-search', (event) => {
  var valueFromSearchBar = event.detail.value // "detail" object is part of CustomEvent spec
  /*
    Perform search logic here. For example:
      - Pass the search value as a parameter to your app's search page
  */
}, false );
```

### Configurable properties via attributes

- **inputLabel (input-label)**: Text to use in the aria-label and placeholder of the search field
- **buttonLabel (button-label)**: Text to use for the aria-label of the search button
- **icon (icon)**: Text name of the material icon to use for the submit button ("search" by default)

### Custom CSS properties

- **--myuw-search-border**: Used to set the border color of the search component (to support themes with light background colors). Defaults to `none`.
- **--myuw-app-bar-color**: Used by to set the color of the search button icon on small screens. Defaults to white.

## Development and contribution

To run the demo app locally and test the component, run the following commands:

```bash
$ npm install
$ npm start
```

Cross-browser testing provided by:

repository: davidmsibley/myuw-search

repo_name: davidmsibley/myuw-search


text:
# StopWatch

Create a simple stopwatch app where user can start, stop, cycle and reset times.

## Features

- [ ] As a User I can start watch
- [ ] As a User I can stop watch
- [ ] As a User I can reset watch
- [ ] As a User I can loop watch (time keeps running, but time interval is marked)
- [ ] As a User I can see list of looped times in a scrollable list below watch

repository: Bobleyl/flutter-app-ideas

repo_name: Bobleyl/flutter-app-ideas


text:
# bm-uploader.js

This library wraps the blob uploader service [Blob uploader](https://github.com/blinkmobile/blob-uploader) and AWS S3 to allow uploading and retrieval of content from S3 without having to work with AWS credentials and the AWS SDK directly.

## Usage
1.  Initialise the BMUploader with the URL of the blob uploader service, e.g.
```
const bmUploader = new BMUploader('https://bm-blob-uploader-dev.api.blinkm.io/')
```
2.  To upload content (where that content is either a buffer, blob or stream) call bmUploader.UploadContent which supports a progress event, cancellation and will adjust to network conditions. This function takes as parameters the content to be uploaded and a function that will be called with a progress event(OPTIONAL). This will return a Promise that will resolve with an object that includes the id that can be used later to retrieve the content, a function upload() which returns a promise that will resolve when the upload succeeds or rejects if the upload fails or is stopped, and a function cancel() that will abort the upload. The progress function will called with two parameters, uploaded (number of bytes uploaded) and total(number of bytes being uploaded)
```
function progressFn (uploaded, total) {
  const percentage = parseInt((uploaded * 100) / total)
  // update progress indicator
}

function cancelOnClick() {
  if (cancelFn) {
    cancelFn()
  }
}

let cancelFn

bmUploader.uploadContent(content, progressFn)
  .then((uploader) => {
    cancelFn = uploader.cancel
    return uploader.upload()
      .then(() => {
        cancelFn = undefined
        //store uploader.id or use to retrieve a GET URL as per step 3 below
      })
  })
  .catch((err) => //error handling)
```
3.  To retrieve a URL to the content in S3, call bmUploader.retrieveContentUrl. This will return a Promise that will resolve to a URL that can be used with HTTP GET to retrieve the content.
```
bmUploader.retrieveContentUrl(id)
  .then((getUrl) => //use HTTP GET to retrieve content)
```

## Example
See [Example](../example/index.html) of using the library for uploading blobs(files in this example)


text:
# Nerual Architecture Search for Image Classification

This tutorial shows how to use [API](https://paddleslim.readthedocs.io/en/latest/api_en/paddleslim.nas.html) about SANAS in PaddleSlim. We start experiment based on MobileNetV2 as example. The tutorial contains follow section.

1. necessary imports
2. initial SANAS instance
3. define function about building program
4. define function about input data
5. define function about training
6. define funciton about evaluation
7. start search
  7.1 fetch model architecture
  7.2 build program
  7.3 define input data
  7.4 train model
  7.5 evaluate model
  7.6 reture score
8. full example

The following chapter describes each steps in order.

## 1. import dependency
Please make sure that you haved installed Paddle correctly, then do the necessary imports.
```python
import paddle
import paddle.nn as nn
import paddle.nn.functional as F
import paddle.static as static
import paddleslim as slim
import numpy as np
```

## 2. initial SANAS instance

Please set a unused port when build instance of SANAS.
```python
port = np.random.randint(8337, 8773)
sanas = slim.nas.SANAS(configs=[('MobileNetV2Space')], server_addr=("", port), save_checkpoint=None)
```

## 3. define function about building program
Build program about training and evaluation according to the model architecture.
```python
paddle.enable_static()
def build_program(archs):
    train_program = static.Program()
    startup_program = static.Program()
    with static.program_guard(train_program, startup_program):
        data = static.data(name='data', shape=[None, 3, 32, 32], dtype='float32')
        label = static.data(name='label', shape=[None, 1], dtype='int64')
        gt = paddle.reshape(label, [-1, 1])
        output = archs(data)
        output = static.nn.fc(output, size=10)

        softmax_out = F.softmax(output)
        cost = F.cross_entropy(softmax_out, label=gt)
        avg_cost = paddle.mean(cost)
        acc_top1 = paddle.metric.accuracy(input=softmax_out, label=gt, k=1)
        acc_top5 = paddle.metric.accuracy(input=softmax_out, label=gt, k=5)
        test_program = static.default_main_program().clone(for_test=True)

        optimizer = paddle.optimizer.Adam(learning_rate=0.1)
        optimizer.minimize(avg_cost)
        place = paddle.CPUPlace()
        exe = static.Executor(place)
        exe.run(startup_program)
    return exe, train_program, test_program, (data, label), avg_cost, acc_top1, acc_top5
```

## 4. define function about input data
The dataset we used is cifar10, and `paddle.dataset.cifar` in Paddle including the download and pre-read about cifar.
```python
import paddle.vision.transforms as T

def input_data(image, label):
    transform = T.Compose([T.Transpose(), T.Normalize([127.5], [127.5])])
    train_dataset = paddle.vision.datasets.Cifar10(mode="train", transform=transform, backend='cv2')
    train_loader = paddle.io.DataLoader(train_dataset,
                    places=paddle.CPUPlace(),
                    feed_list=[image, label],
                    drop_last=True,
                    batch_size=64,
                    return_list=False,
                    shuffle=True)
    eval_dataset = paddle.vision.datasets.Cifar10(mode="test", transform=transform, backend='cv2')
    eval_loader = paddle.io.DataLoader(eval_dataset,
                    places=paddle.CPUPlace(),
                    feed_list=[image, label],
                    drop_last=False,
                    batch_size=64,
                    return_list=False,
                    shuffle=False)
    return train_loader, eval_loader
```

## 5. define function about training
Start training.
```python
def start_train(program, data_loader):
    outputs = [avg_cost.name, acc_top1.name, acc_top5.name]
    for data in data_loader():
        batch_reward = exe.run(program, feed=data, fetch_list = outputs)
        print("TRAIN: loss: {}, acc1: {}, acc5:{}".format(batch_reward[0], batch_reward[1], batch_reward[2]))
```

## 6. define funciton about evaluation
Start evaluating.
```python
def start_eval(program, data_loader):
    reward = []
    outputs = [avg_cost.name, acc_top1.name, acc_top5.name]
    for data in data_loader():
        batch_reward = exe.run(program, feed=data, fetch_list = outputs)
        reward_avg = np.mean(np.array(batch_reward), axis=1)
        reward.append(reward_avg)
        print("TEST: loss: {}, acc1: {}, acc5:{}".format(batch_reward[0], batch_reward[1], batch_reward[2]))
    finally_reward = np.mean(np.array(reward), axis=0)
    print("FINAL TEST: avg_cost: {}, acc1: {}, acc5: {}".format(finally_reward[0], finally_reward[1], finally_reward[2]))
    return finally_reward
```

## 7. start search
The following steps describes how to get current model architecture and what need to do after get the model architecture. If you want to start a full example directly, please jump to Step 9.

### 7.1 fetch model architecture
Get Next model architecture by `next_archs()`.
```python
archs = sanas.next_archs()[0]
```

### 7.2 build program
Get program according to the function in Step3 and model architecture from Step 7.1.
```python
paddle.enable_static()
exe, train_program, eval_program, (image, label), avg_cost, acc_top1, acc_top5 = build_program(archs)
```

### 7.3 define input data
```python
train_loader, eval_loader = input_data(image, label)
```

### 7.4 train model
Start training according to train program and data.
```python
start_train(train_program, train_loader)
```
### 7.5 evaluate model
Start evaluation according to evaluation program and data.
```python
finally_reward = start_eval(eval_program, eval_loader)
```
### 7.6 reture score
```
sanas.reward(float(finally_reward[1]))
```

## 8. full example
The following is a full example about neural architecture search, it uses FLOPs as constraint and includes 3 steps, it means train 3 model architectures which is satisfied constraint, and train 7 epoch for each model architecture.
```python
for step in range(3):
    archs = sanas.next_archs()[0]
    exe, train_program, eval_program, (images,label), avg_cost, acc_top1, acc_top5 = build_program(archs)
    train_loader, eval_loader = input_data(images, label)

    current_flops = slim.analysis.flops(train_program)
    if current_flops > 6555276:
        continue

    for epoch in range(7):
        start_train(train_program, train_loader)

    finally_reward = start_eval(eval_program, eval_loader)

    sanas.reward(float(finally_reward[1]))
```

repository: PaddlePaddle/PaddleSlim

branch_name: refs/heads/develop

gha_language: Python

repo_name: PaddlePaddle/PaddleSlim


text:
# Install the Open Horizon Agent (Anax) on OSX

This page describes the installation of the Open Horizon Agent (Anax) on OSX. These instructions have been tested with **Catalina** version.

> This installation should be done on a separate machine than that of Open Horizon hub to avoid environment variable and port collisions.

## Pre-requisites

1. Install the `brew` package manager if not installed already.

``` bash
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```

2. Install `wget` and `socat` utilities.

```bash
brew update
brew upgrade
brew install wget
brew install socat
```

3. [Get and install](https://docs.docker.com/docker-for-mac/install/) Docker

``` bash
wget https://download.docker.com/mac/stable/Docker.dmg
```

4. Test after install

``` bash
docker --version
```

The response should be similar to the following:

```bash
Docker version 19.03.5, build 633a0ea
```

Check if Docker daemon is running with `docker info`. Look for value of `Running` in `Server` section. The output should look like this.

```bash
Client:
 Debug Mode: false

Server:
 Containers: 22
  Running: 1
  Paused: 0
  Stopped: 21
 Images: 71
 Server Version: 19.03.5
...
```

## Installation

1. Download and install the certificate for Agent

``` bash
wget http://pkg.bluehorizon.network/macos/certs/horizon-cli.crt
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain horizon-cli.crt
```

2. Download and install the Agent

_Can we look-up version number for `horizon-cli`?_

``` bash
wget http://pkg.bluehorizon.network/macos/horizon-cli-2.24.18.pkg
sudo installer -pkg "horizon-cli-2.24.18.pkg" -target /
```

The output of running the command should look something like this:

```bash
installer: Package name is horizon-cli-2.24.18
installer: Installing at base path /
installer: The install was successful.
```

## Configure Open Horizon Agent (Anax)

1. Create a file at `/etc/default/horizon`

``` bash
sudo mkdir -p /etc/default
sudo touch /etc/default/horizon
```

2. Add the following contents to `/etc/default/horizon`. Replace `x.x.x.x` with the actual IP address of the machine running the Open Horizon Hub Services.

```bash
HZN_EXCHANGE_URL=http://x.x.x.x:3090/v1/
HZN_FSS_CSSURL=http://x.x.x.x:9443
```

## Run the Open Horizon Agent (Anax)

1. Start the Open Horizon Agent (Anax) using the command below. It will start the Open Horizon Agent (Anax) with default file as `/etc/default/horizon` and index number as 1.

_Start with a different file without index_

``` bash
horizon-container start
```

The output should look like this.

```bash
Starting socat to listen on port 2375 and forward it to the docker API socket...
latest: Pulling from openhorizon/amd64_anax
3b37166ec614: Pull complete
504facff238f: Pull complete
....
b487343afe3e: Pull complete
Digest: sha256:ed73ca95f2550acf8b1947c822e17011ca4ac45ac84a7f1d983ee82dc7693bc3
Status: Downloaded newer image for openhorizon/amd64_anax:latest
docker.io/openhorizon/amd64_anax:latest
Starting the Horizon agent container openhorizon/amd64_anax:latest...
6374638aed9f702722ca3f6a7ccf4528dbbc6236ead153ffe7724526cbbfe052
Horizon agent started successfully. Now use 'hzn node list', 'hzn register ...', and 'hzn agreement list'
```

4. If you had a previous version already installed, then update the Open Horizon Agent (Anax) and restart with the commands below.

``` bash
horizon-container update
horizon-container restart
```

5. Check version after installation

Check version with the command below.

``` bash
hzn version
```

Output:

```bash
Horizon CLI version: 2.24.18
Horizon Agent version: 2.24.18
```

6. Check the list of nodes after installation

```bash
hzn node list
```

Output:

```json
{
  "id": "",
  "organization": null,
  "pattern": null,
  "name": null,
  "token_last_valid_time": "",
  "token_valid": null,
  "ha": null,
  "configstate": {
    "state": "unconfigured",
    "last_update_time": ""
  },
  "configuration": {
    "exchange_api": "http://54.xxx.xxx.xxx:3090/v1/",
    "exchange_version": "",
    "required_minimum_exchange_version": "2.11.1",
    "preferred_exchange_version": "2.11.1",
    "mms_api": "http://54.xxx.xxx.xxx:9443",
    "architecture": "amd64",
    "horizon_version": "2.24.18"
  },
  "connectivity": {
    "firmware.bluehorizon.network": true,
    "images.bluehorizon.network": true
  }
}
```

Look at the value of `exchange_api` in `configuration` in the output of `hzn node list`. (If you have `jq` installed, then you can get this value directly with this command `hzn node list | jq -r .configuration.exchange_api`.) The value should match with what was added in `/etc/default/horizon`.

_Any way to check from the Hub side?_

repository: losdevnull/open-horizon-integration

repo_name: losdevnull/open-horizon-integration


text:
# Lab 6: Producer and Consumer

## Description
Create a program that has two parts. A producer and a consumer.
- Producer
  - The producer generates random characters from ‘a’ to ‘z’ at random intervals (between 0 and 1 second in length). It adds these to a thread safe buffer that has a finite holding capacity of N characters. It generates a preset number of characters (determined at runtime) and when it has finished it add an ‘X’ character to the buffer and exits.

- Consumer
  - The consumer takes these letters from the buffer at random time intervals (between 0 and 1 second in length) and records how many of each letter it consumes. Once it sees an ‘X’ in the buffer it adds its character count to a central buffer and exits.

## Source files
- Semaphore.h
  - The header file for the Semaphore class. This file is provided for your use. Make sure you understand how it works.
- Semaphore.cpp
  - The implementation file for the Semaphore class. This file is provided for your use. Make sure you understand how it works.
- Message.h
  - This is a class for Message Object to keep the value of the character.
- Message.cpp
  - This is a class implement the Message.h interface.
- MessageBuffer.h
  - This is a class implement the MessageBuffer.h interface.
- MessageBuffer.cpp
  - This is a class implement the MessageBuffer.h interface.
- main.cpp
  - The file containing the main function. This main function must create at least two threads demonstrating Producer and Consumer sync works in action.
- Makefile
  - This is the project file. It contains rules that tell the system how to compile the code and produce a working executable called **ProdCon**.
- Doxyfile
  - This file contains the settings for the Doxygen tool. It is generated by the Doxygen program when run for the first time.

## Execution
There is a **Makefile** we can use to compile the c++ source code of this program within exercises, you can do like this:
```
$ make
```
and then you can run the executable program with the command:
```
$ ./ProdCon
```
If you want to clean the target object files of the c++ source code compilation, you can do like this:
```
$ make CLEAN
```

## Debbuger
There is a dugger command within linux.

- gdb commands
  - list [number]: list the source code arround the specific number line.

  - list : list the source code of the specific function.

  - run: to run the executable file with debug mode

  - break : add the breakpoint at the specific function name

  - break [number]: add the breakpoint at the specific number line.

  - next: execute the next line code.

  - step: if the code line is function, then enter the function.

## License
The MIT License
```
/* * Copyright (c) 2019 Xiaohui Ling
 *
 * 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: hellolingxh/cddlabs

repo_name: hellolingxh/cddlabs


text:
# cdn-sync [![npm](https://img.shields.io/npm/v/cdn-sync.svg?maxAge=2592000)](https://www.npmjs.com/package/cdn-sync) [![Travis CI Status](https://travis-ci.org/jokeyrhyme/cdn-sync.svg?branch=master)](https://travis-ci.org/jokeyrhyme/cdn-sync)

Synchronise a local directory with AWS CloudFront / S3, maintaining correct headers, etc.

- this is a command-line Node.JS tool
- Node.JS and NPM are required to use this
- sufficient to replace s3cmd, cdn-sync has better MIME detection
- for use with Amazon Web Services (CloudFront and Simple Storage Service a.k.a S3)

## Getting Started

1. install the command-line tool with: `npm -g install cdn-sync`
2. set up your AWS S3 Buckets retrieve your IAM credentials
3. save a `.cdn-sync.json` file in the top-level of the directory to sync
4. run `cdn-sync` from within that directory (or any sub-directory

## Goals

- compatibility with more CDN providers
- provide server and client-side code for user agent compatibility test

## Why is this useful?

- CLI tools are easily scripted, making automated deployments easy
- the [de-facto tool](http://s3tools.org/s3cmd) does not always result in correct headers
- JavaScript and other text-based web resources should be GZIP deflated whenever possible
- AWS CloudFront and S3 do not currently offer an automatic deflation feature, so content
  must be separately deflated and uploaded to S3 (with the correct Content-Encoding header)

## Why bother?

Most browsers today support GZIP-deflated content:
- http://webmasters.stackexchange.com/questions/22217/which-browsers-handle-content-encoding-gzip-and-which-of-them-has-any-special
- http://stackoverflow.com/questions/575290/which-browsers-claim-to-support-http-compression-but-are-actually-flaky

If you are confident that you don't need to support these ancient user agents, then you may
skip detection completely and just assume that all of your users have modern web browsers.

### Configuration
_(Coming soon)_

## Documentation

- [discussion of deployment strategies](doc/deployment.md)

## Examples

### Example .cdn-sync.json

```
{
  "targets": [
    {
      "type": "aws",
      "options": {
        "accessKeyId": "...",
        "secretAccessKey": "...",
        "region": "...",
        "sslEnabled": true,
        "Bucket": "..."
      },
      "strategy": ["clone"]
    }
  ]
}
```

Note: for targets[index].options, use the options you would pass to the [AWS.S3 constructor](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3_20060301.html#constructor-property).

## Contributing
Formal style-guide for this project is JSLint. See JSLint settings at the top of
each file.

Add unit tests for any new or changed functionality. Lint and test your code:

    npm test

This project uses [Git Flow](https://github.com/nvie/gitflow), so the master
branch always reflects what is in production (i.e. what is in the NPM repository).
New code should be merged into the develop branch.

## Release History

See [GitHub Releases](https://github.com/jokeyrhyme/cdn-sync/releases)

## License
Copyright (c) 2013 Ron Waldon
Licensed under the MIT license.

repository: jokeyrhyme/cdn-sync

repo_name: jokeyrhyme/cdn-sync


text:
# tsc-monorepo

This repository makes use of [Yarn zero-installs](https://yarnpkg.com/features/zero-installs), just clone and run.

Included are two example packages to build off: `@tsc-monorepo/pkg-01` and `@tsc-monorepo/pkg-02`. `pkg-02` is
 dependent on `pkg-01`.

### Running Included Packages

I compile my Typescript into a relative `lib` folder, which is excluded in this repository.

`@tsc-monorepo/pkg-02` is the productive package. To start it, run `yarn typescript`, then `yarn pkg02 node lib`.

### Local Dependency Typings

Local dependency typings are made available through Typescript references in the root `tsconfig.json` file.
Package names in the respective `package.json` need to match the folder name it's contained in. \
\
Ex. The package name is @tsc-monorepo/pkg01, then the name of the folder for it will be pkg01.

### Other Notes

Lerna link issues when resolving `workspace: ` defined dependencies: \
[feat: Support the \`workspace:` protocol #2450](https://github.com/lerna/lerna/pull/2450).

### License

MIT

repository: cgutwin/tsc-monorepo

repo_name: cgutwin/tsc-monorepo


text:
# v6.0.0:

- added the ability to create worker only and web-only deployments using `web.enabled` and `worker.enabled`
- **[breaking]** worker and web secrets are now separated into 2 different templates, `worker-secrets.yaml` and `web-secrets.yaml`. Users bringing their own secrets will have to split them into 2 different k8s objects.

# v7.0.0:

- upgraded the PostgreSQL Chart (direct dependency of this Chart) from `0.13.1` to `5.3.8`. As various values (like `postgresUser`) changed (to, for instance, `postgresqlUsername`), a major bump was needed.

# v8.0.0:

- changed the format for worker-only deployments from `concourse.worker.tsa.host` and `concourse.worker.tsa.port` to `concourse.worker.tsa.hosts` to take in an array of parameters.

# v9.0.0:

- changed the input format for `concourse.web.auth.mainTeam.config`. Previously you would pass the path to a YAML file that contained the team config. This variable now expects the contents of a YAML file. The chart will then create a `ConfigMap` and store the contents of the `mainTeam.config` key in `main-team.yml`.

# v10.0.0:

- web: removed `concourse.web.enableLidar` and `concourse.web.resourceTypeCheckingInterval`

with 6.0, lidar is enabled by default (there's no radar anymore!)

- web: remove `concourse.web.noop` configuration

with the algorithm, there's no way of making specific web nodes no-op w/ regards to scheduling & checking anymore.

- web: split `concourse.web.maxConns`

previously, there was a single `maxConns` configuration flag that'd be used to set a max number of conn for both api and backend. as this flag does not exist anymore, it was removed.

- web: remove `concourse.web.riemann`

in concourse/concourse#5141 (part of 6.0), riemann was completely removed, making those variables unecessary.

# v11.0.0:

- All settings that were under `web.service` have been moved to three sub-keys: `web.service.api`, `web.service.workerGateway`, and `web.service.prometheus`. This allows users to, for example, expose the `api` component via an ingress while exposing the `workerGateway` via a `LoadBalancer` for registering external workers. Any values previously set under `web.service` should now be moved to `web.service.workerGateway` and `web.service.api`. Any `labels` or `annotations` should be copied to all three sub-keys, `web`, `workerGateway`, and `prometheus`.

# v12.0.1:

- To configure Concourse to use containerd as a runtime, set `concourse.worker.runtime` to `containerd`. In past versions of the chart, this was set in `concourse.worker.garden.useContainerd`, which was removed. Any containerd configuration should now be set under `concourse.worker.containerd.*` rather than under `concourse.worker.garden.*`. The default value for `concourse.worker.runtime` is `guardian`.
- Note: v12.0.0 has no changes from v11.0.0 - please use the patch version v12.0.1 instead

# v13.0.0:

- upgraded the PostgreSQL Chart (direct dependency of this Chart) from `6.5.5` to `9.2.0`. As the backward compatibility is not guarantee when upgrading the PostgreSQL chart to this major version, a major bump was needed. Please refer to [PostgreSQL Chart](https://github.com/bitnami/charts/tree/master/bitnami/postgresql#upgrade) for details.

# v14.0.0:

- The chart is now targeting Helm v3 and no longer supports Helm v2. Trying to deploy this version of the chart with Helm v2 will result an error such as `apiVersion 'v2' is not valid. The value must be "v1"`.

# v15.0.0:

- This chart version creates an init container where it will run the database migrations in. The migration command that it runs depends on a flag that is only added in concourse v7.0.0, making this a breaking change to anyone that tries to use this latest chart version with an older version of concourse.

# v16.0.0:

- For any users using Conjur for secret management, the field `secrets.conjurCertFile` changed to `secrets.conjurCACert`. It now takes the contents of a CA cert and creates a mount with a `ca.crt` file in the web deployment.

# v17.0.0:

- Upgrade the PostgreSQL Chart to v11. As the backward compatibility is not guarantee when upgrading the PostgreSQL chart to this major version, a major bump was needed. Please refer to [PostgreSQL Chart](https://docs.bitnami.com/kubernetes/infrastructure/postgresql/administration/upgrade#to-1100) for details.

repository: concourse/concourse-chart

gha_language: Mustache

repo_name: concourse/concourse-chart


text:
# Anime-scrapping
Node.js app to scrap anime download links.

Just a quick try of scrapping the web with node.js.
Use **noodlejs** as module for scrapping.
Nothing less, nothing more, the scrapper is stucks on *http://tiwi.kiwi*, to get the final download link, impossible to scrap the href of the download button 😬.

##Usage

```
npm install
node index.js
```

repository: remirobert/Anime-scrapping

repo_name: remirobert/Anime-scrapping


text:
---
layout: "unit"
title: "Guide Entry 86.03.06"
path: "/curriculum/guides/1986/3/86.03.06.x.html"
unitTitle: "Feasts, Fairs and Festivals: Mirrors of Renaissance Society"
unitAuthor: "Linda Maynard Powell"
keywords: "Renaissance Art History General European"
recommendedFor: "Recommended for World Civilization classes, grade 9 (all levels); World Literature classes, grade 9; and Art History classes, grades 9-12"
---

Guide Entry to 86.03.06:

During the final month of the school year, my students are well ahead of me: in their minds, they are already out of school and into the playground of summer. The last month of school is the most challenging for me. Just when my reserves on energy are nearly depleted, my students’ energies and attentions are fully charged—but not for school. Their bermuda shorts, colorful T’s and sunglasses remind us all, constantly, that vacation time is only days away.

This unit is designed to meet both our needs: on my part, to make the last month a meaningful learning time; on their part, to help my students understand why summer is so important and why they feel the way they do. We will use a study of Renaissance holidays and culture to explore some of the feelings they are experiencing as they get ready for the summer vacation: to examine the meaning and importance of holidays and to trace the common denominator of why there are holidays, both past and present. This fascinating subject matter will wind up my ninth grade course in world civilization. A study of festivals thus will be informative on several levels. Why do people celebrate? Why are the feelings of anticipation as important as the celebration? Such questions as these will help students understand why summer is important to them both individually and culturally.

As part of the new humanities-arts curriculum being developed at the Cooperative High School, this unit for ninth graders of all levels will draw on three main disciplines: social studies, English and the arts, both visual and performing. While its focus will be rooted in the rituals and festivals of the Renaissance, the unit will explore themes relating both to developments made in the Renaissance and to the personal growth of my students. As such, it is a unit about connections. Not only will the study of festivals allow students to see the connection between the past and the present and the relatedness of their English, social studies and art classes, it will help them understand some of the changes and developments they themselves are going through.

Studying these festivals has something to do with the experience of the student. Rebirth and discovery are two of the most important themes of the festival, both in ancient times and even in our own times. Students often experience feelings of both during holidays, for holidays can be times of growth, even though the students may not know it. The festival was a time of “renewal” of self and society, a reminder of the natural year, and a symbol of spiritual resurrection. It was a time for an individual to discover or affirm how he fit into the community structure through common, ritual experience.

A look at Renaissance rituals will introduce students to the idea that rituals and holidays have both personal and cultural meaning. A study of festivals will help them understand how they have both personal experiences that are their own and group experiences that reaffirm the values of their culture. Students will be encouraged to consider the meaning of and the reasons for this duality, their identity as an individual and as a community member. After looking at Renaissance festivals, students will be challenged to identify some of the rituals in high school and in the culture at large that have allowed them to discover and grow.

(Recommended for World Civilization classes, grade 9 (all levels); World Literature classes, grade 9; and Art History classes, grades 9-12)

Key Words

Renaissance Art History General European

gha_language: HTML


text:
# Set up existing Kubernetes projects with the plugin

You can open any existing project already configured with Kubernetes manifests and a Dockerfile (or [Jib](https://github.com/GoogleContainerTools/jib)), and use it with the plugin. The only additional bit of configuration is a Skaffold YAML file that you can create from a provided template. Here is a quick tutorial:
* Create new file named `skaffold.yaml` in the root directory of your project (right-click -> `New` -> `File`).
* Type `skaffold` and accept proposed Skaffold live template:

![create Skaffold YAML from template](images/skaffold-yaml-template.gif)
* Populate `image` field with your project image name and `manifests` field with a list of your Kubernetes resources you'd like to be deployed from the IDE.
   * Example for Dockerfile based builds:
   ```
   build:
     artifacts:
       - image: gcr.io/gcp_project_id/image_name
   deploy:
     kubectl:
       manifests:
         - k8s/web.yaml
         - k8s/backend.yaml
   ```
   * Example `build` section for Java Maven/Gradle projects with the [Jib plugin](https://github.com/GoogleContainerTools/jib) (`deploy` section stays the same):
   ```
   build:
     artifacts:
     - image: gcr.io/gcp_project_id/image_name
       jibMaven: {}
   ```

* Once `skaffold.yaml` is valid, the plugin will prompt you to create Kubernetes run targets automatically:

<img src="images/k8s-skaffold-notification.png" alt="Kubernetes with Skaffold notification" width="400"/>

repository: kingzuo/cloud-code-intellij

repo_name: kingzuo/cloud-code-intellij


text:
# flight-router

[![Build Status](https://travis-ci.org/getto-systems/flight-router.svg?branch=master)](https://travis-ci.org/getto-systems/flight-router)
[![Gem Version](https://badge.fury.io/rb/flight-router.svg)](https://badge.fury.io/rb/flight-router)

router script for flight

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'flight-router'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install flight-router

## Usage

```ruby
credential = {
  "gcp" => {
    "GCP_CREDENTIALS_JSON" => '"JSON"',
  },
  "smtp" => {
    "SMTP_SERVER" => "SMTP-SERVER",
    "SMTP_PORT" => "SMTP-PORT",
    "SMTP_USER" => "SMTP-USER",
    "SMTP_PASSWORD" => "SMTP-PASSWORD",
  },
}
contents = {
  "reset-email" => {
    "EMAIL_FROM" => "EMAIL-FROM",
    "EMAIL_SUBJECT" => "EMAIL-SUBJECT",
    "EMAIL_BODY" => <<EMAIL_BODY
EMAIL
BODY
EMAIL_BODY
  },
}

router = Flight::Router::Drawer.new(
  env: "development",
  output_dir: File.expand_path("../routes",__FILE__),
)
router.map do
  set :domain, "habit.getto.systems"
  set :origin, env(
    production:  "https://#{map[:domain]}",
    development: "http://localhost:12080",
  )
  group :image do
    set :auth,           "phoenix",  "0.0.0-pre23"
    set :datastore,      "diplomat", "0.0.0-pre14", env: credential["gcp"]
    set :reset_password, "phoenix",  "0.0.0-pre6",  env: credential["smtp"].merge(
      LOGIN_URL: "#{map[:origin]}/login/direct.html",
    )
  end
  group :auth do
    set :direct,   method: "header", expire: 600,    verify: 600
    set :api,      method: "header", expire: 604800, verify: 1209600
    set :download, method: "get",    expire: 600
  end
end

router.app do
  set :origin, map[:origin]
end

router.draw("/getto/habit") do
  namespace :token do
    api :auth do
      [
        [:auth,      "format-for-auth", kind: "User"],
        [:datastore, "find", kind: "User", scope: {}],
        [:auth,      "sign", auth: :api],
      ]
    end
    api :direct, auth: :direct do
      [ [:auth, "renew", auth: :api, verify: :direct] ]
    end
    api :renew, auth: :api do
      [ [:auth, "renew", auth: :api, verify: :api] ]
    end
    api :reset do
      [
        [:datastore,      "find", kind: "User", scope: {}],
        [:auth,           "sign", auth: :direct],
        [:reset_password, "send-email", env: contents["reset-email"]],
      ]
    end
  end

  namespace :profile, auth: :api do
    api :update do
      [
        [:auth, "password-hash", kind: "User"],
        [:datastore, "modify", scope: {
          User: {
            replace: {
              samekey: "loginID",
              cols: ["email","loginID","password"],
            }
          },
        }],
      ]
    end
  end
end
```

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/getto-systems/flight-router.

repository: getto-systems/flight-router

gha_language: Ruby

repo_name: getto-systems/flight-router


text:
# Misc

## Logging

By default errors are always logged, and with log enabled also the execution of a job.
Make sure you add this to your config:
```php
'Log' => [
    ...
    'queue' => [
        'className' => ...,
        'type' => 'queue',
        'levels' => ['info'],
        'scopes' => ['queue'],
    ],
],
```

When debugging (not using `--quiet`/`-q`) on "run", it will also log the worker run and end.

You can disable info logging by setting `Queue.log` to `false` in your config.

## Resetting
You can reset all failed jobs from CLI and web backend.
With web backend you can reset specific ones, as well.

From CLI you run this to reset all at once:
```
bin/cake queue reset
```

## Rerunning
You can rerun successfully run jobs if they are not yet cleaned out. Make sure your cleanup timeout is high enough here.
Usually weeks or months is a good balance to have those still stored for this case.

This is especially useful for local development or debugging, though. As you would otherwise have to manually trigger or import the job all the time.

From CLI you run this to rerun all of a specific job type at once:
```
bin/cake queue rerun FooBar
```
You can add an additional reference to rerun a specific job.

## Using custom finder
You can use a convenience finder for tasks that are still queued, that means not yet finished.
```php
$query = $this->QueuedJobs->find('queued')->...;
```
This includes also failed ones if not filtered further using `where()` conditions.

## Notes

`<TaskName>` is the complete class name without the Task suffix (eg. Example or PluginName.Example).

Custom tasks should be placed in `src/Queue/Task/`.
Tasks should be named `SomethingTask` and implement the Queue "Task".

Plugin tasks go in `plugins/PluginName/src/Queue/Task/`.

A detailed Example task can be found in `src/Queue/Task/QueueExampleTask.php` inside this plugin.

Some more tips:
- If you copy an example, do not forget to adapt the namespace ("App")!
- For plugin tasks, make sure to load the plugin using the plugin prefix ("MyPlugin.MyName").

repository: dereuromark/cakephp-queue

gha_language: PHP

repo_name: dereuromark/cakephp-queue


text:
# Python module for trophic-analysis and network visualisation

*trophic_tools* is a Python module that provides tools for tophic analysis as introduced by [1]
and also provides some tools developed for visualising networks using these methods.

Functions included are:

- *trophic_levels*       : returns trophic levels as per [1]

- *trophic_incoherence*  : returns trophic incoherence as per [1] (where trophic coherence is 1-incoherence)

- *HHD*                  : provides decomposition of network into *circular flow network* and *directional flow network* using *trophic_levels* (network Helmholtz-Hodge Decomposition (HHD)).

- *trophic_layout*       : returns a layout where y-possitions are given by trophic levels, and x-possitions based on a modified force-directed graph drawing algorithm to spread nodes out on the x-axis. For reproducibility, user can save and specify seed.

- *trophic_plot*         : plots network according to *trophic_layout*

All functions take networkx graph object as input. A full list of dependencies is provided in *requirements*.

A small demo of the use of these functions is provided in *demo_trophic_analysis*.

This module was written by: Bazil Sansom (University of Warwick).

Contact<EMAIL_ADDRESS>
If you you make use of this code, please quote the paper: [MacKay, Johnson & Sansom (2020)](https://doi.org/10.1098/rsos.201138) [1]

Contributions welcome!

# Refs:

- [1] MacKay, Johnson & Sansom (2020), "How directed is a directed network", *Royal Society Open Science*, vol. 7, issue 9. doi: https://doi.org/10.1098/rsos.201138

repository: BazilSansom/Trophic-Analysis-Toolbox

gha_language: Jupyter Notebook

repo_name: BazilSansom/Trophic-Analysis-Toolbox


text:
# ReLU neural network

### ----->>>> Note ::This is in development phase it may not work.
rectified linear activation function

## What is ReLU ?

ReLU is defined as g(x) = max(0,x). It is 0 when x is negative and equal to x when positive. Due to it’s lower saturation region, it is highly trainable and decreases the cost function far more quickly than sigmoid.

### acitation function

Inline-style:
![alt text](https://images.app.goo.gl/9umj1oAi4Y5DmecV6 "activation functions")

### ReLU acitation function

Inline-style:
![alt text](https://images.app.goo.gl/gkYh64M1wRKtjGuSA "ReLU activation functions")

note:please check out links if images are broken
https://images.app.goo.gl/9umj1oAi4Y5DmecV6

https://images.app.goo.gl/gkYh64M1wRKtjGuSA

direct implementation of ReLU neural networks

### install

```sh
pip install ReLUs
```
#### or

```sh
pip3 install ReLUs
```

#### parameters for the model to train
```
layers_sizes   (e.g.  layers_size=[13,5,5,1])
num_iters      (e.g. num_iters=1000)
learning_rate (e.g. learning_rate=0.03)
```

#### training the model
```sh
model_name =  model(X_train, Y_train, layer_sizes, num_iters, learning_rate)
```
#### train and test accuracy
```sh
train_acc, test_acc = compute_accuracy(X_train, X_test, Y_train, Y_test, model_name)
```
#### making predictions
```
predict(X_train,your_model)
```

#### REFRENCES

https://machinelearningmastery.com/rectified-linear-activation-function-for-deep-learning-neural-networks/

https://en.wikipedia.org/wiki/Rectifier_(neural_networks)

https://www.kaggle.com/dansbecker/rectified-linear-units-relu-in-deep-learning


text:
## Overview

OkHttp is a third-party library developed by Square for sending and receive HTTP-based network requests.  It is built on top of the [Okio](https://corner.squareup.com/2014/04/okio.html) library, which tries to be more efficient about reading and writing data than
the standard Java I/O libraries by creating a [shared memory pool](https://www.youtube.com/watch?v=WvyScM_S88c&feature=youtu.be).  It also is the underlying library for [[Retrofit|Consuming-APIs-with-Retrofit]] library that provides type safety for consuming REST-based APIs.

The OkHttp library actually provides an [implementation](https://github.com/square/okhttp/blob/master/okhttp-urlconnection/src/main/java/com/squareup/okhttp/internal/huc/HttpURLConnectionImpl.java) of the [HttpUrlConnection](http://developer.android.com/reference/java/net/HttpURLConnection.html)
interface, which Android 4.4 and later versions now use.  Therefore, when using the manual approach described in this [[section|Sending-and-Managing-Network-Requests#sending-an-http-request-the-hard-way]] of the guide, the underlying `HttpUrlConnection` class may be leveraging code from the OkHttp library. However, there is a separate API provided by OkHttp that makes it easier to send and receive network requests, which is described in this guide.

In addition, [OkHttp v2.4](https://corner.squareup.com/2015/05/okhttp-2-4.html) also provides a more updated way of managing URLs internally.  Instead of the `java.net.URL`, `java.net.URI`, or `android.net.Uri` classes, it provides a new `HttpUrl` class that makes it easier to get an HTTP port, parse URLs, and canonicalizing URL strings.

## Setup

Makes sure to enable the use of the Internet permission in your `AndroidManifest.xml` file:

```java
<uses-permission android:name="android.permission.INTERNET"/>
```

Simply add this line to your `app/build.gradle` file:

```gradle
compile 'com.squareup.okhttp3:okhttp:3.3.0'
```

**Note**: If you are upgrading from an older version of OkHttp, your imports will also need to be changed from `import com.squareup.okhttp.XXXX` to `import okhttp3.XXXX`.

**Note**: If you are intending to use Picasso with OkHttp3, you can either [[upgrade Picasso|Displaying-Images-with-the-Picasso-Library#setup-picasso]] to the latest snapshot version or use this custom downloader.  This change is necessary until the next release of Picasso as described [here](https://github.com/square/picasso/issues/1256).

```gradle
dependencies {
  compile 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.0.2'
}
```

You will then wrap the `OkHttpClient` with this `OkHttp3Downloader`.  **Note**: as of `OkHttp3`, it is recommended you declare this object as a singleton because changes in OkHttp3 no long require a global connection pool.  See [this changelog](see https://github.com/square/okhttp/blob/master/CHANGELOG.md#version-300-rc1) for more details.

```java
// Use OkHttpClient singleton
OkHttpClient client = new OkHttpClient();
Picasso picasso = new Picasso.Builder(context).downloader(new OkHttp3Downloader(client)).build();
```

## Sending and Receiving Network Requests

First, we must instantiate an OkHttpClient and create a `Request` object.

```java
// should be a singleton
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
                     .url("http://publicobject.com/helloworld.txt")
                     .build();
```

If there are any query parameters that need to be added, the `HttpUrl` class provided by OkHttp can be leveraged to construct the URL:

```java
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://ajax.googleapis.com/ajax/services/search/images").newBuilder();
urlBuilder.addQueryParameter("v", "1.0");
urlBuilder.addQueryParameter("q", "android");
urlBuilder.addQueryParameter("rsz", "8");
String url = urlBuilder.build().toString();

Request request = new Request.Builder()
                     .url(url)
                     .build();
```

If there are any authenticated query parameters, headers can be added to the request too:

```java
Request request = new Request.Builder()
    .header("Authorization", "token abcd")
    .url("https://api.github.com/users/codepath")
    .build();
```

### Synchronous Network Calls

We can create a `Call` object and dispatch the network request synchronously:

```java
Response response = client.newCall(request).execute();
```

Because Android disallows network calls on the main thread, you can only make synchronous calls if you do so on a separate thread or a background service.  You can use also use [[AsyncTask|Creating-and-Executing-Async-Tasks]] for lightweight network calls.

### Asynchronous Network Calls

We can also make asynchronous network calls too by creating a `Call` object, using the `enqueue()` method, and
passing an anonymous `Callback` object that implements both `onFailure()` and `onResponse()`.

```java
// Get a handler that can be used to post to the main thread
client.newCall(request).enqueue(new Callback() {
    @Override
    public void onFailure(Call call, IOException e) {
        e.printStackTrace();
    }

    @Override
    public void onResponse(Call call, final Response response) throws IOException {
        if (!response.isSuccessful()) {
            throw new IOException("Unexpected code " + response);
        }
    }
}
```

OkHttp normally creates a new worker thread to dispatch the network request and uses the same thread to handle the response.  It is built [primarily as a Java library](http://stackoverflow.com/questions/24246783/okhttp-response-callbacks-on-the-main-thread#comment45410547_24248963) so does not handle the Android framework limitations that only permit views to be updated on the main UI thread.  If you need to update any views, you will need to use `runOnUiThread()` or post the result back on the main thread.  See [[this guide|Managing-Threads-and-Custom-Services#handler-and-loopers]] for more context.

```java
client.newCall(request).enqueue(new Callback() {
    @Override
    public void onResponse(Call call, final Response response) throws IOException {
        // ... check for failure using `isSuccessful` before proceeding

        // Read data on the worker thread
        final String responseData = response.body().string();

        // Run view-related code back on the main thread
        MainActivity.this.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                try {
                    TextView myTextView = (TextView) findViewById(R.id.myTextView);
                    myTextView.setText(responseData);
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
       }
    }
});
```

## Processing Network Responses

Assuming the request is not cancelled and there are no connectivity issues, the `onResponse()` method will be fired. It passes a `Response` object that can be used to check the status code, the response body, and any headers that were returned. Calling `isSuccessful()` for instance if the code returned a status code of 2XX (i.e. 200, 201, etc.)

```java
if (!response.isSuccessful()) {
    throw new IOException("Unexpected code " + response);
}
```

The header responses are also provided as a list:

```java
Headers responseHeaders = response.headers();
for (int i = 0; i < responseHeaders.size(); i++) {
  Log.d("DEBUG", responseHeaders.name(i) + ": " + responseHeaders.value(i));
}
```

The headers can also be access directly using `response.header()`:

```java
String header = response.header("Date");
```

We can also get the response data by calling `response.body()` and then calling `string()` to read the entire payload.  Note that `response.body()` can only be run once and should be done on a background thread.

```java
Log.d("DEBUG", response.body().string());
```

### Processing JSON data

Suppose we make a call to the GitHub API, which returns JSON-based data:

```java
Request request = new Request.Builder()
             .url("https://api.github.com/users/codepath")
             .build();
```

We can also decode the data by converting it to a `JSONObject` or `JSONArray`, depending on the response data:

```java
client.newCall(request).enqueue(new Callback() {
    @Override
    public void onResponse(Call call, final Response response) throws IOException {
        try {
            String responseData = response.body().string();
            JSONObject json = new JSONObject(responseData);
            final String owner = json.getString("name");
        } catch (JSONException e) {

        }
    }
});
```

### Processing JSON data with Gson

Note that the `string()` method on the response body will load the entire data into memory.  To make more efficient use of memory, it is recommended that the response be processed as a stream by using `charStream()` instead.  This approach however requires using the [Gson](https://github.com/google/gson) library.  See [[this guide|Leveraging-the-Gson-Library]] for setup instructions.

To use the Gson library, we first must declare a class that maps directly to the JSON response:

```java
static class GitUser {
    String name;
    String url;
    int id;
}
```

We can then use the Gson parser to convert the data directly to a Java model:

```java
// Create new gson object
final Gson gson = new Gson();
// Get a handler that can be used to post to the main thread
client.newCall(request).enqueue(new Callback() {
    // Parse response using gson deserializer
    @Override
    public void onResponse(Call call, final Response response) throws IOException {
        // Process the data on the worker thread
        GitUser user = gson.fromJson(response.body().charStream(), GitUser.class);
        // Access deserialized user object here
    }
}
```

### Sending Authenticated Requests

OkHttp has a mechanism to modify outbound requests using [interceptors](https://github.com/square/okhttp/wiki/Interceptors).
A common use case is the OAuth protocol, which requires requests to be signed using a private key.  The [OkHttp signpost library](https://github.com/pakerfeldt/okhttp-signpost) works with the [SignPost library](https://github.com/mttkay/signpost) to use an interceptor to sign each request.  This way, the caller does not need to remember to sign each request:

```java
OkHttpOAuthConsumer consumer = new OkHttpOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET);
consumer.setTokenWithSecret(token, secret);
okHttpClient.interceptors().add(new SigningInterceptor(consumer));
```

### Caching Network Responses

We can setup network caching by passing in a cache when building the `OkHttpClient`:

```java
int cacheSize = 10 * 1024 * 1024; // 10 MiB
Cache cache = new Cache(new File(getApplication().getCacheDir(),"cacheFileName"), cacheSize);
OkHttpClient client = new OkHttpClient.Builder().cache(cache).build();
```

We can control whether to retrieve a cached response by setting the `cacheControl` property on the request.  For instance, if we wish to only retrieve the request if data is cached, we could construct the `Request` object as follows:

```java
Request request = new Request.Builder()
                .url("http://publicobject.com/helloworld.txt")
                .cacheControl(new CacheControl.Builder().onlyIfCached().build())
                .build();
```

We can also force a network response by using `noCache()` for the request:

```java
  .cacheControl(new CacheControl.Builder().noCache().build())
```

We can also specify a maximum staleness age for the cached response:

```java
   .cacheControl(new CacheControl.Builder().maxStale(365, TimeUnit.DAYS).build())
```

To retrieve the cached response, we can simply call `cacheResponse()` on the Response object:

```java
Call call = client.newCall(request);
call.enqueue(new Callback() {
  @Override
  public void onFailure(Call call, IOException e) {

  }

  @Override
  public void onResponse(Call call, final Response response) throws IOException
  {
     final Response text = response.cacheResponse();
     // if no cached object, result will be null
     if (text != null) {
        Log.d("here", text.toString());
     }
  }
});
```

## Troubleshooting

OkHttp can be hard to troubleshoot when trying to step through the various layers of abstraction in the libraries.  You can add the `HttpLogInterceptor` that can be added when using the `OkHttp3` library, which will print HTTP requests/responses through LogCat.  You can also leverage Facebook's [Stetho](http://facebook.github.io/stetho/) project to use Chrome to inspect all network traffic.

### HttpLogInterceptor

To use `HttpLogInterceptor`, add this dependency to your Gradle configuration:

```gradle
compile 'com.squareup.okhttp3:logging-interceptor:3.3.0'
```

You will need to add a network interceptor for HttpLogInterceptor.  See [this doc](http://square.github.io/okhttp/3.x/logging-interceptor/) for the different options that can be used.

```java
OkHttpClient.Builder builder = new OkHttpClient.Builder();

HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor();

// Can be Level.BASIC, Level.HEADERS, or Level.BODY
// See http://square.github.io/okhttp/3.x/logging-interceptor/ to see the options.
httpLoggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
builder.networkInterceptors().add(httpLoggingInterceptor);
builder.build();
```

### Stetho

Use Facebook's [Stetho](http://facebook.github.io/stetho/) plugin to monitor network calls with Chrome:

<img src="http://facebook.github.io/stetho/static/images/inspector-network.png"/>

Add this line to your Gradle configuration:

```gradle
dependencies {
    compile 'com.facebook.stetho:stetho-okhttp3:1.3.0'
}
```

When instantiating `OkHttp`, make sure to pass in the `StethoInterceptor`.

```java
OkHttpClient client = new OkHttpClient.Builder()
    .addNetworkInterceptor(new StethoInterceptor())
    .build();
```

Finally, make sure to initialize Stetho in your Application:

```java
public class MyApplication extends Application {
  public void onCreate() {
    super.onCreate();
    Stetho.initializeWithDefaults(this);
  }
}
```

### Recipe guide

Check out Square's official [recipe guide](https://github.com/square/okhttp/wiki/Recipes) for other examples of using OkHttp.

## References

* [Android’s HTTP Clients - Android Developers blog, September 29, 2011](http://android-developers.blogspot.com/2011/09/androids-http-clients.html)
* <https://www.reddit.com/r/androiddev/comments/29p3zz/til_okhttp_engine_is_backing_httpurlconnection_as/>
* <https://github.com/square/okhttp/blob/master/okhttp-urlconnection/src/main/java/com/squareup/okhttp/internal/huc/HttpURLConnectionImpl.java>
* <https://speakerdeck.com/jakewharton/a-few-ok-libraries-droidcon-mtl-2015>
* <https://github.com/square/okio#sources-and-sink>
* <http://stackoverflow.com/questions/24246783/okhttp-response-callbacks-on-the-main-thread>
* <https://github.com/square/okhttp/wiki/Recipes>
* <https://twitter.com/jakewharton/status/482563299511250944>
* [History of OkHttp podcast](https://simplecast.com/s/2e201f87)

repository: teocci/AndroidGuidenotes

repo_name: teocci/AndroidGuidenotes


text:
# BlackDesertFeed
A simple Boss Feed for Black Desert

## About
This is a BlackDesert bosses feed for discord, be sure that you're playing in ``SA`` before running this.

All the messages are currently in ``brazilian portuguese``, this project is a POC (Prove of Concept) and can be used for education purposes

This software sends a webhook message when a boss is going to spawn in ``1 hour, 30 minutes or 5 minutes``

## How To Setup
1 - Rename ``data/config.json.default`` to ``data/config.json`` and setup the configurations being:

- path -> create a webhook inside your channel and copy the url leaving everything after discordapp.com (``/app/...``)
- username -> the username that you want the webhook to have
- avatar_url -> the avatar that you want the webhook to have
- update_delay -> for how long it should wait for the next execution (in milliseconds)

2 - Start the node process with your favorite software, personally I use [forever](https://www.npmjs.com/package/forever), which is a pretty decent one

## License
BlackDesertRSS is licensed over [MIT License](https://github.com/HeyZeer0/BlackDesertRSS/blob/master/LICENSE) © Fabio Augusto 2019