text:
# Sentiment-Analysis
Twitter Sentiment Analysis with npm Sentiment module

Connect to Twitter API,  gather tweets by hashtag, compute the sentiment of each tweet, and build a real-time dashboard to show the result.

## Live Demo
**[https://bensonruan.com/twitter-sentiment-analysis-with-sentiment-node-js/](https://bensonruan.com/twitter-sentiment-analysis-with-sentiment-node-js/)**

![sentiment](https://bensonruan.com/wp-content/uploads/2019/10/twitter-sentiment-analysis.gif)

## Installing
1. Clone this repository to your local computer
``` bash
git https://github.com/bensonruan/Sentiment-Analysis.git
```

2. On Twitter developer platform https://developer.twitter.com/
* Register a Twitter dev account
* Create a Twitter App
* Get the Consumer API keys and Access tokens
* Replace your API keys in queryTwitter.php

3. run below code in the root directory to install required packages
``` bash
npm install
```

4. run below code to install browserify and watchify
``` bash
npm install -g browserify watchify
```

5. run below code in the js directory to watch sentiment-analysis.js change and output the bundle js
``` bash
watchify sentiment-analysis.js -o sentiment-analysis-bundle.js
```

6. Config your path to the queryTwitter.php inside sentiment-analysis.js and sentiment-analysis-bundle.js
``` bash
url: window.location.protocol + '//'+ window.location.hostname + 'YOUR-PATH-TO-queryTwitter.php?q='
```

7. Point your localhost to the cloned root directory. Browse to http://localhost/index.html

## Note
If you are on Windows, you would need to install PHP via Web Platform Installer

## Library
* [twitter-api-php](https://github.com/J7mbo/twitter-api-php) - PHP Wrapper for Twitter API v1.1 calls
* [jquery](https://code.jquery.com/jquery-3.3.1.min.js) - JQuery
* [sentiment](https://www.npmjs.com/package/sentiment) - Node.js module that uses the AFINN-165 wordlist and Emoji Sentiment Ranking to perform sentiment analysis on arbitrary blocks of input text.
* [canvasjs](https://canvasjs.com/jquery-charts/) - JQuery chart library

repository: abhijitdalavi/Sentiment-Analysis

repo_name: abhijitdalavi/Sentiment-Analysis


text:
---
published: true
title: Nanobench
tags: benchmarking c++ single-header
---
> a platform independent microbenchmarking library for C++11/14/17/20. - [nanobench comparison](https://nanobench.ankerl.com/comparison.html) / [r/cpp](https://www.reddit.com/r/cpp/comments/dgy9yc/ankerlnanobench_simple_fast_accurate_singleheader/) / [2](https://www.reddit.com/r/cpp/comments/nwjmct/suggestions_for_c_microbenchmarking_libraries/)

Single header code, easier to integrate and faster than [google benchmark]({% post_url 2021-11-12-google-benchmark %}).

### [pyperf](https://pyperf.readthedocs.io/en/latest/system.html)

Tune the system for benchmarks

{% highlight bash %}
python3 -m pip install pyperf
{% endhighlight %}

### nanobench

{% highlight cpp %}
#define ANKERL_NANOBENCH_IMPLEMENT
#include <nanobench.h>

#include <atomic>

int main() {
    int y = 0;
    std::atomic<int> x(0);
    ankerl::nanobench::Bench().run("compare_exchange_strong", [&] {
        x.compare_exchange_strong(y, 0);
    });
}
{% endhighlight %}

Output
{% highlight cpp %}
Warning, results might be unstable:
* CPU frequency scaling enabled: CPU 0 between 400.0 and 4,900.0 MHz
* CPU governor is 'powersave' but should be 'performance'
* Turbo is enabled, CPU frequency will fluctuate

Recommendations
* Use 'pyperf system tune' before benchmarking. See https://github.com/psf/pyperf

|               ns/op |                op/s |    err% |     total | benchmark
|--------------------:|--------------------:|--------:|----------:|:----------
|               18.97 |       52,724,029.52 |    1.2% |      0.01 | `compare_exchange_strong`
{% endhighlight %}

### see also
- [Micro-benchmarks](https://vorbrodt.blog/2019/03/18/micro-benchmarks/) - compare Google Benchmark / Catch2 / Hayai / Celero / Nonius

license: MIT

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
---
layout: page
title: Inventory
excerpt: "Tinkerers' Laboratory Inventory."
modified: 2014-08-08T19:44:38.564948-04:00
---

Tinkerers' Laboratory is a student run, one of a kind facility at IIT Bombay. It's inventory list includes a large number of Electrical and Mechanical components. For the convenience of the users, below is the updated inventory sheet. Browse through for whatever you are looking for.


text:
# artfullylondon-ingest-api-schema

JSON Schema files for the Artfully London ingest system. Includes packaging those files as a python package and as a golang module for consumption by those respective programming languages.

[![CircleCI](https://circleci.com/gh/stevejay/artfullylondon-ingest-api-schema/tree/master.svg?style=svg)](https://circleci.com/gh/stevejay/artfullylondon-ingest-api-schema/tree/master)

## Python

### Python Packaging Information

- https://setuptools.readthedocs.io/en/latest/setuptools.html#including-data-files
- https://packaging.python.org/tutorials/packaging-projects/

## Go

### Go Packaging Information

- https://github.com/tcnksm/ghr
-<EMAIL_ADDRESS>- https://github.com/golang/go/wiki/Modules

## TODO

- Get rid of area of london

### Constraints Not Captured

- maxAge >= minAge
- maxCost >= minCost
- timeTo >= timeFrom
- dateTo >= dateFrom

### Overrides

- exhibition event's dateFrom and dateTo values

gha_language: JavaScript

gha_license_id: MIT


text:
---
  title: Create a Backup
  weight: 43
---

Backups in Longhorn are off-cluster into a BackupStore. A BackupTarget

To setup a BackupTarget see [Set the BackupTarget](../backupstores-and-backuptargets#set-backuptarget).

For Information regarding BackupStores see [Setup a BackupStore](../backupstores-and-backuptargets#set-backuptarget)

To create a backup

- Navigate to the Volume menu
- Select the volume you wish to Backup
- Click Create Backup
- Add any appropriate labels and click OK

If the BackupTarget has not been set you'll be presented with an error.

Otherwise, once the backup is created it will be seen in the Backup menu.

repository: longhorn/website

gha_language: HTML

repo_name: longhorn/website


text:
Pattern: Missing use of `save_changes`

Issue: -

## Description

Promotes the use of `save_changes`.

## Further Reading

* [RuboCop - Sequel/SaveChanges](https://github.com/rubocop/rubocop-sequel/blob/master/lib/rubocop/cop/sequel/save_changes.rb)

repository: Adroiti/docs-for-code-review-tools

repo_name: Adroiti/docs-for-code-review-tools


text:
#Christvs dei, or, A theologicall discourse wherein is proved that regall or monarchicall power is not of humane but of divine right and that God is the sole efficient cause thereof and not the people : also, that every monarch is above the whole common-wealth and is not onely major singislis, but major vniversis : written in answer to a late printed pamphlet intituled Observations upon some of His Majesties late answers and expresses.#

##Jones, John, d. 1660.##
Christvs dei, or, A theologicall discourse wherein is proved that regall or monarchicall power is not of humane but of divine right and that God is the sole efficient cause thereof and not the people : also, that every monarch is above the whole common-wealth and is not onely major singislis, but major vniversis : written in answer to a late printed pamphlet intituled Observations upon some of His Majesties late answers and expresses.
Jones, John, d. 1660.

##General Summary##

**Links**

[TCP catalogue](http://www.ota.ox.ac.uk/tcp/)  •
[HTML](http://tei.it.ox.ac.uk/tcp/Texts-HTML/free/A47/A47055.html)  •
[EPUB](http://tei.it.ox.ac.uk/tcp/Texts-EPUB/free/A47/A47055.epub) •
[Page images (Historical Texts)](https://data.historicaltexts.jisc.ac.uk/view?pubId=eebo-11839685e&pageId=eebo-11839685e-49793-1)

**Availability**

This keyboarded and encoded edition of the
	       work described above is co-owned by the institutions
	       providing financial support to the Early English Books
	       Online Text Creation Partnership. This Phase I text is
	       available for reuse, according to the terms of Creative
	       Commons 0 1.0 Universal. The text can be copied,
	       modified, distributed and performed, even for
	       commercial purposes, all without asking permission.

**Major revisions**

1. __2004-10__ __TCP__ *Assigned for keying and markup*
1. __2005-12__ __Apex CoVantage__ *Keyed and coded from ProQuest page images*
1. __2006-04__ __Taryn Hakala__ *Sampled and proofread*
1. __2006-04__ __Taryn Hakala__ *Text and markup reviewed and edited*
1. __2006-09__ __pfs__ *Batch review (QC) and XML conversion*

##Content Summary##

#####Front#####

#####Body#####

1. CHRISTUS DEI, OR, A Theologicall Discourse, wherein is proved, that Regall Power is not of Humane, but of Divine Right, and that GOD onely is the Efficient cause thereof, and not the People.

    _ Preface.

    _ §. 1 Of the Primary Finall cause; as also of the Efficient cause of all Civill Societies or Republiques.

    _ §. 2. Of the Secondary finall Cause, and also the onely Efficient Cause of all Civill Societies and Republiques.

    _ §. 3 Of the Finall and Efficient cause of Civill Power in a Common wealth.

    _ §. 4. Of the Efficient cause of Regall Power.

**Types of content**

  * Oh, Mr. Jourdain, there is **prose** in there!

There are 1 **ommitted** fragments!
 @__reason__ (1) : illegible (1)  •  @__extent__ (1) : 1 letter (1)

**Character listing**

|Text|string(s)|codepoint(s)|
|---|---|---|
|Latin-1 Supplement|§ùéà|167 249 233 224|
|Latin Extended-A|ſ|383|
|General Punctuation|•|8226|
|Geometric Shapes|▪|9642|

##Tag Usage Summary##

###Header Tag Usage###

|No|element name|occ|attributes|
|---|---|---|---|
|1.|__author__|3||
|2.|__availability__|1||
|3.|__biblFull__|1||
|4.|__change__|5||
|5.|__date__|8| @__when__ (1) : 2007-01 (1)|
|6.|__edition__|1||
|7.|__editionStmt__|1||
|8.|__editorialDecl__|1||
|9.|__extent__|2||
|10.|__idno__|6| @__type__ (6) : DLPS (1), STC (2), EEBO-CITATION (1), OCLC (1), VID (1)|
|11.|__keywords__|1| @__scheme__ (1) : http://authorities.loc.gov/ (1)|
|12.|__label__|5||
|13.|__langUsage__|1||
|14.|__language__|1| @__ident__ (1) : eng (1)|
|15.|__listPrefixDef__|1||
|16.|__note__|6||
|17.|__notesStmt__|2||
|18.|__p__|11||
|19.|__prefixDef__|2| @__ident__ (2) : tcp (1), char (1)  •  @__matchPattern__ (2) : ([0-9\-]+):([0-9IVX]+) (1), (.+) (1)  •  @__replacementPattern__ (2) : http://eebo.chadwyck.com/downloadtiff?vid=$1&page=$2 (1), https://raw.githubusercontent.com/textcreationpartnership/Texts/master/tcpchars.xml#$1 (1)|
|20.|__projectDesc__|1||
|21.|__pubPlace__|2||
|22.|__publicationStmt__|2||
|23.|__publisher__|2||
|24.|__ref__|2| @__target__ (2) : https://creativecommons.org/publicdomain/zero/1.0/ (1), http://www.textcreationpartnership.org/docs/. (1)|
|25.|__seriesStmt__|1||
|26.|__sourceDesc__|1||
|27.|__term__|3||
|28.|__textClass__|1||
|29.|__title__|3||
|30.|__titleStmt__|2||

###Text Tag Usage###

|No|element name|occ|attributes|
|---|---|---|---|
|1.|__desc__|1||
|2.|__div__|7| @__type__ (7) : title_page (1), text (1), preface (1), section (4)  •  @__n__ (4) : 1 (1), 2 (1), 3 (1), 4 (1)|
|3.|__g__|128| @__ref__ (128) : char:EOLhyphen (127), char:punc (1)|
|4.|__gap__|1| @__reason__ (1) : illegible (1)  •  @__extent__ (1) : 1 letter (1)|
|5.|__head__|6||
|6.|__hi__|119||
|7.|__p__|40||
|8.|__pb__|20| @__facs__ (20) : tcp:49793:1 (2), tcp:49793:2 (2), tcp:49793:3 (2), tcp:49793:4 (2), tcp:49793:5 (2), tcp:49793:6 (2), tcp:49793:7 (2), tcp:49793:8 (2), tcp:49793:9 (2), tcp:49793:10 (2)  •  @__rendition__ (1) : simple:additions (1)  •  @__n__ (17) : 1 (1), 2 (1), 3 (1), 4 (1), 5 (1), 6 (1), 7 (1), 8 (1), 9 (1), 10 (1), 11 (1), 12 (1), 13 (1), 14 (1), 15 (1), 16 (1), 17 (1)|
|9.|__seg__|1| @__rend__ (1) : decorInit (1)|
|10.|__trailer__|1||


text:
[![online hosted application](https://img.shields.io/static/v1?label=Try-It-Out&message=Online-Hosted-Application&color=yellow&logo=godot-engine)](https://gradio.app/g/baishalidutta/Comments-Toxicity-Detection)
[![License - Apache-2.0](https://img.shields.io/badge/License-Apache-blue)](#license)
[![Build - Passing](https://img.shields.io/badge/Build-Passing-brightgreen)](https://github.com/baishalidutta/Comments-Toxicity-Detection/runs/1485969918)
[![GitHub release](https://img.shields.io/github/release/baishalidutta/Comments-Toxicity-Detection?include_prereleases&sort=semver)](https://github.com/baishalidutta/Comments-Toxicity-Detection/releases/)
![Python](https://img.shields.io/badge/python-v3.7.0+-blue.svg)
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/baishalidutta/Pneumonia-Detection/issues)

## Motivation
People tend to discuss or share opinions on social platforms but such activities sometimes encounter threats or harassments which compel people to not express themselves properly.

Many social platforms try to find out such harassments or threats in conversations so that such conversations can easily be prevented before it causes any further damage.

Toxicity detection in comments is one of such methodologies to find out the different types of conversations that can be classified as toxic in nature.

To increase the efficacy in classifying such comments, we can make use of machine learning algorithms to determine the toxicity in comments.

In this model, many toxic comments have been fed to build a `Bidirectional Long Short-Term Memory (LSTM) Recurrent Neural Network (RNN)` model for fulfilling the purpose.

## Requirements

- Python 3.7.0+
- Tensorflow 2.4.1+
- Keras 2.4.3+
- matplotlib 3.3.3+
- numpy 1.19.5+
- pandas 1.2.1+
- scikit-learn 0.24.1+
- nltk 3.5+
- spacy 3.0.3+
- textblob 0.15.3+
- gradio 1.5.3+

## Dataset

You can downloaded the dataset from [kaggle](https://www.kaggle.com/c/jigsaw-toxic-comment-classification-challenge). Use the underlying download link to download the dataset.

### Instructions to follow

* Navigate to `data` section
* In the `Data Explorer`, you will find four separate zip archives to download
* Download `test.csv.zip`, `test_labels.csv.zip` and `train.csv.zip`
* Extract the files
* Copy the CSV files to the `data` directory

The following list enumerates different classes (types) of comments -

| Toxic | Very Toxic | Obscene | Threat | Insult | Hate | Neutral |
|-------|------------|---------|--------|--------|------|---------|

## Installation

* Clone the repository

`git clone https://github.com/baishalidutta/Comments-Toxicity-Detection.git`

* Install the required libraries

`pip3 install -r requirements.txt`

## Model Ideology

* `Clean text`:
    * Lower all text
    * Remove uncommon signs
    * Expand abbreviations
    * Correct misspelled words
    * Remove punctuations
    * Remove emojis
    * Remove stop words
    * Apply lemmatisation
* `Tokenize text` data
* Create `Embedding Vector` using [Glove.6B](https://nlp.stanford.edu/projects/glove/)
* Train a `Recurrent Neural Network (RNN)` with a `Bidirectional LSTM` layer

## Usage

Navigate to the `source` directory to execute the following source codes.

* To generate the model on your own, run

`python3 model_training.py`

* You can also provide your own data:

`python3 model_training.py --data=csv_file_location`

* To evaluate any dataset using the pre-trained model (in the `model` directory), run

`python3 model_evaluation.py`

Note that, for evaluation, `model_evaluation.py` will use the `test.csv` and `test_labels.csv` (inside `data` directory).

Alternatively, you can find the whole analysis in the notebook inside the `notebook` directory. To open the notebook, use either `jupyter notebook` or `google colab` or any other IDE that supports notebook feature such as `PyCharm Professional`.

## Web Application

To run the web application locally, go to the `webapp` directory and execute:

`python3 web_app.py`

This will start a local server that you can access in your browser. You can type in any comment and find out what toxicity the model determines.

You can, alternatively, try out the hosted web application [here](https://gradio.app/g/baishalidutta/Comments-Toxicity-Detection).

## Developer

Baishali Dutta (<a href='mailto:me<EMAIL_ADDRESS>
## Contribution [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/baishalidutta/Comments-Toxicity-Detection/issues)

If you would like to contribute and improve the model further, check out the [Contribution Guide](https://github.com/baishalidutta/Comments-Toxicity-Detection/blob/main/CONTRIBUTING.md)

## License [![License](http://img.shields.io/badge/license-Apache-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)

This project is licensed under Apache License Version 2.0

branch_name: refs/heads/main


text:
# TOTP CLI

TOTP CLI is a command line application for storing and generating OTP (One Time Password)
tokens. This is a quick rushed through version that doesn't have any tests.

I plan to do a complete rewrite with tests and a few more features. Until then
feel free to fork and add or tweak.

## Installation

    gem install totp-cli

For clipboard functionality to work on OSX you need to install reattach-to-user-namespace

    brew install reattach-to-user-namespace

For clipboard funcationality to work on Linux you need to install xsel

    sudo apt-get install xsel # Debian/Ubuntu
    sudo yum install xsel     # Fedora, Red Hat, CentOS
    sudo pacman -S xsel       # Arch Linux

## Usage

Getting help:

    totp --help

Adding a token:

    totp add -l <label> -s <secret>

Listing tokens:

    totp list

Showing a single token:

    totp now -i <id>
    totp now -l <label>

Show single token and copy OTP to clipboard

    totp now -i <id> -c
    totp now -l <label> -c

Remove a token

    totp remove -i <id>
    totp remove -l <label>

## License

Copyright (c) 2014 Brady Love

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: bradylove/totp-cli

repo_name: bradylove/totp-cli


text:
# AngularJS-Gulp-Browserify Starter App

This Angular starter app is built with best practices in mind. The folder structure is intended to be different than the standard official AngularJS application. The application architecture follows modern design conventions from the proposal outlined here:

https://docs.google.com/document/d/1XXMvReO8-Awi1EZXAXS4PzDzdNvV6pGcuaF4Q9821Es/pub

Files are grouped structurally (each section of the app being self contained with its own styles, views, controllers, and directives) instead of functionally (all views in one folder, all styles in one folder, etc). In practice, the basic file structure should look something like this:

```
/app
--- /assets
------ /images
------ /icons
--- /common
------ /directives
------ /constants
------ /elements (common page elements like footer and header)
------ /resources
------ /services
------ /styles
------ common.js (common module requirements)
------ common.less
--- /modules
------ index.js
------ MainController.js
------ MainController.spec.js (controller unit tests)
------ modules.less
------ /module1 (ex: home)
--------- index.js (module definition)
--------- home.html (view)
--------- home.less (styles)
--------- HomeController.js (Controller inherits from MainController)
--------- HomeController.spec.js
--------- homeDirective.js (view definition)
--------- homeRoutes.js (route definitions)
------ /module2
--------- /sub-module1
--------- /sub-module2
--------- index.js (module definition - sub-modules are required in here)
--------- module.html
--------- module.less
--------- ModuleController.js
--------- ModuleController.spec.js
--------- moduleDirective.js
--------- moduleRoutes.js (route definitions and config options for nested sub-modules)
--- app.js
--- app.less
--- appConfig.js (main config file - no routes are defined here)
--- index.html
/dist (this is the gulp pipeline file output destination)
/libs (bower components install here)
/node_modules (npm installations go here)
```

Each Module is self-contained and the js files are exported, combined, and minified through Browserify. Every LESS file from each module should be imported into the master ```app.less``` file in the root app directory. Likewise, each LESS file from a sub-module should be imported into the main ```modules.less``` file. The main app.less file is then processed by Gulp and a css file with a source map is pushed to the ```dist``` folder.

### Setup Instructions

*NOTE:* This starter kit assumes that you already have bower (http://bower.io/) and gulp (http://gulpjs.com/) installed locally. If you don't, then run the following command first: ```npm install -g bower gulp```

1) Node Modules and Bower Components are not included in this repository to keep it light weight. After cloning or pulling changes from this repository, make sure to run the following command in terminal: ```npm install```

Bower dependencies should install automatically at the end of the NPM install process. If the dependencies don't install correctly you may need to manually run ```bower install``` as well.

2) Once everything is installed all you have to do is run ```gulp build``` and your new server will be running at ```http://localhost:5000``` (you can edit the port in the gulpFile). To speed up gulp times, the standard ```gulp``` task does not include copying over static files. Using the standard ```gulp``` task will be useful for most cases, but if you need to rebuild the whole ```dist``` folder, use ```gulp build```.

### Working with this application structure
1) All pipeline, automation, and testing dependencies are in the ```node_modules``` folder (installed using npm), while all third party application libraries are located in the ```libs``` folder (installed using bower).

2) Any additional third party modules and plugins should always be installed automatically whenever possible using ```npm install module_name``` or ```bower install module_name``` with the ```--save``` or ```--save-dev``` suffixes to save the dependencies in the ```package.json``` and ```bower.json``` files.

3) All development takes place in the ```app``` folder. Production files are generated with gulp automatically and pushed to the ```dist``` folder (it will automatically be created the first time the ```gulp``` task is run in terminal post-installation).

4) The ```gulpfile.js``` is clearly commented, defining each task that takes place during pipeline automation. Every file change is watched and new files are automatically pushed to the ```dist``` folder. All files are concatenated into individual files for use on production servers.

### Development, Test, Production, and Deployment
DEV: During development you should be using the standard ```gulp``` task (unless you need to rebuild your dist files, at which point you can run ```gulp build```).

TEST: Contrary to the traditional unit testing approach of putting all tests in a ```/test``` folder, unit test files are included inside of each module alongside the files that they are testing. Each test file has a ```.spec.js``` file type (ex: ```MainController.spec.js```). To run the tests you can simply use ```gulp test```. It will run the development server as well as a karma server so you can develop your code and your tests at the same time. Karma will watch for code changes and run the tests each time a file is saved.

PROD: However, when you are ready for production, you can run ```gulp prod``` to run the production build pipeline, which will minify and concatenate your files. Production files are still sent to the ```/dist``` folder. There is a ```server.js``` file in the root directory that runs a basic Express server that you can use when you deploy to your production server environment. Just run ```node server``` locally from the root directory to try it out.

### Routes, Controllers and TemplateURLs
NOTE: When creating controllers and services/factories, always follow the proper naming convention of starting with an uppercase letter. Everything else can use camelCase.

1) Default AngularJS applications tend to use the ```angular-route``` plugin that makes use of a main ```ng-view``` directive in the index.html file and standard ```href``` tags for links. This application is using the ```angular-ui-router``` plugin for better route nesting and greater customizability. It makes use of a main ```ui-view``` directive instead of ```ng-view``` and uses an ```sref``` tag for links instead of the normal ```href``` tag. Check out the official documentation for more details: https://github.com/angular-ui/ui-router

2) Due to the modularity of this application structure, standard routing parameters aren't being used. In most examples, routes make use of ```TemplateURL``` and ```controller``` like so:

```
$stateProvider
    .state('home', {
      url: '/',
      templateUrl: './modules/home/home.html',
      controller: './modules/home/HomeController.js'
    })
...
```
In this application, each module is set up as an injectible directive with its own controller. So instead of the above example, the home module has a directive called ```homeView``` that can be injected into the HTML like this:
```<div home-view></div>``` (camelcased directives always have to be changed to dashed names when in the HTML). As such, our route config makes use of the ```template``` parameter instead of ```templateURL```. So the routes look like this instead:

```
$stateProvider
    .state('home', {
      url: '/',
      template: '<div home-view></div>'
    });
```
As you can see, it's simpler and cleaner, calling only an HTML ```<div></div>``` tag as a template and leaving everything else contained within the module. This way, if anything changes in the file structure, the routes won't need to be updated.

As we add more options and configuration to each state, further changes to the $stateProvider function becomes necessary, so the current configuration looks like this:

```
var home = {
    name: 'home',
    url: '/',
    template: '<div home-view></div>'
};
var module2 = {
    name: 'module2',
    url: '/module2',
    template: '<div module2-view></div>'
};

$stateProvider.state(home);
$stateProvider.state(module2);
```

With this approach, it's very easy to keep every state object clean and easy to understand.

You can see an example of nested views and sub-modules in this application's file architecture:
https://github.com/goodbomb/angular-gulp-browserify-starter/blob/master/app/modules/pages/pagesRoutes.js

### Adding Sub-Modules
1) Create a new folder in the ```app/modules/``` directory with the following files:

```
index.js
moduleName.html
moduleName.less
moduleNameController.js
moduleNameController.spec.js
moduleNameDirective.js
moduleNameRoutes.js (you can also include a separate config file if you need more configuration options)
```

2) Change the file contents accordingly. Follow the ```app/modules/home``` files as reference. Make sure to change the naming convention in each file.

3) Add a new state to the ```moduleNameRoutes``` file. For example:

```
var home = {
    name: 'home',
    url: '/',
    template: '<div home-view></div>'
};
var moduleName = {
    name: 'moduleName',
    url: '/moduleName',
    template: '<div moduleName-view></div>'
};

$stateProvider.state(home);
$stateProvider.state(moduleName);
```

4) Open the parent ```index.js``` file (such as the ```modules/index.js``` file) and add a requirement for the new module. Make sure to require the entire module folder (browserify will look for the index.js file and use that file as the entry point for all other module dependencies).

```
require('./modules/moduleName').name
```

Your end result should look something like this:
```
'use strict';

require('angular');

module.exports = angular.module('modules',
	[
		require('./home').name,
		require('./moduleName').name
	])
	.controller(require('./MainController'));
```

After those steps are complete, you should be able to see the contents of your new module at the URL you specified in step 3.

NOTE: This same process applies to sub-modules, except you will treat the module directory as the root path, create a ```moduleRoutes.js``` file where you will define module-specific states and options, and then require the sub-module in the module's ```index.js``` file. You could actually do this with the main ```modules``` directory, and use it to "require" all of your modules instead of app.js and simply call ```require('./modules').name``` instead of ```require('./modules/moduleName').name```. It's all up to you and how deep you want to go with the modularity.

### Adding Third Party Vendor JS and CSS files to your app
NOTE: As of version 1.2 of this project, the behaviour of the ```vendor.js``` file has changed.

Instead of bloating the index.html file with a list of scripts and link tags, all CSS and Javascript files from Vendors are bundled and concatenated into single ```vendor.css``` and ```vendor.js``` files using the Gulp pipeline. To add vendor files to your workflow, all you have to do is access the ```Gulpfile.js``` file and add the relative path to the vendor file (found in the ```libs``` or ```node_modules``` directories) to the appropriate location in the *"File Paths"* section.

* For CSS files, add the path to the *VendorCSS* workflow.
* For JS files, add the path to the *VendorJS* workflow.

The ```vendor.js``` contains uses browserify to bundle all of the third party libraries installed via ```npm install``` or ```bower install``` into a single javascript file that is separate from the main ```bundle.js``` file. The ```bundle.js``` file is only for your application code. You aren't necessarily required to use the ```vendor.js``` file and you can bundle everything into a single ```bundle.js``` file, but by doing so you will miss out on the significant speed improvements that a separated ```vendor.js``` file provides.

While the ```bundle.js``` file is your continuously evolving application, the ```vendor.js``` file is largely static and unchanging (except when you update third party modules or add new ones). As such, your bundle.js file can remain signficiantly smaller in file size, and thus improves the speed of your browserify bundling.

### Contributing
This project is open source so collaboration is welcome. If you see a way to improve something in this project, please feel free to open a Pull Request to the *develop* branch so we can discuss your code.

### Learning Resouces
- https://github.com/curran/screencasts/tree/gh-pages/introToAngular
- https://www.codeschool.com/courses/shaping-up-with-angular-js
- http://egghead.io
- http://thinkster.io


text:
+++
Download_x64 = "https://osdn.net/dl/manjaro-community/manjaro-awesome-18.1.3-191115-linux53.iso"
Download_x64_Checksum = "5d64a3c76a0b074bd548953fef11f207a01c21a3"
Download_x64_Sig = "https://osdn.net/dl/manjaro-community/manjaro-awesome-18.1.3-191115-linux53.iso.sig"
Download_x64_Torrent = ""
Download_Minimal_x64 = "https://osdn.net/dl/manjaro-community/manjaro-awesome-18.1.3-minimal-191115-linux53.iso"
Download_Minimal_x64_Checksum = "15931c40fcb3810d40eb3e64215a42110deb4541"
Download_Minimal_x64_Sig = "https://osdn.net/dl/manjaro-community/manjaro-awesome-18.1.3-minimal-191115-linux53.iso.sig"
Download_Minimal_x64_Torrent = ""
Download_x86 = ""
Download_x86_Checksum = ""
Download_x86_Sig = ""
Download_x86_Torrent = ""
Name = "Awesome"
Screenshot = "awesome-full.jpg"
edition = "Community"
shortDescription = "Slim and snappy tiling window manager with the focus on resource efficiency suitable for power users"
Thumbnail = "awesome-full.jpg"
Version = "18.1.3"
date = "2019-11-15T08:02:46:12+01:00"
title = "Awesome"
type="download-edition"
weight = "5"
meta_description = "Manjaro awesome slim and snappy tiling window manager with the focus on resource efficiency suitable for power users"
meta_keywords = "manjaro awesome download, manjaro download"
+++

This edition is supported by the Manjaro community and comes with Awesome, a highly configurable, next generation framework window manager for X.

Awesome is a slim and snappy tiling window manager with the focus on resource efficiency.

If you are looking for older images check the [Awesome](https://osdn.net/projects/manjaro-archive/storage/awesome) archive.


text:
## Visual Compositional Learning for Human-Object Interaction Detection (ECCV2020)

![](misc/imagine.png)

### Training

1. Train an VCL on HICO-DET
    ```Shell
    python tools/Train_VCL_ResNet_HICO.py --num_iteration 800000
    ```

2. Train an VCL for rare first zero-shot on HICO-DET
    ```Shell
    python tools/Train_VCL_ResNet_HICO.py --model VCL_union_multi_zs3_def1_l2_ml5_rew51_aug5_3_x5new --num_iteration 600000
    ```

3. Train an VCL for non-rare first zero-shot on HICO-DET
    ```Shell
    python tools/Train_VCL_ResNet_HICO.py --model VCL_union_multi_zs4_def1_l2_ml5_rew51_aug5_3_x5new --num_iteration 400000
    ```

4. Train an VCL on V-COCO
    ```Shell
    python tools/Train_VCL_ResNet_VCOCO.py --model VCL_union_multi_ml1_l05_t3_rew_aug5_3_new_VCOCO_test --num_iteration 400000
    ```

### Model Parameters
Our model will converge at around iteration 500000 in HICO-DET. V-COCO will converge after 200000 iterations. We provide the model parameters that we trained as follows,

V-COCO: https://drive.google.com/file/d/1SzzMw6fS6fifZkpuar3B40dIl7YLNoYF/view?usp=sharing. I test the result is 47.82. The baseline also decreases compared to the reported result. The model in my reported result is deleted by accident. Empirically, hyper-parameters $lambda_1$ affects V-COCO more apparently.

HICO: https://drive.google.com/file/d/16unS3joUleoYlweX0iFxlU2cxG8csTQf/view?usp=sharing

HICO(Res101): https://drive.google.com/file/d/1iiCywBR0gn6n5tPzOvOSmZw_abOmgg53/view?usp=sharing

### Testing
1. Test an VCL on V-COCO
    ```Shell
     python tools/Test_ResNet_VCOCO.py --num_iteration 200000
    ```
2. Test an VCL on HICO-DET
    ```Shell
    python tools/Test_VCL_ResNet_HICO.py --num_iteration 800000

    cd Data/ho-rcnn/;python ../../scripts/postprocess_test.py --model VCL_union_multi_ml5_def1_l2_rew2_aug5_3_x5new_res101 --num_iteration 3 --fuse_type spv
    ```

    or
    ```Shell
   python scripts/full_test.py --model VCL_union_multi_ml5_def1_l2_rew2_aug5_3_x5new_res101 --num_iteration 800000
    ```

3. Illustration of verb and object features

   ```shell
   python scripts/extract_HO_feature.py --model VCL_union_multi_ml5_def1_l2_rew2_aug5_3_x5new_res101 --num_iteration 800000

   python scripts/tsne.py VCL_union_multi_ml5_def1_l2_rew2_aug5_3_x5new_res101
   ```

## Citations
If you find this submission is useful for you, please consider citing:

```
@inproceedings{hou2021fcl,
  title={Detecting Human-Object Interaction via Fabricated Compositional Learning},
  author={Hou, Zhi and Baosheng, Yu and Qiao, Yu and Peng, Xiaojiang and Tao, Dacheng},
  booktitle={CVPR},
  year={2021}
}
```

```
@inproceedings{hou2021vcl,
  title={Visual Compositional Learning for Human-Object Interaction Detection},
  author={Hou, Zhi and Peng, Xiaojiang and Qiao, Yu  and Tao, Dacheng},
  booktitle={ECCV},
  year={2020}
}
```

```
@inproceedings{hou2021atl,
  title={Affordance Transfer Learning for Human-Object Interaction Detection},
  author={Hou, Zhi and Baosheng, Yu and Qiao, Yu and Peng, Xiaojiang and Tao, Dacheng},
  booktitle={CVPR},
  year={2021}
}
```

repository: RomeroBarata/HOI-CL

repo_name: RomeroBarata/HOI-CL


text:
# flying-scotts.uk

The source for our website, based on the [clean blog](https://github.com/BlackrockDigital/startbootstrap-clean-blog)
theme, using [Hugo](https://gohugo.io/) for content management and
[leaflet](http://leafletjs.com/), [leaflet-gpx](https://github.com/mpetazzoni/leaflet-gpx),
[Leaflet.Elevation](https://github.com/MrMufflon/Leaflet.Elevation) and
[Leaflet.Photo](https://github.com/turban/Leaflet.Photo) for the maps.

Useful tools:

* [Optimising GPX files](http://labs.easyblog.it/maps/gpx-simplify-optimizer/)
* [Fix GPX elevation](http://www.gpsvisualizer.com/elevation)

## License

All original writing and images (e.g. everything under the "content" folder) are copyright their respective owners unless otherwise stated.

All other content is licensed under the MIT License.

gha_language: CSS


text:
---
title: Remove sensitive information from email headers with postfix
author: Major Hayden
type: post
date: 2013-04-15T02:59:34+00:00
url: /2013/04/14/remove-sensitive-information-from-email-headers-with-postfix/
dsq_thread_id:
  -<PHONE_NUMBER>
categories:
  - Blog Posts
tags:
  - centos
  - command lines
  - fedora
  - mail
  - postfix
  - redhat
  - security
  - sysadmin

---
I'm in the process of moving back to a postfix/dovecot setup for hosting my own mail and I wanted a way to remove the more sensitive email headers that are normally generated when I send mail. My goal is to hide the originating IP address of my mail as well as my mail client type and version.

To get started, make a small file with regular expressions in `/etc/postfix/header_checks`:

```
/^Received:.*with ESMTPSA/              IGNORE
/^X-Originating-IP:/    IGNORE
/^X-Mailer:/            IGNORE
/^Mime-Version:/        IGNORE
```

The "ESMTPSA" match works for me because I only send email via port 465. I don't allow SASL authentication via port 25. You may need to adjust the regular expression if you accept SASL authentication via smtp.

Now, add the following two lines to your `/etc/postfix/main.cf`:

```
mime_header_checks = regexp:/etc/postfix/header_checks
header_checks = regexp:/etc/postfix/header_checks
```

Rebuild the hash table and reload the postfix configuration:

```
postmap /etc/postfix/header_checks
postfix reload
```

Now, send a test email. View the headers and you should see the original received header (with your client IP address) removed, along with details about your mail client.


text:
---
layout: post
title: "MS-UEdin Submission to the WMT2018 APE Shared Task: Dual-Source Transformer for Automatic Post-Editing"
date: 2018-09-01 14:10:50
categories: arXiv_CL
tags: arXiv_CL NMT
author: Marcin Junczys-Dowmunt, Roman Grundkiewicz
mathjax: true
---

* content
{:toc}

##### Abstract
This paper describes the Microsoft and University of Edinburgh submission to the Automatic Post-editing shared task at WMT2018. Based on training data and systems from the WMT2017 shared task, we re-implement our own models from the last shared task and introduce improvements based on extensive parameter sharing. Next we experiment with our implementation of dual-source transformer models and data selection for the IT domain. Our submissions decisively wins the SMT post-editing sub-task establishing the new state-of-the-art and is a very close second (or equal, 16.46 vs 16.50 TER) in the NMT sub-task. Based on the rather weak results in the NMT sub-task, we hypothesize that neural-on-neural APE might not be actually useful.

##### Abstract (translated by Google)

##### URL
[https://arxiv.org/abs/1809.00188](https://arxiv.org/abs/1809.00188)

##### PDF
[https://arxiv.org/pdf/1809.00188](https://arxiv.org/pdf/1809.00188)


text:
# WeaveFlux

> Weaveworks Flux is an integration allowing Kubeflow users to leverage [Weaveworks® Flux]("https://github.com/weaveworks/flux) for GitOps. This utilizes the [stand-alone]("https://github.com/weaveworks/flux/tree/master/site/standalone") implementation. Being stand-alone, most of the maintenance is manual. If you are looking for a more managed solution, we recommend you look at [Weave Cloud®]("https://www.weave.works/product/cloud/").

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**  *generated with [DocToc](https://github.com/thlorenz/doctoc)*

- [Installation](#installation)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## Installation

We have packaged Weaveworks® Flux as a ksonnet package as to fit with the overall architecture of Kubeflow. We will pick up from the installation guide found [here]("https://github.com/kubeflow/kubeflow#setup").

```
ks pkg install kubeflow/weaveflux@${VERSION}
```

Next we need to set a few environment variables. Make sure that you set "GITURL" to your Github repository ( For example git@github.com:weaveworks/flux-example ).

```
ks param set weaveflux gitUrl ${GITURL}
ks param set weaveflux namespace ${NAMESPACE}

```
Finally, we will deploy the application

```
ks apply default -c weaveflux
```

You will need to expose the service in order to use this. You are free to use different methods to expose.

```
kubectl port-forward deployment/flux 3030:3030
```

We will then setup our FLUX_URL and test fluxctl

```
FLUX_URL=http://`kubectl -n ${NAMESPACE} get svc flux-lb | head -2 | tail -1 | awk '{ print $4 }'`:3030/api/flux

fluxctl list-controllers

```

Once you are good to go, please refer to the [documentation on Weavework® Flux]("https://github.com/weaveworks/flux/blob/master/site/using.md").

repository: PipelineAI/pipeline

gha_language: Jsonnet

repo_name: PipelineAI/pipeline


text:
---
layout: page
title: "Transcoding Events"
description: "Listening to transcoding events"
order: 4
disqus: 1
---

Transcoding will happen on a background thread, but we will send updates through the `TranscoderListener`
interface, which can be applied when building the request:

```java
Transcoder.into(filePath)
        .setListenerHandler(handler)
        .setListener(new TranscoderListener() {
             public void onTranscodeProgress(double progress) {}
             public void onTranscodeCompleted(int successCode) {}
             public void onTranscodeCanceled() {}
             public void onTranscodeFailed(@NonNull Throwable exception) {}
        })
        // ...
```

All of the listener callbacks are called:

- If present, on the handler specified by `setListenerHandler()`
- If it has a handler, on the thread that started the `transcode()` call
- As a last resort, on the UI thread

##### onTranscodeProgress

This simply sends a double indicating the current progress. The value is typically between 0 and 1,
but can be a negative value to indicate that we are not able to compute progress (yet?).

This is the right place to update a ProgressBar, for example.

##### onTranscodeCanceled

The transcoding operation was canceled. This can happen when the `Future` returned by `transcode()`
is cancelled by the user.

##### onTranscodeFailed

This can happen in a number of cases and is typically out of our control. Input options might be
wrong, write permissions might be missing, codec might be absent, input file might be not supported
or simply corrupted.

You can take a look at the `Throwable` being passed to know more about the exception.

##### onTranscodeCompleted

Transcoding operation did succeed. The success code can be:

|Code|Meaning|
|----|-------|
|`Transcoder.SUCCESS_TRANSCODED`|Transcoding was executed successfully. Transcoded file was written to the output path.|
|`Transcoder.SUCCESS_NOT_NEEDED`|Transcoding was not executed because it was considered **not needed** by the `Validator`.|

[Keep reading](validators) to know about `Validator`s.

gha_language: Java


text:
# Starting a New Project

After you've downloaded the Library, follow these steps to include it in your Android dev environment.

### Eclipse

(This assumes you already have Google's Android Library and Eclipse both installed, and the ADT Eclipse plug in installed.)

1. Go to File -> New -> Android Application Project.
2. Enter a project name. Under Minimum Required Library, select API 10 (2.3.3).
3. Enter your package name and click Finish to complete the setup.
4. In Project Explorer, right click your project and select "Properties."
5. Select Java Build Path, then select Libraries.
6. Select Add External Jars and add the CloudMine android Library jar
7. Select the Order and Export tab and check the checkbox next to the cloudmine-android jar

### IntelliJ

(This assumes you already have Google's Android Library and IntelliJ both installed.)

1. Go to File -> New Project
2. Select Create Project from Scratch and click next
3. Enter your project name, module name, and select Android Module and hit Next
4. Keep hitting next until the project is created. If intelliJ asks for you to identify the Android Library Module, locate the root folder on your filesystem that you unzipped from the download online.
5. Right click your module and select "Open Module Settings"
6. Select Project Settings -> Modules -> Your Module -> Dependencies
7. Click (+) Add, Jars or Directories, and select the CloudMine android Library jar, and click OK

### Eclipse and IntelliJ

8. Open your AndroidManifest.xml add the following below the <manifest> tag:

```xml
<uses-permission android:name="android.permission.INTERNET"/>
```

9. Open your main Activity class and add

```java
// Find this in your developer console
private static final String APP_ID = "c1a....";
// Find this in your developer console
private static final String API_KEY = "3fc...";
```

at the top of the class definition.

10. In onCreate, add the line of code to initial the library with your app's credentials. This code must be ran before any calls to CloudMine occur; because of this, you may want to add it to your Application class if you have one, or make all of your Activities extend a single parent Activity, and put the initialization code in that Activitie's onCreate.

```java
// This will initialize your credentials
CMApiCredentials.initialize(APP_ID, API_KEY, getApplicationContext());
```

11. Enjoy developing without worrying about the backend

repository: cloudmine/CloudMineSDK-Android

branch_name: refs/heads/dev

repo_name: cloudmine/CloudMineSDK-Android


text:
# Prettier formatter for Visual Studio Code

VS Code package to format your JavaScript / TypeScript / CSS using [Prettier](https://github.com/prettier/prettier).

## Installation

Install through VS Code extensions. Search for `Prettier - Code formatter`

[Visual Studio Code Market Place: Prettier - Code formatter](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)

Can also be installed using

```
ext install prettier-vscode
```

⚠ A word of warning-if you have any other code formatting extensions installed such as for example hugely popular `HookyQR.beautify` or `taichi.react-beautify` they might take precedence and format your code instead of Prettier leading to unexpected results.

## Usage

### Using Command Palette (CMD/CTRL + Shift + P)

```
1. CMD + Shift + P -> Format Document
OR
1. Select the text you want to Prettify
2. CMD + Shift + P -> Format Selection
```

### Custom keybindings

If you don't like the defaults, you can rebind `editor.action.formatDocument` and `editor.action.formatSelection` in the keyboard shortcuts menu of vscode.

### Format On Save
Respects `editor.formatOnSave` setting.

You can turn on format-on-save on a per-language basis by scoping the setting:

```json
// Set the default
"editor.formatOnSave": false,
// Enable per-language
"[javascript]": {
    "editor.formatOnSave": true
}
```

## Settings

### Prettier's Settings
Settings will be read from (listed by priority):
1. [Prettier configuration file](https://prettier.io/docs/en/configuration.html)
1. `.editorconfig`

Or if no prettier configuration file exist
1. `.editorconfig`
1. VSCode prettier's settings (described below with their default)

#### prettier.printWidth (default: 80)
Fit code within this line limit

#### prettier.tabWidth (default: 2)
Number of spaces it should use per tab

#### prettier.singleQuote (default: false)
If true, will use single instead of double quotes

#### prettier.trailingComma (default: 'none')
Controls the printing of trailing commas wherever possible. Valid options:
 - "none" - No trailing commas
 - "es5"  - Trailing commas where valid in ES5 (objects, arrays, etc)
 - "all"  - Trailing commas wherever possible (function arguments)

#### prettier.bracketSpacing (default: true)
Controls the printing of spaces inside object literals

#### prettier.jsxBracketSameLine (default: false)
If true, puts the `>` of a multi-line jsx element at the end of the last line instead of being alone on the next line

#### prettier.parser (default: 'babylon') - JavaScript only
Which parser to use. Valid options are 'flow' and 'babylon'.

#### prettier.semi (default: true)
Whether to add a semicolon at the end of every line (semi: true),
or only at the beginning of lines that may introduce ASI failures (semi: false)

#### prettier.useTabs (default: false)
If true, indent lines with tabs

#### prettier.proseWrap (default: 'preserve')
(Markdown) wrap prose over multiple lines.

#### prettier.arrowParens (default: 'avoid')
Include parentheses around a sole arrow function parameter

### VSCode specific settings

These settings are specific to VSCode and need to be set in the VSCode settings file. See the [documentation](https://code.visualstudio.com/docs/getstarted/settings) for how to do that.

#### prettier.eslintIntegration (default: false) - JavaScript and TypeScript only
Use *[prettier-eslint](https://github.com/prettier/prettier-eslint)* instead of *prettier*.
Other settings will only be fallbacks in case they could not be inferred from ESLint rules.

#### prettier.stylelintIntegration (default: false) - CSS, SCSS and LESS only
Use *[prettier-stylelint](https://github.com/hugomrdias/prettier-stylelint)* instead of *prettier*.
Other settings will only be fallbacks in case they could not be inferred from stylelint rules.

#### prettier.requireConfig (default: false)
Require a 'prettierconfig' to format

#### prettier.ignorePath (default: .prettierignore)
Supply the path to an ignore file such as `.gitignore` or `.prettierignore`.
Files which match will not be formatted. Set to `null` to not read ignore files. Restart required.

#### prettier.disableLanguages (default: ["vue"])
A list of languages IDs to disable this extension on. Restart required.
*Note: Disabling a language enabled in a parent folder will prevent formatting instead of letting any other formatter to run*

## Prettier resolution

This extension will use prettier from your project's local dependencies. Should prettier not be installed locally with your project's dependencies, a copy will be bundled with the extension.

## Contribute
Feel free to open issues or PRs!

### Running extension
- Open this repository inside VSCode
- Debug sidebar
- `Launch Extension`

### Running tests
Tests open a VSCode instance and load `./testProject` as root workspace.

- Open this repository inside VSCode
- Debug sidebar
- `Launch Tests`

OR

Without having an instance VSCode running (or it won't start)
`npm run test`

repository: nhatipd/prettier-vscode-ipd

repo_name: nhatipd/prettier-vscode-ipd


text:
# DEPRECATED

This package has broken up into smaller, focused packages.

# gram-format

This is the Gram data interchange format. Gram is a lightweight data graph.
This textual representation is easy to read and write.

## Data Graphs in Gram

Gram data comes in two parts:

1. Records which contain data values
2. Paths which compose records into structures

A gram file is a sequence of paths, making it ideal for streaming.

Let's create some data...

### Unit Path, an empty path

The smallest amount of data is no data, put in a container so we know
it is there. An empty path is infinite nothingness.

Empty path constructions:

```
[]
[] + [] = []
[ [] [] ] = []
```

As a special case, a single nest path implies composition with an empty path:
```
[ [] ] = [ [] [] ] = []
```

Identity:
```
identityof [] = undefined || all the same?
```

### Nodes, a named path of length 0

When given a name, a path can be identified and described and discussed.
The smallest named path has a special name in graphs. It is called a Node.

To help identify Nodes they can use special notation using parenthesis.

Node constructions:
```
[n]
(n) =~ [n]
() != []
```

The empty parenthesis expression is _not_ an empty path. Nodes always
have identity. The identity is simply unknown. Implementations may
invent an identity, but must guarantee that it is unique across all paths.

Node compositions with units:
```
(n) + []   =~ [ + n _ ]  =~ [n] =~ (n)
[]  + (n)  =~ [ + _ n ]  =~ [n] =~ (n)
```

Identity:
```
identityof (n) =~ n
identityof ()  =~ <auto>
```

### Edges, named paths of length 1

Nodes can be composed together to create a new path called an Edge.

Edge construction:
```
e = (n) + (n)  =~ [e + n n ]
e = (n1) + (n2) =~ [e + n1 n2]
```

That `+` is a placeholder for any path composition operator.
Edges use operators that define the navigability of the path.

Edge operators:
- `-->` right association
- `<--` left association
-  `--` either direction

The edge operators can include the name of the edge.

Identity:
```
e =~ ()-->() =~ ()-[e]->() =~ [e --> () ()]

```

### Paths, general composition

Paths generalize nodes and edges, allowing composition of any path-like
structure into larger structures. By using binary composition, this
forms a tree-like nesting of paths within paths.

Path construction:
```
p =~ (1)-->(2)<--(3) =~ [p -->  (1) [e <-- (2) (3)] ] =~ [p <-- [e --> (1) (2)] (3) ] ]
```

Paths can use any of the navigability operators used by edges,
and also a special 'pair' operator which associates two
path-like elements without explicitly connecting them.

Path composition without an explicit operator implies the `,` pair operator:

```
p =~ [p [p1] [p2]] =~ [p , [p1] [p2] ]
```

Identitity:
```
identityof [p + n n2] =~ p
identityof [  + n n ] =~ <auto>
```

### Sequence, a list or stream of paths

Really just a convenience for a path of paths, optimized
for processing.

Process how? Reduce a sequence to a node list or an edge list.
Together, those two lists become a graph.

For fun take different windows of the sequence to see a
graph at different points in time.

### Graphs, a merged view of all paths

A graph is a view of all the paths. Mhmm.

### Records, type-safe nested data values

JSON-like nested structures:

```
{
  name: 'Andreas',
  birthDay: date'1969-01-07',
  height: 184cm
  nicknames: ['abk']
}
```

## Identifiers and Symbols

Identifier alphabet:
```
0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_@
```

Identifier regex: `/[0-9a-zA-Z_@]+\b@*/`

Symbol alphabet:
```
0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
```

Symbol regex: `/[a-zA-Z_][0-9a-zA-Z_]*\b(?!@)/`

### Cypher and GQL compatibility

For compatibility with Cypher and GQL statements, identifiers
should be restricted to valid symbols.

## Exploration...

```
// unary path operations
[p [u]] =~ [p]
[p [e]]
[p (n)]
[p [p2]]
[p [p]] =~ [p]

// binary path operations with unit produce the non-unit operand
(n) =~ (n) . []
(n) =~ []  . (n)
[e] =~ [e] . []
[e] =~ []  . [e]
[p] =~ [p] . []
[p] =~ []  . [p]

// binary path operations with non-unit
[p [e]  . [p2]]  =~ [e]  . [p2]
[p [e]  . [e] ]  =~ [e]  . [e]
[p [e]  . (n) ]  =~ [e]  . (n)
[p (n)  . [p2]]  =~ (n)  . [p2]
[p (n)  . [e] ]  =~ (n)  . [e]
[p (n)  . (n) ]  =~ (n)  . (n)   // aka an edge!
[p [p1] . [p2]]  =~ [p1] . [p2]
[p [p1] . [e]]   =~ [p1] . [e]
[p [p1] . (n)    =~ [p1] . (n)
```

# Credits

Thanks to these project for inspiration:

- The entire [unist family](https://unifiedjs.com)
- [mdast-builder](https://github.com/mike-north/mdast-builder) for how to make a builder


text:
# ctf-uix-icon-selector
A Contentful UI extension that leverages react-select and a portion of the Ionicons 2.0.0 library.

![Icon Selector UI-extension in the Contentful interface](./screenshots/field-admin.png)

## Description

You can install this extension into your Contentful space via the [Contentful Comand line tool](https://github.com/contentful/contentful-cli) or by utilizing the webapp [UI extension installer](https://www.contentful.com/developers/docs/concepts/uiextensions/). Full instructions on how to install an extension can be found in the [Contentful UI Extension Documentation](https://www.contentful.com/developers/docs/concepts/uiextensions/).

## How to Enable the Extension

To enable the extension go to a content type of your choice and add a new field of type `JSON`. In the appearance panel you can then find the `Icon Selector` option.

![The appearance panel of a field in a content type](./screenshots/appearance-admin.png)

## Links

[react-select on Github](https://github.com/JedWatson/react-select)

[Ionicons on Github](https://github.com/ionic-team/ionicons)

[Ionicons v2.0.0 Cheatsheet](https://ionicons.com/v2/cheatsheet.html)

repository: christooma/ctf-uix-icon-selector

repo_name: christooma/ctf-uix-icon-selector


text:
# History

## Example History Object

```
{
  "id": 1,
  "path": "path",
  "when": "2000-01-01T01:00:00Z",
  "destination": "/to_path",
  "display": "Actual text of the action here.",
  "ip": "192.283.128.182",
  "source": "/from_path",
  "targets": [

  ],
  "user_id": 1,
  "username": "user",
  "action": "create",
  "failure_type": "none",
  "interface": "web"
}
```

* `id` (int64): Action ID
* `path` (string): Path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
* `when` (date-time): Action occurrence date/time
* `destination` (string): The destination path for this action, if applicable
* `display` (string): Friendly displayed output
* `ip` (string): IP Address that performed this action
* `source` (string): The source path for this action, if applicable
* `targets` (array): Targets
* `user_id` (int64): User ID
* `username` (string): Username
* `action` (string): Type of action
* `failure_type` (string): Failure type.  If action was a user login or session failure, why did it fail?
* `interface` (string): Interface on which this action occurred.

---

## List history for specific file

```
Files::History.list_for_file(path,
  display: "Actual text of the action here.",
  page: 1,
  per_page: 1,
  action: "create"
)
```

### Parameters

* `start_at` (string): Leave blank or set to a date/time to filter earlier entries.
* `end_at` (string): Leave blank or set to a date/time to filter later entries.
* `display` (string): Display format. Leave blank or set to `full` or `parent`.
* `page` (int64): Current page number.
* `per_page` (int64): Number of records to show per page.  (Max: 10,000, 1,000 or less is recommended).
* `action` (string): Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
* `path` (string): Required - Path to operate on.

---

## List history for specific folder

```
Files::History.list_for_folder(path,
  display: "Actual text of the action here.",
  page: 1,
  per_page: 1,
  action: "create"
)
```

### Parameters

* `start_at` (string): Leave blank or set to a date/time to filter earlier entries.
* `end_at` (string): Leave blank or set to a date/time to filter later entries.
* `display` (string): Display format. Leave blank or set to `full` or `parent`.
* `page` (int64): Current page number.
* `per_page` (int64): Number of records to show per page.  (Max: 10,000, 1,000 or less is recommended).
* `action` (string): Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
* `path` (string): Required - Path to operate on.

---

## List history for specific user

```
Files::History.list_for_user(user_id,
  display: "Actual text of the action here.",
  page: 1,
  per_page: 1,
  action: "create"
)
```

### Parameters

* `start_at` (string): Leave blank or set to a date/time to filter earlier entries.
* `end_at` (string): Leave blank or set to a date/time to filter later entries.
* `display` (string): Display format. Leave blank or set to `full` or `parent`.
* `page` (int64): Current page number.
* `per_page` (int64): Number of records to show per page.  (Max: 10,000, 1,000 or less is recommended).
* `action` (string): Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
* `user_id` (int64): Required - User ID.

---

## List site login history

```
Files::History.list_logins(
  display: "Actual text of the action here.",
  page: 1,
  per_page: 1,
  action: "create"
)
```

### Parameters

* `start_at` (string): Leave blank or set to a date/time to filter earlier entries.
* `end_at` (string): Leave blank or set to a date/time to filter later entries.
* `display` (string): Display format. Leave blank or set to `full` or `parent`.
* `page` (int64): Current page number.
* `per_page` (int64): Number of records to show per page.  (Max: 10,000, 1,000 or less is recommended).
* `action` (string): Deprecated: If set to `count` returns a count of matching records rather than the records themselves.

---

## List site full action history

```
Files::History.list(
  display: "Actual text of the action here.",
  page: 1,
  per_page: 1,
  action: "create"
)
```

### Parameters

* `start_at` (string): Leave blank or set to a date/time to filter earlier entries.
* `end_at` (string): Leave blank or set to a date/time to filter later entries.
* `display` (string): Display format. Leave blank or set to `full` or `parent`.
* `page` (int64): Current page number.
* `per_page` (int64): Number of records to show per page.  (Max: 10,000, 1,000 or less is recommended).
* `action` (string): Deprecated: If set to `count` returns a count of matching records rather than the records themselves.

repository: ricopags/files-sdk-ruby

repo_name: ricopags/files-sdk-ruby


text:
# Spyral
Draw some cool spirals!

## The goal
With Spyral you can draw cool and mesmerizing spirals!

**Note**: this is a work in progress, done quickly.
There is plenty of room for improvement.
So feel free to make some changes and improve this project :)

## How it works

1) Make convex polygons:
    1) Generate N random points (seeds)
    2) Get the Voronoi diagram from the seeds (see [scipy](https://docs.scipy.org/doc/scipy-0.18.1/reference/generated/scipy.spatial.Voronoi.html))
    3) Get a set of vertices and regions (linked vertices) from the Voronoi diagram
2) Draw spirals inside each polygon (region) generated:

    Do the follwing until a stop condition is true:
    1) Draw a line from one polygon's vertex to another.
    2) Move the vertex along the edge so that it is closer to the next vertex.
    3) Move to next vertex.

### Example

Generate a 1500*500 banner:

`raw_image(width=1500, height=500)`

output :
![colored image](examples/color.png)

Generate a 1500*500 black and white banner:

`raw_image(width=1500, height=500, color=(0, 0, 0)`

output :
![black and white image](examples/blackandwhite.png)

repository: AlexandrePerez/Spyral

repo_name: AlexandrePerez/Spyral


text:
# Solidity Game - Privacy Attack

_Inspired by OpenZeppelin's [Ethernaut](https://ethernaut.openzeppelin.com), Privacy Level_

⚠Do not try on mainnet!

## Task

The creator of this contract was careful enough to protect the sensitive areas of its storage.
Unlock this contract.

_Hint:_

1. Understanding how storage works
2. Understanding how parameter parsing works
3. Understanding how casting works

## What will you learn?

1. [Layout of State Variables in Storage](https://docs.soliditylang.org/en/v0.8.5/internals/layout_in_storage.html)

   > State variables of contracts are stored in storage in a compact way such that multiple values sometimes use the same storage slot.
   > For each variable, a size in bytes is determined according to its type. Multiple, contiguous items that need less than 32 bytes are packed into a single storage slot if possible.

![storage1](https://user-images.githubusercontent.com/78368735/123262979-dcf00100-d4ce-11eb-8696-f71659ab509f.jpeg)

2. [Mappings and Dynamic Arrays](https://docs.soliditylang.org/en/v0.8.5/internals/layout_in_storage.html#mappings-and-dynamic-arrays)

   > Due to their unpredictable size, mappings and dynamically-sized array types cannot be stored “in between” the state variables preceding and following them. Instead, they are considered to occupy only 32 bytes with regards to the rules above and the elements they contain are stored starting at a different storage slot that is computed using a Keccak-256 hash.
   > In the sense that there is a slot for the array itself and a data area that is computed using a `keccak256` hash of that slot’s position.

## What is the most difficult challenge?

### How Ethereum optimizes data storage 🤔

From Solidity [docs](https://docs.soliditylang.org/en/v0.8.5/internals/layout_in_storage.html#layout-of-state-variables-in-storage), we get this definition:

> Except for dynamically-sized arrays and mappings, data is stored contiguously item after item starting with the first state variable, which is stored in slot `0`.
> Multiple, contiguous items that need less than 32 bytes are packed into a single storage slot if possible.

#### Less Efficient Storage Use

Here’s an example of inefficient storage usage. Notice that smaller size variables like `boolVar` and `bytes4Var` are not sequentially initialized, taking new slots 0 and 2 when they could have been packed together:
![storage2](https://user-images.githubusercontent.com/78368735/123262993-e1b4b500-d4ce-11eb-889c-206d14f1baf9.jpeg)

#### More Efficient Storage Use

A more efficient storage method would be to sequentially declare the `bool` (1 byte size) and the `bytes4` (4 bytes size) variables. The EVM then efficiently packs the two into a single storage slot.
Likewise, in the `Object` `struct`, the more efficient method is to pack the two `uint8`s together, taking up 1 slot. This way, all future instances of Object only take 2 slots to store, rather than 3. Storage optimization is especially important in structs, as the storage can grow rapidly:
![storage3](https://user-images.githubusercontent.com/78368735/123263231-1fb1d900-d4cf-11eb-9bd3-3342dfdfb39d.jpeg)

**Notice:** slots index at 0 from RIGHT to LEFT. `bytes4Var` is initialized after `boolVar`, so its stored to the left of `boolVar`, exactly 1 byte from the right.

**Exceptions:**

1. `constants` are not stored in storage. From Solidity [documentation](https://docs.soliditylang.org/en/v0.8.5/contracts.html), that the compiler does not reserve a storage slot for `constant` variables. This means you won’t find the following in any storage slots:

```
contract A {
    uint public constant number = ...; //not stored in storage
}
```

2. Mappings and dynamically-sized arrays do not stick to these conventions.

### Security Considerations

- In general, excessive slot usage wastes gas, especially if you declared structs that will reproduce many instances. **Remember to optimize your storage to save gas!**
- Save your variables to `memory` if you don’t need to persist smart contract state. `SSTORE` & `SLOAD` are very gas intensive opcodes.
- All storage is publicly visible on the blockchain, even your `private` variables!
- Never store passwords and private keys without hashing them first.

## Source Code

⚠This contract contains a bug or risk. Do not use on mainnet!

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.5;

contract Privacy {
  bool public locked = true;
  uint256 public ID = block.timestamp;
  uint8 private flattening = 10;
  uint8 private denomination = 255;
  uint16 private awkwardness = uint16(block.timestamp);
  bytes32[3] private data;

  constructor(bytes32[3] memory _data) public {
    data = _data;
  }

  function unlock(bytes16 _key) public {
    require(_key == bytes16(data[2]));
    locked = false;
  }

  /*
    A bunch of super advanced solidity algorithms...

      ,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`
      .,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,
      *.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^         ,---/V\
      `*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.    ~|__(o.o)
      ^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'  UU  UU
  */
}

```

## Configuration

### Install Truffle cli

_Skip if you have already installed._

```
npm install -g truffle
```

### Install Dependencies

```
yarn install
```

## Test and Attack!💥

### Run Tests

```
truffle develop
test
```

You should unlock contract successfully.

```
truffle(develop)> test
Using network 'develop'.

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.

data [
  '0xcc8db7b17346a0c3e6cba83affe8a88a9f86455f9f9619d2f59c271a9b3a8f60',
  '0xb5319411b04e31d05369dc5ff929a09dbe4e49aace036d6f5ad79dec33f681f4',
  '0x6cb79e2ea29b85193ccb73ca2d1939bcfcc2259e3745c0099d5662958209ca4f'
]

  Contract: Hacker
data2 0x6cb79e2ea29b85193ccb73ca2d1939bcfcc2259e3745c0099d5662958209ca4f
key 0x6cb79e2ea29b85193ccb73ca2d1939bc 34
    √ should unlock contract (362ms)

  1 passing (434ms)

```

repository: maAPPsDEV/privacy-attack

repo_name: maAPPsDEV/privacy-attack


text:
# Terraform::AzureRM::SecurityCenterContact

Manages the subscription's Security Center Contact.

~> **NOTE:** Owner access permission is required.

## Properties

`Email` - (Required) The email of the Security Center Contact.

`Phone` - (Required) The phone number of the Security Center Contact.

`AlertNotifications` - (Required) Whether to send security alerts notifications to the security contact.

`AlertsToAdmins` - (Required) Whether to send security alerts notifications to subscription admins.

## Return Values

### Fn::GetAtt

`Id` - The Security Center Contact ID.

## See Also

* [azurerm_security_center_contact](https://www.terraform.io/docs/providers/azurerm/r/security_center_contact.html) in the _Terraform Provider Documentation_


text:
[![Build Status](https://dev.azure.com/almarklein/wgpu-py/_apis/build/status/almarklein.wgpu-py?branchName=master)](https://dev.azure.com/almarklein/wgpu-py/_build/latest?definitionId=1&branchName=master)

# wgpu-py

Next generation GPU API for Python

## Introduction

In short, this is a Python lib wrapping the Rust wgpu lib and exposing
it with a Pythonic API similar to WebGPU.

The OpenGL API is old and showing it's cracks. New API's like Vulkan,
Metal and DX12 provide a modern way to control the GPU, but these API's
are too low-level for general use. The WebGPU API follows the same concepts, but with
a simpler (higher level) spelling. The Python `wgpu` library brings the
WebGPU API to Python. Based on [wgpu-native](https://github.com/gfx-rs/wgpu).

To get an idea of what this API looks like have a look at [triangle.py](https://github.com/almarklein/wgpu-py/blob/master/examples/triangle.py) and the other [examples](https://github.com/almarklein/wgpu-py/blob/master/examples/).

## Status

*This is experimental, work in progress, you probably don't want to use this just yet!*

* We have a few working examples!
* Support for Windows and Linux. Support for MacOS is underway.
* We have not fully implemented the API yet.
* The API may change. We're still figuring out what works best.
* The API may change more. Until WebGPU settles as a standard, its specification
  may change, and with that our API will probably too.

## Installation

```
pip install wgpu
pip install python-shader  # optional - our examples use this to define shaders
```

The library ships with Rust binaries for Windows, MacOS and Linux. If you want to use
a custom build instead, you can set the environment variable `WGPU_LIB_PATH`.

## Platform requirements

Under the hood, `wgpu` runs on Vulkan or Metal, and eventually also DX12 or OpenGL.

On Windows 10, things should just work. On older Windows versions you may need
to install the Vulkan drivers (or wait for the DX12 backend to become more mature).

On Linux, it's advisable to install the proprietary drivers of your GPU
(if you have a dedicated GPU). You may need to `apt install mesa-vulkan-drivers`.
Note that on Linux, the `tk` canvas does not work. Wayland currently only
works with the GLFW canvas (and is unstable).

On MacOS you need at least 10.13 (High Sierra) to have Vulkan support.
At the moment, we've not implemented drawing to a window yet (see #29).

## Usage

The full API is accessable via the main namespace:
```py
import wgpu
```

But to use it, you need to select a backend first. You do this by importing it.
There is currently only one backend:
```py
import wgpu.backend.rs
```

## GUI integration

To render to the screen you can use a variety of GUI toolkits:

```py
# Tk is included with Python (though this canvas only seems to work on Windows)
from wgpu.gui.tk import WgpuCanvas

# GLFW is a great lightweight windowing toolkit. Install with `pip install glfw`
from wgpu.gui.glfw import WgpuCanvas

# Visualizations can be embedded as a widget in a Qt application.
# Import PySide2, PyQt5, PySide or PyQt4 before running the line below.
# The code will detect and use the library that is imported.
from wgpu.gui.qt import WgpuCanvas
```

Some functions in the original `wgpu-native` API are async. In the Python API,
the default functions are all sync (blocking), making things easy for general use.
Async versions of these functions are available, so wgpu can also work
well with Asyncio or Trio.

## Web support

We are considering future support for compiling (Python)
visualizations to the web via PScript and Flexx. We try to keep that
option open as long as it does not get in the way too much. No promises.

## License

This code is distributed under the 2-clause BSD license.

## Developers

* Clone the repo.
* Install devtools using `pip install -r dev-requirements.txt` (you can replace `pip` with `pipenv` to install to a virtualenv).
* Install wgpu-py in editable mode by running `python setup.py develop`, this will also install our only runtime dependency `cffi`
* Run `python download-wgpu-native.py` to download the upstream wgpu-native binaries.
  * Or alternatively point the `WGPU_LIB_PATH` environment variable to a custom build.
* Use `black .` to apply autoformatting.
* Use `flake8 .` to check for flake errors.
* Use `pytest .` to run the tests.

### Changing the upstream wgpu-native version

* Use the optional arguments to `python download-wgpu-native.py --help` to download a different version of the upstream wgpu-native binaries.
* The file `wgpu/resources/wgpu_native-version` will be updated by the script to track which version we depend upon.

repository: forksbot/wgpu-py

repo_name: forksbot/wgpu-py


text:
  Simple Matchmaking

    Simple rule based matchmaking for your online game with support of Redcon(RESP) protocol.

[![Go Report Card](https://goreportcard.com/badge/github.com/fatihkahveci/simple-matchmaking)](https://goreportcard.com/report/github.com/fatihkahveci/simple-matchmaking)
[![GitHub license](https://img.shields.io/github/license/fatihkahveci/simple-matchmaking)](https://github.com/fatihkahveci/simple-matchmaking/blob/main/LICENSE)

## 1- Simple Match Rule

Easiest usage of system is "Direct Match Rule" in this rule players match each other without any rule.

```bash
package main

import (
	"github.com/fatihkahveci/simple-matchmaking/matchmaking"
	"github.com/fatihkahveci/simple-matchmaking/server"
	"github.com/fatihkahveci/simple-matchmaking/store"
	"time"
)

func main()  {
	inMemory := store.NewInMemoryStore()
	dur, _ := time.ParseDuration("10s")

	r := matchmaking.NewDirectMatchRule()

	respServer := server.NewRespServer(inMemory, ":1234")

	matcher := matchmaking.NewMatchmaking("test",respServer,inMemory, r, dur)

	matcher.Start()
}
```

## 2- Score Match Rule

In this example users match with given score rule which means match happens only user score 10 between 15.

```bash
package main

import (
	"github.com/fatihkahveci/simple-matchmaking"
	"github.com/fatihkahveci/simple-matchmaking/rules"
	"github.com/fatihkahveci/simple-matchmaking/server"
	"github.com/fatihkahveci/simple-matchmaking/store"
	"time"
)

func main()  {
	inMemory := store.NewInMemoryStore()
	dur, _ :=time.ParseDuration("10s")

	r := rules.NewScoreMatchRule(10,15)

	respServer := server.NewRespServer(inMemory, ":1234")

	matcher := simpe_mm.NewMatchmaking("score",respServer,inMemory, r, dur)

	matcher.Start()
}
```

## 3- Custom Match Rule

In this example we create our own rule. We just need to follow "MatchRule" interface.

```
package main

import (
	"github.com/fatihkahveci/simple-matchmaking"
	"github.com/fatihkahveci/simple-matchmaking/server"
	"github.com/fatihkahveci/simple-matchmaking/store"
	"time"
)

type CustomFieldMatchRule struct {
	Field string
	MinThreshold int
	MaxThreshold int
}

func NewCustomFieldMatchRule(field string,minThreshold, maxThreshold int) CustomFieldMatchRule {
	return CustomFieldMatchRule{
		Field: field,
		MinThreshold: minThreshold,
		MaxThreshold: maxThreshold,
	}
}

func (r CustomFieldMatchRule) Match(user1, user2 store.User) bool {
	user1Level := user1.Fields[r.Field].(int)
	user2Level := user2.Fields[r.Field].(int)

	minLevel := user1Level - r.MinThreshold
	maxLevel := user1Level + r.MaxThreshold

	if user2Level >= minLevel && user2Level <= maxLevel {
		return true
	}

	return false
}

func (r CustomFieldMatchRule) GetName() string {
	return "CustomField"
}

func main()  {
	inMemory := store.NewInMemoryStore()
	dur, _ :=time.ParseDuration("10s")

	r := NewCustomFieldMatchRule("level",10,20)

	respServer := server.NewRespServer(inMemory, ":1234")

	matcher := simpe_mm.NewMatchmaking("custom",respServer,inMemory, r, dur)

	matcher.Start()
}
```

## Usage

You can add new user to pool using any redis client. Thanks for Redcon ❤

```
redis-cli -p 1234 add '{
  "id": "55",
  "score": 5
}'
```

Also you need to subscribe your matchmaking channel.

```
redis-cli -p 1234
<IP_ADDRESS>:1234> subscribe simple
Reading messages... (press Ctrl-C to quit)
1) "subscribe"
2) "simple"
3) (integer) 1
1) "message"
2) "simple"
3) "{\"user_1\":{\"id\":\"12\",\"score\":5,\"join_time\":\"2021-08-31T22:57:27.109609+03:00\",\"fields\":null},\"user_2\":{\"id\":\"55\",\"score\":5,\"join_time\":\"2021-08-31T22:57:27.109614+03:00\",\"fields\":null},\"match_rule_name\":\"Direct\",\"time\":\"2021-08-31T22:57:27.116724+03:00\",\"action_type\":\"match\"}"

```

## TODOS

- More Server Support (WebSocket etc)
- More Store Support (Redis, Mongo etc)
- Multiple User Support (Team matchmaking)

repository: developgo/simple-matchmaking

repo_name: developgo/simple-matchmaking


text:
# Node.js Chat

A starter chat app using Node.js and WebSockets.

<img src="https://rawgit.com/AllThingsSmitty/nodejs-chat/master/chat-app.png" alt="image of Node.js chat app" width="500">

## Install Node.js

1. [Node.js](http://nodejs.org)

## Run Locally

Install all dependencies:

```shell
npm install
```

Run the app:

```shell
node start.js
```

**Note:** You may want to consider using [`nodemon`](http://nodemon.io/) which will auto-start your server every time you save.

```shell
npm install nodemon -g
nodemon start.js
```

Navigate to `http://localhost:3000`. Open two browsers and start chatting.


text:
# Otholobium decumbens (Aiton) C.H.Stirt. SPECIES

#### Status
ACCEPTED

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

#### Published in
S. African J. Bot. 52(1):2. 1986

#### Original name
Psoralea decumbens Aiton

### Remarks
null

repository: mdoering/backbone

repo_name: mdoering/backbone


text:
# Code Examples

*This folder will contain simple sketches that demonstrate useful snippets.*

## Suggested organization
As we add examples here, create subdirectories named corresponding to the
main topic that links to it, and give each file a reasonably descriptive
name.  If a particular piece of example code will be linked from multiple
topics, do not create multiple example code files -- pick the topic that
seems to be most relevant.  There could be multiple sketches for any given
type of example, so add a two-digit numeric suffix for each file.

For example, if you are adding single piece of sample code which will be
linked both from `powering-projects` and `sleep-modes`, you might create a
file named `examples/sleep-modes/electron-deep-sleep-01.ino`

---
[<- Home](/particle-cookbook)

repository: dougalcampbell/particle-cookbook

repo_name: dougalcampbell/particle-cookbook