text:
---
actual_indicator_available: "Estimated number of victims of intentional homicide per\
  \ 100,000 population, Estimated number of victims of intentional homicide by sex\
  \ and age\t\t\t"
actual_indicator_available_description: Estimated number of victims of intentional
  homicide per 100,000 population, Estimated number of victims of intentional homicide
  by sex and age
comments_and_limitations: NA
computation_units: "Estimated volume number and rate per 100,000\t\t\t\t\t\t\t"
data_non_statistical: false
date_metadata_updated: November 2017
date_of_national_source_publication: September 2017
disaggregation_categories: NA
disaggregation_geography: "National\t\t\t\t\t\t\t"
goal_meta_link: http://unstats.un.org/sdgs/files/metadata-compilation/Metadata-Goal-16.pdf
graph: longitudinal
graph_title: Estimated number of US victims of intentional homicide per 100,000 population
graph_type: line
has_metadata: true
indicator: 16.1.1
indicator_definition: "From UNODC:Intentional homicide is defined as the unlawful\
  \ death inflicted upon a person with the intent to cause death or serious injury\
  \ (Source: International Classification of Crime for Statistical Purposes, ICCS\
  \ 2015); the rate is defined as the total count of victims of intentional homicide\
  \ divided by the total resident population, expressed per 100,000 population. From\
  \ Goal 16 TST Working Group:  This indicator is a composite indicator constructed\
  \ by collecting two numbers, deaths from intentional homicides and deaths from conflict\
  \ to measure \"peace\" with respect to target 1 ' \"Significantly reduce all forms\
  \ of violence and related deaths everywhere.\" The rates of intentional homicide\
  \ and conflict-related deaths should be reported separately, as combining them into\
  \ one single indicator would risk conflating two distinct phenomena with differing\
  \ root causes as well as varying levels of precision in measurement. Still, they\
  \ are useful complements to each other as, by construction, they are exclusive and\
  \ non-overlapping (ie. By design, their conjunction does not double count violent\
  \ deaths).  ICCS recommends\
  \ that intentional homicides include: \tMurder \tHonour killing \tSerious assault\
  \ leading to death \tDeath as a result of terrorist activities \tDowry-related killings\
  \ \tFemicide \tInfanticide \tVoluntary manslaughter \tExtrajudicial killings \t\
  Killings caused by excessive force by law enforcement/state officials Conflict-related\
  \ deaths refer to those deaths caused by warring parties, including, but not limited\
  \ to, those caused by traditional battlefield fighting and bombardments (battle-related\
  \ deaths). The term conflict-related death is broader than the term \"battlerelated\
  \ death\" as it includes killings that amount to war crimes, such as targeting of\
  \ civilians or of military 'hors combat', killings associated with a conflict (but\
  \ not accompanied by a battle between warring parties) such as one-sided killings,\
  \ pogroms and genocides. Following the ICCS definition (see homicides at left) death\
  \ as a result of terrorist activities would be included in intentional homicides.\
  \ For both intentional homicides and conflict-related deaths, rates are defined\
  \ as the total count in deaths in a calendar year, respectively, divided by the\
  \ total resident population for the year, expressed per 100,000 population. The\
  \ denominator (100,000 population) has been adopted globally by law enforcement\
  \ as the standard for comparable measurement."
indicator_name: Number of victims of intentional homicide per 100,000 population,
  by sex and age
indicator_sort_order: 16-01-01
indicator_variable: est_vctm_hmcd_ per_100k
international_and_national_references: "\thttps://ucr.fbi.gov/crime-in-the-u.s/2016/crime-in-the-u.s.-2016\t\
  \t\t\t\t\t\t\t\t\t\t"
layout: indicator
national_geographical_coverage: United States
periodicity: "Annual\t\t\t\t\t\t\t"
permalink: /16-1-1/
published: true
rationale_interpretation: "From UNODC:\nThis indicator is widely used at national\
  \ and international level to measure the most extreme form of violent crime and\
  \ it also provides a direct indication of lack of security. Security from violence\
  \ is a pre-requisite for individuals to enjoy a safe and active life and for societies\
  \ and economies to develop freely. Intentional homicides occur in all countries\
  \ of the world and this indicator has a global applicability. Monitoring intentional\
  \ homicides is necessary to better assess their causes, drivers and consequences\
  \ and, in the longer term, to develop effective preventive measures. \nIf data are\
  \ properly disaggregated (as suggested in the ICCS), the indicator can identify\
  \ the different type of violence associated with homicide: inter-personal (including\
  \ partner and family-related violence), crime (including organized crime and other\
  \ forms of criminal activities) and political (including terrorism, hate crime).\
  \ \nThe interpretation of this indicator is straightforward also for non-specialised\
  \ users.\n\n From Goal 16 TST Working Group: \n As described above, this composite\
  \ indicator is comprised of two forms of violent deaths. Intentional homicides occur\
  \ in all countries of the world and have global applicability, while conflict-related\
  \ deaths occur in countries with ongoing conflicts/wars. Peace is a much broader\
  \ concept than violent deaths, however, it is difficult to measure many aspects\
  \ of peace (threats and the fear of violence, insecurity, and other forms of violence,\
  \ including damages to persons and property). Deaths due to violence are universally\
  \ and easily understood, are frequently monitored and are comparable with only minor\
  \ discrepancies in interpretation, largely due to the finality of death. Monitoring\
  \ intentional homicides is necessary to better assess their causes and consequences\
  \ and, in the longer term, to develop effective prevention measures. It is based\
  \ on statistical data routinely produced by law enforcement authorities and/or public\
  \ health institutions, with a high degree of international comparability. Conflict-related\
  \ deaths measure the direct impact of conflicts on populations in terms of losses\
  \ of life."
reporting_status: complete
sdg_goal: 16
source_active_1: true
source_agency_staff_email_1<EMAIL_ADDRESS>source_agency_staff_name_1: FBI
source_agency_survey_dataset_1: FBI Uniform Crime Reporting Program Data Collection
source_notes_1: null
source_organisation_1: FBI Uniform Crime Reporting Program Data Collection
source_title_1: null
source_url_1: "\thttps://ucr.fbi.gov/crime-in-the-u.s/2016/crime-in-the-u.s.-2016\t\
  \t\t\t\t\t\t\t\t\t\t\t"
target: Significantly reduce all forms of violence and related death rates everywhere.
target_id: '16.1'
time_period: Annual
title: Number of victims of intentional homicide per 100,000 population, by sex and
  age
un_custodial_agency: UNODC, WHO  (Partnering Agencies:DESA Population Division)
un_designated_tier: '1'
us_method_of_computation: "These tables contain statistics for the entire United States.\
  \ Because not all law enforcement agencies provide data for complete reporting periods,\
  \ the Federal Bureau of Investigation (FBI) estimated crime numbers in these presentations.\
  \ The FBI computes estimates for participating agencies that do not provide 12 months\
  \ of complete data. For agencies supplying 3 to 11 months of data, the national\
  \ Uniform Crime Reporting (UCR) Program estimates for the missing data by following\
  \ a standard estimation procedure using the data provided by the agency. If an agency\
  \ has supplied less than 3 months of data, the FBI computes estimates by using the\
  \ known crime figures of similar areas within a state and assigning the same proportion\
  \ of crime volumes to nonreporting agencies. The estimation process considers the\
  \ following: population size covered by the agency; type of jurisdiction, e.g.,\
  \ police department versus sheriff\u2019s office; and geographic location. Much\
  \ of the data presented in the Crime in the United States publication are obtained\
  \ from the Monthly Return of Offenses Known to Police form which is required to\
  \ participate in the FBI UCR Program. Data sited from the FBI UCR Program\u2019\
  s website regarding the age and sex of a victim of homicide is obtained from the\
  \ Supplementary Homicide Report (SHR). The SHR provides additional details surrounding\
  \ the homicide such as victim and offender age, sex, and race, type of weapon, circumstance\
  \ during a homicide, and the relationship of the victim to the offender. The SHR\
  \ is not required for participation in the program. Murder victims with unknown\
  \ age and/or sex are not included in this table. To calculate the estimated number\
  \ of males, females, and age of the victim, the percent distribution was figured\
  \ using data supplied to the national UCR Program on the SHR. The resulting figure\
  \ was then applied to the total estimated number of homicides for the nation. The\
  \ homicide rate, defined as the number of offenses per 100,000 population, is derived\
  \ by first dividing the nation\u2019s population by 100,000 and then dividing the\
  \ number of offenses by the resulting figure."
variable_description: null
variable_notes: null
---

repository: brockfanning/sdg-data-usa

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: brockfanning/sdg-data-usa


text:
# React JS Diagrams

This is a fork of [React JS Diagrams](https://github.com/woodenconsulting/react-js-diagrams) which in turn is an ES6/JSX port of [React Diagrams](https://github.com/projectstorm/react-diagrams). Here are the changes made in this fork:

- **Fixed: [links aren't rendered on page load with a pre-saved model](https://github.com/woodenconsulting/react-js-diagrams/issues/6)**
- **Added a new optional prop `makeLinkModel` to `DiagramWidget` that lets a developer [instantiate their own link model](https://github.com/woodenconsulting/react-js-diagrams/issues/7) when a port is clicked and dragged.**
- **Added following props to `DiagramWidget` for disabling certain interactions:**
  - `disableInteractionZoom`
  - `disableInteractionCanvasMove`
  - `disableInteractionNodeSelect`
  - `disableInteractionNodeMove`
  - `disableInteractionNodeCreate`
  - `disableInteractionLinkSelect`
  - `disableInteractionLinkMove`
  - `disableInteractionLinkCreate`
- Created a new demo (demo5) which demostrates all above changes.
- Added `linkType` parameter to `LinkModel` constructor to make it more consistent with rest of the API (like `NodeModel`).
- Integrated [getPort](https://www.npmjs.com/package/get-port) and [opn](https://www.npmjs.com/package/opn) for faster development experience.
- Un-sunk couple of exceptions in `LinkLayerWidget#generateLinks`.
- Added jest as testing framework

![Demo](./images/main.png)

A React diagramming libary using lodash as its only additional dependency. Initially this project started as an ECMAScript / JSX port of the awesome<EMAIL_ADDRESS>repository by dylanvorster. It has since diverged with different features and goals. If you like TypeScript or a non JSX approach, check out the original repository.

## How To Install

```
npm install --save emumba-react-diagrams
```
or
```
yarn add emumba-react-diagrams
```

The above assumes that you are using [npm](http://npmjs.com/) with a module bundler like [Webpack](http://webpack.github.io/) or [Browserify](http://browserify.org/) in order to consume [CommonJS modules](http://webpack.github.io/docs/commonjs.html).

## Viewing The Examples / Developing

From the repository directory, ensure you've run `npm install` then run `npm start`.

Alternatively, you can run `./node_modules/.bin/webpack` from the repository directory to build the demo bundles and run them from the file system.

## How Does It Work

The library uses a Model Graph to represent the virtual diagram and then renders the diagram using
2 layers:
* Node Layer -> responsible for rendering nodes as React components
* Link Layer -> responsible for rendering links as SVG paths

Each node and link is fed into a factory that then generates the corresponding node or link React widget. This allows for deep customization when creating your own nodes. Browse the demos directory to learn how to create your own custom nodes (see __demo3__ or __demo4__).

__Demo 3 Custom Node:__
![CustomNode](./images/custom-nodes.png)

## Events

The RJD Diagram Widget utilizes a standard onChange to capture events.

```javascript
class MyDiagram extends React.Component {
  onChange(model, action) {
    console.log(model) // Serialized diagramModel
    console.log(action) // Object containing the event type and returned properties
  }

  render() {
    return <RJD.DiagramWidget diagramEngine={diagramEngine} onChange={this.onChange.bind(this)} />;
  }
}
```

### Action Types And Return Properties

---

__items-drag-selected__ -> Array items (NodeModel | LinkModel)

__items-moved__ -> Array items (NodeModel | LinkModel)

__items-selected__ -> NodeModel model, Array items (NodeModel | LinkModel)

__items-select-all__ -> Array items (NodeModel | LinkModel)

__items-deselect-all__ -> Array items (NodeModel | LinkModel)

__items-deleted__ -> Array items (NodeModel | LinkModel | PointModel)

__items-copied__ -> Array items (NodeModel | LinkModel)

__items-pasted__ -> Array items (NodeModel | LinkModel)

__link-created__ -> PointModel model

__link-selected__ -> LinkModel model

__link-deselected__ -> LinkModel model, Array items (NodeModel | LinkModel)

__link-connected__ -> LinkModel linkModel, PortModel portModel

__node-selected__ -> NodeModel model

__node-deselected__ -> NodeModel model, Array items (NodeModel | LinkModel)

__node-moved__ -> NodeModel model

__point-created__ -> PointModel model

__point-selected__ -> PointModel model

__point-deselected__ -> PointModel model

__canvas-drag__ -> event

__canvas-shift-select__ -> event

__canvas-click__ -> event

## Keyboard / Mouse Commands

__Delete__ removes any selected items
![__Delete__](./images/rjdDelete.gif)

__Shift + Mouse Drag__ triggers a multi-selection box
![Shift + Mouse Drag](./images/mouseDrag.gif)

__Shift + Mouse Click__ selects the item (items can be multi-selected)
![Shift + Mouse Click](./images/shiftClick.gif)

__Mouse Drag__ drags the entire diagram
![Mouse Drag](./images/canvasDrag.gif)

__Mouse Wheel__ zooms the diagram in / out
![Mouse Wheel](./images/mouseWheel.gif)

__Click Link + Drag__ creates a new link point
![Click Link + Drag](./images/createPoint.gif)

__Click Node Port + Drag__ creates a new link
![Click Node Port + Drag](./images/createLink.gif)

__Ctrl or ⌘ + C__ copy any selected items; note that only links that belong to a selected source node will
be copied to the internal clipboard

__Ctrl or ⌘ + V__ paste items previously copied to the internal clipboard

__Ctrl or ⌘ + A__ select all items

__Ctrl or ⌘ + D__ deselect all items

license: MIT

repository: emumba-com/react-js-diagrams

repo_name: emumba-com/react-js-diagrams


text:
#[poké-stats](https://tfonji.github.io/poke-stats/)
This website is a single page application, using data from the pokeapi.co website to build charts comparing one or more pokemons in terms of weight, body mass index, height and other stat traits.

## Project Files and Folders
- index.html
- css [folder]
- images [folder]
- scripts [folder]
- WEB-INF [folder]

## CSS Frameworks used
In this project, one CSS framework was implemented:
- Bootstrap

## How to run
The webpage can be accessed by opening the `index.html` file. Enter one or more numbers, separated by a comma each and click to fetch data!

## License
[MIT License](https://github.com/tfonji/Movie-Trailer-Website/blob/master/LICENSE)

repository: tfonji/poke-stats

repo_name: tfonji/poke-stats


text:
# ScatterElementsUpdate {#openvino_docs_ops_movement_ScatterElementsUpdate_3}

@sphinxdirective

.. meta::
  :description: Learn about ScatterElementsUpdate-3 - a data movement operation, which can be
                performed on four required input tensors.

**Versioned name**: *ScatterElementsUpdate-3*

**Category**: *Data movement*

**Short description**: Creates a copy of the first input tensor with updated elements specified with second and third input tensors.

**Detailed description**: For each entry in ``updates``, the target index in ``data`` is obtained by combining the corresponding entry in
``indices`` with the index of the entry itself: the index-value for dimension equal to ``axis`` is obtained from the value of the corresponding entry in
``indices`` and the index-value for dimension not equal to ``axis`` is obtained from the index of the entry itself.

For instance, in a 3D tensor case, the update corresponding to the ``[i][j][k]`` entry is performed as below:

.. code-block:: cpp

    output[indices[i][j][k]][j][k] = updates[i][j][k] if axis = 0,
    output[i][indices[i][j][k]][k] = updates[i][j][k] if axis = 1,
    output[i][j][indices[i][j][k]] = updates[i][j][k] if axis = 2

``update`` tensor dimensions are less or equal to the corresponding ``data`` tensor dimensions.

**Attributes**: *ScatterElementsUpdate* does not have attributes.

**Inputs**:

*   **1**: ``data`` tensor of arbitrary rank ``r`` and of type *T*. **Required.**

*   **2**: ``indices`` tensor with indices of type *T_IND*. The rank of the tensor is equal to the rank of ``data`` tensor. All index values are expected to be within bounds ``[0, s - 1]`` along axis of size ``s``. If multiple indices point to the
same output location then the order of updating the values is undefined. If an index points to non-existing output
tensor element or is negative then exception is raised. **Required.**

*   **3**: ``updates`` tensor of shape equal to the shape of ``indices`` tensor and of type *T*. **Required.**

*   **4**: ``axis`` tensor with scalar or 1D tensor with one element of type *T_AXIS* specifying axis for scatter.
The value can be in range ``[-r, r - 1]`` where ``r`` is the rank of ``data``. **Required.**

**Outputs**:

*   **1**: tensor with shape equal to ``data`` tensor of the type *T*.

**Types**

* *T*: any numeric type.

* *T_IND*: any integer numeric type.

* *T_AXIS*: any integer numeric type.

**Example**

.. code-block:: xml
   :force:

    <layer ... type="ScatterElementsUpdate">
        <input>
            <port id="0">
                <dim>1000</dim>
                <dim>256</dim>
                <dim>7</dim>
                <dim>7</dim>
            </port>
            <port id="1">
                <dim>125</dim>
                <dim>20</dim>
                <dim>7</dim>
                <dim>6</dim>
            </port>
            <port id="2">
                <dim>125</dim>
                <dim>20</dim>
                <dim>7</dim>
                <dim>6</dim>
            </port>
            <port id="3">     < !-- value [0] -->
                <dim>1</dim>
            </port>
        </input>
        <output>
            <port id="4" precision="FP32">
                <dim>1000</dim>
                <dim>256</dim>
                <dim>7</dim>
                <dim>7</dim>
            </port>
        </output>
    </layer>

@endsphinxdirective

repository: openvinotoolkit/openvino

repo_name: openvinotoolkit/openvino


text:
# Vue Hot Loader

[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/jshmrtn/vue-hot-loader/master/LICENSE)
[![Build Status](https://travis-ci.org/jshmrtn/vue-hot-loader.svg?branch=master)](https://travis-ci.org/jshmrtn/vue-hot-loader)
[![NPM Version](https://img.shields.io/npm/v/vue-hot-loader.svg)](https://www.npmjs.com/package/vue-hot-loader)

The Vue Hot Loader adds `webpack` HMR compatibility to your standard JS vue components.

## Why

The standard [`vue-loader`](https://github.com/vuejs/vue-loader) is hard to use with standard webpack loaders like the html loader. (If you want to use html interpolation for example.)

This loader only adds HMR capabilities to your normal JS code without the need to override all the loaders you know from other webpack / JS projects.

## Usage

Install `vue-hot-loader` via `npm` or `yarn`.

```bash
yarn add vue-hot-loader #OR
npm install vue-hot-loader --dev
```

Add a loader in your webpack configuration.

```js
module.exports = {
    // ...
    loaders: [
        {
            test: /\.vue\.js/,
            loader: 'vue-js',
        },
        // ...
    ],
    // ...
};
```

Call your vue component files `[name].vue.js`.

Example `component.vue.js`:

```js
import template from './component.html';

import './component.less';

export default {
    name: 'component',
    template,
};
```

_PS: This example uses [`less-loader`](https://github.com/webpack/less-loader) and [`vue-html-loader`](https://github.com/vuejs/vue-html-loader)._

repository: jshmrtn/vue-hot-loader

gha_language: JavaScript

repo_name: jshmrtn/vue-hot-loader


text:
---
layout: post
title: Motion Activated Raspberry Pi Camera 2
---

Another iteration of the classic motion activated pi camera project. This one will save videos to a platform called [Gofile - Free file sharing and storage platform](https://gofile.io/welcome).

**Features**

- Senses motion
- Records video that is converted to a MP4 format
- Sends MP4 files to Gofile - Free file sharing and storage platform
- Code is logged to app.log file

[**Visit the Project Page 🔧**](https://github.com/okyang/tinyOkayProjects/blob/master/pir_activated_cam_2/README.md)

gha_language: HTML

gha_license_id: MIT


text:
README
================

Overview
--------

This is a Shiny app to explore the diamonds dataset in [ggplot2](http://ggplot2.org/), and to predict the price of a diamond.

It's an updated version of a class project for [Developing Data Products](https://www.coursera.org/learn/data-products) as part of the [Data Science Specialization](https://www.coursera.org/specializations/jhu-data-science) on Coursera, August 2016.

See [Shiny home](https://shiny.rstudio.com/) for details on how to run the app.

![](README_files/figure-markdown_github/unnamed-chunk-1-1.png)


text:
# Simple todo in Vim

Maybe this is the smallest Vim plugin in the world. It adds some useful
mappings for manage simple todo lists (example below) and nothing more.

```
[x] Create plugin
[x] Add helpful documentation
[x] Publish to GitHub
[ ] Spread the word
```

## Features

- Support [GitHub-like task lists](https://github.com/blog/1375-task-lists-in-gfm-issues-pulls-comments):

  - [x] Works well with different markdown list markers, e.g. `-`, `+`, `*`.
  + [ ] So it’s easy to create tasks in issues or pull requests on GitHub

- Visually selected tasks can be processed at once.

- Each mapping is repeatable via . (require [tpope/repeat](https://github.com/tpope/vim-repeat)).

- Tick symbol is configurable, e.g.

  ```
  [y] Water
  [y] Bread
  [ ] Milk
  ```

## Installation

Use your favorite installation method:

- Tim Pope’s [pathogen](https://github.com/tpope/vim-pathogen):

  ```sh
  cd ~/.vim/bundle
  git clone https://github.com/vitalk/vim-simple-todo
  ```

- Junegunn Choi’s [Plug](https://github.com/junegunn/vim-plug) (recommend):

  ```vim
  Plug 'vitalk/vim-simple-todo'
  ```

  ```sh
  vim +PlugInstall +qall
  ```

## Usage

All this mappings use the `<leader>` key and they work the same on `NORMAL`,
`VISUAL` and `INSERT` modes. I prefer to use [the comma](https://github.com/vitalk/sanevi/blob/master/vimrc#L37)
as the `<leader>` key but fell free to set your own.

| Key           | Help                                   |
|:--------------|:---------------------------------------|
| ,i | Create a new todo under cursor         |
| ,I | Create a new todo for current line     |
| ,o | Create a new todo below current line   |
| ,O | Create a new todo above current line   |
| ,x | Mark todo under cursor as done         |
| ,X | Mark todo as undone                    |
| ,s | Switch todo status for current line    |

Or even remap them to somethings more comfortable for you:

```vim
# Disable default key bindings
let g:simple_todo_map_keys = 0

# Map your keys
nmap <c-i> <Plug>(simple-todo-new)
imap <c-i> <Plug>(simple-todo-new)
# ...etc.
```

See `:help simple-todo-maps` for list of available <Plug> mappings.

You can also change the tick symbol to something else. Default is `x`.

```vim
let g:simple_todo_tick_symbol = 'y'
```

## Issues

Don’t hesitate to open [GitHub Issues](https://github.com/vitalk/vim-simple-todo/issues) for any bug or suggestions.

## Copyright

Copyright © 2012 Vital Kudzelka. Use it for Good not Evil.

Distributed under the [MIT license](http://mit-license.org/vitalk).


text:
# A GAN approach to synthetic PET imaging generation for breast cancer diagnosis

[![made-with-python](https://img.shields.io/badge/Coded%20with-Python-21496b.svg?style=for-the-badge&logo=Python)](https://www.python.org/)
[![made-with-latex](https://img.shields.io/badge/Documented%20with-LaTeX-4c9843.svg?style=for-the-badge&logo=Latex)](https://www.latex-project.org/)

Master's thesis; Universitat Oberta de Catalunya

**Author:** Javier Cantero Lorenzo

**Supervisor 1:** Héctor Espinós Morató

**Supervisor 2:** David Cascales Picó

# Experiments

DCGAN and WGAN with gradient penalty networks were tested for the synthesis of sinogram images with the aim of increasing the volume of training data for AI-based PET reconstructors in the context of breast cancer diagnosis.

ACRIN-6688 and ONCOVISION-MAMMI databases were the main case studies of this work.

The main evaluation metrics were manual inspection (Visual Turing Test) and the Fréchet Inception Distance score.

# Results

## Visual Turing Test

All evaluators confused a high percentage of generated images with real images.

![](figs/vtt.png)

## Quality vs Training

The quality of the generated images improved as the training progressed.

![](figs/qvt.png)

## Fréchet Inception Score

In all database-network pairs the FID score value decreased with training, which quantitatively supports that the models generate image sets with higher fidelity and greater diversity.

## Synthetic sinograms reconstructions

For each experiment, one of the generated sinograms was reconstructed by analytical methods (FBP), recovering the PET image with correct semantic representation of the anatomical region studied.

**DCGAN on ACRIN-6688**

![](figs/rec1.png)

**DCGAN on ONCOVISION-MAMMI**

![](figs/rec2.png)

**WGAN-GP on ONCOVISION-MAMMI**

![](figs/rec3.png)

## Conclusions

The studied networks are useful within the clinical context of PET medical imaging. The difference in the quality of the results between the two networks is not significantly different, which makes DCGAN preferable to WGAN-GP as it requires much less training time.

repository: jcantlord/PET-SinoGAN

branch_name: refs/heads/main

repo_name: jcantlord/PET-SinoGAN


text:
# PhoenixFormAwesomplete

PhoenixFormAwesomplete is a [Phoenix form helper](https://hexdocs.pm/phoenix_html/Phoenix.HTML.Form.html) that utilizes Lea Verou's autocomplete / autosuggest / typeahead / inputsearch [Awesomplete widget](https://leaverou.github.io/awesomplete/index.html).

It comes with an AwesompleteUtil [javascript library](https://nico-amsterdam.github.io/awesomplete-util/index.html) which adds the following features:

- Dynamic remote data loading; based on what is typed-in it performs an ajax lookup.
- Allow HTML markup in the shown items. Show value with description. Optionally search in the description text.
- Show when there is an exact match.
- Show when there isn't a match.
- When there is an exact match show related data (supplied in the remote data) in other parts of the page.
- Select the highlighted item when tab key is used.

## Examples

[live examples](https://nico-amsterdam.github.io/awesomplete-util/phoenix.html) with code.

## Installation

In your Phoenix project:

### Add dependency

  1. Add `phoenix_form_awesomplete`to the list of dependencies in`mix.exs:

    ```elixir
    def deps do
      [{:phoenix_form_awesomplete, "~> 0.1"}]
    end
    ```

### Download & compile

```sh
mix deps.get
mix compile
```

### Add in web

Open web/web.ex (phoenix <= 1.2) or lib/\<your context\>\_web.ex (phoenix >= 1.3), in the 'view' function below the other import statements add:
```elixir
# Awesomplete autocomplete widget
import PhoenixFormAwesomplete
```

In web/templates/layout/app.html.eex (phoenix <= 1.2),

or lib/\<your context\>\_web/templates/layout/app.html.eex (phoenix >= 1.3) add inside the head element:

```html
<link rel="stylesheet" href="//nico-amsterdam.github.io/awesomplete-util/css/awesomplete.css">
<script src="//nico-amsterdam.github.io/awesomplete-util/js/awesomplete.min.js"></script>
<script src="//nico-amsterdam.github.io/awesomplete-util/js/awesomplete-util.min.js"></script>
<style>
  div.awesomplete {display: block}

  div.awesomplete ul li p {display: block; font-size: small; margin-left: 1em}

  div.awesomplete .awe-found {border: 2px solid green}

  .hide-not-found div.awesomplete .awe-not-found {border-color: lightblue}

  div.awesomplete .awe-not-found {border: 2px solid red}
</style>
```

The awesomplete.css and awesomplete.min.js files are copied from [Awesomplete](https://github.com/LeaVerou/awesomplete) and tested in combination with AwesompleteUtil. I recommend to make your own copies of these files. If you put them on github.io they will be served by [Fastly CDN](https://www.fastly.com). Do not forget to also copy the javascript sourcemaps ([awesomplete.min.js.map](https://nico-amsterdam.github.io/awesomplete-util/js/awesomplete.min.js.map) and [awesomplete-util.min.js.map](https://nico-amsterdam.github.io/awesomplete-util/js/awesomplete-util.min.js.map)).

Customize the above styling for your own needs. The CSS class 'awe-found' is put on the input control when the input exactly matches the value of an list item. The CSS class 'awe-not-found' is put on the input control when the list closes because there are no more matching items.

### Use in your EEx template

Example:

```html
<div class="form-group row">
  <%= label(:user, :country, "Country", class: "control-label col-sm-2") %>
  <div class="col-sm-10">
      <%= awesomplete(:user, :country,
                      [class: "form-control"],
                      [ url: "https://restcountries.eu/rest/v1/all",
                        loadall: true,
                        prepop: true,
                        minChars: 1,
                        maxItems: 8,
                        value: "name"
                      ]) %>
  </div>
</div>
```

## License

[MIT](LICENSE)


text:
#Tokenpass API

**[Tokenpass](https://tokenpass.tokenly.com)** is a global accounts (OAuth) service powering the Tokenly ecosystem.
It acts as a central hub for "Token Controlled Access" (TCA) requests, allowing
end users to register and prove ownership of their bitcoin addresses a single time instead of
individually for every TCA powered application, as well as providing a layer of privacy (among other features).

Use this API to integrate Tokenpass into your own website, game or other application and empower your project
with Token Controlled Access.

##API Access

To obtain an API key pair for your application, simply head to [https://tokenpass.tokenly.com](https://tokenpass.tokenly.com), create an account and go to the "API Keys" section.
You will then be asked to enter in a name for your client application, your app homepage URL, as well as a callback URL for OAuth requests (e.g https://example.com/account/authorize/callback)

Once your API keys are generated you are ready to integrate!

If you are using **PHP**, we recommend you use our TokenpassClient library, which can be
downloaded on [github here](https://github.com/tokenly/tokenpass-client), or if using Composer it can be included via ```composer require tokenly/tokenpass-client```.

repository: tokenly/api-docs

repo_name: tokenly/api-docs


text:
# Haskell WebAuthn Library

[![Hackage](https://img.shields.io/hackage/v/webauthn.svg)](https://hackage.haskell.org/package/webauthn)

This library implements the server-side
[Web Authentication Relying Party specification Level 2][spec]. The goal of Web
Authentication (WebAuthn) is to bring passwordless login/second factor
authentication to the web, logging in using a FIDO U2F Security Key, finger
print scanner and some other authenticator.

This project was originally developed in 2020 as a [Zurihac project](https://wire.engineering/haskell/events/2020/06/18/wire-goes-zurihac.html) by
[@arianvp](https://github.com/arianvp/) and [@duijf](https://github.com/duijf).
Starting September 2021 a team at [Tweag](https://www.tweag.io/) was sponsored
by [Mercury](https://mercury.com/) to create a production-ready open-source
implementation of this standard, which was done by
[@infinisil](https://github.com/infinisil/) and
[@ErinvanderVeen](https://github.com/ErinvanderVeen/).

## Setting up the environment
We assume Nix is used for the development of this library. If not using Nix,
take a look at `default.nix` for the dependencies and GHC version. All
instructions below assume the use of Nix.

### Nix Caches
Tweag provides a Cachix cache for the library itself and all
non-Haskell dependencies, setting up the `tweag-webauthn` cache can be
done using the [instructions][cachix] provided by Cachix.

### Nix Shell
The Nix shell provides all libraries and tools required to build the library,
tests, and example server. Simply call `nix-shell` to enter a shell. If the
binary caches have been configured properly, this should take little time. If
they have not been properly configured, entering the Nix shell will take
multiple hours.

All further instructions in this README assume that you are in a Nix shell.

## Getting Started
To get started with the library it is best to read the documentation of the
`Crypto.WebAuthn` module. An example of how to use this library to implement a
relying party can be found in the `server` directory, particularly the
`server/src/Main.hs` module. Additionally, we highly recommend reading the
[relying party section](https://www.w3.org/TR/webauthn-2/#sctn-security-considerations-rp)
of the
[WebAuthn security considerations chapter](https://www.w3.org/TR/webauthn-2/#sctn-security-considerations)
before implementing a relying party.

## Developing the Library
The [Haskell Language Server (hls)][hls] and [Ormolu][ormolu] are highly
recommended for the development of this library. The hls
[documentation][hls-editor] describes how to configure your editor to use it.
We also recommend enabling auto-format using Ormolu for your editor. We do,
however, also provide a bash script in `bin/autoformat.sh` that uses Ormolu to
format all Haskell source files in the repository.

Code not formatted using Ormolu will be rejected in CI.

## Running the tests
Tests are provided in the `tests` directory. Running these tests is done via
cabal:
```bash
cabal run test-suite:tests
```

## Running the demo
The library comes with an example implementation for a server that makes use of
it, which can be found in the `server` directory. All dependencies required to
build the example server are included in the Nix shell.
```bash
cd server
./run.sh
```

Changes to the server's source files automatically trigger a rebuild of the
server.

## Testing with an Authenticator
The easiest way to test the server, or your own application, is to use the
Chrome WebAuthn development tool. Simply open the Chrome DevTools, click on the
three dots in the top right, select "More tools -> WebAuthn", and then enable
the virtual environment.

Testing with a physical authenticator is easiest using an Android or iOS phone
supporting it, or a dedicated token like a [YubiKey][yubikey] or the
open-source [SoloKey][solokey]. Testing with a phone requires setting up a
certificate for the domain of the relying party as WebAuthn only works via
https, with an exception being made for `localhost`.

## Acknowledgements
The test files in `tests/responses/` were not created by Tweag, but
were instead copied from existing WebAuthn libraries. Notably the
[.NET][dotnet] and [python][python] libraries by the .NET foundation and Duo
Labs respectively.

## LICENSES
```text
Copyright
  2020 - 2021 Arian van Putten
  2021 -      Tweag I/O

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

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

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

[cache]: https://input-output-hk.github.io/haskell.nix/tutorials/getting-started.html#setting-up-the-binary-cache
[cachix]: https://app.cachix.org/cache/tweag-webauthn
[dotnet]: https://github.com/passwordless-lib/fido2-net-lib
[hls-editor]: https://haskell-language-server.readthedocs.io/en/latest/configuration.html#configuring-your-editor
[hls]: https://github.com/haskell/haskell-language-server
[ormolu]: https://github.com/tweag/ormolu
[python]: https://github.com/duo-labs/py_webauthn
[solokey]: https://solokeys.com/
[spec]: https://www.w3.org/TR/webauthn-2/
[yubikey]: https://www.yubico.com/

repository: sumo/webauthn

gha_language: Haskell

gha_license_id: NOASSERTION

repo_name: sumo/webauthn


text:
# Required libraries

This is a list of third-party libraries used by the Crystal compiler and the standard library.

## Core runtime dependencies

The libraries in this section are always required by Crystal's stdlib runtime. They must be present for building or running any Crystal program that uses the standard library.
Avoiding these dependencies is only possible when not using the standard library (`--prelude=none` compiler option).

### System library

A major component is the system library. Selection depends on the target platform and multiple are supported.
This usually includes the C standard library as well as additional system libraries such as `libdl`, `libm`, `libpthread`, `libcmt`, or `libiconv`
which may be part of the C library or standalone libraries. On most platforms all these libraries are provided by the operating system.

| Library | Description | License |
|---------|-------------|---------|
| [glibc][glibc] | standard C library for Linux | [LGPL](https://www.gnu.org/licenses/lgpl-3.0.en.html) |
| [musl libc][musl-libc] | standard C library for Linux | [MIT](https://git.musl-libc.org/cgit/musl/tree/COPYRIGHT) |
| [FreeBSD libc][freebsd-libc] | standard C library for FreeBSD | [BSD](https://www.freebsd.org/copyright/freebsd-license/) |
| [NetBSD libc][netbsd-libc] | standard C library for NetBSD | [BSD](http://www.netbsd.org/about/redistribution.html) |
| [OpenBSD libc][openbsd-libc] | standard C library for OpenBSD | [BSD](https://www.openbsd.org/policy.html) |
| [Dragonfly libc][dragonfly-libc] | standard C library for DragonflyBSD | [BSD](https://www.dragonflybsd.org/docs/developer/DragonFly_BSD_License/) |
| [macOS libsystem][macos-libsystem] | standard C library for macOS | [Apple](https://github.com/apple-oss-distributions/Libsystem/blob/main/APPLE_LICENSE) |
| [MSVCRT][msvcrt] | standard C library for MSVC compiler (Windows) | |
| [WASI][wasi] | WebAssembly System Interface | [Apache v2 and others](https://github.com/WebAssembly/wasi-libc/blob/main/LICENSE) |
| [bionic libc][bionic-libc] | C library for Android | [BSD-like](https://android.googlesource.com/platform/bionic/+/refs/heads/master/libc/NOTICE) |

### Other runtime libraries

| Library | Description | License |
|---------|-------------|---------|
| [Boehm GC][libgc] | The Boehm-Demers-Weiser conservative garbage collector. Performs automatic memory management. | [MIT-style](https://github.com/ivmai/bdwgc/blob/master/LICENSE)
| [Libevent][libevent] | An event notification library. Implements concurrency features such as [`Fiber`](https://crystal-lang.org/api/Fiber.html) and the event loop on POSIX platforms. Not used on Windows. | [Modified BSD](https://github.com/libevent/libevent/blob/master/LICENSE)
| [compiler-rt builtins][compiler-rt] | Provides optimized implementations for low-level routines required by code generation, such as integer multiplication. Several of these routines are ported to Crystal directly. | [MIT / UIUC][compiler-rt]

## Optional standard library dependencies

These libraries are required by different parts of the standard library, only when explicitly used.

### Regular Exception engine

Engine implementation for the [`Regex`](https://crystal-lang.org/api/Regex.html) class.
PCRE2 support was added in Crystal 1.7 and it's the default since 1.8 (see [Regex documentation](../syntax_and_semantics/literals/regex.md)).

| Library | Description | License |
|---------|-------------|---------|
| [PCRE2][libpcre] | Perl Compatible Regular Expressions, version 2. | [BSD](http://www.pcre.org/licence.txt)
| [PCRE][libpcre] | Perl Compatible Regular Expressions. | [BSD](http://www.pcre.org/licence.txt)

### Big Numbers

Implementations for `Big` types such as [`BigInt`](https://crystal-lang.org/api/BigInt.html).

| Library | Description | License |
|---------|-------------|---------|
| [GMP][libgmp] | GNU multiple precision arithmetic library. | [LGPL v3+ / GPL v2+](https://gmplib.org/manual/Copying)
| [MPIR][libmpir] | Multiple Precision Integers and Rationals, forked from GMP. Used on Windows. | [GPL-3.0](https://github.com/wbhart/mpir/blob/master/COPYING) and [LGPL-3.0](https://github.com/wbhart/mpir/blob/master/COPYING.LIB) |

### Internationalization conversion

This is either a standalone library or may be provided as part of the system library on some platforms. May be disabled with the `-Dwithout_iconv` compile-time flag.
Using a standalone library over the system library implementation can be enforced with the `-Duse_libiconv` compile-time flag.

| Library | Description | License |
|---------|-------------|---------|
| [libiconv][libiconv-gnu] (GNU) | Internationalization conversion library. | [LGPL-3.0](https://www.gnu.org/licenses/lgpl.html)

### TLS

TLS protocol implementation and general-purpose cryptographic routines for the [`OpenSSL`](https://crystal-lang.org/api/OpenSSL.html) API. May be disabled with the `-Dwithout_openssl` [compile-time flag](../syntax_and_semantics/compile_time_flags.md#compiler-features).

Both `OpenSSL` and `LibreSSL` are supported and the bindigns automaticall detect which library and API version is available on the host system.

| Library | Description | License |
|---------|-------------|---------|
| [OpenSSL][openssl] | Implementation of the SSL and TLS protocols | [Apache v2 (3.0+), OpenSSL / SSLeay (1.x)](https://www.openssl.org/source/license.html)
| [LibreSSL][libressl] | Implementation of the SSL and TLS protocols; forked from OpenSSL in 2014  | [ISC / OpenSSL / SSLeay](https://github.com/libressl-portable/openbsd/blob/master/src/lib/libssl/LICENSE)

### Other stdlib libraries

| Library | Description | License |
|---------|-------------|---------|
| [LibXML2][libxml2] | XML parser developed for the Gnome project. Implements the [`XML`](https://crystal-lang.org/api/XML.html) module. | [MIT](https://gitlab.gnome.org/GNOME/libxml2/-/blob/master/Copyright)
| [LibYAML][libyaml] | YAML parser and emitter library. Implements the [`YAML`](https://crystal-lang.org/api/YAML.html) module. | [MIT](https://github.com/yaml/libyaml/blob/master/License)
| [zlib][zlib] | Lossless data compression library. Implements the [`Compress`](https://crystal-lang.org/api/Compress.html) module. May be disabled with the `-Dwithout_zlib` compile-time flag. | [zlib](http://zlib.net/zlib_license.html)
| [LLVM][libllvm] | Target-independent code generator and optimizer. Implements the [`LLVM`](https://crystal-lang.org/api/LLVM.html) API. | [Apache v2 with LLVM exceptions](https://llvm.org/docs/DeveloperPolicy.html#new-llvm-project-license-framework)

## Compiler dependencies

In addition to the [core runtime dependencies](#core-runtime-dependencies), these libraries are needed to build the Crystal compiler.

| Library | Description | License |
|---------|-------------|---------|
| [PCRE2][libpcre] | See above. | |
| [LLVM][libllvm] | See above. | [Apache v2 with LLVM exceptions](https://llvm.org/docs/DeveloperPolicy.html#new-llvm-project-license-framework)
| [libffi][libffi] | Foreign function interface. Used for implementing binary interfaces in the interpreter. May be disabled with the `-Dwithout_interpreter` compile-time flag. | [MIT](https://github.com/libffi/libffi/blob/master/LICENSE)

[bionic-libc]: https://android.googlesource.com/platform/bionic/+/refs/heads/master/libc/
[compiler-rt]: https://compiler-rt.llvm.org/
[dragonfly-libc]: http://gitweb.dragonflybsd.org/dragonfly.git/tree/refs/heads/master:/lib/libc
[freebsd-libc]: https://svn.freebsd.org/base/head/lib/libc/
[glibc]: https://www.gnu.org/software/libc/
[libevent]: https://libevent.org/
[libffi]: https://sourceware.org/libffi/
[libgc]: https://github.com/ivmai/bdwgc
[libgmp]: https://gmplib.org/
[libiconv-gnu]: https://www.gnu.org/software/libiconv/
[libllvm]: https://llvm.org/
[libmpir]: https://github.com/wbhart/mpir
[libpcre]: http://www.pcre.org/
[libressl]: https://www.libressl.org/
[libxml2]: http://xmlsoft.org/
[libyaml]: https://pyyaml.org/wiki/LibYAML
[macos-libsystem]: https://github.com/apple-oss-distributions/Libsystem
[msvcrt]: https://learn.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features?view=msvc-170
[musl-libc]: https://musl.libc.org/
[netbsd-libc]: http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/?only_with_tag=MAIN
[openbsd-libc]: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/
[openssl]: https://www.openssl.org/
[wasi]: https://wasi.dev/
[zlib]: http://zlib.net/

repository: crystal-lang/crystal-book

gha_language: Makefile

repo_name: crystal-lang/crystal-book


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]

### Added
- adds `exec` cli command
- adds `silent` option for `migrator.execute`

## [v0.3.0] - 2016-08-26

### Added
- #3 adds cli component

### Fixed
- #3 prevents cli prompts for up/down migrations if there are no pending/downward migrations

## [v0.3.0-0] - 2016-08-26

### Added
- adds cli component

## [v0.2.1] - 2016-08-24

### Added
- #2 updates `README.md`

## [v0.2.0] - 2016-08-24

### Changed
- #1 refactors `#getMigrations` into hook

[Unreleased]: https://github.com/cludden/termigrator/compare/v0.3.0...HEAD
[v0.3.0]: https://github.com/GaiamTV/gaia-core-api/compare/v0.2.1...v0.3.0
[v0.3.0-0]: https://github.com/GaiamTV/gaia-core-api/compare/v0.2.1...v0.3.0-0
[v0.2.1]: https://github.com/GaiamTV/gaia-core-api/compare/v0.2.0...v0.2.1
[v0.2.0]: https://github.com/GaiamTV/gaia-core-api/compare/v0.1.0...v0.2.0

repository: focusaurus/termigrator

repo_name: focusaurus/termigrator


text:
# Badge

Documentation and examples for badges, our small count and labeling component.

<hr>

#### Example

Badges can be used as part of links or buttons to provide a counter.

:::demo
```html
<base-button type="primary">
  <span>Notifications</span>
  <badge type="white">4</badge>
</base-button>
```
:::

#### Contextual variations

Add any of the below mentioned modifier classes to change the appearance of a badge.

:::demo
```html
<div>
    <badge type="default">Default</badge>

    <badge type="primary">Primary</badge>

    <badge type="secondary">Secondary</badge>

    <badge type="info">Info</badge>

    <badge type="success">Success</badge>

    <badge type="danger">Danger</badge>

    <badge type="warning">Warning</badge>
</div>
```
:::

#### Pill badges

Use the `pill` prop to make badges more rounded (with a larger border-radius and additional horizontal padding).
Useful if you miss the badges from v3.

:::demo
```html
<div>
    <badge pill type="default">Default</badge>

    <badge pill type="primary">Primary</badge>

    <badge pill type="secondary">Secondary</badge>

    <badge pill type="info">Info</badge>

    <badge pill type="success">Success</badge>

    <badge pill type="danger">Danger</badge>

    <badge pill type="warning">Warning</badge>
</div>
```
:::

#### Links

Using the contextual badge component
together with the `tag` prop in order to switch to your desired html element.
Providing `tag="a"` will transform the badge into an `anchor` with hover and focus states.

:::demo
```html
<div>
    <badge tag="a" href="#" type="default">Default</badge>

    <badge tag="a" href="#" type="primary">Primary</badge>

    <badge tag="a" href="#" type="secondary">Secondary</badge>

    <badge tag="a" href="#" type="info">Info</badge>

    <badge tag="a" href="#" type="success">Success</badge>

    <badge tag="a" href="#" type="danger">Danger</badge>

    <badge tag="a" href="#" type="warning">Warning</badge>
</div>
```
:::

#### Props

<props-table component-name="badge"></props-table>

repository: hocwebchuan/vue-argon-dashboard-laravel

repo_name: hocwebchuan/vue-argon-dashboard-laravel


text:
# Evaluating Conditions

You compare one value in the script to what you expect it to be.

== Compares 2 values to see if they are the same (is equal to)

!= compares 2 values to see if they are NOT the same (is not equal to)

=== compares 2 vaues to check that both data and data type are the same (strict equal to)

!== compares 2 vaues to check that both data and data type are NOT the same (strict not equal to)

- greater than >
- less than <
- greater than or equal to >=
- less than or equal to <=

All 4 above are self-explanatory.

# LOGICAL OPERATORS

Comparing operators return single values of True or False.  **Logical Operators** allow you to compare more than 2 operators.

repository: andraluca/reading-notes

repo_name: andraluca/reading-notes


text:
---
templateKey: blog-post-podcast-csw
slug: /podcasts/cs/s02-15
author: Peter Witham
tags: ["Swift", "Podcast", "CompileSwift"]
title: CompileSwift Podcast - Using the EnvironmentObject to make data available to SwiftUI views
date: 2021-03-22T02:17:00
blurb: Sharing data between SwiftUI views is something we all need to do eventually. Here is my solution.
---

<iframe src="https://anchor.fm/compileswift/embed/episodes/Using-the-EnvironmentObject-to-make-data-available-to-SwiftUI-views-et740o" height="102px" width="400px" frameborder="0" scrolling="no"></iframe>

## Show Notes

More than likely you have more than one view in your SwiftUI based application. If that is the case then you probably need to share data across those views and always have them displaying the latest data right? That's where the environment object comes into play, this makes it possible to do just that. I'll walk through the steps on how I recently implemented it in an application.
I will also be releasing a video soon, so if you are interested and want to know when that comes out head over to [compileswift.com/contact](https://compileswift.com/contact) and let me know.

repository: GrfxGuru/gatsby-starter-netlify-cms

repo_name: GrfxGuru/gatsby-starter-netlify-cms


text:
Everyone in IT knows that stuff, somehow, manages to break whenever you are away from your work/workstation. That never leads to good situations. If one of my services falls offline, I need to know so I can fix it. I needed a quick solution to that problem.

Solutions
---

There are many industry standards for fixing this problem. One of the larger players is nagios. My main problem is I (1) didn't have any server that could run it, (2) didn't need all of its features, and (3) have never worked with the software. I decided to write a simple and smaller solution for my issue: Checkers. It is easy to use, simple to setup, and a fun fix to a large problem of mine.

Setup Checkers
---

* git clone https://github.com/gravypod/Checkers.git
* Edit the config.php with settings you would like.
* Put emails into the EMAILS file you have set in the config. Prefixing with "http://" will get the file from a website.
* Setup a cronjob.
* Sit back and relax.... until you get the email!

Wait...?
---

One feature that many people want in software like this is the ability to receive text messages. Lucky for us, for reasons undisclosed to me, most cell providers support email servers as text message gate ways. "Say what?" some of the readers may have said, but it is OK since it isn't currently, to my knowledge being abused by spammers.

How does it work you say?
---

Simple! Send an email to (phone number)@(provides's email gateway).com

For Version it is as follows<EMAIL_ADDRESS>
If you do not use Verizon, there is a handy [list of addresses to carriers](http://archive.is/3TnNP).

repository: gravypod/blog

repo_name: gravypod/blog


text:
# Gnomoniella melanostyla (DC.) Sacc., 1882 SPECIES

#### Status
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Syll. fung. (Abellini) 1: 419 (1882)

#### Original name
Sphaeria melanostyla DC., 1815

### Remarks
null

repository: mdoering/backbone

path: /life/Fungi/Ascomycota/Sordariomycetes/Diaporthales/Ophiognomonia/Ophiognomonia melanostyla/ Syn. Gnomoniella melanostyla/README.md

repo_name: mdoering/backbone


text:
# Silhouette
Silhouette that ported to Windows  via CEF.

# Get Started
### Prerequisite
* Need "Microsoft Visual C++ 2015 Redistributable"
* Check for system bit of your Windows before downloading

1. Download Zipped file that matches your system bit.
2. Unzip it.
3. Use start file or Go open Release/CefSharp.MinimalExample.WinForms.exe
4. Get more information at http://square.dothome.co.kr/#/silhouette/

# Version History
### v1.0
* Added to GitHub.
* Notice that it is not the most recent version.

# Credit
* https://github.com/JinHo-Dev/silhouette
* https://bitbucket.org/chromiumembedded/cef

# License
Follow License of CEF : New BSD License

©JinHo-Dev

# Contact
### e-mail
<EMAIL_ADDRESS>
### GitHub
https://github.com/JinHo-Dev/

repository: JinHo-Dev/Silhouette-CEF-

repo_name: JinHo-Dev/Silhouette-CEF-


text:
---
layout: post
title:  "FamilyTree API"
date:   2020-05-01 23:26:47 +0100
categories: test
tags: test
---

# FamilyTree API

Amphora Core Services Engineer tests

## Installation

Package jar (it also will run all tests) then execute it:

```bash
mvn clean package
cd target
java -jar amphora-1.0-SNAPSHOT.jar
```

## Usage

[http://localhost:8080/swagger-ui.html](http://localhost:8080) here you can find methods GET and POST to work with app.

You can use both formats: json/xml

##### POST
Example of request:
```
curl -X POST "http://localhost:8080/amphora/addFamilyMember" -H "accept: application/json" -H "Content-Type: application/xml" -d "<?xml version=\"1.0\" encoding=\"UTF-8\"?><FamilyNodeRequest name=\"Anna\">\t<age>1901</age>\t<father></father>\t<mother></mother></FamilyNodeRequest>"
data:
<?xml version="1.0" encoding="UTF-8"?>
<FamilyNodeRequest name="Anna">
	<age>1901</age>
	<father></father>
	<mother></mother>
</FamilyNodeRequest>
```
Response:
```
<FamilyNode>
  <name>Anna</name>
  <age>1901</age>
  <parents>
    <parents/>
    <parents/>
  </parents>
  <kids/>
  <generation>0</generation>
</FamilyNode>
```
Request:
```
curl -X POST "http://localhost:8080/amphora/addFamilyMember" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"age\": 1890, \"father\": \"\", \"mother\": \"\", \"name\": \"Bob\"}"
data:
{
  "age": 1890,
  "father": "",
  "mother": "",
  "name": "Bob"
}
```
Response:
```
{
  "name": "Bob",
  "age": 1890,
  "parents": [
    null,
    null
  ],
  "kids": [],
  "generation": 0
}
```

##### GET
* Note: I use here one more param - generation - just to simplify visibility of result
(can not be used) (see notes section)

Descending order:
```
curl -X GET "http://localhost:8080/amphora/getFamilyTree?ascending=false" -H "accept: application/xml"
```
Output:
```
<SortedFamilyResponse>
  <familyNodes>
    <familyNodes>
      <name>Anna</name>
      <age>1901</age>
      <parents>
        <parents/>
        <parents/>
      </parents>
      <kids/>
      <generation>0</generation>
    </familyNodes>
    <familyNodes>
      <name>Bob</name>
      <age>1890</age>
      <parents>
        <parents/>
        <parents/>
      </parents>
      <kids/>
      <generation>0</generation>
    </familyNodes>
  </familyNodes>
</SortedFamilyResponse>
```
Ascending order:
```
curl -X GET "http://localhost:8080/amphora/getFamilyTree?ascending=true" -H "accept: application/json"
```
Output:
```
{
  "familyNodes": [
    {
      "name": "Bob",
      "age": 1890,
      "parents": [
        null,
        null
      ],
      "kids": [],
      "generation": 0
    },
    {
      "name": "Anna",
      "age": 1901,
      "parents": [
        null,
        null
      ],
      "kids": [],
      "generation": 0
    }
  ]
}
```

## Tasks

* Q1 - FamilyTree
```
 public FamilyNode save(String name, int age,
                           String father, String mother)
```
Test class - FamilyTreeTest

Chosen data structure - implemented as a tree,
complexity of adding node: O(n),
space for adding node: O(n)

* Q2, Q3 - SortFamilyTreeUtils

```
public static List<FamilyNode> sort(FamilyTree familyTree,
                                        Comparator<Integer> comparator)
```
Test class - SortFamilyTreeTest

* Q4, Q5 - PrintUtils
```
public static void printTree(FamilyTree familyTree)

public static void printUpwardsTreeFrom(FamilyNode kid)
```

* Q6 - MissingMemberHandler, there is explanation of approach
```
    public static LinkedFamilyNode addMissingMember(LinkedFamilyNode sortedNodeHead,
                                                    FamilyNode missingNode)
```
MissingMemberHandlerTest - carefully cover different test cases

* Q7 - FamilyTreeServiceImplTest - implemented integration test after implemented SptingBoot API

## Additional scope:

* Implemented Spring Boot RESTful API

* Added swagger UI documentation

## Notes
* I use here one more param - generation - just to simplify visibility of result
(can not be used)

* Constructions to the family node:

1. Names are unique (to simplify).
If we don't want our names to be unique,
we can just add id, that will be for example hash of {name + age}, and then everytime then we create a node - we provide id as the result

2. To simplify interface (as there is no constructions in conditions) - we can add only kids

3. If there is no parent - it's the most ancient parent

* JPA

I didn’t implement any entities using JPA (as it didn't asked),
but it also possible to create repository like this:

```
import com.kamalova.amphora.dao.model.FamilyNodeDao;
import org.springframework.data.repository.CrudRepository;

public interface FamilyTreeRepository
        extends CrudRepository<FamilyNodeDao, Long> {
}
```

* Testing

There could be more detailed tests

I didn't implement too many test like tests to check all edge cases (for example, to provide more details about HTTP API, it's better to add more validation on request data and more code errors with explanation


text:
# Ciao - Kernel for Kubelow in Jupyter Notebook

Ciao is still in early development -- it is not feature-complete or production-ready. Please try our experimental kernel and give us your feedback.

- Report bugs to [Ciao Issues](https://github.com/caicloud/ciao/issues)
- Chat at the [Kubeflow Slack Channel](https://kubeflow.slack.com/messages/C7REE0EHK/) (Please @gaocegege to let us know)

## Overview

Ciao is a jupyter kernel for Kubeflow. The name of the project `Ciao` comes from Italian:

> The word "ciao" (/ˈtʃaʊ/; Italian pronunciation: [ˈtʃaːo]) is an informal salutation in the Italian language that is used for both "hello" and "goodbye".

Ciao's goal is to simplify the machine learning workflow using Kubeflow. Currently, users could create a **distributed** model training job from Jupyter Notebook and get the logs of all replicas (parameter servers and workers) in the output.

## Demo

Please see the [Demo Show](./docs/demo.md).

### Usage

There are some magic commands supported by Ciao:

```
%framework=tensorflow
%ps={number}
%worker={number}
```

or

```
%framework=pytorch
%master={number}
%worker={number}
```

### Examples

- [Distributed Training using TensorFlow](./docs/examples/example.ipynb)
- [Distributed Training using PyTorch](./docs/examples/example.ipynb)

## Installation

Please see the [Installation Guide](./docs/installation.md).

## Design Document

Please see the [Design Document](./docs/design.md) to know the architecture of Ciao.

## Acknowledgments

- Thank [kubeflow/kubeflow](https://github.com/kubeflow/kubeflow) for the awesome operators which supports TensorFlow/PyTorch and many other ML frameworks on Kubernetes.
- Thank [gopherdata/gophernotes](https://github.com/gopherdata/gophernotes) for the reference implementation of Jupyter Kernel in Golang.
- Thank [openshift/source-to-image](https://github.com/openshift/source-to-image) for the tool to convert source code to Docker image directly.

gha_language: Go


text:
# Pi Pico libraries
Raspberry Pi Pico 2040 self-made libraries

## Directions to use this library
* Copy the required library inside your project include -> include and src -> src
* If project structure is simple then try to add these lines in your CMakeLists.txt

> add_executable( ${PROJECT_NAME}
>     src/main.c
>     src/mpu6050_sensor.c)
>
> target_include_directories(${PROJECT_NAME} PUBLIC include/)


text:
# exercism-solutions
These are my solutions to the lessons I take on exercism.org

To run tests or watch files for TDD you need to install [bundler](https://bundler.io/) for Ruby and/or
[yarn](https://classic.yarnpkg.com/lang/en/docs/install) for JavaScript then run either or both of these:

```bash
bundle install
yarn install
```
Afterwards you can run `bundle exec guard` for Ruby or `yarn watch` for Javascript TDD.
I pefer to use this bash function for running single tests (must be run from the exercise directory):

```bash
alias etest() {
  if [ -f package.json ]
  then
    yarn test
  else
    ruby *_test.rb -c
  fi
}
```

To be able to submit and download new exercises you need to install `exercism`:

Mac:

```bash
brew update
brew install exercism
```
For other platforms: https://exercism.org/cli-walkthrough

After `exercism` is installed it must be configured to use your API token:

```bash
exercism configure --token=<your-api-token>
```
For additional assistance with the `exercism` CLI see: https://exercism.org/docs/using/solving-exercises/working-locally

<hr>

##### Note from exercism regarding licensing:

Our Content
All materials displayed on our Website and/or Platform are Copyright Exercism.

Where a resource does not appear to have a clear licensing statement, we would recommend that you check our GitHub source-code repositories. You should not assume that all content on our Platform is openly licensed, but it generally will be.

Community Content
All of the exercises delivered through the platform have been built by a community of volunteers and are licensed mainly under the MIT License. All of this content is available directly through our GitHub repositories (see https://github.com/exercism) where specific license details can be viewed.

repository: joe-sharp/exercism-solutions

repo_name: joe-sharp/exercism-solutions


text:
A [Hubot](https://hubot.github.com/) script to open / close ports on security groups automatically in AWS based on a user's presence.

If you regularly open ports in security groups in AWS to your current IP, this is the tool for you.  When Hubot sees you sign in, it will send you a picture.  When it's loaded in your chat client (if you're using Adium, you'll need to install the [Adinline](http://www.adiumxtras.com/index.php?a=xtras&xtra_id=7926) plugin) Hubot is able to get your IP, and then open the security group(s) to you.

# Installation
Assuming you've installed [Hubot](https://hubot.github.com/) and have an instance already running, the steps are simple.  Just add "hubot-aws-sesame" to both your dependencies list in Hubot's package.json file as well as the external-scripts.json file.  Then run:

```bash
npm install
```

# Configuration:

* HUBOT_AWS_REGION
* HUBOT_AWS_KEY_ID
* HUBOT_AWS_SECRET_KEY
* HUBOT_AWS_SEC_RULES
* HUBOT_ROOT_URL

```HUBOT_AWS_SEC_RULES``` should contain the security group(s) that should have access enabled and the port range(s) that should be opened within them.  It should be of the form (spaces are ignored):

<code>
  <sec group id>: <port start>[ - <port end>][, <port start> - <port end>];
</code>

For instance, each of the following would work:

* sg-123: 22
* sg-123: 20 - 222
* sg-123: 22; sg-456: 1-1600
* sg-123: 10 - 20; sg-456: 30

HUBOT_ROOT_URL should be the root URL of an internet visible host.  This is necessary so that a message can be sent to the client containing a link to this bot's Hubot web server.  For instance, the following are valid values:

* http://<IP_ADDRESS>
* https://bothost.example.com
* http://<IP_ADDRESS>:123

# Commands:

    hubot show firewall - Show all users who currently have access to AWS

repository: bmuller/hubot-aws-sesame

repo_name: bmuller/hubot-aws-sesame


text:
---
layout: timeline
meta_title: Roadmap
body_class: governance
title: Roadmap
timeline:
  - description: Project scope and research design
    date: Summer 2019
    state: done
  - description: Workshops and interviews
    date: Winter 2019
    state: done
  - description: Publish research report
    date: Spring 2020
    state: done
  - description: Design pattern research
    date: Summer 2020
    state: done
  - description: Shared decentralization glossary
    date: Fall 2020
    state: progress
  - description: Pattern library launch
    date: Winter 2020
    state: progress
  - description: Explanatory resources about decentralization
    date: Summer 2021
    state: idle
  - description: Comparative map of decentralization projects
    date: Fall 2021
    state: idle
---

### Roadmap

DOTS is a collective initiative to identify needs, synthesize priorities,
provide resources, and coordinate efforts to further the development and
deployment of decentralized technologies. By addressing these issues, we can
increase the overall quantity and quality of decentralized applications. We are
actively [seeking funding](/support-us) to fuel the development of high-quality
resources on a faster timeframe.

You can support us by backing DOTS.

### Timeline

branch_name: refs/heads/develop


text:
jQuery 2
=======

jQuery 2.x has the same API as jQuery 1.x, but does not support Internet Explorer 6, 7, or 8. All the notes in the jQuery 1.9 Upgrade Guide apply here as well. Since IE 6/7/8 are still relatively common, we recommend using the 1.x version unless you are certain no IE 6/7/8 users are visiting the site. Please read the 2.0 release notes carefully.

Download the compressed, production jQuery 2.0.3 - http://code.jquery.com/jquery-2.0.3.min.js

Download the uncompressed, development jQuery 2.0.3 - http://code.jquery.com/jquery-2.0.3.js

jQuery 2.0.3 release notes - http://blog.jquery.com/2013/07/03/jquery-1-10-2-and-2-0-3-released/


text:
# TipTap

I'm still in the process of moving the documentation to this place. For now, you can find the documentation in the respective README:

{% embed url="https://github.com/yjs/y-prosemirror/" caption="" %}

### Live Demo

{% embed url="https://codesandbox.io/s/y-tiptap-1ntgp" %}

{% embed url="https://codesandbox.io/s/y-tiptap-1ntgp" %}

## yjs-demos

The yjs-demos repository contains a TipTap demo with everything setup from vue to webpack.

{% embed url="https://github.com/yjs/yjs-demos/tree/master/tiptap" caption="Source Code that you can use as a starting point for your own project" %}

{% embed url="https://demos.yjs.dev/tiptap/dist/index.html" caption="A live demo. Open this website in several browser windows." %}

repository: chewnoill/docs

repo_name: chewnoill/docs


text:
---
layout: post
title: "Day Against DRM"
date: 2016-05-03
categories:
- virtualization
- Proxmox VE
tags:
- DRM
---

2 May 2016: It's **International Day Against DRM**.

It's a day to spread the word about the harms of DRM, to both consumers and cultures.

It's also a day to celebrate. Packt Publishing and O'Reilly Media, both celebrated for publishing ebooks free from DRM, are offering steep discounts today in celebration of Day Against DRM.

Generally, this means all ebooks at Packt Pub are $10, while all DRM-free media from O'Reilly is 50% - 60% off (depending on your purchase total).

Specifically, this means that my first book for Packt Pub, *Learning Proxmox VE* is available for as low as $10 at [Packt's site](https://www.packtpub.com/virtualization-and-cloud/learning-proxmox-ve). It's also available from O'Reilly at http://shop.oreilly.com/product/9781783981786.do.

*Learning Proxmox VE* covers Proxmox 4. Although 4.2 was released just a few days ago, *Learning Proxmox VE* is still current.

Have a [look](https://www.packtpub.com/virtualization-and-cloud/learning-proxmox-ve).

(Click the figure above to learn more about DRM.)


text:
---
id: airframe-rpc
title: Airframe RPC
---

Airframe RPC is a framework for building RPC services by using Scala as a unified interface between
servers and clients.

![overview](../img/airframe-rpc/rpc-overview.png)

**Airframe RPC Features**:

- Use plain Scala functions as RPC endpoints.
- Support [Finagle](https://twitter.github.io/finagle/) (HTTP/1) or [gRPC](https://grpc.io/) (HTTP/2) backends.
- [sbt-airframe](#sbt-airframe-plugin) plugin to generate RPC clients. No need to make HTTP requests
  by yourself.
- [Scala.js](https://www.scala-js.org/) support for building interactive web browser applications.
- [Open API](https://www.openapis.org/) schema generation.

## Why Airframe RPC?

Airframe RPC enables calling Scala methods at remote servers. You don’t need to worry about how to
encode your data into JSON, nor how to define HTTP REST endpoints. Airframe RPC abstracts away these
details; the framework generates the code for serializing your data objects into JSON
or [MessagePack](https://msgpack.org/) and calls appropriate HTTP endpoints on your behalf.

For defining RPC services, we need to define functions and data structures for representing HTTP
requests and responses. Airframe RPC leverages the nature of Scala as a functional and
object-oriented programming language; You can use plain Scala functions as RPC endpoints
and [case classes](https://docs.scala-lang.org/tour/case-classes.html) for modeling complex data.
Here is an example of Airframe RPC interface:

```scala
// An example RPC definition using Airframe RPC
@RPC
trait Greeter {
  // RPC endpoint definition
  def hello(name: String): GreeterResponse = GreeterResponse(s"Hello ${name}!")
}

// A model class defined with case class.
// This will be encoded into JSON {"message":"...."} or its MessagePack representation
case class GreeterResponse(message: String)

```

While [gRPC](https://grpc.io/) has been a popular approach for building RPC services, its ecosystem
often uses [ProtocolBuffers](https://developers.google.com/protocol-buffers/docs/overview) for
defining data structures and RPC methods. To start using gRPC in Scala, we need to bridge the gap
between ProtocolBuffers and Scala (e.g., [ScalaPB](https://scalapb.github.io/)). gRPC itself,
however, is a data-format agnostic framework. So, in order to naturally use Scala for gRPC, we
extended gRPC to support MessagePack (a compact binary alternative of JSON) and
used [airframe-codec](airframe-codec.md) for message serialization so that we can create RPC
services without introducing ProtocolBuffers.

Airframe RPC also supports building HTTP/1 services backed
by [Finagle](https://twitter.github.io/finagle/). Supporting both HTTP/1 and HTTP/2 is important
because gRPC heavily uses HTTP/2 features, but HTTP/1-based web clients including web browsers still
don't fully support HTTP/2.

In 2020, Scala.js, which can compile Scala code into JavaScript,
finally [became 1.0.0 after 7 years of development](https://www.scala-js.org/news/2020/02/25/announcing-scalajs-1.0.0/)
. This also has paved a way for using Scala both for servers (Scala JVM) and clients (Scala.js with
Ajax call with HTTP/1). We explored the approach for using Scala's functional interfaces as RPC
endpoint definitions, and successfully created Airframe RPC, which works both for Scala JVM and
Scala.js, on top of [technology stack of 20+ Airframe modules](index.md).

Although Airframe RPC is a relatively new project started at March 2020
inside [Arm Treasure Data](https://www.treasuredata.com/), this project has proved various
advantages. For example:

- __Free from REST__. We can just use Scala's functional interface for defining
  servers. [Google's REST API Design Guide](https://cloud.google.com/apis/design) has been useful
  resources for defining clear REST API endpoints, but we've found using programming language's
  native interface is much easier.
- __No more web-framework wars__. In Scala, there are many web frameworks, such
  as [Finatra](https://github.com/twitter/finatra), [Finch](https://github.com/finagle/finch)
  , [Akka HTTP](https://doc.akka.io/docs/akka-http/current/index.html), and our
  own [airframe-http](airframe-http.md), etc. Each of them has its own pros and cons, and choosing
  one of them has been a hard choice for us. Now, we can just start from Airframe RPC using plain
  Scala interfaces. If necessary, we can use airframe-http for adding custom HTTP endpoints.
- __Seamless integration with Scala.js__. Writing web browser applications in JavaScript that
  interact with servers is not easy. You may need to learn about the existing frameworks
  like [React.js](https://https://reactjs.org/), [Vue.js](https://vuejs.org), and a lot of
  techniques for using them. By using Scala both for server and client code, an engineer just joined
  the company could write an RPC application using Scala and Scala.js in a few days.

## Airframe RPC: Overview

For using Airframe RPC, first, define your RPC service interface using regular Scala functions by
adding `@RPC` annotation. All public methods in this class will be your RPC endpoints. For the
method arguments and return types, you can use arbitrary types (
See [Object Serialization](#object-serialization) for the list of available types). To pass complex
messages, you can use case classes.

```scala
package hello.api.v1

import wvlet.airframe.http._

// A model class. This will be serialized into JSON or MessagePack
case
class Person(id: Int, name: String)

// RPC interface definition
@RPC
trait MyService {
  def hello(person: Person): String
}

```

Next, implement this service interface in Scala:

```scala
package hello.api.v1

import wvlet.airframe.http._

class MyServiceImpl extends MyService {
  override def hello(person: Person): String = s"Hello ${person.name} (id=${person.id})!"
}
```

To start an RPC web server, Airfarme RPC provides Finagle-based web server implementation. The
following code starts an RPC web server at `http://localhost:8080/`:

```scala
// Create a Router
val router = Router.add[MyServiceImpl]

// Starting a new RPC server.
Finagle
  .server
  .withRouter(router)
  .withPort(8080)
  .start { server =>
     server.waitForTermination
  }
```

To access the RPC server, we need to generate an RPC client from the RPC interface definition. We
can use an RPC client `hello.api.v1.ServiceSyncClient`  generated
by [sbt-airframe](#sbt-airframe-plugin), which reads an RPC interface code and generates HTTP client
code for calling RPC methods.

// Create an RPC client
val client = new ServiceSyncClient(Http.client.newSyncClient("localhost:8080"))

// Your first RPC call!
client.myService.hello(Person(id = 1, name = "leo")) // "Hello leo (id=1)!"
```

That’s it! Now you can call remote Scala methods as if they were regular Scala functions. Airframe
RPC also supports asynchronous clients using Future.

## Usage

The basic flow of using Airframe RPC is as follows:

1. Define RPC interfaces with `@RPC` annotation
1. Implement the RPC interfaces in Scala
1. Create `wvlet.airframe.http.Router` by adding the RPC interface implementation classes.
1. Generate RPC client code with sbt-airframe plugin

### Basic Project Structure

Here is an example build configurations for using Airframe RPC with Scala and Scala.js.

[![maven central](https://img.shields.io/maven-central/v/org.wvlet.airframe/airframe_2.12.svg?label=maven%20central)](https://search.maven.org/search?q=g:%22org.wvlet.airframe%22%20AND%20a:%22airframe_2.12%22
)

__project/plugins.sbt__

```scala
// For RPC client generation
addSbtPlugin("org.wvlet.airframe" % "sbt-airframe" % "(version)")

// [optional] For Scala.js
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.1.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")
```

__build.sbt__

```scala
val AIRFRAME_VERSION = "(version)"

// Common build settings
val buildSettings = Seq(
  organization := "(your organization)",
  scalaVersion := "2.12.10"
  // Add your own settings here
)

// RPC API definition. This project should contain only RPC interfaces
lazy val api =
  crossProject(JSPlatform, JVMPlatform)
    .crossType(CrossType.Pure)
    .in(file("myapp-api"))
    .settings(
       buildSettings,
       libraryDependencies += "org.wvlet.airframe" %%% "airframe-http" % AIRFRAME_VERSION
    )

lazy val apiJVM = api.jvm
lazy val apiJS = api.js

// RPC server project
lazy val server =
  project
    .in(file("myapp-server"))
    .settings(
      buildSettings,
      libraryDependencies ++= Seq(
        "org.wvlet.airframe" %% "airframe-http-finagle" % AIRFRAME_VERSION,
        // Add this for using gRPC
        "org.wvlet.airframe" %% "airframe-http-grpc" % AIRFRAME_VERSION
      )
    )
    .dependsOn(apiJVM)

// RPC client project
lazy val client =
  project
    .in(file("myapp-client"))
    .enablePlugins(AirframeHttpPlugin)
    .settings(
      buildSettings,
      // Generates both ServiceSyncClient and ServiceClient (async)
      airframeHttpClients := Seq("myapp.app.v1:sync", "myapp.app.v1:async"),
      // Enable debug logging of sbt-airframe
      airframeHttpGeneratorOption := "-l debug",
      libraryDependencies ++= Seq(
        "org.wvlet.airframe" %% "airframe-http-finagle" % AIRFRAME_VERSION,
        // Add this for using gRPC
        "org.wvlet.airframe" %% "airframe-http-grpc" % AIRFRAME_VERSION
   )
   .dependsOn(apiJVM)

// [optional] Scala.js UI using RPC
lazy val ui =
  project
    .in(file("myapp-ui"))
    .enablePlugins(ScalaJSPlugin, AirframeHttpPlugin)
    .settings(
      buildSettings,
      // sbt-airframe generates Scala.js HTTP client: ServiceJSClient with this setting:
      airframeHttpClients := Seq("myapp.app.v1:scalajs"),
      // Enable debug logging of sbt-airframe
      airframeHttpGeneratorOption := "-l debug"
    )
    .dependsOn(apiJS)
```

### sbt-airframe plugin

sbt-airframe plugins supports generating HTTP clients for making RPC calls. sbt-airframe supports
generating async, sync, or Scala.js HTTP clients.

[![maven central](https://img.shields.io/maven-central/v/org.wvlet.airframe/airframe_2.12.svg?label=maven%20central)](https://search.maven.org/search?q=g:%22org.wvlet.airframe%22%20AND%20a:%22airframe_2.12%22
)

Add the following plugin settings:

__project/plugins.sbt__

```scala
addSbtPlugin("org.wvlet.airframe" % "sbt-airframe" % "(version)")
```

To generate HTTP clients, add `airframeHttpClients` setting to your `build.sbt`. You need to specify
which API package to use for generating RPC clients. The format
is `<RPC package name>:<client type>(:<target package name>)?`. For example:

__build.sbt__

```scala
enablePlugins(AirframeHttpPlugin)

airframeHttpClients := Seq("hello.api.v1:sync")
```

Supported client types are:

- __sync__: Create a sync HTTP client (ServiceSyncClient) for Scala (JVM)
- __async__: Create an async HTTP client (ServiceClient) for Scala (JVM) using Future
  abstraction (`F`). The `F` can be `scala.concurrent.Future` or twitter-util's Future.
- __scalajs__:  Create an RPC client (ServiceClientJS)
- __grpc__: Create gRPC client stubs (ServiceGrpc: SyncClient, AsyncClient)

To support other types of clients, see the examples
of [HTTP code generators](https://github.com/wvlet/airframe/blob/master/airframe-http/.jvm/src/main/scala/wvlet/airframe/http/codegen/client/ScalaHttpClient.scala)
. This code reads a Router definition of RPC interfaces, and generate client code for calling RPC
endpoints. Currently, we only supports generating HTTP clients for Scala. In near future, we would
like to add Open API spec generator so that many programming languages can be used with Airframe
RPC.

The generated client code can be found in `target/scala-2.12/src_managed/(api package)/` folder.

#### sbt-airframe commands

```scala
# Regenerate the generated client code.Use this if RPC interface has changed
> airframeHttpReload

# Generating RPC clients manually
> airframeHttpGenerateClients

# Clean the generated code
> airframeHttpClean
```

### Open API

sbt-airframe plugin also supports generating [Open API](http://spec.openapis.org/oas/v3.0.3)
specification from Airframe RPC interfaces. To generate OpenAPI spec from RPC definition,
add `airframeHttpOpenAPIPackages` configuration to your build.sbt:

```scala
// [Required] RPC packages to use for generating Open API specification
airframeHttpOpenAPIPackages := Seq("hello.api")
// [Optional] Specify target directory to generate openapi.yaml. The default is target directory
airframeHttpOpenAPITargetDir := target.value
// [Optional] Additional configurations (e.g., title, version, etc.)
airframeHttpOpenAPIConfig := OpenAPIConfig(
  title = "My API", // default is project name
  version = "1.0.0", // default is project version,
  format = "yaml", // yaml (default) or json
  filePrefix = "openapi" // Output file name: (filePrefix).(format)
)
```

With this configuration, Open API spec will be generated when running `package` task:

```scala
> package
```

It will generate `target/openapi.yaml` file.

### RPC Logging

Airframe RPC stores HTTP access logs to `log/http-access.json` by default. This json logs contains
HTTP request related parameters and RPC-specific fields described below:

- __rpc_interface__: RPC interface class name
- __rpc_class__: The atual RPC implementation class name
- __rpc_method__: The RPC method name
- __rpc_args__: The RPC call argument parameters described in JSON

These parameters can be used for debugging your RPC requests.

See also [airframe-http: Access Logs](airframe-http.md#access-logs) for more details.

### RPC Filters

(This feature is not available for gRPC backend)

Airframe RPC can chain arbitrary HTTP request filters before processing HTTP requests. Most typical
use cases would be adding an authentication filter for RPC calls:

```scala
import wvlet.airframe.http._
import wvlet.ariframe.http.finagle._

object AuthFilter extends FinagleFilter with LogSupport {
  def apply(request: Request, context: Context): Future[Response] = {
    val auth = request.authorization
    if (isValidAuth(auth)) {
      // Call the next filter chain
      context(request)
    }
    else {
      // Reject the request
      Future.value(Response(Version.Http11, Status.Forbidden))
    }
  }
}
```

```scala
// Router for RPC
val rpcRouter = Router.add[MyApp]

// Add a filter before processing RPC requests
val router = Router
        .add(AuthFilter)
        .andThen(rpcRouterr)
```

### DI Integration

Airframe RPC natively supports [Airframe DI](airframe.md) for dependency injection so that you can
inject necessary components for running your web service using `bind[X]` syntax or constructor
injection. DI is useful when building web applications requiring many components and if you need to
decouple component implementations from the service implementations. Airframe DI also supports
switching component implementations between production and tests for the convenience of module
tests.

Here is an example of using Airframe DI for starting an RPC server:

```scala
import wvlet.airframe._

trait MyAPIImpl extends MyAPI {
  // Inject your component
  private
  val myService = bind[MyService]

  override def hello(
  ...) =...
}

val router = Router.add[MyAPIImpl]

// Define the component implementation to use
val design = newDesign
  .bind[MyService].toInstance(new MyServiceImpl(...))
  .add(Finagle.server.withRouter(router).design)

// Launch a Finagle Server
design.build[FinagleServer] { server =>
  server.waitForTermination
}
```

### Object Serialization

Airframe `@RPC` interface supports almost all commonly used data types in Scala (and Scala.js). Note
that some Java-specific classes (e.g., ZonedDateTime) is not supported in Scala.js.

Here is the list of available data types:

- case classes whose parameter types (including generic types) are described in this list.
- Primitive types (Int, Long, String, Double, Float, Boolean, etc)
- java.util.UUID
- java.time.Instant (recommended because it can be used for Scala.js too)
  - (JVM only) ZonedDataTime, java.util.Date. These types cannot be used in Scala.js.
- Collection types: Seq, IndexedSeq, List, Set, Array, Map, Tuple (up to 21 parameters), Option,
  Either.
- Exception, Throwable
  - Exception types will be serialized as GenericException for safety.
- [airframe-metrics](airframe-metrics.md) types: ElapsedTime, DataSize, Count, etc.
- Raw Json, JSONValue, MsgPack values.
- Enum-like case object class, which has `object X { def unapply(s:String): Option[X] }` definition.
  String representation of enum-like classes will be used. Scala's native Enumeration classes are
  not supported.

Airframe RPC internally uses [schema-on-read functionality of airframe-codec](airframe-codec.md) for
serializing messages between server and clients. Even if the data type is slightly different from
the target type, for example, if the input data is "100", but the target type is Int, the input
String "100" will be translated into an Int value `100` automatically.

### Receiving Raw HTTP Responses

If you need to manage HTTP request specific parameters (e.g., HTTP headers), you can add request
object to the RPC arguments.

```scala
import wvlet.airframe.http._
import wvlet.airframe.http.HttpMessage.{Request, Respone}

@RPC
trait MyAPI {
  def rpc1(p1: String, p2: Int, request: Request): Response
}
```

### Other Tips

Airframe RPC is built on top of Airframe HTTP framework.
See [Airframe HTTP documentation](airframe-http.md) for the other features and advanced
configurations.

## Airframe gRPC

_(This is an experimental feature available since Airframe 20.8.0)_

Airframe gRPC is a gRPC and HTTP2-based implementation of Airframe RPC, which can make thousands of
RPC calls per second. Airframe gRPC requires no Protobuf definitions. You can use plain Scala
interface and case classes to define gRPC services.

Example gRPC projects can be found
from [here](https://github.com/wvlet/airframe/tree/master/examples/rpc-examples).

__build.sbt__

```scala
"org.wvlet.airframe" %% "airframe-http-grpc" % AIRFRAME_VERSION
```

### Defining gRPC API

As in Airframe RPC, just use Scala trait annotated with `@RPC`. All public methods in this trait
will be RPC endpoints:

```scala
package example.api

import wvlet.airframe.http.RPC

@RPC
trait GreeterApi {
  def sayHello(message: String): String
}

```

### Generating gRPC client

Add a following build setting to generate a gRPC client by using sbt-airframe plugin:

```scala
airframeHttpClients := Seq("example.api:grpc")
```

With this setting, gRPC client stubs `example.api.ServiceGrpc` will be generated. You can create a
new sync or async client with ServiceGrpc.newSyncClient or newAsyncClient methods.

### Starting An Airframe gRPC Server

```scala
import wvlet.airframe.http.Router
import wvlet.airframe.http.grpc.gRPC

// API implementation
class GreeterApiImpl extends example.api.GreeterApi {
  def sayHello(message: String): String = s"Hello ${message}!"
}

// Create a Router definition in the same manner with Airframe RPC
val router = Router.add[GreeterApiImpl]

gRPC.server
  .withRouter(router)
  .withPort(8080)
  // [optional] You can add gRPC interceptors here
  //.withInterceptor(...)
  // [optional] you can customize gRPC server here
  //.withServerInitializer{ x: ServerBuilder => x.addMethod(...); x }
  // [optional] Disable the default logging to log/http-access.json file
  //.noRequestLogging
  .start { server =>
    // gRPC server (based on Netty) starts at localhost:8080
    server.awaitTermination
  }
```

### gRPC Client

sbt-airframe generates ServiceGrpc.scala file to the target API package. You can create sync (
blocking) or async (non-blocking) gRPC clients using this class.

#### gRPC Sync Client

```scala
import example.api.ServiceGrpc

// Create a client channel
val channel = ManagedChannelBuilder.forTarget("localhost:8080").usePlaintext().build()

// Create a gRPC blocking client (SyncClient)
val client = ServiceGrpc.newSyncClient(channel)
try {
  // Call gRPC server
  val ret = client.GreeterApi.sayHello("Airframe gRPC") // Hello Airframe gRPC!
}
finally {
  client.close()
}
```

#### gRPC Async Client

```scala
import example.api.ServiceGrpc
import io.grpc.stub.StreamObserver

// Create an async gRPC client
val client = ServiceGrpc.newAsyncClient(channel)

// Call gRPC server
client.GreeterApi.sayHello("Airframe gRPC", new StreamObserver[String] {
  def onNext(v: String): Unit = {
    // v == Hello Airframe gRPC!
  }
  def onError(t: Throwable): Unit = {
    // report the error
  }
  def onCompleted(): Unit = {
    // RPC call completion
  }
})
```

### gRPC Streaming

To implement server/client/bi-directional streaming, define RPC endpoints with `RxStream[A]`argument
or return types of [airframe-rx](airframe-rx.md). `RxStream[A]` describes reactive-streaming data
from client or server-side, and it basically the same with `Seq[A]` other than the chained operators
of `RxStream[A]` such as map, flatMap, etc. will be evaluated as a new streaming input of `A`
arrives (i.e., reactive evaluation).

```scala
import wvlet.airframe.http.RPC
import wvlet.airframe.rx.{Rx, RxStream}

@RPC
trait GreeterStreaming {
  // Server streaming returns RxStream[X] value
  def serverStreaming(name: String): RxStream[String] = {
    Rx.sequence("Hello", "See you").map { x => s"${x} ${name}!" }
  }

  // Client streaming receives only one RxStream[X] argument
  def clientStreaming(names: RxStream[String]): String = {
    names
      .map { x => s"Hello ${x}!" }
      .toSeq // Rx[X].toSeq materialize the streaming inputs as a concrete Seq[X]
      .mkString(", ")
  }

  // Bidirectional streaming receives only one RxStream[X] argument and returns RxStream[Y] response
  def bidirectionalStreaming(names: RxStream[String]): RxStream[String] = {
    names.map { x => s"Hello ${x}!" }
  }
}

```

### Launching Multiple gRPC Servers

To launch multiple gRPC serves, use `GrpcServerFactory`:

```scala
import wlvet.airframe._
import wvlet.airframe.http.grpc.{gRPC, GrpcServerFactory}

val d = Design.newDesign

d.build { f: GrpcServerFactory =>
  val s1 = f.newGrpcServer(
    gRPC.server.withName("grpc1").withPort(8080).withRouter(...)
  )
  val s2 = f.newGrpcServer(
    gRPC.server.withName("grpc2").withPort(8081).withRouter(...)
  )

  // Wait until all servers terminate
  f.awaitTermination
}
```

All gRPC servers created by the factory will be closed when the factory is closed.

### Reading gRPC Metadata

To access gRPC Metadata containing HTTP2 headers, use `GrpcContext.current` method:

```scala
import wvlet.airframe.http.RPC
import wvlet.airframe.http.grpc.GrpcContext

@RPC
trait MyApi {
  def hello: String = {
    // Get the current context
    val ctx: Option[GrpcContext] = GrpcContext.current
    // Read gRPC Metadata
    ctx.map(_.metadata) // Option[Metadata]
    // ...
  }
}

```

## RPC Internals

(_This section describes the internals of Airframe RPC protocol. Just for using Airframe RPC, you
can skip this section._)

Airframe RPC uses MessagePack (or JSON) for data transfer. All requests must use HTTP POST method
and the URL path matching to `/(RPC interface package name).(RPC interface name)/(method name)`. The
request message body of an RPC request is a MessagePack Map representation of a sequence of
key-value pairs of `(method argument name)` -> `(method argument value)`.

When gRPC backend is used, the client must use HTTP/2 and the message body must be encoded
as [Length-Prefixed-Message](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests)
defined in gRPC protocol.

### RPC Protocol

Airframe RPC maps function calls to HTTP POST requests.

Let's see how RPC calls will be translated into HTTP requests using the following RPC interface
example:

```scala
package hello.api.v1

import wvlet.airframe.http.RPC

@RPC
trait MyService {
  def hello(request: HelloRequest): HelloResponse
}

case class HelloRequest(name: String)

case class HelloResponse(message: String)

```

- __Method__: POST
- __Path__: `/(package name).(RPC interface name)/(method name)`
  - ex. `POST /hello.api.v1.MyService/hello`
- __Content-Type__: `application/x-msgpack` (default), `application/json`, or `application/grpc` (
  gRPC backend with HTTP/2)
- __Request body__: JSON or MessagePack (default) representation of the method arguments. Each
  method parameter names and arguments need to be a key-value pair in the JSON object.
  - For an RPC method `def m(p1:T1, p2:T2, ...)`, the request body will have the structrure
    of `{"p1":(json representation of T1), "p2":(json representation of T2}, ...}`. For example, the
    request to the above `hello(request:HelloRequest)` method will require the following JSON body:

```json
{
  "request": {
    "name": "leo"
  }
}
```

- __Accept__: "application/json" or "application/x-msgpack" (default)
- __Response body__: JSON or MessagePack (default) representation of the method return type:

```json
{
  "message": "..."
}
```

- __Http Status__
  - 200 (Ok) for successful responses.
  - 400 (Bad Request) if some request parameters are invalid.

### RPC Protocol (HTTP/2 for gRPC)

For gRPC backend, see
also [gRPC over HTTP2](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md) protocol for
the other HTTP headers.

```aidl
// Save Length-Prefixed-Message representation of MessagePack Map value of {"name":"hello"}
// The first byte (0x00) means no compression
// The next 4 bytes (0x00 0x00 0x00 0x0c) represents the message body size = 12 bytes in big-endian
// Then, followed by MessagePack binary value
$ echo -n $'\x00\x00\x00\x00\x0c\x81\xa4\x6e\x61\x6d\x65\xa5\x68\x65\x6c\x6c\x6f' > hello.mspack
```

An example of calling Airframe gRPC method with Curl:

```
$ curl -v --raw --http2-prior-knowledge -X POST  -H "content-type: application/grpc" -H "TE: trailers" --data-binary @hello.mspack --output - http://localhost:8080/greeter.api.GreeterApi/hello
```

With `accept: application/json` header, JSON string can be passed instead of MessagePack. In this case, the response message format will be `{"response":(RPC result)}`.

repository: xerial/airframe

repo_name: xerial/airframe


text:
# lighthouse-example
A simple example of running Lighthouse programmatically.

To see the results of a lighthouse test run on the mobile and desktop versions of the site (https://seesparkbox.com/)[https://seesparkbox.com/] (my employer), run:

`npm run lighthouse-a11y`

repository: isayushsingh/lighthouse-example

repo_name: isayushsingh/lighthouse-example


text:
---
title: Day24 - More Linked Lists (Python 3)
author: HyunMin Kim
date: 2020-06-05 00:00:00 0000
categories: [Hacker Ranker, 30 Days of Code]
tags: []
---

- URL : <https://www.hackerrank.com/challenges/30-linked-list-deletion/problem>{:target="_blank"}

- Objective
    - Check out the Tutorial tab for learning materials and an instructional video!

- Task
    - A Node class is provided for you in the editor. A Node object has an integer data field, data, and a Node instance pointer, next, pointing to another node(i.e.: the next node in a list).

    - A removeDuplicates function is declared in your editor, which takes a pointer to the head node of a linked list as a parameter. Complete removeDuplicates so that it deletes any duplicate nodes from the list and returns the head of the updated list.

- Note: The head pointer may be null, indicating that the list is empty. Be sure to reset your next pointer when performing deletions to avoid breaking the list.

- Input Format
    - You do not need to read any input from stdin. The following input is handled by the locked stub code and passed to the removeDuplicates function:
    - The first line contains an integer, N, the number of nodes to be inserted.
    - The N subsequent lines each contain an integer describing the data value of a node being inserted at the list's tail.

- Constraints
    - The data elements of the linked list argument will always be in non-decreasing order.

- Output Format
    - Your removeDuplicates function should return the head of the updated linked list. The locked stub code in your editor will print the returned list to stdout.

```python
def removeDuplicates(self,head):
    #Write your code here
    if head is None:
        return None
    ls = [head.data]
    node = head
    while node.next is not None:
        if node.next.data not in ls:
            node = node.next
        else :
            snode = node.next
            node.next = snode.next
            del snode
        ls.append(node.data)
    return head
```