text:
# Rafay Performance Monitoring Application #

This repo lets you build and run two of three flavors of a performance measurement and monitoring
application.  This is the first version of the application, demonstrating minimal functionality.
The next version will build out more functionality.

1.  Standalone -- a golang app you can run on your laptop.
2.  Docker -- a container that you can run as a component in many locations.
3.  Rafay Workload -- the Docker container running in one or more Edge locations on the Rafay
    platform.  (Coming in the full version of the app.)

## Description

This application makes an HTTP or HTTPS request to one or more target URLs and collects overall
response time data as well as detailed response time statistics.

### Prerequisites

You must have the ([golang](https://golang.org/doc/install)) language installed to build perftest.
Install and configure it using instructions at the link above.

If you don't want to install `go` and build yourself you can also just run a
prebuilt version on DockerHub (see "Run from Docker" below).

If you want to build and run perftest in a container you will need the
[Docker environment](https://docs.docker.com/get-started/).  If you have
golang you can just build and run a standalone version.

## How to Build and Run

Clone this repo.
  * Use "gmake standalone" to build the local standalone app.
  * Use "gmake docker" if you want to build the docker image.

Once you've built the app you can run it in one of two ways, standalone or as a docker.

**Standalone**: To run a test from the command line: `./perftest -n 5 https://www.google.com`.  You
will see output like this:

    # timestamp	DNS	TCP	TLS	First	LastB	Total	HTTP	Size	From_Location	Remote_Addr	proto://uri
    1<PHONE_NUMBER>	24.168	14.607	127.732	61.524	1.333	209.282	200	12051	<IP_ADDRESS>	<IP_ADDRESS>	https://www.google.com
    2<PHONE_NUMBER>	1.374	14.204	49.462	59.318	1.995	125.206	200	12017	<IP_ADDRESS>	<IP_ADDRESS>	https://www.google.com
    3<PHONE_NUMBER>	1.265	14.341	52.774	63.336	3.908	134.661	200	12052	<IP_ADDRESS>	<IP_ADDRESS>	https://www.google.com
    4<PHONE_NUMBER>	2.007	17.288	56.195	65.746	1.727	141.187	200	12000	<IP_ADDRESS>	<IP_ADDRESS>	https://www.google.com
    5<PHONE_NUMBER>	19.876	12.394	56.910	73.899	2.003	145.440	200	12040	<IP_ADDRESS>	<IP_ADDRESS>	https://www.google.com

    Recorded 5 samples in 41s, average values:
    # timestamp	DNS	TCP	TLS	First	LastB	Total	HTTP	Size	From_Location	Remote_Addr	proto://uri
    5 41s   	9.738	14.567	68.615	64.764	2.193	151.155		12032		https://www.google.com

Each line has a request count (1..5), the epoch timestamp when the test started, and the time in
milliseconds measured for the following actions:
  * DNS: how long to look up the IP address(es) for the hostname
  * TCP: how long the TCP three-way handshake took to set up the connection
  * TLS: how long the SSL/TLS handshake took to establish a secure channel
  * First: how long until the first byte of the reply arrived (HTTP response headers)
  * LastB: how long until the last byte of the reply arrived (HTTP content body)
  * Total: response time of the application, from start of TCP connection until last byte
  * HTTP: response code returned from the server; 500 indicates a failure to connect
  * Size: response size in content bytes received from the upstream (response body, not headers)
  * From_Location: where you said the test was running from (REP_LOCATION environment variable)
  * Remote_Addr: the IP address hit by the test (may change over time, based upon DNS result)
  * proto://uri: the request URL (protocol and URI requested)

The final section provides the count of samples, the total time, and averages for the above values.
If you test to multiple endpoints you'll see multiple sections as each completes.

> Interestingly, in the example above we see the remote address changed in the last sample, following a
> DNS resolution.  Each test makes a DNS query; most of them return quickly from cache, but the last
> one fetched a fresh answer -- and it changed.

**Docker**: To run the containerized app you can say "gmake run" from the command line, which will
build the docker image (if needed) and run it out of the local docker repo with default arguments.
You can modify the arguments in the Makefile, or use a variant of its `docker run` invocation
directly from the shell.  You'll see similar output as above.

A recent version of `perftest` is available in the DockerHub and Rafay registries as noted below.
You can fetch it from public DockerHub to your local system via `docker pull dc4jadrafay/perftest`
if you prefer not to build from source.  Or you can just run it using a command line like the one
in the Makefile:

    docker run --rm -it -e PERFTEST_URL="https://www.google.com" -e REP_LOCATION="Your Town,US" dc4jadrafay/perftest:v1 -n=5 -d=2

This example also shows how the application picks up values from the environment.  This will be
useful as we build out the edge application.

If you want to push it to your DockerHub repo, you can `gmake push`.  This
requres the following environment variables:

``` shell
export DOCKER_USER="your docker username"
export DOCKER_EMAIL="the email address you registerd with DockerHub"
```

You will need to login to DockerHub to establish credentials:

``` shell
docker login --username=${DOCKER_USER} --email=${DOCKER_EMAIL}
```

Supply your password if/when prompted.
Now you can `gmake push` to upload the docker to DockerHub.

## Run from Docker

If you don't want to build your own local copy, but you have docker
installed, you can just run a prebuilt version from there using a command
line similar to this:

``` shell
docker run dc4jadrafay/perftest:v1 -n 5 -d 1 https://www.google.com/
```

repository: rafayopen/perftest

repo_name: rafayopen/perftest


text:
# 6PG - Build a Discord Bot With No Code
Customize many different modules including:
Announce, Auto-mod, General, Leveling, Music, and more!

**Dashboard**: https://github.com/theADAMJR/6PG-Dashboard

### Heroku
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/theADAMJR/6PG/tree/master)

---

### Other Setup
This is used if you are **not using Heroku**.

1) Edit `.env` values. The existing values are supplied as a **default**.
2) Add `.env` to **.gitignore**

`.env` example
```
API_URL="http://localhost:3000/api"
CLIENT_ID=533947001578979328
CLIENT_SECRET="fnBIV8t8Pj7JFNNDipKeRL8xhJT1sl8m"
DASHBOARD_URL="http://localhost:3000"
ENCRYPTION_KEY="minecraft is good"
MONGO_URI="mongodb://localhost/6PG"
PORT=3000
```

license: MIT

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) > [@office-iss/react-native-win32](./react-native-win32.md) > [ITouchableWin32Props](./react-native-win32.itouchablewin32props.md) > [filterKeys](./react-native-win32.itouchablewin32props.filterkeys.md)

## ITouchableWin32Props.filterKeys property

Filters keys for touchableHandleKeyPress / touchableHandleKeyPressDown events. Space and Enter keys result in touchableHandleKeyPress(Down) in the event that no filterKeys function is provided as a callback. All keyboard events will result in onKeyUp and onKeyDown getting fired regardless of filterKeys.

<b>Signature:</b>

```typescript
filterKeys?: (str: string) => boolean;
```

repository: acoates-ms/react-native-windows

branch_name: refs/heads/notmaster

gha_license_id: NOASSERTION

repo_name: acoates-ms/react-native-windows


text:
# SLiR: Sparse Linear Regression

Sparse linear regression (SLiR), developed by Misato Tanaka at ATR.

Original Sparse Linear Regerssion toolbox for Matlab is available at <http://www.cns.atr.jp/cbi/sparse_estimation/sato/VBSR.html>.

## Installation

Run the following command:

``` shell
$ pip install git+https://github.com/KamitaniLab/slir.git
```

## Usage

``` python
import slir

model = slir.SparseLinearRegression(n_iter=100)

model.fit(x, y)
y_pred = model.predict(x_test)
```

- `x`, `x_test`: numpy array of training and test input features
- `y`: target vector

The API of this function is compatible with the regression in scikit-learn.
For demonstration, try `demo_slir.py`.

## References

Sato M. (2001) On-line model selection based on the variational Bayes. Neural Computation, 13, 1649-1681. <http://www.mitpressjournals.org/doi/abs/10.1162/089976601750265045>

## License

The scripts provided here are released under the MIT license (http://opensource.org/licenses/mit-license.php).

repository: KamitaniLab/slir

repo_name: KamitaniLab/slir


text:
# templatizer.js

[![Build Status](https://travis-ci.org/HenrikJoreteg/templatizer.png?branch=master)](https://travis-ci.org/HenrikJoreteg/templatizer)

[![NPM](https://nodei.co/npm/templatizer.png?downloads=true)](https://nodei.co/npm/templatizer/)

Simple solution for compiling jade templates into vanilla JS functions for blazin' fast client-side use.

**If you're looking for something that works with [`pug`](https://pugjs.org/api/getting-started.html), check out [`puglatizer`](https://github.com/happilymarrieddad/puglatizer).**

**v2 has been released. See the [changelog](#changelog) for breaking changes.**

## What is this?

Client-side templating is overly complicated, ultimately what you *actually* want is a function you can call from your JS that puts your data in a template.  Ultimately, all I want is a function that I can call with some variable to render the string I want.

So, the question is, what's a sane way to get to that point? Enter [jade](http://jade-lang.com). Simple, intuitive templating, and happens to be what I use on the server anyway. So... Jade has some awesome stuff for compiling templates into functions. I just built templatizer to make it easy to turn a folder full of jade templates into a CommonJS module that exports all the template functions by whatever their file name.

## Is it faster?

From my tests it's 6 to 10 times faster than mustache.js with ICanHaz.

## How do I use it?

1. `npm install templatizer`
1. Write all your templates as individual jade files in a folder in your project.
1. Somewhere in your build process do this:

```js
var templatizer = require('templatizer');

// pass in the template directory and what you want to save the output file as
templatizer(
  __dirname + '/templates',
  __dirname + '/output.js',
  options, // Optional
  function (err, templates) { console.log(err || 'Success!') }
);
```

So a folder like this

```
/clienttemplates
   user.jade
   app.jade
   /myfolder
     nestedTemplate.jade
```

Compiles down to a JS file that looks something like this:

```js
var jade = require('jade-runtime') // This is a peerDependency

var templates = {};

// a function built from the `user.jade` file
// that takes your data and returns a string.
templates.user = function () {}

// built from the `app.jade` file
templates.app = function () {} // the function

// folders become nested objects so
// myfolder/nestedTemplate.jade becomes
templates.myFolder = {};
templates.myfolder.nestedTemplate = function () {} // the template function

module.exports = templates;
```

The awesome thing is... they're just functions at this point. Crazy fast, SO MUCH WIN!!!!

## Dependencies

`templatizer` has `jade-runtime` as a `peerDependency`. In npm 3.x.x peerDependencies will no longer be installed by default.

When this happens, you'll want to run the following `npm install jade-runtime` to install it yourself.

**Note: the currently published [`jade-runtime`](https://www.npmjs.com/package/jade-runtime) only works with the upcoming<EMAIL_ADDRESS>release. For now `templatizer` uses an npm publically scoped module that is a copy of the current runtime [`@lukekarrys/jade-runtime`](https://www.npmjs.com/package/@lukekarrys/jade-runtime). This will be changed once<EMAIL_ADDRESS>is released.**

## API

```js
templatizer(
  templatesDirectory,
  outputFile?,
  options?,
  function (err, templates) {}
)
```

### templatesDirectory (string or array, required)

A string or an array of paths to look for templates.

The path can also be a [glob](https://github.com/isaacs/node-glob) instead that can be used to match `*.jade` files across multiple directories. For example:

```js
templatizer(__dirname + '/app/**/*.jade', ...);
```

### outputFile (string)

Optionally build the compiled templates to a file. The output will be a CommonJS module. If you don't build to a file, you'll want to supply a callback to do something else with the compiled templates.

### Options (object)

##### `jade` (object, default `{}`)

`jade` is an object which will be passed directly to `jade.compile()`. See the [Jade API documentation](http://jade-lang.com/api/) for what options are available.

Here's an example where we set the Jade `compileDebug` option to `true`.

```js
templatizer(templatesDir, outputFile, {
    // Options
    jade: {
        compileDebug: true
    }
});
```

##### `globOptions` (object, default `{}`)

`globOptions` will be passed directly to `node-glob`. See the [API docs](https://github.com/isaacs/node-glob#options) for available options.

##### `transformMixins` (boolean, default false)

Set this to `true` to turn on `mixin` AST transformations.

Jade has a feature called `mixins` which when compiled get treated as function declarations within the compiled function. Templatizer can pull these out of the compiled function and place them on the namespace of the parent function. For example:

```jade
// users.jade
ul
  each user in users
    mixin user(user)

mixin user(user)
  // Jade mixin content
```

Templatizer will compile this as

```js
// Compiled fn from file
exports.users = function () {}

// Compiled mixin fn
exports.users.user = function (user) {}
```

This is helpful as it allows you to call `users()` to create your list and then `users.user()` to render just a single item in the list.

### Callback (function)

If the last parameter is a function, it will be treated as a callback. The callback will always have the signature `function (err, templates) {}`. Use this to respond to errors or to do something else with the source of the compiled templates file.

This can be helpful if you don't want to write the compiled templates directly to a file, and you want to make modifications first.

### Argument order

Both the `outputFile` string and `options` object are optional.

```js
// Use just the callback to do something else with your templates
// besides write them to a file
templatizer(templatesDir, function (err, templates) { });

// Build to a file and do something in the callback
templatizer(templatesDir, outputFile, function (err, templates) { });

// Use only with options
templatizer(templatesDir, { /* options */ }, function (err, templates) { });

// Use with options and outputFile
templatizer(templatesDir, outputFile, { /* options */ }, function (err, templates) { });
```

## Passing client side data to templates

Simply pass in data objects to make those variables available within the template:
```js
templatizer.Template({ title: ..., description: ...});
```

Using jade's [`&attributes(attributes)`](http://jade-lang.com/reference/attributes/#and-attributes) syntax:
```js
templatizer.Template.call({ attributes:{ class: ..., value: ...}} , data);
templatizer.Template.apply({ attributes:{ class: ..., value: ...}} , [data]);
```

## CLI

Templatizer comes with a bin script to use from makefiles/package.json scripts/etc, it works like this:

```
$ templatizer -d path/to/templates -o /path/to/output/templates.js
```

## Tests

Run `npm test` to run the tests (you'll need phantomjs installed). You can also run the tests in your browser with `npm start` and going to [http://localhost:3003](http://localhost:3003).

## Changelog

- 2.0.3
  - Return err from callback on jade compile errors ([#94](https://github.com/HenrikJoreteg/templatizer/pull/94) [@klausbayrhammer](https://github.com/klausbayrhammer))

- 2.0.2
  - Use publically scoped runtime from [`@lukekarrys/jade-runtime`](https://www.npmjs.com/package/@lukekarrys/jade-runtime)

- 2.0.0 Breaking Changes:
  - **Async API** Pass a callback as the last parameter with the signature `function (err, templates) {}` to know when compilation is complete.
  - **Compiled templates are no longer UMD.** The compiled templates are now only a CommonJS module. Global and AMD support have been removed. If you want to consume this file as an AMD module or global, you'll need to do that as part of a build step in your project. Try the [`require.js` conversion tool](http://requirejs.org/docs/commonjs.html#autoconversion) or [`amd-wrap`](https://www.npmjs.com/package/amd-wrap) for AMD compatibility or [creating a standalone build with `browserify`](http://www.forbeslindesay.co.uk/post/46324645400/standalone-browserify-builds) for global builds.
  - **`jade-runtime` is no longer inlined.** `jade-runtime` is now installed as a `peerDependency` and required from the compiled templates file.
  - **`namespace` options have been removed.** Since the compiled templates no longer have the option to attach to a global variable, the `namespace` options are no longer relevant.
  - **Mixin transformation is now off by default.** Mixin transformation can be turned back on by using the option `transformMixins: true`. Also, the dynamic mixin compiler is no automatically turned on if opting-in to mixin transformation.

## License

MIT

## Contributors

- Aaron McCall [github profile](https://github.com/aaronmccall)
- Luke Karrys [github profile](https://github.com/lukekarrys)

If you think this is cool, you should follow me on twitter: [@HenrikJoreteg](http://twitter.com/henrikjoreteg)

repository: HenrikJoreteg/templatizer

gha_language: JavaScript

repo_name: HenrikJoreteg/templatizer


text:
# telegram_notify
This repo contains a simple Go application that can be used for sending telegram messages containing an optional photo or video.

## Usage
1. Download the executable for your platform from the build directory within this repo. If the executable you want is not in the build directory, then clone the repo and build it for the desired platform.
2. Place the executable somewhere you can run it
3. Run one of the following commands:

* Get the chat ID of a Telegram chat that your Telegram Bot is in
    * Command:
        ```
        telegram_notify -botToken <my Telegram bot token here> -mode getChatID
        ```
    * Response (the desired chat ID is on the 15th line at result.message.chat.id):
        ```json
        {
            "ok": true,
            "result": [
                {
                    "update_id": 11111111,
                    "message": {
                        "message_id": 1,
                        "from": {
                            "id": 111111111,
                            "first_name": "MyFirstName",
                            "last_name": "MyLastName",
                            "username": "MyUsername"
                        },
                        "chat": {
                            "id": 186939052,
                            "first_name": "MyFirstName",
                            "last_name": "MyLastName",
                            "username": "MyUsername",
                            "type": "private"
                        },
                        "date":<PHONE_NUMBER>,
                        "text": "Test"
                    }
                }
            ]
        }
        ```
* Send a message with text
    * Command:
        ```
        telegram_notify -botToken <my Telegram bot token here> -chatID <my Telegram chat ID> -mode sendText -text "my message"
        ```
    * Response:
        ```
        Text sent
        ```
* Send a photo
    * Command:
        ```
        telegram_notify -botToken <my Telegram bot token here> -chatID <my Telegram chat ID> -mode sendPhoto -filePath "path to photo file"
        ```
    * Response:
        ```
        Photo sent
        ```
* Send a photo with a caption
    * Command:
        ```
        telegram_notify -botToken <my Telegram bot token here> -chatID <my Telegram chat ID> -mode sendPhoto -filePath "path to photo file" -text "my optional caption"
        ```
    * Response:
        ```
        Photo sent
        ```
* Send a video
    * Command:
        ```
        telegram_notify -botToken <my Telegram bot token here> -chatID <my Telegram chat ID> -mode sendVideo -filePath "path to video file"
        ```
    * Response:
        ```
        Video sent
        ```
* Send a video with a caption
    * Command:
        ```
        telegram_notify -botToken <my Telegram bot token here> -chatID <my Telegram chat ID> -mode sendVideo -filePath "path to video file" -text "my optional caption"
        ```
    * Response:
        ```
        Video sent
        ```

### Manually Building Executable
When compiling for raspberry pi 2 use:

Windows:
```
set GOARCH=arm
set GOOS=linux
set GOARM=5
go build
```

Mac
```
env GOOS=linux GOARCH=arm GOARM=5 go build
```


text:
# textworld-bots
Bots to play [TextWorld](https://aka.ms/textworld).

# Setup

```bash
docker build -t tw .
```

* If you want to SSH into the container:
```bash
docker run --rm -it --detach -p 2022:22 -v ${PWD}:/root/workspace/textworld-bots --name tw tw bash
docker attach tw
# The prompt might not show, just press a key, e.g. the letter l.

nano ~/.ssh/authorized_keys
# Add you public key.

# Even though it was already done in the Dockerfile, to actually enable SSH, you might need to do.
service ssh restart

# Ctrl P+Q to detach and keep the container running.

# To set up SSH:

```

# Running games
Copy games into all_games/train.

Then run:
```bash
docker run --rm -it -v ${PWD}:/root/tw --name tw tw python3 /root/tw/test_submission.py . /root/tw/all_games --in-docker
```

# Testing
Run:
```bash
docker run --rm -it -v ${PWD}:/root/tw --name tw tw python3 -m unittest discover /root/tw
```

[codalab]: https://competitions.codalab.org/competitions/20865#participate-get_starting_kit

repository: juharris/textworld-bots

gha_language: Python

gha_license_id: MIT

repo_name: juharris/textworld-bots


text:
# val3dity

Validation of solids according to the international standard ISO 19107.

## How do I use val3dity?

It is a command-line program, which we provide as source code, together with makefiles for Mac and Linux.

If you use Windows, you can download the following [binary](https://www.dropbox.com/s/aywlwz49ngeh80l/3dValidator1.10.zip). It has the latest val3dity, and [citygml2poly](https://github.com/tudelft-gist/citygml2poly) is used to parse CityGML files. Java and Python must be installed on the system.

To compile val3dity yourself, you first need to install the free libraries [CGAL](http://www.cgal.org), [GEOS](http://trac.osgeo.org/geos/) and [CMake](http://www.cmake.org)--under Mac we suggest using [Homebrew](http://brew.sh/). Afterwards run:

    $ cmake .
    $ make

To execute val3dity:

    $ ./val3dity outershell.poly innershell1.poly innershell2.poly

Each shell of the solid must be modelled with a [POLY](http://tetgen.berlios.de/fformats.poly.html) file, the first argument is always the outer shell, and the others are inner shells. If you want to read CityGML files as input, have a look at [citygml2poly](https://github.com/tudelft-gist/citygml2poly).

There can be 0 or an infinity of inner shells, their order is not important.
For instance, to validate a solid having only one outer shell (it's a unit cube):

```
$ ./val3dity data/poly/cube.poly
Reading 1 file(s).
Reading outer shell:	data/poly/cube.poly

Validating surface in 2D with GEOS (their projection)
-----all valid

Triangulating outer shell
-----done

Validating shell #0
-----Planarity
	yes
-----Combinatorial consistency
	yes
-----Geometrical consistency
	yes
-----Orientation of normals
	yes
Shell #0 valid

Valid solid. Hourrraaa!
```

And to validate a solid with one outer shell and 2 inner shells:

```
$ ./val3dity data/poly/cube.poly data/poly/py1.poly data/poly/py7.poly
Reading 3 file(s).
Reading outer shell:	data/poly/cube.poly
Reading inner shell #0:	data/poly/py1.poly
Reading inner shell #1:	data/poly/py7.poly

Validating surface in 2D with GEOS (their projection)
-----all valid

Triangulating outer shell
Triangulating inner shell #0
Triangulating inner shell #1
-----done

Validating shell #0
-----Planarity
	yes
-----Combinatorial consistency
	yes
-----Geometrical consistency
	yes
-----Orientation of normals
	yes
Shell #0 valid

Validating shell #1
-----Planarity
	yes
-----Combinatorial consistency
	yes
-----Geometrical consistency
	yes
-----Orientation of normals
	yes
Shell #1 valid

Validating shell #2
-----Planarity
	yes
-----Combinatorial consistency
	yes
-----Geometrical consistency
	yes
-----Orientation of normals
	yes
Shell #2 valid

Inspecting interactions between the 3 shells
Error 400: shells are face adjacent
	[shell: #1; face: #2]

Invalid solid :(
```

# Error reported

## Ring level ##

  * REPEATED_POINTS
  * RING_NOT_CLOSED
  * RING_SELF_INTERSECT

## Surface level ##

  * SELF_INTERSECTION
  * NON_PLANAR_SURFACE
  * INTERIOR_DISCONNECTED
  * HOLE_OUTSIDE
  * HOLES_ARE_NESTED

## Shell level ##

  * NOT_VALID_2_MANIFOLD
    * SURFACE_NOT_CLOSED
    * DANGLING_FACES
    * FACE_ORIENTATION_INCORRECT_EDGE_USAGE
    * FREE_FACES
    * SURFACE_SELF_INTERSECTS
  * VERTICES_NOT_USED
  * SURFACE_NORMALS_WRONG_ORIENTATION

## Solid level

  * SHELLS_FACE_ADJACENT
  * SHELL_INTERIOR_INTERSECT
  * INNER_SHELL_OUTSIDE_OUTER
  * INTERIOR_OF_SHELL_NOT_CONNECTED

## I'm interested in the details of how the validation is performed ##

The validation is performed hierarchically, ie first every surface are validated in 2D (with [GEOS](http://trac.osgeo.org/geos/)), then every shell is validated (must be watertight, no self-intersections, orientation of the normals must be consistent and pointing outwards, etc.), and finally the interactions between the shells are analysed.

Most details about the implementation are available in this [scientific article](http://homepage.tudelft.nl/23t4p/pdfs/_13cacaie.pdf).


text:
# Microsoft.AspNetCore.NodeServices

This NuGet package provides a fast and robust way to invoke Node.js code from a .NET application (typically ASP.NET Core web apps). You can use this whenever you want to use Node/NPM-supplied functionality at runtime in ASP.NET. For example,

 * Executing arbitrary JavaScript
 * Runtime integration with JavaScript build or packaging tools, e.g., transpiling code via Babel
 * Using of NPM modules for image resizing, audio compression, language recognition, etc.
 * Calling third-party services that supply Node-based APIs but don't yet ship native .NET ones

It is the underlying mechanism supporting the following packages:

 * [`Microsoft.AspNetCore.SpaServices`](/src/Middleware/SpaServices/) - builds on NodeServices, adding functionality commonly used in Single Page Applications, such as server-side prerendering, webpack middleware, and integration between server-side and client-side routing.

### Requirements

* [Node.js](https://nodejs.org/en/)
  * To test this is installed and can be found, run `node -v` on a command line
  * Note: If you're deploying to an Azure web site, you don't need to do anything here - Node is already installed and available in the server environments
* [.NET](https://dot.net)
  * For .NET Core (e.g., ASP.NET Core apps), you need at least 1.0 RC2
  * For .NET Framework, you need at least version 4.5.1.

### Installation

For .NET Core apps:

 * Add `Microsoft.AspNetCore.NodeServices` to the dependencies list in your `project.json` file
 * Run `dotnet restore` (or if you use Visual Studio, just wait a moment - it will restore dependencies automatically)

For .NET Framework apps:

 * `nuget install Microsoft.AspNetCore.NodeServices`

### Do you just want to build an ASP.NET Core app with Angular / React / Knockout / etc.?

In that case, you don't need to use NodeServices directly (or install it manually). You can either:

* **Recommended:** Use the `aspnetcore-spa` Yeoman generator to get a ready-to-go starting point using your choice of client-side framework. [Instructions here.](http://blog.stevensanderson.com/2016/05/02/angular2-react-knockout-apps-on-aspnet-core/)
* Or set up your ASP.NET Core and client-side Angular/React/KO/etc. app manually, and then use the [`Microsoft.AspNetCore.SpaServices`](/src/Middleware/SpaServices/) package to add features like server-side prerendering or Webpack middleware. But really, at least try using the `aspnetcore-spa` generator first.

# Simple usage example

## For ASP.NET Core apps

.NET Core has a built-in dependency injection (DI) system. NodeServices is designed to work with this, so you don't have to manage the creation or disposal of instances.

Enable NodeServices in your application by first adding the following to your `ConfigureServices` method in `Startup.cs`:

```csharp
public void ConfigureServices(IServiceCollection services)
{
    // ... all your existing configuration is here ...

    // Enable Node Services
    services.AddNodeServices();
}
```

Now you can receive an instance of `NodeServices` as an action method parameter to any MVC action, and then use it to make calls into Node.js code, e.g.:

```csharp
public async Task<IActionResult> MyAction([FromServices] INodeServices nodeServices)
{
    var result = await nodeServices.InvokeAsync<int>("./addNumbers", 1, 2);
    return Content("1 + 2 = " + result);
}
```

Of course, you also need to supply the Node.js code you want to invoke. Create a file called `addNumbers.js` at the root of your ASP.NET Core application, and add the following code:

```javascript
module.exports = function (callback, first, second) {
    var result = first + second;
    callback(/* error */ null, result);
};
```

As you can see, the exported JavaScript function will receive the arguments you pass from .NET (as long as they are JSON-serializable), along with a Node-style callback you can use to send back a result or error when you are ready.

When the `InvokeAsync<T>` method receives the result back from Node, the result will be JSON-deserialized to whatever generic type you specified when calling `InvokeAsync<T>` (e.g., above, that type is `int`). If `InvokeAsync<T>` receives an error from your Node code, it will throw an exception describing that error.

If you want to put `addNumber.js` inside a subfolder rather than the root of your app, then also amend the path in the `_nodeServices.Invoke` call to match that path.

## For non-ASP.NET apps

In other types of .NET Core app, where you don't have ASP.NET supplying an `IServiceCollection` to you, you'll need to instantiate your own DI container. For example, add a reference to the .NET package `Microsoft.Extensions.DependencyInjection`, and then you can construct an `IServiceCollection`, then register NodeServices as usual:

```csharp
var services = new ServiceCollection();
services.AddNodeServices(options => {
    // Set any properties that you want on 'options' here
});
```

Now you can ask it to supply the shared `INodeServices` instance:

```csharp
var serviceProvider = services.BuildServiceProvider();
var nodeServices = serviceProvider.GetRequiredService<INodeServices>();
```

Or, if you want to obtain a separate (non-shared) `INodeServices` instance:

```csharp
var options = new NodeServicesOptions(serviceProvider) { /* Assign/override any other options here */ };
var nodeServices = NodeServicesFactory.CreateNodeServices(options);
```

Besides this, the usage is the same as described for ASP.NET above, so you can now call `nodeServices.InvokeAsync<T>(...)` etc.

You can dispose the `nodeServices` object whenever you are done with it (and it will shut down the associated Node.js instance), but because these instances are expensive to create, you should whenever possible retain and reuse instances. Don't dispose the shared instance returned from `serviceProvider.GetRequiredService` (except perhaps if you know your application is shutting down, although .NET's finalizers will dispose it anyway if the shutdown is graceful).

NodeServices instances are thread-safe - you can call `InvokeAsync<T>` simultaneously from multiple threads. Also, they are smart enough to detect if the associated Node instance has died and will automatically start a new Node instance if needed.

# API Reference

### AddNodeServices

**Signatures:**

```csharp
AddNodeServices()
AddNodeServices(Action<NodeServicesOptions> setupAction)
```

This is an extension method on `IServiceCollection`. It registers NodeServices with ASP.NET Core's DI system. Typically you should call this from the `ConfigureServices` method in your `Startup.cs` file.

To access this extension method, you'll need to add the following namespace import to the top of your file, if it isn't already there:

```csharp
using Microsoft.Extensions.DependencyInjection;
```

**Examples**

Using default options:

```csharp
services.AddNodeServices();
```

Or, specifying options:

```csharp
services.AddNodeServices(options =>
{
    options.WatchFileExtensions = new[] { ".coffee", ".sass" };
    // ... etc. - see other properties below
});
```

**Parameters**

 * `setupAction` - type: `Action<NodeServicesOptions>`
   * Optional. If not specified, defaults will be used.
   * Properties on `NodeServicesOptions`:
     * `HostingModel` - an `NodeHostingModel` enum value. See: [hosting models](#hosting-models)
     * `ProjectPath` - if specified, controls the working directory used when launching Node instances. This affects, for example, the location that `require` statements resolve relative paths against. If not specified, your application root directory is used.
     * `WatchFileExtensions` - if specified, the launched Node instance will watch for changes to any files with these extensions, and auto-restarts when any are changed. The default array includes `.js`, `.jsx`, `.ts`, `.tsx`, `.json`, and `.html`.

**Return type**: None. But once you've done this, you can get `NodeServices` instances out of ASP.NET's DI system. Typically it will be a singleton instance.

### CreateNodeServices

**Signature:**

```csharp
CreateNodeServices(NodeServicesOptions options)
```

Supplies a new (non-shared) instance of `NodeServices`.

**Example**

```csharp
var options = new NodeServicesOptions(serviceProvider); // Obtains default options from DI config
var nodeServices = NodeServicesFactory.CreateNodeServices(options);
```

**Parameters**
 * `options` - type: `NodeServicesOptions`.
   * Configures the returned `NodeServices` instance.
   * Properties:
     * `HostingModel` - an `NodeHostingModel` enum value. See: [hosting models](#hosting-models)
     * `ProjectPath` - if specified, controls the working directory used when launching Node instances. This affects, for example, the location that `require` statements resolve relative paths against. If not specified, your application root directory is used.
     * `WatchFileExtensions` - if specified, the launched Node instance will watch for changes to any files with these extension, and auto-restarts when any are changed.

**Return type:** `NodeServices`

If you create a `NodeServices` instance this way, you can also dispose it (call `nodeServiceInstance.Dispose();`) and it will shut down the associated Node instance. But because these instances are expensive to create, you should whenever possible retain and reuse your `NodeServices` object. They are thread-safe - you can call `nodeServiceInstance.InvokeAsync<T>(...)` simultaneously from multiple threads.

### InvokeAsync<T>

**Signature:**

```csharp
InvokeAsync<T>(string moduleName, params object[] args)
```

Asynchronously calls a JavaScript function and returns the result, or throws an exception if the result was an error.

**Example 1: Getting a JSON-serializable object from Node (the most common use case)**

```csharp
var result = await myNodeServicesInstance.InvokeAsync<TranspilerResult>(
    "./Node/transpile",
    pathOfSomeFileToBeTranspiled);
```

... where `TranspilerResult` might be defined as follows:

```csharp
public class TranspilerResult
{
    public string Code { get; set; }
    public string[] Warnings { get; set; }
}
```

... and the corresponding JavaScript module (in `Node/transpile.js`) could be implemented as follows:

```javascript
module.exports = function (callback, filePath) {
    // Invoke some external transpiler (e.g., an NPM module) then:
    callback(null, {
        code: theTranspiledCodeAsAString,
        warnings: someArrayOfStrings
    });
};
```

**Example 2: Getting a stream of binary data from Node**

```csharp
var imageStream = await myNodeServicesInstance.InvokeAsync<Stream>(
    "./Node/resizeImage",
    fullImagePath,
    width,
    height);

// In an MVC action method, you can pipe the result to the response as follows
return File(imageStream, someContentType);
```

... where the corresponding JavaScript module (in `Node/resizeImage.js`) could be implemented as follows:

```javascript
var sharp = require('sharp'); // A popular image manipulation package on NPM

module.exports = function(result, physicalPath, maxWidth, maxHeight) {
    // Invoke the 'sharp' NPM module, and have it pipe the resulting image data back to .NET
    sharp(physicalPath)
        .resize(maxWidth || null, maxHeight || null)
        .pipe(result.stream);
}
```

**Parameters**

* `moduleName` - type: `string`
  * The name of a JavaScript module that Node.js must be able to resolve by calling `require(moduleName)`. This can be a relative path such as `"./Some/Directory/mymodule"`. If you don't specify the `.js` filename extension, Node.js will infer it anyway.
* `params`
  * Any set of JSON-serializable objects you want to pass to the exported JavaScript function

**Return type:** `T`, which must be:

 * A JSON-serializable .NET type, if your JavaScript code uses the `callback(error, result)` pattern to return an object, as in example 1 above
 * Or, the type `System.IO.Stream`, if your JavaScript code writes data to the `result.stream` object (which is a [Node `Duplex` stream](https://nodejs.org/api/stream.html#stream_class_stream_duplex)), as in example 2 above

### InvokeExportAsync<T>

**Signature**

```csharp
InvokeExportAsync<T>(string moduleName, string exportName, params object[] args)
```

This is exactly the same as `InvokeAsync<T>`, except that it also takes an `exportName` parameter. You can use this if you want your JavaScript module to export more than one function.

**Example**

```csharp
var someString = await myNodeServicesInstance.InvokeExportAsync<string>(
    "./Node/myNodeApis",
    "getMeAString");

var someStringInFrench = await myNodeServicesInstance.InvokeExportAsync<string>(
    "./Node/myNodeApis",
    "convertLanguage"
    someString,
    "fr-FR");
```

... where  the corresponding JavaScript module (in `Node/myNodeApis.js`) could be implemented as follows:

```javascript
module.exports = {

    getMeAString: function (callback) {
        callback(null, 'Here is a string');
    },

    convertLanguage: function (callback, sourceString, targetLanguage) {
        // Implementation detail left as an exercise for the reader
        doMachineTranslation(sourceString, targetLanguage, function(error, result) {
            callback(error, result);
        });
    }

};
```

**Parameters, return type, etc.** For all other details, see the docs for [`InvokeAsync<T>`](#invokeasynct)

## Hosting models

NodeServices has a pluggable hosting/transport mechanism, because it is an abstraction over various possible ways to invoke Node.js from .NET. This allows more high-level facilities (e.g., for Angular prerendering) to be agnostic to the details of launching Node and communicating with it - those high-level facilities can just trust that *somehow* we can invoke code in Node for them.

Using this abstraction, we could run Node inside the .NET process, in a separate process on the same machine, or even on a different machine altogether. At the time of writing, all the built-in hosting mechanisms work by launching Node as a separate process on the same machine as your .NET code.

**What about Edge.js?**

[Edge.js](http://tjanczuk.github.io/edge/#/) hosts Node.js inside a .NET process, or vice-versa, and lets you interoperate between the two.

NodeServices is not meant to compete with Edge.js. Instead, NodeServices is an abstraction over all possible ways to invoke Node from .NET. Eventually we may offer an in-process Node hosting mechanism via Edge.js, without you needing to change your higher-level code. This can be done when Edge.js supports hosting Node in cross-platform .NET Core processes ([discussion](https://github.com/tjanczuk/edge/issues/279)).

**What about VroomJS?**

People have asked about using [VroomJS](https://github.com/fogzot/vroomjs) as a hosting mechanism. We don't currently plan to implement that, because Vroom only supplies a V8 runtime environment, not a complete Node environment. The difference is that, with a true Node environment, *all* NPM modules and Node code will work exactly as expected, whereas in a Vroom environment, code will only work if it doesn't use any Node primitives, which rules out large portions of the NPM landscape.

### Custom hosting models

If you implement a custom hosting model (by implementing `INodeInstance`), then you can cause it to be used by populating `NodeInstanceFactory` on your options:

```csharp
services.AddNodeServices(options =>
{
    options.NodeInstanceFactory = () => new MyCustomNodeInstance();
});
```

repository: donma/aspnetcore

repo_name: donma/aspnetcore


text:
---
layout: post
title: "Artificial Intelligence in Clinical Health Care Applications: Viewpoint"
date: 2019-06-05 15:57:20
categories: arXiv_AI
tags: arXiv_AI Deep_Learning Recommendation
author: Michael van Hartskamp, Sergio Consoli, Wim Verhaegh, Milan Petković, Anja van de Stolpe
mathjax: true
---

* content
{:toc}

##### Abstract
The idea of Artificial Intelligence (AI) has a long history. It turned out, however, that reaching intelligence at human levels is more complicated than originally anticipated. Currently we are experiencing a renewed interest in AI, fueled by an enormous increase in computing power and an even larger increase in data, in combination with improved AI technologies like deep learning. Healthcare is considered the next domain to be revolutionized by Artificial Intelligence. While AI approaches are excellently suited to develop certain algorithms, for biomedical applications there are specific challenges. We propose recommendations to improve AI projects in the biomedical space and especially clinical healthcare.

##### Abstract (translated by Google)

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

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


text:
# Lab 04 Report -

## Part 1

### Step 1.

###### Output with different inputs:
![step1_output](step1_output.jpg)

###### Code:

1. CMakeLists.txt:
![cmakelist](step1_cmakelist.jpg)

2. TutorialConfig.h.in:
![tutorialconfig](step1_tutorialconfig.jpg)

3. Tutorial.cxx:
![tutorial](step1_tutorial.jpg)

### Step 2.

###### Output with different inputs:

![step2_output](step2_output_on.jpg)

###### Code:

1. CMakeLists.txt(top level):
![cmakelist1](step2_cmakelist_top.jpg)

2. CMakeLists.txt(in MathFunctions folder):
![cmakelist2](step2_cmakelist_inmath.jpg)

3. TutorialConfig.h.in:
![tutorialconfig](step2_tutorialconfig.jpg)

4. Tutorial.cxx:
![tutorial](step2_tutorial.jpg)

### Step 3.

###### Outputs with different inputs:

![step3_output](step3_output.jpg)

###### Code:

1. CMakeLists.txt(top level):
![cmakelist1](step2_cmakelist_top.jpg)

2. CMakeLists.txt(in MathFunctions folder):
![cmakelist2](step2_cmakelist_inmath.jpg)

### Step 4.

###### Output:

![output1](step4_output_1.jpg)
![output2](step4_output_2.jpg)
![output3](step4_output_3.jpg)

###### Code:

1. CMakeLists.txt(top level):
![cmakelist1](step4_cmakelist_top1.jpg)
![cmakelist2](step4_cmakelist_top2.jpg)

2. CMakeLists.txt(in MathFunctions folder):
![cmakelist3](step4_cmakelist_inmath.jpg)

### Step 5.

###### Output:

![output](step5_output.jpg)

###### Code:

1. CMakeLists.txt(top level):
![cmakelist1](step4_cmakelist_top1.jpg)
![cmakelist2](step4_cmakelist_top2.jpg)

2. CMakeLists.txt(in MathFunctions folder):
![cmakelist3](step5_cmakelist_inmath.jpg)

## Part 2

##### Compare Results:
![compare](ls-la.jpg)

##### Makefile(mine):
all: dynamic_block static_block

static_block: program.o static_lib.a

cc program.o static_lib.a -o static_block -Wl, -rpath .

dynamic_block: program.o share_lib.so

cc program.o share_lib.so -o dynamic_block -Wl, -rpath .

share_lib.so: block.o

cc -shared -o share_lib.so block.o

static_lib.a: block.o

ar qc static_lib.a block.o

block.o: source/block.c

cc -fPIC -c source/block.c -o block.o

program.o: program.c

cc -fPIC -c program.c -o program.o

##### CMakeLists:
cmake_minimum_required(VERSION 3.10)

project(Lab)

set(CMAKE_CXX_STANDARD 11)

set(CMAKE_CXX_STANDARD_REQUIRED True)

add_library(staticLib STATIC source/block.c)

add_executable(static_block program.c)

target_link_libraries(static_block staticLib)

add_library(dynamicLib SHARED source/block.c)

add_executable(dynamic_block program.c)

target_link_libraries(dynamic_block dynamicLib)

##### Outputs:
![out](part2_output.jpg)

##### Makefile(generated by cmake):
'''
\# CMAKE generated file: DO NOT EDIT!
\# Generated by "Unix Makefiles" Generator, CMake Version 3.19

\# Default target executed when no arguments are given to make.
default_target: all

.PHONY : default_target

\# Allow only one "make -f Makefile2" at a time, but pass parallelism.
.NOTPARALLEL:

#=============================================================================
\# Special targets provided by cmake.

\# Disable implicit rules so canonical targets will work.
.SUFFIXES:

\# Disable VCS-based implicit rules.
% : %,v

\# Disable VCS-based implicit rules.
% : RCS/%

\# Disable VCS-based implicit rules.
% : RCS/%,v

\# Disable VCS-based implicit rules.
% : SCCS/s.%

\# Disable VCS-based implicit rules.
% : s.%

.SUFFIXES: .hpux_make_needs_suffix_list

\# Command-line flag to silence nested $(MAKE).
$(VERBOSE)MAKESILENT = -s

#Suppress display of executed commands.
$(VERBOSE).SILENT:

\# A target that is always out of date.
cmake_force:

.PHONY : cmake_force

#=============================================================================
\# Set environment variables for the build.

\# The shell in which to execute make rules.
SHELL = /bin/sh

\# The CMake executable.
CMAKE_COMMAND = /usr/local/Cellar/cmake/3.19.6/bin/cmake

\# The command to remove a file.
RM = /usr/local/Cellar/cmake/3.19.6/bin/cmake -E rm -f

\# Escaping for special characters.
EQUALS = =

\# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /Users/lrz/Documents/GitHub/CSCI-4470-OpenSource/Modules/05.BuildSystems/Lab-BuildSystemsExample

\# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /Users/lrz/Documents/GitHub/CSCI-4470-OpenSource/Modules/05.BuildSystems/Lab-BuildSystemsExample/test

#=============================================================================
\# Targets provided globally by CMake.

\# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
/usr/local/Cellar/cmake/3.19.6/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache

\# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache

.PHONY : rebuild_cache/fast

\# Special rule for the target edit_cache
edit_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
/usr/local/Cellar/cmake/3.19.6/bin/ccmake -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : edit_cache

\# Special rule for the target edit_cache
edit_cache/fast: edit_cache

.PHONY : edit_cache/fast

\# The main all target
all: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start /Users/lrz/Documents/GitHub/CSCI-4470-OpenSource/Modules/05.BuildSystems/Lab-BuildSystemsExample/test/CMakeFiles /Users/lrz/Documents/GitHub/CSCI-4470-OpenSource/Modules/05.BuildSystems/Lab-BuildSystemsExample/test//CMakeFiles/progress.marks
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all
$(CMAKE_COMMAND) -E cmake_progress_start /Users/lrz/Documents/GitHub/CSCI-4470-OpenSource/Modules/05.BuildSystems/Lab-BuildSystemsExample/test/CMakeFiles 0
.PHONY : all

\# The main clean target
clean:
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 clean
.PHONY : clean

\# The main clean target
clean/fast: clean

.PHONY : clean/fast

\# Prepare targets for installation.
preinstall: all
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall

\# Prepare targets for installation.
preinstall/fast:
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall/fast

\# clear depends
depend:
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend

#=============================================================================
\# Target rules for targets named static_block

\# Build rule for target.
static_block: cmake_check_build_system
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 static_block
.PHONY : static_block

\# fast build rule for target.
static_block/fast:
$(MAKE) $(MAKESILENT) -f CMakeFiles/static_block.dir/build.make CMakeFiles/static_block.dir/build
.PHONY : static_block/fast

#=============================================================================
\# Target rules for targets named dynamic_block

\# Build rule for target.
dynamic_block: cmake_check_build_system
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 dynamic_block
.PHONY : dynamic_block

\# fast build rule for target.
dynamic_block/fast:
$(MAKE) $(MAKESILENT) -f CMakeFiles/dynamic_block.dir/build.make CMakeFiles/dynamic_block.dir/build
.PHONY : dynamic_block/fast

#=============================================================================
\# Target rules for targets named dynamicLib

\# Build rule for target.
dynamicLib: cmake_check_build_system
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 dynamicLib
.PHONY : dynamicLib

\# fast build rule for target.
dynamicLib/fast:
$(MAKE) $(MAKESILENT) -f CMakeFiles/dynamicLib.dir/build.make CMakeFiles/dynamicLib.dir/build
.PHONY : dynamicLib/fast

#=============================================================================
\# Target rules for targets named staticLib

\# Build rule for target.
staticLib: cmake_check_build_system
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 staticLib
.PHONY : staticLib

\# fast build rule for target.
staticLib/fast:
$(MAKE) $(MAKESILENT) -f CMakeFiles/staticLib.dir/build.make CMakeFiles/staticLib.dir/build
.PHONY : staticLib/fast

program.o: program.c.o

.PHONY : program.o

\# target to build an object file
program.c.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/static_block.dir/build.make CMakeFiles/static_block.dir/program.c.o
$(MAKE) $(MAKESILENT) -f CMakeFiles/dynamic_block.dir/build.make CMakeFiles/dynamic_block.dir/program.c.o
.PHONY : program.c.o

program.i: program.c.i

.PHONY : program.i

\# target to preprocess a source file
program.c.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/static_block.dir/build.make CMakeFiles/static_block.dir/program.c.i
$(MAKE) $(MAKESILENT) -f CMakeFiles/dynamic_block.dir/build.make CMakeFiles/dynamic_block.dir/program.c.i
.PHONY : program.c.i

program.s: program.c.s

.PHONY : program.s

\# target to generate assembly for a file
program.c.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/static_block.dir/build.make CMakeFiles/static_block.dir/program.c.s
$(MAKE) $(MAKESILENT) -f CMakeFiles/dynamic_block.dir/build.make CMakeFiles/dynamic_block.dir/program.c.s
.PHONY : program.c.s

source/block.o: source/block.c.o

.PHONY : source/block.o

\# target to build an object file
source/block.c.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/dynamicLib.dir/build.make CMakeFiles/dynamicLib.dir/source/block.c.o
$(MAKE) $(MAKESILENT) -f CMakeFiles/staticLib.dir/build.make CMakeFiles/staticLib.dir/source/block.c.o
.PHONY : source/block.c.o

source/block.i: source/block.c.i

.PHONY : source/block.i

\# target to preprocess a source file
source/block.c.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/dynamicLib.dir/build.make CMakeFiles/dynamicLib.dir/source/block.c.i
$(MAKE) $(MAKESILENT) -f CMakeFiles/staticLib.dir/build.make CMakeFiles/staticLib.dir/source/block.c.i
.PHONY : source/block.c.i

source/block.s: source/block.c.s

.PHONY : source/block.s

\# target to generate assembly for a file
source/block.c.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/dynamicLib.dir/build.make CMakeFiles/dynamicLib.dir/source/block.c.s
$(MAKE) $(MAKESILENT) -f CMakeFiles/staticLib.dir/build.make CMakeFiles/staticLib.dir/source/block.c.s
.PHONY : source/block.c.s

\# Help Target
help:
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... edit_cache"
@echo "... rebuild_cache"
@echo "... dynamicLib"
@echo "... dynamic_block"
@echo "... staticLib"
@echo "... static_block"
@echo "... program.o"
@echo "... program.i"
@echo "... program.s"
@echo "... source/block.o"
@echo "... source/block.i"
@echo "... source/block.s"
.PHONY : help

#=============================================================================
\# Special targets to cleanup operation of make.

\# Special rule to run CMake to check the build system integrity.
\# No rule that depends on this can have commands that come from listfiles
\# because they might be regenerated.
cmake_check_build_system:
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system

repository: rz-steven/oss-repo-template

repo_name: rz-steven/oss-repo-template


text:
SoA
=====

Vector types, but instead of being represented as Array-Of-Struct, data is stored
as a Struct-Of-Arrays, or SoA.

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

A large subset of the `std::Vec` interface is supported, as well as some extras
to make writing efficient code more natural.

Documentation
--------------

See the very thorough [API Docs](http://www.rust-ci.org/cgaebel/soa/doc/soa/).

repository: bwo/soa

repo_name: bwo/soa


text:
# Recombinator - Statistical Resampling in Python

## Overview

Recombinator is a Python package for statistical resampling in Python. It provides various algorithms for the iid bootstrap, the block bootstrap, as well as optimal block-length selection.

## Algorithms

*   I.I.D. bootstrap: Standard i.i.d. bootstrap for one-dimensional and multi-dimensional data, balanced bootstrap, anthithetic bootstrap
*   Block based bootstrap: Moving Block Bootstrap, Circular Block Bootstrap, Stationary Bootstrap, Tapered Block-Bootstrap
*   Optimal block-length selection algorithm for Circular Block Bootstrap and Stationary Bootstrap

## Table of Contents

1.  [Installation](#installation)
2.  [Getting Started](#getting-started)

## Installation
### Latest Release
```shell
    pip install recombinator
```
or
```shell
    pip3 install recombinator
```
if not using Anaconda.

To get the latest version, clone the repository from github,
open a terminal/command prompt, navigate to the root folder and install via
```shell
    pip install .
```
or
```shell
    pip3 install .
```
if not using Anaconda.

### Most Recent Version on GitHub
1. Clone the github repository via

```shell
    git clone https://github.com/InvestmentSystems/recombinator.git
```

2. Navigate to the Recombinator base directory and run
```shell
    pip install .
```

## Getting Started
Please see the Jupyter notebooks 'notebooks/Block Bootstrap.ipynb' and 'notebooks/IID Bootstrap.ipynb' for more examples.

### Basic I.I.D. Bootstrap
Import modules

```python
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline

import numpy as np

from recombinator.iid_bootstrap import \
    iid_balanced_bootstrap, \
    iid_bootstrap, \
    iid_bootstrap_vectorized, \
    iid_bootstrap_via_choice, \
    iid_bootstrap_via_loop, \
    iid_bootstrap_with_antithetic_resampling
```

For illustrative purposes, generate an original dataset of sample size n=100 to resample from.

```python
n=100
np.random.seed(1)
x = np.abs(np.random.randn(n))
```

Estimate the 75th percentile from the original sample
```python
percentile = 75
original_statistic = np.percentile(x, percentile)
print(original_statistic)
```

Now generate 100000 new bootstrap samples by drawing from the original sample with replacement.
```python
R = 100000
x_resampled = iid_bootstrap(x, replications=R)
```
This produces a 100000 x 100 dimensional NumPy array. Each row is a new sample.

If we instead wanted to resample without replacement, we could draw shorter samples.
This is known as as subsampling. See these lecture notes by Charles Geyer for statistical background:
http://www.stat.umn.edu/geyer/5601/notes/sub.pdf.

In recombinator, subsampling is achieved by using the keyword arguments "sub_sample_length" and "replace".
To draw samples of size 50 without replacement we would write
```python
x_resampled = iid_bootstrap(x, replications=R, sub_sample_length=50, replace=False)
```

Let us return to the original example of resampling at the full sample size with replacement.
We are interested in the sampling distribution of a statistic (in this example the 75th percentile of the distribution).
Hence, we calculate the statistic on each of the new bootstrap samples:
```python
resampled_statistic = np.percentile(x_resampled, percentile, axis=1)
```

We can use Recombinator to estimate the bootstrap standard error and the 95%
confidence interval of the statistic as follows.
```python
from recombinator.statistics import \
    estimate_confidence_interval_from_bootstrap, \
    estimate_standard_error_from_bootstrap
```

Estimate the standard error of the estimate of the 75th percentile via bootstrap:
```python
estimate_standard_error_from_bootstrap(bootstrap_estimates=resampled_statistic,
                                       original_estimate=original_statistic)
```

Estimate the 95% confidence interval of the 75th percentile via bootstrap:
```python
estimate_confidence_interval_from_bootstrap(bootstrap_estimates=resampled_statistic,
                                            confidence_level=95)
```

Recombinator supports other variations of the standard i.i.d. bootstrap
(the balanced and the antithetic bootstrap). Please see the Jupyter notebook on the I.I.D. boostrap for examples.

### Block-Based Bootstrap for Time-Series
Recombinator offers the following block-based approaches to resample temporally dependent data:
* Moving Block Bootstrap - Kuensch (1989)
* Circular Block Bootstrap - Politis and Romano (1992)
* Stationary Bootstrap - Politis and Romano (1994)
* Tapered Block Bootstrap - Paparoditis and Politis (2001)

Import statsmodels for the estimation of time-series models.
```python
from statsmodels.tsa.arima_process import ArmaProcess
from statsmodels.tsa.ar_model import AR
import statsmodels.api as sm
from statsmodels.graphics.tsaplots import plot_acf
```

Generate a sample of length n=1000 from an AR(1) process with autoregressive coefficient 0.5:
```python
np.random.seed(1)

# number of time periods
T = 1000

# draw random errors
e = np.random.randn(T)
y = np.zeros((T,))

# y is an AR(1) with phi_1 = 0.5
phi_1 = 0.5
y[0] = e[0]*np.sqrt(1.0/(1.0-phi_1**2))
for t in range(1, T):
    y[t]=phi_1*y[t-1] + e[t]
```

#### Optimal Block-Length
In order to preserve temporal dependence in time-series data,
bootstrap algorithms sample from the original data in blocks rather than
sampling single observations.
A key question is what block length to use.
We are using a data based block length selection algorithm due to Politis and White (2004)
with corrections by Patton, Politis, and White (2007).
This algorithm produces optimal block-lengths for the circular block bootstrap and the stationary bootstrap for the estimation of the variance of the mean.

Import the optimal block-length selection functionality:
```python
from recombinator.optimal_block_length import optimal_block_length
```

Compute the optimal block length of the sample from the AR(1) process created above:
```python
b_star = optimal_block_length(y)
b_star_sb = b_star[0].b_star_sb
b_star_cb = math.ceil(b_star[0].b_star_cb)
print(f'optimal block length for stationary bootstrap = {b_star_sb}')
print(f'optimal block length for circular bootstrap = {b_star_cb}')
```

#### Resampling using a Block-Based Bootstrap
We illustrate the procedure using the circular-block bootstrap.
```python
from recombinator.block_bootstrap import circular_block_bootstrap
```

The true autoregressive coefficient of the process we simulated is 0.5.
The estimated coefficient from the simulated time-series is obtained as follows
```python
ar = AR(y)
estimate_from_original_data = ar.fit(maxlag=1)
print(estimate_from_original_data.params[1])
```

Statsmodels can produce an estimate of the standard error of the estimate of the autoregressive coefficient resorting to asymptotic theory:
```python
print(estimate_from_original_data.bse[1])
```

Generate 10000 new time-series by resampling using a circular-block bootstrap
```python
# number of replications for bootstraps (number of resampled time-series to generate)
B = 10000

y_star_cb \
    = circular_block_bootstrap(y,
                               block_length=b_star_cb,
                               replications=B,
                               replace=True)
```

Now estimate the AR coefficient on each of the bootstrap samples
```python
estimates_from_bootstrap = []
ar_estimates_from_bootstrap = np.zeros((B, ))

for b in range(B):
    y_bootstrap = y_star_cb[b, :]
    ar_bootstrap = AR(y_bootstrap)
    estimate_from_bootstrap = ar_bootstrap.fit(maxlag=1)
    estimates_from_bootstrap.append(estimate_from_bootstrap)
    ar_estimates_from_bootstrap[b] = estimate_from_bootstrap.params[1]
```

Plot the sampling distribution and compute its mean and median
```python
plt.hist(ar_estimates_from_bootstrap, bins=20)
print(f'mean={np.mean(ar_estimates_from_bootstrap)}')
print(f'median={np.median(ar_estimates_from_bootstrap)}')
```

It turns out that the mean and median are below the AR coefficient estimated on the original sample.
This is due to the fact that the block bootstrap approach breaks the temporal
dependence whenever a new block starts.
One can reduce this effect by choosing a higher block-length at the expense of
reducing the number of possible permutations of the data.

Another way to reduce this issue is to use a tapered-block bootstrap which is
designed to mitigate artificial structural breaks introduced by the resampling
procedure at the block-transition points.

Import the function
```python
from recombinator.tapered_block_bootstrap import tapered_block_bootstrap
```

Run the tapered-block bootstrap
```python
y_star_tbb \
    = tapered_block_bootstrap(y,
                              block_length=b_star_cb,
                              replications=B)
```

Again estimate the AR coefficient on each of the new bootstrap samples
```python
estimates_from_bootstrap = []
ar_estimates_from_bootstrap = np.zeros((B, ))

for b in range(B):
    y_bootstrap = y_star_tbb[b, :]
    ar_bootstrap = AR(y_bootstrap)
    estimate_from_bootstrap = ar_bootstrap.fit(maxlag=1)
    estimates_from_bootstrap.append(estimate_from_bootstrap)
    ar_estimates_from_bootstrap[b] = estimate_from_bootstrap.params[1]
```

... and plot the sampling distribution
```python
plt.hist(ar_estimates_from_bootstrap, bins=20)
print(f'mean={np.mean(ar_estimates_from_bootstrap)}')
print(f'median={np.median(ar_estimates_from_bootstrap)}')
```

The mean and median of the distribution are now much closer to the estimate from the original time series.

### Running Recombinator on a GPU
Resampling can be a computationally intensive task, which is highly parallelizable.
The implementations of various algorithms fall into two broad categories:
* Loop-based (via Numba)
* Vectorized (via NumPy)

Vectorized implementations can be run on the GPU depending on the availability a
GPU package with a NumPy compatible interface.
To this end, vectorized implementations in Recombinator lets the user specify
alternative modules and functions that are to be used internally.

A NumPy compatible package that supports both CUDA and OpenCL is Cocos
available at https://github.com/michaelnowotny/cocos.

Using Cocos, resampling on the GPU using Recombinator can be performed as follows.

Import the NumPy-like Cocos package. This requires an ArrayFire installation, a compatible GPU, and the installation of Cocos.
```python
import cocos.numerics as cn
from cocos.device import gpu_sync_wrapper, sync
```

#### I.I.D. Boostrap
Generate an original sample to work with
```python
n = 100
cn.random.seed(1)
x_gpu = cn.absolute(cn.random.randn(n))
plt.hist(x_gpu);
```

Resample using an i.i.d. boostrap
```python
x_resampled_vectorized_gpu \
    = iid_bootstrap_vectorized(x_gpu,
                               replications=R,
                               randint=cn.random.randint)
sync()
```

In this case, GPU support is achieved by simply specifying an alternative
implementation of NumPy's randint function.

#### Block-Based Bootstrap
Transfer the array created in the time-series example above to the GPU
```python
y_gpu = cn.array(y)
```

Run a circular-block boostrap on the GPU
```python
y_star_cb \
    = circular_block_bootstrap_vectorized(y_gpu,
                                          block_length=b_star_cb,
                                          replications=B,
                                          replace=True,
                                          num_pack=cn,
                                          choice=cn.random.choice)
```

Estimate the AR coefficient on each of the bootstrap samples
```python
estimates_from_bootstrap = []
ar_estimates_from_bootstrap = np.zeros((len(y_star_cb), ))

for b in range(len(y_star_cb)):
    y_bootstrap = np.array(y_star_mb[b, :].squeeze())
    ar_bootstrap = AR(y_bootstrap)
    estimate_from_bootstrap = ar_bootstrap.fit(maxlag=1)
    estimates_from_bootstrap.append(estimate_from_bootstrap)
    ar_estimates_from_bootstrap[b] = estimate_from_bootstrap.params[1]
```

Plot the empirical sampling distribution and the compute its mean and median
```python
plt.hist(ar_estimates_from_bootstrap, bins=20)
print(f'mean={np.mean(ar_estimates_from_bootstrap)}')
print(f'median={np.median(ar_estimates_from_bootstrap)}')
```

For the block-based bootstrap, GPU support requires the specification of a
function compatible with NumPy's random.choice as well as a package
(num_pack) that is compatible with NumPy.

#### Cocos-Specific Convenience Functions
The module recombinator.bootstrap_cocos provides Cocos specific wrapper-functions
for GPU enabled vectorized bootstrap procedures.

repository: InvestmentSystems/recombinator

gha_language: Jupyter Notebook

repo_name: InvestmentSystems/recombinator


text:
# onetime-request

A simple onetime URL generator. Created for a personal project.

The webserver is ran by `go run main.go`. You have to set your SendGridUser and SendGridKey as environment variables. `export SendGridUser=___`, and `export SendGridKey=___`.

Onetime URL is sent to someone's email. To send it to someone's email set your environment variable OTUSecretKey to the secret key. For example: `export OTUSecretKey=a0sd0s9sd9sds91`, and then make a POST request to `http://localhost:3000/email` with the JSON being:

```
{
	"sk": "a0sd0s9sd9sds91",
	"email"<EMAIL_ADDRESS>}
```

You're able to pick your own secret key. Then a key will arrive in that email. You're able to go to `http://localhost:3000/_ID IN EMAIL HERE_`.

repository: AbhiAgarwal/onetime-url

repo_name: AbhiAgarwal/onetime-url


text:
---
layout: default
---

# 1996-09-22 - Re: Snake-Oil FAQ

## Header Data

From: Alan Olsen<EMAIL_ADDRESS>To<EMAIL_ADDRESS>(Timothy C. May)

Message Hash: 14d560e8e3a933411359af37c3ddcc7181c33994cf5bf635f76772390bc6ef98

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1996-09-22 21:17:53 UTC

Raw Date: Mon, 23 Sep 1996 05:17:53 +0800

## Raw message

```
{% raw  %}From: Alan Olsen<EMAIL_ADDRESS>Date: Mon, 23 Sep 1996 05:17:53 +0800
To<EMAIL_ADDRESS>(Timothy C. May)
Subject: Re: Snake-Oil FAQ
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

At 03:48 AM 9/22/96 -0700, Timothy C. May wrote:

>The Basic Problem (tm) with a "Snake Oil FAQ" is that the very persons most
>in need of it won't read it.
>
>If those who post descriptions of their "Unbreakable Virtual Whammo-Matic
>Really Complicated Transposition Cipher" have not bothered to read Schneier
>or other basic texts on ciphers, why would they bother to read a Snake Oil
>FAQ? This applies to their customers as well.

I agree that it will no change the glorified decoder ring salesmen, but it
can have a positive effect on their customers.

The FAQ has the ability to reach those who would not nessisarily read
Schneier or any other large tome.

Most of the people outside of this forum have some understanding of
cryptography.  Most of that understanding is based on folklore and
marketing hype.  If we do not take pains to educate them as to what real
crypto is, then we might as well just sit here and prattle on about
Assassination Politics and ad hominem.

You seem to take a pretty negative attitude about what the general public
can and cannot learn from.  If Cypherpunks do not help educate the masses,
who will?  The snake oil salesmen?  The Government?  The masses themselves?
 They are not going to go out and buy a book intended for programmers.
(And especially one that costs about $50.)  There are no "cryptography for
dummies" books.  (At least none worth a damn.)

A FAQ has the ability to propigate in channels that books cannot.  You
cannot forward a book via e-mail.  (Some will claim I have tried...)  The
FAQ has the capability to do alot of good.

If not, where do you think the energy would be better spent?

<sarcasm>"If it saves just one newbie..."</sarcasm>

---
Alan Olsen --<EMAIL_ADDRESS>-- Contract Web Design & Instruction
        `finger -l<EMAIL_ADDRESS>for PGP 2.6.2 key
                http://www.teleport.com/~alano/
  "We had to destroy the Internet in order to save it." - Sen. Exon
                "Microsoft -- Nothing but NT promises."

{% endraw %}
```

## Thread

+ Return to [September 1996](/archive/1996/09)

+ Return to "[Alan Olsen <alano@teleport.com>](/authors/alan_olsen_alano_at_teleport_com_)"

+ 1996-09-22 (Mon, 23 Sep 1996 05:17:53 +0800) - Re: Snake-Oil FAQ - _Alan Olsen<EMAIL_ADDRESS>


text:
# The Algorithms - C++ # {#mainpage}
[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/TheAlgorithms/C-Plus-Plus)
[![Gitter chat](https://img.shields.io/badge/Chat-Gitter-ff69b4.svg?label=Chat&logo=gitter&style=flat-square)](https://gitter.im/TheAlgorithms)
![contributions welcome](https://img.shields.io/static/v1.svg?label=Contributions&message=Welcome&color=0059b3&style=flat-square)
![GitHub repo size](https://img.shields.io/github/repo-size/TheAlgorithms/C-Plus-Plus?color=red&style=flat-square)
![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/TheAlgorithms/C-Plus-Plus?color=green&style=flat-square)
![Doxygen CI](https://github.com/TheAlgorithms/C-Plus-Plus/workflows/Doxygen%20CI/badge.svg)
![Awesome CI](https://github.com/TheAlgorithms/C-Plus-Plus/workflows/Awesome%20CI%20Workflow/badge.svg)

[Online Documentation](https://TheAlgorithms.github.io/C-Plus-Plus).

Click on [Files menu](https://TheAlgorithms.github.io/C-Plus-Plus/files.html) to see the list of all the files documented with the code.

### Algorithms implemented in C++ (for education)
The implementations are for learning purpose. They may be less efficient than the implementation in the standard library.

### Contribute Guidelines
Read our [Contribution Guidelines](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/CONTRIBUTING.md) before you contribute.


text:
# Canvas

This is a spasm example to show how to draw 'Hello World' on a browser's canvas.

```d
import spasm.bindings;
import spasm.dom;
import spasm.types;

@safe:

extern (C) export void _start()
{
  auto canvas = document.createElement("canvas").as!HTMLCanvasElement;
  canvas.width = 400;
  canvas.height = 400;

  import std.algorithm : move;
  auto root = document.querySelector("body").front.move;
  root.appendChild(canvas);

  auto context = canvas.getContext("2d").front.trustedGet!CanvasRenderingContext2D.move;
  context.fillText("Hello World!", 10, 10);
}
```

# Notes

* createElement actually returns an instance of `Element`. The reason we need to typecase it to `HTMLCanvasElement` is because canvas methods like `getContext` are only exposed on `HTMLCanvasElement`. In javascript this is not an issue because of the prototype chain.
* `querySelector` actually returns an instance of `Element?`, so we first have to unwrap the optional to access the `Element`.
* `getContext` returns an optional SumType, we need to unwrap the optional and get the CanvasRenderingContext2D.

repository: rayleyva/spasm

repo_name: rayleyva/spasm


text:
JW Platform API Client
======================

A PHP client library for accessing [JW Platform](https://www.jwplayer.com/products/jwplatform/) API. Visit [JW Player Developer site](https://developer.jwplayer.com/jw-platform/) for more information about JW Platform API.

Installation
------------

Usage
-----

Source Code
-----------

Source code for the JW Platform API library provided on [GitHub](https://github.com/jwplayer/jwplatform-php).

License
-------

JW Platform API library is distributed under the [MIT license](https://github.com/jwplayer/jwplatform-php/blob/master/LICENSE).


text:
Mediawiki in a docker container for EMF. This container bakes in the needed set
of Mediawiki plugins using composer.

## Development

* `docker-compose up`
* Visit http://localhost:8087 and complete the installation wizard

The database credentials are: host `db`, db `wiki`, username `wiki`, password `wiki`. Once
you've downloaded the config file, put it in `./data/config`.

## Updating

If a mediawiki DB needs an upgrade:

    docker-compose exec mediawiki php /var/www/mediawiki/w/maintenance/update.php

And if you're using SMW, you may need to also run extra commands, e.g.:

    docker-compose exec mediawiki php /var/www/mediawiki/w/extensions/SemanticMediaWiki/maintenance/updateEntityCountMap.php

Note that if the wiki is in read-only mode (`$wgReadOnly`), you'll have to disable that, or you'll
get a cryptic error.

## Config
### Short URLs

For short URLs, the appropriate config is:

```
$wgScriptPath = "/w";
$wgUsePathInfo = true;
```

If you're exposing the wiki under a subdirectory, set `URL_PREFIX` in `docker-compose.yml`, e.g.:

```
    environment:
      URL_PREFIX: /2018
```

And update the config to:

```
$wgScriptPath = "/2018/w";
$wgArticlePath = "/2018/wiki/$1";
$wgUsePathInfo = true;
```

### Email

To send emails, you need to set `$wgSMTP`:

```
$wgSMTP = array(
 'host'     => "smtp.host",
 'IDHost'   => "external.domain",
 'port'     => 25,
 'auth'     => false,
);
```

To use the host machine, set `host` to either its FQDN or the default gateway of
the container. `IDHost` should match the hostname used in `$wgServer`.

repository: emfcamp/docker-mediawiki

gha_language: Dockerfile

repo_name: emfcamp/docker-mediawiki


text:
---
layout: post
title: TinkerRule- The Maker's Swiss Army Knife
image: https://farm8.staticflickr.com/7523/15832394669_86dc282a7f_z.jpg
location: TI-CEPD, NSIT, Delhi, India
tags:
- hardware
- projects

---

This project was done during my time at [TI-CEPD,NSIT,Delhi](http://www.cedtnsit.in/). They have an awesome Winter Internship program going on, Be sure to have a look.

I source a lot of my components from Local Markets in Delhi like *Lajpat Rai Market* etc. The problem was that when buying stuff from such places we dont always get a part number, datasheet or footprint details with it, this is very bad when you want to use it in a board that you want to etch or fabricate.

There are two ways to overcome this issue (assuming that the package is not standard) :

1. Measure each and every thing using a vernier and then make a part for it in eagle.
> I used to do it for a long time, until i made this. This is a bit more labourious approach and it involves too much measuring. But , i noticed that **most** leaded parts can be resolved in a 0.1inch grid.

2. Make a reference and then use that to make parts without picking up the vernier.
> In this we make a reference for most common footprints and use them as a reference. What's better is that the known reference helps in finding out packages of some component you found lying in the parts bin.

So, i kept on collecting ideas on what can be made into a tool that helps during the entire cycle from designing the part to etching the board comparing the parts and checking PCBs. Finally i had a list of things to do and started designing the Tool as a PCB on *Eagle* that can be etched. Nothing could offer me better precison than that.

After a few hours of designing, i etched the board (which took quite an effort), then selectively tinned a few pads and applied protective lacquer on the board.

Here's what i mananged.

1. **Continuity Tester** : Built in basic continuity tester to check whether the tracks are correctly etched or whether there is any under cutting. Just plug those alligator clips on the exposed pads and see the LED light up incase of continuity.

2. **Standard Packages** : Some standard packages used, good to compare them and match.

3. **0.1 inch grid** : This is the best one and used most of the times. Makes it easy to simulate breadboard/perfboard behaviour.

4. **Common Drills** : Most common drill sizes(bits) , just see what inserts easily and voila, we have a good enough drill size.

5. **Track Widths** : Compare track widths on the go.

6. **Right angled rule with both inch and cm scale** : Right angled makes it easy while cutting PCBs and marking them and cm and inch scales help in measuring.

7. **Rust Buster** : A fine sandpaper to rust off those parts that just dont solder .

I have now been using it for quite sometime and its really useful and serves the purpose.

If you are interested in this i can mail you the file , just drop me an email at indiantinker [at] gmail [dot] com.

Cheers!

Rohit


text:
---
title: "Multiple X-Frame-Options Header Entries"
alertid: 10020-2
alertindex: 1002002
alerttype: "Passive"
alertcount: 4
status: release
type: alert
risk: Medium
solution: "Ensure only a single X-Frame-Options header is present in the response."
references:
   - https://tools.ietf.org/html/rfc7034
cwe: 1021
wasc: 15
code: https://github.com/zaproxy/zap-extensions/blob/main/addOns/pscanrules/src/main/java/org/zaproxy/zap/extension/pscanrules/XFrameOptionScanRule.java
linktext: org/zaproxy/zap/extension/pscanrules/XFrameOptionScanRule.java
date: 2021-08-25 13:10:42.503Z
lastmod: 2021-08-25 13:10:42.503Z
---
X-Frame-Options (XFO) headers were found, a response with multiple XFO header entries may not be predictably treated by all user-agents.

repository: melissaneira/zaproxy-website

repo_name: melissaneira/zaproxy-website


text:
---
title: "Installing Jenkins X on Alibaba Cloud Container Service"
date: 2019-06-17T07:36:00+02:00
description: >
    Install Jenkins X on Alibaba Cloud Container Service.
categories: [blog]
keywords: [alibaba,container,install,k8s]
slug: "alibaba-container-service-jenkins-x"
aliases: []
author: Carlos Sanchez
---

Installing Jenkins X on Alibaba Cloud Container Service

# Installing Jenkins X in Alibaba Kubernetes Container Service

Jenkins X has just added initial support to install in [Alibaba Container Service](https://www.alibabacloud.com/product/container-service), its Kubernetes offering.

The following instructions allow installation in a managed Kubernetes cluster in any region outside of mainland China, where more configuration is needed avoid using Google services blocked by chinese authorities (Docker images in GCR). There is a [pending issue](https://github.com/jenkins-x/jenkins-x-platform/issues/5551) for that.

## Creating a Kubernetes Cluster

Alibaba requires several things in order to create a Kubernetes cluster, so it is easier to do it through the [web UI](https://cs.console.aliyun.com/) the first time.

The following services need to be activated: Container Service, Resource Orchestration Service (ROS), RAM, and Auto Scaling service, and created the [Container Service roles](https://www.alibabacloud.com/help/doc-detail/86484.htm?spm=a2c63.p38356.b99.38.663a333eMXExon).

If we want to use the command line we can install the [`aliyun`](https://github.com/aliyun/aliyun-cli) cli. I have added all the steps needed below in case you want to use it.

```sh
brew install aliyun-cli
aliyun configure
REGION=ap-southeast-1
```

The clusters need to be created in a VPC, so that needs to be created with VSwitches for each zone to be used.

```sh
aliyun vpc CreateVpc \
    --VpcName jx \
    --Description "Jenkins X" \
    --RegionId ${REGION} \
    --CidrBlock <IP_ADDRESS>/12

{
    "ResourceGroupId": "rg-acfmv2nomuaaaaa",
    "RequestId": "2E795E99-AD73-4EA7-8BF5-F6F391000000",
    "RouteTableId": "vtb-t4nesimu804j33p4aaaaa",
    "VRouterId": "vrt-t4n2w07mdra52kakaaaaa",
    "VpcId": "vpc-t4nszyte14vie746aaaaa"
}

VPC=vpc-t4nszyte14vie746aaaaa

aliyun vpc CreateVSwitch \
    --VSwitchName jx \
    --VpcId ${VPC} \
    --RegionId ${REGION} \
    --ZoneId ${REGION}a \
    --Description "Jenkins X" \
    --CidrBlock <IP_ADDRESS>/24

{
    "RequestId": "89D9AB1F-B4AB-4B4B-8CAA-F68F84417502",
    "VSwitchId": "vsw-t4n7uxycbwgtg14maaaaa"
}

VSWITCH=vsw-t4n7uxycbwgtg14maaaaa
```

Next, a keypair (or password) is needed for the cluster instances.

```sh
aliyun ecs ImportKeyPair \
    --KeyPairName jx \
    --RegionId ${REGION} \
    --PublicKeyBody "$(cat ~/.ssh/id_rsa.pub)"
```

The last step is to create the cluster using the just created VPC, VSwitch and Keypair. It's important to select the option *Expose API Server with EIP* (`public_slb` in the API json) to be able to connect to the API from the internet.

```sh
echo << EOF > cluster.json
{
    "name": "jx-rocks",
    "cluster_type": "ManagedKubernetes",
    "disable_rollback": true,
    "timeout_mins": 60,
    "region_id": "${REGION}",
    "zoneid": "${REGION}a",
    "snat_entry": true,
    "cloud_monitor_flags": false,
    "public_slb": true,
    "worker_instance_type": "ecs.c4.xlarge",
    "num_of_nodes": 3,
    "worker_system_disk_category": "cloud_efficiency",
    "worker_system_disk_size": 120,
    "worker_instance_charge_type": "PostPaid",
    "vpcid": "${VPC}",
    "vswitchid": "${VSWITCH}",
    "container_cidr": "<IP_ADDRESS>/16",
    "service_cidr": "<IP_ADDRESS>/20",
    "key_pair": "jx"
}
EOF

aliyun cs  POST /clusters \
    --header "Content-Type=application/json" \
    --body "$(cat create.json)"

{
    "cluster_id": "cb643152f97ae4e44980f6199f298f223",
    "request_id": "0C1E16F8-6A9E-4726-AF6E-A8F37CDDC50C",
    "task_id": "T-5cd93cf5b8ff804bb40000e1",
    "instanceId": "cb643152f97ae4e44980f6199f298f223"
}

CLUSTER=cb643152f97ae4e44980f6199f298f223
```

We can now download `kubectl` configuration with

```sh
aliyun cs GET /k8s/${CLUSTER}/user_config | jq -r .config > ~/.kube/config-alibaba
export KUBECONFIG=$KUBECONFIG:~/.kube/config-alibaba
```

Another detail before being able to install applications that use `PersistentVolumeClaims` is to [configure a default storage class](https://www.alibabacloud.com/help/doc-detail/86612.htm#a2c63.p38356.879954.i0.11497ec4J5rKJd). There are several volume options that can be listed with `kubectl get storageclass`.

```sh
NAME                          PROVISIONER     AGE
alicloud-disk-available       alicloud/disk   44h
alicloud-disk-common          alicloud/disk   44h
alicloud-disk-efficiency      alicloud/disk   44h
alicloud-disk-ssd             alicloud/disk   44h
```

Each of them matches the following cloud disks:

* alicloud-disk-common: basic cloud disk (minimum size 5GiB). Only available in some zones (us-west-1a, cn-beijing-b,...)
* alicloud-disk-efficiency: high-efficiency cloud disk, ultra disk (minimum size 20GiB).
* alicloud-disk-ssd: SSD disk (minimum size 20GiB).
* alicloud-disk-available: provides highly available options, first attempts to create a high-efficiency cloud disk. If the corresponding AZ's efficient cloud disk resources are sold out, tries to create an SSD disk. If the SSD is sold out, tries to create a common cloud disk.

To set SSDs as the default:

```sh
kubectl patch storageclass alicloud-disk-ssd \
    -p '{"metadata": {"annotations": {"storageclass.kubernetes.io/is-default-class":"true"}}}'
```

**NOTE**: Alibaba cloud disks must be [more than 5GiB (basic) or 20GiB (SSD and Ultra)](https://www.alibabacloud.com/help/doc-detail/25513.htm#h2-url-2)) so we will need to configure any service that is deployed with PVCs to have that size as a minimum or the `PersistentVolume` provision will fail. The Jenkins X deployments [are already configured with this in mind](https://github.com/jenkins-x/cloud-environments/blob/master/env-alibaba/myvalues.yaml).

## Installing Jenkins X

Alibaba Kubernetes clusters won't be able to pull images from the insecure docker registry included in Jenkins X, we need to use Alibaba's Container Registry by going to [https://cr.console.aliyun.com](https://cr.console.aliyun.com) and setting a password.

Then we need to create a Container Registry namespace that allows us to push any image and make them public by default.

From the web UI we can create a Docker login password that we will be using later.

```sh
NAMESPACE=jenkins-x-$(cat /dev/urandom | env LC_CTYPE=C tr -dc 'a-z' | fold -w 6 | head -n 1)
cat << EOF > namespace.json
{
    "Namespace": {
        "Namespace": "${NAMESPACE}"
    }
}
EOF
aliyun cr PUT /namespace \
    --header "Content-Type=application/json" \
    --body "$(cat namespace.json)"

cat << EOF > namespace.json
{
    "namespace": {
        "namespace": "${NAMESPACE}",
        "defaultVisibility": "PUBLIC",
        "autoCreate": true
    }
}
EOF

aliyun cr POST /namespace/${NAMESPACE} \
    --header "Content-Type=application/json" \
    --body "$(cat namespace.json)"

```

Now we can install Jenkins X as usual, passing the `--provider alibaba` flag.

```sh
jx install \
    --provider alibaba \
    --default-admin-password=admin \
    --default-environment-prefix=jx-rocks \
    --tekton \
    --docker-registry=registry.${REGION}.aliyuncs.com \
    --docker-registry-org=${NAMESPACE} \
    -b
```

After installation we need to add the Container Registry credentials to the cluster, the Docker password we have previously created.

```bash
AUTH=$(echo -n "${DOCKER_USERNAME}:${DOCKER_PASSWORD}" | base64)
DATA=$(cat << EOF | base64
{
    "auths": {
        "registry.${REGION}.aliyuncs.com": {
            "auth": "${AUTH}"
        }
    }
}
EOF
)
cat << EOF | kubectl apply -f -
apiVersion: v1
kind: Secret
type: Opaque
metadata:
  name: jenkins-docker-cfg
  namespace: jx
data:
  config.json: ${DATA}
EOF
```

## Installing Addons

Addons can be installed normally with the caveat mentioned above about PVC minimum size. Which means that we may need to pass some Helm values to the `create addon` command, depending on the chart we are installing.

For instance to install Prometheus with 20Gi disks:

```sh
jx create addon prometheus \
    -s alertmanager.persistentVolume.size=20Gi,pushgateway.persistentVolume.size=20Gi,server.persistentVolume.size=20Gi
```

## Tekton

Tekton builds need to be configured to use PVCs bigger than 20Gi due to the same reasons. The default is to use 5GiB PVCs.

```sh
cat << EOF | kubectl apply -f -
apiVersion: v1
kind: ConfigMap
metadata:
  name: config-artifact-pvc
  namespace: jx
data:
  size: 20Gi
EOF
```

repository: jenkins-x/jx-docs

branch_name: refs/heads/main

gha_language: HTML

repo_name: jenkins-x/jx-docs


text:
# _track-suggester_

#### _This application will tell users which Epicodus track they should take, 01/18/2019_

#### By _**Riley Benson**_

## Description

_This application will gather user input using select boxes. Then based on that information, inform the user which epicodus track they should take._

## Setup/Installation Requirements

* _open up this file in your preffered web browser._

## Known Bugs

_The only known problem with this application is that the inputted data does not dissapear when the page is refreshed._

## Support and contact details

_If you have any issues, concerns, or would like to make a contribution E-mail<EMAIL_ADDRESS>
## Technologies Used

_HTML, CSS, Javascript, and Bootstrap were used to make this application._

### License

MIT License

Copyright (c) [2019] [Riley Benson]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

 IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

repository: ryguybenson/track-suggester

repo_name: ryguybenson/track-suggester


text:
# T4.FileManager.VisualStudio

[![Build Status](https://dev.azure.com/databinding/Building%20Blocks/_apis/build/status/databinding-gmbh.T4.FileManager.VisualStudio?branchName=master)](https://dev.azure.com/databinding/Building%20Blocks/_build/latest?definitionId=39&branchName=master) [![Nuget](https://img.shields.io/nuget/v/T4.FileManager.VisualStudio)](https://www.nuget.org/packages/T4.FileManager.VisualStudio/) [![Nuget](https://img.shields.io/nuget/dt/T4.FileManager.VisualStudio)](https://www.nuget.org/packages/T4.FileManager.VisualStudio/)

With the T4.FileManager you can define into which files T4 generates your code. You are no longer bound to the default behaviour of T4 that generates all the code of the “example.tt” template into a single “example.cs” file. Now you can split your code into the files you want:

- Putting each generated data class into a single code file
- Creating a server and a client component based on a common model
- Distribute generated code to multiple projects within a solution
- Set the file properties (like ResXFileCodeGenerator as CustomTool)
- Update previously generated files

## Documentation

Our [documentation](https://databinding-gmbh.github.io/T4.FileManager.VisualStudio/) offers all the details you need to know to work with T4.FileManager.

## Getting Started

### Prerequisites

| Program     | Version     | Info | File        |
|-------------|-------------|------|-------------|
| [Visual Studio](https://visualstudio.microsoft.com/vs/) | 2022 |  since Version 3.0 | T4.FileManager.VisualStudio.ttinclude |
| Visual Studio | 2017, 2019 | since Version 3.0 | T4.FileManager.VisualStudio19.ttinclude |

Visual Studio 16.9.x has a bug that prevents you from debugging T4 templates. See [this post](https://improveandrepeat.com/2021/05/how-to-fix-the-t4-debugger-in-visual-studio-16-9-x/) for an explanation on how to fix it.

### Installing

Install the nuget package in your project.

```
Install-Package T4.FileManager.VisualStudio
```

For more information see [documentation](https://databinding-gmbh.github.io/T4.FileManager.VisualStudio/01-Installation/).

## Running

The execution of the generation remains on the original [T4 Text Templates](https://docs.microsoft.com/en-us/visualstudio/modeling/code-generation-and-t4-text-templates?view=vs-2019).

## Testing

There are some user story oriented [SpecFlow tests](https://databinding-gmbh.github.io/T4.FileManager.VisualStudio/T4FileManagerVisualStudio.html) for ensuring that the FileManager is working as expected.
Tests for NET Framework are located in the project **T4.FileManager.VisualStudio.AcceptanceCriteria** and for NET 5+ in **T4.FileManager.NetCore.AcceptanceCriteria**.

## Authors

- René Leupold - *initial work*
- Johnny Graber

## How to Contribute

Pull-requests are welcome! Please follow these rules so that we can integrate your pull-requests without much effort:

* Create an issue and explain the problem with an example
*	Reference the issue in your commits / pull-request
*	Document the new behavior (in the docs folder)
*	Create tests to verify the new behavior
*	[All existing tests must still pass](https://databinding-gmbh.github.io/T4.FileManager.VisualStudio/T4FileManagerVisualStudio.html), including the acceptance tests (in the tests folder)
*	Clean-up the commit history
    *	No fix commits
    *	Changes that belong together are in the same commit
    *	All commits have a meaningful commit message
* Keep the code maintainable and focused on the problem you try to solve
    *	No feature-flags to turn the main logic on or off
    *	No C# preprocessor directives (like #if DEBUG)
    *	No modification of the author list (on GitHub and in the NuGet package)
    *	No changes on the code style and formatting

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Built With

- [T4 Text Templates](https://docs.microsoft.com/en-us/visualstudio/modeling/)
- [Json.NET](https://www.newtonsoft.com/json)

## Breaking changes to old [T4.TemplateFileManager](https://www.nuget.org/packages/T4.TemplateFileManager)

See section breaking changes of [Change log](https://databinding-gmbh.github.io/T4.FileManager.VisualStudio/12-Change-log/#breaking-changes-compared-to-templatefilemanager)

Link to old T4.TemplateFileManager: https://github.com/renegadexx/T4.Helper.

## T4 Intellisense Extensions for Visual Studio
- [tangible T4 Editor](https://t4-editor.tangible-engineering.com/T4-Editor-Visual-T4-Editing.html)
- [T4Editor](https://github.com/Tim-Maes/T4Editor)
- [devart T4 Editor](https://www.devart.com/t4-editor/)

gha_language: Gherkin


text:
# CDD-React
This repo template for using Component Driven Development using Storybook to develop dynamic components

just a proof of concept following

To start storybook [ src\stories\ ]
```
npm run storybook
```
more info about storybook please refer to [https://www.learnstorybook.com/intro-to-storybook/react/en/get-started/]

To start using node-sass [ sass\ ] using 7 in 1 folder archticture
```
npm run node-sass
```

To run jest tests [ src\ ]
```
npm run test
```

repository: lMINERl/CDD-React

repo_name: lMINERl/CDD-React


text:
---
title:  Types and Type Conversions
---

# Types and Type Conversions

## Newly supported Types
So far the open-source LLVM trunk has not yet implemented bit size support larger than 128bits. We have implemented 256bit supports in our own backend, and is considering contributing them back to main trunk.

Users are allowed to use `i256` and `i160` data types in their generated LLVM IR, which represent 256bit integer types and 160bit integer types respectively.

Even though all EVM data types are 256bit in length internally. We are still able to offer support to smaller data types. However, users are encouraged to use 256bit data types internally because it is free.

## Contract Input Argument Types -- The Solidity convention

Contract arguments are passed to EVM via the call data field. The function dispatcher is responsible to extract input arguments from call data.

In Solidity's convention, the arguments in call data are padded to 32 bytes long if its data type's length is shorter. So, in order to maintain the convention, the function dispatcher needs to truncate the input arguments to the defined size in the function that is going to be called.

This is undoubtedly inefficient, so users are discouraged to use smaller data types.

repository: etclabscore/evm-llvm-website

repo_name: etclabscore/evm-llvm-website


text:
### Description
This file shows how to generate an animation of views from the sun over the course of a day.  Such animations are useful for understanding the times of the day and the year when the sun will be shining on given building elements, like glass facades.  Accordingly, you can anticipate interior glare conditions and the times that the indoor shades will be down.

This file has been submitted by [chriswmackey](https://github.com/chriswmackey)

[Check out this example on Hydra!](http://hydrashare.github.io/hydra/viewer?owner=chriswmackey&fork=hydra_2&id=View_From_Sun_Animation)
### Tags
LBExampleFiles, EPW, Climate, Glare, Direct, Sun, View from Sun, Views from Sun, Animation, Solar, Exposure, HumanCenteredFacades, Grasshopper
### Thumbnail
![Screenshot](https://raw.githubusercontent.com/chriswmackey/hydra/master/View_From_Sun_Animation/thumbnail.png)