text:
# [Intermediate Algorithm Scripting: Sum All Odd Fibonacci Numbers](https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-odd-fibonacci-numbers)

Given a positive integer `num`, return the sum of all odd Fibonacci numbers that are less than or equal to `num`.

The first two numbers in the Fibonacci sequence are 1 and 1. Every additional number in the sequence is the sum of the two previous numbers. The first six numbers of the Fibonacci sequence are 1, 1, 2, 3, 5 and 8.

For example, `sumFibs(10)` should return `10` because all odd Fibonacci numbers less than or equal to `10` are 1, 1, 3, and 5.

Remember to use [Read-Search-Ask](http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514) if you get stuck. Try to pair program. Write your own code.

## Setup
```js
function sumFibs(num) {
  return num;
}

sumFibs(4);
```

## Solution
```js
// Basic Code: Using while loop
function sumFibs(num) {
  var prevNumber = 0;
  var currNumber = 1;
  var result = 0;
  while (currNumber <= num) {
    if (currNumber % 2 !== 0) {
        result += currNumber;
    }
    currNumber += prevNumber;
    prevNumber = currNumber - prevNumber;
  }
  return result;
}

sumFibs(4); // 5
```

repository: johnfelipe/progress

repo_name: johnfelipe/progress


text:
# sara-server-vre
Virtual Research Environment for Sara Server - container build scripts

This is the VRE main spec containing a Java Runtime Environment plus Eclipse
used for the development of the SARA service.
A local postgres database is integrated, too. The source is a docker repo
which is being pulled on build time and used to locally run a postgresql
server using udocker.
This VRE has no external requirements whatsoever once the image has been built.

## Use prebuild image
```
   cd /tmp
   singularity pull --name "sara-server-vre.img" shub://c1t4r/sara-server-vre
   ./sara-server-vre.img
```

## Build local image (Singularity 2.3)

```
cd /tmp
singularity create -s 2048 sara-server-vre.img
singularity bootstrap sara-server-vre.img ./Singularity
./sara-server-vre.img
```

## Build local image (Singularity 2.4)

```
sudo singularity build sara-server-vre.simg ./Singularity
```

license: MIT

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
# mikrotik_interface_wireguard (Resource)
Creates a Mikrotik interface wireguard only supported by RouterOS v7+.

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) Name of the interface wireguard.

### Optional

- `comment` (String) Comment associated with interface wireguard.
- `disabled` (Boolean) Boolean for whether or not the interface wireguard is disabled.
- `listen_port` (Number) Port for WireGuard service to listen on for incoming sessions.
- `mtu` (Number) Layer3 Maximum transmission unit.
- `private_key` (String, Sensitive) A base64 private key. If not specified, it will be automatically generated upon interface creation.

### Read-Only

- `id` (String) Identifier of this resource assigned by RouterOS
- `public_key` (String) A base64 public key is calculated from the private key.
- `running` (Boolean) Whether the interface is running.

repository: ddelnano/terraform-provider-mikrotik

gha_language: Go

gha_license_id: MIT

repo_name: ddelnano/terraform-provider-mikrotik


text:
# SoBi Client

A command line app for SoBi Client - works with
[SoBi server](https://github.com/jpietrzyk/sobi-srv), and
deliver bike informations.

## Usage

You should first install SoBi Server from here
https://github.com/jpietrzyk/sobi-srv, then clone this repo to your local machine and run `bin/setup` to install dependencies.

Modify `.env` file if you need to change your redis config.

Run `exe/sobi_cli {bike_id}` to send data to SoBi Server - `bike_id` **have to** be an integer value

## Development

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

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

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/jpietrzyk/sobi_cli. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.

## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).

repository: jpietrzyk/sobi-cli

repo_name: jpietrzyk/sobi-cli


text:
# eiaGenerationCapacity
Tools for working with EIA Generation Capacity Data

getEIAStateGenCap.R contains the function `getGenCap()`.
calcIPPGenCapShare.R contains the function `calcIPPShare()`.
vizIPPShare.R contains the function `vizIPPShare()`.

Source each of the files as so.

```{r}
source('getEIAStateGenCap.R')
source('calcIPPGenCapShare.R')
source('vizIPPShare.R')
```

The function `getGenCap()` takes no arguments and is hardcoded with the EIA URL distribnuting the generation capacity data.  Specifically, the function is getting the **Existing Nameplate and Net Summer Capacity by Energy Source, Producer Type and State (EIA-860)** and returns the data as a R data.frame.  Assign `getGenCap()` to some varaible name like the following.

```{r}
d = getGenCap()
```

The function `calcIPPShare()` takes the dataframe returned by `getGenCap()` and returns a state level dataframe with two new variables approximating the share of generation capacity owned by independent power producers in each state in each year.  The first `ipp2util` gives the ratio of IPP generation capacity to IPP plus utility generation capacity.  The second `ipp2total` gives the ratio of IPP generation capcity to total electric industry capacity.  Simply pass `d` to the function and assign it to a new variable, like `g`.

```{r}
g = calcIPPShare(d)
```

The function `vizIPPShare()` can be used to produce a map time series when combined with the [Census Bureau 500k state shapefile](https://www.census.gov/geo/maps-data/data/cbf/cbf_state.html). Download the zip archieve and extract the files locally.  Pass the path to the .shp file to the `vizIPPShare()` function along with the dataframe `g`.  For example, the shape files are saved at the following location on my machine.

`/home/nicholas/Documents/RetailMarketProject/USStateMap/cb_2017_us_state_500k.shp`

```{r}
pathtoShp = "/home/nicholas/Documents/RetailMarketProject/USStateMap/cb_2017_us_state_500k.shp"
vizIPPShare(g, pathtoShp)
```

repository: nsbowden/eiaGenerationCapacity

repo_name: nsbowden/eiaGenerationCapacity


text:
![PHP Composer](https://github.com/stephanediondev/elasticsearch-admin/workflows/PHP%20Composer/badge.svg)

## Requirements

- Elasticsearch 6.x or 7.x
- Web server running PHP 7.2.5 or higher
- Composer
- npm

## Installation

Configure a vhost with the document root set to "public" folder (ie /var/www/elasticsearch-admin/public)

```
composer install

npm install
npm run build

bin/console security:encode-password
# Encode a password

cp .env.dist .env
# Edit ELASTICSEARCH_URL, EMAIL and ENCODED_PASSWORD
# If Elasticsearch security features are enabled, edit ELASTICSEARCH_USERNAME and ELASTICSEARCH_PASSWORD
```

## Features

- [x] Connection to Elasticsearch: server-side (no CORS config), local (private) or remote server, http or https, with credentials or not
- [x] Login: user managed by Symfony, not related to Elasticsearch
- [x] Cluster: basic metrics, allocation explain, list settings, update settings (transient or persistent)
- [x] Nodes: list, read, usage, plugins, reload secure settings
- [x] Indices: list, reindex, create, read, update (mappings), lifecycle (explain, remove policy), delete, close, open, freeze, unfreeze, force merge, clear cache, flush, refresh, empty, import (XLSX) / export (CSV, TSV, ODS, XLSX, GEOJSON), aliases (list, create, delete)
- [x] Index templates: list, create, read, update, delete, copy
- [x] Component templates (7.8): list, create, read, update, delete, copy
- [x] Index lifecycle management policies (6.6): list, status, start, stop, create, read, update, delete, copy
- [x] Shards: list
- [x] Repositories: list, create (fs, s3, gcs), read, update, delete, cleanup, verify
- [x] Snapshot lifecycle management policies (7.4): list, status, start, stop, create, read, update, delete, execute, history, stats, copy
- [x] Snapshots: list, create, read, delete, failures, restore
- [x] Users (native realm): list, create, read, update, delete, enable, disable
- [x] Roles: list, create, read, update, delete, copy
- [x] Tasks: list
- [x] Remote clusters: list
- [x] Enrich policies (7.5): list, stats, create, read, delete, execute
- [x] Pipelines: list, create, read, update, delete, copy
- [x] Cat APIs: list, export (CSV, TSV, ODS, XLSX)
- [x] Console
- [x] Deprecations info
- [x] License: read, start trial, revert to basic, features

## Todo

- [ ] Indices: update (dynamic index settings)
- [ ] Index templates: handle legacy (_template) and new version (_index_template) since 7.8
- [ ] Repositories: create (url, source, hdfs, azure)
- [ ] License: update

## Unit tests

```
bin/console app:phpunit && bin/phpunit
```

## Screenshots

[![Login](assets/images/resized-login.png)](assets/images/original-login.png)

[![Cluster](assets/images/resized-cluster.png)](assets/images/original-cluster.png)

[![Cluster settings](assets/images/resized-cluster-settings.png)](assets/images/original-cluster-settings.png)

[![Cluster allocation explain](assets/images/resized-cluster-allocation-explain.png)](assets/images/original-cluster-allocation-explain.png)

[![Nodes](assets/images/resized-nodes.png)](assets/images/original-nodes.png)

[![Node](assets/images/resized-node.png)](assets/images/original-node.png)

[![Indices](assets/images/resized-indices.png)](assets/images/original-indices.png)

[![Indices stats](assets/images/resized-indices-stats.png)](assets/images/original-indices-stats.png)

[![Index](assets/images/resized-index.png)](assets/images/original-index.png)

[![Create index](assets/images/resized-index-create.png)](assets/images/original-index-create.png)

[![Index templates](assets/images/resized-index-templates.png)](assets/images/original-index-templates.png)

[![Create index template](assets/images/resized-index-template-create.png)](assets/images/original-index-template-create.png)

[![Shards](assets/images/resized-shards.png)](assets/images/original-shards.png)

[![Create AWS S3 repository](assets/images/resized-repository-create-s3.png)](assets/images/original-repository-create-s3.png)

[![Create SLM policy](assets/images/resized-slm-policy-create.png)](assets/images/original-slm-policy-create.png)

[![Snaphosts](assets/images/resized-snapshots.png)](assets/images/original-snapshots.png)

[![Create snapshot](assets/images/resized-snapshot-create.png)](assets/images/original-snapshot-create.png)

[![Create enrich policy](assets/images/resized-enrich-create.png)](assets/images/original-enrich-create.png)

repository: kkounvonglasy/elasticsearch-admin

repo_name: kkounvonglasy/elasticsearch-admin


text:
# Dash visualization
Dash is a python framework which is suitable for building data visualization dashboards using pure python. Dash is written on top of plotly, react and flask and the graphs are defined using plotly python. The dash application is composed of two major parts :

  - `Layout`  - Describes how the dashboard looks like
  - `Callbacks`  - Used to update graphs, tables in the layout and makes the dashboard interactive.

# Files
The dash application is organized as follows:
- `dashapp.py`
	- Creates the dash application
	- The dash app is embedded in the flask app passed to `create_dash_app` function
	- This file need not be modified to create a new plot
- `layouts.py`
	- contains the layout for all the pages
	- `get_layout_from_data`- returns layout of data visualization
	-  `get_layout_from_task`- returns layout of task visualization
	- `get_layout_from_flow`- returns layout of flow visualization
	- `get_layout_from_run` -  returns layout of run visualization
	-  This file needs to be modified to add a new plot (data, task, flow, run)
- `callbacks.py`
	- Registers all the callbacks for the dash application
	- This file needs to be modified to add a new plot, especially if the plot needs to be interactive

## How the dashboard works
In this dash application, we need to create the layout of the page dynamically based on the entered URL.
For example,  [http://<IP_ADDRESS>:5000/dashboard/data/5] needs to return the layout for dataset id #5 whereas
[http://<IP_ADDRESS>:5000/dashboard/run/5] needs to return the layout for run id #5.

Hence , the dash app is  initially created with a dummy `app.layout` by dashapp.py and
the callbacks are registered for the app using `register_callbacks` function.

 - **render_layout** is the callback which dynamically renders layout. Once the dash app is running, the first callback which  is fired is `render_layout.`
   This is the main callback invoked when  a URL with a data , task, run or flow ID is entered.
   Based on the path and ID in the URL, this method returns the layout.

 - Based on the URL, get_layout_from_data, get_layout_from_task, get_layout_from_flow, get_layout_from_run are called.
   These functions define the layout of the page - tables, tabs, graphs etc.

 - The callbacks corresponding to each component in the layout are invoked to update the components dynamically and
   make the graphs interactive. For example, **update_scatter_plot** in `data_callbacks.py` updates the scatter plot
   component in the data visualization dashboard.

## Example: adding a graph
This example walks through the process of adding a new data visualization.
The steps are similar for run, task and flow visualizations.
### Non-interactive graph
If the graph is non-interactive, layouts.py is the only file that needs to be modified.
The data can be directly specified for a graph component and added to the layout.

This is similar to adding a plotly graph:

```# make a plotly figure
fig = go.Figure(data=go.Scatter(
    x=[1, 2, 3, 4],
    y=[10, 11, 12, 13],
    mode='markers',
    marker=dict(size=[40, 60, 80, 100],
                color=[0, 1, 2, 3])
))
# add it to dash graph component
dcc.Graph(id='scatterPlotGraph',
          figure = fig)
  ```

Since we would like to add this to the data dashboard, dcc.Graph component needs to added to the 'layout' in get_layout_from_data method.

## Interactive graph
 In order to add an interactive graph, we need to specify the graph component in the layout and
 update it in the callbacks.

The best example for this is the scatter_plot component found in get_layout_from_data function in layouts.py
and updated in data_callbacks.py

The first step is to add the layout. In this case, we have 3 drop-down components
and a html.Div component called scatter_plot.
```             html.Div([
                    html.Div(dcc.Dropdown(
                        id='dropdown1',
                        options=[
                            {'label': i, 'value': i} for i in numerical_data
                        ],
                        multi=False,
                        clearable=False,
                        value=numerical_data[0]
                    )),
                    html.Div(dcc.Dropdown(
                        id='dropdown2',
                        options=[
                            {'label': i, 'value': i} for i in numerical_data
                        ],
                        multi=False,
                        clearable=False,
                        value=numerical_data[0]

                    )),
                    html.Div(dcc.Dropdown(
                        id='dropdown3',
                        options=[
                            {'label': i, 'value': i} for i in nominal_data],
                        multi=False,
                        clearable=False,
                        value=nominal_data[0])),
                    html.Div(id='scatter_plot'), ])```

 # In the callbacks, we wil update the scatter_plot component with a graph dynamically,
 based on the dropdown selection.

```     @app.callback(Output('scatter_plot', 'children'), [
        Input('dropdown1', 'value'),
        Input('dropdown2', 'value'),
        Input('dropdown3', 'value'),
        Input('url', 'pathname')])
    def update_scatter_plot(at1, at2, colorCode,url):
        """

        :param at1: str
            selected attribute 1 from dropdown list
        :param at2: str
            selected attribute 2 from dropdown list
        :param colorCode: str
            selected categorical attribute
        :return:
            fig : Scatter plot of selected attributes
        """
        data_id = int(re.search('data/(\d+)', url).group(1))
        try:
            df = pd.read_pickle('cache/df'+str(data_id)+'.pkl')
        except OSError:
            return []
        fig = {
            'data': [go.Scatter(
                x=df[df[colorCode] == col][at1],
                y=df[df[colorCode] == col][at2],
                mode='markers',
                marker={
                    'size': 15,
                    'line': {'width': 0.5, 'color': 'white'}
                },
                name=col,
            ) for col in set(df[colorCode])],
            'layout': go.Layout(
                xaxis={'title': at1, 'autorange': True},
                yaxis={'title': at2, 'autorange': True},
                hovermode='closest',
                height=800, width=1200
            )}
        return html.Div(dcc.Graph(figure=fig))
 ```

gha_language: JavaScript


text:
# Project name

## Vision

*Approx 10-15 lines*.

The aim of this project is …

We’re solving … problem but you may also use this project to …

## Ethics

This project operates under the W3C's
[Code of Ethics and Professional Conduct](https://www.w3.org/Consortium/cepc):

> W3C is a growing and global community where participants choose to work
> together, and in that process experience differences in language, location,
> nationality, and experience. In such a diverse environment, misunderstandings
> and disagreements happen, which in most cases can be resolved informally. In
> rare cases, however, behavior can intimidate, harass, or otherwise disrupt one
> or more people in the community, which W3C will not tolerate.
>
> A Code of Ethics and Professional Conduct is useful to define accepted and
> acceptable behaviors and to promote high standards of professional
> practice. It also provides a benchmark for self evaluation and acts as a
> vehicle for better identity of the organization.

We hope that our community group act according to these guidelines, and that
participants hold each other to these high standards. If you have any questions
or are worried that the code isn't being followed, please contact the owner of the repository.

## Language

The development language is English. All comments and documentation should be written in English, so that we don't end up with “franglais” methods, and so we can share our learnings with developers around the world.

However, the domain language is French. We consider each tax, collecting organism and French regulation as a domain-specific term. In the same fashion, well-known abbreviations of these domain-specific terms are accepted.

OR

Par souci de lisibilité pour les partenaires, la langue utilisée pour la description et le suivi de fonctionnalités est le français.

En revanche, pour éviter le coût du changement de contexte, les discussions techniques peuvent se faire en anglais, la langue la plus utilisée dans le cadre du développement logiciel.

## History

We started this project on … for this particular use-case.

We open-sourced it on … / since the beginning because …

## Installation

We’re using these technologies: … because …

Once installed, you have to run these commands to setup the project:

```shell
pip install -r requirements/
bower install
fab runserver
```

Enjoy!

## Contributing

We’re really happy to accept contributions from the community, that’s the main reason why we open-sourced it! There are many ways to contribute, even if you’re not a technical person.

We’re using the infamous [simplified Github workflow](http://scottchacon.com/2011/08/31/github-flow.html) to accept modifications (even internally), basically you’ll have to:

* create an issue related to the problem you want to fix (good for traceability and cross-reference)
* fork the repository
* create a branch (optionally with the reference to the issue in the name)
* hack hack hack
* commit incrementally with readable and detailed commit messages
* submit a pull-request against the master branch of this repository

We’ll take care of tagging your issue with the appropriated labels and answer within a week (hopefully less!) to the problem you encounter.

If you’re not familiar with open-source workflows or our set of technologies, do not hesitate to ask for help! We can mentor you or propose good first bugs (as labeled in our issues). Also welcome to add your name to Credits section of this document.

### Submitting bugs

You can report issues directly on Github, that would be a really useful contribution given that we lack some user testing on the project. Please document as much as possible the steps to reproduce your problem (even better with screenshots).

### Discussing strategies

We’re trying to develop this project in the open as much as possible. We have a dedicated mailing-list where we discuss each new strategic change and invite the community to give a valuable feedback. You’re encouraged to subscribe to it and participate.

### Adding documentation

We’re doing our best to document each usage of the project but you can improve it or add you own sections. The documentation is available within the /docs/ folder. You don’t have to build anything, we’ll take care of it once your changes are merged.

### Improving User eXperience

You don’t have to install the whole project to fix a CSS or UI bug. We’re using a static [styleguide](http://styleguides.io/) that you can access to within the /statics/styleguide/ folder. You can edit the CSS/templates and just load the plain HTML page to see your changes. Once your pull-request merged, we’ll take care of integrating it within the whole project for you.

### Hacking backend

Hello fellow hacker, it’s good to have you on board! There is an extra step to install development dependencies if you plan to modify our core server:

* `pip install -r requirements/dev.txt`

Once you did it, the server will reload automagically upon your changes of the source code. You have to run tests periodically though to ensure that your changes don’t break existing functionalities. Our continuous integration server will run the whole test suite once you submit your pull-request (approx. 5 minutes).

Commit messages should be formatted using [AngularJS conventions](http://goo.gl/QpbS7) (one-liners are OK for now but body and footer may be required as the project matures).

Comments follow [Google's style guide](http://google-styleguide.googlecode.com/svn/trunk/pyguide.html#Comments).

## Financing

We accept donations and we have a bounty program to develop some big features:

* A plugin architecture - 3000€
* Accepting custom themes - 1000€

Please contact us if you want to collaborate on those features or mutualize your costs with other people/companies. If you pay for these developments, we offer half a day of support for you and your team.

Note that each feature will be discussed and developed in the open with the whole community, financing bounties doesn’t give you a stronger voice. If you’re looking for personal/closed-source improvements we can do consulting too.

## Versioning

Version numbering follows the [Semantic versioning](http://semver.org/) approach.

## License

We’re using the … license because we believe in …

## Rationale for forking (optional)

We forked that project because:

* it has been rather poorly maintained for x years
* we would like to develop … feature
* we disagree on the governance of the project
* etc

## Credits

* [John Snow](http://gameofthrones.wikia.com/wiki/Jon_Snow)
* etc.


text:
# legendre_transform
Generalized Legendre (Legendre–Fenchel) transformation for applications in nonimaging optics

C implementation uses OpenMP. AVX-512 implementation with double/single precision is also available.

function lap_sqm_mex(x1, y1, z1, x2, y2, z2, g2, fun_id, sign) calculates

R_j = max_j {g2[j]-f(xyz1[i],xyz2[j])}    when sign = +1

R_j = min_j {g2[j]-f(xyz1[i],xyz2[j])}    when sign = -1

returns ind = argmax(argmin)

The cost function f is defined by fun_id:

fun_id = 0  :	f = -(x1 x2 + y1 y2 + z1 z2)

fun_id = 10 :  	f = -(x1 x2 + y1 y2)

fun_id = 1  :  	f = -log[1 - (x1 x2 + y1 y2 + z1 z2)]	(and +infinity if log-argument is negative)

fun_id = 101:  	f =  1 - (x1 x2 + y1 y2 + z1 z2)		(see the Note below)

fun_id = 2	:	f =  sqrt[1 + (x1-x2)^2 + (y1-y2)^2]

fun_id = 3	:	f = -sqrt[1 - (x1-x2)^2 - (y1-y2)^2]	(and +infinity if sqrt-argument is negative)

fun_id = 4	:	f =  sqrt[(x1-x2)^2 + (y1-y2)^2 + (z1-z2)^2]

fun_id = 5	:	f = -sqrt[(z1-z2)^2 - (x1-x2)^2 - (y1-y2)^2]	(and +infinity if sqrt-argument is negative)

Note: when fun_id = 101, lap_sqm_mex calculates

max_j {g2[j] / f(xyz1[i], xyz2[j])}    when sign = +1

min_j {g2[j] / f(xyz1[i], xyz2[j])}    when sign = -1

MATLAB (MEX) implementation allows to use additional parameters in the cost function (see implementation for details)

branch_name: refs/heads/main


text:
# Auto Tester

The auto-tester is a stand alone application that provides a mechanism for regression testing.  The general idea is simple:
* Each test folder has a script that produces a set of snapshots.
* The snapshots are compared to a 'canonical' set of images that have been produced beforehand.

***Please note that before running any tests that your avatar must be in an empty part of the domain.***

## autoTester.js
A utility script in the **tests/utils** folder is **autoTester.js**.  During a test, this script is pulled from the GitHub repository.

This script is a module that exposes two functions.
### setupTests.js
This function hides the avatar, sets its orientation to 0, sets the snapshots folder and sets up the secondary camera.  The secondary camera is used to take snapshots so that the snapshot size will be independent of the user's monitor.  This secondary camera is the function return value.
### runTests
This function runs the tests in either of 2 modes:
1. Manual - the space bar is used to sequence through the steps.  The steps are displayed in the log.
2. Automatic - the steps are sequenced through automatically, at a rate of one per two seconds.  This mode creates a series of snapshots.
## Setup
### Windows 10
* Clone the hifi_tests repository
```
git clone https://github.com/NissimHadar/hifi_tests.git
```
* Double click **setup.bat** (located in tools/autoTester) to download and install autotester (Note: do not select setup.ps1 by mistake). When prompted, select folder to install autoTester (the default is usually OK).
* ![](./setup_7z.png)

The executable is located in the **autoTester/Release** folder, and is named **autoTester.exe**.
## Test Folder Content
Each test is in a separate folder, which should contain the following file:
1. test.js - a module containing the test.  The contents are described in detail below.
2. runAuto.js - runs the test.js script automatically, creating a set of snapshots.
3. runManual.js - runs the test.js step by step.
## Test File Content
### test.js
An automatic test is always named **test.js**.  This file contains a javascript module, as described below.
#### test.js details
The **test.js** file itself has two requirements:
1. Export a parameterless function named `test`
2. Export a boolean named`complete`
    1. Initialized to false
    2. Set to true on completion of the test

In addition, the test hierarchy, only the test root may, and must, be named **tests**.  This is because the test needs to find the **tests/utils** folder.

A test expects an empty world and should end with an empty world, for the next test (if any).  The test should create a list of snapshots in the local folder.  The following code snippet describes one way of doing this.

```javascript
module.exports.complete = false;

module.exports.test = function (testType) {
    var TESTS_URL = "https://github.com/NissimHadar/hifi_tests/blob/NissimHadar/tests/";
    var SUFFIX = "?raw=true";
    var autoTester = Script.require(TESTS_URL + "utils/autoTester.js" + SUFFIX);
    var spectatorCameraConfig = autoTester.setupTests(Script.resolvePath("."));

    // Create the zone centered at the avatar position
    var pos = MyAvatar.position;

    // As a 5 meters cube box
    var dim = { x: 5.0, y: 5.0, z: 5.0};

    // Define zone properties
    var properties = {
        lifetime: 60,
        type: "Zone",
        name: "test create zone",
        position: pos,
        dimensions: dim,
        keyLight:{"color": {"red":0,"green":255,"blue":0}},

        skyboxMode: "enabled",
        skybox:{"color":{"red":0,"green":0,"blue":255}}
    };
    var zone = Entities.addEntity(properties);

    // An array of tests is created.  These may be called via the timing mechanism for auto-testing,
    // or stepped through with the space bar
    var steps = [
        function () {
            spectatorCameraConfig.position = {x: pos.x, y: pos.y + 0.6, z: pos.z};
        },

        // Take snapshot
        function () {
        },

        // Clean up after test
        function () {
            Entities.deleteEntity(zone);
            module.exports.complete = true;
        }
    ]

    var result = autoTester.runTests(testType, steps);
};
```
## Using the auto-tester
The auto-tester provides the following 5 functions:
1. Evaluate a single test
2. Evaluate tests recursively
3. Create a recursive test script
4. Create a test case
5. Delete old snapshots

![](./autoTesterUI.png)

Each of the 4 functions asks the user to select a folder.

## Evaluation - general
A checkbox is provided for de-selecting interactive mode.  If this checkbox ix selected then each error will be displayed to the user; otherwise, the evaluation will procede till completion.  In both cases, all errors are logged to file.
For each failed test, a zipped folder is created within the test folder, named *TestResults*.  This folder contains a folder for each failed test named *Failure_n*, numbered sequentially.  Each folder contains 4 files:
1. Expected Image
2. Actual Image
3. Difference Image
4. TestResults - a text file providing details of the test folder, the original image names, and the size of the mismatch.
### Evaluate Test
Evaluating a test is performed after running a **test.js** script to create new snapshots.  After selecting the folder, the images are compared in lexical order.  If the similarity between any image pair does not pass a fixed threshold, the image pair is displayed and the user can select to accept the difference, fail this specific test case, or abort testing.
![](./autoTesterMismatchExample.png)
### Evaluate Tests Recursively
This is a recursive version of the previous function.  Auto-tester will recurse through all folders from the selected folder.  A test will be evaluated if the following is true:
* The folder contains a **test.js** script
* The number of actual and expected snapshots is the same (see Create Test for an explanation)
### Create a recursive test script
Auto-tester will create a script named **allTests.js** that will call all **test.js** scripts found in the folder, and any subfolders.  An example of the script created is:
```
// This is an automatically generated file, created by auto-tester
var test1 = Script.require("file:///D:/GitHub/hifi-tests/tests/content/entity/zone/ambientLightInheritance/test.js");
var test2 = Script.require("file:///D:/GitHub/hifi-tests/tests/content/entity/zone/create/test.js");
var test3 = Script.require("file:///D:/GitHub/hifi-tests/tests/content/entity/zone/createMultipleZones/test.js");

var test1HasNotStarted = true;
var test2HasNotStarted = true;
var test3HasNotStarted = true;

// Check every second if the current test is complete and the next test can be run
var testTimer = Script.setInterval(
    function() {
        if (test1HasNotStarted) {
            test1HasNotStarted = false;
            test1.test();
            print("******started test 1******");
        }

        if (test1.complete && test2HasNotStarted) {
            test2HasNotStarted = false;
            test2.test();
            print("******started test 2******");
        }

        if (test2.complete && test3HasNotStarted) {
            test3HasNotStarted = false;
            test3.test();
            print("******started test 3******");
        }

        if (test3.complete) {
            print("******stopping******");
            Script.stop();
        }

    },

    1000
);

// Stop the timer and clear the module cache
Script.scriptEnding.connect(
    function() {
        Script.clearInterval(testTimer);
        Script.require.cache = {};
    }
);
```
### Create a Test Case
A test case is created after running the test script.  Running the script produces a series of snapshots, named **hifi-snap-by-**_user name_**-on-YYYY-MM-DD_HH-MM-SS.jpg**.  This function simply renames these files to **ExpectedImage_1.jpg**, **ExpectedImage_2.jpg** and so on.  These files can be added to version control as they are a fixed asset of the test.
### Delete old snapshots
This button recursively deletes all snapshots created for testign (not the Expected Images).


text:
# unordered_map in STL and its applications
unordered_map is an associated container that stores elements formed by combination of key value and a mapped value. The key value is used to uniquely identify the element and mapped value is the content associated with the key. Both key and value can be of any type predefined or user-defined.

Internally unordered_map is implemented using Hash Table, the key provided to map are hashed into indices of hash table that is why performance of data structure depends on hash function a lot but on an average the cost of look-up from hash table is O(1). In worst case unordered_map may require O(n) time but practically it is much faster and outperforms tree based maps.

## unordered_map vs unordered_set
In unordered_set, we have only key, no value, these are mainly used to see presence/absence in a set. For example, consider the problem of counting frequencies of individual words. We can’t use unordered_set (or set) as we can’t store counts.

## unordered_map vs map
map (like set) is an ordered sequence of unique keys whereas in unordered_map key can be stored in any order, so unordered.
Map is implemented as balanced tree structure that is why it is possible to maintain an order between the elements (by specific tree traversal). Time complexity of map operations is O(Log n) while for unordered_set, it is O(1) on average.

## Methods on unordered_map
A lot of function are available which work on unordered_map. most useful of them are – operator =, operator [], empty and size for capacity, begin and end for iterator, find and count for lookup, insert and erase for modification.
The C++11 library also provides function to see internally used bucket count, bucket size and also used hash function and various hash policies but they are less useful in real application.
We can iterate over all elements of unordered_map using Iterator. Initialization, indexing and iteration is shown in below sample code :

    // C++ program to demonstrate functionality of unordered_map
    #include <bits/stdc++.h>
    using namespace std;

    int main()
    {
        // Declaring umap to be of <string, double> type
        // key will be of string type and mapped value will
        // be of double type
        unordered_map<string, double> umap;

        // inserting values by using [] operator
        umap["PI"] = 3.14;
        umap["root2"] = 1.414;
        umap["root3"] = 1.732;
        umap["log10"] = 2.302;
        umap["loge"] = 1.0;

        // inserting value by insert function
        umap.insert(make_pair("e", 2.718));

        string key = "PI";

        // If key not found in map iterator to end is returned
        if (umap.find(key) == umap.end())
            cout << key << " not found\n\n";

        // If key found then iterator to that key is returned
        else
            cout << "Found " << key << "\n\n";

        key = "lambda";
        if (umap.find(key) == umap.end())
            cout << key << " not found\n";
        else
            cout << "Found " << key << endl;

        //    iterating over all value of umap
        unordered_map<string, double>:: iterator itr;
        cout << "\nAll Elements : \n";
        for (itr = umap.begin(); itr != umap.end(); itr++)
        {
            // itr works as a pointer to pair<string, double>
            // type itr->first stores the key part  and
            // itr->second stroes the value part
            cout << itr->first << "  " << itr->second << endl;
         }
    }

Output :

    Found PI

    lambda not found

    All Elements :
    loge 1
    log10 2.302
    root3 1.732
    e 2.718
    root2 1.414
    PI 3.14

## A practical problem based on unordered_map
Given a string of words, find frequencies of individual words.

    Input :  str = "geeks for geeks geeks quiz practice qa for";
    Output : Frequencies of individual words are
       (practice, 1)
       (for, 2)
       (qa, 1)
       (quiz, 1)
       (geeks, 3)
Below is C++ solution using unordered_map.

    // C++ program to find freq of every word using
    // unordered_map
    #include <bits/stdc++.h>
    using namespace std;

    // Prints frequencies of individual words in str
    void printFrequencies(const string &str)
    {
        // declaring map of <string, int> type, each word
        // is mapped to its frequency
        unordered_map<string, int> wordFreq;

        // breaking input into word using string stream
        stringstream ss(str);  // Used for breaking words
        string word; // To store individual words
        while (ss >> word)
            wordFreq[word]++;

        // now iterating over word, freq pair and printing
        // them in <, > format
        unordered_map<string, int>:: iterator p;
        for (p = wordFreq.begin(); p != wordFreq.end(); p++)
            cout << "(" << p->first << ", " << p->second << ")\n";
    }

    // Driver code
    int main()
    {
        string str = "geeks for geeks geeks quiz "
                     "practice qa for";
        printFrequencies(str);
        return 0;
    }

Output :

    (practice, 1)
    (for, 2)
    (qa, 1)
    (quiz, 1)
    (geeks, 3)


text:
### Introduction

This is an implementation of the MBC and MBC* algorithm written on the paper:

*Lyu, Bingqing, et al. "Maximum biclique search at billion scale." Proceedings of the VLDB Endowment (2020).*

It is written in C with a Python interface.

### Definition

Given a bipartite graph G = (U,V,E), a **biclique** C is a complete bipartite subgraph of G, i.e., for each pair of u ∈ U(C) and v ∈ V(C), we have (u, v) ∈ E(C).

In this implementation, we aim to find a biclique C* in G with the maximum number of **edge**.

If you are looking for **enumerating** maximum biclique, I suggest you refer to:

*Alexe, Gabriela, et al. "Consensus algorithms for the generation of all maximal bicliques." Discrete Applied Mathematics 145.1 (2004): 11-21.*

*Lu, Yuping, Charles A. Phillips, and Michael A. Langston. "Biclique: an R package for maximal biclique enumeration in bipartite graphs." BMC research notes 13.1 (2020): 1-5.*

and the implementation [here](https://cran.r-project.org/web/packages/biclique/index.html).

If you are looking for finding the biclique with the maximum number of **vertex**, I suggest you refer to the [NetworkX](https://networkx.org/) project and this [post](https://cs.stackexchange.com/questions/131081/polynomial-time-algorithm-to-solve-the-maximum-vertex-bipartite-subgraph-problem).

### About this implementation

When I implemented the algorithm, I had a specific application in my mind. As a result, it probably was not suitable for your own use. For example, D (see Documentation) was passed as a dense matrix and the bipartite graph was represented as two arrays of bitset internally to speed up some steps.

I also used `_GNU_SOURCE` to use some `stdlib.h` methods. It limited the portability of the code.

Good luck.

### Compilation and Installation

#### Prerequisites
You need [setuptools](https://pypi.org/project/setuptools/), [numpy](https://numpy.org/) and standard build toolchain. If you are running on a Ubuntu, the following command should suffice:

```bash
$ apt install python3 python3-numpy python3-setuptools build-essential libpython3-dev
```

#### Compile and Installation

```bash
$ python setup.py build
$ sudo python setup.py install # or python setup.py install --user
```

### Documentation

```python
import pymbc
help(pymbc)
```

### Examples

Please refer to the `examples/` subdirectory.

### License

3-Clause BSD License

### Contact

wonghang (at) gmail (dot) com

WONG is my surname.

repository: wonghang/pymbc

repo_name: wonghang/pymbc


text:
```yaml
title: Router in Iconify Icon Finder Core
types:
  PartialRoute: ./routes.md
  FullRoute: ./routes.md
  IconsList: ./types.md#icons-list
  Icon: ./types.md#icon
```

# Router in Iconify Icon Finder Core

This tutorial is part of [Iconify Icon Finder Core tutorial](./index.md).

Every view has a route associated with it. Route makes it easy to save and restore Icon Finder state, so visitor can continue browsing page from the previous session.

A route is a simple object of type `[type]PartialRoute` describing the current view. It has a route type, set of parameters and optional parent route. For more details about route types and parameters, see [routes documentation](./routes.md).

Routes are handled by `[type]Router` instance. To access `[type]Router` instance, use `[prop]router` property of `[type]IconFinderCore` instance or `[prop]router` property of `[type]Registry` instance:

```js
const router = core.router;
```

```js
const router = registry.router;
```

`[class]Router` has the following methods and properties:

- `[prop]partialRoute`, `[type]PartialRoute`. Current route (only customised parameters). You can change route by changing value.
- `[prop]fullRoute`, `[type]FullRoute`. Current route (full object). You can change route by changing value.
- `[prop]defaultProvider`, `[type]string`. You can use this to set default API provider when navigating to home page.
- `[func]home()`. Navigates to home page.
- `[func]action()`. Run action on the currently visible view.
- `[func]setCustomIcons()`. Set icons list for a custom view. Works only if a custom view is currently visible or is being loaded. It is intended to be used to manipulate icons list while custom view is active.
- `[func]getCustomIcons()`. Same as `[func]setCustomIcons()`, but returns current data instead of setting new data.

Functions and properties that are meant for internal use:

- `[func]render()`. Renders visible view, the same as the data sent to the render callback, so it is a bit redundant.
- `[func]createChildView()`. Creates new child view from route.
- `[func]setParentView()`. Navigate few levels up in parent views tree. Identical to `[js]action('parent', 1)`.

## partialRoute and fullRoute {#route}

Properties `[prop]partialRoute` and `[prop]fullRoute` can access or change current route. See [routes documentation](./routes.md) for details.

What is the difference between two properties?

Property `[prop]partialRoute` contains copy of current route, without parameters that match default values.

Property `[prop]fullRoute` accesses current route variable directly. It has all parameters, including optional parameters. Be careful when using this property, it is a reference to internal variable, not a copy, so your code should never modify it and never assume it will not be modified. Use `[prop]partialRoute` instead if you need to a copy of route.

Setting either property to `null` is identical to calling `[func]home()` function.

## defaultProvider

Property `[prop]defaultProvider` is used to set default API provider. It affects only `[func]home()` function.

## home

Function `[func]home()` is used to navigate to home route. Home route [is set in configuration](./config.md) and is affected by `[prop]defaultProvider`.

By default, home route is:

```json
{
	"type": "collections"
}
```

## action

Runs an action on the currently visible view. It has 2 parameters:

- `[prop]action`, `[type]string`. Action name.
- `[prop]value`. Value, type is specific to action.

For more information, see [actions documentation](./actions.md).

## setCustomIcons

Updates list of icons in a custom view. Custom view must be visible or pending or function will fail.

It has 2 parameters:

- `[prop]customType`, `[type]string`. Custom view type, such as `[str]recent`.
- `[prop]icons`, `[type]IconsList`. List of icons.

For more details about custom views, see [custom views documentation](./custom-view.md).

## getCustomIcons

Same as `[func]setCustomIcons()` above, but has only `[prop]customType` parameter.

Returns list of icons as array of `[type]Icon` objects.

## render

Returns list of blocks for the current view, same as first parameter of the render callback.

This function is redundant because you already have all data available from render callback and is meant to be used internally when calling render callback.

For more details, check out [IconFinderCore documentation](./core.md), [render callback documentation](./render.md), [blocks documentation](./blocks.md).

## createChildView

Creates a child view. It has 2 parameters:

- `[prop]route`, `[type]PartialRoute`. Route for child view.
- `[prop]parentLevels`, `[type]number`. Optional number of levels to go up the parent routes tree before adding new child view. If set and is above `[num]0`, this would be identical to going up the parent views tree few levels up then adding a new child view.

## setParentView

Navigates few levels up the parent routes tree. Optional parameter is the number of levels to go up, the default value is `[num]1`.

repository: Natureshadow/documentation

repo_name: Natureshadow/documentation


text:
    Open Source Key/Value storage atom.

    version 0.1.0-alpha

    Status ·
    Description ·
    Features ·
    Install ·
    Contributing

---

## Status

**Tin** is currently in **alpha** version. It has never been released and currently it's only an idea that we're developing. Please, please, please, **do not** use this in production!

---

## Description

**Tin** is a lightweight Open Source Key/Value storage atom developed in **Rust**.

It exposes a simple HTTP API made with **Rocket** where all the actions are sent to. These are the currently available ones:
- `/get/<key>` to retrieve the value associated with the input key;
- `/set/<key>` with the following body `{"value": VALUE, "expiration": 0}` to set the VALUE for the given key;
- `/setexp/<key>` with the following body `{"value": VALUE, "expiration": EXPIRATION}` to set the VALUE and EXPIRATION of the given key;
- `/delete/<key>` to remove the value associated with the input key.

---

## TODO List

- [x] Minimal key/value pair operations
- [x] HTTP API using Rocket (currently considering Actix or Warp too)
- [x] CLI configuration (WIP)
- [x] Encryption (WIP)
- [x] Dockerfile (WIP)
- [ ] Persistence
- [ ] Replication
- [ ] Compression (?)
- [ ] Queues implementation (Redis wannabe?)

---

## Contributing

We welcome community contributions!

Please check out our open issues to get started.

If you discover something that could potentially impact security, please notify us immediately by sending an e-mail at <a href="mailto:support<EMAIL_ADDRESS>We'll get in touch with you as fast as we can!

repository: PaoloRollo/tin

repo_name: PaoloRollo/tin


text:
<meta itemprop="name" content="tfp.optimizer.proximal_hessian_sparse_one_step" />
<meta itemprop="path" content="Stable" />

# tfp.optimizer.proximal_hessian_sparse_one_step

    View source on GitHub

One step of (the outer loop of) the minimization algorithm.

``` python
tfp.optimizer.proximal_hessian_sparse_one_step(
    gradient_unregularized_loss,
    hessian_unregularized_loss_outer,
    hessian_unregularized_loss_middle,
    x_start,
    tolerance,
    l1_regularizer,
    l2_regularizer=None,
    maximum_full_sweeps=1,
    learning_rate=None,
    name=None
)
```

This function returns a new value of `x`, equal to `x_start + x_update`.  The
increment `x_update in R^n` is computed by a coordinate descent method, that
is, by a loop in which each iteration updates exactly one coordinate of
`x_update`.  (Some updates may leave the value of the coordinate unchanged.)

The particular update method used is to apply an L1-based proximity operator,
"soft threshold", whose fixed point `x_update_fix` is the desired minimum

```none
x_update_fix = argmin{
    Loss(x_start + x_update')
      + l1_regularizer * ||x_start + x_update'||_1
      + l2_regularizer * ||x_start + x_update'||_2**2
    : x_update' }
```

where in each iteration `x_update'` is constrained to have at most one nonzero
coordinate.

This update method preserves sparsity, i.e., tends to find sparse solutions if
`x_start` is sparse.  Additionally, the choice of step size is based on
curvature (Hessian), which significantly speeds up convergence.

This algorithm assumes that `Loss` is convex, at least in a region surrounding
the optimum.  (If `l2_regularizer > 0`, then only weak convexity is needed.)

#### Args:

* `gradient_unregularized_loss`: (Batch of) `Tensor` with the same shape and
  dtype as `x_start` representing the gradient, evaluated at `x_start`, of
  the unregularized loss function (denoted `Loss` above).  (In all current
  use cases, `Loss` is the negative log likelihood.)
* `hessian_unregularized_loss_outer`: (Batch of) `Tensor` or `SparseTensor`
  having the same dtype as `x_start`, and shape `[N, n]` where `x_start` has
  shape `[n]`, satisfying the property
  `Transpose(hessian_unregularized_loss_outer)
  @ diag(hessian_unregularized_loss_middle)
  @ hessian_unregularized_loss_inner
  = (approximation of) Hessian matrix of Loss, evaluated at x_start`.
* `hessian_unregularized_loss_middle`: (Batch of) vector-shaped `Tensor` having
  the same dtype as `x_start`, and shape `[N]` where
  `hessian_unregularized_loss_outer` has shape `[N, n]`, satisfying the
  property
  `Transpose(hessian_unregularized_loss_outer)
  @ diag(hessian_unregularized_loss_middle)
  @ hessian_unregularized_loss_inner
  = (approximation of) Hessian matrix of Loss, evaluated at x_start`.
* `x_start`: (Batch of) vector-shaped, `float` `Tensor` representing the current
  value of the argument to the Loss function.
* `tolerance`: scalar, `float` `Tensor` representing the convergence threshold.
  The optimization step will terminate early, returning its current value of
  `x_start + x_update`, once the following condition is met:
  `||x_update_end - x_update_start||_2 / (1 + ||x_start||_2)
  < sqrt(tolerance)`,
  where `x_update_end` is the value of `x_update` at the end of a sweep and
  `x_update_start` is the value of `x_update` at the beginning of that
  sweep.
* `l1_regularizer`: scalar, `float` `Tensor` representing the weight of the L1
  regularization term (see equation above).  If L1 regularization is not
  required, then tfp.glm.fit_one_step is preferable.
* `l2_regularizer`: scalar, `float` `Tensor` representing the weight of the L2
  regularization term (see equation above).
  Default value: `None` (i.e., no L2 regularization).
* `maximum_full_sweeps`: Python integer specifying maximum number of sweeps to
  run.  A "sweep" consists of an iteration of coordinate descent on each
  coordinate. After this many sweeps, the algorithm will terminate even if
  convergence has not been reached.
  Default value: `1`.
* `learning_rate`: scalar, `float` `Tensor` representing a multiplicative factor
  used to dampen the proximal gradient descent steps.
  Default value: `None` (i.e., factor is conceptually `1`).
* `name`: Python string representing the name of the TensorFlow operation.
  The default name is `"minimize_one_step"`.

#### Returns:

* `x`: (Batch of) `Tensor` having the same shape and dtype as `x_start`,
  representing the updated value of `x`, that is, `x_start + x_update`.
* `is_converged`: scalar, `bool` `Tensor` indicating whether convergence
  occurred across all batches within the specified number of sweeps.
* `iter`: scalar, `int` `Tensor` representing the actual number of coordinate
  updates made (before achieving convergence).  Since each sweep consists of
  `tf.size(x_start)` iterations, the maximum number of updates is
  `maximum_full_sweeps * tf.size(x_start)`.

#### References

[1]: Jerome Friedman, Trevor Hastie and Rob Tibshirani. Regularization Paths
     for Generalized Linear Models via Coordinate Descent. _Journal of
     Statistical Software_, 33(1), 2010.
     https://www.jstatsoft.org/article/view/v033i01/v33i01.pdf

[2]: Guo-Xun Yuan, Chia-Hua Ho and Chih-Jen Lin. An Improved GLMNET for
     L1-regularized Logistic Regression. _Journal of Machine Learning
     Research_, 13, 2012.
     http://www.jmlr.org/papers/volume13/yuan12a/yuan12a.pdf

repository: davmre/probability

repo_name: davmre/probability


text:
# gogs2gitea
Migration script that helps copy organizations and repositories(with all the history) from Gogs/Gitea to Gogs/Gitea.

## What does it do?
* Creates all the organizations of source Gogs/Gitea on destination Gogs/Gitea
* Creates all the repositories of each organization of source Gogs/Gitea on destination Gogs/Gitea
* Migrates repositories of source Gogs/Gitea to destination Gogs/Gitea

## Limitations
* It does not migrate specific user's organization and repositories. You can use `copy_user_repo()` function, though.
* It does not create users on destination Gogs/Gitea
* It does not create teams on destination Gogs/Gitea. Authenticated user of destination server(`dst_owner_user`) becomes the owner of all the organizations and repositories.
* It does not copy avatars from source Gogs/Gitea to destination Gogs/Gitea.

## Compatibility

Tested with;
* Python 2.7.5
* Gogs Version: <IP_ADDRESS>5
* Gitea Version: 1.3.0 and 1.3.2

## Prerequisites
* An administrator account and its access token must be created on destination Gogs/Gitea to be used as `dst_owner_user`.
* Access token of source must belong to a user which owns all the organizations and repositories. Otherwise, given user's organizations and repositories are copied only.

## Hints

Script was created to be read and modified easily. Just tweak it to suit your needs.

```python
gogs__url = 'http://gogs.mycompany.com'
gogs_token = '60a4cf0f5c90625c99c14b64392ead3963a9f00dc'
gitea_url = 'http://gitea.mycompany.com'
gitea_token = '5d7da2370c4b62c99f5c6496391a2ed66f07be3f'
owner_user = 'gitea_admin'

# Prints organizations and repos
print_orgs_and_repos(gogs_url, gogs_token)

# Creates newOrg organization whose owner ise owner_user
create_org(gitea_url,
           gitea_token,
           owner_user,
           'newOrg',
           'newOrg full name',
           'newOrg description.',
           'http://newOrg.mycompany.com',
           'TR')

# Creates newRepo repository under newOrg organization.
create_repo(gitea_url, gitea_token, 'newOrg', 'newRepo')

# Migrates newRepo of newOrg from Gogs to Gitea.
migrate_repo(gogs_url, gogs_token, 'newOrg', gitea_url, gitea_token, 'newOrg', 'newRepo')

# Deletes newRepo of newOrg.
delete_repo(gitea_url, gitea_token, 'newOrg', 'newRepo')

# Copies testOrg of Gogs to Gitea. Repositories are not copied.
copy_org(gogs_url, gogs_token, gitea_url, gitea_token, owner_user, 'testOrg')

# Copies testRepo of gogsOrg from Gogs to giteaOrg of Gitea.
# It simply calls create_repo() and migrate_repo().
copy_repo(gogs_url, gogs_token, 'gogsOrg', gitea_url, gitea_token, 'giteaOrg', 'testRepo')

# Copies all the organizations from Gogs to Gitea. gitea_owner_user
# becomes the owner of all the organizations.
copy_orgs(gogs_url, gogs_token, gitea_url, gitea_token, gitea_owner_user)

# Copies all the repositories of each organization on Gogs to Gitea.
# All the Gogs organizations must exist on Gitea. copy_orgs() can be used
# for this.
copy_repos(gogs_url, gogs_token, gitea_url, gitea_token)

# Copies MyRepo of MyUser under to YourUser in the same server.
copy_user_repo(gitea_url, gitea_token, 'MyUser', gitea_url, gitea_token, 'YourUser', 'MyRepo')

# Copies public repositories of MyUser on Gogs under to YourUser on Gitea.
copy_user_repos(gogs_url, gogs_token, 'MyUser', gitea_url, gitea_token, 'YourUser')

# Prints repositories of YourUser
print_user_repos(gitea_url, gitea_token, 'YourUser')
```

## Usage

        python migrate.py [-h] --src_url SRC_URL --src_token SRC_TOKEN --dst_url
                        DST_URL --dst_token DST_TOKEN --dst_owner_user
                        DST_OWNER_USER

        arguments:
        -h, --help              show this help message and exit

        --src_url SRC_URL       (Required) URL of source Gogs/Gitea
                                (e.g. http://gogs.mycompany.com)

        --src_token SRC_TOKEN   (Required) Access token of user that owns
                                the repositories on source Gogs/Gitea

        --dst_url DST_URL       (Required) URL of destination Gogs/Gitea
                                (e.g. http://gitea.mycompany.com)

        --dst_token DST_TOKEN   (Required) Access token of user that owns
                                the repositories on destination Gogs/Gitea

        --dst_owner_user DST_OWNER_USER  (Required) Owner of all the organizations
                                         on destination Gogs/Gitea


text:
# Keeper

Keeper is a MIT-licensed open source project currently maintained by me, Yakov Danilichev.

## Introduction
Keeper is a command line password manager.

**Stack**:
  - Python
  - Postgresql

 I cannot guarantee full security and reliability of this app, since this project is not for commercial using.

## How to use
Install requirements using:

`pip install -r requirements.txt`

To run the app consider using:

`python app.py`

repository: omgthatsjackie/keeper

repo_name: omgthatsjackie/keeper


text:
# LiveStreamEmbeddedSubtitleSettings

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | **string** | A name for this live stream closed caption track. | [optional]
**Passthrough** | **string** | Arbitrary user-supplied metadata set for the live stream closed caption track. Max 255 characters. | [optional]
**LanguageCode** | **string** | The language of the closed caption stream. Value must be BCP 47 compliant. | [optional] [default to en]
**LanguageChannel** | **string** | CEA-608 caption channel to read data from. | [optional] [default to LANGUAGE_CHANNEL_CC1]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

repository: muxinc/mux-go

repo_name: muxinc/mux-go


text:
# Date: 31 July 2020

## Question:
Given two samples from two different populations, sample A with (mean, std. deviation, n) as (74, 9, 15) and sample B with (mean, std. deviation, n) as (69, 5, 18).Which of the following test should you choose to test the hypothesis that population mean of A is equal to population mean of B?

## Topic:
1. Welch's t-test

## Options:
1. paired t-test
2. Student's t-test
3. Welch's t-test

## Correct Option:
3. Welch's t-test

## Explanation:
While Welch's t-test is very similar to Student's t-test, except it doesn't assume the two samples to have the same variance. Given our data with different standard deviation, it's safer to use Welch's t-test, avoiding the assumption of same variance. With Student's t-test it is better to first test the assumption of equal variance.

## Scripts:
1. Question Script: NULL
2. Answer Script: NULL

## Link:
1. Question Link: NULL
2. Answer Link: NULL

## Images:
1. Question Images: NULL
2. Answer Images: NULL

gha_language: HTML


text:
# Logging

It's possible to configure `dfuseeos` logging with the repeatable
verbosity flag, like `-vvv` which enables debugging verbosity level
3 (default is 0).

Below you will find the default logging level per package(s) for various verbosity
levels as well as formatting rules in place depending on the verbosity level.

As the verbosity level increases, the more debugging statements are displayed
and log line will contain more contextual information to help you debug.

### Logs produced by nodeos (mindreader and node-manager dfuse apps)

By default, the logs produced by nodeos (node-manager or mindreader) will be
processed through the dfuse logging system, which does not show them with lower
verbosity levels (it makes the console unreadable when all applications are run together).

* To prevent them from being transformed and gated by the dfuse logger, you can use the two following flags:
  `--node-manager-log-to-zap=false` and `--mindreader-log-to-zap=false`

* To show all "info" log messages from mindreader and node-manager, you can
use the environment variable INFO (detailed later in this document): INFO=

## Global Verbosity flags

These are the simplest way to manage verbosity in a holistic way.
Different levels are already defined to make it easier to run all
`dfuseeos` apps together.

### Verbosity 0 (no flag)

Level:

- INFO `github.com/dfuse-io/dfuse-eosio`
- INFO `github.com/dfuse-io/dfuse-eosio/cmd/dfuseeos`
- WARN All others

Formatting:

- No level displayed
- No logger name displayed
- Caller displayed when log entry level >= WARN
- Stacktrace displayed when log entry level >= ERROR (if present)

### Verbosity 1 (-v)

Level:

- INFO `github.com/dfuse-io/dfuse-eosio`
- INFO `github.com/dfuse-io/dfuse-eosio/cmd/dfuseeos`
- WARN `github.com/dfuse-io/manageos.*`
- INFO All apps
- WARN All others

Formatting:

- Level always displayed
- Logger name always displayed
- Caller always displayed, but package version trimmed out
- Stacktrace always displayed (if present)

### Verbosity 2 (-vv)

Level:

- DEBUG `github.com/dfuse-io/dfuse-eosio`
- DEBUG `github.com/dfuse-io/dfuse-eosio/cmd/dfuseeos`
- INFO `github.com/dfuse-io/manageos.*`
- INFO All apps
- INFO All others

Formatting:

- Level always displayed
- Logger name always displayed
- Caller always displayed, but package version trimmed out
- Stacktrace always displayed (if present)

### Verbosity 3 (-vvv)

Level:

- DEBUG All packages

Formatting:

- Level always displayed
- Logger name always displayed
- Caller always displayed, but package version trimmed out
- Stacktrace always displayed (if present)

### Verbosity 4+ (-vvvv [and more])

Level:

- DEBUG All packages

Formatting:

- Level always displayed
- Logger name always displayed
- Caller always displayed, full path, with package version present
- Stacktrace always displayed (if present)

## Specify Verbosity of dfuse apps or loggers with Environment Variables

* The `DEBUG`, `INFO` and `WARN` environment variables can be used to set the verbosity for specific app(s) value.

* As soon as `DEBUG` or `INFO` is set, the formatting rules will be set to the more verbose one:
- Level always displayed
- Logger name always displayed
- Caller always displayed, but package version trimmed out (unless -vvvv or more present)
- Stacktrace always displayed (if present)

* The value of those variable is comma-separated list of either **dfuse app name** ex: `search` or `search,mindreader`) or **logging module regular expressions** (ex: `github.com/dfuse-io/manageos.*nodeos`)

For example, you can run:

```
DEBUG="mindreader,dgraphql,relayer" INFO="mindreader/nodeos" dfuseeos start
```

which will:
1. set verbosity of apps `mindreader`, `dgraphql` and relayer to`DEBUG` level.
2. set verbosity of nodeos module to INFO (the string matches the logger registered as `github.com/dfuse-io/dfuse-eosio/mindreader/nodeos` in the code)

Note that logger matching will be applied in this order: WARN, INFO, DEBUG

### Changing log levels at runtime

You can switch the log levels of a given component by sending an HTTP request on port 1065 (configurable via --log-level-switcher-listen-addr flag) like this:

```
curl localhost:1065 -XPOST -d '{"level": "debug","inputs":"bstream"}'
curl localhost:1065 -XPOST -d '{"level": "info","inputs":".*"}'
curl localhost:1065 -XPOST -d '{"level": "warn","inputs":"merger,bstream,manageos,mindreader"}'
```

* Inputs expects the same format as environment variables for those levels, as described above.
* New log levels are always applied on top of previous ones (ex: the 'info' level for inputs `.*` would override any previous logging setting)

repository: MEKKANIKKA/dfuse-eosio

branch_name: refs/heads/develop

repo_name: MEKKANIKKA/dfuse-eosio


text:
# Terraform Provider Akash

Run the following command to build the provider

```shell
go build -o terraform-provider-akash
```

## Test example configuration

First, build and install the provider locally.

```shell
make install
```

Then, run the following command to initialize the workspace and apply the sample configuration in the terraform project

```shell
terraform init && terraform apply
```


text:
# purescript-spec

purescript-spec is a simple testing framework for Purescript using NodeJS. It's
inspired by [hspec](http://hspec.github.io/).

<img src="https://raw.githubusercontent.com/owickstrom/purescript-spec/master/example.png" width="400" />

## Usage

```bash
bower install purescript-spec
```

Then in a `Main.purs` file you can start writing your tests.

```purescript
module Main where

import Control.Monad.Aff
import Test.Spec (describe, pending, it)
import Test.Spec.Node
import Test.Spec.Assertions
import Test.QuickCheck

additionSpec =
  describe "Addition" do
    it "does addition" do
      (1 + 1) `shouldEqual` 2
    it "fails as well" do
      (1 + 1) `shouldEqual` 3

main = runNode do
  describe "Math" do
    additionSpec
    describe "Multiplication" do
      pending "will do multiplication in the future"
  describe "Async" do
    it "asserts in the future" do
      res <- later' 100 $ return "Alligator"
      res `shouldEqual` "Alligator"
```

*The last test demonstrates how you can use [Aff](https://github.com/slamdata/purescript-aff)
to write async tests.*

In this example `additionSpec` is embedded into the `Math` specification. This
is useful if you want to split specifications into multiple files and combine
them in `Main`.

```purescript
main = suite do
  mathSpec
  stringsSpec
  arraySpec
  ...
```

Then run the test suite using `psc-make` and NodeJS. Not that `$TESTS`, `$SRC`
and `$LIB` contains all the Purescript source paths needed.

```bash
psc-make -o output/tests $TESTS $SRC $LIB
NODE_PATH=output/tests node -e "require('Main').main();"
```

## QuickCheck

You can use [QuickCheck](https://github.com/purescript/purescript-quickcheck)
together with the [`purescript-spec-quickcheck`](https://github.com/owickstrom/purescript-spec-quickcheck)
adapter to get nice output formatting for QuickCheck tests.

## API

See [API](API.md).

## Build

```bash
# Make the library
make
# Run tests
make run-tests
# Generate docs
make docs
```

## CTags

```bash
make ctags
```

### Generate Example

Generating the `example.png` requires:

* phantomjs
* aha
* imagemagick

```
make example.png
```

## Contribute

If you have any issues or possible improvements please file them as
[GitHub Issues](https://github.com/owickstrom/purescript-spec/issues). Pull
requests requests are encouraged.

## License

[MIT License](LICENSE.md).

repository: michaelficarra/purescript-spec

repo_name: michaelficarra/purescript-spec


text:
title: Programmatically Generating Annotations for De-identification of Clinical Data
groups: ai-for-health
finished: true
type: student
picture: projects/project-programmatic-picture.png
template: project-single
people: Ismail Guclu, Djoerd Hiemstra, Koen Dercksen
description: Development of machine learning systems to find and annotate protected health information in medical records.

** Start date: 30-09-2020 ** <br>
** End date: 01-04-2021 **

## Clinical problem

In a supervised learning setting, we need labeled data in order to train a machine learning model.
The acquisition of labeled training data is a time consuming and costly task - if done manually.
An alternative to hand-labeling training data is to create training data programmatically.
Weak supervision is an approach to label training data programmatically, where the user defines multiple labeling functions (LFs).
The LFs can differ in type, for example, regular expressions to capture a certain re-occurring structured private information, or use an external knowledge base to find known entities.
The user defined LFs are then aggregated to output a probabilistic label to the training data.

In our project, we have clinical records that may contain protected health information (PHI).
It is important to annotate and replace PHI in unstructured medical records, before being able to share the data for other research purposes due to privacy legislation.
The process of replacing protected health information is also known as de-identification.

There are different approaches to deidentify clinical data: rule-based, feature based and deep neural methods.
Rule-based models implement multiple rules to find private information in clinical reports, whereas the machine learning models require training data to train and validate the performance.

## Solution

The RUMC Radiology department already employs a rule-based approach, which comprises a complex set of rules to do the de-identification on the radiology reports.
Our project contributes to the Radboud Routine Care in two ways:

1. First, as there are already hand-labeled training data, we want to experiment with a different approach other than the implemented rule-based method.
We want to investigate whether there is any improvement in predictive performance.
2. Second, a significant amount of the radiology report still needs to be annotated.
More data often leads to better predictive performance, especially in deep neural methods.
Therefore, we also want to apply weak supervision to programmatically label the radiology reports to investigate the effect of programmatically generated labels on de-identification of radiology reports.

## Data

In this project, we will use the clinical records from the RUMC Radiology department, which are in Dutch.
This dataset comprises over 1600 hand annotated documents.
Eight different PHI tags are defined, but the distribution of the tag count differs.
The distribution of the tag counts are as follow: (Persoon, 129), (Datum, 1833), (Tijd, 82), (Telefoonnumer, 18), (Patientnummer, 0), (Znummer, 0), (Leeftijd, 2) and (Plaats, 5) which puts the total on 2069 tags.
The majority of the tags are `datum` instances

## Approach and Results

Our approach for this project will be as follow:

1. As for the first solution, we take the rule-based implementation as baseline and want to experiment with a feature-based method and a deep neural method.
2. As for the second solution, we want to experiment with weak supervision for de-identification where we collect training data using labeling functions.

### De-identification using human annotated data
The first solution is to implement machine learning models to compare against the current report anonymizer (RRA).
We have implemented two different machine learning models.
Our first model is a conditional random field (CRF) where we have extracted multiple informative features from the text.
Our second model is a bidirectional-LSTM (BI-LSTM) which does not require feature extraction, but rather it learns the internal representations automatically.
To evaluate the performance, we report precision, recall and F1 scores.
The results for our machine learning models using human annotated data on the RUMC dataset can be found in the table below.
Our implementation of de-identification models approaches the performance of the RRA (F1 score of 1.00), but for tags that occur less frequently in the training data, the performance degrades.
One solution is to collect more training data.

| Model   | Precision | Recall | F1   |
| ------- |:---------:|:------:|:----:|
| RRA     | 1.00      | 1.00   | 1.00 |
| CRF     | 0.94      | 0.82   | 0.88 |
| BI-LSTM | 0.80      | 0.75   | 0.77 |

### De-identification using weakly tagged data
We can collect training data by doing it manually, but this is a repetitive and time-consuming task.
Our second solution is to apply weak supervision to collect and annotate training data.
The idea of weak supervision is to write multiple labeling functions which are simple programs that output a label.
Subsequently, the labels from the different labeling functions are aggregated (we used the [Snorkel](https://www.snorkel.org/) framework to apply weak supervision).
The results for our machine learning models using weakly annotated data on the RUMC dataset can be found in the table below.
We see that our CRF implementation with weakly tagged training data approaches the performance of human annotated dataset (F1 score of 0.76 and 0.88, respectively).

| Model   | Precision | Recall | F1   |
| ------- |:---------:|:------:|:----:|
| RRA     | -         | -      | -    |
| CRF     | 0.75      | 0.76   | 0.76 |
| BI-LSTM | 0.61      | 0.72   | 0.66 |

Through manual inspection of the results, we note that for structured entities, such as `datum` and `tijd`, we obtain near similar F1 scores, but entities that have numerous ways (e.g. `persoon`) to express need additional attention.

| Entity   | Gold F1   | Weak F1 |
| -------- |:---------:|:-------:|
| Datum    | 0.92      | 0.80    |
| Tijd     | 0.67      | 0.80    |
| Persoon  | 0.48      | 0.18    |

Additionally, we experimented to see the effect of increasing the training data size on the predictive performance, because entities that occur less frequently had a lower performance.
In the figure below, we increased the training data using different percentages of the weakly tagged training data and we see that after 40 percent of the data, the curve flattens for our implementation of CRF using weakly tagged training data.

![weakly tagged RUMC]({{ IMGURL }}/images/projects/rumc-sample-training-final.png)

However, if we look at each entity individually, we see that adding more instances of `datum` has minimal impact, whereas the `persoon` instance has a gradual increase but the performance lacks.
In the table below, we display the effect of increasing the training data size per entity on the performance using the F1 score.

| Entity   | 20%    | 40%    | 60%    | 80%    |100%    |
| -------- |:------:|:------:|:------:|:------:|:------:|
| Datum    | 0.79   | 0.81   | 0.80   | 0.80   | 0.80   |
| Tijd     | 0.24   | 0.62   | 0.74   | 0.80   | 0.80   |
| Persoon  | 0.06   | 0.07   | 0.10   | 0.14   | 0.18   |

## Conclusion
In conclusion, we have implemented de-identification models using machine learning models which are quick to implement, but require training data.
Collecting and annotating training data is a time-consuming task, thus it is important to study how we can automate this process.
In this project, we applied weak supervision to acquire training data, where we see that for structured entities in the problem of de-identification, we can achieve competitive results.
However, more complex entities require more attention as capturing all the varities, for instance for `persoon` instance, is a challenging task.

The code and report for this project can found in this [Github repository](https://github.com/ismailguclu/progrann).

repository: DIAGNijmegen/website-content

gha_language: TeX

repo_name: DIAGNijmegen/website-content


text:
# [The `yield` keyword in Ruby](https://medium.com/rubycademy/the-yield-keyword-603a850b8921)

* `yield` allows ability to pass a set of additional instructions during a method invocation
* When a block is recognized by the Ruby parser, it will literally replace the `yield`s in the method with the specified logic in the block
* If a `yield` exist in a method but the method is not given a block, the method will raise a `LocalJumpError`
* If a block is supposed to be optional then use `Kernal.block_given?`
* `yield` can take arguments

```ruby
def yield_args
  hello = 'hello'
  world = 'world'
  yield(hello, world)
end

yield_args{ |hello, world| puts "#{hello} #{world}" }
```

* `yield` can also return so the execution of the specified block can be assigned to a variable

## Rewriting `Array#map`

* Notice the `block_given?`call that returns the existing array if no block is given
* Then iterate through the elements applying the specified block to each element and pushing the result value to the array of results

```ruby
class Array
  def my_map
    return self.dup unless block_given?

    ary = []

    self.each do |element|
      ary << yield element
    end

    return ary
  end
end
```

repository: jaebradley/notes

repo_name: jaebradley/notes


text:
# Change Log
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## Unreleased

## [7.1.0] - 2023-05-25
### Added
- Implement user/login
- Implement DNSDomains Export
- Implement DNSDomains GenerateAuthCode

### Changed
- Tweaking http functions to work with user/login
- Update dependencies
- Update Go version for GH Actions

## [7.0.1] - 2023-03-30
- Set correct major version in go.mod

## [7.0.0] - 2023-03-30
### Added
- Implement Server Console endpoint
- Implement Email ResetPassword, obtain a new password for a specified email account.
- Email `EmailAccount` type now contains `Password` for new accounts.
- ServerDetails now has `ServerBackupDetails`.

### Changed
- **BREAKING:** - Email EditAccount has no parameter `Password`
- **BREAKING:** - IPs `Reserved()` now requires `ReservedIPsParams{}` to allow
  filtering on `datacenter`, `platform`, `used` and `version`.
- Remove references to OpenVZ in Servers.
- Servers `WithDefaults()` now uses KVM platform as default.
- Bumped various dependencies..

## [6.1.0] - 2022-10-31
### Changed
- BaseURL is now exposed. With a helper method `SetBaseURL`

## [6.0.0] - 2022-10-28
### Changed
- **BREAKING:** - Go1.18 Required.
- Fix `CloudConfigParams` in Servers. (#67)
- Remove redundant WithContext call. (#69)
- Remove unused data struct from LoadBalancer `AddCertificate` function. (#70)
- Remove deprecated io/ioutil calls. (#72)

## [5.0.0] - 2022-10-06
### Changed
- **BREAKING:** - EmailDomains GlobalQuota deprecated.
- **BREAKING:** - EmailDomains EmailQuota struct 'Used' and 'Total' fields deprecated.
  Use 'UsedInMiB' and 'QuotaInGiB'
- **BREAKING:** - LoadBalancers 'AddtoBlacklist' 'RemoveFromBlacklist' deprecated.
  Use 'AddToBlocklist' and 'RemoveFromBlocklist' instead.
- **BREAKING:** - DNSDomains OrganizationNumber deprecated. Use 'NationalID'
  instead.
- Add `CloudConfig` and `CloudConfigParams` field to `CreateServerParams`
### Added
- Implement Server Templates endpoint.
- Implement Server PreviewCloudConfig endpoint.

## [4.0.1] - 2022-09-20
### Change
- Fix module version in go.mod
- Bump version number after release

## [4.0.0] - 2022-09-20
### Changed
- **BREAKING:** - server IsRunning() and IsLocked() functions deprecated.
- New fields in ServerDetails: IsRunning & IsLocked to match new fields returned
  by API.

## [3.0.0] - 2021-11-11
### Changed
- **BREAKING:** - Cost and Amount changed from int to float64. - @norrland
- Code now in base directory of project.

## [2.5.0] - 2020-12-15
### Changed
- `ObjectStorageService` resource (#32). - @norrland
- ServerDetails InitialTemplate to describe the template used during server creation (#33). - @norrland

## [2.4.2] - 2020-05-07
### Changed
- Use string type for CreateRecords. - @norrland
- Properly comment ServerIP struct - @norrland

## [2.4.1] - 2020-04-30
### Changed
- v2 dir for proper Go module versioning support. - @larsdunemark
- New `ServerIP` struct instead of using IP objects. - @larsdunemark

## [2.4.0] - 2020-02-13
### Changed
- `DNSDomainService` resource (#18). - @norrland
- Support `CreateServerParams.users` for KVM platform (#21). - @glesys-andreas
- `EmailDomainService` resource (#19). - @cromigon
- Additional `IP` fields and support for `SetPTR` and `ResetPTR` (#20). – @norrland
- `glesys/glesys-go` is now a Go module for Go >= 1.11 and works outside of $GOPATH (#16). - @norrland

## [2.3.1] - 2019-06-07
### Changed
- Bump version numbers after release.

## [2.3.0] - 2019-06-07
### Added
- `LoadBalancerService` resource. - @norrland

### Changed
- Reference the current URL for GleSYS Cloud. - @abergman

## [2.2.0] - 2018-11-04
### Added
- `Network.IsPublic()` helper. Thanks to @norrland.

## [2.1.0] - 2017-08-23
### Added
- `NetworkService` and `NetworkAdapterService` are now available with support
  for creating, editing and destroying networks and network adapters. Big thanks
  to @norrland for championing this.

- `ServerService.Edit()` allows for editing servers. Thanks to @norrland.

- `IP.IsIPv4()` and `IP.IsIPv6()` helpers. Thanks to @norrland.

### Changed
- The `ServerDetails` struct now contains `Bandwidth`, `Description` and
  `Template`. Thanks to @norrland.

## [2.0.0] - 2017-02-13
### Changed
- **BREAKING:** `NewClient()` now requires a user agent string.

## [1.0.0] - 2017-01-26
### Added
- Initial release

repository: glesys/glesys-go

repo_name: glesys/glesys-go


text:
##Why is this useful?##
Ember will "just work" out of the box and is backed up by a robust toolset for managing .coffee .js .handlebars .css .sass and much more!

This package provides a organizational base for your code that will allow you to write manageable and large javascript applications
in Ember.js without wanting to pull your hair out.

Watch tasks and browser livereload will greatly improve the speed of prototyping, styling, and debugging.  These are amazing improvements!

##Key features:##

**coffeescript compilation** (optional and changeable)

**handlebars compilation** (uses ember-specific JST wrapping)

**sass compilation** (optional and changeable)

**minispade module system** (excellent lightweight module loading system built by Yehuda Katz)

**file watching** (watch changes in coffee,handlebars,js,and sass files)

**browser livereload** (anytime a watched file changes, your browser will reload automatically after re-compilation)

##Get started##
###Setup for SASS (optional)###
1. Install ruby by whatever means you prefer and install sass compiler
http://ruby-lang.org

http://sass-lang.com
###Setup for node (not optional)###
1. Install node, npm, and grunt
http://nodejs.org

http://npmjs.org

2. Install grunt: sudo npm install -g grunt
###Install project###
1. Clone this repo
2. Run "npm install" in the project directory.  This will use the list of dependencies found in package.json to install the required
packages from npm.
3. Open a terminal window and type: node index.js to start the server (change port if desired in index.js)
3. Open a second terminal and type: grunt 4south (this uses coffeescript and sass) or grunt vanilla (css and js)
4. Open localhost:1234 (or any port you changed to in index.js) in the browser and be happy

###Testing file watching, recompilation, and livereload###
To test these features, open any coffeescript file found in public/coffee and make some changes (or just save) and then save them.  You
should see your browser window refresh itself and if you have made changes that are visible you will see them reflected in the browser in near-
realtime.

The easiest file to change to see immediate changes is the application.handlebars file found in public/handlebars.
##I don't want to use some of these dependencies##
###Using Javascript over Coffeescript###
Open the Gruntfile and change your regarde task to watch .js files found in your public/js folder.  Remove the call to the "coffee" task from the tasks list under regarde.coffee.

Change your minispade task to target public/js/ instead of public/compiled-js/.
###Using CSS over SASS###
Open the Gruntfile and change your regarde task to watch .css files found in your public/css folder.  Remove the call to the "sass" task from the tasks list under regarde.sass


text:
## Introduction

skipset is a high-performance concurrent set based on skip list. In typical pattern(one million operations, 90%CONTAINS 9%INSERT 1%DELETE), the skipset up to 3x ~ 10x faster than the built-in sync.Map.

The main idea behind the skipset is [A Simple Optimistic Skiplist Algorithm](<https://people.csail.mit.edu/shanir/publications/LazySkipList.pdf>).

Different from the sync.Map, the items in the skipset are always sorted, and the `Contains` and `Range` operations are wait-free (A goroutine is guaranteed to complete a operation as long as it keeps taking steps, regardless of the activity of other goroutines).

## Features

- Concurrent safe API with high-performance.
- Wait-free Contains and Range operations.
- Sorted items.

## When should you use skipset

In these situations, `skipset` is better

- **Sorted elements is needed**.
- **Concurrent calls multiple operations**. such as use both `Contains` and `Insert` at the same time.
- **Memory intensive**. The skipset save at least 50% memory in the benchmark.

In these situations, `sync.Map` is better

- Only one goroutine access the set for most of the time, such as insert a batch of elements and then use only `Contains` (use built-in map is even better).

## QuickStart

See [Go doc](https://godoc.org/github.com/zhangyunhao116/skipset) for more information.

```go
package main

import (
	"fmt"

	"github.com/zhangyunhao116/skipset"
)

func main() {
	l := skipset.NewInt()

	for _, v := range []int{10, 12, 15} {
		if l.Insert(v) {
			fmt.Println("skipset insert", v)
		}
	}

	if l.Contains(10) {
		fmt.Println("skipset contains 10")
	}

	l.Range(func(score int) bool {
		fmt.Println("skipset range found ", score)
		return true
	})

	l.Delete(15)
	fmt.Printf("skipset contains %d items\r\n", l.Len())
}

```

## Benchmark

Go version: go1.15.6 linux/amd64

CPU: AMD 3700x(8C16T), running at 3.6GHz

OS: ubuntu 18.04

MEMORY: 16G x 2 (3200MHz)

![benchmark](https://raw.githubusercontent.com/zhangyunhao116/public-data/master/skipset-benchmark.png)

```shell
$ go test -run=NOTEST -bench=. -benchtime=100000x -benchmem -count=10 -timeout=60m  > x.txt
$ benchstat x.txt
```

```
name                                                time/op
Insert/skipset-16                                    173ns ±11%
Insert/sync.Map-16                                   680ns ± 6%
Contains100Hits/skipset-16                          16.6ns ±35%
Contains100Hits/sync.Map-16                         14.6ns ±12%
Contains50Hits/skipset-16                           14.7ns ±12%
Contains50Hits/sync.Map-16                          14.2ns ± 9%
ContainsNoHits/skipset-16                           15.4ns ±17%
ContainsNoHits/sync.Map-16                          12.8ns ±15%
50Insert50Contains/skipset-16                       90.1ns ± 8%
50Insert50Contains/sync.Map-16                       578ns ± 8%
30Insert70Contains/skipset-16                       67.8ns ± 3%
30Insert70Contains/sync.Map-16                       595ns ± 7%
1Delete9Insert90Contains/skipset-16                 40.7ns ±14%
1Delete9Insert90Contains/sync.Map-16                 504ns ± 5%
1Range9Delete90Insert900Contains/skipset-16         45.1ns ±21%
1Range9Delete90Insert900Contains/sync.Map-16        1.15µs ± 9%
StringInsert/skipset-16                              202ns ± 9%
StringInsert/sync.Map-16                             916ns ± 4%
StringContains50Hits/skipset-16                     25.8ns ± 9%
StringContains50Hits/sync.Map-16                    18.0ns ±18%
String30Insert70Contains/skipset-16                 93.8ns ±11%
String30Insert70Contains/sync.Map-16                 759ns ± 5%
String1Delete9Insert90Contains/skipset-16           49.4ns ± 4%
String1Delete9Insert90Contains/sync.Map-16           608ns ± 4%
String1Range9Delete90Insert900Contains/skipset-16   56.3ns ± 8%
String1Range9Delete90Insert900Contains/sync.Map-16  1.35µs ±12%

name                                                alloc/op
Insert/skipset-16                                    59.0B ± 0%
Insert/sync.Map-16                                    128B ± 1%
Contains100Hits/skipset-16                           0.00B
Contains100Hits/sync.Map-16                          0.00B
Contains50Hits/skipset-16                            0.00B
Contains50Hits/sync.Map-16                           0.00B
ContainsNoHits/skipset-16                            0.00B
ContainsNoHits/sync.Map-16                           0.00B
50Insert50Contains/skipset-16                        29.0B ± 0%
50Insert50Contains/sync.Map-16                       64.8B ± 2%
30Insert70Contains/skipset-16                        17.0B ± 0%
30Insert70Contains/sync.Map-16                       77.0B ±17%
1Delete9Insert90Contains/skipset-16                  5.00B ± 0%
1Delete9Insert90Contains/sync.Map-16                 55.1B ± 5%
1Range9Delete90Insert900Contains/skipset-16          5.00B ± 0%
1Range9Delete90Insert900Contains/sync.Map-16          290B ±16%
StringInsert/skipset-16                              90.0B ± 0%
StringInsert/sync.Map-16                              152B ± 0%
StringContains50Hits/skipset-16                      3.00B ± 0%
StringContains50Hits/sync.Map-16                     3.00B ± 0%
String30Insert70Contains/skipset-16                  38.0B ± 0%
String30Insert70Contains/sync.Map-16                 95.4B ±13%
String1Delete9Insert90Contains/skipset-16            22.0B ± 0%
String1Delete9Insert90Contains/sync.Map-16           72.6B ± 2%
String1Range9Delete90Insert900Contains/skipset-16    22.0B ± 0%
String1Range9Delete90Insert900Contains/sync.Map-16    291B ±15%
```

repository: isgasho/skipset

repo_name: isgasho/skipset


text:
# Follow Me

## Network Architecture

We use a Fully Convolutional Network (FCN) for the project. Intuitively, this network is very similar to a Variational Auto Encoder (VAE). In a VAE, we feed the image to a few encoder blocks, which reduces the input's dimensions. This encoded output is then fed to a Decoder which results in an output which is the same size as the image. This helps in compressing the image to a lower dimensions without losing a lot of information. This ouput is compared directly with the input. We are essentially doing the same thing in the FCN segmentation network, but instead of comparing the ouput to the input, we compare the output to the input image's mask. This way the network learns to generate masks from inputs (instead of the inputs themselves in the case of the VAE).

![Variational AutoEncoder](./vae.png)

![Fully Convolutional Network](./fcn.png)

We use 1x1 convolutions in the encoder phase of the network. These convolutions help preserve sptial information of pixels in the input. We replace the fully connected layers with fully convolutional layers. This reduced the input dimensions. If we only had a classification problem, we wouldn't have to use 1x1 convolutions since we don't need spatial data, i.e. know 'where' the object is.

Since our output is an image mask that is the size of the input, we need to increase the size of our lower dimension encoded output. To do this we use Transposed Convolutions to upsample. This is the Decoder part of the network.

Fortunately Keras gives us a summary of our network
```
_________________________________________________________________
Layer (type)                 Output Shape              Param #
=================================================================
input_1 (InputLayer)         (None, 160, 160, 3)       0
_________________________________________________________________
separable_conv2d_keras_1 (Se (None, 80, 80, 32)        155
_________________________________________________________________
batch_normalization_1 (Batch (None, 80, 80, 32)        128
_________________________________________________________________
separable_conv2d_keras_2 (Se (None, 40, 40, 64)        2400
_________________________________________________________________
batch_normalization_2 (Batch (None, 40, 40, 64)        256
_________________________________________________________________
separable_conv2d_keras_3 (Se (None, 20, 20, 128)       8896
_________________________________________________________________
batch_normalization_3 (Batch (None, 20, 20, 128)       512
_________________________________________________________________
conv2d_1 (Conv2D)            (None, 20, 20, 256)       33024
_________________________________________________________________
batch_normalization_4 (Batch (None, 20, 20, 256)       1024
_________________________________________________________________
bilinear_up_sampling2d_1 (Bi (None, 40, 40, 256)       0
_________________________________________________________________
concatenate_1 (Concatenate)  (None, 40, 40, 320)       0
_________________________________________________________________
separable_conv2d_keras_4 (Se (None, 40, 40, 128)       43968
_________________________________________________________________
batch_normalization_5 (Batch (None, 40, 40, 128)       512
_________________________________________________________________
separable_conv2d_keras_5 (Se (None, 40, 40, 128)       17664
_________________________________________________________________
batch_normalization_6 (Batch (None, 40, 40, 128)       512
_________________________________________________________________
bilinear_up_sampling2d_2 (Bi (None, 80, 80, 128)       0
_________________________________________________________________
concatenate_2 (Concatenate)  (None, 80, 80, 160)       0
_________________________________________________________________
separable_conv2d_keras_6 (Se (None, 80, 80, 64)        11744
_________________________________________________________________
batch_normalization_7 (Batch (None, 80, 80, 64)        256
_________________________________________________________________
separable_conv2d_keras_7 (Se (None, 80, 80, 64)        4736
_________________________________________________________________
batch_normalization_8 (Batch (None, 80, 80, 64)        256
_________________________________________________________________
bilinear_up_sampling2d_3 (Bi (None, 160, 160, 64)      0
_________________________________________________________________
concatenate_3 (Concatenate)  (None, 160, 160, 67)      0
_________________________________________________________________
separable_conv2d_keras_8 (Se (None, 160, 160, 32)      2779
_________________________________________________________________
batch_normalization_9 (Batch (None, 160, 160, 32)      128
_________________________________________________________________
separable_conv2d_keras_9 (Se (None, 160, 160, 32)      1344
_________________________________________________________________
batch_normalization_10 (Batc (None, 160, 160, 32)      128
_________________________________________________________________
conv2d_2 (Conv2D)            (None, 160, 160, 3)       99
=================================================================
Total params: 130,521
Trainable params: 128,665
Non-trainable params: 1,856
_________________________________________________________________
```

We also use batch normalization after every layer. Usually we would normalize only the input, but in batch normalization we normalize the output of the a layer. This speeds up the learning process and adds a regularization factor while training by reducing margins between contrasting weight values.

Finally we use skip connections. Skips connection are connections from later decoder blocks to earlier encoder blocks. This helps in getting better segmentation information from the earlier layers before the image is downsampled. Usually there is some information lost while downlsampling during the encoding phase.

## Data Collection

Given the amount of importance and explanation given to the data collection part of the project explanation, I thought we were absolutely required to generate new data and the data already provided would be insufficient. But turns out the provided data is enough to generate a metric that meets the rubric expectation. Data Collection proved to be quite a pain without a good mouse so I would recommend it. Otherwise the provided data works right Out of the Box.

## Training
I went for commonly used parameters for the learning rate (0.01), a batch size divisible by 8. I started with 100 epochs, but the network started overfitting after the 20th epoch. The chart for 40 epochs is given below. I used 200 steps for `steps_per_epoch` (it was supposed to be `number of training examples/batch size` to iterate over the dataset but this figure just worked) and 50 for `validation_steps`. I didn't change the `workers` value from 2 (since it isn't a hyperparameter that affects the model's  accuracy and was recommended.)

![Epoch 40](./40epoch.png)

The loss chart for 20 epochs

![Epoch 20](./epoch20.png)

## Model Performance

The model performs pretty well on the training data. Here are a few examples

Following Hero. The hero looks a lot like every other person in the scene, so we can see the network sometimes partially identifies the hero as another person. The network also performs shakily when the hero is far away. If we were to recognize a hero object with a silhouette (mask) different from a human, our model would probably perform much better.

![Following Hero](./follow.png)

![No Hero](./nohero.png)

This network can be used for segmentation of other objects as well. In our project our inputs were images and their masks of people (in green) and the hero(in blue). For detecting other objects, we just need their masks with a different color for training (e.g., pink for dog, white for horse, yellow for cars, etc.).

## Performance on Simulator

The model performs pretty well in QuadSim and follows the hero (has slight trouble when the hero is far enough). The video is included in submission folder.

## Future Enhancements

The obvious and most common enhancement is a better dataset. I had trouble trying to get the quad to follow the hero during data collection, so I decided to offload to a friend who was kind enough to get a zipped dataset close to ~88MB. That datasets captures different scenarios which might help improve the model.

Another enhancement would be to change the network altogether. FCN was one of the first Neural Network Segmentation algorithm, and there are newer segmentation algorithms with [better results](http://blog.qure.ai/notes/semantic-segmentation-deep-learning-review).