text:
# Children Residence Change Template

This is an application template for children residence change created for the County Magistrate of Iceland by Kolibri.

## Setup

Application System setup: [Setup](https://docs.devland.is/apps/application-system)

### Additional setup

There are additional steps required to run this template locally

#### National Registry Provider

Prerequisites

- You have `kubectl` installed
  - `brew install kubectl`
- You have [AWS Secrets](../../../../handbook/repository/aws-secrets.md) configured

1. Fetch development secrets for the project

- Run `yarn get-secrets service-portal`

2. Get kubeconfig

- Export aws variables `aws eks update-kubeconfig --name dev-cluster01`

3. Socat Þjóðskrá

- Run `kubectl port-forward svc/socat-soffia 8443:443 -n socat`
- Keep this process running while running the project

### Test user

For testing on local, dev and staging use the Gervimaður Evrópa login: 0102719

## Code owners and maintainers

- [Kolibri](https://github.com/orgs/island-is/teams/kolibri-modern-family)


text:
# react-experiments

react-experiments is a set of React components for implementing UI experiments. This is a fork of https://github.com/HubSpot/react-experiments.

# Installation

```
npm install --save hijup-react-experiments
```

# Usage

**If you are using React 0.13 the latest supported version is 3.0.1**.

react-experiments was built to work with [PlanOut.js](https://www.github.com/HubSpot/PlanOut.js) and most of its constructs are inspired by the structure of PlanOut.js. This library will work out of the box if you pass it an instantiated PlanOut Namespace or Experiment class, but if you want to use your own methods of assigning experiment parameters and logging exposure then you can extend the base [experiment class](https://github.com/hijup/react-experiments/blob/master/src/Experiment.js) and pass that as the experiment class prop.

## Implementing a simple experiment

This library serves as a way to declaratively implement UI experiments that are defined via PlanOut. The standard usage of this library is as follows:

1) Define experiment via PlanOut script / API. The PlanOut parameters that you set should map to the props on which you want to run an experiment. Let's use the [sample PlanOut.js experiment](https://github.com/HubSpot/PlanOut.js/blob/master/examples/sample_planout_es5.js#L41) as an example, which is effectively:

```js
signupText = uniformChoice(choices=['Signup', 'Join now'])
```

2) Wrap the component where you want to implement your UI experiment with the parametrize function provided by the library along with an instantiated experiment class and the specific parameter names that you want to parametrize the component with. As an example,

```js
const Signup = parametrize(DummyExperiment, ['signupText'], React.createClass({
  render() {
    return (
      <div>
        {this.props.signupText}
      </div>
    );
  }
}));
```

Now you should be all set to run the sample experiment. The Signup component will render 'Sign up' or 'Join now' based on the randomized parameter assigned by PlanOut.js.

To put it all together,

```js
exp = new DummyExperiment({ id: 'this_is_the_user_id'});

let Signup = parametrize(exp, ['signupText'], React.createClass({
  render() {
    return (
      <div>
        {this.props.signupText}
      </div>
    );
  }
}));

let Parent = React.createClass({
  render() {
    ...
    <Signup />
  }
});
```

## Base Parametrize Component

The implementation of all the components provided by this library are wrappers around a base ```Parametrize``` component. The ```Parametrize``` component allows for parametrizing a given component with experiment parameters. The following are the props that the ```Parametrize``` component takes:

**experiment**: This is an instance of a PlanOut.js experiment/namespace class or the base Experiment class. [REQUIRED]

**params**: This is the list of experiment parameters that you want to use to parametrize the component. They should correspond to the parameter names defined in your PlanOut script / experiment definition. [REQUIRED]

[any arbitrary prop]: You can pass arbitrary props to the Parametrize component and they will be available via context.experimentProps in all descendants of the Parametrize component.

### Higher-order Parametrization Components

There are two primary higher-order components to use for parametrization.

**parametrize**: The ```parametrize``` function takes an instantiated experiment class, either an experiment name or a list of params, and a React component. It takes the given component and sets the deterministically and randomly assigned experiment parameters of the experiment class as props.

```parametrize(exp, ['signupText'], React.createClass({..}));```

**withExperimentParams**: The ```withExperimentParams``` function is used in combination with the base ```Parametrize``` component. It is useful when running an experiment with nested components, but generally the ```parametrize``` function should be preferred.

```js
const Parent = React.createClass({
  render() {
    return (
      <Parametrize experiment={exp} params={['signup_form_text', 'signup_nav_text']}>
        <SignupHeader />
        <SignupForm />
      </Parametrize>
    );
  }
});

const SignupHeader = withExperimentParams(React.createClass({
  render() {
    return (
      <div>
        {this.props.signup_nav_text}
      </div>
    );
  }
});

const SignupForm = withExperimentParams(React.createClass({
  render() {
    return (
      <div>
        {this.props.signup_form_text}
      </div>
    );
  }
});
```

## Running A/B Variation experiments:

There are two common types of experimental parameters:

1) Parameters that correspond to parametrizations of existing variables and components. For instance, if one is running an experiment to test which shade of blue optimizes the click rate of the button, then the values to which your experiment parameters map would correspond to something such as the different hex codes for the different shades of blue.

2) "Branching" parameters where the parameter values correspond to different "variations" of the experiment. For instance, if one is testing two completely different user interfaces then it wouldn't make sense to parametrize every aspect that has changed, but rather to bin users into either 'Variation A' or 'Variation B'.

While the core component of this library focuses on the first type of parameter, it also includes some convenience components built around the Parametrize component for running "branching" experiments using the ```ABTest``` component.

```javascript
<ABTest on='foo' experiment={TestNamespace}>
  <When value='foobar'>
    variation 1
  </When>
  <When value='bar'>
    variation 2
  </When>
  <When value='test'>
    variation 3
  </When>
  <Default>
    variation default
  </Default>
</ABTest>
```

The ABTest component above branches off the value of ```this.props.experiment.get(this.props.on);```, ```TestNamespace.get('foo')``` in this case, and renders the When component where ```ABTest.props.experiment.get(ABTest.props.on) === ABTest.props.value```. If it doesn't find a corresponding When component to render then the Default component will render. This component makes implementing an experiment using "branching" parameters easy.

The ABTest component takes the following as props:

**experiment** - an instantiated PlanOut namespace/experiment class or a custom Experiment class. [REQUIRED]

**on** - the parameter name to "branch" off [REQUIRED]

## Customized Experiment Components

If you want to create your own experiment component you can extend the base Parametrize component.

## Logging

react-experiments deals with logging experiment exposure. All the components provided by this library trigger an exposure log when the component is mounted.

## Development

This project is written using ES6 and all build steps / transpilation are done by webpack. Be sure to run ```npm install``` to install the necessary development dependencies. In order to develop and test locally, it is necessary to simply run the ```build.sh``` shell script which will take care of transpiling to ES5 and running tests.

To test API changes locally, open the examples/index.html file locally after building with your most recent changes. The index.html file contains a simple example of using this library paired with the [PlanOut.js sample experiment](https://github.com/HubSpot/PlanOut.js/blob/master/examples/sample_planout_es5.js).

Please be sure to add tests to this project when making changes. This project uses [Jest](https://facebook.github.io/jest/) for running tests. Tests can be run either by building the project using build.sh or by using ```npm test```.

## License
MIT. Copyright Gustavo Vargas, Guy Aridor, Matthew Rheault, HIJUP team, and other contributors.

## Acknowledgement
This library is fork of https://github.com/HubSpot/react-experiments. Copyright: Gustavo Vargas, Guy Aridor, and Matthew Rheault. License: MIT.

license: MIT

repository: hijup/react-experiments

branch_name: refs/heads/master

extension: md

gha_language: JavaScript

license_type: permissive

repo_name: hijup/react-experiments


text:
# openAI gym

Discovering reinforcement learning with openAI.

So far, my agent passed the evaluations for the following environments:

1. [CartPole-v0](https://gym.openai.com/envs/CartPole-v0)
2. [CartPole-v1](https://gym.openai.com/envs/CartPole-v1)

repository: alterlai/openai-gym-examples

repo_name: alterlai/openai-gym-examples


text:
# Celebrity Matchmaking

#### Practice JS Branching, 1.13.2016

#### By Michelle Brecunier and Mary Warrington

## Description

The user will enter information in a form to determine who their perfect celebrity match would be.

## Setup/Installation Requirements

* Clone this repository
* Open in a standard web browser

## Known Bugs

No known bugs.

## Support and contact details

Contact mbrecunier or marywarrington through github.

## Technologies Used

* Bootstrap
* Javascript

### License
MIT License.

Copyright (c) 2016 **Michelle Brecunier and Mary Warrington**

gha_language: HTML


text:
# Railway-E-Ticketing-Service

Railway-E-Ticketing-Service is a replica web application for railway system management made as the project for CSE 4508: Relational Database Management System.

![IDE](https://img.shields.io/badge/IDE-VSCode-brightgreen)
![FrontEnd](https://img.shields.io/badge/FrontEnd-ReactJS-blue)
![BackEnd Environment](https://img.shields.io/badge/BackEnd%20Environment-NodeJS-purple)
![BackEnd Framework](https://img.shields.io/badge/BackEnd%20Framework-ExpressJS-pink)
![Database](https://img.shields.io/badge/Database-MySQL-brightyellow)
![License](https://img.shields.io/badge/license-MIT-orange.svg)

## Team Members:
* Md. Sajid Altaf- 180041203
* Syed Mohammed Sartaj Ekram- 180041204
* Adham Arik Rahman- 180041219

## Functionalities:
### Admin:
* can signin to the system
* can add and delete station
* can add and delete clerk
* can add train and set the train path

### Booking Clerk:
* can signin to the system
* can sell tickets based on availability

### Passenger:
* can signup and signin to the system
* can verify ticket online
* can buy ticket online based on availability


text:
## Deep Learning in Multiple Multistep Time Series Prediction

This project aims to use deep learning to try to solve a Kaggle competition problem - Web Traffic Time Series Forecasting (https://www.kaggle.com/c/web-traffic-time-series-forecasting).

A report is generated in the PDF file. [Deep Learning in Multiple Multistep Time Series Prediction](https://arxiv.org/abs/1710.04373)

All the python code is implemented in the IPython notebook.

**Note:**
The competiton is closed on Nov. 13th 2017. The result above achieved top 2% in the leaderboard. Great thanks to Kaggle and Google research for organizing this interesting and challenging competition.

## Dataset

The dataset is from a Kaggle competition and here is the link:

https://www.kaggle.com/c/web-traffic-time-series-forecasting/data

## Python libraries

- [Pandas](http://pandas.pydata.org)

It is mainly used to import, save, join and analyze dataframes like using read_csv, DataFrame, merge, etc.

- [NumPy](http://www.numpy.org/)

It is mainly used to transform array like taking log() and exp().

- [scikit-learn](http://scikit-learn.org/stable/)

Its model evaluation metrics and preprocessing functions are used.

- [Keras](https://keras.io/)

It is used to build neural network architecture, train and save the model, and predict new dataset like using models, layers, callbacks, etc..

- [matplotlib](http://matplotlib.org/)

It is used to visualize time series and other figures.

repository: carterrees/Deep-Learning-in-Time-Series

repo_name: carterrees/Deep-Learning-in-Time-Series


text:
# Apache Thrift Example

## About

This project offers an example [Apache Thrift](https://thrift.apache.org/) service and shows how to implement it in different languages.

It shows how to perform common tasks and can be used as a skeleton for your own thrift projects.

The code was tested using the latest thrift version which at the time of writing is `1.14.2`.

## Supported Languages

At the moment the project offers language bindings for:

* C# / .NET 5.0 (in [csharp/Calculator](https://github.com/kmhsonnenkind/thrift-example/tree/main/csharp/Calculator))
* Java 11 (in [java/calculator](https://github.com/kmhsonnenkind/thrift-example/tree/main/java/calculator))
* Python 3.6 (in [python](https://github.com/kmhsonnenkind/thrift-example/tree/main/python))

Each language implementation offers example code as well as build / test configuration showing how to perform common tasks (like running unittests).

## Build and Run

As with any thrift project the build consists of two steps:

* Use `thrift` to generate the language specific code
* Use the language's build tools to actually build the code

For your convenience utility scripts are provided to show how to perform these steps.

Each language offers either a *Makefile* based build script in [scripts/make](https://github.com/kmhsonnenkind/thrift-example/tree/main/scripts/make) or Batch files in [scripts/win](https://github.com/kmhsonnenkind/thrift-example/tree/main/scripts/win). E.g. for the `Python` implementation you can find the build steps either in [scripts/make/py.mk](https://github.com/kmhsonnenkind/thrift-example/blob/main/scripts/make/py.mk) or [scripts/win/py](https://github.com/kmhsonnenkind/thrift-example/tree/main/scripts/win/py).

All targets from the build scripts are bundled in either the main [Makefile](https://github.com/kmhsonnenkind/thrift-example/blob/main/Makefile) or the corresponding scripts in [scripts/win](https://github.com/kmhsonnenkind/thrift-example/tree/main/scripts/win).

The utility scripts will offer the following targets:

* `generate-code` is used to generate the language specific thrift code.
* `build` is used to build the code using the language's build tools.
* `test` is used to run the unittests using the language's test framework.
* `check` is used to run static code analysis using tools matching the desired language.
* `documentation` is used to create (HTML) documentation using the language's documentation generator.
* `clean` is used to remove all generated, build and cache files.

Further each language will also offer a *client* and *server* implementation to use the thrift service.

As an example you can perform common tasks in Linux using `make`:

```sh
make test
make documentation-py
make server-java
make -f scripts/make/csharp.mk client
```

or on Windows using:
```sh
scripts\win\test.bat
scripts\win\py\documentation.bat
scripts\win\java\server.bat
scripts\win\csharp\client.bat
```

### VS Code

The project is set up for use with [Visual Studio Code](https://code.visualstudio.com/). It offers some utility build and launch configurations in [.vscode](https://github.com/kmhsonnenkind/thrift-example/tree/main/.vscode). For full IDE integration please install the language's tooling in VS Code.

As the project needs some configuration variables a workspace settings file [.vscode/settings.json](https://github.com/kmhsonnenkind/thrift-example/blob/main/.vscode/settings.json) is provided. If you need additional configuration please set them via your user config file.

repository: kmhsonnenkind/thrift-example

branch_name: refs/heads/main

repo_name: kmhsonnenkind/thrift-example


text:
# Cloak

_Cloak_ is a protocol for confidential assets based on the [Bulletproofs](https://crypto.stanford.edu/bulletproofs/) zero-knowledge proof system. _Cloaked transactions_ exchange values of different “asset types” (which we call [flavors](#flavor)).

* [Requirements](#requirements)
* [Future directions](#future-directions)
* [Definitions](#definitions)
    * [Scalar](#scalar)
    * [Signed integer](#signed-integer)
    * [Value](#value)
    * [Quantity](#quantity)
    * [Flavor](#flavor)
    * [Gadget](#gadget)
    * [Transaction](#transaction)
    * [K-scalar shuffle](#k-scalar-shuffle)
    * [K-value shuffle](#k-value-shuffle)
    * [Pad](#pad)
    * [Mix](#mix)
    * [K-mix](#k-mix)
    * [K-merge](#k-merge)
    * [K-split](#k-split)
    * [Range proof](#range-proof)
* [Converting boolean expressions](#converting-boolean-expressions)
* [Computing assignments](#computing-assignments)

## Requirements

#### Soundness

The protocol guarantees to the verifier that each transaction is balanced _per flavor_.

Assumptions:
1. Input [quantities](#quantity) are [scalars](#scalar) in the [signed integer](#signed-integer) range.
2. Number of inputs and outputs is below 2^64, such that quantities cannot wrap around the group order.

Guarantees:
1. Non-zero output quantities were not created from nowhere or dropped.
2. Non-zero output quantities were not transmuted from one [flavor](#flavor) to another.
3. Per each [flavor](#flavor), the sum of all input quantities is equal to the sum of all output quantities.
4. Each output [quantity](#quantity) is in non-negative range `[0, 2^64-1]`.

#### Secrecy

The protocol must preserve secrecy of the values and secrecy of distribution of the flavors.
In other words, all transfers with `M` inputs and `N` outputs must be indistinguishable to the verifier.

Note: protecting the metadata (e.g. linkability of asset flow between the distinct transactions)
is out of scope of this protocol. However, a higher-level system that solves this problem could
use Cloak as a building block.

## Definitions

### Scalar

An integer mod `l` where `l` is a Ristretto group order (`l = 2^252 +<PHONE_NUMBER>7372353535851937790883648493`).

### Signed integer

An integer in range [-2^64+1, 2^64-1].

### Value

The _value_ `v` is the tuple `(q, f)`, consisting of both an untyped [quantity](#quantity) `q` as well as
type information `f` that we call [flavor](#flavor).

In the rest of this specification, we will always use the word _value_
to denote the typed quantity `(q, f)` and the word _quantity_ to denote an untyped quantity `q`.

Values are encrypted using Pedersen commitments, one per component.

### Quantity

A [signed integer](#signed-integer) `q` representing a numeric amount of a given [value](#value).

Note: input values may have a negative quantity, but all outputs of a transaction are proven to be non-negative.

### Flavor

A [scalar](#scalar) `f` representing a unique asset type of a given [value](#value).

[Values](#value) of different flavors cannot be merged. One flavor cannot be transmuted to another.

### Gadget

Each gadget represents constraints on a number of variables.
Gadgets can be composed of nested gadgets.

### Transaction

A transaction is a [gadget](#gadget) that represents the transfer of `M` input [values](#value) into `N` output [values](#value).

A transaction consists of:

1. [M-value shuffle](#k-value-shuffle) that proves that [values](#value) are sorted by [flavor](#flavor) for the following merge.
2. [M-merge](#k-merge) that proves merge of all [values](#value) of the same [flavor](#flavor) in one.
3. [K-value padded shuffle](#k-value-shuffle) (`K = max(M,N)`) that proves that [values](#value) are reordered by [flavor](#flavor) (such that non-zero values go before the zeroed ones). This gadget is [padded](#pad) with zero values on inputs or outputs as required.
4. [N-split](#k-split) that proves split of non-zero [values](#value) into a required number of smaller values per [flavor](#flavor).
5. [N-value shuffle](#k-value-shuffle) that proves that [values](#value) are preserved while being permuted in random order.
6. [N range proofs](#range-proof) that prove that each [quantity](#quantity) is in a valid range `[0, 2^64)`. This prevents the prover from creating “negative” quantities that may offset inflated “positive” quantities.

Transaction is the outermost gadget of this protocol.

```ascii

  M inputs                                                  N outputs
            -->█-->█------------->█---->█---------->█--█-->
            -->█-->█-->█--------->█---->█-->█------>█--█-->
            -->█------>█-->█----->█-------->█-->█-->█--█-->
            -->█-----------█----->█-------------█-->█--█-->
               |   |   |   |  0-->█-->0 |   |   |   |  |
               |    \  |  /   |   |   |  \  |  /    |  |
               |     \ | /    |   |   |   \ | /     |  |
               |     M-merge  |   |   |   N-split   | range proofs
               |              |   |   |             |
        first shuffle        pad  |  pad       final shuffle
                                  |
                            middle shuffle
```

Prover provides M input commitments, N output commitments, intermediate commitments, and a proof of the above relation between inputs and outputs.

Verifier constructs the relation from the commitments and parameters M and N, and verifies the proof.
If the verification is successful, the verifier is convinced of the [soundness](#soundness) of the transfer.

### K-scalar shuffle

Represents a permutation of a list of `k` [scalars](#scalar) `{x_i}`
into a list of `k` [scalars](#scalar) `{y_i}`.

Algebraically it can be expressed as a statement that for a free variable `z`,
the roots of the two polynomials in terms of `z` are the same up to a permutation:

    ∏(x_i - z) == ∏(y_i - z)

Prover can commit to blinded scalars `x_i` and `y_i`, then receive a random challenge `z`,
and build a proof that the above relation holds.

K-scalar shuffle requires `2*(K-1)` multipliers.

For K > 1:

```ascii
        (x_0 - z)---⊗------⊗---(y_0 - z)        // mulx[0], muly[0]
                    |      |
        (x_1 - z)---⊗      ⊗---(y_1 - z)        // mulx[1], muly[1]
                    |      |
                   ...    ...
                    |      |
    (x_{k-2} - z)---⊗      ⊗---(y_{k-2} - z)    // mulx[k-2], muly[k-2]
                   /        \
    (x_{k-1} - z)_/          \_(y_{k-1} - z)

    // Connect left and right sides of the shuffle statement
    mulx_out[0] = muly_out[0]

    // For i == [0, k-3]:
    mulx_left[i]  = x_i - z
    mulx_right[i] = mulx_out[i+1]
    muly_left[i]  = y_i - z
    muly_right[i] = muly_out[i+1]

    // last multipliers connect two last variables (on each side)
    mulx_left[k-2]  = x_{k-2} - z
    mulx_right[k-2] = x_{k-1} - z
    muly_left[k-2]  = y_{k-2} - z
    muly_right[k-2] = y_{k-1} - z
```

For K = 1:

```ascii
    (x_0 - z)--------------(y_0 - z)

    // Connect x to y directly, omitting the challenge entirely as it cancels out
    x_0 = y_0
```

### K-value shuffle

Represents a permutation of tuples ([quantity](#quantity), [flavor](#flavor)).

Each tuple of [scalars](#scalar) `(q, f)` is combined into a single scalar using a free variable `w`:

    x = q  + w*f

Then, the combined scalars are permuted using [K-scalar shuffle](#k-scalar-shuffle) gadget.

If `w` is chosen unpredictably to a prover, any `x` scalar can be equal to a `y` scalar (computed in the same way)
iff their corresponding [quantities](#quantity) `q` and [flavors](#flavor) `f` are equal.

Note: for K = 1, no compression is necessary as the input variables can be constrained to be equal
to the output variables (or the same variables reused for adjacent gadgets).

### Pad

Represents an all-zero [value](#value) `(q, f) = (0, 0)`.
It is implemented as allocation of two variables and two constraints enforcing zero value for each variable.

In case `M == N`, no padding is required as all shuffles have the same number of inputs and outputs.

In case `M > N` (more inputs than outputs), the padding is applied to the _outputs_ to the middle [shuffle](#k-value-shuffle):
prover sorts unnecessary zero [values](#value) coming from [M-merge](#k-merge) to the end of the outputs list,
and verifier constraints them to all-zero tuples.

In case `N < M` (less inputs than outputs), the padding is applied to the _inputs_ to the middle [shuffle](#k-value-shuffle):
prover adds required zero [values](#value) in the clear to the end of the inputs list,
and secretly sorts them in required position for the subsequent [splits](#k-split).

### Mix

A _mix_ gadget proves that two [values](#value) either remain _unchanged_,
or are _redistributed_ with one value being zero.

    Mix(A,B,C,D):
    (a) unchanged:     A = C, B = D
    (b) redistributed: C = 0, D = A+B

_Mix_ is a building block for [K-mix](#k-mix) gadget which is itself a building block for [K-merge](#k-merge) and [K-split](#k-split) gadgets.

In case of redistribution, the verifier allows the flavor of `C` to be anything.
However, the prover must set the whole tuple `C = (q, f)` to zeroes in
order to match the [padding](#pad) that might be necessary in the middle of a [transaction](#transaction).

Boolean expression:

    Mix(A,B,C,D) = OR(
        AND( // move
            A.q == C.q,
            A.f == C.f,
            B.q == D.q,
            B.f == D.f,
        ),
        AND( // distribute
            C.q == 0,
            A.f == B.f,
            D.q == A.q + B.q,
            D.f == A.f,
        )
    )

Mix requires a single challenge variable `w` to combine 6 statements in one (in each branch),
and one multiplier for `OR` statement.

    mul_left  = (A.q - C.q) +
                (A.f - C.f) * w^1 +
                (B.q - D.q) * w^2 +
                (B.f - D.f) * w^3 +
    mul_right = (C.q - 0) +
                (A.f - B.f) * w^1 +
                (D.q - A.q - B.q) * w^2 +
                (D.f - A.f) * w^3
    mul_out   = 0
    --------------------------------------
    1 multiplier, 3 constraints

When computing the proof, the assignments of all input and output values are assumed to be known.

### K-mix

_K-mix_ is a composition of `K-1` [mix gadgets](#mix) connected sequentially.

For a pair of [mixes](#mix) M1 and M2:
* First output of M1 is the first output of K-mix.
* Second output of M1 is the first input of M2.
* Second input of M2 is the last input of K-mix.

```ascii

      3-mix consisting of 2 simple mixes:

      +-----------------------+
      |  +------+             |
    --|--|      |-------------|--
      |  |  M1  |   +------+  |
    --|--|      |---|      |--|--
      |  +------+   |  M2  |  |
    --|-------------|      |--|--
      |             +------+  |
      +-----------------------+
```

When K=1, the K-mix gadget is not necessary: the output value is instead
constrained to be equal to the input value.

### K-merge

_K-merge_ is implemented using a [K-mix](#k-mix) gadget with the same order of variables:

    K-Merge(input_{0..k-1}, output_{0..k-1})
    =
    K-Mix(input_{0..k-1}, output_{0..k-1})

### K-split

_K-split_ is implemented using a [K-mix](#k-mix) gadget with the reversed inputs and outputs
and using inputs as outputs and vice versa:

    K-Split(input_{0..k-1}, output_{0..k-1})
    =
    K-Mix(output_{k-1..0}, input_{k-1..0})

### Range proof

Proves that a given [quantity](#quantity) is in a valid range using a binary representation:
the quantity is a sum of all bits in its bit-representation multiplied by corresponding powers of two, and each bit has either 0 or 1 value.

`n` multipliers `a_i*b_i = c_i` and `1 + 2*n` constraints:

    c_i == 0           for i in [0,n)  // n constraints on multipliers’ outputs
    a_i == (1 - b_i)   for i in [0,n)  // n constraints on multipliers’ inputs
    q = Sum(b_i * 2^i, i = 0..n-1)     // 1 constraint between quantity and the multipliers’ inputs

where:

* `b_i` is a bit and a left input to the `i`th multiplier.
* `a_i` is a right input to an `i`th multiplier set to `1 - b_i` .
* `c_i` is a multiplication result of `a_i` and `b_i`.
* `q` is a [quantity](#quantity).

Computing the proof:

1. The [quantity](#quantity) is assumed to be known and be in range `[0, 2^64)`.
2. Create 64 multipliers.
3. Assign the inputs and outputs of the multipliers to the values specified above.

## Converting boolean expressions

Any gadget that expresses a boolean function of some statements needs to convert it into a form
required by _Rank-1 Constraint System_ (R1CS) which specifies linear constraints between external
commitments and multipliers.

#### 1. Normalize statements

Each statement of the form `a = b` must be converted to a form `c = 0`, where `c = a - b`.

    a = b    ->    a - b = 0

#### 2. Convert a disjunction of statements into a multiplication

Each statement of the form `or(a = 0, b = 0)` is converted into a statement about multiplication: `a*b = 0`.

    a = 0 or b = 0    ->    a*b = 0

This means, each `OR` function requires a multiplier.

#### 3. Convert a conjunction of statements into a polynomial

Each statement of the form `and(a = 0, b = 0)` is converted into a 1-degree polynomial with a unique free variable `x`:

    a + x*b = 0

As an optimization, conjuction of `n+1` statements can use `n`-degree polynomial of the free variable `x`:

    a = 0 and b = 0 and c = 0   ->   a + x*b + x*x*c = 0

Note: the `AND` does not require a multiplier because secrets are multiplied by a non-secret _constant_ `x`.

## Computing assignments

Prover needs to compute exact [scalar](#scalar) assignments for all variables used in all gadgets.
It is typically done at the appropriate gadget: some variables are provided by upstream gadgets,
while others need to be allocated and assigned internally.

#### [Transaction](#transaction) assignments

`M` input and `N` output [values](#value) are assumed to be already assigned and randomly ordered.
The goal is to assign values for all the intermediate variables necessary to connect
[shuffle](#k-value-shuffle), [merge](#k-merge) and [split](#k-split) gadgets.

```
               B
A              B
B              A
A   ---?--->   B
B              B
A              A
               B
```

For the first [M-value shuffle](#k-value-shuffle), the `M` [values](#value) are sorted by [flavor](#flavor):

```
A        A
B        A
A   ->   A
B        B
A        B
```

For the [M-merge](#k-merge) outputs, all values are added up within each [flavor](#flavor) group,
assigning the sum to the _last_ variable in the group, and setting all preceding variables to zeroes:

```
A        0
A        0
A   ->   A_sum
B        0
B        B_sum
```

If `N` is greater than `M`, the list is [padded](#pad) with `|M - N|` all-zero values:

```
0          0
0          0
A_sum  ->  A_sum
0          0
B_sum      B_sum
           0
           0
```

In the second half of the transaction, assign values in reverse order (from end towards the middle).

For the `N` input values of the last [N-value shuffle](#k-value-shuffle), outputs are sorted
by flavor:

```
A       B
A       B
B       A
B   <-  B
B       B
B       A
B       B
```

For the output values of the middle [K-value shuffle](#k-value-shuffle) (`K = max(N,M)`),
all values are added up within each [flavor](#flavor) group, assigning the sum to the _first_ variable
in the group, and setting all subsequent variables in the group to zeroes:

```
A_sum       A
0           A
B_sum       B
0      <-   B
0           B
0           B
0           B
```

If `N` is less than `M` (not the case in this example transaction), the list is [padded](#pad)
with `|M - N|` all-zero values:

```
A_sum       A_sum
0           0
B_sum       B_sum
0      <-   0
0           0
0           0
0           0
0
0
```

Finally, the lists of values on the left and right sides of the middle [K-value shuffle](#k-value-shuffle)
have `K = max(N,M)` values in each, with the same amount of zero values and one non-zero value per flavor,
satisfying the permutation constraint that the outputs are a valid reordering of the inputs.

```
          ____________
0     ---|            |--- A_sum
0     ---|            |--- 0
A_sum ---|  K-value   |--- B_sum
0     ---|  shuffle   |--- 0
B_sum ---|            |--- 0
0     ---|            |--- 0
0     ---|____________|--- 0

(Since N = M + 2, the inputs are padded with two all-zero values.)
```

Note: order of flavors with respect to each other is actually unimportant and can be inconsistent
between the left and right halves of the transaction. It must only be consistent within each half of the transaction.

#### [K-mix](#k-mix) assignments

All input values are assumed to be known.

The intermediate variables connecting inner [mix gadgets](#mix) and output variables are assigned sequentially.
For each [mix](#mix) gadget, its A and B [values](#value) are known, and C and D are to be determined.

1. If A and B have the same [flavor](#flavor), then values are redistributed:
   - Assign D to have quantity `A.quantity + B.quantity` and have flavor equal to `A.flavor` and `B.flavor`.
   - Assign C to have [quantity](#quantity) and [flavor](#flavor) of zero.
2. If A and B have different [flavors](#flavor), then values are unchanged:
   - Assign C to be equal to A.
   - Assign D to be equal to B.

## Future directions

As a step towards protecting the metadata, we need to allow multiple parties to perform
individual transactions using a single circuit making them indistinguishable from a single-party transaction
of the same size. In order to achieve that we will need a multi-party computation protocol
that allows multiple parties compute a joint proof for such combined circuit, while preserving privacy
of the participants with respect to each other.

repository: stellar/slingshot

gha_language: Rust

repo_name: stellar/slingshot


text:
JavaUtils
---------

This repository contains some useful java utility programs.

### PROGRAMS

---

### [Scientific Calculator](https://jorexdeveloper.github.io/JavaUtils/ScientificCalculator/)

A program to evaluate/solve mathematical expressions.

#### FEATURES

* Works with large decimals.
* Supports mathematical constants.
* Supports output of answer in words.
* Stores answer to the previous successful evaluation.

> This program can be used both in code and with the command line (requires at least jre installed).

---

### [Reflector](https://jorexdeveloper.github.io/JavaUtils/Reflector/)

A program to print the details of java classes using reflection.

### FEATURES

* Full Generic Support
* Organized output
* Detailed information

> This program can be used both in java code and with the command line (requires at least jre installed).

---

### [BrainfuckIntereter](https://jorexdeveloper.github.io/JavaUtils/BrainfuckInterpreter/)

A program to interpret brainfuck code.

### FEATURES

* Supports a custom null in character.
* Supports a custom null out character.
* Full brainfuck support.

> This program can be used both in code and with the command line (requires at least jre installed).

---

#### Author : Jore

#### License
```
    Copyright © 2021 Jore

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

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

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

repository: jorexdeveloper/JavaUtils

branch_name: refs/heads/root

repo_name: jorexdeveloper/JavaUtils


text:
# Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [0.0.2]
- tweaked the function to use the simpler `fs.readFile` method

## [0.0.1]
### Added
- initial release version. Extracts all matching selectors into a single (other file)
- test added (Thanks @ben-eb for all his help)

repository: benfrain/postcss-extract-to-file

repo_name: benfrain/postcss-extract-to-file


text:
<!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you 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.
-->

# Installation Guide
This tutorial guides you through the installation and configuration of CarbonData in the following two modes :

* [Installing and Configuring CarbonData on Standalone Spark Cluster](#installing-and-configuring-carbondata-on-standalone-spark-cluster)
* [Installing and Configuring CarbonData on “Spark on YARN” Cluster](#installing-and-configuring-carbondata-on-spark-on-yarn-cluster)

followed by :

* [Query Execution using CarbonData Thrift Server](#query-execution-using-carbondata-thrift-server)

## Installing and Configuring CarbonData on Standalone Spark Cluster

### Prerequisites

   - Hadoop HDFS and Yarn should be installed and running.

   - Spark should be installed and running on all the cluster nodes.

   - CarbonData user should have permission to access HDFS.

### Procedure

* [Build the CarbonData](https://cwiki.apache.org/confluence/display/CARBONDATA/Building+CarbonData+And+IDE+Configuration) project and get the assembly jar from "./assembly/target/scala-2.10/carbondata_xxx.jar" and put in the ``"<SPARK_HOME>/carbonlib"`` folder.

     NOTE: Create the carbonlib folder if it does not exists inside ``"<SPARK_HOME>"`` path.

* Add the carbonlib folder path in the Spark classpath. (Edit ``"<SPARK_HOME>/conf/spark-env.sh"`` file and modify the value of SPARK_CLASSPATH by appending ``"<SPARK_HOME>/carbonlib/*"`` to the existing value)

* Copy the carbon.properties.template to ``"<SPARK_HOME>/conf/carbon.properties"`` folder from "./conf/" of CarbonData repository.

* Copy the "carbonplugins" folder  to ``"<SPARK_HOME>/carbonlib"`` folder from "./processing/" folder of CarbonData repository.

    NOTE: carbonplugins will contain .kettle folder.

* In Spark node, configure the properties mentioned in the following table in ``"<SPARK_HOME>/conf/spark-defaults.conf"`` file.

| Property | Value | Description |
|---------------------------------|-----------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|
| carbon.kettle.home | $SPARK_HOME /carbonlib/carbonplugins | Path that will be used by CarbonData internally to create graph for loading the data |
| spark.driver.extraJavaOptions | -Dcarbon.properties.filepath=$SPARK_HOME/conf/carbon.properties | A string of extra JVM options to pass to the driver. For instance, GC settings or other logging. |
| spark.executor.extraJavaOptions | -Dcarbon.properties.filepath=$SPARK_HOME/conf/carbon.properties | A string of extra JVM options to pass to executors. For instance, GC settings or other logging. NOTE: You can enter multiple values separated by space. |

* Add the following properties in ``"<SPARK_HOME>/conf/" carbon.properties``:

| Property             | Required | Description                                                                            | Example                             | Remark  |
|----------------------|----------|----------------------------------------------------------------------------------------|-------------------------------------|---------|
| carbon.storelocation | NO       | Location where data CarbonData will create the store and write the data in its own format. | hdfs://HOSTNAME:PORT/Opt/CarbonStore      | Propose to set HDFS directory |
| carbon.kettle.home   | YES      | Path that will be used by CarbonData internally to create graph for loading the data.         | $SPARK_HOME/carbonlib/carbonplugins |         |

* Verify the installation. For example:

```
   ./spark-shell --master spark://HOSTNAME:PORT --total-executor-cores 2
   --executor-memory 2G
```

NOTE: Make sure you have permissions for CarbonData JARs and files through which driver and executor will start.

To get started with CarbonData : [Quick Start](quick-start-guide.md), [DDL Operations on CarbonData](ddl-operation-on-carbondata.md)

## Installing and Configuring CarbonData on "Spark on YARN" Cluster

   This section provides the procedure to install CarbonData on "Spark on YARN" cluster.

### Prerequisites
   * Hadoop HDFS and Yarn should be installed and running.
   * Spark should be installed and running in all the clients.
   * CarbonData user should have permission to access HDFS.

### Procedure

   The following steps are only for Driver Nodes. (Driver nodes are the one which starts the spark context.)

* [Build the CarbonData](https://cwiki.apache.org/confluence/display/CARBONDATA/Building+CarbonData+And+IDE+Configuration) project and get the assembly jar from "./assembly/target/scala-2.10/carbondata_xxx.jar" and put in the ``"<SPARK_HOME>/carbonlib"`` folder.

      NOTE: Create the carbonlib folder if it does not exists inside ``"<SPARK_HOME>"`` path.

* Copy "carbonplugins" folder to ``"<SPARK_HOME>/carbonlib"`` folder from "./processing/" folder of CarbonData repository.
      carbonplugins will contain .kettle folder.

* Copy the "carbon.properties.template" to ``"<SPARK_HOME>/conf/carbon.properties"`` folder from conf folder of CarbonData repository.
* Modify the parameters in "spark-default.conf" located in the ``"<SPARK_HOME>/conf``"

| Property | Description | Value |
|---------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|
| spark.master | Set this value to run the Spark in yarn cluster mode. | Set "yarn-client" to run the Spark in yarn cluster mode. |
| spark.yarn.dist.files | Comma-separated list of files to be placed in the working directory of each executor. |``"<YOUR_SPARK_HOME_PATH>"/conf/carbon.properties`` |
| spark.yarn.dist.archives | Comma-separated list of archives to be extracted into the working directory of each executor. |``"<YOUR_SPARK_HOME_PATH>"/carbonlib/carbondata_xxx.jar`` |
| spark.executor.extraJavaOptions | A string of extra JVM options to pass to executors. For instance  NOTE: You can enter multiple values separated by space. |``-Dcarbon.properties.filepath="<YOUR_SPARK_HOME_PATH>"/conf/carbon.properties`` |
| spark.executor.extraClassPath | Extra classpath entries to prepend to the classpath of executors. NOTE: If SPARK_CLASSPATH is defined in spark-env.sh, then comment it and append the values in below parameter spark.driver.extraClassPath |``"<YOUR_SPARK_HOME_PATH>"/carbonlib/carbonlib/carbondata_xxx.jar`` |
| spark.driver.extraClassPath | Extra classpath entries to prepend to the classpath of the driver. NOTE: If SPARK_CLASSPATH is defined in spark-env.sh, then comment it and append the value in below parameter spark.driver.extraClassPath. |``"<YOUR_SPARK_HOME_PATH>"/carbonlib/carbonlib/carbondata_xxx.jar`` |
| spark.driver.extraJavaOptions | A string of extra JVM options to pass to the driver. For instance, GC settings or other logging. |``-Dcarbon.properties.filepath="<YOUR_SPARK_HOME_PATH>"/conf/carbon.properties`` |
| carbon.kettle.home | Path that will be used by CarbonData internally to create graph for loading the data. |``"<YOUR_SPARK_HOME_PATH>"/carbonlib/carbonplugins`` |

* Add the following properties in ``<SPARK_HOME>/conf/ carbon.properties``:

| Property | Required | Description | Example | Default Value |
|----------------------|----------|----------------------------------------------------------------------------------------|-------------------------------------|---------------|
| carbon.storelocation | NO | Location where CarbonData will create the store and write the data in its own format. | hdfs://HOSTNAME:PORT/Opt/CarbonStore | Propose to set HDFS directory|
| carbon.kettle.home | YES | Path that will be used by CarbonData internally to create graph for loading the data. | $SPARK_HOME/carbonlib/carbonplugins |  |

* Verify the installation.

```
     ./bin/spark-shell --master yarn-client --driver-memory 1g
     --executor-cores 2 --executor-memory 2G
```
  NOTE: Make sure you have permissions for CarbonData JARs and files through which driver and executor will start.

  Getting started with CarbonData : [Quick Start](quick-start-guide.md), [DDL Operations on CarbonData](ddl-operation-on-carbondata.md)

## Query Execution Using CarbonData Thrift Server

### Starting CarbonData Thrift Server

   a. cd ``<SPARK_HOME>``

   b. Run the following command to start the CarbonData thrift server.

```
./bin/spark-submit --conf spark.sql.hive.thriftServer.singleSession=true
--class org.apache.carbondata.spark.thriftserver.CarbonThriftServer
$SPARK_HOME/carbonlib/$CARBON_ASSEMBLY_JAR <carbon_store_path>
```

| Parameter | Description | Example |
|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------|
| CARBON_ASSEMBLY_JAR | CarbonData assembly jar name present in the ``"<SPARK_HOME>"/carbonlib/`` folder. | carbondata_2.10-0.1.0-incubating-SNAPSHOT-shade-hadoop2.7.2.jar |
| carbon_store_path | This is a parameter to the CarbonThriftServer class. This a HDFS path where CarbonData files will be kept. Strongly Recommended to put same as carbon.storelocation parameter of carbon.properties. | ``hdfs//<host_name>:54310/user/hive/warehouse/carbon.store`` |

### Examples

   * Start with default memory and executors

```
./bin/spark-submit --conf spark.sql.hive.thriftServer.singleSession=true
--class org.apache.carbondata.spark.thriftserver.CarbonThriftServer
$SPARK_HOME/carbonlib
/carbondata_2.10-0.1.0-incubating-SNAPSHOT-shade-hadoop2.7.2.jar
hdfs://hacluster/user/hive/warehouse/carbon.store
```

   * Start with Fixed executors and resources

```
./bin/spark-submit --conf spark.sql.hive.thriftServer.singleSession=true
--class org.apache.carbondata.spark.thriftserver.CarbonThriftServer
--num-executors 3 --driver-memory 20g --executor-memory 250g
--executor-cores 32
/srv/OSCON/BigData/HACluster/install/spark/sparkJdbc/lib
/carbondata_2.10-0.1.0-incubating-SNAPSHOT-shade-hadoop2.7.2.jar
hdfs://hacluster/user/hive/warehouse/carbon.store
```

### Connecting to CarbonData Thrift Server Using Beeline

```
     cd <SPARK_HOME>
     ./bin/beeline jdbc:hive2://<thrftserver_host>:port

     Example
     ./bin/beeline jdbc:hive2://<IP_ADDRESS>:10000
```

repository: sathishvit/incubator-carbondata

repo_name: sathishvit/incubator-carbondata


text:
# Dispatch exposes inner function

Dispatch return the inner function. Can be useful to wait for action to complete.

```javascript
const myAction = () => dispatch => {
    return dispatch(new Promise())
}

myAction.then(...)
```

repository: lgraubner/til

repo_name: lgraubner/til


text:
---
title: Bitcoin is our Friend, not Food.
date: "2021-09-03"
description: "As a famous shark once said.."
---

# Laying out geopolitics of BTC and its rise in the MMT future.

As we have learned throughout history many times before, paper money will at some point lose confidence. It is a trade-off in providing the entire world with a currency we risk the falling purchasing power if our USD becomes less used today than before.

### disclaimer: "not predicting anything or saying the world is going to end"

My observation has been noticing a trend in which it is highly plausible that we see a world in which China returns to or attempts a gold-back Yuan. If they do such a thing, it will only mean it is an attempt to generate more **confidence** in their currency.

A counter move the USA needs to implore is the idea that Gold is merely a religious relic. The critic might say, " but is thou Bitcoin not thy Same?" In the ability to discuss nuance it is not.

Bitcoin makes sending money anywhere with internet access an easy possibility to transmit money across the globe.

The other benefit that Bitcoin has developed is that, for now, it seems to be a great way to hedge against speculative attacks on your native currency. If your native currency is in constant flux then Bitcoin might actually be a safer currency.

My goal is not to get you to take out loans and loans to buy Bitcoin. It is to reason an awareness of a silent fight going on, it is the **Currency War**.

# the silent War

the war that is taking place in the central banks is one that has been going on for sometime now. It is one in the rise of CCP in China and their goal to destroy confidence in the USD and instill greater confidence in the Yuan. The move to gold backed currency would greatly increase the legitimacy and optics of a currency that isn't totally at the control of a government. While it wouldn't change much in the transparency of such information. The most logical counter move would be to erode the trust in gold while going the opposite end rooted in "trust" via the blockchain, Bitcoin.

Bitcoin is the next evolution of what gold provided. The game theory of Bitcoin that will play out needs to happen in the States, ideally in the smaller states that could benefit from the externalities of enabling Bitcoin payments. Mining bitcoin with external flaring from natural gas plants is incredibly important. That alone could not only cut down on emission, it also economically makes sense.

# What does this mean for Bitcoin?

It means soon Bitcoin will have to step up to a 9-10 trillion dollar market. The way Bitcoin has taken over the entire digital realm is one of the reasons we must look to counter the rise of any gold backed currencies. A wonderful more optimistic view of what the US should do is well articulated in this article

[The Fiat Dollar System Is No Privilege: The Burden And Why The U.S. Will Adopt Bitcoin](https://bitcoinmagazine.com/.amp/markets/how-bitcoin-could-replace-the-u-s-dollar)

to keep it brief, the larger trends all seem to be pointing back to a need to build back and not be so focused on the global economy. Bitcoin would be the most obvious way to challenge the trust of gold and maintain the openness of the USD.


text:
![](./docs/logo_white_framed.png "Slicebox") Slicebox
=====================================================

This is a project gathering integration code for using Slicebox from Matlab, and other Slicebox-related Matlab code.

Introduction
------------

The Matlab integration uses the REST API to connect to an instance of slicebox. Several scripts and are provided which can be used to retrieve image information and dicom files. There is also a simple GUI which can list patients and series, show some very basic image information and can be used to retrieve images. Note that the GUI is created using Matlab for OSX, which limits its usefulness on other OS due to differences in font size etc.

Matlab 2015a or later is required to use these scripts.

For more detailed descriptions of file usage and usage examples, the comments in the function files.

### Getting started

* Clone the repository and find the files in [./src/main/matlab/slicebox-integration](src/main/matlab/slicebox-integration).
* Edit the [./src/main/matlab/slicebox-integration/sbxsettings.conf](sbxsettings.conf). The file only contains two options, an url to an instance of slicebox (defaults to localhost:5000) and the path to a cache directory where dicom files and some offline data will be saved to allow offline usage of the GUI.
* Start `SBXGui_osx` in Matlab 2015a or later. Normal usage is `SBXGui_osx(username, password)`, but other options can be entered as well, see the readme.

File descriptions
-----------------

For more in depth usage documatation, read the in-file comments.

* `makesbxdata` - use this function to create an container for all the settings required to connect to a slicebox instance. The function will read some settings from the file `sbxsettings.conf` if it exists in the active matlab directory.
* `sbxgetflatseries` -- use this function to retrieve a flattened image of the patient database on the slicebox server. This can be used to manually browse through patients, studies or series, but is mainly used to populate the tables in the gui. Every time the function is used it will save the flattened image to the cache folder. If the server is offline or otherwise unreachable, the function will try to use the cached version instead.
* `sbxgetimageinfo` -- use this function to retrieve the information required to download the images in a series. The image information is saved to the cache directory and if the slicebox server is offline or otherwise unrechable the function will try to use the cached version.
* `sbxreadimages` -- this function will download the specified images and dicom headers from the slicebox server. The images will be saved in the cache directory, if not already present. If present, the images will be read from the cache instead.
* `sbxreadseries` -- will download the images and their dicom headers of the specified series. The images will be saved in the cache directory, if not already present. If present, the images will be read from the cache instead.
* `SBXGui_osx` -- provides a simple gui to select and download images from a slicebox server. Start the gui, providing a username and password, select a patient in the upper table and then select a series in the bottom table. Press Load to download the images. The GUI will terminate when all the images have been downloaded. The images will be saved in the cache directory, if not already present. If present, the images will be read from the cache instead. This GUI works best with OSX, but can be used with other OSes as well. You will find that when used with a different os, the font size will be slightly too large.

Example Usage
-------------

There are three ways of retrieving images. In all three cases, a `sbxdata` object must first be created, like so:

```
sbxdata = makesbxdata(username, password);
```

provided a `sbxsettings.conf` file exists. Otherwise the options `cachepath` and `url` must also be provided. Don't forget to use specify the port in the url!

If the seriesid is known (you can find this by browsing the slicebox online interface, or by looking through the output of `sbxgetflatseries`), use `sbxreadseries`

```
[I, dcminfo] = sbxreadseries(sbxdata, seriesid);
```

If you only want certain images from a series, you can first read the imageinfo, choose the images you want and then use `sbxreadimages` to load them.

```
imageinfo = sbxgetimageinfo(sbxdata, seriesid);
[I, dcminfo] = sbxreadimages(sbxdata, imageinfo(2:6));
```

To start the gui just write

```
[I, dcminfo] = SBXGui(username, password);
```

Again, if the `sbxsettings.conf` doesn't exist, you must provide the `cachcepath` and `url` options.

Slicebox API
------------

A full specification of the Slicebox API is available at [slicebox.github.io/slicebox](http://slicebox.github.io/slicebox).

License
-------

Slicebox is released under the [Apache License, version 2.0](./LICENSE).

repository: slicebox/slicebox-matlab

repo_name: slicebox/slicebox-matlab


text:
---
title:  inSpect
date:  28/01/2020
---

#### inSpect

How do the following verses relate to the primary passage?

`John 9:41; 12:35; 13:17`

`2 Peter 2:21`

`Revelation 16:12; 18:1–10`

`Isaiah 45:1`

What other verses/promises come to mind in connection with Daniel 5?

``

repository: Adventech/sabbath-school-lessons

branch_name: refs/heads/stage

gha_license_id: MIT

repo_name: Adventech/sabbath-school-lessons


text:
**CoffeeScript is a little language that compiles into JavaScript.** Underneath that awkward Java-esque patina, JavaScript has always had a gorgeous heart. CoffeeScript is an attempt to expose the good parts of JavaScript in a simple way.

The golden rule of CoffeeScript is: _“It’s just JavaScript.”_ The code compiles one-to-one into the equivalent JS, and there is no interpretation at runtime. You can use any existing JavaScript library seamlessly from CoffeeScript (and vice-versa). The compiled output is readable, pretty-printed, and tends to run as fast or faster than the equivalent handwritten JavaScript.

**Latest Version:** [<%= fullVersion %>](https://github.com/jashkenas/coffeescript/tarball/<%= fullVersion %>)

```bash
# Install locally for a project:
npm install --save-dev coffeescript

# Install globally to execute .coffee files anywhere:
npm install --global coffeescript
```

repository: jashkenas/coffeescript

gha_language: CoffeeScript

repo_name: jashkenas/coffeescript


text:
@annotate: folktale.core.lambda.partialize
category: Partialization / Currying
throws:
  - TypeError: when the number of arguments given doesn't match the arity.
---
Creates a new function where some of the arguments are specified.

## Example::

    const partialize = require('folktale/core/lambda/partialize');

    const clamp = (min, max, number) =>
      number < min ?  min
    : number > max ?  max
    :                 number;

    const _      = partialize.hole;
    const clamp_ = partialize(3, clamp);

    const atLeast = clamp_(_, Infinity, _);
    const atMost  = clamp_(-Infinity, _, _);

    atLeast(3, 2); // ==> 3
    atLeast(3, 5); // ==> 5

    atMost(5, 3);  // ==> 3
    atMost(5, 10); // ==> 5

## Why Partialisation

With higher-order programming, one often wants to specialise some of
the arguments of a function before passing it to another function.
This kind of configuration is often done by creating a new function
manually::

    const plus = (a, b) => a + b;
    const add5 = (x) => plus(5, x);

    [1, 2, 3].map(add5);
    // ==> [6, 7, 8]

And for most cases this is reasonable. For functions that take more
parameters, this can be cumbersome, however. The `partialize` function
allows creating a new function by specialising some of the arguments,
and filling the remaining ones when the function is called.

Places where the caller of the function should fill are specified as
`hole`, which is a special constant used by `partialize`::

    const partialize = require('folktale/core/lambda/partialize');

    const _ = partialize.hole;
    const partialAdd5 = partialize(2, plus)(5, _);
    [1, 2, 3].map(partialAdd5);
    // ==> [6, 7, 8]

## Relation to Currying

Partial application and currying are related concepts. Currying
refers to transforming a function of arity N, into N functions of
arity 1. Partial application, on the other hand, refers to
fixing some (but not all) arguments of a function.

Both concepts are used to improve function composition, where the
shape of the function you have does not reflect the shape of the
function expected by function you're calling. So, in essence, these
techniques transform the shape of your function to make them "fit"
some API.

`partialize` and `curry` differ on how they achieve this, however.
While `curry` creates N functions, and lets you specify arguments
one by one, `partialize` requires you to specify all arguments at
once, distinguishing which ones are fixed, and which ones have to
be provided (using "holes").

Because of this, `curry` can be more natural, but it requires that
the APIs be designed thinking about currying before hand, and it
often interacts poorly with JavaScript, due to the use of variadic
functions. `partialize` does not have such problems.

## How `partialize` Works?

The `partialize` function transforms regular functions into
functions that can accept holes for arguments that are not
defined yet. Whenever a partial function receives a hole as
an argument, it constructs a new function so the holes can
be filled later::

    const partialize = require('folktale/core/lambda/partialize');

    const clamp = (min, max, number) =>
      number < min ?  min
    : number > max ?  max
    :                 number

    const partialClamp = partialize(3, clamp);

In the example above, `partialClamp` is a function that takes
arguments that may or may not be holes. A hole is a special
constant defined by `partialize` itself. It's convenient to
bind such constant to the `_` binding::

    const _ = partialize.hole;

A partial function is considered saturated when, among the
arguments provided to it, no hole exists. When a partial function
is saturated, its original behaviour is executed::

    partialClamp(3, 5, 6);  // ==> 5

If a partial function is not saturated, then it its execution
results in a new partial function::

    const atLeast = partialClamp(_, Infinity, _);
    atLeast(5, 3); // ==> 5

    const atLeast5 = atLeast(5, _);
    atLeast5(3); // ==> 5

Note that to prevent confusing behaviour, Folktale's `partialize`
forces you to always pass the exact number of arguments that the
partial function expects. Passing more or less arguments to a
partial function is a TypeError. This ensures that all new partial
functions can properly invoke the original behaviour when saturated,
rather than returning previous unsaturated functions.

## Drawbacks of Using `partialize`

`partialize` is a convenience function for transforming the shape
of functions, and it relies on variadic application, as well as
doing a fair bit of processing before each call to determine
saturation. Combined, these make `partialize` a poor choice for
any code that needs to be performant.

@annotate: folktale.core.lambda.partialize.hole
category: Special values
---
Represents a place in an argument list that needs to be filled.

repository: dChunikhin/folktale

repo_name: dChunikhin/folktale


text:
# yalookup
[![NPM](https://nodei.co/npm/yalookup.png?compact=true)](https://nodei.co/npm/yalookup/)
[![build status](https://secure.travis-ci.org/bzb-stcnx/yalookup.png)](http://travis-ci.org/bzb-stcnx/yalookup)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)

yet another lookup!
look for a file searching from the current or a given directory up.

# motivation
very lean recursive implementation restricted to using only node's core modules.
* no glob
* only one option (cwd)
* only synchronous
* no cli

at least for now.

# usage
## example
search from `__dirname` upwards for `package.json`:
```javascript
var lookup = require('yalookup')
var filepath = lookup('package.json', { cwd: __dirname })
```

## signature
**lookup(filename: `string`, options: `object`): `string`**
* **filename** `string` plain text name of the file, no support for glob
* **options** `object` currently only supports a single option:
  * **cwd** `string` the directory to start searching upwards from,
  defaults to `process.cwd()`
* **return** `string` the filepath of the file if found, `null` otherwise

# status
[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)

# license
(C) Copyright 2015, bzb-stcnx,
all rights reserved.
[MIT](./LICENSE)

repository: bzb-stcnx/yalookup

repo_name: bzb-stcnx/yalookup


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

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [1.1.0] - 2017-09-20
### Added
- Code is now simplier and more clean.
### Changed
- Now you don't need your Client Secret to authenticate, so you don't have to store it into your client.
- The Progress View now uses the new block-based KVO.
### Removed
- On successful logins, the information about the authenticated user is not returned any more, just the access token.

## [1.0.3] - 2017-09-13
### Fixed
- The progress view now automatically adjusts, regardless of top bar height.

## [1.0.2] - 2017-09-10
### Added
- Carthage support.

## [1.0.1] - 2017-09-09
### Added
- Travis CI support.
### Fixed
- Pod configuration files.

## 1.0.0 - 2017-09-09
### Added
- Initial release of IGAuth.

[Unreleased]: https://github.com/AnderGoig/IGAuth/compare/v1.1.0...HEAD
[1.1.0]: https://github.com/AnderGoig/IGAuth/compare/v1.0.3...v1.1.0
[1.0.3]: https://github.com/AnderGoig/IGAuth/compare/v1.0.2...v1.0.3
[1.0.2]: https://github.com/AnderGoig/IGAuth/compare/v1.0.1...v1.0.2
[1.0.1]: https://github.com/AnderGoig/IGAuth/compare/v1.0.0...v1.0.1

repository: sharemyknowledge/IGAuth

repo_name: sharemyknowledge/IGAuth


text:
---
layout: post
title: "Reinforcement Learning"
category: DL
tags: []
date:   2019-07-21 13:25:35 +0200
---

## Markov Decision Process(MDP)

![](https://strongman1995.github.io/assets/images/2019-07-21-RL/1.png)

![](https://strongman1995.github.io/assets/images/2019-07-21-RL/2.png)

## Policy

A policy $$\boldsymbol{\pi} : \mathcal{S} \rightarrow \mathcal{A}$$ specifies what action to take in each state

- Deterministic policy: $$a=\pi(s)$$ (for a state, only one action is taken)
- Stochastic policy: $$\pi(a \| s)=P(a \| s)$$ (requires sampling to take action)

Objective: find optimal $$\boldsymbol{\pi}^{*}$$ to maximize the expected sum of rewards
$$
\pi^{*}=\operatorname{argmax} \mathbb{E}\left[\sum_{t \geq 0} \gamma^{t} r_{t} \| \pi\right]
$$
with $$s_{0} \sim p\left(s_{0}\right), a_{t} \sim \pi\left(\cdot \| s_{t}\right), s_{t+1} \sim p\left(\cdot \| s_{t}, a_{t}\right)$$

![](https://strongman1995.github.io/assets/images/2019-07-21-RL/3.png)

## Value Function

- (State) Value function is a prediction of the future reward

  - How much reward will I get from state s under policy $$\pi$$

  $$
  V^{\pi}(s)=\mathbb{E}\left[\sum_{t \geq 0} \gamma^{t} r_{t} \| s_{0}=s, \pi\right]
  $$

- (Action) Q-value function (quality) is a prediction of the future reward

  - from state s and action a, under policy $$\pi$$

  $$
  Q^{\pi}(s, a)=\mathbb{E}\left[\sum_{t \geq 0} \gamma^{t} r_{t} \| s_{0}=s, a_{0}=a, \pi\right]
  $$

- Optimal Q-value function is maximum value under optimal policy $$\pi^*$$
  $$
  Q^{*}(s, a)=\max _{\pi} Q^{\pi}(s, a)=Q^{\pi^{*}}(s, a) \Rightarrow \pi^{*}(s)=\underset{a}{\operatorname{argmax}} Q^{*}(s, a)
  $$

## Bellman Equation

Q-value function can be decomposed into a Bellman equation
$$
Q^{\pi}(s, a)=\mathbb{E}_{s^{\prime}, a^{\prime}}\left[r+\gamma Q^{\pi}\left(s^{\prime}, a^{\prime}\right) \| s, a, \pi\right]
$$
Optimal Q-value function also decomposes into a Bellman equation
$$
Q^{*}(s, a)=\mathbb{E}_{s^{\prime}}\left[r+\gamma \max _{a^{\prime}} Q^{*}\left(s^{\prime}, a^{\prime}\right) \| s, a\right]
$$
![](https://strongman1995.github.io/assets/images/2019-07-21-RL/4.png)

# Value-based RL

- Estimate the optimal Q-value function $$Q^{*}(s, a)$$
- This is the **maximum value** achievable under any policy

## Q-Learning(DQN)

Represent the Q-value function by **Q-network** with weights w
$$
Q(s, a, w) \approx Q^{*}(s, a)
$$
![](https://strongman1995.github.io/assets/images/2019-07-21-RL/5.png)

### Lookup Table

Optimal Q-values should obey the Bellman equation
$$
Q^{*}(s, a)=\mathbb{E}_{S^{\prime}}\left[r+\gamma \max _{a^{\prime}} Q^{*}\left(s^{\prime}, a^{\prime}\right) \| s, a\right]
$$
Treat the right-hand side $$r+\gamma \max _{a^{\prime}} Q^{*}\left(s^{\prime}, a^{\prime}, w\right)$$ as a target

Minimize MSE loss by SGD:
$$
l=\left(r+\gamma \max _{a^{\prime}} Q^{*}\left(s^{\prime}, a^{\prime}, w\right)-Q(s, a, w)\right)^{2}
$$

- Converges to Q* using table lookup representation (Q-table)
  $$
  Q_{t+1}(s_t, a_t)=Q_{t}\left(s_{t}, a_{t}\right)+\alpha\left(r_{t+1}+\gamma \max _{a} Q_{t}\left(s_{t+1}, a\right)-Q_{t}\left(s_{t}, a_{t}\right)\right)
  $$

- But diverges using neural networks due to
  - Correlations between samples: to remove correlations, build dataset from agent's own experience
  - Non-stationary targets: to deal with non-stationarity, target parameters w' are held fixed

### Improvements to DQN

- Double DQN
- Prioritized replay
- Dueling network

# Policy-based RL

- Search directly for the optimal policy $$\pi^{*}=\pi^{*}(a \| s)$$
- This is the **policy** achieving maximum future reward

### Policy Network

directly output the probability of actions $$p\left(a_{t} \| s_{t}\right)$$ without learning the Q-value function

- Guaranteed convergence to local minima
- High-dimensional (continuous) action spaces
- Stochastic policies (exploration/exploitation)

## Policy Gradient(Reinforce)

policy gradients is exactly like supervised learning, except for:

- no correct label
  - use fake label: sample action from policy
- training when **an episode** is finished
- scaled by **the episode reward**
  - increase the log probability for actions that worked

![](https://strongman1995.github.io/assets/images/2019-07-21-RL/6.png)

### Training protocol

For episode in range(max_episodes):

observation = env.reset()

While true (For each timestep) :

1. action = choose_action(observation)

2. observation_, reward, done = env.step(action)

3. store(observation, action, reward)

4. if done:

   	feed-forward policy network maximize $$\sum_{t} J(\tau ; \theta) \log p\left(a_{t} \| s_{t}\right)$$

   break

5. observation = observation_

![](https://strongman1995.github.io/assets/images/2019-07-21-RL/7.png)

# Q-Learning vs. Policy Gradient

- Policy Gradient
  - very general but suffer from high variance so requires a lot of samples
  - Challenge: sample-efficiency
- Q-learning
  - Does not always work but when it works, usually more sample-efficient
  - Challenge: exploration
- Guarantees
  - Policy Gradient: Converges to a local minima of $$J(\theta)$$, often good enough
  - Q-learning: Zero guarantees since you are approximating the Bellman equation with a complicated function approximator


text:
---
layout: post
title:      "What I've learned about JavaScript - 1"
date:       2019-07-12 17:37:11 +0000
permalink:  what_ive_learned_about_javascript_-_1
---

After months of studying and playing around with Ruby, the curriculum took me to JavaScript. Here is a summary of what I have learned about it so far. In the rest of the article I will refer to JavaScript as JS.

## Back to Basics

### A short introduction

It is commonly said and written that JS is the programming language of the web. Along with **HTML** - *HyperText Markup Language*, for the content - and **CSS** - *Cascading Style Sheets*, for the styling - it is used in most of the web pages. JS handles most of the **dynamic behaviour** of websites. It reacts to user **events** - scrolling, clicking, zooming in or out and so on - and changes the page's content **without requiring a full reload** of the page. HTML elements that change when interacted with are targetted by their *class* or *id*, just like in CSS.

When you hover a button and it wiggles in anticipation, when you see new notification alerts without refreshing the page, when content progressively appears at the botton of the page when you scroll, when you zoom in or out on Google Maps, it's all JS. JS is a very popular language and is the only **programming languag**e that can run in every major browser - HTML is a **markup language** and CSS is a **style sheet language**.

JS is a **flexible** language that allows us to program in many different styles - functional or object-oriented - mixing and matching concepts to **adapt** the each situation's need.

### A history

The firsy version of JS was built in about 10 days in **1995**. There were other competitors trying to build the language of the web, who did not succeed. After that, there were only **minor improvements** to JS.

Around the turn of the century, Microsoft decided they wanted to give their customers a way to **access their emails in the browser**. To do so, they added a JS functionality that allowed an **already loaded page to fire off requests for additional data**. The process of making requests for additional data became known as *Asynchronous JavaScript and XML*, or **AJAX**. JS became very popular in 2004 when Gmail came around with a heavy dependence on AJAX.

Even though AJAX brought a lot of functionalities, JS was still different to program, different browsers implemented things differently and everyone had they own idea of how the language should be. in 2009, everyone agreed on **standardisation**. There came **ES5** - fifth version of JS, sometimes referred to as **Harmony**. After harmonisation came the need for **modern language features** that or major languages had. These concerns were addressed from 2015 with **ES6**.

### What about compilation?

As a note, JS and Java have pretty much nothing in common and the name JavaScript was chosen for **marketing** reasons, since Java was highly popular in 1995. Unlike Java, JS code doesn't need **compilation**. This means that the code written by the developer is the **same as** the code that the web browser parses and run, whereas a compiled language, the code the developer writes is a human readable code that needs to be **translated**, *ie* compiled, for the machine to understand it. The latter means that reading the source code and debugging is less straightforward.

### In-browser dev tools

All major browsers come with their own **built-in developer tools** that can be used to inspect, modify and debug the content of a web page. The **console** is an environement in the browser where we can type and run random JS code, in the context of the current browser window. We say the console is **sandboxed**, because it can only access the resources that are loaded on the ucrrent page.

To make **debugging** easier, JS comes with a number of built-in features. One of the simplest is the ```alert()``` function which simply creates an alert in the browser window.

### About syntax and best practices

In JS, ending each **statement** with a **semicolumn** is optional. When running some code in the browser, the JS engine makes several passes over the same code:
- The first pass **parses** the syntax of the code. The engine proceeds to *automatic column insertion* but semicolumns are part of the JS syntax, whether you insert them yourself or the engine does it for you.

- The second pass **initialises** variables and functions and **stores** them in memory.
- The third pass **executes** the code line by line.

Most programmers consider the first and second passes the **compilation phase**. JS makes sure the code is readable and sets it up for running. The same way, the third phase is referred to as the **execution phase**. Teh code is then run top to bottom and left to right.

### Data types

One of the most profound philosophical problems is about **abstraction** and how humans do it. Abstraction is about making a subject general rather than based on real life examples or instances. In JS **concrete instances of data** can be categorised into abstract names, called *data types* or *types*.

In JS, everything is **data** except:
- Operators: ```+```, ```-```, ```!```, ```=```...

- Reserved words: ```function```, ```for```, ```const```...

Every piece of data falls into one of JS's **seven** data types:
- **Numbers**: some programming languages divide numbers into **several categories that allow better precision is calculations**: integers, decimals, doubles, floats... When JS was created, a deep level of precision for calculations was not required. Consequently, all numbers are stacked into **one category**. As a note, this lack of precision kept JS from entering **industries** where **precision** is essential like banking or engineering.

- **Strings**: are how we represent text in JS. A string consists in a pair of **matching** single quotes, double quotes or backticks with **0 or more** characters in between.
For **string interpolation**, use backticks and ```${}```.

- **Booleans**: a boolean can only be one of two possible values - *true* or *false*.

- **Symbols**: relatively new data type that is mainly used as an alternate way to add properties to an abject.

- **Objects**: objects are a **collection of properties** linked by curly braces, similar to a hash in Ruby. A property can point to a **value of any type**, including other objects. In JS's perspective, an **array** is a special type of object where the properties are numbers - the array's indexes.

- ```null```: represents an **intentionally absent object,** *eg* if a piece of code returns an object when successful, we might want it to return ```null``` when failing. When calling the ```typeof``` operator on ```null``` it returns a data type of *object*.

- ```undefined```: does not mean something is strictly not defined, but rather that is it **not assigned a value yet**. Any **variable** that is declared but not defined will return ```undefined```.

N.B. The ```typeof``` operator accepts one argument - the piece of data we want to know the type of - and returns the type. Since ```typeof``` is an operator there is no need for parentheses.

N.B. 6 of the 7 data types are called *primitive*. This means that they all **represent single values**, whereas an *object* represents a **collection of values**.

What happens when we mix up data types? Some languages like Python are very **strict** about it and will refuse to compile a program if types and mixed. Other languages like Ruby will **attempt a convertion** of one of the data types to have only one type to handle, but will throw errors for non obvious cases. JS, however, will **return something in any case** even if that something makes little or no sense. Sometimes it makes sense:

``` 'Give me' + 5 + '!'; ``` will return ```"Give me 5!"```

Some other times it is rather comical:

``` null ** 2 ```, *ie* ```null``` to the power of 2, will return ```0```.

``` undefined ** null```, *ie* undefined to the power of null, will return ```1```.

```{} + {}```, *ie* empty object + empty object, will return ```"[object Object][object Object]"``` which is a string and not an object.

### Variables

*A variable is a container in which we can store values for later retrieval. *

In order to retrive the correct piece of stored data, we **name** variables - *ie* we give them an *identifier* - following these 3 rules:
- Start every variable name by a **lowercase letter**.

- Don't use **spaces**, **camelcase** - variableName - them and do not **snake** them - variable_name.

- Don't use JS **reserved** or future reserved words.

N.B. In JS, **case matters**. javaScript, javascript, JavaScript and JAVASCRIPT are four different names.

```var``` is a special word in JS. It means that the word that comes next is a **variable identifier**.

A variable is first **declared** and then **assigned**. Either one after the other:

```var pi;```

```pi = 3.14159;```

or do both at the same time:

``` var pi = 3.14159;```

Both methods are commonly used.

To retrieve a declared variable, simply refer to its name: ```pi;```.

#### About variable values

Upon **declaration**, all variables are **automatically** assigned the value of ```undefined```. It is only after a new value is **assigned** that the variable will contain something else.

When writing JS code it is bet practice to **never** manually assign ```undefined``` to a variable. Encountering and ```undefined``` is a strong signal that the variable was **declared** before being **referenced**. It is valuable information when debugging.

Once a variable has been declared with ```var```, we can **reassign** it as many times as we want. The data stored in a variable might **change** over time, but its current value can be **retrieved** at any point.

#### ```const``` vs ```let``` vs ```var```

```var``` is present in code written before 2015 and ES5. However it comes with a lot of **scope issues**. For example, with ```var``` no error is thrown if we declare two variables with the same **identifier**. Since there is no reason to declare a variable twice it is usually a mistake that should throw an error.

```let``` was introduced in ES5. It allows us to **reassign** a variable as much as we like but throws an **error** if we try to declare the same variable twice.

```const``` is a good default to have. With it, a variable cannot be **redeclared** or **reassigned**. The latter is good for 3 reasons:
- When assigning a **primitive value**, we know it will always contain the **exact same** value.

- When assigning an **object**, the variable will always point to the **same object**, although the object itself can be **modified** over time.

- When a developer sees a variable declared with ```const``` they know it will point ot the exact **same object** or have the exact **same value** every single time it is **referenced** in the program.

N.B. With ```let``` it is possible to declare a variable without assigning it a value. However, since ```const``` does not allow reassignment, a value must be assigned at the same time as declaration.

As a general rule for declaring variables, use ```const``` as **often** as possible, unless you know that it will have to be **reassigned** at some point, in which case ```let``` should be used. Do not use ```var``` because of the **scope issues** it creates.

### Control Flow

Control flow is an **essential** concept in all programming languages. According to Wikipedia:

> In computer science, control flow (or flow of control) is the order in which individual statements, instructions or function calls of an imperative program are executed or evaluated

Control flow starts with **comparison**. The value returned by a comparison is always **true** or **false**.

In JS, there are 4 built-in equality operators:
- Loose equality operator ``` == ```
- Strict equality operator ``` === ```
- Loose inequality operator ``` != ```
- Strict inequality operator ``` !== ```

It is always preferred to use **strict operators**. Indeed, the loose operators will **return true** even if the **data types** are **different**.

There are also 4 built in relational operators:
- Greater than ``` > ```
- Greater than or equals ``` >= ```
- Less than ``` < ```
- Less than or equals ``` <= ```

These operators work in a similar way to the equality operators. However, be careful of **type conversion** when comparing numbers and non numbers.

Strings are compared with each other **lexicographically**. This means character per character left to right. The **Unicode value** of each character is compared leading to ``` '88' > '9' ``` returning ``` false ```.

Generally speaking, try and stick to comparing **numerical values** with each other.

An **expression** is a unit of code that returns a value. **Primitive values** - all data types except objects - are expressions. So are **string and arithmetic** operations. The same goes for **comparison**,  **assignment** and **referencing** operations. Variable **declarations**, however, are not expressions.

**Block** statements - *ie* pairs of curly braces used to group JS statements - play a role in **conditional** statements. They return the value of the last evaluated expression inside the curly braces.

The **truthiness** and **falsiness** indicate what happens when the value is converted into a **boolean**. In JS **falsy** values are:
- ``` false ```
- ``` null ```
- ``` undefined ```
- ``` 0 ```
- ``` NaN ```
- empty strings

Every other value is **truthy**.

To check whether a value is truthy or falsy, pass it to the global ```Boolean``` object.

There are 3 main **conditional statements** in JS:
- ``` if...else ```: fairly straightforward structure. As soon as one of the conditions returns a **truthy value** the block of code is executed and the conditional **exits**.

     ```
if (condition) {
} else if (condition) {
} else {
}
```

- ``` switch ```: is the solution to **run multiple blocks** in the same control flow. It is generally used if a conditional that hinges on a **single value** but requires a **specific handler** for each case is needed.

     ```
switch (expression) {
     case value1:
        // statements
        break;
     case value2:
        // statements
        break;
     default:
        // statements
        break;
}
```
- **Ternary operator**: is a good way to represent and ``` if...else ``` statement on one line.

   ``` condition ? expression1 : expression2;```

The last part of control flow is **logical operators**:
- ``` ! ``` is used to **negate** an expression

- ``` !! ``` is used to convert an expression to a boolean
- ``` && ``` and ``` || ``` are used to link conditions

### Intro to Functions

Functions are the most important unit of code in JS. They serve as ways to **group related bits of JS** together.

We have already talked about abstraction earlier in this article. Functions **combine** series of steps under a **new name**. Consequently they are **abstractions**.

> A function is an object that contains a sequence of JavaScript statements. We can execute or *call* it multiple times - Flatiron School
>

Call a function means run the independent pieces that constitute it. To do so, add ``` () ``` after its name. Before calling a function, it has to be **declared**. When declaring a function, the ideal is to have it as **general** as possible, in order to be able to use the same function for as many situations as possible. Using **parameters**, **arguments** and **string interpolation** is a way of doing it.

Sometimes, it can be helpful to send something back to the place where the function was executed. That's where **return values** come in. When a function is called, it returns the value found on the right of the ``` return ``` keyword when it encounters it. Once the ``` return ``` keyword is reached, nothing else happens. Return values can be saved to **variables** or used as **inputs** to other functions.

extension: markdown


text:
# WP2TXT

Wikipedia dump file to text converter

     CAUTION: This software is on an experimental stage. Use with care!

### About ###

WP2TXT extracts plain text data from Wikipedia dump file (encoded in XML/compressed with Bzip2) stripping all the MediaWiki markups and other metadata. It is originally intended to be useful for researchers who look for an easy way to obtain open-source multi-lingual corpora, but may be handy for other purposes.

### Features ###

* Convert dump files of Wikipedia of multiple languages (I hope).
* Create output files of specified size.
* Allow users to specify text elements to be extracted/converted (page titles, section titles, lists, and tables).

WP2TXT before version 0.4.0 came with Mac/Windows GUI. Now it's become a pure command-line application--Sorry GUI folks, but there seems more demand for an easy-to-hack CUI package than a not-very-flexible GUI app.

### Installation

    $ gem install wp2txt

### Usage

Obtain a Wikipedia dump file (see the link below) with a file name such as:

    xxwiki-yyyymmdd-pages-articles.xml.bz2

where `xx` is language code such as "en (English)" or "ja (Japanese)", and  `yyyymmdd` is the date of creation (e.g. 20120601).

Command line options are as follows:

    Usage: wp2txt [options]
    where [options] are:
                         --input-file, -i:   Wikipedia dump file with .bz2 (compressed) or .txt (uncompressed) format
                     --output-dir, -o <s>:   Output directory (default: Present working directory)
                        --convert-off, -c:   Output XML (without converting to plain text)
                           --list-off, -l:   Exclude list items from output
                        --heading-off, -d:   Exclude section titles from output
                          --title-off, -t:   Exclude page titles from output
          --table-off, --no-table-off, -a:   Exclude page titles from output (default: true)
    --template-off, --no-template-off, -e:   Remove template notations from output (default: true)
                       --redirect-off, -r:   Not show redirect destination
                       --strip-marker, -s:   Remove symbols prefixed to list items, definitions, etc.
                       --category-off, -g:   Not show article category information
                      --file-size, -f <i>:   Approximate size (in MB) of each output file (default: 10)
                            --version, -v:   Print version and exit
                               --help, -h:   Show this message

### Limitations ###

* Certain types of data such as mathematical equations and computer source code are not be properly converted.  Please remember this software is originally intended for correcting “sentences” for linguistic studies.
* Extraction of normal text data could sometimes fail for various reasons (e.g. illegal matching of begin/end tags, language-specific conventions of formatting, etc).
* Conversion process can take far more than you would expect. It could take several hours or more when dealing with a huge data set such as the English Wikipedia on a low-spec environments.
* Because of nature of the task, WP2TXT needs much machine power and consumes a lot of memory/storage resources. The process thus could halt unexpectedly. It may even get stuck, in the worst case, without getting gracefully terminated. Please understand this and use the software __at your own risk__.

### Useful Link ###

* [Wikipedia Database backup dumps](http://dumps.wikimedia.org/backup-index.html)

### Author ###

* Yoichiro Hasebe<EMAIL_ADDRESS>
### License ###

This software is distributed under the MIT License. Please see the LICENSE file.


text:
---
title: Openings
subtitle: Recent Opportunities Regarding Ph.D/ Internship/ Postdoc
date: 2020-05-10T02:15:36.550Z
summary: About Project Content, Position Types.
draft: false
featured:
  filename: featured
  focal_point: Smart
  preview_only: true
image:
  filename: featured.jpg
  preview_only: false
---
## **Ph.D. Students**

I am looking for self-motivated Ph.D. students who are interested in the following areas:

* Network Science, Graph Neural Networks, Spectral Graph Theory;
* Spatial Data Mining, Urban Computing;
* Chem-Informatics, Machine Learning for Material Science;
* Machine Learning for Cyber Security, Software/Hardware Security, Block-Chain Transaction.
* Computational Art, Music Generation;

For **Ph.D. students**, please read the graduate admission requirements of MSU at [here](https://www.cse.msstate.edu/grad/).
Please send your CV, academic transcripts, GRE/TOEFL scores (for international applicants), and other supporting documents to me. I will contact you if there is a match.

Students who want to do **Internships** and have matching interests are also welcome to contact me.

Motivated students who are interested in my research directions are welcome to contact me for brainstorms, discussions and collaborations.

---

## **Proposal Collaboration**

I am open to any proposal that is related to my research topic, please contact me if you have any fit.

repository: aquastar/academic-kickstart

repo_name: aquastar/academic-kickstart


text:
This document contains several guides to install the Kong ingress controller in a Kubernetes cluster

1. [Using minikube][0]:

This guide installs:

* PostgresQL (statefulset)
* RBAC permissions
* Kong deployment in data-plane mode
* Ingress controller deployment with Kong in control-plane mode and init container to run migrations

*Notes:*

- This setup do not provides HA for PostgresQL

[0]: minikube.md


text:
# irreceive

irreceive

## License

MIT

## Supported targets

* for PXT/microbit
(The metadata above is needed for package search.)

```package
irreceive=github:gchen1996/pxt-irreceive
```

repository: xiaozhou-lei/pxt-irreceive

repo_name: xiaozhou-lei/pxt-irreceive


text:
```toml
[advisory]
id = "RUSTSEC-2019-0024"
package = "rustsec-example-crate"
date = "2019-10-08"
url = "https://github.com/RustSec/advisory-db/issues/158"

[versions]
patched = [">= 1.0.0"]
```

# Test advisory with associated example crate

This is a test advisory useful for verifying RustSec tooling and vulnerability
detection pipelines are working correctly. Aside from the fact that it is filed
against an example crate, it is otherwise considered by the Advisory Database
itself to be a normal security advisory.

It's filed against `rustsec-example-crate`, an otherwise completely empty crate
with no functionality or code, which has two releases:

- [v0.0.1] - *vulnerable* according to this advisory
- [v1.0.0] - *patched* by this advisory

(Technically there is a third release, v0.0.0, which is yanked, but otherwise
identical to the v0.0.1 release)

[v0.0.1]: https://crates.io/crates/rustsec-example-crate/0.0.1
[v1.0.0]: https://crates.io/crates/rustsec-example-crate/1.0.0

repository: BurntSushi/advisory-db

gha_license_id: NOASSERTION

repo_name: BurntSushi/advisory-db


text:
# site-backend-mysql

Repository for holding the DB scripts for Website Builder CRM.

To make changes, add a new folder(if an unreleased version doesn't already exist) inside sql folder and add a new file with the SQL queries.
The file name should be of the format <number>-<feature/fix name> where number should be in ascending order.
Also modify the er diagram inside the er folder as part of the change.

For db dumps, add the dump file to the dbdumps folder.

ER Diagram for the database
![ER Diagram](https://github.com/jijojames18/site-backend-mysql/blob/master/er/ER_Main_DB_Screenshot.JPG?raw=true)

gha_language: Shell


text:
---
path: "/leadership"
template: "main-pages"
title: "Leadership"
---

## Leadership

### Executive Team

![subha.png](../images/362a3a58-4e0e-4960-b2c1-970f4a18ff45.png)

#### Subhajeet Mukherjee

_Founder, President_

Subha hails from Calcutta, India. He aims to create a smarter general population through The Programming Foundation and the operating system that he’s developing. He has authored two books on operating systems and given talks at HackerDojo, ACM, SF Python, and LinkedIn. His real-life heroes are Bill Gates and Steve Jobs.

![theo.png](../images/c44d6b35-64fa-47de-a0da-b763f2eb7047.png)

#### Theodore Rolle

_Secretary, Technical Advisor_

Theo is a Technical Account Manager at Google. He is an interdisciplinary specialist with over 10 years of Linux experience.  Theo is overseeing the Reach4Help project.

![claudia.png](../images/74cb9ee3-07f0-407d-bd3d-9891af4bac73.png)

#### Claudia Caroleo

_Head of Marketing_

Claudia is currently the Program Manager and Marketing Strategist at Maserati. After working in the US and Europe, she went back to her roots in Italy. She is a professional with over 15 years of experience in prestigious automotive brands. She has supported CEOs and executives in defining brand strategies.

repository: yu-emily/githubpages-netlifycms

repo_name: yu-emily/githubpages-netlifycms