text:
# CovsirPhy: COVID-19 data with SIR model [![GitHub license](https://img.shields.io/github/license/lisphilar/covid19-sir)](https://github.com/lisphilar/covid19-sir/blob/master/LICENSE)[![Python version](https://img.shields.io/badge/Python-3.7|3.8-green.svg)](https://www.python.org/)

## Introduction
CovsirPhy is a Python package for COVID-19 (Coronavirus disease 2019) data analysis with SIR-derived models. Please refer to "Method" part of [COVID-19 data with SIR model](https://www.kaggle.com/lisphilar/covid-19-data-with-sir-model) notebook in Kaggle to understand the methods of analysis.

With CovsirPhy, we can apply epidemic models to COVID-19 data. Epidemic models include simple SIR and SIR-F model. SIR-F is a customized SIR-derived ODE model. To evaluate the effect of measures, parameter estimation of SIR-F will be applied to subsets of time series data in each country. Parameter change points will be determined by S-R trend analysis.

## Functionalities
- Data cleaning
    - Epidemic data: raw data must include date, country, (province), the number of confirmed/fatal/recovered cases
    - Population data: raw data must include country, (province), values of population
- Data visualization with Matplotlib
- S-R Trend analysis with Optuna and scipy.optimize.curve_fit
- Numerical simulation of ODE models with scipy.integrate.solve_ivp
- Description of ODE models
    - Basic class of ODE models
    - SIR, SIR-D, SIR-F, SIR-FV and SEWIR-F model
- Parameter Estimation of ODE models with Optuna and numerical simulation
- Simulate the number of cases with user-defined parameter values

## Inspiration
- Monitor the spread of COVID-19
- Keep track parameter values/reproductive number in each country/province
- Find the relationship of reproductive number and measures taken in each country/province

## Trying now
The author is trying to add the following functionalities.
- Speed-up S-R trend analysis and hyperparameter estimation of ODE models
- Keep track parameter values/reproductive number of all countries with a simple code
- Find relationship of reproductive number and measures automatically

If you have ideas or need new functionalities, please join this project.
Any suggestions (Github issues, pull request, comment on Kaggle notebook) are always welcomed.

## Need discussion
- Analysis with linelist of case reports
- Analysis with mobility data

## Installation
When you use this package in Kaggle notebook (need to turn on Internet option in notebook settings) or local environment with Pip,
```
# Installation
pip install --upgrade pip setuptools
pip install "git+https://github.com/lisphilar/covid19-sir#egg=covsirphy"
# Un-installation
pip install pip-autoremove
pip-autoremove covsirphy
pip uninstall pip-autoremove
```
With Pipenv environment,
```
# Installation
pipenv install "git+https://github.com/lisphilar/covid19-sir#egg=covsirphy"
# Un-installation
pipenv uninstall covsirphy
```
For developers,
```
git clone https://github.com/lisphilar/covid19-sir.git
cd covid19-sir
pip install wheel; pip install --upgrade pip; pip install pipenv
export PIPENV_VENV_IN_PROJECT=true
export PIPENV_TIMEOUT=3600
pipenv install --dev
```

## Recommended datasets
Datasets are not included in this repository, but we can download the following recommended datasets from Kaggle and GitHub.

The necessary datasets can easily be obtained using two different: a bash script (`ìnput.sh`) or a python script (`input.py`). The bash script will not work for Windows OS. You need to setup your Kaggle account properly for both methods. Please follow the steps [provided here to ensure that you can authenticate with the Kaggle API](https://stackoverflow.com/questions/55934733/documentation-for-kaggle-api-within-python#:~:text=Here%20are%20the%20steps%20involved%20in%20using%20the%20Kaggle%20API%20from%20Python.&text=Go%20to%20your%20Kaggle%20account,json%20will%20be%20downloaded).

If you choose to use the python script, note that simply putting the `kaggle.json` in the same folder as `input.py` before executing it will allow `input.py` to find it (not necessary to modify environment variables).

Please read Bash code `input.sh` in the top directory of this repository to better understand its usage.

### Kaggle
Kaggle API key and Kaggle package are necessary. Please read [How to Use Kaggle: Public API](https://www.kaggle.com/docs/api).

#### The number of cases
Primary source: [COVID-19 Data Repository by CSSE at Johns Hopkins University](https://github.com/CSSEGISandData/COVID-19)
Secondary source: [Novel Corona Virus 2019 Dataset by SRK](https://www.kaggle.com/sudalairajkumar/novel-corona-virus-2019-dataset)
We can download this dataset from the primary source directly. Please refer to "Quick usage" section.

### The number of cases in Japan
Primary source: [Ministry of Health, Labour and Welfare HP (in English)](https://www.mhlw.go.jp/stf/seisakunitsuite/bunya/newpage_00032.html)
Secondary source: [Secondary source: COVID-19 dataset in Japan by Lisphilar](https://www.kaggle.com/lisphilar/covid19-dataset-in-japan)
We can download this dataset from the secondary source directly. Please refer to "Quick usage" section.

#### Total population
[covid19 global forecasting: locations population by Dmitry A. Grechka](https://www.kaggle.com/dgrechka/covid19-global-forecasting-locations-population)

### GitHub
#### OxCGRT: Measures taken by each country and response scores
[Thomas Hale, Sam Webster, Anna Petherick, Toby Phillips, and Beatriz Kira. (2020).
Oxford COVID-19 Government Response Tracker. Blavatnik School of Government.](https://github.com/OxCGRT/covid-policy-tracker)
We can download this dataset from the primary source directly. Please refer to "Quick usage" section.

## Quick usage
Example Python codes are in `example` directory. With Pipenv environment, we can run the Python codes with Bash code `example.sh` in the top directory of this repository.

### Preparation
```Python
import covsirphy as cs
cs.__version__
```
Set the directory to save the datasets.
```Python
data_loader = cs.DataLoader("input")
```
Download JHU dataset and perform data cleaning.
```Python
jhu_data = data_loader.jhu()
# Show citation
print(jhu_data.citation)
# Return the cleaned dataset as a dataframe
jhu_data.cleaned()
```
(Optional) We can replace JHU data with country-specific dataset.
```Python
# As an example, read Japan dataset
japan_data = data_loader.japan()
print(japan_data.citation)
# Replace records of Japan with Japan-specific dataset
jhu_data.replace(japan_data)
ncov_df = jhu_data.cleaned()
```
Perform data cleaning of population dataset.
```Python
# Read population dataset
pop_data = cs.Population("input/locations_population.csv")
# We can add a new record
pop_data.update(country="Example", province="-", value=1_000_000)
# Return dictionary
pop_data.to_dict(country_level=True)
```
Perform data cleaning of OxGCRT dataset.
```Python
oxcgrt_data = data_loader.oxcgrt()
# Show citation
print(oxcgrt_data.citation)
# Data cleaning
oxcgrt_df = oxcgrt_data.cleaned()
# Create a subset for a country with ISO3 country code
jpn_oxcgrt_df = oxcgrt_data.subset(iso3="JPN")
```

### Scenario analysis
As an example, use dataset in Italy.
#### Check records
```Python
ita_scenario = cs.Scenario(jhu_data, pop_data, country="Italy", province=None)
```
See the records as a figure.
```Python
ita_record_df = ita_scenario.records()
```
#### S-R trend analysis
Show S-R trend to determine the number of change points.
```Python
ita_scenario.trend()
```
As an example, set the number of change points as 4.
```Python
ita_scenario.trend(n_points=4, set_phases=True)
```
Start/end date of the four phase were automatically determined. Let's see.
```Python
print(ita_scenario.summary())
```
#### Hyperparameter estimation of ODE models
As an example, use SIR-F model.
```Python
ita_scenario.estimate(cs.SIRF)
print(ita_scenario.summary())
```
We can check the accuracy of estimation with a figure.
```Python
# Table
ita_scenario.estimate_accuracy(phase="1st")
# Get a value
ita_scenario.get("Rt", phase="4th")
# Show parameter history as a figure
ita_scenario.param_history(targets=["Rt"], divide_by_first=False, box_plot=False)
ita_scenario.param_history(targets=["rho", "sigma"])
```
#### Prediction of the number of cases
we can add some future phases.
```Python
# if needed, clear the registered future phases
ita_scenario.clear(name="Main")
# Add future phase to main scenario
ita_scenario.add_phase(name="Main", end_date="01Aug2020")
# Get parameter value
sigma_4th = ita_scenario.get("sigma", name="Main", phase="4th")
# Add future phase with changed parameter value to new scenario
sigma_6th = sigma_4th * 2
ita_scenario.add_phase(end_date="31Dec2020", name="Medicine", sigma=sigma_6th)
ita_scenario.add_phase(days=30, name="Medicine")
print(ita_scenario.summary())
```
Then, we can predict the number of cases and get a figure.
```Python
# Prediction and show figure
sim_df = ita_scenario.simulate(name="Main")
# Describe representative values
print(ita_scenario.describe())
```

## Citation
Lisphilar, 2020, Kaggle notebook, COVID-19 data with SIR model, https://www.kaggle.com/lisphilar/covid-19-data-with-sir-model

CovsirPhy development team, 2020, GitHub repository, CovsirPhy, Python package for COVID-19 data with SIR model, https://github.com/lisphilar/covid19-sir


text:
# Olympic Analysis

## Data source(s)
- Olympic medal winners: every one since 1896 (THE GUARDIAN [datablog](https://www.theguardian.com/sport/datablog/2012/jun/25/olympic-medal-winner-list-data))

## Demo
- [Weblink](https://mithileysh.github.io/Olympic-Analysis/)

Credits: Geervesh Peenith, Intern at Red Sift, UK (during July-Dec 2016)

license: MIT

repository: Mithileysh/Olympic-Analysis

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: Mithileysh/Olympic-Analysis


text:
# Integration Guide:  Porting Mimi Models from v0.4.0 to v0.5.0

## Overview

The release of Mimi v0.5.0 is a breaking release, necessitating the adaptation of existing models' syntax and structure in order for those models to run on this new version.  This guide provides an overview of the steps required to get most models using the v0.4.0 API working with v0.5.0.  It is **not** a comprehensive review of all changes and new functionalities, but a guide to the minimum steps required to port old models between versions.  For complete information on the new version and its functionalities, see the full documentation.

This guide is organized into six main sections, each descripting an independent set of changes that can be undertaken in any order desired.  For clarity, these sections echo the organization of the `userguide`.

1) Defining components
2) Constructing a model
3) Running the model
4) Accessing results
5) Plotting
6) Advanced topics

## Defining Components

The `run_timestep` function is now contained by the `@defcomp` macro, and takes the parameters `p, v, d, t`, referring to Parameters, Variables, and Dimensions of the component you defined.  The fourth argument is an AbstractTimestep, i.e., either a `FixedTimestep` or a `VariableTimestep`.  Similarly, the optional `init` function is also contained by `@defcomp`, and takes the parameters `p, v, d`.  Thus, as described in the user guide, defining a single component is now done as follows:

```julia
@defcomp component1 begin

    # First define the state this component will hold
    savingsrate = Parameter()

    # Second, define the (optional) init function for the component
    function init(p, v, d)
    end

    # Third, define the run_timestep function for the component
    function run_timestep(p, v, d, t)
    end

end
```

## Constructing a Model

In an effort to standardize the function naming protocol within Mimi, and to streamline it with the Julia convention, several function names have been changed.  The table below lists a **subset** of these changes, focused on the exported API functions most commonly used in model construction.

| Old Syntax                | New Syntax                |
| ------------------------  |:-------------------------:|
|`connectparameter`         |`connect_parameter`        |
|`setleftoverparameters`    |`set_leftover_params!`     |
|`setparameter`             |`set_parameter!`           |
|`adddimension`             |`add_dimension!`            |
|`setindex`                 |`set_dimension!`           |

Changes to various optional keyword arguments:

 - `connect_parameter`:  In the case that a component parameter is connected to a variable from a prior timestep, it is necessary to use the `offset` keyword argument to prevent a cycle.  The offset value is an `Int` specifying the offset in terms of timesteps as below.

```julia
connect_parameter(mymodel, :TargetComponent=>:parametername, :SourceComponent=>:variablename, offset = 1)
```
- `addcomponent`:  Previously the optional keyword arguments `start` and `stop` could be used to specify times for components that do not run for the full length of the model. These arguments are now `first` and `last` respectively.

```julia
addcomponent(mymodel, ComponentC; first=2010, last=2100)
```

Finally, in order to finish connecting components, it is necessary to run `add_connector_comps` as below.

```julia
add_connector_comps(mymodel)

```

## Running a Model

## Accessing Results

## Plotting

This release of Mimi does not include the plotting functionality previously offered by Mimi.  While the previous files are still included, the functions are not exported as efforts are made to simplify and improve the plotting associated with Mimi.

The new version does, however, include a new UI tool that can be used to visualize model results.  This `explore` function is described in the User Guide under **Advanced Topics**.

## Advanced Topics

### Timesteps and available functions

As previously mentioned, some relevant function names have changed.  These changes were made to eliminate ambiguity.  For example, the new naming clarifies that `is_last` returns whether the timestep is on the last valid period to be run, not whether it has run through that period already.  This check can still be achieved with `is_finished`, which retains its name and function.  Below is a subset of such changes related to timesteps and available functions.

| Old Syntax                | New Syntax                |
| ------------------------  |:-------------------------:|
|`isstart`                  |`is_first`                 |
|`isstop`                   |`is_last`                  |

### Parameter connections between different length components

### More on parameter indices

### Updating an external parameter

The function `update_external_parameter` is now written as `update_external_param`.

### Setting parameters with a dictionary

The function `setleftoverparameters` is now written as `set_leftover_params!`.

### Using NamedArrays for setting parameters

### The internal 'build' function and model instances

###  The explorer UI


text:
## Contributing to discord.py

First off, thanks for taking the time to contribute. It makes the library substantially better. :+1:

The following is a set of guidelines for contributing to the repository. These are guidelines, not hard rules.

## This is too much to read! I want to ask a question!

Generally speaking questions are better suited in our resources below.

- The official support server: https://discord.gg/r3sSKJJ
- The Discord API server under #python_discord-py: https://discord.gg/discord-api
- [The FAQ in the documentation](https://discordpy.readthedocs.io/en/latest/faq.html)
- [StackOverflow's `discord.py` tag](https://stackoverflow.com/questions/tagged/discord.py)

Please try your best not to ask questions in our issue tracker. Most of them don't belong there unless they provide value to a larger audience.

## Good Bug Reports

Please be aware of the following things when filing bug reports.

1. Don't open duplicate issues. Please search your issue to see if it has been asked already. Duplicate issues will be closed.
2. When filing a bug about exceptions or tracebacks, please include the *complete* traceback. Without the complete traceback the issue might be **unsolvable** and you will be asked to provide more information.
3. Make sure to provide enough information to make the issue workable. The issue template will generally walk you through the process but they are enumerated here as well:
    - A **summary** of your bug report. This is generally a quick sentence or two to describe the issue in human terms.
    - Guidance on **how to reproduce the issue**. Ideally, this should have a small code sample that allows us to run and see the issue for ourselves to debug. **Please make sure that the token is not displayed**. If you cannot provide a code snippet, then let us know what the steps were, how often it happens, etc.
    - Tell us **what you expected to happen**. That way we can meet that expectation.
    - Tell us **what actually happens**. What ends up happening in reality? It's not helpful to say "it fails" or "it doesn't work". Say *how* it failed, do you get an exception? Does it hang? How are the expectations different from reality?
    - Tell us **information about your environment**. What version of discord.py are you using? How was it installed? What operating system are you running on? These are valuable questions and information that we use.

If the bug report is missing this information then it'll take us longer to fix the issue. We will probably ask for clarification, and barring that if no response was given then the issue will be closed.

## Submitting a Pull Request

Submitting a pull request is fairly simple, just make sure it focuses on a single aspect and doesn't manage to have scope creep and it's probably good to go. It would be incredibly lovely if the style is consistent to that found in the project. This project follows PEP-8 guidelines (mostly) with a column limit of 125.

### Git Commit Guidelines

- Use present tense (e.g. "Add feature" not "Added feature")
- Limit all lines to 72 characters or less.
- Reference issues or pull requests outside of the first line.
    - Please use the shorthand `#123` and not the full URL.
- Commits regarding the commands extension must be prefixed with `[commands]`

If you do not meet any of these guidelines, don't fret. Chances are they will be fixed upon rebasing but please do try to meet them to remove some of the workload.

gha_language: Python

gha_license_id: MIT


text:
---
title: API - Classes - Model
sidebar_label: Model
id: api-classes-model
---

# Redux-Data-Model API Reference Guide

This reference guide lists all methods exposed by redux-data-model. Contributions like linguistic improvements, adding
more details to the descriptions or additional examples are highly appreciated! Please note that the docs are
generated from source.

[redux-data-model](../README.md) › [Model](model.md)

# Class: Model ‹**State, SelectorPayloads, ReducerPayloads, EffectPayloads**›

Models are the most basic data structure/abstraction in this library. They require a set of options to be
provided when initializing them. The model will be used to generate the action types, actions, reducers,
dispatchers, and sagas, based on the [model's options](../interfaces/modeloptions.md) that were provided.

## Type parameters

▪ **State**

▪ **SelectorPayloads**

▪ **ReducerPayloads**

▪ **EffectPayloads**

## Hierarchy

* **Model**

## Index

### Constructors

* [constructor](model.md#constructor)

### Properties

* [disableInitializationChecks](model.md#static-disableinitializationchecks)
* [disableProxyChecks](model.md#static-disableproxychecks)

### Accessors

* [blockingEffects](model.md#blockingeffects)
* [effects](model.md#effects)
* [isReduxInitialized](model.md#isreduxinitialized)
* [isSagaInitialized](model.md#issagainitialized)
* [namespace](model.md#namespace)
* [reducers](model.md#reducers)
* [reduxSagas](model.md#reduxsagas)
* [selectors](model.md#selectors)
* [state](model.md#state)

### Methods

* [actionCreators](model.md#actioncreators)
* [actionTypes](model.md#actiontypes)

## Constructors

###  constructor

\+ **new Model**(`options`: [ModelOptions](../interfaces/modeloptions.md)‹State, SelectorPayloads, ReducerPayloads, EffectPayloads›): *[Model](model.md)*

*Defined in [packages/redux-data-model/src/model.ts:233](https://github.com/kayak/redux-data-model/blob/2f50839/packages/redux-data-model/src/model.ts#L233)*

Creates a model instance.

**`example`**
const counterModel = new Model({
  namespace: 'counter',
  state: {
     count: 0,
  },
  selectors: {
      count: (state) => state.count,
  },
  reducers: {
     increment(state) {
       state.count += 1;
     },
     decrement(state) {
       state.count -= 1;
     },
     setCount(state, { value }) {
       state.count = value;
     },
  },
 // effects: {...}
 // blockingEffects: {...}
});

**`throws`** [NamespaceIsntAStringError](namespaceisntastringerror.md) When namespace isn't a string.

**`throws`** [EmptyNamespaceError](emptynamespaceerror.md) When namespace is an empty string.

**`throws`** [InvalidNamespaceError](invalidnamespaceerror.md) When namespace has invalid characters.

**`throws`** [DuplicatedActionTypesError](duplicatedactiontypeserror.md) When reducer and/or effect action types are duplicated.

**`throws`** [BlockingEffectWithoutMatchingEffectError](blockingeffectwithoutmatchingeffecterror.md) When blocking effect action types don't have a matching
                                                     effect action type.

**Parameters:**

Name | Type | Description |
------ | ------ | ------ |
`options` | [ModelOptions](../interfaces/modeloptions.md)‹State, SelectorPayloads, ReducerPayloads, EffectPayloads› | A model's options. |

**Returns:** *[Model](model.md)*

## Properties

### `Static` disableInitializationChecks

▪ **disableInitializationChecks**: *boolean* = false

*Defined in [packages/redux-data-model/src/model.ts:217](https://github.com/kayak/redux-data-model/blob/2f50839/packages/redux-data-model/src/model.ts#L217)*

Whether [ModelNotReduxInitializedError](modelnotreduxinitializederror.md) and [ModelNotSagaInitializedError](modelnotsagainitializederror.md) should be thrown when the model
is used without it being integrated with Redux/Saga yet. Normally you only want to disable initialization
checks in your tests, given they help developers to find out common mistakes soon.

___

### `Static` disableProxyChecks

▪ **disableProxyChecks**: *boolean* = false

*Defined in [packages/redux-data-model/src/model.ts:224](https://github.com/kayak/redux-data-model/blob/2f50839/packages/redux-data-model/src/model.ts#L224)*

Whether [UndefinedReducerOrEffectError](undefinedreduceroreffecterror.md), [UndefinedSelectorError](undefinedselectorerror.md), [UndefinedSagaEffectError](undefinedsagaeffecterror.md), and
[UndefinedBlockingSagaEffectError](undefinedblockingsagaeffecterror.md) should be thrown when a accessing properties that were not defined.
Normally you only want to disable proxy checks in your tests, given they help developers to find out
common mistakes soon.

## Accessors

###  blockingEffects

• **get blockingEffects**(): *[BlockingEffectMap](../README.md#blockingeffectmap)‹[BlockingSagaEffects](../README.md#blockingsagaeffects), EffectPayloads›*

*Defined in [packages/redux-data-model/src/model.ts:579](https://github.com/kayak/redux-data-model/blob/2f50839/packages/redux-data-model/src/model.ts#L579)*

Returns the [blocking effects](../interfaces/modeloptions.md#optional-blockingeffects) as provided in the [constructor](model.md#constructor).

**Returns:** *[BlockingEffectMap](../README.md#blockingeffectmap)‹[BlockingSagaEffects](../README.md#blockingsagaeffects), EffectPayloads›*

A blocking effect map.

___

###  effects

• **get effects**(): *[EffectMap](../README.md#effectmap)‹[SagaEffects](../README.md#sagaeffects), ReducerPayloads, EffectPayloads›*

*Defined in [packages/redux-data-model/src/model.ts:570](https://github.com/kayak/redux-data-model/blob/2f50839/packages/redux-data-model/src/model.ts#L570)*

Returns the [effects](../interfaces/modeloptions.md#optional-effects) as provided in the [constructor](model.md#constructor).

**Returns:** *[EffectMap](../README.md#effectmap)‹[SagaEffects](../README.md#sagaeffects), ReducerPayloads, EffectPayloads›*

An effect map.

___

###  isReduxInitialized

• **get isReduxInitialized**(): *boolean*

*Defined in [packages/redux-data-model/src/model.ts:516](https://github.com/kayak/redux-data-model/blob/2f50839/packages/redux-data-model/src/model.ts#L516)*

Returns whether the model was initialized on a [combineModelReducers](../README.md#combinemodelreducers) call.

**Returns:** *boolean*

A boolean.

___

###  isSagaInitialized

• **get isSagaInitialized**(): *boolean*

*Defined in [packages/redux-data-model/src/model.ts:525](https://github.com/kayak/redux-data-model/blob/2f50839/packages/redux-data-model/src/model.ts#L525)*

Returns whether the model was initialized on a [modelRootSaga](../README.md#modelrootsaga) call.

**Returns:** *boolean*

A boolean.

___

###  namespace

• **get namespace**(): *string*

*Defined in [packages/redux-data-model/src/model.ts:534](https://github.com/kayak/redux-data-model/blob/2f50839/packages/redux-data-model/src/model.ts#L534)*

Returns the [namespace](../interfaces/modeloptions.md#namespace) as provided in the [constructor](model.md#constructor).

**Returns:** *string*

A string.

___

###  reducers

• **get reducers**(): *[ReducerMap](../README.md#reducermap)‹State, ReducerPayloads›*

*Defined in [packages/redux-data-model/src/model.ts:561](https://github.com/kayak/redux-data-model/blob/2f50839/packages/redux-data-model/src/model.ts#L561)*

Returns the [reducers](../interfaces/modeloptions.md#optional-reducers) as provided in the [constructor](model.md#constructor).

**Returns:** *[ReducerMap](../README.md#reducermap)‹State, ReducerPayloads›*

A reducer function.

___

###  reduxSagas

• **get reduxSagas**(): *Saga[]*

*Defined in [packages/redux-data-model/src/model.ts:501](https://github.com/kayak/redux-data-model/blob/2f50839/packages/redux-data-model/src/model.ts#L501)*

Returns an array of sagas, one for each of the declared
[normal effects](../interfaces/modeloptions.md#optional-effects)/[blocking effects](../interfaces/modeloptions.md#optional-blockingeffects).
[Normal effects](../interfaces/modeloptions.md#optional-effects) will default to taking every action and calling its respective effect,
unless overridden by a [blocking effect](../interfaces/modeloptions.md#optional-blockingeffects).

**`throws`** [NonCompatibleActionError](noncompatibleactionerror.md) When [bindModelActionCreators](../README.md#bindmodelactioncreators) was not used to bind the action creators.

**Returns:** *Saga[]*

An array of sagas.

___

###  selectors

• **get selectors**(): *[SelectorMap](../README.md#selectormap)‹Immutable‹State›, SelectorPayloads›*

*Defined in [packages/redux-data-model/src/model.ts:552](https://github.com/kayak/redux-data-model/blob/2f50839/packages/redux-data-model/src/model.ts#L552)*

Returns the [selectors](../interfaces/modeloptions.md#optional-selectors) as provided in the [constructor](model.md#constructor).

**Returns:** *[SelectorMap](../README.md#selectormap)‹Immutable‹State›, SelectorPayloads›*

A selectors map.

___

###  state

• **get state**(): *Immutable‹State›*

*Defined in [packages/redux-data-model/src/model.ts:543](https://github.com/kayak/redux-data-model/blob/2f50839/packages/redux-data-model/src/model.ts#L543)*

Returns the [initial state](../interfaces/modeloptions.md#state) as provided in the [constructor](model.md#constructor).

**Returns:** *Immutable‹State›*

An initial state.

## Methods

###  actionCreators

▸ **actionCreators**(): *[ActionCreatorsMapObject](../README.md#actioncreatorsmapobject)‹ReducerPayloads & EffectPayloads›*

*Defined in [packages/redux-data-model/src/model.ts:360](https://github.com/kayak/redux-data-model/blob/2f50839/packages/redux-data-model/src/model.ts#L360)*

Returns an object with action creators, one for each of the declared [reducers](../interfaces/modeloptions.md#optional-reducers) and
[effects](../interfaces/modeloptions.md#optional-effects). Only useful for testing purposes, read the docs section on testing for
more info, or when you need to process actions from a different model's
[reducers](../interfaces/modeloptions.md#optional-reducers)/[effects](../interfaces/modeloptions.md#optional-effects). Being the latter a common
approach when dispatching another model's actions within your [effects](../interfaces/modeloptions.md#optional-effects).

**Returns:** *[ActionCreatorsMapObject](../README.md#actioncreatorsmapobject)‹ReducerPayloads & EffectPayloads›*

An action creator's map object.

___

###  actionTypes

▸ **actionTypes**(): *[ActionTypesMapObject](../README.md#actiontypesmapobject)‹ReducerPayloads & EffectPayloads›*

*Defined in [packages/redux-data-model/src/model.ts:337](https://github.com/kayak/redux-data-model/blob/2f50839/packages/redux-data-model/src/model.ts#L337)*

Returns an object with action types, one for each of the declared [reducers](../interfaces/modeloptions.md#optional-reducers) and
[effects](../interfaces/modeloptions.md#optional-effects). Only useful for testing purposes, read the docs section on testing for
more info, or when you need to process actions from a different model's
[reducers](../interfaces/modeloptions.md#optional-reducers)/[effects](../interfaces/modeloptions.md#optional-effects). Being the latter a common
approach when normalising data.

**Returns:** *[ActionTypesMapObject](../README.md#actiontypesmapobject)‹ReducerPayloads & EffectPayloads›*

An action type's map object.

repository: kayak/redux-data-model

gha_language: TypeScript

repo_name: kayak/redux-data-model


text:
# File

A basic file/directory library.

[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/aensley/file/blob/master/LICENSE)
[![Latest Stable Version](https://poser.pugx.org/aensley/file/v/stable)](https://packagist.org/packages/aensley/file)
[![Packagist Downloads](https://img.shields.io/packagist/dt/aensley/file.svg)](https://packagist.org/packages/aensley/file)
[![Build Status](https://travis-ci.org/aensley/file.svg)](https://travis-ci.org/aensley/file)
[![GitHub Issues](https://img.shields.io/github/issues-raw/aensley/file.svg)](https://github.com/aensley/file/issues)

[![Tested Versions Status](https://php-eye.com/badge/aensley/file/tested.svg?branch=dev-master)](https://php-eye.com/package/aensley/file)
[![Code Climate Grade](https://codeclimate.com/github/aensley/file/badges/gpa.svg)](https://codeclimate.com/github/aensley/file)
[![Code Climate Issues](https://img.shields.io/codeclimate/issues/github/aensley/file.svg)](https://codeclimate.com/github/aensley/file/issues)
[![Code Climate Test Coverage](https://codeclimate.com/github/aensley/file/badges/coverage.svg)](https://codeclimate.com/github/aensley/file/coverage)

## What it does

Basic file and directory access/manipulation.

## Installation

Install the latest version with

```bash
composer require aensley/file
```

## Requirements

* PHP >= 5.6

## Example usage

### Simple example

```php
<?php

require '/path/to/composer/autoload.php';

use use \Aensley\File\Directory;

// Recursively delete a directory.
Directory::delete('/some/dir/');
```

----

[![Supercharged by ZenHub.io](https://raw.githubusercontent.com/ZenHubIO/support/master/zenhub-badge.png)](https://zenhub.io)

repository: aensley/file

gha_language: PHP

repo_name: aensley/file


text:
# API

This repo contains examples for using the micro api.

## Overview

The [micro api](https://github.com/micro/micro/tree/master/api) is an API gateway which serves HTTP and routes dynamically based on service discovery.

The micro api by default serves the namespace go.micro.api. Our service names include this plus a unique name e.g go.micro.api.example.
You can change the namespace via the flag `--namespace=`.

The micro api has a number of different handlers which lets you define what kind of API services you want. See examples below. The handler
can be set via the flag `--handler=`. The default handler is "rpc".

## Contents

- api - an rpc handler that provides the entire http headers and request
- proxy - use the api as a http reverse proxy
- rpc - make an rpc request to a go-micro app
- meta - specify which handler to use via configuration in code

## Request Mapping

### API/RPC

Micro maps http paths to rpc services. The mapping table can be seen below.

The default namespace for the api is **go.micro.api** but you can set your own namespace via `--namespace`.

URLs are mapped as follows:

Path	|	Service	|	Method
----	|	----	|	----
/foo/bar	|	go.micro.api.foo	|	Foo.Bar
/foo/bar/baz	|	go.micro.api.foo	|	Bar.Baz
/foo/bar/baz/cat	|	go.micro.api.foo.bar	|	Baz.Cat

Versioned API URLs can easily be mapped to service names:

Path	|	Service	|	Method
----	|	----	|	----
/foo/bar	|	go.micro.api.foo	|	Foo.Bar
/v1/foo/bar	|	go.micro.api.v1.foo	|	Foo.Bar
/v1/foo/bar/baz	|	go.micro.api.v1.foo	|	Bar.Baz
/v2/foo/bar	|	go.micro.api.v2.foo	|	Foo.Bar
/v2/foo/bar/baz	|	go.micro.api.v2.foo	|	Bar.Baz

### Proxy Mapping

Starting the API with `--handler=http` will reverse proxy requests to backend services within the served API namespace (default: go.micro.api).

Example

Path	|	Service	|	Service Path
---	|	---	|	---
/greeter	|	go.micro.api.greeter	|	/greeter
/greeter/:name	|	go.micro.api.greeter	|	/greeter/:name

gha_language: JavaScript


text:
---
layout: post
title:  "论文阅读：PPR-FCN"
date:   2018-07-02 17:40:41
categories: 图像理解
tags: SceneGraphGeneration
mathjax: true
author: Narcissus
---

* content
{:toc}

# 1.主要思想

- weakly supervised      visual relation detection (WSVRD)这里无监督指的是两个方面，一个方面是弱监督的物体检测，在训练过程中，没有bounding box作为标签来监督训练，其实我认为这里的物体检测是无监督的，不太懂这里为啥说是弱监督的。（解释，通过阅读WSDDN这篇文章，我理解了其中的弱监督的观念：就是说虽然没有bounding box，但是通过预训练的cnn+region proposal      mechanism+spp能得到一个大致的物体区域，利用image-level的标注信息进行训练，就相当于给了弱监督的信息）

At training time, we discarded the object bounding boxes to conform with the weakly supervised setting ，应该是WSOD和WSPP两个过程都没有用bounding box的标签。

- 那为什么又说是image-level的分类或者标注呢？因为标注只给了很少的信息，如果一个物体出现在一张图片中，那么图像的标注就是positive，否则为negtive。而分类是要在这种image-level的标注下找到一个物体对应的region proposal。

- 网络分成了两个部分，两个都是弱监督的方法，一个进行物体检测，另一个进行关系分类。

![WSOD  Module  Input Image  s  Subject  FCN  Subject  FCN  NMS  Pos.-Role  Sensitive  Score Map  Pos.-Role  Sensitive  Score Map  s  Cls.  Object  FCN  Object  FCN  Rois Rolo  Pairwise  ROI Pooling  Pair-wise  Rol Pooling  Output  I Sperson  Shold O 0.8  s  umbrella  Shat  son = 0.6  WSPP Module  Figure 2. The overview Of the proposed PPR-FCN architecture for WSVRD. It has two modules: WSOD for Object detection (C:\Users\nian\OneDrive\NoteBook\narcissuscyn.github.io\_posts\assets\clip_image001-1547018446020.png)  and WSPP for predicate prediction (Section 3.2), each module is composed by a pair selection branch and a classification branch. ](https://ws1.sinaimg.cn/large/007tAU6Agy1fz0d1np0zwj311x0cygqh.jpg)

# 2.WSVRD的三个难点

- 1）缺乏空间位置的限制，比如人戴帽子，帽子可能在别人头上；
- 2）相对于WSOD更容易陷入次优解[21]；
- 3)WSVRD如果采用全连接网络，会有很大的计算量。

# 3.WSOD模块采用的是WSDDN[3]

 参考另一篇WSDDN的文章：

# 4.WSPP模块采用了两个子网络

一个用来选取关系对，另一个用来进行关系分类：

![(C:\Users\nian\OneDrive\NoteBook\narcissuscyn.github.io\_posts\assets\clip_image002-1547018446020.png)  '(0 "d)sßs • (0 'id)ßs = (0 'Id)US ](https://ws1.sinaimg.cn/large/007tAU6Agy1fz0d29ixsgj30fj01fwec.jpg)

![cation) branch. ss' I is softmax normalized over all pos-  Sible region pairs with respect to a predicate class, i.e.,  (C:\Users\nian\OneDrive\NoteBook\narcissuscyn.github.io\_posts\assets\clip_image003-1547018446020.png)) 4— Pj); while S,.cls is soft-  normalized over possible predicate classes for a re-  gion pair, i.e., P)) 4— softmaxrSrClS(Pi, Note  that such normalizations assign different objectives to two  branches and hence they are unlikely to learn redundant  models [3]. Essentially, the normalized selection score can  be considered as a soft-attention mechanism used in weakly  supervised vision tasks [35, 5] to determine the likely Rols. ](https://ws1.sinaimg.cn/large/007tAU6Agy1fz0d2ru63jj30hr08vabq.jpg)

在进行softmax之前，如何计算这两个分数：

- ![重要](C:\Users\nian\OneDrive\NoteBook\narcissuscyn.github.io\_posts\assets\clip_image004-1547018446020.png) Position-sequence-Sensitive Score Map

主要考虑到两方面的因素：position和pair对的顺序问题：

![kxkxR  t:) Vote  POO  Vote  .•'0bj. Rol  Joint P ooling  Figure 3. Illustrations of pairwise Rol pooling with k2(k —  spatial grids and R predicates. Left: subject/object pooling for a  single Rol. Right: joint pooling. For each score map, we use k2  colors to represent different position channels. Each color channel  has R predicate channels. For the joint pooling, uncolored pooling  results indicate zero and the back-propagation is disabled through  these grids. Note that the score maps in subject/object pooling and  joint pooling are different, i.e., there are 2 • 2 • k2R conv-filters. ](https://ws1.sinaimg.cn/large/007tAU6Agy1fz0d43fwbaj30ih0ft77r.jpg)

- Pairwise roi pooling（为了实现以上思想，设计了以下pooling方案：）

![(O '(Cd + + = (C:\Users\nian\OneDrive\NoteBook\narcissuscyn.github.io\_posts\assets\clip_image006-1547018446020.png)Js ](https://ws1.sinaimg.cn/large/007tAU6Agy1fz0d4htr8mj30hn01jmx2.jpg)

- 1）subject、object pooling：主要判断两个物体哪个是subject，哪个是object，以subject的分数计算为例，文章说这种设计是position-sensitive的，我不是很懂：

![(C:\Users\nian\OneDrive\NoteBook\narcissuscyn.github.io\_posts\assets\clip_image007-1547018446020.png) = vote  pool  (3)  where k = 3, pool(•) is mean pooling, and vote(•) is aver-  age voting (e.g., average pooling for the scores of the grids).  ss ub (P) is position-sensitive because Eq. (3) aggregates re-  sponses for a spatial grid of Rol subject to the correspond-  ing one from the k2 maps (e.g., in Figure 3 left, the dark  red value pooled from the top-left grid of the Rol) and then  votes for all the spatial grids. Therefore, the training will  shepherd the k2 R subject filters to capture subject position  in an Image. ](https://ws1.sinaimg.cn/large/007tAU6Agy1fz0d4q3aemj30i30axq4q.jpg)

- 2）joint pooling 为了捕捉subject和object的相对位置关系，与1）不同的是grids是建立在joint region的

![sjoint(C:\Users\nian\OneDrive\NoteBook\narcissuscyn.github.io\_posts\assets\clip_image008-1547018446020.png) = vote  pool xs  (xo  pool  (4)  where g(i' , j') n Pi denotes the intersected pixels between  g(i', j') and P', in particular, if g(i', j' F) Pi = d), pool(•) is  zero and the gradient is not back-propagated. We set k = 3,  pool(.) to average pooling, and vote(.) to average voting.  For example, for relation person-ride-bike, the pool-  ing result of person Rol is usually zero at the lower grids  of the joint ROIS while that of bike Rol is usually zero at  the upper grids. ](https://ws1.sinaimg.cn/large/007tAU6Agy1fz0d4zx6fsj30ih0cwdhq.jpg)

# 5.损失函数

Follow[34]，Multi-task loss:

![reg  mg  tm g  (C:\Users\nian\OneDrive\NoteBook\narcissuscyn.github.io\_posts\assets\clip_image009-1547018446020.png)  where a is empirically set to 0.2. We train the PPR-FCN  model by SGI) with momentum [19]. ](https://ws1.sinaimg.cn/large/007tAU6Agy1fz0d5iywjrj30i104cq3b.jpg)

- 1）WSOD loss：（这个loss是图像级的类别分数）

![= -E logsc + log(C:\Users\nian\OneDrive\NoteBook\narcissuscyn.github.io\_posts\assets\clip_image010-1547018446020.png)) , (5) ](https://ws1.sinaimg.cn/large/007tAU6Agy1fz0d5iywjrj30i104cq3b.jpg)

根据[10]又考虑了位置上的关系（上面这个loss不能保证空间位置上的平滑性）：

![detection [10], we regularize the smoothness as: 1) for each  foreground class c G {1, ..., C}, the top high-scored regions  (C:\Users\nian\OneDrive\NoteBook\narcissuscyn.github.io\_posts\assets\clip_image011-1547018446021.png) and their neighborhood with IOU 0.5 should  both have high scores; we consider them as the pseudo pos-  itive regions; and 2) the neighborhood of the pseudo posi-  tive regions with 0.1 IOU 0.5 should be pseudo back-  ground regions (c = O). In this way, our spatial smoothness  regularization loss is:  ceC ieCc  iet3  where Cc is the set of pseudo positive regions for class  c # O, and B is the set of pseudo background regions. We  follow a similar sampling strategy as in [34]: 256 regions  are sampled, where at least 75% are the pseudo background  regions. ](https://ws1.sinaimg.cn/large/007tAU6Agy1fz0d6btp6gj30hz0er76t.jpg)

- 2）WSPP loss:

![WSPP Loss. Suppose R is the set of the image-level  relation groundtruth triplets, specifically, (C:\Users\nian\OneDrive\NoteBook\narcissuscyn.github.io\_posts\assets\clip_image012-1547018446021.png) e R,  where s, o G {1, ...,C} are the labels of the subject  and object. Suppose Cs and Co are the region sets of  subject s and object o, respectively. Denote Sr =  S (P' P') as the image-level predicate score,  i€Cs r t•, J  the image-level predicate prediction loss is defined as:  cered = _E(I  log Sr +  (7) ](https://ws1.sinaimg.cn/large/007tAU6Agy1fz0d6kuo5lj30i90agq4k.jpg)

# 6.实验

- 1）物体检测结果，提升主要来自于全卷积网络，而且WSOD往往能发现discriminative parts of objects

  ![](https://ws1.sinaimg.cn/large/007tAU6Agy1fz0d776whrj30ds06kq3m.jpg)

- 2）谓词检测结果，结果说明考虑position和sequence的网络要更优，用全连接层的要优于pooling-based methods，本文用这类方法是为了减少计算量

![Table 2. Predicate prediction Irrformances of various  methods on VRD and VG. The llst two rows are fc-based methods.  Pos*Pairw ise  Pos•JointBox  Pos Seq +Pairw ise+fc  VTransE  R@50  24.30  29.57  2, 74  47.43  44.76  R@IOO  24.30  29.57  47.43  44_76  R@SO  43_30  45_69  61.5  64.17  62.63  4361  45.78  64M,  6287 ](https://ws1.sinaimg.cn/large/007tAU6Agy1fz0d7cc8fnj30dl06074u.jpg)

- 3）phrase和关系检测结果

Supervised-PPR-FCN优于VtransE,因为其pair-wise roi pooling，有用的spatial context 速度相对于VtransE更快，参数更少

# 7.实现

数据：

VG is annotated by crowd workers and thus the relations labeling are noisy, e.g., free-language and typos. Therefore, we used the20pruned version provided by Zhang et al. [48].


text:
# gorm  <github.com/opentracing-contrib/gorm>

Package gorm provides a means of instrumenting GORM database operations.

To trace GORM operations, import the appropriate apmgorm/dialects package (instead of the gorm/dialects package), and use apmgorm.Open (instead of gorm.Open). The parameters are exactly the same.

Once you have a *gorm.DB from apmgorm.Open, you can call apmgorm.WithContext to propagate a context containing a transaction to the operations:

```
import (
    apmgorm "github.com/opentracing-contrib/gorm"
    _ "github.com/opentracing-contrib/gorm/dialects/mysql"
)

func main() {
	db, err := apmgorm.Open("mysql", "")
	...
	db = apmgorm.WithContext(ctx, db)
	db.Find(...) // creates a "SELECT FROM <foo>" span
}
```

repository: opentracing-lib/gorm

gha_language: Go

repo_name: opentracing-lib/gorm


text:
A rule-fitting solver, which takes an OpenFlow 1.3 ruleset and transforms it to fit a new constrained fixed-function pipeline.

### Running

The main executable is ```ofsolver``` and is installed to
/usr/bin in your python environment.

To use the recommended settings run:
```
ofsolver --progress ruleset.pickle ttp.json
```
Where ```ttp.json``` is a [Table Type Pattern](https://www.opennetworking.org/wp-content/uploads/2013/04/OpenFlow%20Table%20Type%20Patterns%20v1.0.pdf) encoded as JSON and  ```ruleset.pickle``` is in the format supported by [ofequivalence](https://github.com/wandsdn/ofequivalence). You can collect a ruleset in this format from a switch using this script: [collect_state.py](https://github.com/wandsdn/ofequivalence/blob/master/scripts/collect_state.py).

There are some sample rulesets and patterns in ```tests/```, e.g.:
```
ofsolver --progress tests/rulesets/sample_rules.pickle tests/ttps/test_pipeline2.json
```

For more advanced settings check --help:
 ```ofsolver --help
usage: ofsolver [-h] [-t] [-d] [-s] [-a {Search,SAT,SSAT,SingleSAT,Genetic}]
                [-p] [--progress] [-l {CRITICAL,ERROR,WARNING,INFO,DEBUG}]
                [--ttp-log-level {CRITICAL,ERROR,WARNING,INFO,DEBUG}] [-C]
                [-f | -b] [-i ITERATIONS] [-M] [-R] [-G]
                [-o {NO_CONFLICT,NO_HIT,NO_MISS,NO_PLACEMENT,NO_PLACEMENT_CONFLICT,NO_SAME_TABLE}]
                capture ttp

Transforms an OpenFlow ruleset to fit a fixed-function pipeline

positional arguments:
  capture               A file of a pickled set of flow rules, either a full
                        state capture or list of flow stats
  ttp                   A JSON Table Type Pattern description

optional arguments:
  -h, --help            show this help message and exit
  -t, --time            Collect timing information
  -d, --dummy           Use dummy multiprocessing i.e. threading
  -s, --single          Use the single threaded solver
  -a {Search,SAT,SSAT,SingleSAT,Genetic}, --algorithm {Search,SAT,SSAT,SingleSAT,Genetic}
                        The algorithm to use
  -p, --print-failure   Prints additional information about a failure
  --progress            Track progress throughout the solver, adds progress
                        bars to loops.
  -l {CRITICAL,ERROR,WARNING,INFO,DEBUG}, --log-level {CRITICAL,ERROR,WARNING,INFO,DEBUG}
                        The solvers logging level
  --ttp-log-level {CRITICAL,ERROR,WARNING,INFO,DEBUG}
                        The logging level used when loading the TTP
  -C, --no-compression  Disable compression of the input ruleset.
  -f, --full            Collect all valid results
  -b, --best            Check all results, only save the best and worst
  -i ITERATIONS, --iterations ITERATIONS
                        Limit the iterations of the solver
  -M, --no-merge        Disable merge placements
  -R, --no-reactioning  Disable reactioning. Reactioning tries to replace a
                        placement with a placement from another rule with the
                        same match but different actions. See
                        ofsolver.solver.Solver.reactioning
  -G, --no-generalisation
                        Disable generalisation. Generalisation creates rules
                        with less specific matches. See
                        ofsolver.solver.valid_generalisation.
  -o {NO_CONFLICT,NO_HIT,NO_MISS,NO_PLACEMENT,NO_PLACEMENT_CONFLICT,NO_SAME_TABLE}, --option {NO_CONFLICT,NO_HIT,NO_MISS,NO_PLACEMENT,NO_PLACEMENT_CONFLICT,NO_SAME_TABLE}
                        Additional solver specific options
```

### Installing

Install the C library requirements for [gmpy2](https://gmpy2.readthedocs.io/en/latest/) as required by [ofequivalence](https://github.com/wandsdn/ofequivalence). For Debian based distributions run:
```
apt install libgmp-dev libmpfr-dev libmpc-dev
```
Install the python requirements. In the root directory (containing this readme) run:
```
pip install -r requirements.txt
```
Download the required [minisat-zmq](https://github.com/wandsdn/minisat-zmq) and [muser2](https://bitbucket.org/anton_belov/muser2/src/master/) binaries, these are placed locally in the ofsolver directory. Alternativelly see the documentation of those projects and install the binaries to the system path.
```
./setup.py download
```
Install the ofsolver tool and library (use the pip --user option to install for only the local user):
```
pip install .
```

### Running tests

Note: tests require minisat to be installed to the system path (on debian based systems ```apt install minisat2```).

Unittest is used to run tests.

In the root directory, the following command will run the tests locally:
```
./setup.py test
```
Or alternatively:
```
python -m unittest discover -v
```

### License

The code is licensed under the Apache License Version 2.0, see the included
LICENSE file.

repository: wandsdn/ofsolver

repo_name: wandsdn/ofsolver


text:
# Kibana Alert & Report App for Elasticsearch

> Data Series are awesome, but who's Watching them 24/7/365? Introducing KaaE, the Kibana Watcher

---
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/77b040968c354d6597ff60a615195a1a)](https://www.codacy.com/app/lorenzo-mangani/kaae?utm_source=github.com&utm_medium=referral&utm_content=elasticfence/kaae&utm_campaign=Badge_Grade)

**KaaE** extends *Kibana* with **Alerting** and **Reporting** functionality to monitor, notify and report on data series changes using standard queries, programmable validators and a variety of configurable actions - Think of it as a free an independent ["Watcher"](https://www.elastic.co/guide/en/watcher/current/introduction.html) and ["Reporting"](https://www.elastic.co/products/reporting) alternative.

**KaaE** is also designed to simplify the process of creating and managing alerts and reports in Kibana via its integrated  App and Spy integration, while retaining baseline *logic and configuration style compatibility* with the Elastic counterparts.

---

### Kibana Plugin: Kaae Spy
The Kaae integrated Kibana plug-in extends the default Spy functionality to shape new prototype Watchers based on Visualize queries, and providing them to Kaae for fine editing and deployment.

---

### Kibana Alerts Display
KaaE alerts can easily be displayed back in Kibana dashboards using [saved search](https://github.com/elasticfence/kaae/wiki/KAAE-Alerts-in-Dashboard) visualizations

### Kibana Report Snapshots
Boss wants to see charts and reports? KaaE can grab timed snapshots of Kibana dashboards _(or any other website)_ and deliver them via email using the [report](https://github.com/elasticfence/kaae/wiki/KAAE-Report-Example) action

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

## App Installation

#### Snapshot Plugin Install

/opt/kibana/bin/kibana plugin --install kaae -u https://github.com/elasticfence/kaae/releases/download/snapshot/kaae-latest.tar.gz

#### Dev Plugin Install

git clone https://github.com/elasticfence/kaae
cd kaae && npm install && npm run package
/opt/kibana/bin/kibana plugin --install kaae -u file://`pwd`/kaae-latest.tar.gz

#### Dev Plugin Remove

/opt/kibana/bin/kibana plugin -r kaae

## Configuration & Usage

Consult our [wiki](https://github.com/elasticfence/kaae/wiki) to learn how to configure and use **KaaE** and program awesome Watchers

## Project Status

* Working Status, more testers needed!
  * Please [report](https://github.com/elasticfence/kaae/issues) any ideas, bug reports and findings
* Contributors Needed! If you know angular and elasticsearch, consider joining us!

## License

This software is licensed under the Apache License, version 2 ("ALv2"), quoted below.

Copyright 2016, Lorenzo Mangani<EMAIL_ADDRESS>Copyright 2015, Rao Chenlin<EMAIL_ADDRESS>
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: phachon/kaae

repo_name: phachon/kaae


text:
# mastercard
Technical Interview Assignment for Mastercard

## DevOps Engineer Code Test

> Simply run `docker-compose up` in 1_nginx_apache, modify your `/etc/hosts` file to include something like `<IP_ADDRESS> example.com www.example.com` and navigate to https://www.example.com/?foo and http://www.example.com:8080/?bar

1. In any Linux based system (CentOS/RHEL preferred):

    a. Configure logrotate to rotate /var/log/httpd/access_log (or equivalent) hourly

> Doing this in a Docker container is a bit clunky, and I generally wouldn't ever actually configure log rotation in a container like this

    b. Configure an Apache HTTPD VirtualHost to do all of:

        i. Show a test page at https://example.com,

        ii. Redirect http to https, while maintaining all URL parameters,

        iii. Redirect www.example.com to example.com.

    c. Configure nginx as a load balancer to a local Apache HTTPD listening on 8080-8090

> I couldn't tell whether it's NGINX or Apache that should be listening on 8080-8090 - so I just went with NGINX

2. In your favourite programming language (PHP or Python preferred):

    a. Write code that will find a duplicate value in an array.

    b. Do the same for dictionaries.

3. We need to troubleshoot our website at https://www.mastercard.ca/. In any Linux based
system, use CLI tools to do the following (send us commands + outputs):

    a. Test if port 443 is answering at the IP address of our website.

    b. Check when the SSL certificate expires.

    c. Connect to http://www.mastercard.com/ using telnet and “GET /” (note: not https).

4. Package managers can be used to install software packages such as RPMs. Generally, companies and individuals host mirrors and package repositories in a website or ftp. An alternative is to use a system like AWS S3 to host a repository.

    While public repositories are great, sometimes a privately hosted repository is desired for internal software. In these situations, you could host a private web server in your environment.

    Alternatively, a “serverless” approach could be to use S3 with an authentication scheme like IAM through the usage of a yum plugin. Write a value state / formula for a configuration management tool (SaltStack preferred) to install a S3 yum plugin (https://github.com/seporaitis/yum-s3-iam) and configure it.

> Wasn't able to finish this.  It was my plan to configure a working solution that used Minio to host a private S3-based Yum repository that could be accessed from another container.  The Minio Yum repository would contain the RPM produced in problem #5.  -- I'd need at least a few more hours for this.

5. Building an RPM for easy management of internal software is a common strategy to deploy
software. Create an RPM of a command line tool that prints out “Awe$ome”. Bonus: install this
in a fashion like #4 above.

> Enter `5_rpm` and issue `docker-compose up` to build the RPM

Zip up all relevant files and send back to us.

Best regards, and good luck!

license: Unlicense


text:
# Unlimited Cactus Cane

## Setup

Build it yourself or download a copy from [releases](https://github.com/ehwuts/UnlimitedCactusCane/releases/).

## License

This project is made available under the MIT license.

repository: ehwuts/UnlimitedCactusCane

gha_language: Java

repo_name: ehwuts/UnlimitedCactusCane


text:
---
layout: post
title: Developing AGI scripts with phpagi and Docker
---

The Asterisk Gateway Interface (**AGI**) is an interface for adding functionality to Asterisk with many different programming languages.

The [Agiphlow phpagi][agiphlow-phpagi] is a PHP library that implements the AGI protocol. It is based on the [phpagi project](http://phpagi.sourceforge.net/).

In this article we will create a Docker image that will let us develop AGI scripts using the [Agiphlow phpagi][agiphlow-phpagi] library

We'll start by creating a directory to place our source:

```sh
mkdir phpagi-test
cd phpagi-test
```

Now let's create a `composer.json` file to install `agiphlow/phpagi`:

```json
{
  "require": {
    "agiphlow/phpagi": "dev-master"
  },
  "minimum-stability": "dev"
}
```

Install dependencies using composer:

```sh
composer install
```

You will now see a `vendor` directory where the `agiphlow/phpagi` library has been installed.

## Dockerfile
Now,  we'll create a docker image we can reuse for all of our `agiphlow/phpagi` scripts.
We will base our image on [dougbtv/asterisk](https://hub.docker.com/r/dougbtv/asterisk/) image which already has an Asterisk Server installed:

```Dockerfile
FROM dougbtv/asterisk
```

Then we add the following line to install php on our image:

```Dockerfile
RUN yum install -y php
```

We'll define a SIP user so we can connect to our Asterisk Server to make test calls. We can achieve this appending the follwing lines to the SIP module config file (`/etc/asterisk/sip.conf`):

```Dockerfile
[phpagi]
defaultuser=phpagi
secret=secret
context=agiphlow-phpagi
type=friend
host=dynamic
insecure=port,invite
```
In our `Dockerfile` this will look something like this:

```Dockerfile
RUN printf "\n\
[phpagi]\n\
defaultuser=phpagi\n\
secret=secret\n\
context=agiphlow-phpagi\n\
type=friend\n\
host=dynamic\n\
insecure=port,invite\n"\
>> /etc/asterisk/sip.conf
```
As you can see, we defined the user *phpagi* with the context *agiphlow-phpagi*.

Now let's create an extension we can dial in to run our agi script. We can achieve this by appending the following lines to Asterisk's extension file (`/etc/asterisk/extensions.conf`):

```
[agiphlow-phapgi]
exten => 100, 1, AGI(/phpagi/agi.php)
same  =>      n, Hangup()
```

This defines the extension *100* on the *agiphlow-phpagi* context. When we dial extension *100* from our SIP client, the AGI script `/phpagi/agi.php` will get executed.

So our `Dockerfile` will end up looking like this:

```Dockerfile
FROM dougbtv/asterisk

# Install php
RUN yum install -y php

# Define SIP user
RUN printf "\n\
[phpagi]\n\
defaultuser=phpagi\n\
secret=secret\n\
context=agiphlow-phpagi\n\
type=friend\n\
host=dynamic\n\
insecure=port,invite\n"\
>> /etc/asterisk/sip.conf

# Define extension in dialplan
RUN printf "\n\
[agiphlow-phpagi]\n\
exten => 100, 1, AGI(/phpagi/agi.php)\n\
same  =>      n, Hangup()\n"\
>> /etc/asterisk/extensions.conf
```

Let's build our image:

```sh
docker build --tag phpagi-dev .
```

## Sample AGI script
Now, let's create an AGI script using `agiphlow/phpagi`. Create the file `agi.php` with the following content:

```php
#!/usr/bin/env php
<?php
require_once __DIR__ .'/vendor/autoload.php';

use Agiphlow\PhpAgi\Agi;

// turn on debugging
$agi = new Agi(array(
    'debug' => true,
    'use_default_error_handler' => true
));

// answer the call
$agi->answer();

// play message
$agi->stream_file('hello-world');

// hangup
$agi->hangup();

```

Make sure the script is executable:

```sh
chmod +x agi.php
```

## Run docker container

> **Note:** SIP uses a wide range of UDP ports for RTP communication. Exposing many ports using docker's `expose` option can be very slow. For the purpose of this tutorial, we will use the `--net=host` option

```sh
docker run \
  --name phpagi-test \
  --net=host \
  -v `pwd`:/phpagi \
  -d -t phpagi-dev
```

As you can see, we mounted the current directory (`pwd`) on the container's `/phpagi` directory. That's where Asterisk will look for the `agi.php` script.

## Make test calls
Use your favorite SIP client to register to the SIP Server. Remember that since we used the `-net=host` option, you should point your SIP client to the IP Address of the machine where `docker` is running.

## Debugging
To debug your script use docker logs:

```sh
docker logs -f phpagi-test
```

   [agiphlow-phpagi]: <https://github.com/agiphlow/phpagi>


text:
# Task2-1
# IDE

## **PyCharm vs Visual Studio Code**

The Most Intelligent IDE is **PyCharm**. Python, JavaScript, CoffeeScript, TypeScript, CSS, major template languages, and more are all supported by PyCharm's smart code editor. Take advantage of code completion, error detection, and on-the-fly code updates that are language-aware!.
**Microsoft's Visual Studio Code** allows you to create and debug modern online and cloud apps. Create and debug cutting-edge online and cloud apps. Code is accessible for free on your preferred platform, including Linux, Mac OSX, and Windows.

## **Performance**

When compared to **PyCharm**, **Microsoft's Visual Studio Code is substantially faster**. When compared to **PyCharm, it is extremely light**. Visual Studio Code is the clear winner when it comes to a **modular approach to wiring code.** **Microsoft's integrated development environment (IDE) offers a large number of extensions, add-ons, and other libraries.** **PyCharm is said to have a very long lead time.**

## **Virtual environment**

In the development of libraries and experiments, the virtual environment is critical. Several Python interpreters are supported by Visual Studio Code. You can manually add virtual environments and designate their interpreters as the default in PyCharm. The biggest issue with these settings is their slowness. Both IDEs have a certain level of delay.

## **Extensions**

Most IDEs allow you to go beyond "compile and execute" in terms of functionality. Both IDEs' marketplaces enable a variety of extensions that provide new features and services. **The PyCharm and Visual Studio communities each have a strong following**. Because **PyCharm is designed only for Python programmers**, you will need to download and install alternative IDEs for other programming languages. Here, **Visual Studio Code is more modular; all it needs to know is what type of project you're working on right now. It has the ability to enable the plugins required for that particular project.**

---------------------
# **Operating System**

## Linux vs Windows

1. Open Source:

    Unlike the commercial Windows operating system, **Linux is an open source operating system that may be downloaded for free**. Hundreds of Linux distributions are available, with around 500 under active development. and the most popular one is Ubuntu

2. Faster Software Updates:

    In Linux, software updates are delivered more quickly. Users receive updates instantly if bugs are discovered; they do not have to wait long. Free development libraries and tools are available.

3. Performance:

    Linux is a more powerful and adaptable operating system than Windows. Linux is lightweight, making it speedier than Windows. When you first start working with a Linux distribution, you will notice a big increase in speed.

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

# Version-control platform

- ## **GitHub vs GitLab**

## **Authentication Levels**

You can set and edit people's permissions in **GitLab** based on their roles. You can choose whether someone has read or write access to a repository in **GitHub**.

You can give someone access to the issue tracker (for example) without giving them access to the source code with GitLab. Larger teams and businesses with role-based contributors would benefit greatly from this.

## **Issue Tracking**
GitLab and GitHub both have a simple issue tracker that allows you to update the status and assignee for several issues at once.

## **The Community**
**GitHub** made a name for itself in the development community. And the incredibly active GitHub community of millions of developers is mostly responsible for its popularity. You can talk about issues and possibly pick up a few unofficial skills. **GitLab**, on the other side, did some fantastic things like host community events and connect open source contributors.

# task2-2

in this project, i will use these:

## For IDE

 Visual Studio Code: since I will be developing a web application using JS, HTML, and CSS, also I can easily export my code into GitHub, download the extensions that I need. lastly, I'm used to using it. **And I won't use the PyCharm** because It takes up more space than other text editors, which reduces code functionality. also, it's complicated to use it with virtual machine platforms and some version required cost.

## For Operating system

 I will be using Linux distribution because it's faster than windows OS, also The Linux terminal is better than the command line on Windows. Almost all programming languages are supported by Linux. and it's open-source, and almost most of the tools are free and easy to access with Linux. **And I won't use the windows OS** because its closed source, The tools that i need or might need will be hard to find it on windows os, also it is too slow for developing part and it might crash at any time.

## For The Version-control platform:

 I will be using GitHub because it's free and easy to use, also, it is easy to contribute to a project with a team because I will work with a team too.
 lastly, it's great for the documentation part of the assignment **And I won't use the GitLab** because it's not free, it needs a free trial for 30 days to use it.

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

# Task2-3:

accodring to my problem domain, i used VS code because its support HTML,CSS,JS at once and its full of extention that i nedded such as live server and its not complicated to link it with virtual machine platform. and i used linux OS because its fast than windows and its open source so i can easily download the tools that i need to use.
i used github because its support SSH keys, also its free and i can easily connect with my team into organization in github and create branches and mange our codes.

repository: QamarAlkhatib/ProjectTooling-AP

branch_name: refs/heads/main

repo_name: QamarAlkhatib/ProjectTooling-AP


text:
# CO2-Measurement-simple

A simple CO2 measurement device for about than 40 Euros or 50$ which does not require an additional microcomputer. It uses an analogue multiplier to show correct ppm values.

Please read this repository carefully to see what restrictions follow from this design.

# Simple design

This is the simple design:

The power cable is a cut USB cable.

It uses a MH-Z19B sensor, two integrated operation amplifiers and a small voltmeter.
There is no need for a further microcontroller.

For potential casings see [Casings](Casing.md).

# Simple design circuit diagram

[Back to top](../README.md)


text:
---
name: Bug report
about: Create a report to help us improve the stackstorm docker image

---

**Describe the problem**
A clear and concise description of what the problem is.

**Versions**
 - Host OS: [e.g. Ubuntu 18.04]
 - docker: [e.g. 18.09.1-ce]
 - docker-compose: [e.g. 1.21.1]
 - stackstorm version: [e.g. v3.3.0]

**To Reproduce**
If necessary, please specify steps to reproduce the behavior.

gha_language: Shell


text:
# CSS-Positioning

## About The Project
This project is about depecting how features can be positioned on a web page using CSS

## Image
![landing page.](landing.jpg "This is the welcome interface")

## Built With
* CSS
* HTML

## Author
* 👨🦱Ezekiel Ogunniwa
  * Github: https://github.com/Eminentzeal
  * linkedin: https://www.linkedin.com/in/ogunniwaezekiel/
  * Twitter: https://twitter.com/Ogunniwaezekiel

## Facilitators
* [Godwin Nwachukwu](https://github.com/Gnwin).

* [Chioma Nwachukwu](https://github.com/Chiomy).

## Acknowledgements
* HomeFrontStartup
  * http://homefrontstartup.com.ng/
* Mentors International
  * https://mentorsint.com/
  * https://www.facebook.com/mentorshubyola/
  * https://twitter.com/hub_mic
  * https://www.linkedin.com/company/michub/

# Live Demo
[Click Here to see project live](https://raw.githack.com/Eminentzeal/CSS-Positioning/main/css%20absolute%20position/index.html)

## 🤝 Contributions
* This project is open to your comments and contributions, kindly reach the author through the above author's social media handles.

repository: Eminentzeal/CSS-Positioning

path: /css absolute position/README.md

repo_name: Eminentzeal/CSS-Positioning


text:
# Material UI Icons macro

A macro for expanding [Material-UI](https://github.com/mui-org/material-ui) Icons imports.

Material-UI encourages usage of direct deep imports.

```es6
// Material-UI suggested import
import CheckBox from '@material-ui/icons/CheckBox';
```

While that is motivated by impact on bundle size and build performance it might cause certain aesthetic and readability issues.

This macro enables the usage of namespace import without harming either.

The transformation:

```es6
import MuiIcons from<EMAIL_ADDRESS>
function Component() {
  return (
    <span>
      <MuiIcons.Checkbox /> some text
    </span>
  );
}
      ↓ ↓ ↓ ↓ ↓ ↓
import MuiIcons_Checkbox from '@material-ui/icons/Checkbox';

function Component() {
  return (
    <span>
      <MuiIcons_Checkbox /> some text
    </span>
  );
}
```

## Installation

This module is distributed via [npm](https://www.npmjs.com/) which is bundled with [node](https://nodejs.org/) and
should be installed as one of your project's `devDependencies`:

```bash
npm install --save-dev @ram-stack/material-ui-icons.macro
```

Assuming the project has `babel-plugin-macros` already configured (such as Create React App v2+ projects) no further action is required.
Otherwise see [`babel-plugin-macros`](https://github.com/kentcdodds/babel-plugin-macros) guide first.

## Usage

This macro is a drop in replacement for `@material-ui/icons` imports.
Replacing `import * as MuiIcons from '@material-ui/icons'` with `import MuiIcons from<EMAIL_ADDRESS>is the only thing needed.

The `MuiIcons` identifier can be renamed arbitrarily. The macro does not care about names.

### TypeScript usage

No extra setup is required. This package reexports the typings from `@material-ui/icons` and the typechecking works as if no substitution happened.

## See also

[`@ram-stack/material-ui.macro`](../material-ui.macro/README.md)
[`@ram-stack/import-replacer-helper`](../import-replacer-helper/README.md)

[`babel-plugin-macros`](https://github.com/kentcdodds/babel-plugin-macros)

## License

[MIT](LICENSE)

repository: InvictusMB/ram-stack

repo_name: InvictusMB/ram-stack


text:
# ractive-model

A Ractive adaptor for ractive data objects. This makes it possible to use template-less Ractive objects as models.

Ractive-Model is forked from [@rstacruz]'s [ractive-ractive](https://github.com/rstacruz/ractive-ractive) module and takes a wrapper-based approach to nesting Ractive models rather than applying the child data properties directly on the parent.

*Find more Ractive.js plugins at [docs.ractivejs.org/latest/plugins](http://docs.ractivejs.org/latest/plugins)*

## Example

```js
Ractive.defaults.adapt.push('Ractive');

parent = new Ractive();
user   = new Ractive();

parent.set('user', user);
```

Changes in children are propagated to the parent:

```js
user.set('name', 'Jake');
parent.get('user.name')   //=> "Jake"
```

Changes in the parent are propagated to the children:

```js
parent.set('user.name', 'Matt');
user.get('name')   //=> "Matt"
```

## Features

Everything you'd expect to work will work.

 * bi-directional propagation
 * observers
 * templates
 * computed properties

However, these things are not supported, but may be in the future:

 * circular dependencies (an error will be thrown)
 * events (see [ractive#1249])

## Wrap events

It will trigger a few events:

 * `wrap` - called when the instance is set as an attribute of another instance
 * `unwrap` - called when the instance has been unset from its parent
 * `wrapchild` - called when the instance gets an Ractive attribute set
 * `unwrapchild` - called when the instance gets an Ractive attribute unset

To illustrate:

```js
parent = new Ractive();
child  = new Ractive();

parent.set('x', child);
// triggers `wrap(parent, 'x')` on child
// triggers `wrapchild(child, 'x')` on parent

parent.set('x', undefined);
// triggers `unwrap(parent, 'x')` on child
// triggers `unwrapchild(child, 'x')` on parent
```

## Usage

ractive-model is available via npm.

    $ npm install --save ractive-model

[![npm version](http://img.shields.io/npm/v/ractive-model.svg?style=flat)](https://npmjs.org/package/ractive-model "View this project on npm")

Require the module to use. No need to consume the return value.

```js
require('ractive-model')
```

## Credits

Hat tip to the original Ractive adaptor from [@Rich-Harris].
([src](https://github.com/Rich-Harris/Ractive-plugins/blob/master/adaptors/Ractive.js))
Kudos for the original `ractive-ractive` from [@rstacruz].
([src](https://github.com/rstacruz/ractive-ractive))

## Thanks

**ractive-model** © 2015+, Elliot Chong. Released under the [MIT] License.

**ractive-ractive** © 2014+, Rico Sta. Cruz. Released under the [MIT] License.

Authored and maintained by Elliot Chong with help from contributors ([list][contributors]).

> GitHub [@ElliotChong](https://github.com/ElliotChong)  ·
> Twitter [@ElliotChong](https://twitter.com/ElliotChong)

[MIT]: http://mit-license.org/
[contributors]: http://github.com/ElliotChong/ractive-model/contributors
[ractive#1249]: https://github.com/ractivejs/ractive/issues/1249
[@Rich-Harris]: https://github.com/Rich-Harris

repository: ElliotChong/ractive-model

repo_name: ElliotChong/ractive-model


text:
# mecklenburg-quality-of-life-data

Mecklenburg County data for the Quality of Life Dashboard.

## Related Projects

- [quality-of-life-dashboard](https://github.com/tobinbradley/quality-of-life-dashboard)
- [quality-of-life-report](https://github.com/tobinbradley/quality-of-life-report)
- [quality-of-life-embed](https://github.com/tobinbradley/quality-of-life-embed)

## Get Started

This project requires [NodeJS](http://nodejs.org/).

```bash
git clone https://github.com/tobinbradley/mecklenburg-quality-of-life-data.git data
cd data
npm install
```

It isn't meant as a stand-alone repository, but rather to be used with the other Quality of Life projects.

## Customizing your Data

![data design](http://i.imgur.com/pRdRkFG.png)

There are several parts to configuring this repo:

- Creating your geography (GeoJSON)
- Creating your data files (CSV)
- Creating your metadata (Markdown)
- Updating configuration files

The existing files are a good guidepost for creating your own, so dig in before you get started.

### Creating your geography

The first thing you'll need is your geography, in GeoJSON. Your geography:

- Must be named `geography.geojson.json` and placed in the root folder.
- Must be WGS84 (EPSG:4326).
- Must contain an `id` property that's a string and a unique identifier for each polygon that you'll use for your data files.

For serving and rendering GeoJSON, smaller is better, but watch out for topologically unaware simplification tools, as they'll leave ugly slivers in your data. You could use `v.generalize` in [QGIS](http://qgis.org/en/site/) (or [GRASS](http://grass.osgeo.org/) directly), or you could go the shapefile->[topojson](http://grass.osgeo.org/)->geojson route.

### Creating your data files

Data files are simple CSV's in the format:

```csv
id,y_2000,y_2010
jim,23,432
suzy,,100
```

The file header is `id` and each year of data is expressed as `y_<year>`. No data values are empty, like `suzy,,100`. CSV files are processed into JSON by the consuming applications. Each metric file will be named with a metric number found in `/config/data.js`.

The type of data will decide the files required:

- `sum`: The data is summed when polygons are selected. This will require a `r<metric>.csv` file.
- `mean`: The data is averaged when polygons are selected. This will require a `n<metric>.csv` file.
- `weighted`: A weighted average is calculated when polygons are selected. This requires the raw data in `r<metric>.csv` and a denominator for weighting/calculations in `d<metric>.csv`. r/d is each individual polygon value.

After creating your data files, run the test suite to make sure the basics check out.

```bash
npm run test --silent
```

### Creating your metadata

Metadata files in markdown format are located in `/meta`. Each metadata file is named in format `m<metric number>.md` with heading tags _exactly_ like this:

```markdown
## Title of Metric

Median age of poodles

### Why is this important?

Because we like poodles.

### About the Data

I hang out at dog parks and type stuff in my phone. Circa 1986.

### Additional Resources

Dog pound yo.
```

The markdown is processed to HTML by the consuming projects, and as there's a lot of ugly text processing going on, messing with the layout will involve tinkering with code.

### Updating configuration files

There are four configuration files in `/config`:

- `data.json`: Configuration information for your metrics.
- `map.json`: Configuration information for your maps.
- `selectgroups.json`: Groups of your geography units that you want to make selectable as a group.
- `site.json`: Configuration for the site, like titles etc.

Check the `README.md` in the config folder for configuration options.

The `/config/legacy` folder is for an earlier version of the project.

In particular, you will also want to change the Mapbox GL JS `/gl-style/style.json` pointer in `main.js` to your own tiles, Mapbox tiles, OSM2VectorTiles tiles, or what have you. The tiles we use don't cover much of the planet beyond our needs. The excellent [OSM-Liberty](https://github.com/lukasmartinelli/osm-liberty) is provided as a drop-in replacement.

### Tips and Gotchas

#### CSV column case sensitivity

Spreadsheet software often likes to capitalize the first letter in the `y_XXXX` field. That will turn your life into a furious ball of nothing. On a 'nix machine you can fix your files automatically via `npm run clean-csv`.

#### Sort on the ID

Your CSV files should be sorted on the metric ID. On a 'nix machine you can sort them automatically via `npm run clean-csv`.

#### Beware the hanging zero

Some identifiers like Census tracts can have a hanging zero, like 541.10. If you are manipulating your data files in spreadsheet software, make sure your ID column is being treated as a string and not a number or it will get dropped and your life will be destroyed.

#### Don't add H2 (##) or H3 (###) tags to the metadata

Because we're using those as choppers for layout, adding more of those will screw up your formatting.

#### Beware weird, non-web safe characters in Markdown

Don't edit Markdown in Word. You're welcome.


text:
# DeskHubSharp
A desktop application that shows repos and user data from GitHub.

## Overview
Please note this application only works on Windows. Mono and Wine, I did not test. Future versions of this project
will include platform-agnostic capablities, so it is being worked on.

Things you can do with application is search GitHub users, look at repositories from a 10k foot view, go into to detail
with a certain repository and clone a branch of that repository. Does not include git features. Will add that in the future.

## Installation

This will be a standalone application in the future. For now, you will have to build this. Go into Visual Studio with
the .NET Framework 4.6.1 or greater installed and click Start. This will build the applcaition and run this in debug mode.

That should be it.

## Running

Look at installation for details.

## Contributions

I don't know, I have to figure this out later.

## Troubleshooting

Found a bug? You want a new feature in the program? Use the feedback form in the application or<EMAIL_ADDRESS>me!

repository: wymillerlinux/DeskHubSharp

gha_language: C#

repo_name: wymillerlinux/DeskHubSharp


text:
godi
===========
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/asaskevich/godi?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![GoDoc](https://godoc.org/github.com/asaskevich/godi?status.png)](https://godoc.org/github.com/asaskevich/godi)
[![Build Status](https://travis-ci.org/asaskevich/godi.svg?branch=master)](https://travis-ci.org/asaskevich/godi)
[![Coverage](https://codecov.io/gh/asaskevich/godi/branch/master/graph/badge.svg)](https://codecov.io/gh/asaskevich/godi) [![Go Report Card](https://goreportcard.com/badge/github.com/asaskevich/godi)](https://goreportcard.com/report/github.com/asaskevich/godi) [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fasaskevich%2Fgodi.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fasaskevich%2Fgodi?ref=badge_shield)

Dependency injection in Golang at runtime.

#### Installation
Make sure that Go is installed on your computer.
Type the following command in your terminal:

	go get github.com/asaskevich/godi

or you can get specified release of the package with `gopkg.in`:

	go get gopkg.in/asaskevich/godi.v1.0.0

After it the package is ready to use.

#### Import package in your project
Add following line in your `*.go` file:
```go
import "github.com/asaskevich/godi"
```

#### Example of usage
```go
type Repository struct {
	Driver CustomDriver `godi:"autowire"`
}

type CustomDriver struct {
	Name string
}
...

c := Container{}
c.New()
c.RegisterService(CustomDriver{Name:"my_driver"})

service, err := c.ConstructService(Repository{})

println(service.(Repository))
```

## License
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fasaskevich%2Fgodi.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fasaskevich%2Fgodi?ref=badge_large)

repository: fossabot/godi

repo_name: fossabot/godi


text:
Build v1.0

Link to the repository: https://github.com/LazyFoxStudio/Project-2
Link to the web page: https://lazyfoxstudio.github.io/Project-2/

- Install and play:

Open Alliance: The Last Bastion.exe file to play the game

- The Game:

Collect wood and gold by building Lumber mills and mines and assigning workers to them, produce workers by building farms, and recruit troops in the barracks, gnome hut and church.
You can find upgrades for your troops in the blacksmith.
Try to protect your Town Hall and last as long as possible using your troops and your hero's powerful spells.

Controls:
-Mouse & Arrows: Move the camera
-Left click and Drag: Select units
-Right click: move units
-Right click on an enemy unit: Attack
-Use the keys 	Q W E to build when selecting the town hall, or to use your hero abilities.
		A S D
		Z X C
-Hero abilities:
	- Mage: Powerful hero with damaging spells.
		-Icicle Crash: Area damage spell
		-Overflow: Single target long range damage
		-Dragon Breath: Line damage.
	- Paladin: Resilient hero with support ablities.
		-Consecration: Area damage around the paladin.
		-Circle of light: Area healing spell.
		-Honor of the pure: Buffs the allies near the paladin.

Options:
You can change the volume of the music and sfx in the options menu. Also the hotkeys assigned to the menu buttons can be changed to other letter keys.

Team members:

Marc Garcia - Team Lead: https://github.com/MaxitoSama

Lorien Portella - Designer: https://github.com/Witiza

Josep Pi - Manager: https://github.com/joseppi

Rodrigo de Pedro - Programming Leader: https://github.com/rodrigodpl

Ivan Drofiak - Artist: https://github.com/FurryGhoul

Jaume Surís - Audio: https://github.com/Farmak09

Adrià Ferrer - UI Designer: https://github.com/Adria-F

Hugo Bo - QA: https://github.com/Hugo-Bo-Diaz


text:
# favis-ci-rails

Continuous Integration in your Favicon.

# Introduction

This is a gem for [jaunesarmiento][jaunesarmiento]'s [favis-ci][lib]

[jaunesarmiento]: https://github.com/jaunesarmiento
[lib]: https://github.com/jaunesarmiento/favis-ci

![](https://raw.github.com/jaunesarmiento/favis-ci/master/docs/buildstatus.png)

## Installation

Add this line to your application's Gemfile:

    gem 'favis-ci-rails'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install favis-ci-rails

# Usage

You need to add the following  your `application.js` or `application.js.coffee`:
```coffeescript
#= require favis-ci
```

To use Favis-CI on your pages, just do:
```javascript
var favis = new Favis('<username>/<repository>');
```

For example, to generate a Favis CI favicon for the Ember.js project, do:

For coffeescript
```coffeescript
favis = new Favis('emberjs/ember.js')
```

For javascript
```javascript
var favis = new Favis('emberjs/ember.js');
```

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

repository: jaemar/favis-ci-rails

repo_name: jaemar/favis-ci-rails


text:
# hackathon-4-challenge

Read the challenge instructions document [here](https://docs.google.com/document/d/1LzkJ5eIQndznpJrJnDp-eTNvitYnoXMUymYn2aTmM9Q/edit?usp=sharing).

Download the dataset [here](https://drive.google.com/file/d/0B2HqqTPPXngoNS1nWUVXdWJCemc/view?usp=sharing), where you'll find:

* train.csv
  * Has the users’ play history. Each row of the file is a record with a user_id, artist_id, artist_name and play_counts, where the play_counts represents the number of times the user played a song by the artist.
* tags.csv
  * Each row associates an artist_id with a tag, which is a word that describes a song by the artist.
* test.csv
  * Has the ids of the users that should receive a recommendation.
* sample_submission.csv
  * Which is exactly what it says it is!

And in this repository, you have a challenge.ipynb empty notebook for your solution for the challenge.

## Submission

You can upload your submissions [here](http://hackathon-4.lisbondatascience.org/).

Your submission file should be a csv with the following two columns:

* user_id - the user ids must match the ones in test.csv, in the same order
* top5 - this is a string with the list of artist_ids (strings) that you are recommending to the user.


text:
## Installation of example app (at tutorial starting point)

(For the full final app, see the [`src` directory](/src))

Assuming you have [Node](https://nodejs.org/en/) installed, clone this repo and run `npm install` in the `src-start` directory.

#### Command line:

```
git clone https://github.com/binaryfunt/electron-seamless-titlebar-tutorial.git

cd electron-seamless-titlebar-tutorial/src-start

npm install

npm start
```


text:
# Pool area

## Introduction
The Swimming Company has asked you to write an application that calculates the volume of cuboid shaped pools.

## Tasks
1. Write a class with the name `Rectangle`. The class needs two fields (instance variable) with name `width` and
`length` both of type `double`
* The class needs to have one constructor with parameters `width` and `length` both of type `double` and it needs to initialize the fields
* In case the `width` parameter is less than `0` it needs to set the `width` field value to `0`
* In case the `length` parameter is less than `0` it needs to set the `length` field value to `0`
** Method named `getWidth` without any parameters, it needs to return the value of `width` field
** Method named `getLength` without any parameters, it needs to return the value of `length` field
** Method named `getArea` without any parameters, it needs to return the calculated area` (width * length)`

2. Write a class with the name Cuboid that extends `Rectangle` class. The class needs one field (instance variable)
  with name height of type `double`
* The class needs to have one constructor with three parameters `width`, `length`, and height all of type `double`
* It needs to call parent constructor and initialize a height field
** In case the height parameter is less than `0` it needs to set the height field value to `0`
** Method named `getHeight` without any parameters, it needs to return the value of `height` field.
** Method named `getVolume` without any parameters, it needs to return the calculated `volume`
* To calculate volume `multiply the area with height`

## Example input
``
Rectangle rectangle = new Rectangle(5, 10);
System.out.println("rectangle.width= " + rectangle.getWidth());
System.out.println("rectangle.length= " + rectangle.getLength());
System.out.println("rectangle.area= " + rectangle.getArea());
Cuboid cuboid = new Cuboid(5,10,5);
System.out.println("cuboid.width= " + cuboid.getWidth());
System.out.println("cuboid.length= " + cuboid.getLength());
System.out.println("cuboid.area= " + cuboid.getArea());
System.out.println("cuboid.height= " + cuboid.getHeight());
System.out.println("cuboid.volume= " + cuboid.getVolume());
``

## Example output
``
rectangle.width= 5.0
rectangle.length= 10.0
rectangle.area= 50.0
cuboid.width= 5.0
cuboid.length= 10.0
cuboid.area= 50.0
cuboid.height= 5.0
cuboid.volume= 250.0
``

repository: jdnierth/java-coding-exercises

repo_name: jdnierth/java-coding-exercises


text:
# Task 1: Track and share your own work

## Task
Create a local repository, link it to a remote repository on GitHub, and practice changing the repo and sharing your changes on GitHub.

## Add to your drawing
As you go through these steps, add to your drawing the commands that move changes between different parts of the git project.

## If you need a hint
Look at [this version](https://github.com/koudyk/intro_git_github/blob/main/2-in-class-tutorial/HINTS__task-1_track-and-share-your-work.md
) of this file to see which git command(s) to use for each step and which commands to put on your drawing.

## Steps
1. Make a directory somewhere on your machine (make its name unique so there isn't another with the same name on GitHub

2. Change into the directory

3. Initialize a git repository

4.  Stage the change

7. Commit the change

8. Make a PUBLIC repository on GitHub with the same name (if it's private, you won't be able to do the collaboration task; you can delete it afterwards).

9. Once you create your repo on GitHub, it will bring you to a page with a heading *"... or push an existing repository from the command line"*. Use this code to tell git the shortname and address of your remote repository, rename your principal branch to 'main', and push your local repo contents to the remote repo.

10. If you have time before the next task, repeat these steps a few times:
      - Change your file
      - Stage the change
      - Commit the change
      - Push the change to GitHub


text:
# Gitea package for YunoHost

Gitea is a self-hosted Git service written in Go. Alternative to Github.
- [Gitea website](http://gitea.io)

## Requirements
A functional instance of [YunoHost](https://yunohost.org)

## Installation
From the command-line:

`sudo yunohost app install -l Gitea https://github.com/npe-2012/gitea_ynh`

## Upgrade
From the command-line:

`sudo yunohost app upgrade -u https://github.com/npe-2012/gitea_ynh gitea`

## Notes on SSH usage
If you want to use Gitea with ssh and be able to pull/push with you ssh key, your ssh daemon must be properly configured to use private/public keys. Here is a sample configuration of `/etc/ssh/sshd_config` that works with Gitea:

```bash
PubkeyAuthentication yes
AuthorizedKeysFile %h/.ssh/authorized_keys
ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM no
```

You also need to add your public key to your Gitea profile.

If you use ssh on another port than 22, you need to add theses lines to your ssh config in `~/.ssh/config`:

```bash
Host domain.tld
    port 2222 # change this with the port you use
```

## Info on upgrading from the old package version (gitea <0.9.xx)
Previous versions of this package used to build Gitea from sources instead of using the pre-compiled binary. It also left data in many places which was not good. The upgrade tries to take care of moving everything to the right place **BUT it's strongly advised to do a backup of your repositories and of the Gitea directory before the update**. Your avatars and issue attachments files may be lost in the process.

Also, in some cases, Gitea will not restart properly during the update. If so, you can rerun the update safely or try to start Gitea with `sudo systemctl restart gitea.service`.

Sources and issues of the old package can be found [here](https://github.com/YunoHost-Apps/gogs_ynh_old/)

## Info
Gitea v0.11

- [YunoHost forum thread](https://forum.yunohost.org/t/gogs-package-an-awesome-github-alternative/1127)

Architecture: this package is compatible with amd64, i386 and arm. The package will try to detect it with the command uname -m and fail if it can't detect the architecture. If that happens please open an issue describing your hardware and the result of the command `uname -m`.

## License
Gitea is published under the MIT License:
https://github.com/gogits/gogs/blob/master/LICENSE

This package is published under the MIT License.

## Developper info
Please do your pull requests to the `dev` branch.

Test or upgrade to dev version:
```bash
sudo su - admin
git clone -b dev https://github.com/npe-2012/gitea_ynh
# to install
sudo yunohost app install -l Gitea /home/admin/gitea_ynh
# to upgrade
sudo yunohost app upgrade -f /home/admin/gitea_ynh gogs

```


text:
Short script using `pytube` and `moviepy` to automate the clipping of YouTube
videos based on spreadsheets' timestamps (i.e. skip the first 6 hours of work
in making highlights sourced from youtube!)

Input Structure
---

With csv's in the current directory containing the following columns:

- link (required)
  - YouTube link
- timestamp (required)
  - in the format `MM:SS`
- description
  - helpful blurb, part of which can be placed in output clip filename
- replay
  - whether or not to clip a larger length, in order to capture replay footage
    (leave blank for no)
- judgement (required)
  - "rating" of the clip, determining whether or not it is worth clipping
- comment
  - additional blurb (I often use to start pre-planning video structure)

Before running, at the top of `clipper.py`, adjust config constants to your
needs.

For an example of input, the following sheet is an example that would work well
with the script defaults.

`hoyle.csv`
----
| link                         | timestamp | description      | replay | judgement |  comment        |
|------------------------------|-----------|------------------|--------|-----------|-----------------|
| https://youtu.be/0T3LtBvANbg | 3:50      | 6 pickup arm hit |        | clean     |                 |
| https://youtu.be/0T3LtBvANbg | 4:10      | straight fleche  |        | nice      |                 |
| https://youtu.be/0T3LtBvANbg | 18:25     | the Novosjolov   |        | perf      |                 |
| https://youtu.be/0T3LtBvANbg | 21:25     | hand pick to won |        | clean     | sadly bad angle |

Running
----

Using `pipenv` to run:

    $ pipenv install
    $ pipenv run python clipper.py

Debugging
----

Frequently, YouTube HTML page structure changes require a new version of pytube in order to scrape videos.
If there seem to be errors from within the pytube library, try updating to
[the latest pytube release on pypi](https://pypi.org/project/pytube/).

If there are still errors downloading videos and you have access to locally
stored footage, you can also make changes to the how the queue of videos is
constructed, and place the videos into individual folders (each within the
`video_output/<CSV_SHEET_NAME>/` folder by default).

repository: CSRessel/quickclips

repo_name: CSRessel/quickclips


text:
---
title: "addRouteMiddleware"
description: addRouteMiddleware() is a helper function to dynamically add middleware in your application.
---

# `addRouteMiddleware`

`addRouteMiddleware()` is a helper function to dynamically add route middleware in your Nuxt application.

::alert{type=info}
Route middleware are navigation guards stored in the [`middleware/`](/guide/directory-structure/middleware) directory of your Nuxt application (unless [set otherwise](/api/configuration/nuxt-config#middleware)).
::

## Usage

```js
addRouteMiddleware (name: string | RouteMiddleware, middleware?: RouteMiddleware, options: AddRouteMiddlewareOptions = {})
```

`addRouteMiddleware()` takes three arguments:

- **name** `type: string | RouteMiddleware`

`name` can be either a string or a function of type `RouteMiddleware`. Function takes the next route `to` as the first argument and the current route `from` as the second argument, both of which are Vue route objects.

Learn more about available properties of [route objects](/api/composables/use-route).

- **middleware** `type: RouteMiddleware`

The second argument is a function of type `RouteMiddleware`. Same as above, it provides `to` and `from` route objects. It becomes optional if the first argument in `addRouteMiddleware()` is already passed as a function.

- **options** `type: AddRouteMiddlewareOptions`

An optional `options` argument lets you set the value of `global` to `true` to indicate whether the router middleware is global or not (set to `false` by default).

## Examples

### Anonymous Route Middleware

Anonymous route middleware does not have a name. It takes a function as the first argument, making the second `middleware` argument redundant:

```ts [plugins/my-plugin.ts]
export default defineNuxtPlugin(() => {
  addRouteMiddleware((to, from) => {
    if (to.path === '/forbidden') {
      return false
    }
  })
})
```

### Named Route Middleware

Named route middleware takes a string as the first argument and a function as the second.

When defined in a plugin, it overrides any existing middleware of the same name located in the `middleware/` directory:

```ts [plugins/my-plugin.ts]
export default defineNuxtPlugin(() => {
  addRouteMiddleware('named-middleware', () => {
    console.log('named middleware added in Nuxt plugin')
  })
})
```

### Global Route Middleware

Set an optional, third argument `{ global: true }` to indicate whether the route middleware is global:

```ts [plugins/my-plugin.ts]
export default defineNuxtPlugin(() => {
  addRouteMiddleware('global-middleware', (to, from) => {
      console.log('global middleware that runs on every route change')
    },
    { global: true }
  )
})
```


text:
# ModernReactWithReduxCourseUdemy
Set of my practical approaches by following the course

### Covered Sections
1. An Intro to React
2. Ajax Requests with React
3. Modeling Application State