text:
# Lectures in Quantitative Economics: Source Files

### Python version

This repository contains

* the `rst` source files for each python lecture in [Quantitative Economics](https://lectures.quantecon.org/), in directory `source/rst`

* supporting Python code in `source/_static/code/`

* supporting figures, PDFs and other static assets in `source/_static`.

## Installation

1) Download and install [Anacoda](https://www.anaconda.com/distribution/) for your platform (Windows/Linux/Mac OS).

2) Download or clone this repository.

3) Enter your local copy of the repository and run `make setup`.

The `make setup` command checks for and installs

* the [quantecon package](https://quantecon.org/quantecon-py) and

* the [sphinxcontrib.jupyter extension](https://github.com/QuantEcon/sphinxcontrib-jupyter) for [Sphinx](https://www.sphinx-doc.org/).

Other dependencies are included with Anaconda.

## Building notebooks

To transform the `rst` files in to `ipynb` files, enter the repo and run `make notebooks`.

The resulting `ipynb` files are stored in a temporary `_build` directory at the root level of the repository.

## Viewing notebooks

Run `make view`

Additionally you can view a particular lecture directly:

* Example: `make view lecture=about_py`

The `make view` command launches a local instance of Jupyter and points it at
the contents of the `_build` directory.

## Workflow

Standard workflow for editing, say, `lqcontrol.rst` in the master branch is

1. Enter your local copy of `lecture-source-py` and type `git pull` to get the latest version
1. Run `make notebooks`
1. Run `make view lecture=lqcontrol` to see `lqcontrol.ipynb` in Jupyter
    * or just `make view` and then navigate to `lqcontrol.ipynb` in the browser window that pops up
1.  Edit `lqcontrol.rst` in your favorite text editor
1. Run `make notebooks` again to generate a new version of `lqcontrol.ipynb`
    * the build system uses caching so this should be quick
    * you might need to open a new terminal window to run this command
1. Return to `lqcontrol.ipynb` in Jupyter and reload the page
1. Go to step 4 and repeat as necessary.

Finally, add, commit and push your changes using `git`.

## Converting notebooks to RST files

Sometimes it's convenient to write a lecture as a notebook and then convert to
RST

This guide is provided by TJS and requires pandoc 2.6 or newer

(Use `pandoc --version` to test)

1.  This step is necessary only if you want to strip out dollar signs from maths

    *  `python latex_space_strip.py  [myinputfile.ipynb] -o [myoutputfile.ipynb]`

2.  To convert, use

    *  `pandoc [myfilenamenew.pynb] -f ipynb+tex_math_dollars -t rst -s -o [newfilename.rst]`

repository: angelsmreyes/lecture-source-py

repo_name: angelsmreyes/lecture-source-py


text:
# `regdomdns`

## Introduction

This is a simple script used to update an *existing* DNS record on
[Register Domain SA](https://www.registerdomain.co.za)'s DNS management web
front-end.

It was created to automate the process of associating my home ADSL IP address
with a host name in my domain. This effectively replaces the need for a dynamic
DNS service.

## Requirements

* npm (1.3.10)
  * `npm install coffee-script` (1.9.0)
  * `npm install casperjs` (1.1.0-beta3)

*All versions are those in use at the time of writing. Other versions may also
work.*

## Usage

To update the `dynamic.mydomain.co.za` record to point to the IP `<IP_ADDRESS>`:

    $ coffee -o . regdomdns.coffee
    $ casperjs --ssl-protocol=tlsv1 regdomdns.js USERNAME PASSWORD dynamic.mydomain.co.za <IP_ADDRESS>

... where `USERNAME` and `PASSWORD` are your Register Domain login credentials.

The `--ssl-protocol=tlsv1` option is required because PhantomJS (on which
CasperJS is built) defaults to SSLv3 and `https://www.registerdomain.co.za`
(rightly) only supports TLS.

**Note:** This script will only update an existing DNS record, and will NOT
create new ones.

## Automation

This script could be called from a (cron jobbed) shell script similar to the
following:

```bash
#!/bin/bash

hostname=dynamic.mydomain.co.za
dnsserver=main.nameserver2.co.za
public_ip=$(lookup_my_public_ip.sh)
current_ip=$(dig +short $hostname @$dnsserver)
<EMAIL_ADDRESS>regdom_pass="l3tmein"

[ -z "$current_ip" ] && echo "No current IP!" && exit 1
[ -z "$public_ip" ] && echo "No public IP!" && exit 1

if [ "$public_ip" != "$current_ip" ]; then
    echo "[current $current_ip] <= [public $public_ip]"
    casperjs --ssl-protocol=tlsv1 $HOME/src/regdomdns/regdomdns.js \
        $regdom_user $regdom_pass $hostname $public_ip
fi
```

license: MIT

repository: walterl/regdomdns

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: walterl/regdomdns


text:
---
templateKey: "blog-post"
blogKey: "Calling All Cross Country Runners!"
description: "null"
publishedAt: "2014-09-11T08:51:00.000Z"
---
The cross country season is nearly upon us so here’s a bit of information about what it entails…

## What is it?

The Wikipedia definition is sport in which teams and individuals run a race on open-air courses over natural terrain. Essentially, this is the winter off-road sport in which we compete not only individually but also as a club.

In cross country the men and women run in separate races with different start times.

## Who do we compete with?

We usually compete in 2 leagues – the Greater Manchester League and the South East Lancs League. However, this year we are yet to hear if South East Lancs League will go ahead. The Manchester League as you might expect is made up of a number of local clubs (as well as some slightly less local ones) so it’s a good chance to see what everyone else is doing.

There are also single Greater Manchester, Northern and National championship races where we compete with clubs in the north and across the country.

## How are we ranked?

To complete the Manchester league you must run 4 of the 5 races. You will then be given an individual ranking in the league comprised of your best 4 results.

We also compete as team. To have a qualifying men’s team we need 6 runners for a race. For a qualifying women’s team it’s 4 runners. The top runners per race will count towards the team and an overall position on the day.

As with the individual rankings, we need to have fielded a team in 4 of the 5 races to qualify for a position overall.

So even if you don’t plan to finish the league it’s good to turn up to the races you can do as you may help contribute to one of the team places.

## What about the club championship?

We also hold a club championship for members to compete with each other. The usual trophies for the top 6 women and top 6 men are available. The championship is scored in the same way as the road and fell.

To qualify you need to complete 4 of 7 possible races. The qualifying races this year are the 5 Manchester league races, the Northern Championships and the National Championships.

## Where is it?

The races are in local parks around Manchester. This year’s locations are Woodbank Park (Stockport), Sherdley Park (St Helens), Boggart Hole Clough (Blackley), Heaton Park and Wythenshawe Park.

The races are hosted by local clubs. As the Harriers do not host a race (many of the clubs don’t) we are usually asked to provide a few marshals for one of the races.

The venue for the Northern champs is yet to be confirmed but the National will be at Parliament Hill in London!

## What is the terrain?

Expect mud, mud and more mud. The races tend to be over grass and through wooded areas with some up and down sections (nothing like a fell race – just undulating).

## How far is it?

The women usually run between 4-6 miles and the men between 5-7 miles. For the National and the Northern the distances are slightly longer.

## When are the races?

11 October 2014 – Woodbank Park
8 November 2014 – Sherdley Park
6 December 2014 – Boggart Hole Clough
7 January 2015 – Heaton Park
24 January 2014 – Northern Champs, Venue TBC
7 February 2015 – Wythenshawe Park
21 February 2015 – National Champs, Parliament Hill
We are also hoping for a men and women’s team for the Manchester University Cross Country Relays on 25 October 2014. Date for Greater Manchester Champs is TBC, it’s usually the first weekend of January.

## What time does it start?

For the Manchester League the women’s race starts at 1.40pm and the men’s race at 2.30pm.

## What kit do I need?

As I have mentioned there is quite a lot of mud involved! Ideally, it would be wise to invest in some cross country spikes. These are lightweight shoes with spikes for grip in the mud. They tend to be cheaper than a normal running shoe – you can pick up a pair for between £30-£50.

If you haven’t got spikes at the very least you need a pair of trainers with good grip such as a trail or fell shoe. What you wear clothing wise will depend on how much you like the cold!

It is advisable to bring some waterproof shoes/wellies, lots of warm clothes and a waterproof coat to wrap up in for before and after the race. We encourage the women to support the men once they have finished and vice versa. This is part of the fun but it can get cold when you are standing around cheering.

Snacks and chocolate are also greatly appreciated when shared with your fellow runners!

## How do I enter?

There is a sign-up sheet on the board for those who wish to participate. The club has to pay an affiliation fee to the league by the end of the month so the deadline to sign up is 18 September 2014.

The fee is £20 which covers your entry to all the Manchester League races, the Northern and the National. It’s then up to you which ones you want to do but we hope people will come to as many as possible.

## Questions?

If you have any questions at all about cross country please speak to me or Mark at one of the training nights and we will be happy to answer any queries.

— Hannah Brierley, Co-Captain

gha_language: JavaScript

gha_license_id: MIT


text:
---
title: "Testing"
description: "Learn how to write tests that check the behaviour of Keystone application."
---

When building a web application it's important to be able to test the behaviour of your system to ensure it does what you expect.
In this guide we'll show you how to use `@keystone-6/core/testing` and [Jest](https://jestjs.io/) to write tests to check the behaviour of your GraphQL API.

## What tests might look like

Typically you will use tests to verify the behaviour of your code.
You might typically test things like your access control, hooks, virtual fields et cetera.

```typescript
import { getContext } from '@keystone-6/core/context';
import { resetDatabase } from '@keystone-6/core/testing';
import * as PrismaModule from '.prisma/client';
import baseConfig from './keystone';

const dbUrl = `file:./test-${process.env.JEST_WORKER_ID}.db`;
const prismaSchemaPath = path.join(__dirname, 'schema.prisma');
const config = { ...baseConfig, db: { ...baseConfig.db, url: dbUrl } };

beforeEach(async () => {
  await resetDatabase(dbUrl, prismaSchemaPath);
});

const context = getContext(config, PrismaModule);

test('Your unit test', async () => {
  // ...
});
```

{% hint kind="tip" %}
We're setting the database url as `file:./test-${process.env.JEST_WORKER_ID}.db` so that our tests can use one database per Jest worker thread and run each test suite in parallel
{% /hint %}

### Context API

The [context API](../context/overview) lets you easily manipulate data in your system.
We can use the [Query API](../context/query) to ensure that we can do basic CRUD operations.

```typescript
const person = await context.query.Person.createOne({
  data: { name: 'Alice', email<EMAIL_ADDRESS>password: 'super-secret' },
  query: 'id name email password { isSet }',
});
expect(person.name).toEqual('Alice');
expect(person.email).toEqual('alice@example.com');
expect(person.password.isSet).toEqual(true);
```

This API works well when we expect an operation to succeed.
If we expect an operation to fail we can use the `context.graphql.raw` operation to check that both the `data` and `errors` returned by a query are what we expect.

```typescript
// Create user without the required `name` field
const { data, errors } = await context.graphql.raw({
  query: `mutation {
    createPerson(data: { email<EMAIL_ADDRESS>password: "super-secret" }) {
      id name email password { isSet }
    }
  }`,
});
expect(data.createPerson).toBe(null);
expect(errors).toHaveLength(1);
expect(errors[0].path).toEqual(['createPerson']);
expect(errors[0].message).toEqual(
  'You provided invalid data for this operation.\n  - Person.name: Name must not be empty'
);
```

The `context.withSession()` function can be used to run queries as if you were logged in as a particular user.
This can be useful for testing the behaviour of your access control rules.
In the example below, the access control only allows users to update their own tasks.

```typescript
// Create some users
const [alice, bob] = await context.query.Person.createMany({
  data: [
    { name: 'Alice', email<EMAIL_ADDRESS>password: 'super-secret' },
    { name: 'Bob', email<EMAIL_ADDRESS>password: 'super-secret' },
  ],
});

// Create a task assigned to Alice
const task = await context.query.Task.createOne({
  data: {
    label: 'Experiment with Keystone',
    priority: 'high',
    isComplete: false,
    assignedTo: { connect: { id: alice.id } },
  },
});

// Check that we can't update the task when logged in as Bob
const { data, errors } = await context
  .withSession({ itemId: bob.id, data: {} })
  .graphql.raw({
    query: `mutation update($id: ID!) {
      updateTask(where: { id: $id }, data: { isComplete: true }) {
        id
      }
    }`,
    variables: { id: task.id },
  });
expect(data!.updateTask).toBe(null);
expect(errors).toHaveLength(1);
expect(errors![0].path).toEqual(['updateTask']);
expect(errors![0].message).toEqual(
  `Access denied: You cannot perform the 'update' operation on the item '{"id":"${task.id}"}'. It may not exist.`
);
```

## Related resources

{% related-content %}
{% well
heading="Example Project: Testing"
href="https://github.com/keystonejs/keystone/tree/main/examples/testing"
target="_blank" %}
Shows you how to write tests against the GraphQL API to your Keystone system. Builds on the Authentication example project.
{% /well %}
{% well
heading="Context API Reference"
href="/docs/context/overview" %}
The API for run-time functionality in your Keystone system. Use it to write business logic for access control, hooks, testing, GraphQL schema extensions, and more.
{% /well %}
{% well
heading="Query API Reference"
href="/docs/context/query" %}
A programmatic API for running CRUD operations against your GraphQL API. For each list in your system you get an API at `context.query.<listName>`.
{% /well %}
{% /related-content %}

repository: keystonejs/keystone

branch_name: refs/heads/main

gha_language: TypeScript

repo_name: keystonejs/keystone


text:
To build a local copy of the docs, install the programs in
docs/environment.yml and run 'make html'. If you use the conda
package manager these commands suffice:

```
git clone git@github.com:anaconda-platform/anaconda-project.git
cd anaconda-project/docs
conda env create
source activate anaconda-project-docs
make html
open build/html/index.html
```

repository: Anaconda-Platform/anaconda-project

gha_language: Python

gha_license_id: NOASSERTION

repo_name: Anaconda-Platform/anaconda-project


text:
# MEGAcmd for Java

[![Build Status](https://travis-ci.com/EliuX/MEGAcmd4J.svg?branch=master)](https://travis-ci.com/EliuX/MEGAcmd4J)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.eliux/megacmd4j/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.eliux/megacmd4j)
[![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/eliux_black)

This is an open source Java library for the [mega.nz][mega] API, working on top of the [MEGAcmd][megacmd] CLI.
There is a [Quick Start][quick-start] available for developers who want to start using the library right away.

## Features

| Feature                   | MEGAcmd   | Description
| ---                       | ---       | ---
| Start session             | `login`   | Allows to authenticate into the mega api to start running commands using user and password, or sessionID or an exported/public folder  |
| Close session             | `logout`  | Close the current session.
| Put content in the Cloud  | `put`     | Upload content to the cloud.
| Session Id                | `session` | Returns the id of the current session.
| HTTPS                     | `https`   | Shows if HTTPS is used for transfers. Allows enabling and disabling this option.
| Idenfity current username | `whoami`  | Returns the username of the current session.
| Make directory            | `mkdir`   | Creates a directory or multiple based on a given remote path.
| List files/directories    | `ls`      | List files and directories in a remote path.
| Get content               | `get`     | Get the content of files and directories in a remote path.
| Copy                      | `cp`      | Copy remote files and directories into a new location.
| Move                      | `mv`      | Move remote files and directories into a new location.
| Change password           | `passwd`  | Changes the password of the currently logged user.
| Shares folder             | `share`   | Shares/Unshares folder with user
| Export to the Internet    | `export`  | Create, delete or list existing public links
| Signup user               | `signup`  | Register as user with a given email

If you have any doubt about how each feature works, please run

```bash
    MegaClient <MEGAcmd> --help
```

## Additional Features
This features have no corresponding Megacmd command, but they are infered from the existing ones

### Count
Show the amount of elements in a folder or that match the query mask. E.g.

```java
    final long amountOfFilesAndDirectories = sessionMega.count("remote/path");
```

But what if you want to filter that counting and it a Predicate to, for instance,
just get the files and not the directories.

```java
    final long amountOfFiles = sessionMega.count("remote/path", FileInfo::isFile);
```

### Exists
This is pretty much the equivalent of `java.io.File.exists`. It checks if the remote path or mask
indicates any non null response. E.g.

```java
    sessionMega.exists("remote/path/filesprefix*.ext");
```

## System requirements
* Install [MEGAcmd][megacmd]. Available packages for MEGAcmd in all supported
platforms should be found [here][megacmd-install].

### Environment variables to set

* `MEGA_EMAIL`: Email used as username (lowercase)
* `MEGA_PWD`: Corresponding password
* `CMD_TTL_ENV_VAR`: Maximum time to live of a running MEGAcmd command.

### Setup your credentials
1. The most common way to setup your credentials would be using environment variables `MEGA_EMAIL`
and `MEGA_PWD`.

2. Use an existing session can be a saver way. You can use it from your app as long
as it don't be closed.

## Continuous Integrations
As most OSS projects in github this one uses [Travis CI](https://travis-ci.com/EliuX/MEGAcmd4J).
I you want a CLI for your project, its recommend to install the correspondent ruby gem:

```bash
    gem install travis
```

## Code style

* Follow the [Google Java Style Guide][google-java-style-guide] as much as possible.
* Install the [Google Java Style Guide settings in your IDE][google-java-style-settings-intellij].

## Known Bugs
There were tests that moved a file to a folder where another file with the same name was present.
In Windows boths files were identified as one and when I ran a move instruction for that file
name it operated over the last moved file and left the oldest one in that folder. In Linux
both files are keep in the folder but identified as different ones, even if the properties where the
same; when a move operation was run over such filename it operated over both.

Also when I tested this on Windows I got more detailed error code, which also gives more detailed
exceptions.

I suppose these issues has to do with the libraries used for making calls to the Mega API, because
in the  Linux version I had more features enabled that in the Windows one, whilst the Mega Cmd and
SDK version were the same. It has already been reported as an
[issue](https://github.com/meganz/MEGAcmd/issues/52) in the MEGAcmd project. It was afterwards solved
by keeping return errors always positive to be compliant with POSIX standard. Thats why an
issue was raised in this repository to provide support for this new feature.

## More information
* Once installed [MEGAcmd][megacmd] in your system execute `mega-help` to check all commands.
You will be able to notice those who are used in this library and others which don't, for practical
reasons, but that will provide you additional capabilities. Try them out.

## Status
Pre-release or Beta: The project has gone through multiple rounds of active development with a goal
of reaching
a stable release version, but is not there yet.

Path of Development: Active (November 4th 2018)

## Author

* **Eliecer Hernandez** - [eliecerhdz@gmail.com](mailto:eliecerhdz@gmail.com).
To know more of me please visit my [website](http://eliux.github.io).

## License

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

[google-java-style-guide]: https://google.github.io/styleguide/javaguide.html
[google-java-style-settings-intellij]: https://github.com/HPI-Information-Systems/Metanome/wiki/Installing-the-google-styleguide-settings-in-intellij-and-eclipse
[mega]: https://mega.co.nz
[megacmd]: https://github.com/meganz/MEGAcmd
[megacmd-install]: https://mega.nz/cmd
[quick-start]: https://github.com/EliuX/MEGAcmd4J/wiki/Quick-start


text:
#### Operation engine

Operation engine allows structuring the invoking of actions and conditions under which these actions are invoked.

##### Operation

Operation contains Condition object and Action object.

##### Action

Action describes something that could happen in the application.

##### Condition

Condition tells the system whether the action should be performed or not.

##### OperationFilter

OperationFilter filters list of operations. For example: return first\last\all Operations with valid Condition.

##### Reducer

Reducer receives list of Operations and performs target task.
For example: invoking all operation's actions.

##### Example #1

Suppose we have a task to buy home appliances. We can buy only one item, and we have a limited budget.
Therefore, we have a set of conditions and positions in priority order.

This piece of code on spock lang simulates such task:

    static class PurchaseAction<T> implements Action<T> {
        private String name
        PurchaseAction(String name) {
            this.name = name
        }

        @Override
        T invoke() {
            throw new Exception(name)
        }
    }

    def "test OperationExecutor. Purchases."() {
        when:
        List<Operation<Void>> operations = [
                new Operation<Void>(new FalseCondition(), new PurchaseAction('TV')),
                new Operation<Void>(new TrueCondition(), new PurchaseAction('VHSPlayer')),
                new Operation<Void>(new TrueCondition(), new PurchaseAction('Laptop'))
        ]

        OperationFilter<Void> operationFilter = new FirstValidOperationFilter<>(operations)
        Reducer<Void> reducer = new ActionInvoker<>()
        OperationExecutor<Void> operationExecutor = new OperationExecutor<>(reducer, operationFilter)
        String purchase = ''
        try {
            operationExecutor.execute()
        } catch (Exception e) {
            purchase = e.getMessage()
        }

        then:
        assert purchase == 'VHSPlayer'
    }

##### Example #2
Suppose we need to send an email with a list of customer names who have agreed to purchase our software.
In this situation Action would return customer name and reducer would combine it into one email.

    def "test OperationExecutor. Send email."() {
         when:
         List<Operation<Void>> operations = [
                 new Operation<Void>(new TrueCondition(), new CustomerNameAction<String>('Michael Johnson')),
                 new Operation<Void>(new FalseCondition(), new CustomerNameAction('Joe Thompson')),
                 new Operation<Void>(new TrueCondition(), new CustomerNameAction('Betty Ross'))
         ]

         OperationFilter<Void> operationFilter = new AllValidOperationFilter<>(operations)
         Reducer<Void> reducer = new EmailSenderReducer<>()
         OperationExecutor<Void> operationExecutor = new OperationExecutor<>(reducer, operationFilter)
         String TARGET_NAMES = 'Michael Johnson, Betty Ross'
         String names = ''
         try {
             operationExecutor.execute()
         } catch (Exception e) {
             names = e.getMessage()
         }

         then:
         assert names == TARGET_NAMES
     }

#### Conditions

OperationEngine allows you to create Condition objects from strings. Consider the mechanism of such creation on the example of a logical expression:

(conditionXXX or conditionYYY) and not conditionZZZ
1. Build literal list
2. Transform literal list to prefix notation
3. Construct condition

##### Build literal list
Logical expression is transformed to literal list.

(conditionXXX or conditionYYY) and not conditionZZZ -> [OPEN_BRACKET, PARAM(conditionXXX), OR, PARAM(conditionYYY), CLOSE_BRACKET, AND, NOT, PARAM(conditionZZZ)]

    OperatorRepresentation operatorRepresentation = new ClassicOperatorRepresentation()
    String logicalExpression = '(conditionXXX or conditionYYY) and not conditionZZZ'
    List<Literal> literals = new LiteralBuilder(operatorRepresentation).buildByLogicalExpression(logicalExpression)

Literal is an object with id (in case of PARAM will be equal to string representation 'conditionXXX' or 'conditionYYY') and literal type.
Possible LiteralTypes: PARAM, AND, OR, NOT, OPEN_BRACKET, CLOSE_BRACKET.
OperatorRepresentation - mapping object of operator, and it's string representation.
Classic:
    AND - and
    OR - or
    NOT - not
Symbol:
    AND - &&
    OR - ||
    NOT - !
It is possible to define custom OperatorRepresentation.

##### Transform literal list to prefix notation
Received list of literals is in infix form. We should transform it to prefix.

    LiteralNotationTransformer notationTransformer = new LiteralNotationTransformer()
    List<Literal> prefixLiterals = notationTransformer.infixToPrefix(
            literals
    )

We transform [OPEN_BRACKET, PARAM, OR, PARAM, CLOSE_BRACKET, AND, NOT, PARAM] to [AND, OR, PARAM(conditionXXX), PARAM(conditionYYY), NOT, PARAM(conditionZZZ)].

##### Construct condition
Target condition is a condition consists of subconditions such as AndCondition, OrCondition, NotCondition, CustomCondition.
It is possible to present via 'condition tree':

                      AndCondition
                /                    \
        OrCondition               NotCondition
        /         \                     |
    conditionXXX   conditionYYY     conditionZZZ

Constructing:

    Condition condition1 = new TrueCondition('conditionXXX')
    Condition condition2 = new TrueCondition('conditionYYY')
    Condition condition3 = new TrueCondition('conditionZZZ')
    Map<String, Condition> conditions = [
                                            (condition1.getId()): condition1,
                                            (condition2.getId()): condition2,
                                            (condition3.getId()): condition3
                                        ]
    Condition targetCondition = new ConditionConstructorFromPrefixLiterals(conditions, prefixLiterals).construct()

##### Full condition construction code:

    OperatorRepresentation operatorRepresentation = new ClassicOperatorRepresentation()
    String logicalExpression = '(conditionXXX or conditionYYY) and not conditionZZZ'
    List<Literal> literals = new LiteralBuilder(operatorRepresentation).buildByLogicalExpression(logicalExpression)

    LiteralNotationTransformer notationTransformer = new LiteralNotationTransformer()
    List<Literal> prefixLiterals = notationTransformer.infixToPrefix(
            literals
    )

    Condition condition1 = new TrueCondition('conditionXXX')
    Condition condition2 = new TrueCondition('conditionYYY')
    Condition condition3 = new TrueCondition('conditionZZZ')
    Map<String, Condition> conditions = [
                                            (condition1.getId()): condition1,
                                            (condition2.getId()): condition2,
                                            (condition3.getId()): condition3
                                        ]
    Condition targetCondition = new ConditionConstructorFromPrefixLiterals(conditions, prefixLiterals).construct()

##### ConditionTransformer

ConditionTransformer transforms condition to list of literals.

    ConditionTransformer conditionTransformer = new ConditionTransformerToPrefixLiterals(targetCondition)
    List<Literal> transformedLiteralList = conditionTransformer.transform()

Transformation of target condition from previous example: targetCondition -> [AND, OR, PARAM(conditionXXX), PARAM(conditionYYY), NOT, PARAM(conditionZZZ)].

##### ConditionCalculator

ConditionCalculator validates conditions and return Map - [key: id of condition, value: result of condition].

    ConditionCalculator conditionCalculator = new ConditionCalculator(condition)
    Map<String, Boolean> results = conditionCalculator.calculate()

MemorizingConditionTransformer
MemorizingConditionTransformer transforms condition (and all subconditions) to MemorizingCondition.
It's useful using of MemorizingCondition with ConditionCalculator in order each condition is calculated only once.

    MemorizingConditionTransformer conditionTransformer = new MemorizingConditionTransformer(condition)
    Condition memorizingCondition = conditionTransformer.transform()

repository: wwkarev/operationengine

repo_name: wwkarev/operationengine


text:
# Use Ginkgo and Gomega with TerraTest

This is an example project on how to use [Ginkgo](https://github.com/onsi/ginkgo) and [Gomega](https://onsi.github.io/gomega/)
frameworks with [Terratest](https://github.com/gruntwork-io/terratest).

## Usage
```bash
make test
```

repository: canhnt/terratest-ginkgo-example

repo_name: canhnt/terratest-ginkgo-example


text:
 **Bookstore with React & Redux **

[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
[![dependencies Status](https://david-dm.org/dwyl/esta/status.svg)](https://david-dm.org/dwyl/esta)

This project comes after the introduction of the React & Redux JS framework. The main aim of the project is to learn how to build a very simple React application using Redux as a state management system. The project has been split into multiple milestones, and each milestone has functional and technical requirements that needs to be implemented.

The project is part of a series of projects to be completed by students of [Microverse](https://www.microverse.org/ "The Global School for Remote Software Developers!").

![sample](./src/image/bookstore.png)

## Background

- Node.js
- React
- React-DOM
- React-Create-App
- Redux
- react-redux
- npm
- CSS
- ES6

## Demo
The demo page can be found [HERE](https://serene-golick-bd6385.netlify.app/)

## Usage

> Clone the repository to your local machine

```sh
$ git clone https://github.com/macbright/react-book-store.git
```

> cd into the directory

```sh
$ cd book-store
```

> install the npm packages

```sh
$ npm install
```

> use npm or yarn to start the server (note: you must have npm and yarn install)

```sh
$ yarn start
```
OR

```sh
$ npm run start
```
this runs the app in the development mode.

Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.

You will also see any lint errors in the console.

## Maintainers

👤  **Bright Okike**

- Github: [@macbright](https://github.com/macbright)
- LinkedIn: [@bokike](https://www.linkedin.com/in/bokike/)
- Twitter: [@b_okike](https://twitter.com/b_okike)

👤  **Shakhawat Hossain**
- Github: [Shakhawat Hossain](https://github.com/shshamim63)
- LinkedIn: [Shakhawat Hossain](https://www.linkedin.com/in/shakhawathossainshamim/)

## Future Features
1. Extend A backend API for users to comment, and upate reading progress
2. Add a book store API for users to add book directly from the net

## Contributing

1. Fork it (https://github.com/macbright/react-book-store.git)
2. Create your feature branch (git checkout -b feature/[choose-a-name])
3.  Push to the branch (git push origin feature/[chosen name])
5. Create a new Pull Request

## License

Bright okike & Shakhawat Hossain
[MIT license](https://opensource.org/licenses/MIT).

repository: macbright/bookstore

branch_name: refs/heads/development

repo_name: macbright/bookstore


text:
# Router Interface Resolver

This package provides a resolver for [Code Inc.'s router](https://github.com/CodeIncHQ/Router) using [`RoutableControllerInterface`](src/RoutableControllerInterface.php) and [`MultiRoutableControllerInterface`](src/MultiRoutableControllerInterface.php) interfaces to detect and configure request handlers.

## Installation

This library is available through [Packagist](https://packagist.org/packages/codeinc/router-routable-resolver) and can be installed using [Composer](https://getcomposer.org/):

```bash
composer require codeinc/router-routable-resolver
```

## License
This library is published under the MIT license (see the [`LICENSE`](LICENSE) file).

repository: codeinchq/router-routable-resolver

repo_name: codeinchq/router-routable-resolver


text:
# Home Assistant Component for Deako Lighting

This component implements support for [Deako](https://deako.com) smart lighting in [Home Assistant](https://home-assistant.io). It is a work in progress, see [issues](https://github.com/iamwillbar/home-assistant-deako/issues) for details on remaining work.

Only Deako Smart Suite switches can be controlled (if you have the first generation Smart switches you will also need a Deako Connect).

## Installation
Until the component has been submitted to Home Assistant you will need to install the component manually by:

1. Downloading the `components/deako` folder.
2. Copying the `deako` folder to `[installation_root]/config/custom_components/`.
3. Adding the following to `configuration.yaml`:
   ```yaml
   light:
     - platform: deako
   ```

repository: iamwillbar/home-assistant-deako

repo_name: iamwillbar/home-assistant-deako


text:
---
hrs_structure:
  division: '1'
  volume: '1'
  title: '5'
  chapter: '37'
  section: 37-68.5
type: hrs_section
tags:
  - Government
menu:
  hrs:
    identifier: HRS_0037-0068_0005
    parent: HRS0037
    name: 37-68.5 Position ceiling
weight: 53185
title: Position ceiling
full_title: 37-68.5 Position ceiling
---
**[§37-68.5] Position ceiling.** Whenever this part requires a position ceiling to be specified:

(1) The number of permanent positions and temporary positions shall be separately identified; and

(2) The position ceiling shall be expressed in units or fractions of full-time equivalent positions. [L 2015, c 160, §2]

Note

Applicability of section. L 2015, c 160, §11.

repository: SamMade/BlueAndKrabby

repo_name: SamMade/BlueAndKrabby


text:
[Home](./index.md) > [@handtracking.io/yoha](./yoha.md) > [ITrackResult](./yoha.itrackresult.md)

## ITrackResult interface

Hand tracking results.

Signature:

```typescript
export interface ITrackResult
```

## Properties

|  Property | Type | Description |
|  --- | --- | --- |
|  [coordinates](./yoha.itrackresult.coordinates.md) | number\[\]\[\] | Array of 21 \[x, y\] coordinates where x and y are relative coordinates such that \[x,y\] = \[0,0\] corresponds to the top left pixel of the track source and \[x,y\] = \[1,1\] corresponds to the bottom right pixel of the track source.The array is orderd as follows:

 [0-3]: Thumb from base to tip.

 [4-7]: Index finger from base to tip.

 [8-11]: Middle finger from base to tip.

 [12-15]: Ring finger from base to tip.

 [16-19]: Little finger from base to tip.

 [20]: Base of hand.

 |
|  [isHandPresentProb](./yoha.itrackresult.ishandpresentprob.md) | number | The probability that the analyzed frame contains a hand. |
|  [isLeftHandProb](./yoha.itrackresult.islefthandprob.md) | number | The probability that the detected hand (if any) is a left hand. Note that this is with respect to the processed video which may or may not be flipped depending on how you retrieved it. |
|  [poses](./yoha.itrackresult.poses.md) | [IPoseProbabilities](./yoha.iposeprobabilities.md) | The detected hand poses. |

repository: handtracking-io/yoha

repo_name: handtracking-io/yoha


text:
# isplayer

This condition will only fire when the specified UnitID is a player.

## Parameters

The target's UnitID. Refer to [target condition](target.md).

## Examples

```lua
/cast [isplayer:target] {Yes}
```

This will execute the Macro with the name `Yes` if your target is a player.

repository: DennisWG/Roid-Macros

gha_language: Lua

repo_name: DennisWG/Roid-Macros


text:
# Homebrew Tap

[Homebrew](https://docs.brew.sh/) formulas for [terraform-docs](https://github.com/terraform-docs/terraform-docs/).

Managed with [goreleaser](https://goreleaser.com/).

## Usage

To use this tap:

```bash
brew tap terraform-docs/homebrew-tap
brew install terraform-docs
```

There's also an offical tap in `homebrew/core`.

```bash
brew install terraform-docs
```

## License

Apache version 2.0 License - Copyright (c) 2021 The terraform-docs Authors.

repository: terraform-docs/homebrew-tap

repo_name: terraform-docs/homebrew-tap


text:
# The HTTP Client and WebSocket APIs
This chapter includes 20 problems that are meant to cover the HTTP Client and WebSocket APIs.

Do you remember `HttpUrlConnection`? Well, JDK 11 comes with the HTTP Client API as a reinvention of `HttpUrlConnection`.
The HTTP Client API is easy to use and supports HTTP/2 (default) and HTTP/1.1. For backward compatibility, the HTTP Client API
will automatically downgrade from HTTP/2 to HTTP 1.1 when the server doesn't support HTTP/2. Moreover, the HTTP Client API
supports synchronous and asynchronous programming models and relies on streams to transfer data (reactive streams). It also
supports the WebSocket protocol, which is used in real-time web applications to provide client-server communication with low
message overhead.

repository: PacktPublishing/Java-Coding-Problems

gha_language: Java

repo_name: PacktPublishing/Java-Coding-Problems


text:
![Screen Shot 2021-05-17 at 6 22 08 PM](https://user-images.githubusercontent.com/77944651/118576388-08543300-b74e-11eb-9752-559e21353773.jpg)
# takeAhike

##TakeAHike:
A Full stack web application that serves as a personal hub for all things hiking. Allowing you to keep track of dream hikes, past hikes, connect and exchange information with other hikers, search for new hikes and add them all to your personal account page.

Direct link to app:
https://p2v2takeahike.herokuapp.com/

Home page
[Screenshot1](https://github.com/AGRASSL/takeahikep2/blob/bccde2401b36dc820d5427dc835223f6e70585b8/images/Screen%20Shot%202021-05-17%20at%206.22.08%20PM.jpg)

Result:
In this application we utilized the National Parks API to implement a search for hiking trails. Ultimately, TakeAHike allows the user to keep a list of hikes they want to take. Once the hike is selected, a brief description of the hike including; name, location, style of hike, contact number, operating hours, pictures and entrance fees.

General info

Technologies used:
(new technology)

Font Awesome

Express.js (Server framework)

Handlebars (Templating engine)

Heroku (Cloud platform)

MySQL (RDBMS)

Node.js (Javascript environment)

Sequelize (ORM)

Body Parser

Dotenv

Bcrypt

Body-Parser

Getting Started
Prerequisites
MySQL
Node.js

Installing
If you would like the view the site from a user's point of view, you have the option of viewing the site on Heroku. It is located at <"https://p2v2takeahike.herokuapp.com/">.

If you would like to run the application locally, please ensure that you have the prerequisites installed, then take the following steps:

Clone this repository to your local machine with git clone <repo-url>.
Install NPM dependencies by running npm install in the project directory.
If you use a MySQL username other than root or have a MySQL password, open config/config.json and update these values.
Log into MySQL Workbench with mysql -u root (substitute your username and add -p <your password> if needed).
Run CREATE DATABASE trails_db;
Ensure that you are in the root project directory, then run npm start.
The application will be running at localhost:3000/

Authors
Sean Bannon, Alexandra Grassl, Andrew Friedman

License
This project is licensed under the MIT License - see the LICENSE file for details.


text:
# BaRCoD - Barcode Recovery and Comparison from Database

A snakemake workflow aiming at recovering and analyzing barcodes for metabarcoding experiments.
Using a set of primers, finds possible amplicon in the database (or a taxonomic subset thereof) and performs pairwise alignements of barcodes.

Orignally RRW-Primerblast and BAnalyzer, now united.

## Usage

Download the repository and create a conda environment containing snakemake.

```bash
conda create -c bioconda -c conda-forge --name snakemake snakemake
```

Then modify the config file template in `config/config.yaml` to suit your needs
and run the workflow with:

```bash
snakemake --use-conda --cores 1 --configfile /path/to/config.yaml
```

More options are available, see the [snakemake's documentation](https://snakemake.readthedocs.io/en/stable/).

## Sequence database

To run the pipeline you will need to provide a BLAST-formated reference sequence database.
If you already have a fasta file with your sequences follow the [BLAST documentation](https://www.ncbi.nlm.nih.gov/books/NBK279688/)
to know how to format it.

You will also need to provide the [taxdb](https://ftp.ncbi.nlm.nih.gov/blast/db/taxdb.tar.gz) and
[taxdump](https://ftp.ncbi.nlm.nih.gov/pub/taxonomy/new_taxdump/new_taxdump.tar.gz)
files available from the NCBI server.

## Workflow

### Barcode recovery

First the provided primers will be used to scan the (BLAST-formatted) database and find putative
primer binding sites. Possible amplicons will then be extracted between consecutive primer matches:

```
-> indicates a match on the '+' strand
<- indicates a match on the '-' strand

primer matches:      <- ->  ->    <-  ->
database sequence: =========================
flanked sequence:           ========

primer matches:      -> <-  ->    <-  ->
database sequence: =========================
flanked sequence:    =====  ========

primer matches:      <- <-  ->    ->  ->
database sequence: =========================
flanked sequence:
```

### Pairwise comparison

Sequences within a Taxonomic node will be clustered prior to the alignement and calculation of the Hamming distance.
This allows to reduce redundancy in the database. Dereplication is performed by grouping
sequences with 100% identity **within a taxonomic node**.
Note that alignement of ambiguous nucleotides **never** incures a penalty. Therefore sequences
containing ambiguous nuclotides can be clustered with sequences that contain strict nucleotide (A, T, U, C, G).

Then each sequence cluster will be compaired in pairs to determine the pair-wise Hamming distance.
Note that only pairs with at least the identity level defined in the config file be compaired.

If no distance is available for a given taxid it may be that:
* there is no barcode for this taxid
* there is no other barcode within the identtity threshold

To differentiate between these two option check the output of the Barcode recovery process.

### Consensus determination

For each cluster a consensus rank will be determined. This reflects the expected consensus
that can be reached for this sequence considering all sequences within the given identtity
threshold and with a given agreement level.

## Credits

This would not be possible without:

* Snakemake
* BLAST+
* Biopython
* Cutadapt
* TaxidTools
* VSEARCH
* R tidyverse

## Contributing

For new features or to report bugs please submit issues directly on the online repository.

## License

This project is licensed under a BSD 3-Clauses License, see the LICENSE file for details.

## Author

For questions about the pipeline, problems, suggestions or requests, feel free to contact:

Grégoire Denay, Chemisches- und Veterinär-Untersuchungsamt Rhein-Ruhr-Wupper

<gregoire.denay@cvua-rrw.de>

repository: CVUA-RRW/BaRCoD

repo_name: CVUA-RRW/BaRCoD


text:
# Video Game Design course - 2017/2018 - Introduction Project

Introductory game project for Unreal Engine 4.

**NOTE: maps are committed with no precomputed lighting.** To build static lightmaps: open the map, go to Settings > World Settings > Lightmass > [Advanced] > unset Force No Precomputed Lighting, then Build.

**NOTE**: The "_Starter Content_" package has been added to `.gitignore` as it is automatically added by UE4 on load, so don't modify its content as changes will be lost.


text:
# CNU-KOTH
Ethical hacking King of the Hill competition at CNU

## Scorebot
### Basic Setup
1. Fill out the configuration files found in the /config/ directory.
2. Place the contents of the /web/ directory into your web server's directory and make them executable. You may have to configure your web server to allow execution of CGIs.
3. Run runme.py in the /scripts/ directory. This will enroll the teams configured in keylist.cfg into your MySQL database and stage the boxes in iplist.cfg for scoring. Scoring should start automatically.

### Custom Flag Files
You may want to have your teams plant their flags in custom files on your vulnerable servers. The way we implemented this in our last competition was the following:

1. Make the custom file, e.g. flag.txt
2. Run an ncat listener that serves the contents of flag.txt, e.g. ncat -lkp 1738 -e "/bin/cat /path/to/flag.txt"
3. Insert a custom entry into your iplist.cfg file, e.g. CUST:<IP_ADDRESS>:1738:2000

The scorebot will connect to port 1738 on <IP_ADDRESS> and receive the contents of flag.txt to parse for flags.

To stop the scorebot properly, hit the ENTER key (CTRL-C if it hangs for too long).

### Web Front End
#### scoreboard.cgi
Real-time scoreboard. Must be refreshed to update.

#### boxes.cgi
Shows IP and point value of scored boxes, as well as the last team to successfully plant their flag in each. Boxes added to iplist.cfg after scoring is started will not show up on this page. To see such boxes, runme.py must be restarted.

repository: Blastitt/CNU-KOTH

repo_name: Blastitt/CNU-KOTH


text:
# Controller (Server)

This folder is used to contain the logical workings of the back-end.

## Auth.js (Controller)

> Validate form data

```javascript
if (!email || !password) {
    return res.status(400).json('Bad request params - you need to provide an email and password');
}
```

> Call login function in [service/auth.js](#auth-js-service)

```javascript
    const user = await authService.login(email, password);
```

>If user is found, return cookie with user information

```javascript
    req.session.user = user;
    return res.sendStatus(204);
```

>Else, return error and 401

```javascript
return res.status(401).json(err);
```

This file handles communications between the login form  in the react client and the user authentication service.

The login(req, res) function is called from the login form contained with the [Login.jsx](#login-jsx) page. When the form is submitted, it passes the users email and password information as an argument to this function.

If either the email or password values are null, this will return a status code of 400

Once it is verified that the user has submitted their information, the login(email, password) function contained within the [service/auth.js](#auth-js-service) file is called. This will make an api call to the Postgres server to verify the user exists.

If verified, a json object is returned which contains the user.ID and user.role which is stored as a cookie on the users browser and we send status code 204

If not authenticated, the service call will return a rejected promise and a status code of 401

repository: crgold/retrodocs

repo_name: crgold/retrodocs


text:
# *Abstract*
Abstract is a Python library for creating and drawing graphs
and taking advantage of graph properties.

## Installation

```bash
pip install abstract
```

## Graph

### Introduction
In computer science, a graph is an abstract data type that
is meant to implement the undirected graph and directed graph
concepts from mathematics; specifically, the field of graph theory.
[[1]](https://en.wikipedia.org/wiki/Graph_(abstract_data_type))

A graph data structure consists of a finite (and possibly mutable)
set of vertices or nodes or points, together with a set of
unordered pairs of these vertices for an undirected graph or
a set of ordered pairs for a directed graph. These pairs are known
as edges, arcs, or lines for an undirected graph and as arrows,
directed edges, directed arcs, or directed lines for a directed graph.
The vertices may be part of the graph structure, or may be external
entities represented by integer indices or references.
[[1]](https://en.wikipedia.org/wiki/Graph_(abstract_data_type))

### Usage
The `Graph` class allows you to create nodes and edges and
visualize the resulting graph. Edges can have direction which
indicates parent-child relationship.

To construct a new graph, use *Graph()*.
```python
from abstract import Graph

graph = Graph(direction='LR')
# default direction is 'LR', other options are: 'TB', 'BT', 'RL'
```

### `add_node(...)`
The `add_node` method creates a node in the graph
and returns a *Node* object.

It takes the following arguments:
* `name`: name of the new node (should be unique); snake case is recommended
* `label` (optional): it can be any string, if it is missing the name will be displayed
* `value` (optional): can be any object
* `style` (optional): it should be a *NodeStyle* object and is only used for rendering
* `if_node_exists` (optional): what to do if a node with this name exists
and can be 'warn', 'error', or 'ignore'; default is 'warn'

Let's use the
[Rock, Paper, Scissors, Lizard, Spock](https://bigbangtheory.fandom.com/wiki/Rock,_Paper,_Scissors,_Lizard,_Spock)
game to show how `Graph` works. The following list shows the order in which
an object in the game beats the object to its right of it in the list and
gets beaten by the object left of it. Please note that there are only five
objects and they are repeated to illustrate all possible pairs.

```python
node_list = [
    'scissors', 'paper', 'rock', 'lizard', 'Spock', 'scissors',
    'lizard', 'paper', 'Spock', 'rock', 'scissors'
]
```

Now let's create `nodes` with the same names:
```python
# create a set to avoid duplicates
for node in set(node_list):
    node = graph.add_node(name=node)

graph.display(direction='TB') # left-right direction is too tall
```
![image of the graph](http://idin.ca/storage/python/abstract/images/rock_paper_scissors_lizard_spock_1.png)

**Note**: by default, Graph uses colour theme from the
[colouration](http://pypi.org/project/colouration) library for roots and uses
the directionality of edges to determine the colour of other nodes.
In the above example, without any edges, all nodes are roots.

### `connect(...)` (add an edge)
The `connect` method creates an `edge` from a `start` node to an `end` node.
The `start` and `end` arguments can be either names of nodes or the `Node` objects.

```python
for i in range(len(node_list)-1):
    edge = graph.connect(start=node_list[i], end=node_list[i + 1])
graph.display(direction='LR') # top-bottom direction is too tall
```
![image of the graph](http://idin.ca/storage/python/abstract/images/rock_paper_scissors_lizard_spock_2.png)

**Note**: nodes that form a loop are coloured differently
(red circles with yellow colour inside)

### *get_node*
To retrieve a node from the graph you can use the *get_node* method
which returns a *Node* object.
```python
rock = graph.get_node('rock')
```

### `display(...)`
The `display` method visualizes the graph and if a `path` is provided it saves it
to an image file that can be a *pdf* or *png*;
you can also provide the resolution with the `dpi` argument.
The file format is infered from
the `path` argument.

```python
# save as a png file and view the file
graph.draw(path='my_graph.png', view=True)

```

### `Graph(obj=...)`
You can create a graph from any object that has a `__graph__()` method.
Examples of such objects are:
* `Graph` class from this library
* `Pensieve` class from the [pensieve](https://pypi.org/project/pensieve/) library
* `Page` class from [internet.wikipedia](https://pypi.org/project/internet/) submodule

```python
from pensieve import Pensieve
from abstract import Graph

pensieve = Pensieve()
pensieve['two'] = 2
pensieve['three'] = 3
pensieve['four'] = lambda two: two * two
pensieve['five'] = 5
pensieve['six'] = lambda two, three: two * three
pensieve['seven'] = 7
pensieve['eight'] = lambda two, four: two * four
pensieve['nine'] = lambda three: three * three
pensieve['ten'] = lambda two, five: two * five
graph = Graph(obj=pensieve, direction='TB') # or Graph(pensieve)
graph.display()
```
![image of the graph](http://idin.ca/storage/python/abstract/images/pensieve_numbers_graph.png)

### `random(...)`
The `random` method creates a random Graph.

```python
g1 = Graph.random(num_nodes=8, connection_probability=0.4, seed=6)
g1
```
![image of the graph](http://idin.ca/storage/python/abstract/images/random_graph_1.png)

### Adding Two Graphs: `+`
You can easily add two graphs using the `+` operator.
The result will have the union of nodes and edges in both graphs.

```python
g2 = Graph.random(num_nodes=7, start_index=3, connection_probability=0.4, seed=41)
g2
```
![image of the graph](http://idin.ca/storage/python/abstract/images/random_graph_2.png)

```python
g3 = g1 + g2
g3
```
![image of the graph](http://idin.ca/storage/python/abstract/images/random_graph_1_plus_2.png)

### Finding Loops
The `node`'s `is_in_loop` method helps you find nodes that form a loop;
*i.e.*, nodes that have at least one descendant which is also an ancestor.

```python
graph_with_loop = Graph()
for letter in 'abcdef':
    graph_with_loop.add_node(letter)
for start, end in [
    ('a', 'b'), ('b', 'c'), ('c', 'a'), ('c', 'd'), ('d', 'e'), ('e', 'f'), ('f', 'e')
]:
    graph_with_loop.connect(start, end)
graph_with_loop
```
![image of the graph](http://idin.ca/storage/python/abstract/images/graph_with_loop.png)

```python
for node in graph_with_loop.nodes:
    if node.is_in_loop_with(other='a') and node.name != 'a':
        print(node.name, 'is in the same loop as a')
    elif node.is_in_loop():
        print(node.name, 'is in a loop')
    else:
        print(node.name, 'is not in a loop')
```
output:
```text
a is in a loop
b is in the same loop as a
c is in the same loop as a
d is not in a loop
e is in a loop
f is in a loop
```

## Future Features

* Create a graph from:
  * list of dictionaries
  * dataframe
* Create a new graph by filtering a graph

repository: idin/abstract

repo_name: idin/abstract


text:
# a binary to hexadecimal calculator
a  binary to hexadecimal calculator that can be called in the linux terminals; using sys.argv[]

```
> python mySimpleCalculator.py 1 + 2
> 3
```
## Author
* **William SHANG** | *Email<EMAIL_ADDRESS>

repository: william-shang/myShowcase

repo_name: william-shang/myShowcase


text:
# Skill Learning

Somehow using metronomes generally is beneficial in obtaining new skills, the mechanism is not clear but the evidence shows that we can increase plasticity by metronoming. This somehow enforces repetition, with is essential when obtaining new skills to increase skill acquisition speed.

Error is important, this is why very slow repetitions are not benficial if we make less than 30% accurate movements.

Flexibility tool - cerrebelum. Our flexibility is not mainly because hamstrings are short or muscles are short. It has to do with neural elongation of the muscles. When muscles are elongated to a certain point, then the neurons don't let the muscles stretch anymore. If you want to extend range of motion, first measure range of motion, move eyes


text:
# PageFor

## Dependencies

* gem 'kaminari'

* gem 'ransack'

* gem 'cancan'

* gem 'simple-navigation'

* gem 'polywag'

* gem 'simple_form' >= 3.1.0

## Skin Dependencies

* gem 'adminlte-rails'

## Configuration

To change the theme for your application, create an initializer that follows the following formation:

    PageFor.configure do |config|
      config.theme = 'theme-name-here'
      config.simple_form_for :theme-name-here
    end

## Once your AcitveRecord model exists and migrations have run, you can scaffold views and controllers via

    rails g page_for:scaffold ModelName

## JS

    //= require jquery
    //= require jquery_ujs
    //= require bootstrap.min
    //= require adminlte-custom
    //= require actionsheet
    //= require page_for_adminlte
    //= require numerous-2.1.1.min

## CSS

   *= require bootstrap
   *= require font-awesome
   *= require ionicons
   *= require adminlte
   *= require page_for_adminlte
   *= require action_sheet

# editable_table_for

To add a 'Remove' button to editable_table_for instances, add '- t.delete_link_if_can'.

# Troubleshooting

If you get an exception "undefined method `has_attribute?' for ...", you likely forgot to add accepts_nested_attributes_for to your model for the has_many relationships in your form.

## Change Log

* 12/27/2014 - Kaminari looks for theme in subfolder.  For example.  app/views/kaminari/adminlte/*


text:
CSS StyleGuide
==============

Welcome to the NAIT DMIT CSS Styleguide.

*This is a very early first draft, and it is based largely on the internal styleguide used at Github https://github.com/styleguide/css*

## Coding Style

* Use soft-tabs with a two or four space indent.
* Put spaces after `:` in property declarations.
* Put spaces before `{` in rule declarations.
* Use hex color codes `#000` unless using rgba.
* Use **hyphens** to separate words in class and id names, not underscores, camelCase, or other methods
* Zero values should not be given units when possible

Here is good example syntax:
```css
/* This is a good example! */
.styleguide-format {
  border: 1px solid #0f0;
  color: #000;
  background: rgba(0,0,0,0.5);
}
```

## CSS File Naming

Websites with single style sheets should have that stylesheet named `style.css`, and should be found in a directory named `stylesheets`

## Pixels vs. Ems

Use percentage value to set font size initially at the document level, use the `html {...}` tag selector. Font sizes for individual elements should then be set using em units, calculated by the browser as a multiplier of the parent element font size.

Set the line-height at the document level by using a unitless value, use the `html {...}` tag selector. This acts as a multiplier of the computed font size. Line heights for individual text elements can be set either with a unitless value (better for inheritance), or with `em` values (better for rounding accuracy).

Other values, such as elements widths, margins, padding, etc can use `em` or `px` values.

Here is an example:

```css
html {
  font-size: 100%; /* Yields a 16px font size in most browsers */
  line-height: 1.5; /* Yields a 24px line height, based on font size */
}

.container {
  width: 960px;
  margin: 0 auto;
}

h1 {
  font-size: 3em; /* Yields a 48px font size, based on setting above */
  margin: 20px 0;
}
```

## Class naming conventions

Never reference `js-` prefixed class names from CSS files. `js-` are used exclusively from JS files.

Use the `is-` prefix for state rules that are shared between CSS and JS.

## Specificity (classes vs. ids)

Heavily favour using classes over ids. Elements that occur exactly once inside a page can use ids, otherwise, use classes. When in doubt, use a class name.

* Good candidates for ids: modal popups, forms.
* Bad candidates for ids: navigation, item listings, grid structures.

When styling a component, start with an `element.class` namespace (prefer class names over ids), prefer descendant selectors by default, and use as little specificity as possible.

Here is a good example, given the following HTML:

```html
<ul class="category-list">
  <li class="item">Category 1</li>
  <li class="item">Category 2</li>
  <li class="item">Category 3</li>
</ul>
```

We could style it as such:

```css
/* element + class namespace */
ul.category-list {
  margin: 20px 0 20px 20px;
}

/* descendant selector for list items, no need to use the .item class selector in this case */
ul.category-list li {
  list-style-type: disc;
}

/* minimal specificity for all links */
ul.category-list a {
    color: #ff0000;
}
```

### CSS Specificity Guidelines

* If you must use an id selector (`#selector`) make sure that you have no more than one in your rule declaration. A rule like `#header .search #quicksearch { ... }` is considered harmful.
* When modifying an existing element for a specific use, try to use specific class names. Instead of `.listings-layout.bigger` use rules like `.listings-layout.listings-bigger`.

repository: nait-dmit/styleguides

repo_name: nait-dmit/styleguides


text:
condition
=========

Common usage patterns for Etcd to implement group join, and watch counts.
Things that can be done with the condition library:

 1. Register that someone has joined a process.
 1. Watch the join, and signal when they leave.
 1. Watch a group of joins, until some count condition is satisfied.
 1. Store and fetch wrappers for CAS, with boolean flag to indicate stale store or fetch.

### Join Example
 ```go
    j := condition.NewJoin(g.Etcd(), 30*time.Second, "registration", "path", "in", "etcd")
    j.Join()

    ... do work ...

    j.Exit()
}
```

### JoinWatch Example
```go
	w := condition.NewJoinWatch(g.Etcd(), "registration", "path", "to", "watch")
	<-w.WatchJoin()
	log.Printf("other participant has joined")

	<-w.WatchExit()
	log.Printf("other participant has exited")
```

### CountWatch Example
```go
	w := condition.NewCountWatch(g.Etcd(), "registration", "dir", "to", "watch")
	<-w.WatchUntil(10)
	log.Printf("all ten participants have joined")

	<-w.WatchUntil(0)
	log.Printf("all ten participants have exited")

	for {
		select {
			case n := <-w.WatchCount():
				log.Printf("there are %d participants registered", n)
		}
	}
```

### NameWatch Example
```go
	w := condition.NewNameWatch(g.Etcd(), "registration", "dir", "to", "watch")
	<-w.WatchUntil("producer-0", "producer-1")
	log.Printf("both producers have joined")

	r := ring.New("producer", 2, g)
	<-w.WatchUntil(r)
	log.Printf("all members of ring have joined")

	for {
		select {
			case names := <- w.WatchNames():
				log.Printf("the current participants: %v", names)
		}
	}
```

### State Example
```go
	s := condition.NewState(g.Etcd(), 30*time.Second, "path", "to", "saved", "state")
	err := s.Init(state)
	if err != nil {
		// State failed to be created.
	}

	stale, err := s.Store(state)
	if stale {
		// State failed to save because of a stale view of the state.
	}
	if err != nil {
		// State failed to save becuase of another type of error.
	}

	stale, err := s.Fetch(state)
	if stale {
		// State was read, but its Etcd index indicates that updates happened.
	}
	if err != nil {
		// State failed to read because of anther type of error.
	}

	stale, err := s.Remove()
	if stale {
		// State failed to delete because of a stale view of the state.
	}
	if err != nil {
		// State failed to delete for another type of error.
	}
```

repository: etsangsplk/grid

repo_name: etsangsplk/grid


text:
# Build: The Achilles Heel

Building software is not sexy, but it is critical!
 * Required for envisioned Python environment
  - Dozens of Python packages required + system prerequisites.
  - Must install on discover (for iPython / Jupyter).
 * Increasingly required for ModelE
   - ModelE+Ice has dozens of dependencies.
   - Serious problem for running on discover.

## Building on a Mac: MacPorts
 * Gets you the software you need
 * Can be run without Admin privileges:
   - https://github.com/citibeth/usermacports
   - But GISS needs to use it!
 * Can install many but not all Python modules
 * Builds python consistent with GCC toolchain
   - Necessary for our Python extensions.
 * **Macintosh only! :-(**

## Building on Posix: EasyBuild
 * Works on Mac and Linux
   - Build scripts are cross-platform
   - Needed for useful work between desktop Macs and discover
 * Requires some work to set up required GISS software
 * NCCS sysadmins will appreciate it?
   - Easier than building by hand.
   - Integrates with module system.
 * Spack is also an EasyBuild Alternative.

## Python Environment: Conda, PyPi
 * Better and more complete for Python stuff
 * Open question: how to combine EasyBuild + [Conda + PyPi](https://www.linkedin.com/pulse/20140107182855-25278008-using-pypi-packages-with-conda)?

repository: citibeth/gissinfra

repo_name: citibeth/gissinfra


text:
---
title: "DA3018 Computer Science for Mathematicians"
collection: "teaching"
permalink: /teaching/DA3018_Datalogi.md
type: "Undergraduate course"
venue: "Stockholm University"
date: 2021-03-15
---

The idea with the course is to prepare students for working with non-trivial
datasets. This requires programming both practical and analytical tools.

The practical part of the course presents shell commands for working
on the command line, version control systems, an introduction to Java.

The analytical part discusses datastructures, algorithms, and algorithm
analysis, in particular time and space complexity.

There are five labs to practice programming. The project that challenges students
to analyse a large graph from a biological problem. The size of the raw data is inconvenient for simple tools, forcing students to implement alternative solutions.


text:
---
title: Day-by-day
layout: page
pager: true
---

We will update this page to include links to each day activity and extra material for the students. Due to technical reasons, we are unable to live stream lectures this year. But the lectures will be avaliable as soon as possible on [YouTube](https://www.youtube.com/c/UnicampIC).
{.lead}

## World Final Class

Day      | Lecture | Contest
---------|---------|--------
Jan 20st | [Lecture](https://www.youtube.com/watch?v=Xrw0OWWKyE4) | [Contest](https://codeforces.com/group/Ohoz9kAFjS/contests)
Jan 21nd | [Lecture](https://www.youtube.com/watch?v=ZMnDVv67wug) | [Contest](https://codeforces.com/group/Ohoz9kAFjS/contests)
Jan 22rd | [Lecture](https://www.youtube.com/watch?v=Cphfv9k9uyw) | [Contest](https://codeforces.com/group/Ohoz9kAFjS/contests)
Jan 24th | [Lecture](https://www.youtube.com/watch?v=BJextQwj-Ec) | [Contest](https://codeforces.com/group/Ohoz9kAFjS/contests)
Jan 25th | [Lecture](https://www.youtube.com/watch?v=WKyZSitpm6M) | [Contest](https://codeforces.com/group/Ohoz9kAFjS/contests)
Jan 27th | [Lecture](https://www.youtube.com/watch?v=FuNrg52gayQ) | [Contest](https://codeforces.com/group/Ohoz9kAFjS/contests)
Jan 28th | [Lecture](https://www.youtube.com/watch?v=8H4mF-LUJ5c) | [Contest](https://codeforces.com/group/Ohoz9kAFjS/contests)
Jan 29th | [Lecture](https://www.youtube.com/watch?v=7Zc8xey6woA) | [Contest](https://codeforces.com/group/Ohoz9kAFjS/contests)
Jan 31th | [Lecture](https://www.youtube.com/watch?v=mQFVNhPkpnc) | [Contest](https://codeforces.com/group/Ohoz9kAFjS/contests)
Feb 1st  | [Lecture](https://www.youtube.com/watch?v=dvgNNZkyPwA) | [Contest](https://codeforces.com/group/Ohoz9kAFjS/contests)

<!-- Remote participants can subscribe at this [link](https://docs.google.com/forms/d/e/1FAIpQLSfL7jxcfCOFS3b1BxaE82qzcRHSIZtHOrwOJC-_gkRegfR_cg/viewform). -->

## Brazilian Final Class

Day      | Lecture | Contest
---------|---------|--------
Jan 20st | [Lecture](lecture-b/20200120.pdf) | [Contest](https://codeforces.com/gym/102428)
Jan 21nd | [Lecture](https://www.youtube.com/watch?v=on73WzQCmHY) | [Contest](https://vjudge.net/contest/353194)
Jan 22rd | [Lecture](https://www.youtube.com/watch?v=jfBiPMOqRY4) [pdf](lecture-b/20200122.pdf) | [Contest](https://vjudge.net/contest/353364)
Jan 24th | [Lecture](https://www.youtube.com/watch?v=LDlvL_ASEQI) [pdf](lecture-b/20200124_25.pdf) | [Contest](https://vjudge.net/contest/353598)
Jan 25th | [Lecture](https://www.youtube.com/watch?v=0Coh_kmLy0g) [pdf](lecture-b/20200124_25.pdf) | [Contest](https://vjudge.net/contest/353698)
Jan 27th | [Lecture](https://www.youtube.com/watch?v=uTOYDJ1W3TQ) | [Contest](https://codeforces.com/group/NTEJ3kWgR3/contests)
Jan 28th | [Lecture](https://www.youtube.com/watch?v=KoyW78FlXHk) | [Contest](https://codeforces.com/group/NTEJ3kWgR3/contests)
Jan 29th | [Lecture](https://www.youtube.com/watch?v=BsOFxyn3Zmc) | [Contest](https://codeforces.com/group/NTEJ3kWgR3/contests)
Jan 31th | [Lecture](https://www.youtube.com/watch?v=eLCm1gKBe3c) [pdf](lecture-b/fecho-convexo.pdf) | [Contest](https://vjudge.net/contest/354515)
Feb 1st  | [Lecture](https://www.youtube.com/watch?v=XCt04Q8wMgo) [pdf](lecture-b/linha-de-varredura.pdf) | [Contest](https://vjudge.net/contest/354794)

license: Unlicense


text:
# ng2-nvd3

Angular2 component for nvd3. It has similar technique as [angular-nvd3](http://krispo.github.io/angular-nvd3) for angular 1, but designed for angular 2 and without extra features (like extended mode) you won't need.

## Demos

Clone project and run `$ ng serve` for demo

## Install

    npm install git+https://github.com/newoceaninfosys/ng2-nvd3.git d3@^3 nvd3

it requires `angular2`, `d3` and `nvd3` as dependencies. Tested with the current `@angular` version `^4.0.0`.

## Basic usage

- See `src` for sample code
- IMPORTANT: you must include `nv.d3.css` to you app or you will get black background in the chart

## Change Log

## License
MIT


text:
# node-session-handler

Module provides a way of handling Companies House sessions.

Module offers the following artifacts:

- `Session` that reflects structure of the session including elements of Single Sign-On
- `SessionStore` that is responsible for reading and writing session data from / to database taking care of data encoding / decoding
- `SessionMiddleware` that provides easy to use express.js middleware reading session based on the request cookie

## Prerequisite

Module requires `request.cookies` map to be populated with an object keyed by the cookie names. It can be achieved by use of [cookie-parser](https://www.npmjs.com/package/cookie-parser) module.

In short run `npm install cookie-parser` command to install dependency and add the following snipped to the application to apply cookie parsing middleware:

```$typescript
import * as cookieParser from 'cookie-parser'
...
app.use(cookieParser())
```

Note: Cookie parsing must happen before request is passed to session middleware.

## How to use it

To bring this module as dependency please add the following fragment to `package.json`:

```$json
"@companieshouse/node-session-handler": "~4.1.0"
```

### Session

The session class is a wrapper around the raw session `data: ISession` (as retrieved from accounts after signing in).

To keep the `ISession` type consistent, we added an extra field called `extra_data` (`SessionKey.ExtraData`) to store any data that apps might need in the session making session itself extensible.

The class provides these methods:

- `get<T = ISessionValue>(key: SessionKey): T | undefined` - allows retrieving session data for keys defined in the `SessionKey` enum that represents all possible types than can be retrieved from the session
- `getExtraData<T>(key: string): T | undefined` - allows retrieving session data populated by the applications
- `setExtraData<T>(key: string, val: T): void` - allows amending session data used by the applications by replacing existing value (if present)
- `deleteExtraData(key: string): boolean` - deletes a key from the session data populated by an application (if exists)
- `verify = (): void` - ensures that the session is valid i.e. contains the right fields, and it's not expired

### SessionStore

Session store offers a way to load `SessionStore.load`, store `SessionStore.store` and delete `SessionStore.delete` session from database without worrying about data encoding or decoding.

All above methods take instance of `Cookie` class which holds combination of session ID and signature. Use of that argument type helps to ensure that database operations are only performed for verified session identifiers.

### SessionMiddleware

Session middleware provides convenient integration point for express.js applications. Middleware does:

1. read cookie value from request HTTP headers
2. verify cookie signature if cookie is present
3. load session from store using verified cookie if present
4. sets verified session in request scope
5. stores session in store on request end if session data changed

Express.js applications wishing to introduce session handling should register middleware in the following way:

```$javascript

const sessionStore = new SessionStore(new Redis(`redis://${process.env.CACHE_SERVER}`))
const middleware = SessionMiddleware({
    cookieName: process.env.COOKIE_NAME,
    cookieDomain: process.env.COOKIE_DOMAIN,
    cookieSecureFlag: process.env.COOKIE_SECURE_ONLY,
    cookieTimeToLiveInSeconds: process.env.DEFAULT_SESSION_EXPIRATION,
    cookieSecret: process.env.COOKIE_SECRET
}, sessionStore)

app.use(middleware)
```

Such application will then have access to session instance via `request.session` as long as `__SID` cookie is set to correct value.

There is also an option to have not authenticated sessions without sign-in info. In such cases middleware creates empty session as long as no valid session was found in the request.

To enable support for non authenticated sessions pass `true` as a last argument to the middleware factory function e.g. `SessionMiddleware(config, sessionStore, true)`.

## Development

Module requires dependencies that can be installed via `npm install` command.

### Linting and testing

Code is linted using `ts-lint` which can be run via `npm run lint` command.

Tests in turn can be run via `npm test` command.


text:
# Master list on xFLS

This folder contains the Jupyter notebooks used to create HELP mater list on
xFLS.

| Survey | Telescope / Instrument  | Filters (detection band in bold)  | Location        |
|--------|-------------------------|:---------------------------------:|-----------------|
| DataFusion  | Spitzer/IRAC       |  IRAC12                   | dmu0_DataFusion-Spitzer |
| INT-WFC | INT/WFC                | ugriz                             | dmu0_INT-WFC    |
| KPNO-FLS        |               | R                             | dmu0_KPNO-FLS        |
| PanSTARRS-3SS | PanSTARRS/GPC1   | ugriz                          | dmu0_PanSTARRS-322 |
| Legacy Survey | BASS             | grz                             | dmu0_LegacySurvey |
| UHS    | UKIRT                   | J                                 | dmu0_UHS        |

## Pristine catalogue preparations

For each pristine catalogue, a specific notebook is used for its preparation:
the selection of columns, the conversion of some magnitudes or fluxes when
needed, the removal of duplicated sources, the correction of astrometry using
Gaia as reference, and the flagging of possible Gaia objects.

- [1.1_DataFusion-Spitzer.ipynb](1.1_DataFusion-Spitzer.ipynb)
- [1.2_INT-WFC.ipynb](1.2_INT-WFC.ipynb)
- [1.3_KPNO-FLS.ipynb](1.3_KPNO-FLS.ipynb)
- [1.4_PanSTARRS-3SS.ipynb](1.4_PanSTARRS-3SS.ipynb)
- [1.5_LegacySurvey.ipynb](1.5_LegacySurvey.ipynb)
- [1.6_UHS.ipynb](1.6_UHS.ipynb)

## Catalogue merging

The [2_Merging.ipynb](2_Merging.ipynb) notebook performs the merging of the
pristine catalogues into the master list.

## Diagnostics

The [3_Checks_and_diagnostics.ipynb](3_Checks_and_diagnostics.ipynb) notebook
presents some checks and diagnostic plots on the final master list.


text:
# Amour
Amour is a dating app for the Santa Clara University Students and Faculties

Goal: Amour provides users with a safe and verified environment for dating

Intended Users: University staff and students (with valid .edu email address)

The application

aims to create an authentic and friendly environment for everyone to date

has chatting functionality to help the person know each other

filters the suggestion according to user preference

uses real time database to maintain user's information in real-time

Modules

User Authentication (Login & Registration)

Email Verification

Card swipe for matching

Chat Messaging

View and Edit Profile

repository: ayushi-rathod/Amour

repo_name: ayushi-rathod/Amour


text:
#  Nim

[![Build Status](https://dev.azure.com/nim-lang/Nim/_apis/build/status/nim-lang.Nim?branchName=devel)](https://dev.azure.com/nim-lang/Nim/_build/latest?definitionId=1&branchName=devel)

This repository contains the Nim compiler, Nim's stdlib, tools, and documentation.
For more information about Nim, including downloads and documentation for
the latest release, check out [Nim's website][nim-site] or [bleeding edge docs](https://nim-lang.github.io/Nim/).

## Community

[![Join the IRC chat][badge-nim-irc]][nim-irc]
[![Join the Discord server][badge-nim-discord]][nim-discord]
[![Join the Gitter chat][badge-nim-gitter]][nim-gitter]
[![Join the Matrix room](https://img.shields.io/matrix/nim-lang:matrix.org?color=blue&style=flat&logo=matrix)](https://matrix.to/#/#nim-lang:matrix.org)
[![Get help][badge-nim-forum-gethelp]][nim-forum]
[![View Nim posts on Stack Overflow][badge-nim-stackoverflow]][nim-stackoverflow-newest]
[![Follow @nim_lang on Twitter][badge-nim-twitter]][nim-twitter]

* The [forum][nim-forum] - the best place to ask questions and to discuss Nim.
* [#nim IRC Channel (Libera Chat)][nim-irc] - a place to discuss Nim in real-time.
  Also where most development decisions get made.
* [Discord][nim-discord] - an additional place to discuss Nim in real-time. Most
  channels there are bridged to IRC.
* [Gitter][nim-gitter] - an additional place to discuss Nim in real-time. There
  is a bridge between Gitter and the IRC channel.
* [Matrix][nim-matrix] - the main room to discuss Nim in real-time. [Matrix space][nim-matrix-space] contains a list of rooms, most of them are bridged to IRC.
* [Telegram][nim-telegram] - an additional place to discuss Nim in real-time. There
  is the official Telegram channel. Not bridged to IRC.
* [Stack Overflow][nim-stackoverflow] - a popular Q/A site for programming related
  topics that includes posts about Nim.
* [GitHub Wiki][nim-wiki] - Misc user-contributed content.

## Compiling

The compiler currently officially supports the following platform and
architecture combinations:

  * Windows (Windows XP or greater) - x86 and x86_64
  * Linux (most, if not all, distributions) - x86, x86_64, ppc64 and armv6l
  * Mac OS X (10.04 or greater) - x86, x86_64, ppc64 and Apple Silicon (based on the ARM64 architecture)

More platforms are supported, however, they are not tested regularly and they
may not be as stable as the above-listed platforms.

Compiling the Nim compiler is quite straightforward if you follow these steps:

First, the C source of an older version of the Nim compiler is needed to
bootstrap the latest version because the Nim compiler itself is written in the
Nim programming language. Those C sources are available within the
[``nim-lang/csources_v2``][csources-v2-repo] repository.

Next, to build from source you will need:

  * A C compiler such as ``gcc`` 5.x/later or an alternative such as ``clang``,
    ``Visual C++`` or ``Intel C++``. It is recommended to use ``gcc`` 5.x or
    later.
  * Either ``git`` or ``wget`` to download the needed source repositories.
  * The ``build-essential`` package when using ``gcc`` on Ubuntu (and likely
    other distros as well).
  * On Windows MinGW 4.3.0 (GCC 8.10) is the minimum recommended compiler.
  * Nim hosts a known working MinGW distribution:
    * [MinGW32.7z](https://nim-lang.org/download/mingw32.7z)
    * [MinGW64.7z](https://nim-lang.org/download/mingw64.7z)

**Windows Note: Cygwin and similar POSIX runtime environments are not supported.**

Then, if you are on a \*nix system or Windows, the following steps should compile
Nim from source using ``gcc``, ``git``, and the ``koch`` build tool.

**Note: The following commands are for the development version of the compiler.**
For most users, installing the latest stable version is enough. Check out
the installation instructions on the website to do so: https://nim-lang.org/install.html.

For package maintainers: see [packaging guidelines](https://nim-lang.github.io/Nim/packaging.html).

First, get Nim from GitHub:

```
git clone https://github.com/nim-lang/Nim.git
cd Nim
```

Next, run the appropriate build shell script for your platform:

* `build_all.sh` (Linux, Mac)
* `build_all.bat` (Windows)

Finally, once you have finished the build steps (on Windows, Mac, or Linux) you
should add the ``bin`` directory to your PATH.

See also [bootstrapping the compiler](https://nim-lang.github.io/Nim/intern.html#bootstrapping-the-compiler).

See also [reproducible builds](https://nim-lang.github.io/Nim/intern.html#bootstrapping-the-compiler-reproducible-builds).

## Koch

``koch`` is the build tool used to build various parts of Nim and to generate
documentation and the website, among other things. The ``koch`` tool can also
be used to run the Nim test suite.

Assuming that you added Nim's ``bin`` directory to your PATH, you may execute
the tests using ``./koch tests``. The tests take a while to run, but you
can run a subset of tests by specifying a category (for example
``./koch tests cat async``).

For more information on the ``koch`` build tool please see the documentation
within the [doc/koch.md](https://nim-lang.github.io/Nim/koch.html) file.

## Nimble

``nimble`` is Nim's package manager. To learn more about it, see the
[``nim-lang/nimble``][nimble-repo] repository.

## Contributors

This project exists thanks to all the people who contribute.

## Contributing

[![Backers on Open Collective](https://opencollective.com/nim/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/nim/sponsors/badge.svg)](#sponsors)
[![Setup a bounty via Bountysource][badge-nim-bountysource]][nim-bountysource]
[![Donate Bitcoins][badge-nim-bitcoin]][nim-bitcoin]
[![Open Source Helpers](https://www.codetriage.com/nim-lang/nim/badges/users.svg)](https://www.codetriage.com/nim-lang/nim)

See [detailed contributing guidelines](https://nim-lang.github.io/Nim/contributing.html).
We welcome all contributions to Nim regardless of how small or large
they are. Everything from spelling fixes to new modules to be included in the
standard library are welcomed and appreciated. Before you start contributing,
you should familiarize yourself with the following repository structure:

* ``bin/``, ``build/`` - these directories are empty, but are used when Nim is built.
* ``compiler/`` - the compiler source code. Also includes plugins within ``compiler/plugins``.
* ``nimsuggest`` - the nimsuggest tool that previously lived in the [``nim-lang/nimsuggest``][nimsuggest-repo] repository.
* ``config/`` - the configuration for the compiler and documentation generator.
* ``doc/`` - the documentation files in reStructuredText format.
* ``lib/`` - the standard library, including:
    * ``pure/`` - modules in the standard library written in pure Nim.
    * ``impure/`` - modules in the standard library written in pure Nim with
    dependencies written in other languages.
    * ``wrappers/`` - modules that wrap dependencies written in other languages.
* ``tests/`` - contains categorized tests for the compiler and standard library.
* ``tools/`` - the tools including ``niminst`` (mostly invoked via
  ``koch``).
* ``koch.nim`` - the tool used to bootstrap Nim, generate C sources, build the website,
  and generate the documentation.

If you are not familiar with making a pull request using GitHub and/or git, please
read [this guide][pull-request-instructions].

Ideally, you should make sure that all tests pass before submitting a pull request.
However, if you are short on time, you can just run the tests specific to your
changes by only running the corresponding categories of tests. CI verifies
that all tests pass before allowing the pull request to be accepted, so only
running specific tests should be harmless.
Integration tests should go in ``tests/untestable``.

If you're looking for ways to contribute, please look at our [issue tracker][nim-issues].
There are always plenty of issues labeled [``Easy``][nim-issues-easy]; these should
be a good starting point for an initial contribution to Nim.

You can also help with the development of Nim by making donations. Donations can be
made using:

* [Open Collective](https://opencollective.com/nim)
* [Bountysource][nim-bountysource]
* [Bitcoin][nim-bitcoin]

If you have any questions feel free to submit a question on the
[Nim forum][nim-forum], or via IRC on [the \#nim channel][nim-irc].

## Backers

Thank you to all our backers! [[Become a backer](https://opencollective.com/Nim#backer)]

## Sponsors

Support this project by becoming a sponsor.  [[Become a sponsor](https://opencollective.com/Nim#sponsor)]

You can also see a list of all our sponsors/backers from various payment services on the [sponsors page](https://nim-lang.org/sponsors.html) of our website.

## License
The compiler and the standard library are licensed under the MIT license, except
for some modules which explicitly state otherwise. As a result, you may use any
compatible license (essentially any license) for your own programs developed with
Nim. You are explicitly permitted to develop commercial applications using Nim.

Please read the [copying.txt](copying.txt) file for more details.

Copyright © 2006-2023 Andreas Rumpf, all rights reserved.

[nim-site]: https://nim-lang.org
[nim-forum]: https://forum.nim-lang.org
[nim-issues]: https://github.com/nim-lang/Nim/issues
[nim-issues-easy]: https://github.com/nim-lang/Nim/labels/Easy
[nim-irc]: https://web.libera.chat/#nim
[nim-twitter]: https://twitter.com/nim_lang
[nim-stackoverflow]: https://stackoverflow.com/questions/tagged/nim-lang
[nim-stackoverflow-newest]: https://stackoverflow.com/questions/tagged/nim-lang?sort=newest&pageSize=15
[nim-discord]: https://discord.gg/nim
[nim-gitter]: https://gitter.im/nim-lang/Nim
[nim-matrix]: https://matrix.to/#/#nim-lang:matrix.org
[nim-matrix-space]: https://matrix.to/#/#nim:envs.net
[nim-telegram]: https://t.me/nim_lang
[nim-bountysource]: https://www.bountysource.com/teams/nim
[nim-bitcoin]: https://blockchain.info/address/1BXfuKM2uvoD6mbx4g5xM3eQhLzkCK77tJ
[nimble-repo]: https://github.com/nim-lang/nimble
[nimsuggest-repo]: https://github.com/nim-lang/nimsuggest
[csources-repo-deprecated]: https://github.com/nim-lang/csources
[csources-v2-repo]: https://github.com/nim-lang/csources_v2
[badge-nim-irc]: https://img.shields.io/badge/chat-on_irc-blue.svg?style=flat-square
[badge-nim-discord]: https://img.shields.io/discord/371759389889003530?color=blue&label=discord&logo=discord&logoColor=gold&style=flat-square
[badge-nim-gitter]: https://img.shields.io/badge/chat-on_gitter-blue.svg?style=flat-square
[badge-nim-forum-gethelp]: https://img.shields.io/badge/Forum-get%20help-4eb899.svg?style=flat-square
[badge-nim-twitter]: https://img.shields.io/twitter/follow/nim_lang.svg?style=social
[badge-nim-stackoverflow]: https://img.shields.io/badge/stackoverflow-nim_tag-yellow.svg?style=flat-square
[badge-nim-bountysource]: https://img.shields.io/bountysource/team/nim/activity.svg?style=flat-square
[badge-nim-bitcoin]: https://img.shields.io/badge/bitcoin-1BXfuKM2uvoD6mbx4g5xM3eQhLzkCK77tJ-D69134.svg?style=flat-square
[pull-request-instructions]: https://help.github.com/articles/using-pull-requests/
[nim-wiki]: https://github.com/nim-lang/Nim/wiki

repository: nim-lang/Nim

branch_name: refs/heads/devel

gha_language: Nim

repo_name: nim-lang/Nim


text:
Trap Sink
================

* [Configuration](#configuration)
* [General Usage](#general-usage)

The Trap Sink acts as a server to receive SNMP (v1, v2, v3) traps from hosts. Received traps are passed to a user defined
listener object that then processes it.

**Note**: The trap sink currently does not support SNMPv3 inform requests. However, SNMPv2 inform requests are supported.

## Configuration

* [General Options](#general-options)
    * [ip](#ip)
    * [port](#port)
    * [version](#version)
    * [community](#community)
    * [whitelist](#whitelist)
    * [timeout_connect](#timeout_connect)

------------------
#### ip

The IP address for the trap sink to bind to.

**Default**: `<IP_ADDRESS>`

------------------
#### port

The port to listen for traps on.

**Default**: `162`

------------------
#### version

Only accept traps using this SNMP version.

**Default**: `(null)`

------------------
#### community

Only accept traps from this SNMP community.

**Default**: `(null)`

------------------
#### whitelist

An array of IP addresses permitted to send traps to this trap sink. If a trap is received from an IP address that is not
on the whitelist then it will be ignored. Defined like: `['<IP_ADDRESS>', '<IP_ADDRESS>']`

If you define this, then the `accept()` method of the listener is never called.

**Default**: `(null)`

------------------
#### timeout_connect

When sending an inform request, this is the timeout period (in seconds) when connecting to the SNMP host for the response.

**Default**: `5`

## General Usage

To use the trap sink you must define a listener class. The listener class must implement the TrapListenerInteface, which
defines what methods you must define on your trap listener when using the trap sink.

The methods you must define on the listener are as follows:

```php
# FreeDSx\Snmp\Trap\TrapListenerInterface

/**
 * Whether or not the host should be accepted. Return true to allow the trap, return false to deny it.
 *
 * @param string $ip
 * @return bool
 */
public function accept(string $ip) : bool;

/**
 * Given an engineId, get the USM user information associated with it. This information is used to potentially
 * authenticate and/or decrypt an incoming SNMP v3 trap using the USM security model.
 *
 * To ignore a request by a specific engine ID and user, return null.
 *
 * @param EngineId $engineId
 * @param string $user
 * @return UsmUser
 */
public function getUsmUser(EngineId $engineId, string $ip, string $user) : ?UsmUser;

/**
 * Handle a received trap.
 *
 * @param TrapContext $context
 */
public function receive(TrapContext $context) : void;
```

So first create your own class implementing the above interface to pass to the trap sink, such as:

```php
use FreeDSx\Snmp\Trap\TrapListenerInterface;
use FreeDSx\Snmp\Message\EngineId;
use FreeDSx\Snmp\Module\SecurityModel\Usm\UsmUser;

class TrapListener implements TrapListenerInterface
{
    /**
     * @var array
     */
    protected $users = [];

    public function __construct()
    {
        $user1 = UsmUser::withPrivacy('user1', 'auth-password123', 'sha512', 'priv-password123','aes128');

        $this->users[EngineId::fromText('foobar123')->toBinary()]['user1'] = $user1;
    }

    /**
     * {@inheritdoc}
     */
    public function accept(string $ip) : bool
    {
        # Implement any logic here for IP addresses you want to accept / decline...
        return true;
    }

    /**
     * {@inheritdoc}
     */
    public function getUsmUser(EngineId $engineId, string $ipAddress, string $user) : ?UsmUser
    {
        # Assuming we have an array populated with the engine and users associated with it...
        if (isset($this->users[$engineId->toBinary()]) && isset($this->>users[$engineId->toBinary()][$user])) {
            return $this->users[$engineId->toBinary()][$user];
        }

        return null;
    }

    /**
     * {@inheritdoc}
     */
    public function receive(TrapContext $context) : void
    {
        # The full SNMP message
        $message = $context->getMessage();
        # The IP address the trap came from
        $ipAddress = $context->getIpAddress();
        # The trap request object only
        $trap = $context->getTrap();
        # The SNMP version that was used
        $version = $context->getVersion();
    }
}
```

Then pass it to the trap sink when constructing it:

```php
use FreeDSx\Snmp\TrapSink;

$listener = new TrapListener();
$trapSink = new TrapSink($listener);
$trapSink->listen();
```

repository: FreeDSx/SNMP

gha_language: PHP

repo_name: FreeDSx/SNMP


text:
# Factory Application

#### An application using a many-to-many relationship to track a factory's engineers and machines

#### By **Laurie Waller**

## Technologies Used

* C#
* ASP.NET Core MVC
* ASP.NET Razor
* Entity Framework Core
* .NET 5.0
* MySQL
* MySQL Workbench
* CSS
* HTML5

## Description
This application implements a many-to-many relationship and enables the user to track machines and engineers at a factory. Users can:
* Add new machine profiles and engineer profiles
* View details for each machine or engineer
* View a list of all machines or all engineers
* Search for engineers or machines
* Delete or update each machine or engineer
* Add, view, and delete machines connected with each engineer
* Add, view, and delete engineers connected with each machine

## Database Structure

![image](https://user-images.githubusercontent.com/57472714/120923419-4b396480-c683-11eb-8677-bb1ddea639b7.png)

## Prerequisites
* [.Net Framework](https://dotnet.microsoft.com/download/dotnet/thank-you/sdk-2.2.106-macos-x64-installer)
* [MySQL](https://dev.mysql.com/downloads/file/?id=484914)
* [MySQL WorkBench](https://dev.mysql.com/downloads/file/?id=484391)
* dotnet script
  `dotnet tool install -g dotnet-script`
* Entity Framework Core
  `dotnet add package Microsoft.EntityFrameworkCore -v 5.0.0`
  `dotnet add package Pomelo.EntityFrameworkCore.MySql -v 5.0.0-alpha.2`

## Setup/Installation Requirements

  1. Go to the main page of the repository (https://github.com/lauriewaller/Factory.Solution).
  2. In the top righthand corner of the list of files, click the Code dropdown menu.
  3. Click on the clipboard icon to copy the URL to the GitHub repo.
  4. On your computer, open Terminal and navigate to the folder where you plan to clone the repo folder.
  5. Type in `git clone` and then paste the URL you copied: `git clone https://github.com/lauriewaller/Factory.Solution`. Press Enter.
  6. To open your files in [Visual Studio Code](https://code.visualstudio.com/),
  navigate to Factory.Solution in Terminal, type `code .`, and press Enter. This will open the application files in VS Code.
  7. In the Factory directory, create the file `appsettings.json`. Add the following code and save the file:

    {
      "ConnectionStrings": {
        "DefaultConnection": "Server=localhost;Port=3306;database=laurie_waller;uid={INSERT_USERNAME};pwd={INSERT_PASSWORD};"
      }
    }
  8. Still in the Factory directory, type in `dotnet restore` and `dotnet build` to restore dependencies and compile code.
  9. To update the existing migration in your database, run the following commands in the Factory directory:

  * `dotnet tool install --global dotnet-ef`
  * `dotnet ef database update` (applies the migration for you in Workbench)

  10. In the Factory directory, type in `dotnet run` to run the program.

## Known Bugs

* No known errors

## License

MIT

Copyright (c) 2021 by Laurie Waller

## Contact Information

_Laurie Waller (lauriewaller7@gmail.com)_


text:
# Realworld with Next.js

This project use [Realword API](https://github.com/gothinkster/realworld) and [Next.js](https://nextjs.org/).

## Realworld API

Realworld API is `The mother of all demo apps` they said.

## Next.js

Next.js is React Framework. If you need SSR(Server Side Rendering), Next.js is so easy to set SSR.

### PROS

Next.js has some PROS.

1. Provide Server Side Rendering(SSR) by default.

2. Automatic code spliting.

3. Easy client routing.

   - Next.js has `link/next`

4. Support Hot Module Replacement.

5. Use Next.js with node.js.

6. Cutomizable Babel and Webpack.

## Dependencies

- `next`: React with Server Side Rendering.

- `react, react-dom`

- `styled-components`

  - `babel-plugin-styled-components`: Support styled-components with Nextjs.

  - and create .babelrc in root path.

    ```
    {
      "presets": ["next/babel"],
      "plugins": [["styled-components", { "ssr": true }]]
    }

    ```

  - ref: https://github.com/zeit/next.js/tree/master/examples/with-styled-components

- `eslint`

  - `eslint-config-airbnb`

  - `eslint-plugin-babel, eslint-plugin-import, eslint-plugin-jsx-a11y, eslint-plugin-react`

## Script

```
scripts: {
  "dev": "next",
  "build": "next build",
  "start": "next start"
}
```

## Description

### How to use Styled-components

ref: https://github.com/zeit/next.js/tree/canary/examples/with-styled-components

```
  npm install styled-components
```

Note🚨

Create \_app.js and \_document.js files to use styled-components with SSR.

### How to use Css with Next.js

ref: https://github.com/zeit/next-plugins/tree/master/packages/next-css

```
  npm install --save @zeit/next-css
```

Note🚨

Css files cannot be import `_documnet.js`.

### How to use Redux with redux-saga

ref: https://github.com/zeit/next.js/tree/canary/examples/with-redux-saga

```
  npm install redux redux-saga react-redux next-redux-saga next-redux-wrapper redux-devtools-extension
```

# License

MIT

repository: jonggyun/realworld-nextjs

repo_name: jonggyun/realworld-nextjs