text:
#Resourcer

This module attempts to ease the loading and parsing of resource files into the application. It'll load automatically any file of a known format into a hash. That hash will be structured accordingly to the folder structure.

So, for a JSON file stored on: resources/jsons/names.json with the following structure:
```javascript
{
	firstNames : ["Alicia", "Michel", "Penelope"]
}
```

You can use Resourcer like this:

```javascript
var resourcer = require("resourcer")();

resourcer.init({
	path: "/resources/"
});

//.... later on
console.log(resourcer.R.jsons.names.firstNames);
//This will print: ["Alicia", "Michel", "Penelope"]

```

##Install

To install the app, just use npm:

```
$ npm install node-resourcer
```

##Init method

The init method takes two arguments: options and an optional callback.

The options supported are:

+ path: (Mandatory) It's the  path of the folder containing all the resources (can be relative or absolute).
+ extraFormats: (Optional) Hash containing the extra known formats and their respective parsers.
+ verbose: (Optional, defaulted to false) If true, errors and info messages will be printed on the console.
+ csvOpts: (Optional) Configuration options to be used when parsing a CSV file.
	+ fieldSplitter: The character (or characters) to be used as field splitters. By default it's ','
	+ firstRowFieldNames: Tells Resourcer to use the first row of the csv file for field naming, instead of treating it like data. By default it's true.

The optinal callback will be executed after all the resources are loaded.

##Known formats

By default, Resourcer is able to parse JSON, XML and CSV file formats, but it's easily extensible, allowing other file formats to be used.
In order to add support for other formats, just specify the extension and it's parser on the `init`method:

```javascript
resourcer.init({
	path: "/resources/",
	extraFormats: {
		txt: parserFunction
	}
});
```

The parser function will receive the content of the file, and a callback. The callback function receives two parameters, an error (if any) and the json structure that the resource was turned into.

###Working with CSV

In the case of CSV files, there are some considerations to take into account.
Resourcer tries to follow the definition of CSV described on Wikipedia: http://en.wikipedia.org/wiki/Comma-separated_values

By default, Resourcer will assume that the first row on every CSV file contains the names of the columns, which will be turned into the names of the different fields.

i.e:
A CSV file called _people.csv_ inside resources/csv

```
"First Name", "Last Name"
Fernando, Doglio
John, Doe
```

Will turn into:

_resourcer.R.csv.people_
```javascript
[
{
	First_Name: "Fernando",
	Last_Name: "Doglio"
},
{
	First_Name: "John",
	Last_Name: "Doe"
}
]
```

If the CSV doens't have the columns information on the first row, then a configuration option can be set to make Resourcer auto-generate the field names (they will be _filed0_, _field1_, ..., _fieldN_). See above for details on that.

##Original content

Even though all resources are turned into a JSON structure, it's original form is kept, in case it's required by the developer. In order to access the original content, just call the `original` method from the resource.

Going back to the first example, doing:

```javascript
resourcer.R.jsons.names.original();
```
Will return the string content of the file `names.json`
This can be specially useful for non-json resources.

##Resource list

The nodes of the resource tree that don't represent the content of a specific file, are called _PathNodes_ and they are able to list their child resources, using the method  `listResources`.

i.e:

```javascript
console.log(resourcer.R.jsons.listResources());
//Will print: ['names']

```

##Contributing

If you feel like contributing with bug-fixing, new features or just ideas, please follow these simple steps:

+ Create the issue
+ Fork the project
+ Make your changes / Add your feature
+ Add or update the tests
+ Make the pull request

That simple!

##License

The MIT License (MIT)

Copyright (c) 2013 Fernando Doglio

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: deleteman/resourcer

repo_name: deleteman/resourcer


text:
---
title: Troubleshooting Pesky API ApiGatewayV2 Authorizer permissions
tags:
---

Lately I've been building a Web application for [crosscut.io](https://crosscut.io). The frontend is built with Vue/Vuetify, the backend is a mix of TypeScript and R (for GIS Processing). Most of the compute is handled with lambdas, and to provide bi-directional communication I'm using a WebSockets API Gateway. I had a devil of a time getting the permissions to work for the Authorizer. I kept getting errors like this in the API Gateway logs:

2020-07-02T11:34:31.881-04:00 (PDS1PEC4oAMFpyA=) Execution failed due to configuration error: Invalid permissions on Lambda function

2020-07-02T11:34:31.882-04:00 (PDS1PEC4oAMFpyA=) Execution failed due to configuration error: Authorizer error

2020-07-02T11:34:31.882-04:00 (PDS1PEC4oAMFpyA=) Gateway response type: AUTHORIZER_CONFIGURATION_ERROR with status code: 500

After creating an Authorizer through the console instead of through CloudFormation, I realized that the authorizer source arn is different than the other methods (it doesn't run from a stage). I changed my `SourceArn` in the template to this, and then the Authorizer Lambda started working:

{% codeblock Code lang:yaml  %}

AuthPermission:
    Type: AWS::Lambda::Permission
    Properties:
      Action: lambda:InvokeFunction
      FunctionName: !Ref CCAuthorizerLambda
      Principal: apigateway.amazonaws.com
      SourceArn: !Sub "arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${CCApi}/*"
{% endcodeblock %}

For reference, the API Gateway and Authorizer are declared like this:

{% codeblock Code lang:js  %}
CCApi:
    Type: "AWS::ApiGatewayV2::Api"
    Properties:
      Name: cc-api
      ProtocolType: WEBSOCKET
      RouteSelectionExpression: $request.body.action
      ApiKeySelectionExpression: $request.header.x-api-key
CCApiAuthorizer:
    Type: AWS::ApiGatewayV2::Authorizer
    Properties:
      ApiId: !Ref CCApi
      # AuthorizerCredentialsArn: !GetAtt CCApiAuthorizerRole.Arn
      AuthorizerType: REQUEST
      AuthorizerUri: !Sub "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${CCAuthorizerLambda.Arn}/invocations"
      IdentitySource:
        - "route.request.header.Authorization"
      Name: ConnectAuthorizer
{% endcodeblock %}

repository: mapoulos/equulus-blog

branch_name: refs/heads/master

extension: md

gha_language: CSS

license_type: permissive

repo_name: mapoulos/equulus-blog


text:
# ATTRIBUTE Plot

## Goal
The purpose of this analytic is to plot attributes and return a SVG. The analytic requires the x and y parameters to be passed to the analytic.

## Usage:
- Build the analytics container:
```
docker build -t kestrel-analytics-attrib-plot .
```

- Command to trigger kestrel-analytics-attrib-plot analytic
```
nt = get network-traffic from file://samplestix.json where [ipv4-addr:value LIKE '<IP_ADDRESS>']
apply docker://attrib-plot ON foo with XPARAM=pid, YPARAM=number_observed
disp nt
```

repository: rongwutwc/kestrel-analytics

branch_name: refs/heads/release

repo_name: rongwutwc/kestrel-analytics


text:
# YT Downloader

Website for download from Youtube.com

## Getting Started

These instructions will get you a copy of the project up and running on your local machine.

### Prerequisites

What things you need to install the software :

[youtube-dl](https://rg3.github.io/youtube-dl/download.html) and [ffmpeg](https://www.ffmpeg.org/download.html)

### Installing

```
cd /path/to/your/web/root
```
```
git clone https://github.com/OnDebian/YT-Downloader.git
```
```
mv YT-Downloader/* ./
```

And edit configuration file (locate in ``data/config.php``)

## Final Rendering

→ https://ytdl.sts.ovh

Home :

![home](https://screens.sts.ovh/screenshot-04-08-2018_13-11-20.png)

Download Success :

![success](https://screens.sts.ovh/screenshot-04-08-2018_11-38-19.png)

Download failed :

![fail](https://screens.sts.ovh/screenshot-04-08-2018_13-13-45.png)

## Built With

[Symfony/Process](https://github.com/symfony/process)

## Author

[OnDebian](https://github.com/OnDebian) - [Website](https://ondebian.sts.ovh)

## License

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

license: MIT


text:
# FileStorage

## 1. xiangqi
Contain an epd file with perft data

## 2. cpu
Contains cpu.exe, double click to see which compiled stockfish is suitable for your cpu.
```
       Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz
Download modern at https://stockfishchess.org/download/ or at https://abrok.eu/stockfish/

press enter to exit
```

## 3. tcec cutechess-cli
Contain tcec_cutechess-cli.exe

repository: fsmosca/FileStorage

branch_name: refs/heads/main

repo_name: fsmosca/FileStorage


text:
# Deep Low Light Image Enhancement

This work considers the low light image enhancement problem of recovering an enhanced normal light version of a low contrast image which suffers from poor visibilty.
Image enhancement is an inherently ill-posed problem since a given low light image can have many possible normal light equivalents.
We seek to explore, compare and contrast various deep learning based approaches to the problem in supervised and unsupervised settings.
In particular we deal with the following 3 methods

1. Contrast Limited Adaptive Histogram Equalization (CLAHE): A conventional computer vision technique that adaptively equalized fized window regions in the image to improve the image contrast.
2. [EnlightenGAN](https://arxiv.org/abs/1906.06972): A GAN based low light image enhancement method that works without paired supervision.
3. Auto-encoders: U-Net based convolutional auto-encoder architectures with various ablations.

# Programmer's Guide

* The codebase structure and base classes for the auto-encoder based experiments are derived from [this](https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix) repository.
* This structure makes it easy to abstract away common contructs of dataset loading as well as model training, evaluation and visualization.
* In particular, we adopt the base classes for different entities (such as models and dataloaders) and the options handler for all our experiments with the U-Net auto-encoders.
* Based on this structure, we implement a model class for the auto-encoder (in *models/autoencoder\_model.py*) which includes code for initializing the model along with training and testing it based on custom options.
* *options/* contains various different options to select hyper-parameters and training and test setting along with paths to store the results and read the datasets as well as which models to use, number of epochs, etc.
* We also implement a generic dataloader for any dataset having training/validation/testing data (see *data/trainval\_dataloader.py*).
* The LoL dataset can be loaded by our custom dataloader defined in *data/lol\_dataset.py*.
* The scripts *train.py* and *test.py* can be used to train and test an instance of the model with specific commandline options.
* We experiment with multiple variations of the auto-encoder model while varying loss terms (RMSE, SSIM) as well as network architectures (bilinear upsampling, transpose convolution).
* We provide the scripts used to train and test these configurations in the *scripts/* directory.
* In particular, *ex3\_train.py* and *ex3\_test.py* can be used to reproduce the results from our report.
* In order to train a new model instance, simply create a bash script invoking *train.py* with the desired commandline parameters.

Trained models can be tested by invoking the script *test.py* with the desired commandline options specifying the epoch to use for testing along with the directory path to store the results.

# Acknowledgements

Website: https://pkmandke.github.io/ece5554-website/

Template used: https://github.com/yenchiah/project-website-template

repository: pkmandke/low-light-enhance

repo_name: pkmandke/low-light-enhance


text:
# docker-browser-server

Spawn and expose docker containers over http and websockets

```
npm install -g docker-browser-server
```

Running the above will expose a command line tool called `docker-browser-server`.
To run the server do

```
docker-browser-server docker-image-name --port 8080
```

Make sure you pulled `docker-image-name` from a docker registry first.
Running the above will start the server on port 8080

Visit http://localhost:8080 after to attach to a container using a web browser.

## Spawn a new container

To spawn a new container create a websocket to the server and pipe it to a [docker-browser-console](https://github.com/mafintosh/docker-browser-console) instance

``` js
// using browserify
var docker = require('docker-browser-console')
var websocket = require('websocket-stream')

var container = docker()
var socket = websocket('ws://localhost:8080')

container.appendTo(document.body)

socket.pipe(container).pipe(socket)
```

A demo interface is available if you simply visit http://localhost:8080 after starting the server

## Expose filesystem

If you run [expose-fs](https://github.com/mafintosh/expose-fs) inside your container the containers
file system will be exposed using the following rest api

* `GET /files/{container}/{path}` Get a file or directory listing
* `PUT /files/{container}/{path}` Write a new file with the http body
* `POST /files/{container}/{path}` Create a new directory

## Expose a http server

When you spawn a new container a special env var called `$HOST` will be set to a http address.
If you listen on port 80 inside the container all requests going to `$HOST` will be forwarded to this server.

## Adventure time

Checkout [maxogden/adventure-time](https://github.com/maxogden/adventure-time) for a complete client environment
that integrates with docker-browser-server.

The easiest way to create your own workshop is creating a new Dockerfile and inheriting from the [mafintosh/docker-browser-adventure](https://github.com/mafintosh/docker-adventure-time) image.
This will setup expose-fs and install node among other things

```
FROM mafintosh/docker-adventure-time
RUN npm install -g your-workshop-stuff
```

## Programmatic usage

``` js
var server = require('docker-browser-server')

var s = server('mafintosh/dev')

s.on('spawn', function(container) {
  console.log('spawned new container', container.id)
})

s.on('kill', function(container) {
  console.log('killed container', container.id)
})

s.listen(8080)
```

## License

MIT

repository: bmpvieira/docker-browser-server

repo_name: bmpvieira/docker-browser-server


text:
---
layout: post
status: publish
published: true
title: How to set up and use Face ID on iPhone X (and later generations)
author:
  display_name: Charlotte Grainger
  login: LottieBetty
  email<EMAIL_ADDRESS>  url: ''
author_login: LottieBetty
author_email<EMAIL_ADDRESS>wordpress_id: 18730
wordpress_url: https://blog.buymobiles.net/?p=18730
date: '2018-09-24 14:56:38 +0100'
date_gmt: '2018-09-24 13:56:38 +0100'
categories:
- How To
tags:
- apple
- iPhone Setup
- iPhone X
- Face ID
- iPhone Xs
- iPhone Xs Max
---

Unlock your iPhone and pay for things using Face ID.

If you’ve got yourself a shiny iPhone X (or a newer iPhone Xs or Xs Max), and you want to feel like a spy, there’s one feature you will be absolutely buzzing about.

Yes, you know what I’m talking about – Face ID. Here’s how to set it up and use it.

How to Set Up Face ID

Let’s do the groundwork here. For the setup, you’ll need to hold the selfie cam (i.e. the True Depth camera) around 10 to 20 inches away from your face. Make sure that there’s nothing covering it while completing this process.

1) Go to Settings > Face ID & Passcode. You may need to enter your passcode at this point too.

2) Simply tap Set Up Face ID and then Get Started.

3) You’ll see a circular frame on your iPhone X or later. Look directly at it and make sure that your head fits inside the space.

4) When you’ve done so, move your head slowly in a circular motion to complete.

5) After the first Face ID scan, tap Continue.

6) Then repeat the same process of slowly moving your head in a circular motion.

7) Finally, when you have done that, you need to tap Done. And that’s it!

Pay for Things Using Face ID

Now that you’ve got Face ID up and running, it’s time to start using it. One of the cool things you can do with Face ID is authenticating purchases, i.e. buying things. (Note: You’ll need to have Face ID turned on and Apple Pay set up on your iPhone before you use this feature.)

How to Use Apple Pay and Face ID in Shops

If you’re in a shop and want to use Apple Pay, just double-click the side (power) button on your iPhone X or later generation. That’ll bring up your default card on the app. And here’s where things get very high-tech...

All you do is glance at your iPhone screen to authenticate the Face ID request. Once that’s done, simply hold your iPhone near a contactless reader until the payment is complete. You’ll see a small tick with the message Done when it goes through.

How to Use Apple Pay and Face ID in An App or Online

Of course, you can also use Apple Pay when paying for things online with your iPhone.

If you’re using an app or shopping on a website, tap the Buy with Apple Pay option when available. Make sure that the card that comes up is the one that you want to use. Then, double-tab the side button and glance down at your phone. Wait for the purchase to complete. Simple.

How to Unlock Your iPhone with Face ID

It’s one of the coolest tricks (or ‘safety features’) that you will find on iPhone X and later generations.

So, how can you unlock your iPhone using the super-futuristic Face ID? Well, once you’ve set up Face ID, you need to make sure it’s ready to be used. Go to Settings > Face ID & Passcode and then tap iPhone Unlock.

Want to give it a whirl? First, pick your iPhone up to wake the display, or just go ahead and tap the screen. Then, glance down at it for a moment. You’ll notice a little padlock symbol at the top of the screen. When the padlock symbol unlocks, your iPhone is ready to use. Simply swipe up from the bottom of the screen to start navigating around.


text:
# process_mrelease

## Intro
process_mrelease - allows releasing memory from mlock()/mlock2().

## Description
process_mrelease is used to release homogeneous memory locked using mlock() or mlock2(). It accepts two parameters: *pidfd* of type *int*, which is the PID of the process whose memory is to be released, and *flags* of type *unsigned int*, which is used to set flags to determine the behaviour of the syscall. The advantage of using process_mrelease over mlock()/mlock2() is that it offers more fine-grained control; however, a drawback is that it can only be used on homogeneous memory.

## Arguments
* `pidfd`:`int`[K] - A file descriptor referring to the process whose memory is to be released.
* `flags`:`unsigned int`[K] - Flags that can be used to alter the behaviour of the syscall. The flags must be provided as a bit mask, which can be ORed together.

### Available Tags
* K - Originated from kernel-space.
* U - Originated from user space (for example, pointer to user space memory used to get it)
* TOCTOU - Vulnerable to TOCTOU (time of check, time of use)
* OPT - Optional argument - might not always be available (passed with null value)

## Hooks
### do_mrelease
#### Type
Tracepoint probes
#### Purpose
To monitor and trace a successful process mrelease call.

### sys_process_mrelease
#### Type
Kprobe probes
#### Purpose
To monitor and trace the entry and exit of a process mrelease call.

## Example Use Case
A use case for process_mrelease would be for memory locking applications. An application could monitor memory usage changes, and if a certain threshold is met, it could call process_mrelease to release any memory that was locked using mlock()/mlock2().

## Issues
The only issue with process_mrelease is that it can only be used with homogeneous memory. If the memory locked was not homogeneous, the syscall will not succeed.

## Related Events
* mlock()
* munlock()
* mlock2()

> This document was automatically generated by OpenAI and needs review. It might
> not be accurate and might contain errors. The authors of Tracee recommend that
> the user reads the "events.go" source file to understand the events and their
> arguments better.

repository: aquasecurity/tracee

gha_language: Go

repo_name: aquasecurity/tracee


text:
# Change Log

All notable changes to the "flutter-mvvm-architecture-generator" extension will be documented in this file.

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

## [unreleased]
- Create folders for the `Create Widget` command

## [1.4.0]
- Create Folder if `CreateViews` command is given a parameter like `demo/login`

## [1.0.0] - 2019-12-17
- Initial release

gha_license_id: MIT


text:
**Test included variable as include attribute**

{{ included_variable_as_include_attribute }}

**Test included variable**

{{ included_variable }}

**Test included variable with markdown**

{{ included_variable_with_markdown }}

**Test included variable as attribute**

Test

**Test included variable as HTML element**

{{ included_variable_as_html_element }}

**Test included variable overridden by variables.md**

{{ global_variable_overriding_included_variable }}

**Test included variables in included file**

<include src="testIncludeVariablesIncludedFile.md">
  <variable name="included_variable_inner_overridden">Included variable overridden by outer variable</variable>
  <variable name="included_variable_should_not_leak_inner">Included variable should not leak into other files</variable>
</include>

**Inner included variables should not leak into other files**

<include src="testIncludeVariableLeakInner.md" />

**Test included variable with global variable**

{{ included_variable_with_global_variable }}

{% set included_variable = "Set should be overridden by include variable - This should not appear" %}
{% set global_variable = "Set should be overridden by global variable - This should not appear" %}

**Test nunjucks set overridden by include variable and global variable**

{{ included_variable }}
{{ global_variable }}

{% from "testIncludeVariablesIncludedFile.md" import included_variable, global_variable %}

**Test nunjucks import overridden by include variable and global variable**

{{ included_variable }}
{{ global_variable }}

{% include "testIncludeVariablesInner.md" %}

**Test missing variable with default**

{{ missing_variable or "Missing Variable" }}

repository: MarkBind/markbind

gha_language: HTML

repo_name: MarkBind/markbind


text:
# Substrate Carambola Node

## Build & Run

To build the chain, execute the following commands from the project root:

```
$ cargo build --release
```

To execute the chain, run:

```
$ ./target/release/carambola-node --dev
```

The node also supports to use manual seal (to produce block manually through RPC).
This is also used by the ts-tests:

```
$ ./target/debug/carambola-node --dev --manual-seal
```

## Run Example

**0. Run Carambola node and frontend**

* Chạy node
```
$ ./target/release/carambola-node --dev
```

* Phục vụ cho việc Demo
```
https://polkadot.js.org/apps/
```

**1. Create ERC20 Smart Contract to mint token**
* Compile smart contract ERC20 https://github.com/Carambola-Labs/Carambola/blob/master/contracts/MyToken.sol in http://remix.ethereum.org/
* Bytecode:https://github.com/Carambola-Labs/Carambola/blob/master/contracts/bytecode_MyToken.txt
```
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

// Learn more about the ERC20 implementation
// on OpenZeppelin docs: https://docs.openzeppelin.com/contracts/4.x/erc20
import<EMAIL_ADDRESS>
contract MyToken is ERC20 {
    constructor() ERC20("ETH Token", "SET") {
        _mint(msg.sender, 2**256 - 1);
    }
}
```
**2. Convert Substrate's account(H256 - 32 bytes) into Etherium Account (H160 - 20 bytes) in Development **
* Creating Account Alice follow subkey https://docs.substrate.io/v3/tools/subkey/
```
subkey inspect "//Alice"
```
** Result
```
Secret Key URI `//Alice` is account:
  Secret seed:       0xe5be9a5092b81bca64be81d212e7f2f9eba183bb7a90954f7b76361f6edb5c0a
  Public key (hex):  0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d
  Public key (SS58): 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
  Account ID:        0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d
  SS58 Address:      5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
```
** Alice's Etherium Account: Use first 20 bytes of the hex encoded from public key Substrate address
```
0xd43593c715fdd31c61141abd04a99fd6822c8558
```

* Creating Account Bob
```
subkey inspect "//Bob"
```
** Result
```
Secret Key URI `//Bob` is account:
  Secret seed:       0x398f0c28f98885e046333d4a41c19cee4c37368a9832c6502f6cfd182e2aef89
  Public key (hex):  0x8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48
  Account ID:        0x8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48
  Public key (SS58): 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty
  SS58 Address:      5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty

```
** Bob's Etherium Account: Use first 20 bytes of the hex encoded from public key Substrate address
```
0x8eaf04151687736326c9fea17e25fc5287613693
```

**3. Storage Slot**

** Installation dependencies
```
cd utils
npm i
```
** Usage
```
node ./utils <command> <parameters>
```
** Storage Slot for Alice
```
node ./utils --erc20-slot 0 0xd43593c715fdd31c61141abd04a99fd6822c8558
```

** Storage Slot for Bob
```
node ./utils --erc20-slot 0 0x8eaf04151687736326c9fea17e25fc5287613693
```

**4. Contract Creation**

Use the Polkadot UI **Extrinsics** app to deploy the contract from Alice's account (submit the extrinsic as a signed transaction) using **evm > create**

```
source: 0xd43593c715fdd31c61141abd04a99fd6822c8558
init: <raw contract bytecode, a very long hex value>
value: 0
gas_limit:<PHONE_NUMBER>
gas_price: 1
nonce: <empty> {None}
```
** Event Trigger
```
evm.Created
A contract has been created at given [address].
H160
0xb49a2a41bbd68b6f49f03810f299d752875bcf89 // this is smart contract id
```

**5. Check Alice Balance**

Use the **Chain State** app to query **evm > accountStorage** and view the value associated with Alice's account

** first parameter: smart contract id
```
0x8a50db1e0f9452cfd91be8dc004ceb11cb08832f
```

** Second parameter: storage slot

```
0x045c0350b9cf0df39c4b40400c965118df2dca5ce0fbcf0de4aafc099aea4a14
```
** Result: Alice Balance (2 ** 256 -1)

```
0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
```
**6. Transfer Balance from Alice to Bob**

** Use the **Developer** -> **Extrinsics** tab to invoke the **transfer(address, uint256)** function on the ERC-20 contract with **evm > call**
** **input** parameter: ABI encoded for specific function.

*** Go to https://abi.hashex.org/

*** Import ABI code : https://github.com/Carambola-Labs/Carambola/blob/master/contracts/MyToken.sol that is compiled in Remix or in https://github.com/Carambola-Labs/Carambola/blob/master/contracts/abi_MyToken.json

*** Choose function type : **transfer**  with:

```
recipient: 0x8eaf04151687736326c9fea17e25fc5287613693
amount: 221
```
*** Result ABI encode with **transfer** function:

```
0xa9059cbb0000000000000000000000008eaf04151687736326c9fea17e25fc528761369300000000000000000000000000000000000000000000000000000000000000dd
```

** **evm > call**
```
target: 0x8a50db1e0f9452cfd91be8dc004ceb11cb08832f // smart contract id
source: 0xd43593c715fdd31c61141abd04a99fd6822c8558 // Alice EVM's account
input: 0xa9059cbb0000000000000000000000008eaf04151687736326c9fea17e25fc528761369300000000000000000000000000000000000000000000000000000000000000dd
value: 0
gas_limit:<PHONE_NUMBER>
gas_price: 1
```

** Event Trigger

```
evm.Executed
A [contract] has been executed successfully with states applied.
H160
0x8a50db1e0f9452cfd91be8dc004ceb11cb08832f
```

**7. Check Bob Balance**

Use the **Chain State** app to query **evm > accountStorage** and view the value associated with Bob's account

** first parameter: smart contract id
```
0x8a50db1e0f9452cfd91be8dc004ceb11cb08832f
```

** Second parameter: storage slot

```
0xe15f03c03b19c474c700f0ded08fa4d431a189d91588b86c3ef774970f504892
```
** Result: Bob Balance

```
0x00000000000000000000000000000000000000000000000000000000000000dd (221)
```

** Result: Alice Balance

```
0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff22 (2 ** 32 -1 - 221)
```

license: Unlicense

repository: Carambola-Labs/Carambola

repo_name: Carambola-Labs/Carambola


text:
# vlt.file.xml.xmlstruct_stripwhitespace

```
  XMLSTRUCT_STRIPTEXT - Strip nodes with name '#text' from xml structure

   XML_STRUCT = XMLSTRUCT_STRIPWHITESPACETEXT(XML_STRUCT)

   Recursively searches XML_STRUCT, an XML node tree returned from
   vlt.file.xml.parseXML, and strips out all nodes with name '#text'. These seem to
   correspond to whitespace.

   See also: vlt.file.xml.parseXML

```

repository: VH-Lab/vhlab-toolbox-matlab

gha_language: MATLAB

repo_name: VH-Lab/vhlab-toolbox-matlab


text:
# Logic :: Logical Connectives :: Index

* Logical connectives
  * Unary
    - negation, `¬`
    - identity
    - T
    - F, ⟘
  * Binary
    - conjunction, `∧`, `⋀`
    - disjunction, `∨`, `⋁`
    - conditional, `->`, `→`
    - converse implication, `<-`, `←`
    - nonimplication, `⇏`
    - converse nonimplication, `⇍`
    - biconditional, `⟺`, `<=>`
    - Xor, `⊕`
    - Sheffer stroke, `↑`
    - Pierce arrow, `↓`

* Logical connectives
  * Nullary
    - tautology, ⟙
    - contradiction, ⟘
  * Unary
    - negation
    - identity
    - T
    - F, ⟘
  * Binary
    - logical consequence
    - logical conditional
    - material implication
    - biconditional
    - logical equavalence
    - implication
      - contrapositive
      - inversion
      - conversion
      - implication negation


text:
# n8n-workflow-to-openapi

Dump n8n workflows and try to compute openapi yaml file from it.

# Usage

Specify `N8N_URL` and `OPENAPI_BASE` environment variable

`OPENAPI_BASE` should be a valid openapi yaml file.

`node index.js openAPIFileToCreate.yaml`

gha_language: JavaScript


text:
[![Build Status](https://img.shields.io/travis/eix-js/core.svg)](https://travis-ci.com/eix-js/core) [![License](https://img.shields.io/github/license/eix-js/core.svg)](https://github.com/eix-js/core/blob/master/LICENSE.md) [![Version](https://img.shields.io/github/package-json/v/eix-js/core.svg)](https://github.com/eix-js/core) [![Minzipped size size](https://badgen.net/bundlephobia/minzip/@eix-js/core)](https://bundlephobia.com/result?p=@eix-js/core@latest)

# Eix-core
the core of the eix game engine

# Getting started
To get started, you need to have npm and node installed on your machine, and then install @eix/core and ts-node with:
```
npm i @eix/core ts-node
```

Create an `index.ts` file, and import the library:
```ts
import { Ecs } from '@eix/core'
```

Ecs is the main class exposed by this engine:
```ts
const ecs = new Ecs()

ecs.addEntity({
    prop: true
})

ecs
    .flag('prop')
    .get<{prop:boolean}>()
    .each({prop} => console.log(prop)) // true
```

# Playing around with the source:
First, clone this repo:
```sh
git clone "https://github.com/eix-js/core"
```

Then install the dependencies:
```sh
npm install
```

You can use `npm test` to run all tests and `npm run docs` to generate docs.

repository: eix-js/core

repo_name: eix-js/core


text:
# FuryRouter

[![Build Status](https://snap-ci.com/gofury/furyrouter/branch/master/build_image)](https://snap-ci.com/gofury/furyrouter/branch/master)
[![Coverage Status](https://coveralls.io/repos/gofury/furyrouter/badge.svg?branch=master&service=github)](https://coveralls.io/github/gofury/furyrouter?branch=master)
[![GoDoc](http://godoc.org/github.com/gofury/furyrouter?status.png)](http://godoc.org/github.com/gofury/furyrouter)

FuryRouter is forked from [fasthttprouter][fasthttprouter] which in turn is forked from [httprouter][httprouter].
It leverages [fasthttp][fasthttp] and [fasthttp.RequestHandler][fasthttp.RequestHandler] functions and
fetches parameters into `RequestHandler.UserValues`.

## Enhancements

Both `fasthttprouter` and `httprouter` are highly optimised with low memory footprint. However they still suffer from
having to allocate memory for `params`. Which also takes up an extra argument, causing the `Router.Handler` to be
non-compatible when chaining other middleware. Eg:

`func Handler(ctx *fasthttp.RequestCtx, ps fasthttprouter.Params)` is not chainable with `func Middleware(ctx *fasthttp.RequestCtx)`

FuryRouter attempts to improve on this by:

- Getting rid of the extra `params` variable. Uses built in `UserValue` from `RequestHandler` instead.
- Easier middleware chaining as a result of no extra `params` variable being passed. Using chaining library such as [fasthttpchain][fasthttpchain]

## Features

**Only explicit matches:** With other routers, like [`http.ServeMux`][http.ServeMux], a requested URL path could match multiple patterns. Therefore they have some awkward pattern priority rules, like *longest match* or *first registered, first matched*. By design of this router, a request can only match exactly one or no route. As a result, there are also no unintended matches, which makes it great for SEO and improves the user experience.

**Stop caring about trailing slashes:** Choose the URL style you like, the router automatically redirects the client if a trailing slash is missing or if there is one extra. Of course it only does so, if the new path has a handler. If you don't like it, you can [turn off this behavior](https://godoc.org/github.com/julienschmidt/httprouter#Router.RedirectTrailingSlash).

**Path auto-correction:** Besides detecting the missing or additional trailing slash at no extra cost, the router can also fix wrong cases and remove superfluous path elements (like `../` or `//`). Is [CAPTAIN CAPS LOCK](http://www.urbandictionary.com/define.php?term=Captain+Caps+Lock) one of your users? HttpRouter can help him by making a case-insensitive look-up and redirecting him to the correct URL.

**Parameters in your routing pattern:** Stop parsing the requested URL path, just give the path segment a name and the router delivers the dynamic value to you. Because of the design of the router, path parameters are very cheap.

**Zero Garbage:** The matching and dispatching process generates zero bytes of garbage. In fact, the only heap allocations that are made, is by building the slice of the key-value pairs for path parameters. If the request path contains no parameters, not a single heap allocation is necessary.

**Best Performance:** [Benchmarks speak for themselves][benchmark]. See below for technical details of the implementation.

**No more server crashes:** You can set a [Panic handler][Router.PanicHandler] to deal with panics occurring during handling a HTTP request. The router then recovers and lets the `PanicHandler` log what happened and deliver a nice error page.

**Perfect for APIs:** The router design encourages to build sensible, hierarchical RESTful APIs. Moreover it has builtin native support for [OPTIONS requests](http://zacstewart.com/2012/04/14/http-options-method.html) and `405 Method Not Allowed` replies.

Of course you can also set **custom [`NotFound`][Router.NotFound] and  [`MethodNotAllowed`][Router.MethodNotAllowed] handlers** and [**serve static files**][Router.ServeFiles].

## Usage

This is just a quick introduction, view the [GoDoc](http://godoc.org/github.com/gofury/furyrouter) for details.

Let's start with a trivial example:

[examples/basic.go][examples.basic]

### Named parameters

As you can see, `:name` is a *named parameter*. The values are accessible via `RequestCtx.UserValues`. You can get the value of a parameter by using the `ctx.UserValue("name")`.

Named parameters only match a single path segment:

```
Pattern: /user/:user

 /user/gordon              match
 /user/you                 match
 /user/gordon/profile      no match
 /user/                    no match
```

**Note:** Since this router has only explicit matches, you can not register static routes and parameters for the same path segment. For example you can not register the patterns `/user/new` and `/user/:user` for the same request method at the same time. The routing of different request methods is independent from each other.

### Catch-All parameters

The second type are *catch-all* parameters and have the form `*name`. Like the name suggests, they match everything. Therefore they must always be at the **end** of the pattern:

```
Pattern: /src/*filepath

 /src/                     match
 /src/somefile.go          match
 /src/subdir/somefile.go   match
```

## How does it work?

The router relies on a tree structure which makes heavy use of *common prefixes*, it is basically a *compact* [*prefix tree*](https://en.wikipedia.org/wiki/Trie) (or just [*Radix tree*](https://en.wikipedia.org/wiki/Radix_tree)). Nodes with a common prefix also share a common parent. Here is a short example what the routing tree for the `GET` request method could look like:

```
Priority   Path             Handle
9          \                *<1>
3          ├s               nil
2          |├earch\         *<2>
1          |└upport\        *<3>
2          ├blog\           *<4>
1          |    └:post      nil
1          |         └\     *<5>
2          ├about-us\       *<6>
1          |        └team\  *<7>
1          └contact\        *<8>
```

Every `*<num>` represents the memory address of a handler function (a pointer). If you follow a path trough the tree from the root to the leaf, you get the complete route path, e.g `\blog\:post\`, where `:post` is just a placeholder ([*parameter*](#named-parameters)) for an actual post name. Unlike hash-maps, a tree structure also allows us to use dynamic parts like the `:post` parameter, since we actually match against the routing patterns instead of just comparing hashes. [As benchmarks show][benchmark], this works very well and efficient.

Since URL paths have a hierarchical structure and make use only of a limited set of characters (byte values), it is very likely that there are a lot of common prefixes. This allows us to easily reduce the routing into ever smaller problems. Moreover the router manages a separate tree for every request method. For one thing it is more space efficient than holding a method->handle map in every single node, for another thing is also allows us to greatly reduce the routing problem before even starting the look-up in the prefix-tree.

For even better scalability, the child nodes on each tree level are ordered by priority, where the priority is just the number of handles registered in sub nodes (children, grandchildren, and so on..). This helps in two ways:

1. Nodes which are part of the most routing paths are evaluated first. This helps to make as much routes as possible to be reachable as fast as possible.
2. It is some sort of cost compensation. The longest reachable path (highest cost) can always be evaluated first. The following scheme visualizes the tree structure. Nodes are evaluated from top to bottom and from left to right.

```
├------------
├---------
├-----
├----
├--
├--
└-
```

## Why doesn't this work with `http.Handler`?

Becasue fasthttp doesn't use http.Handler. See this [description][fasthttp.switch].

Fasthttp works with [RequestHandler][fasthttp.RequestHandler] functions instead of objects implementing Handler interface. So a FastHttpRouter provides a [Handler][Router.Handler] interface to implement the `fasthttp.ListenAndServe` interface.

Just try it out for yourself, the usage of FastHttpRouter is very straightforward. The package is compact and minimalistic, but also probably one of the easiest routers to set up.

## Where can I find Middleware *X*?

This package just provides a very efficient request router with a few extra features. The router is just a [`fasthttp.RequestHandler`][fasthttp.RequestHandler], you can chain any fasthttp.RequestHandler compatible middleware before the router. Or you could [just write your own](https://justinas.org/writing-http-middleware-in-go/), it's very easy!

Alternatively, you could try a web framework based on FastHttpRouter - Coming soon.

### Multi-domain / Sub-domains

Here is a quick example: Does your server serve multiple domains / hosts?
You want to use sub-domains?
Define a router per host!

[examples/hosts.go][examples.hosts]

### Basic Authentication

Another quick example: Basic Authentication (RFC 2617) for handles

[examples/auth.go][examples.auth]

## Chaining with the NotFound handler

**NOTE: It might be required to set [`Router.HandleMethodNotAllowed`][Router.HandleMethodNotAllowed] to `false` to avoid problems.**

You can use another [`fasthttp.RequestHandler`][fasthttp.RequestHandler], for example another router, to handle requests which could not be matched by this router by using the [`Router.NotFound`][Router.NotFound] handler. This allows chaining.

### Static files
The `NotFound` handler can for example be used to serve static files from the root path `/` (like an index.html file along with other assets):

```go
// Serve static files from the ./public directory
router.NotFound = fasthttp.FSHandler("./public", 0)
```

But this approach sidesteps the strict core rules of this router to avoid routing problems. A cleaner approach is to use a distinct sub-path for serving files, like `/static/*filepath` or `/files/*filepath`.

## Web Frameworks based on FuryRouter

You might try one of the following more high-level 3rd-party web frameworks building upon the FuryRouter package:

[benchmark]: <https://github.com/julienschmidt/go-http-routing-benchmark>
[httprouter]: <https://github.com/julienschmidt/httprouter>
[fasthttp]: <https://godoc.org/github.com/valyala/fasthttp>
[fasthttp.switch]: <https://github.com/valyala/fasthttp#switching-from-nethttp-to-fasthttp>
[fasthttp.RequestHandler]: <https://godoc.org/github.com/valyala/fasthttp#RequestHandler>
[http.ServeMux]: <https://golang.org/pkg/net/http/#ServeMux>
[Router.Handle]: <https://godoc.org/github.com/gofury/furyrouter#Router.Handle>
[Router.HandleMethodNotAllowed]: <https://godoc.org/github.com/gofury/furyrouter#Router.HandleMethodNotAllowed>
[Router.MethodNotAllowed]: <https://godoc.org/github.com/gofury/furyrouter#Router.MethodNotAllowed>
[Router.Handler]: <https://godoc.org/github.com/gofury/furyrouter#Router.Handler>
[Router.NotFound]: <https://godoc.org/github.com/gofury/furyrouter#Router.NotFound>
[Router.PanicHandler]: <https://godoc.org/github.com/gofury/furyrouter#Router.PanicHandler>
[Router.ServeFiles]: <https://godoc.org/github.com/gofury/furyrouter#Router.ServeFiles>
[fasthttprouter]: <https://github.com/buaazp/fasthttprouter>
[fasthttpchain]: <https://github.com/gofury/fasthttpchain>
[examples.basic]: <https://github.com/gofury/furyrouter/blob/master/examples/basic.go>
[examples.auth]: <https://github.com/gofury/furyrouter/blob/master/examples/auth.go>
[examples.hosts]: <https://github.com/gofury/furyrouter/blob/master/examples/hosts.go>

repository: prateek-forks/furyrouter

repo_name: prateek-forks/furyrouter


text:
# `::` double-colon type conversion

AlaSQL supports ```::``` operator:

```js
   alasql('SELECT '10/12/2013'::DATE');
```

To cast types to Number you can use one of three forms:
```sql
    SELECT CAST(a AS NUMBER), FORMAT(NUMBER,a), a::NUMBER
```

license: MS-PL,MIT

detected_licenses: MS-PL MIT


text:
# [Obsolete] facebook_events_scraper

## Install

`pip install facebook_events_scraper`

## Usage

```
import facebook_events_scraper as fes
fes.driver(chromedriver)
fes.login(email, password)
fes.event_info(driver, link="")
fes.events_recurring(driver, link="")
fes.events_upcoming(driver, link="")
fes.events(driver, link="")
```

### driver(pathToChromeDriver)

- You can write your own selenium webdriver code, and also use other browser drivers
- Or, you can use the package's driver function
- To download Chromedriver: https://chromedriver.chromium.org/downloads
- example:
  `driver = facebook_events_scraper.driver("chromedriver")`

### login(email, password)

- If you use the package's driver, you only needs to login once because it creates selenium folder which will save the Chrome cookies, the settings, extensions, etc, and the logins done in the previous session are present here.
- Example<EMAIL_ADDRESS>"mypassword")`
  i

### event_info(driver, link="")

- Example: `facebook_events_scraper.event_info(driver, "https://www.facebook.com/events/310254858646618")`
- The function returns one dictionary

```
return {
    "hosts": ["...", "...", ....],
    "title": "...",
    "time": "...",
    "description": "...",
    "location": "...",
    "ticket": "...",
    "link": "...",
    "image": "...",
    "interested": "...",
    "going": "...",
    "categories": ["...", "...", ....]
}
```

### events_upcoming(driver, link="") and events_recurring(driver, link="")

- Example: `facebook_events_scraper.events_upcoming(driver, "https://www.facebook.com/pagename/events/")`
- Example: `facebook_events_scraper.events_recurring(driver, "https://www.facebook.com/pagename/events/")`
- The function returns a list of dictionaries

```
return [
    {
        "hosts": ["...", "...", ....],
        "title": "...",
        "time": "...",
        "description": "...",
        "location": "...",
        "ticket": "...",
        "link": "...",
        "image": "...",
        "interested": "...",
        "going": "...",
        "categories": ["...", "...", ....]
    },
    {
        "hosts": ["...", ...],
        "title": "...",
        ...
        ...
        ...
    },
    ...
    ...
    ...
]
```

### events(driver, link="")

- Example: `facebook_events_scraper.events(driver, "https://www.facebook.com/pagename/events/")`
- The function returns a list of dictionaries

```
return [events_upcoming(driver, link) + events_recurring(driver, link)]
```

- Note: All the scraping function only works when the facebook layout is the same as when the browser is maximized

## Preview

[![event_info](https://thumbs.gfycat.com/UncommonPoliteIchthyostega-size_restricted.gif)](https://giant.gfycat.com/UncommonPoliteIchthyostega.mp4)
[![event_recurring](https://thumbs.gfycat.com/WideeyedLoathsomeBanteng-size_restricted.gif)](https://giant.gfycat.com/WideeyedLoathsomeBanteng.mp4)
[![event_upcoming](https://thumbs.gfycat.com/ReliableWarlikeBobcat-size_restricted.gif)](https://giant.gfycat.com/ReliableWarlikeBobcat.mp4)


text:
![oz Logo](https://raw.github.com/hueniverse/oz/master/images/oz.png)

Oz is a web authorization protocol based on industry best practices. Oz combines the
[Hawk](https://github.com/hueniverse/hawk) authentication protocol with the
[Iron](https://github.com/hueniverse/iron) encryption protocol to provide a simple to use and
secure solution for granting and authenticating third-party access to an API on behalf of a user or
an application.

Protocol version: **4.0.0** (Same as v1.0.0 but moved the expired ticket indicator from a header
attribute to the error payload).

[![Build Status](https://secure.travis-ci.org/hueniverse/oz.png)](http://travis-ci.org/hueniverse/oz)

- [Protocol](#protocol)
  - [Workflow](#workflow)
  - [Application](#application)
  - [User](#user)
  - [Ticket](#ticket)
    - [Grant](#grant)
    - [Scope](#scope)
    - [Rsvp](#rsvp)
- [API](#api)
  - [Shared objects](#shared-objects)
    - [`app` object](#app-object)
    - [`grant` object](#grant-object)
    - [`ticket` response](#ticket-response)
  - [`Oz.client`](#ozclient)
    - [`Oz.client.header(uri, method, ticket, [options])`](#ozclientheaderuri-method-ticket-options)
    - [`new Oz.client.Connection(options)`](#new-ozclientconnectionoptions)
      - [`connection.request(path, ticket, options, callback)`](#connectionrequestpath-ticket-options-callback)
      - [`connection.app(path, options, callback)`](#connectionapppath-options-callback)
      - [`connection.reissue(ticket, callback)`](#connectionreissueticket-callback)
  - [`Oz.endpoints`](#ozendpoints)
    - [Endpoints options](#endpoints-options)
      - [`encryptionPassword`](#encryptionpassword)
      - [`loadAppFunc`](#loadappfunc)
      - [`loadGrantFunc`](#loadgrantfunc)
    - [`endpoints.app(req, payload, options, callback)`](#endpointsappreq-payload-options-callback)
    - [`endpoints.reissue(req, payload, options, callback)`](#endpointsreissuereq-payload-options-callback)
    - [`endpoints.rsvp(req, payload, options, callback)`](#endpointsrsvpreq-payload-options-callback)
  - [`Oz.hawk`](#ozhawk)
  - [`Oz.scope`](#ozscope)
    - [`Oz.scope.validate(scope)`](#ozscopevalidatescope)
    - [`Oz.scope.isSubset(scope, subset)`](#ozscopeissubsetscope-subset)
  - [`Oz.server`](#ozserver)
    - [`Oz.server.authenticate(req, encryptionPassword, options, callback)`](#ozserverauthenticatereq-encryptionpassword-options-callback)
  - [`Oz.ticket`](#ozticket)
    - [Ticket options](#ticket-options)
    - [`ticket.issue(app, grant, encryptionPassword, options, callback)`](#ticketissueapp-grant-encryptionpassword-options-callback)
    - [`ticket.reissue(parentTicket, grant, encryptionPassword, options, callback)`](#ticketreissueparentticket-grant-encryptionpassword-options-callback)
    - [`ticket.rsvp(app, grant, encryptionPassword, options, callback)`](#ticketrsvpapp-grant-encryptionpassword-options-callback)
    - [`ticket.generate(ticket, encryptionPassword, options, callback)`](#ticketgenerateticket-encryptionpassword-options-callback)
    - [`ticket.parse(id, encryptionPassword, options, callback)`](#ticketparseid-encryptionpassword-options-callback)

## Protocol

Oz builds on the well-understood concepts behind the [OAuth](https://tools.ietf.org/html/rfc5849)
protocol. While the terminology has been updated to reflect the common terms used today when
building applications with third-party access, the overall architecture is the same. This document
assumes the reader is familiar with the OAuth 1.0a protocol workflow.

### Workflow

1. The [application](#application) uses its previously issued [Hawk](https://github.com/hueniverse/hawk)
  credentials to authenticate with the server and request an application [ticket](#ticket). If valid,
  the server issues an application ticket.
2. The application directs the [user](#user) to grant it authorization by providing the user with its
  application identifier. The user authenticates with the server, reviews the authorization
  [grant](#grant) and its [scope](#scope), and if approved the server returns an [rsvp](#rsvp).
3. The user returns to the application with the rsvp which the application uses to request a new
  user-specific ticket. If valid, the server returns a new ticket.
4. The application uses the user-ticket to access the user's protected resources.

### Application

Oz is an application-to-server authorization protocol. This means credentials are issued only to
applications, not to users. The method through which users authenticate is outside the scope of
this protocol.

The application represents a third-party accessing protected resource on the server. This
third-party can be another server, a native app, a single-page-app, or any other application using
web resources. The protected resources can be under the control of the application itself or under
the control of a user who grants the application access.

Each application definition includes:
- `id` - a unique application identifier.
- `scope` - the default application [scope](#scope).
- `delegate` - if `true`, the application is allowed to delegate a ticket to another application.
  Defaults to `false`.

Applications must be registered with the server prior to using Oz. The method through which
applications register is outside the scope of this protocol. When an application registers, it is
issued a set of [Hawk](https://github.com/hueniverse/hawk) credentials. The application uses these
credentials to obtain an Oz [ticket](#ticket).

The application Hawk credentials include:
- `id` - the unique application identifier.
- `key` - a shared secret used to authenticate.
- `algorithm` - the HMAC algorithm used to authenticate (e.g. HMAC-SHA256).

The [Hawk](https://github.com/hueniverse/hawk) protocol supports two Oz-specific header attributes
which are used for authenticating Oz applications (`app` and `dlg`).

### User

Applications act on behalf of users. Users are usually people with protected resources on the
server who would like to use the application to access those protected resources. For the purpose
of the Oz protocol, each user must have a unique identifier which is used by the protocol to record
access rights. The method through which users are registered, authenticated, and managed is beyond
the scope of this protocol.

### Ticket

An Oz ticket is a set of [Hawk](https://github.com/hueniverse/hawk) credentials used by the
application to access protected resources. Just like any other Hawk credentials, the ticket
includes:
- `id` - a unique identifier for the authorized access.
- `key` - a shared secret used to authenticate.
- `algorithm` - the HMAC algorithm used to authenticate (e.g. HMAC-SHA256).

However, unlike most Hawk credential identifiers, the Oz identifier is an encoded
[Iron](https://github.com/hueniverse/iron) string which when decoded contains:
- `exp` - ticket expiration time in milliseconds since 1/1/1970.
- `app` - the application id the ticket was issued to.
- `user` - the user id if the ticket represents access to user resources. If no user id is included,
  the ticket allows the application access to the application own resources only.
- `scope` - the ticket [scope](#scope). Defaults to `[]` if no scope is specified.
- `delegate` - if `false`, the ticket cannot be delegated regardless of the application permissions.
  Defaults to `true` which means use the application permissions to delegate.
- `grant` - if `user` is set, includes the [grant](#grant) identifier referencing the authorization
  granted by the user to the application. Can be a unique identifier or string encoding the grant
  information as long as the server is able to parse the information later.
- `dlg` - if the ticket is the result of access delegation, the application id of the delegating
  application.
- `ext` - custom server data where:
    - `public` - also made available to the application when the ticket is sent back.
    - `private` - available only within the encoded ticket.

When a ticket is generated and sent to the application by the server, the response includes all of
the above properties with the exception of `ext` which is included but only with the content of
`ext.public` if present.

The ticket expiration can be shorter than the grant expiration in which case, the application can
reissue the ticket. This provides the ability to limit the time credentials are valid but allowing
grants to have longer lifetime.

When tickets are reissued, they can be constrained to less scope or duration, and can also be
issued to another application for access delegation.

#### Grant

A grant is the authorization given to an application by a user to access the user's protected
resources. Grants can be persisted in a database (usually to support revocation) or can be self
describing (using an encoded identifier). Each grant contains:
- `id` - the grant identifier, allowing the server to retrieve or recreate the grant information.
- `exp` - authorization expiration time in milliseconds since 1/1/1970.
- `user` - the user id who the user who authorized access.
- `scope` - the authorized [scope](#scope). Defaults to the application scope if no scope is
  specified.

#### Scope

Scope is an array of strings, each represents an implementation-specific permission on the server.
Each scope string adds additional permissions to the application (i.e. `['a', 'b']` grants the
application access to both the `'a'` and `'b'` rights, individually).

Each application has a default scope which is included in the tickets issued to the application
unless the grant specifies a subset of the application scope. Applications cannot be granted scopes
not present in their default set.

#### Rsvp

When the user authorizes the application access request, the server issues an rsvp which is an
encoded string containing the application identifier, the grant identifier, and an expiration.

## API

The Oz public API is offered as a full toolkit to implement the protocol as-is or to modify it to
fit custom security needs. Most implementations will only need to use the [endpoints functions](#ozendpoints)
methods and the [`ticket.rsvp()`](#ticketrsvpapp-grant-encryptionPassword-options-callback) method
directly.

### Shared objects

#### `app` object

An object describing an application where:
- `id` - the application identifier.
- `scope` - an array with the default application scope.
- `delegate` - if `true`, the application is allowed to delegate a ticket to another application.
  Defaults to `false`.
- `key` - the shared secret used to authenticate.
- `algorithm` - the HMAC algorithm used to authenticate (e.g. HMAC-SHA256).

#### `grant` object

An object describing a user grant where:
- `id` - the grant identifier.
- `app` - the application identifier.
- `user` - the user identifier.
- `exp` - grant expiration time in milliseconds since 1/1/1970.
- `scope` - an array with the scope granted by the user to the application.

#### `ticket` response

An object describing a ticket and its public properties:
- `id` - the ticket identifier used for making authenticated Hawk requests.
- `key` - a shared secret used to authenticate.
- `algorithm` - the HMAC algorithm used to authenticate (e.g. HMAC-SHA256).
- `exp` - ticket expiration time in milliseconds since 1/1/1970.
- `app` - the application id the ticket was issued to.
- `user` - the user id if the ticket represents access to user resources. If no user id is
  included, the ticket allows the application access to the application own resources only.
- `scope` - the ticket [scope](#scope). Defaults to `[]` if no scope is specified.
- `grant` - if `user` is set, includes the [grant](#grant) identifier referencing the authorization
    granted by the user to the application. Can be a unique identifier or string encoding the grant
    information as long as the server is able to parse the information later.
- `delegate` - if `false`, the ticket cannot be delegated regardless of the application permissions.
  Defaults to `true` which means use the application permissions to delegate.
- `dlg` - if the ticket is the result of access delegation, the application id of the delegating
    application.
- `ext` - custom server public data attached to the ticket.

### `Oz.client`

Utilities used for making authenticated Oz requests.

#### `Oz.client.header(uri, method, ticket, [options])`

A convenience utility to generate the application Hawk request authorization header for making
authenticated Oz requests where:
- `uri` - the request URI.
- `method` - the request HTTP method.
- `ticket` - the authorization [ticket](#ticket-response).
- `options` - additional Hawk `Hawk.client.header()` options.

#### `new Oz.client.Connection(options)`

Creates an **oz** client connection manager for easier access to protected resources. The client
manages the ticket lifecycle and will automatically refresh the ticken when expired. Accepts the
following options:
- `endpoints` - an object containing the server protocol endpoints:
    `app` - the application credentials endpoint path. Defaults to `'/oz/app'`.
    `reissue` - the ticket reissue endpoint path. Defaults to `'/oz/reissue'`.
- `uri` - required, the server full root uri without path (e.g. 'https://example.com').
- `credentials` - required, the application **hawk** credentials.

##### `connection.request(path, ticket, options, callback)`

Requests a protected resource where:
- `path` - the resource path (e.g. '/resource').
- `ticket` - the application or user ticket. If the ticket is expired, it will automatically
  attempt to refresh it.
- `options` - optional configuration object where:
    - `method` - the HTTP method (e.g. 'GET'). Defaults to `'GET'`.
    - `payload` - the request payload object or string. Defaults to no payload.
- `callback` - the callback method using the signature `function(err, result, code, ticket)` where:
    - `err` - an error condition.
    - `result` - the requested resource (parsed to object if JSON).
    - `code` - the HTTP response code.
    - `ticket` - the ticket used to make the request (may be different from the ticket provided
      when the ticket was expired and refreshed).

##### `connection.app(path, options, callback)`

Requests a protected resource using a shared application ticket where:
- `path` - the resource path (e.g. '/resource').
- `options` - optional configuration object where:
    - `method` - the HTTP method (e.g. 'GET'). Defaults to `'GET'`.
    - `payload` - the request payload object or string. Defaults to no payload.
- `callback` - the callback method using the signature `function(err, result, code, ticket)` where:
    - `err` - an error condition.
    - `result` - the requested resource (parsed to object if JSON).
    - `code` - the HTTP response code.
    - `ticket` - the ticket used to make the request (may be different from the ticket provided
      when the ticket was expired and refreshed).

Once an application ticket is obtained internally using the provided **hawk** credentials in the
constructor, it will be reused by called to `connection.app()`. If it expires, it will
automatically refresh and stored for future usage.

##### `connection.reissue(ticket, callback)`

Reissues (refresh) a ticket where:
- `ticket` - the ticket being reissued.
- `callback` - the callback method using the signature `function(err, reissued)` where:
    - `err` - an error condition.
    - `reissued` - the reissued ticket.

### `Oz.endpoints`

The endpoint methods provide a complete HTTP request handler implementation which is designed to
be plugged into an HTTP framework such as [**hapi**](http://hapijs.com). The
[**scarecrow**](https://github.com/hueniverse/scarecrow) plugin provides an example of how these
methods integrate with an existing server implementation.

#### Endpoints options

Each endpoint method accepts a set of options.

##### `encryptionPassword`

A required string used to generate the ticket encryption key. Must be kept confidential. The string
must be the same across all Oz methods and deployments in order to allow the server to parse and
generate compatible encoded strings.

The `encryptionPassword` value is passed directly to the [Iron](https://github.com/hueniverse/iron)
module which supports additional inputs for pre-generated encryption and integrity keys as well as
password rotation.

##### `loadAppFunc`

The application lookup method using the signature `function(id, next)` where:
- `id` - the application identifier being requested.
- `next` - the callback method used to return the requested application using the signature
    `function(err, app)` where:
    - `err` - an error condition.
    - `app` - an [application](#app-object) object.

##### `loadGrantFunc`

The grant lookup method using the signature `function(id, next)` where:
- `id` - the grant identifier being requested.
- `next` - the callback method used to return the requested grant using the signature
    `function(err, grant, ext)` where:
    - `err` - an error condition.
    - `grant` - a [grant](#grant-object) object.
    - `ext` - an object used to include custom server data in the ticket and response where:
        - `public` - an object which is included in the response under `ticket.ext` and in
            the encoded ticket as `ticket.ext.public`.
        - `private` - an object which is included only in the encoded ticket as
            `ticket.ext.private`.

#### `endpoints.app(req, payload, options, callback)`

Authenticates an application request and if valid, issues an application ticket where:
- `req` - the node HTTP server request object.
- `payload` - this argument is ignored and is defined only to keep the endpoint method signature
  consistent with the other endpoints.
- `options` - protocol [configuration](#endpoints-options) options where:
    - `encryptionPassword` - required.
    - `loadAppFunc` - required.
    - `ticket` - optional [ticket options](#ticket-options) used for parsing and issuance.
    - `hawk` - optional [Hawk](https://github.com/hueniverse/hawk) configuration object. Defaults to
      the Hawk defaults.
- `callback` - the method used to return the request result with signature `function(err, ticket)` where:
    - `err` - an error condition.
    - `ticket` - a [ticket response](#ticket-response) object.

#### `endpoints.reissue(req, payload, options, callback)`

Reissue an existing ticket (the ticket used to authenticate the request) where:
- `req` - the node HTTP server request object.
- `payload` - The HTTP request payload fully parsed into an object with the following optional keys:
    - `issueTo` - a different application identifier than the one of the current application. Used
      to delegate access between applications. Defaults to the current application.
    - `scope` - an array of scope strings which must be a subset of the ticket's granted scope.
      Defaults to the original ticket scope.
- `options` - protocol [configuration](#endpoints-options) options where:
    - `encryptionPassword` - required.
    - `loadAppFunc` - required.
    - `loadGrantFunc` - required.
    - `ticket` - optional [ticket options](#ticket-options) used for parsing and issuance.
    - `hawk` - optional [Hawk](https://github.com/hueniverse/hawk) configuration object. Defaults to
      the Hawk defaults.
- `callback` - the method used to return the request result with signature `function(err, ticket)` where:
    - `err` - an error condition.
    - `ticket` - a [ticket response](#ticket-response) object.

#### `endpoints.rsvp(req, payload, options, callback)`

Authenticates an application request and if valid, exchanges the provided rsvp with a ticket where:
- `req` - the node HTTP server request object.
- `payload` - The HTTP request payload fully parsed into an object with the following keys:
    - `rsvp` - the required rsvp string provided to the user to bring back to the application after
      granting authorization.
- `options` - protocol [configuration](#endpoints-options) options where:
    - `encryptionPassword` - required.
    - `loadAppFunc` - required.
    - `loadGrantFunc` - required.
    - `ticket` - optional [ticket options](#ticket-options) used for parsing and issuance.
    - `hawk` - optional [Hawk](https://github.com/hueniverse/hawk) configuration object. Defaults to
      the Hawk defaults.
- `callback` - the method used to return the request result with signature `function(err, ticket)` where:
    - `err` - an error condition.
    - `ticket` - a [ticket response](#ticket-response) object.

### `Oz.hawk`

Provides direct access to the underlying [Hawk](https://github.com/hueniverse/hawk) module.

### `Oz.scope`

Scope manipulation utilities.

#### `Oz.scope.validate(scope)`

Validates a scope for proper structure (an array of unique strings) where:
- `scope` - the array being validated.

Returns an `Error` is the scope failed validation, otherwise `null` for valid scope.

#### `Oz.scope.isSubset(scope, subset)`

Checks whether a scope is a subset of another where:
- `scope` - the superset.
- `subset` - the subset.

Returns `true` if the `subset` is fully contained with `scope`, otherwise `false.

### `Oz.server`

Server implementation utilities.

#### `Oz.server.authenticate(req, encryptionPassword, options, callback)`

Authenticates an incoming request using [Hawk](https://github.com/hueniverse/hawk) and performs
additional Oz-specific validations where:
Authenticates an application request and if valid, issues an application ticket where:
- `req` - the node HTTP server request object.
- `encryptionPassword` - the ticket [encryption password](#encryptionPassword).
- `options` - protocol [configuration](#endpoints-options) options where:
    - `ticket` - optional [ticket options](#ticket-options) used for parsing and issuance.
    - `hawk` - optional [Hawk](https://github.com/hueniverse/hawk) configuration object. Defaults to
      the Hawk defaults.
- `callback` - the method used to return the request result with signature
  `function(err, credentials, artifacts)` where:
    - `err` - an error condition.
    - `credentials` - the decoded [ticket response](#ticket-response) object.
    - `artifacts` - Hawk protocol artifacts.

### `Oz.ticket`

Ticket issuance, parsing, encoding, and re-issuance utilities.

#### Ticket options

The following are the supported ticket parsing and issuance options passed to the corresponding
ticket methods. Each endpoint utilizes a different subset of these options but it is safe to pass
one common object to all (it will ignore unused options):
- `ttl` - when generating a ticket, sets the ticket lifetime in milliseconds. Defaults to
    `3600000` (1 hour) for tickets and `60000` (1 minutes) for rsvps.
- `delegate` - if `false`, the ticket cannot be delegated regardless of the application permissions.
  Defaults to `true` which means use the application permissions to delegate.
- `iron` - overrides the default [Iron](https://github.com/hueniverse/iron) configuration.
- `keyBytes` - the [Hawk](https://github.com/hueniverse/hawk) key length in bytes. Defaults to
    `32`.
- `hmacAlgorithm` - the [Hawk](https://github.com/hueniverse/hawk) HMAC algorithm. Defaults to
    `sha256`.
- `ext` - an object used to provide custom server data to be included in the ticket (this option
    will be ignored when passed to an endpoint method and the `loadGrantFunc` function returns an
    `ext` value in the callback) where:
    - `public` - an object which is included in the response under `ticket.ext` and in
        the encoded ticket as `ticket.ext.public`.
    - `private` - an object which is included only in the encoded ticket as
        `ticket.ext.private`.

#### `ticket.issue(app, grant, encryptionPassword, options, callback)`

Issues a new application or user ticket where:
- `app` - the application [object](#app-object) the ticket is being issued to.
- `grant` - the grant [object](#grant-object) the ticket is being issued with if the ticket
  represents user access. `null` if the ticket is an application-only ticket.
- `encryptionPassword` - the ticket [encryption password](#encryptionPassword).
- `options` - ticket generation [options](#ticket-options).
- `callback` - the callback method using signature `function(err, ticket)` where:
    - `err` - an error condition.
    - `ticket` - a [ticket response](#ticket-response) object.

#### `ticket.reissue(parentTicket, grant, encryptionPassword, options, callback)`

Reissues a application or user ticket where:
- `parentTicket` - the [ticket](#ticket-response) object being reissued.
- `grant` - the grant [object](#grant-object) the ticket is being issued with if the ticket
  represents user access. `null` if the ticket is an application-only ticket.
- `encryptionPassword` - the ticket [encryption password](#encryptionPassword).
- `options` - ticket generation [options](#ticket-options).
- `callback` - the callback method using signature `function(err, ticket)` where:
    - `err` - an error condition.
    - `ticket` - a [ticket response](#ticket-response) object.

#### `ticket.rsvp(app, grant, encryptionPassword, options, callback)`

Generates an rsvp string representing a user grant where:
- `app` - the application [object](#app-object) the ticket is being issued to.
- `grant` - the grant [object](#grant-object) the ticket is being issued with if the ticket
  represents user access. `null` if the ticket is an application-only ticket.
- `encryptionPassword` - the ticket [encryption password](#encryptionPassword).
- `options` - ticket generation [options](#ticket-options).
- `callback` - the callback method using signature `function(err, rsvp)` where:
    - `err` - an error condition.
    - `rsvp` - the rsvp string.

#### `ticket.generate(ticket, encryptionPassword, options, callback)`

Adds the cryptographic properties to a ticket and prepares the response where:
- `ticket` - an incomplete [ticket](#ticket-response) object with the following:
    - `exp`
    - `app`
    - `user`
    - `scope`
    - `grant`
    - `dlg`
- `encryptionPassword` - the ticket [encryption password](#encryptionPassword).
- `options` - ticket generation [options](#ticket-options).
- `callback` - the callback method using signature `function(err, ticket)` where:
    - `err` - an error condition.
    - `ticket` - the completed [ticket response](#ticket-response) object.

#### `ticket.parse(id, encryptionPassword, options, callback)`

Decodes a ticket identifier into a ticket response where:
- `id` - the ticket id which contains the encoded ticket information.
- `encryptionPassword` - the ticket [encryption password](#encryptionPassword).
- `options` - ticket generation [options](#ticket-options).
- `callback` - the callback method using signature `function(err, ticket)` where:
    - `err` - an error condition.
    - `ticket` - a [ticket response](#ticket-response) object.


text:
## NB! This manual is for running backend without docker, if you don't plan to debug back-end it may be easier to follow docker route:

[Understand rtc build and deployments guide](../deployment/readme.md)

#### Install .NET Core

Follow the instructions provided [here](https://www.microsoft.com/net)

Run `dotnet --info` to test that the install has been successful.

#### Get External Dependencies

Grab the source, then restore the packages used by the application

```bash
$ cd ./src/server/dotNet
$ dotnet restore
```

Alternatively on Windows, you can run `GetDependencies.bat` (this runs `dotnet restore` and downloads the relevant NuGet packages to your machine)

#### Install and start Event Store

If you want to persist data across sessions then you should run a local Event Store.

- [Download Event Store](https://eventstore.com/downloads/)
- Follow the [getting started instructions](https://eventstore.org/docs/getting-started/index.html?tabs=tabid-1%2Ctabid-dotnet-client%2Ctabid-dotnet-client-connect%2Ctabid-4) and run Event Store locally

Or, [use the docker image](https://hub.docker.com/r/eventstore/eventstore/).

#### Populate Event Store

Populate eventstore with the following command from the`/src/server/dotNet` directory:

```bash
$ dotnet run -p Adaptive.ReactiveTrader.Server.Launcher --populate-eventstore
```

Alternatively on Windows, you can run `Populate Event Store.bat` to add some dummy data

#### Run Broker (Crossbar)

Crossbar.io is required for RTC to properly run. If not installed, the server cannot communicate with the client.
To install crossbar.io on Windows:

- [Download Crossbar](http://crossbar.io/docs/Installation-on-Windows/): At the time of writing, the download instructions for Crossbar on Windows aren't perfect. The following should work:
  - [Install Python 3.x 32bit](https://www.python.org/), tick the 'Add Python to PATH' checkbox in the installer
  - [Install PyWin](https://github.com/mhammond/pywin32/releases)
  - The dependency 'snappy' doesn't build on Windows, so use a pre-built version:
    - [Download snappy binary](https://www.lfd.uci.edu/~gohlke/pythonlibs/#python-snappy) (choose the appropriate binary for your version of Python)
    - Install it: `pip install python_snappy-0.5.4-cp37-cp37m-win32.whl` (or whichever `whl` file you downloaded in the previous step)
  - Install Crossbar: `pip install crossbar`
- Run `crossbar start` from the `\src\services\broker\.crossbar` working directory on the command line

To install crossbar.io on another OS, follow the instructions provided for [Linux](https://crossbar.io/docs/Installation-on-Linux/) or for [MacOS](http://crossbar.io/docs/Installation-on-Mac-OS-X/)

In a separate terminal, start Crossbar from the `/src/server/dotNet` folder or from the `\src\services\broker\.crossbar` folder (Windows) by running:

```bash
$ crossbar start
```

#### Start Services

To start the backend services, run the following command from the`/src/server/dotNet` directory:

```bash
$ dotnet run -p Adaptive.ReactiveTrader.Server.Launcher all
```

The services should now run and connect to Crossbar and Event Store.

To run each service individually, cd into each of the services (analytics, blotter, pricing, referenceDataRead, tradeExecution) and run `dotnet run`

On Windows, once the stand-alone Event Store and Crossbar are running, you can fire up the services by running `StartServices.bat`

This calls the Launcher console application and will start all the services, the messaging broker and Event Store.

The services can also be debugged from Visual Studio like any another console app.

#### Interactive Mode

The console process started via `dotnet run dev` from the Launcher project is interactive, and can be used to bring various services up and down. This lets you investigate how the application responds to component failures. Simply type 'help' within the Launcher process.

#### Client

For the web client follow these [instructions](../client.md)

### Problem running the app?

If you find any issue running the app or anything is missing in the docs, please create [an issue on github](https://github.com/AdaptiveConsulting/ReactiveTraderCloud/issues)

repository: kenkiti-com/ReactiveTraderCloud

repo_name: kenkiti-com/ReactiveTraderCloud


text:
# Common [Commands](https://www.terraform.io/docs/commands/index.html)

[Initialise](https://www.terraform.io/docs/commands/init.html), or bring up to date, a working directory:
```
terraform init
```

Apply standard [formatting](https://www.terraform.io/docs/commands/fmt.html):
```
terraform fmt
```

Check [validation](https://www.terraform.io/docs/commands/validate.html) and report errors with modules, attribute names, and value types:
```
terraform validate
```

[Display](https://www.terraform.io/docs/commands/plan.html) what would be changed if executed:
```
terraform plan
```

[Apply](https://www.terraform.io/docs/commands/apply.html) changes:
```
terraform apply
```
For Terraform >= 0.12 this will also display execution plan. **Earlier versions** (< 0.12) willl require `terraform plan` to be run explicitly to see the execution plan.

Inspect current state being managed:
```
terraform show
```

Display a specific output value, in this case "ip":
```
terraform output ip
```

[Refresh](https://www.terraform.io/docs/commands/refresh.html) state by comparing it against cloud infrastructure:
```
terraform refresh
```

[Destroy](https://www.terraform.io/docs/commands/destroy.html) resources:
```
terraform destroy
```
It is possible to preview behaviour using:
```
terraform plan -destroy
```

Mark resource as [tainted](https://www.terraform.io/docs/commands/taint.html):
```
terraform taint resource.id
```
where resource.id refers to the resource block name and resource Id. e.g. aws_instance.example

Modify current [state](https://www.terraform.io/docs/commands/state/index.html) (advanced use only):
```
terraform state <subcommand>
```

repository: launchquickly/terraform

repo_name: launchquickly/terraform


text:
# ansible-quartermaster

The Production Operations team at Care.com uses Ansible to manage our
production web infrastructure. We wrote a dynamic inventory script called
Ansible Quartermaster (or AQ), to tie together multiple other dynamic
inventory scripts (for example, of cloud systems at Rackspace, AWS, etc)
and a static inventory file (e.g. for dedicated hardware systems). This
gives us a single unified inventory that includes all of our
Ansible-managed systems, and thus allows us to use Ansible to manage them
all in a single coherent way, regardless of who provides the systems (or
how).

All the work of AQ is handled by the ansible_quartermaster.py module. We
have the need to reference the Ansible inventory in other Python scripts
that we write, so a module makes perfect sense.  To incorporate our
Ansible inventory in another script is as simple as:

  ```python
  import ansible_quartermaster as aq
  inventory = aq.fetch_inventory('/ansible/conf/inventory.d')
  ```

# Installation

To install the ansible_quartermaster module simply run the following command:

  `sudo python setup.py install`

repository: caredotcom/ansible-quartermaster

gha_language: Python

repo_name: caredotcom/ansible-quartermaster


text:
---
title: Ionic
sidebar_order: 201
---

To use Sentry with [Ionic](https://ionicframework.com/) you have to add _sentry-cordova_ as a dependency to you package.json.

First run `npm i --save sentry-cordova` and make sure you already added the platforms you want to support with `ionic cordova platform add ios` and/or `ionic cordova platform add android`.

After that it’s important to run `cordova plugin add sentry-cordova` without the ionic wrapper.

{% capture __alert_content -%}
Do not run `ionic cordova plugin add sentry-cordova`. The ionic cli wrapper sucks up all the input and sentry-wizard will not be able to setup your project.
{%- endcapture -%}
{%- include components/alert.html
  level="warning"
  title="Warning"
  content=__alert_content
%}

When building your app with ionic for production make sure you have source maps enabled. You have to add this to your `package.json`:

```javascript
"config": {
    "ionic_generate_source_map": "true"
}
```

Otherwise we are not able to upload source maps to Sentry.

{% capture __alert_content -%}
If you want to skip the automatic release version and set the release completely for yourself. You have to add this env var to disable it e.g.: `SENTRY_SKIP_AUTO_RELEASE=true ionic cordova emulate ios --prod`
{%- endcapture -%}
{%- include components/alert.html
  level="warning"
  title="Warning"
  content=__alert_content
%}

To setup Sentry in your codebase, add this to your `app.module.ts`:

```javascript
import * as Sentry from 'sentry-cordova';

Sentry.init({ dsn: '___PUBLIC_DSN___' });
```

In order to also use the Ionic provided `IonicErrorHandler`, we need to add `SentryIonicErrorHandler`:

```javascript
import { IonicErrorHandler } from 'ionic-angular';

import * as Sentry from 'sentry-cordova';

class SentryIonicErrorHandler extends IonicErrorHandler {
  handleError(error) {
    super.handleError(error);
    try {
      Sentry.captureException(error.originalError || error);
    } catch (e) {
      console.error(e);
    }
  }
}
```

Then change the `@NgModule{providers:[]}` in `app.module.ts` to:

```javascript
@NgModule({
    ...
    providers: [
        StatusBar,
        SplashScreen,
        // {provide: ErrorHandler, useClass: IonicErrorHandler} remove this, add next line
        {provide: ErrorHandler, useClass: SentryIonicErrorHandler}
    ]
})
```

repository: sirinartk/sentry-docs

repo_name: sirinartk/sentry-docs


text:
---
layout: post
title:  "OpenCV Installation in Linux (Anaconda / Default Python) {Updated}"
date:   2017-02-23
desc: "Installing OpenCV on Ubuntu {works even with Anaconda Python}"
keywords: "python,ubuntu,anaconda,opencv,linux"
categories: [ComputerVision]
tags: [ComputerVision,OpenCV,Python,Linux,Anaconda]
icon: icon-centos
---

In my earlier blog posts, I talk about adopting different methods for installing OpenCV if you use Anaconda Python.  Turns out you can have a unified solution, and that is exactly what I have done in the script linked below

[Complete OpenCV Installation Script available here](https://github.com/rsnk96/Ubuntu-Setup-Scripts/blob/master/opencvDirectInstall.sh).

Use that link if you quickly want to get around knowing how it works, or if you're simply too lazy.

This blog post explains what I have done to build a unified installation script.

## NOTE:

If at any point of time, you are re-building with or without changed cmake parameters, then make sure you remove partial built files

```bash
$ sudo rm -rf opencv/build/ opencv/CMakeLists.txt opencv/cmake/
$ cd opencv
$ git reset --hard HEAD
$ cd ..
```

<br>

## Step 1: Install the dependencies

Well, the first step towards having a complete installation is obviously to install the required dependencies. This is exactly what about a third of the code does

It installs libraries that would enable you to harness the full functionality of OpenCV (excluding a few modules in contrib like SFM and Kinect Support).

If Anaconda Python is not installed, then we install numpy, scipy and matplotlib for Python 2 and 3 using the Ubuntu software centre. If it is, then we simply check if they are installed using pip directly

## Step 2: Download the OpenCV and OpenCV Contrib Source code

It first checks if the folder already exists (in case you have partially run the script in the past). If not, it firsts changes your git buffer size (as the opencv repo size might be bigger than the default maximum git buffer size), and then clones both the source code repos. In case the folder already exists, it simply updates updates by pulling the latest changes from the repository

## Step 3: Extracting necessary Python program parameters

The main cause of conflict / issue when you have Anaconda Python installed is the fact that Anaconda has a malformed MKL library and it's own versions of lots of other libraries, which the OpenCV cmake detects, and uses to override the default full version of the library that exists in your system. To prevent that, we need to remove Anaconda from the `PATH` variable, so that it is not detected at all by CMAKE. However, this would mean that Anaconda Python will also not be detected. Hence, we find the all the Python directories needed by CMAKE before hand, and then remove all traces of Anaconda from the path using
```bash
export PATH=$(echo $PATH | tr ':' '\n' | grep -v "conda[2-9]\?" | uniq | tr '\n' ':')
```

**NOTE**: If you do not have Anaconda Python, this will still work perfectly alright

## Step 4: CMAKE parameters

We enforce the usage of the default Python by storing the Python paths needed for the installation (before removing Anaconda from the path using the above command) by executing
```bash
py2Ex=`which python2`
py2In=`python2 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())"`
py2Pack=`python2 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"`
py3Ex=`which python3`
py3In=`python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())"`
py3Pack=`python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"`
```
Of course, Python2 installation will be needed after 2019. We next use these variables to force CMAKE to use these directories only
```bash
 -DPYTHON2_EXECUTABLE=$py2Ex \
 -DPYTHON2_INCLUDE_DIR=$py2In \
 -DPYTHON2_PACKAGES_PATH=$py2Pack \
 -DPYTHON3_EXECUTABLE=$py3Ex \
 -DPYTHON3_INCLUDE_DIR=$py3In \
 -DPYTHON3_PACKAGES_PATH=$py3Pack \
```

We next enable TBB (Threaded Building blocks, gives higher performance), V4L (Video library) and QT (Better image displayer)
```bash
 -DWITH_TBB=ON \
 -DWITH_V4L=ON \
 -DWITH_QT=ON \
```

We also explicitly disable CUDA, as compiling OpenCV with CUDA slows down the process significantly
```bash
 -DWITH_CUDA=OFF \
```

We build TIFF as OpenCV relies on an older version of libtiff, and using the system default libtiff in Ubunttu 14.04+ will throw errors.
```bash
 -DBUILD_TIFF=ON \
```

## Step 5
We finally make and install, and the installation should complete. We then re-add Anaconda to the PATH variable.

You can check out and download the whole script [here](https://github.com/rsnk96/Ubuntu-Setup-Scripts/blob/master/opencvDirectInstall.sh)


text:
### [CVE-2019-12513](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-12513)
![](https://img.shields.io/static/v1?label=Product&message=n%2Fa&color=blue)
![](https://img.shields.io/static/v1?label=Version&message=n%2Fa&color=blue)
![](https://img.shields.io/static/v1?label=Vulnerability&message=n%2Fa&color=brighgreen)

### Description

In NETGEAR Nighthawk X10-R900 prior to <IP_ADDRESS>, by sending a DHCP discover request containing a malicious hostname field, an attacker may execute stored XSS attacks against this device. When the malicious DHCP request is received, the device will generate a log entry containing the malicious hostname. This log entry may then be viewed at Advanced settings->Administration->Logs to trigger the exploit. Although this value is inserted into a textarea tag, converted to all-caps, and limited in length, attacks are still possible.

### POC

#### Reference
- https://www.ise.io/casestudies/sohopelessly-broken-2-0/

#### Github
No PoCs found on GitHub currently.

repository: trickest/cve

repo_name: trickest/cve


text:
# Honeycomb Plugin for IOpipe

This plugin sends a copy of the iopipe report to Honeycomb. In order to use this plugin, you must have an account with Honeycomb. You can sign up at https://honeycomb.io/signup.

## Usage

To enable this plugin, include it and enable it in your initialization of iopipe:

``` js
const iopipeLib = require('@iopipe/iopipe');
const honeycombReport = require('iopipe-plugin-honeycomb');

const iopipe = iopipeLib({
  token: 'TOKEN_HERE',
  plugins: [honeycombReport()]
});
```

## Configuration

The plugin needs some configuration:

* Honeycomb write key (available from https://ui.honeycomb.io/account)
* Honeycomb dataset name (your choice)
* Sample Rate (optional, defaults to 1)

All three of these attributes can be configured via Lambda environment variables (in the same way the IOpipe Token is configured).  Set the following variables:

* Write key: `HONEYCOMB_WRITEKEY`
* Dataset name: `HONEYCOMB_DATASET`
* Sample Rate: `HONEYCOMB_SAMPLE_RATE`

They can also be provided directly in code:

```js
const iopipe = iopipeLib({
  token: 'TOKEN_HERE',
  plugins: [honeycombReport({
      writeKey: "WRITEKEY_HERE",
      dataset: "DATASET_HERE",
      sampleRate: 1
  })]
});
```

It is strongly advised that (after the dataset has been created) you enable unpacking of nested JSON (configurable at the bottom of the Schema page).

Once the plugin is configured and successfully sending events to Honeycomb, you can augment the events with the iopipe `log` function call. Use it to record any measurements you want to take or attributes of your function you wish to use in Honeycomb. This can include timers, user IDs, log lines indicating branching, and so on.

This plugin also works well with the `TracePlugin` - if you enable it as well, all the tracing data will automatically be included in the reports sent to Honeycomb.


text:
PiControl
=========

Control your headless Raspberry Pi with the AdaFruit LCD Plate
Built on latest Raspbian (2014-09-09) at time of writing readme (2014-12-16)

PiControl lets you control an internet connected Raspberry Pi (NAS optional) running Raspbian, via the Adafruit 16x2 LCD Plate. The idea was to create a simple hierarchical menu system to provide basic system functionality for a NAS Pi through the use of the LCD and Tactile buttons provided by the Adafruit i2c LCD Plate.

To Install:
  1. Open terminal window or SSH into pi.
  2. Run the terminal command: "git clone https://github.com/korn101/PiControl"
  3. You now have a working copy of PiControl in your /home/pi/PiControl directory, but we're not done yet.
  4. Automate the running of the /home/pi/PiControl/PiControl.py script. See here: http://www.raspberrypi.org/documentation/linux/usage/rc-local.md

System Functions include:
* Idle Mode (with clock display)
* PiDiag (see crucial hardware specs ie. clock speeds, temp, memory split)
* Wifi Diag (see current Wifi network, check connectivity to router and internet)
* Halt System (perform a safe system halt/shutdown)
* Restart System (perform a safe system restart)
* Run a PiNumberStation in the background. See: https://github.com/korn101/PiNumberStation

New Updates include:
* Check connected HDD ✓
* Settings menu and configuration file support ✓
* PiNumberStation support for broadcast on user-defined frequency ✓
* Integer Dialog Support ✓
* Boolean Dialog Support ✓
* Automatic display dimming after set amount of time ✓

Soon to be functions include:
* Run rpi-update, apt-get update, apt-get upgrade
* Backup contents of selected drive to ExtHDD
* Connect/Disconnect to and from different wifi networks (including password entry dialog and basic keyboard system)
* Live & Continuous temperature 'watching' console
* Yowsup functionality to pass commands over Whatsapp

=================

Developers Notes:

Install, Dev & Maintenance Instructions
===
Cloning the repository / Install:
  1. Open terminal and cd to home directory. ie. /home/pi/
  2. Run "git clone https://github.com/korn101/PiControl" to clone repository to the pi.
  3. Project folder is now under /home/pi/PiControl/
  4. Enter the project folder with "cd PiControl"
  5. Make changes as you wish. Then continue to next section of steps.

To commit changes:
  1. Open terminal, cd into /home/pi/PiControl
  2. Run "git add PiControl.py", "git add piconf.ini" , etc. To add to commit list.
  3. Run "git commit -m "<commit message>""
  4.  Done! :)
(or use the update.sh automated script!)

repository: GazimbeIsaac/PiControl

repo_name: GazimbeIsaac/PiControl


text:
# [How can I construct a table header than spans multiple rows in HTML?](https://stackoverflow.com/questions/18680044/how-can-i-construct-a-table-header-than-spans-multiple-rows-in-html)

I would like to construct a table as follows:

```text
|   Major Heading 1    |  Major Heading 2    |
|   Minor1  |  Minor2  | Minor3  |  Minor4   |
----------------------------------------------
|   col1    |   col2   |   col3  |    col4   |
rest of table ...
```

```html
<table>
  <thead>
    <tr>
      <th colspan="2">Major 1</th>
      <th colspan="2">Major 2</th>
    </tr>
    <tr>
      <th>col1</th>
      <th>col2</th>
      <th>col3</th>
      <th>col4</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>data1</td>
      <td>data2</td>
      <td>data3</td>
      <td>data4</td>
    </tr>
  </tbody>
</table>
```

url: https://raw.githubusercontent.com/phoebeliu/work2018/669b982ba9d2cd4f70284fc62e73838c92815000/How can I construct a table header than spans multiple rows in HTML.md


text:
---
layout: post
title: Love named_scope
comments: true
categories:
- named_scope
- rails
- refactor
- Ruby On Rails
- snippet
status: publish
type: post
published: true
meta:
  _edit_last: "1"
---
Rails Best Practice Snippet: About named_scope.
Reference link to the PDF. Rails-best-practices.

named_scope is a Rails 2.x feature which can simplify your rails code, move your finders into their own Model, and compact the code logically and gracefully. Below code refactoring is a named_scope sample to show the tricky.

BEFORE

class PostController < ApplicationController
  def search
    conditions = { :title => "%#{params[:title]}%" } if params[:title]
    conditions.merge!{ :content => "%#{params[:content]}%" } if params[:content]
    case params[:order]
      when "title" : order = "title desc"
      when "created_at" : order = "created_at"
    end
    if params[:is_published]
      conditions.merge!{ :is_published => true }
    end
    @posts = Post.find(:all, :conditions => conditions, :order => order,
                             :limit => params[:limit])
  end
end

AFTER

class Post < ActiveRecord::Base
  named_scope :matching, lambda { |column, value|
    return {} if value.blank?
    { :conditions => ["#{column} like ?", "%#{value}%"] }
  }
  named_scope :order, lambda { |order|
  { :order => case order
      when "title" : "title desc"
      when "created_at" : "created_at"
    end }
  }
end

class PostController < ApplicationController
  def search
    @posts = Post.matching(:title, params[:title])
                 .matching(:content, params[:content])
                 .order(params[:order])
  end
end

More references :
http://ryandaigle.com/articles/2008/3/24/what-s-new-in-edge-rails-has-finder-functionality
http://railscasts.com/episodes/108-named-scope

extension: markdown