text:
# Generator-Back

[![Build Status](https://secure.travis-ci.org/timbergus/generator-back.png?branch=master)](https://travis-ci.org/timbergus/generator-back)
[![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/)
[![Stories in Ready](https://badge.waffle.io/timbergus/generator-back.svg?label=ready&title=Ready)](http://waffle.io/timbergus/generator-back)
[![Dependency Status](https://david-dm.org/timbergus/generator-back.svg)](https://david-dm.org/timbergus/generator-back)

> Backend generator for [Yeoman](http://yeoman.io) with [Hapi.js](http://hapijs.com/) and other cool stuff :)

## Getting Started

To start using this generator you need to clone or download it, and link it into the node modules folder of your system. To do this, you need to execute this command into the __generator-back__ project folder:

```
npm link
```

## Creating our API

After linking the generator, we need to create the project folder for our new REST API, and execute inside this new folder:

```
yo back
```

There are a few configuration questions and then a npm package installation. After this, the API is ready to be used. Just launch a local MongoDB server, Redis server and our new app (I assume you have installed [MongoDB](http://www.mongodb.org/) and [Redis](http://redis.io/)):

```
mongod
redis-server
nodemon server.js
```

## Testing our API

To test our API y use Postman. It's easy, it's cool and it's free. Good for me. The steps you can follow are:

### 1. Register into the system

To create a new user, you need to do a POST with an object with the following data:

###### POST

```
http://localhost:5000/signup
```

###### Content

```
{
    "name": "My Name",
    "surname": "My Surname",
    "username": "my_username",
    "email"<EMAIL_ADDRESS>    "password": "123456",
}
```

### 2. Login with your new user

To login to the system, you need to use a GET with the username and password in the query of the call:

###### GET

```
http://localhost:5000/login?username=my_username&password=123456
```

What you get in response is an object with a token. This is your session token and you need it for every protected communication with the server. The password is only send to the server in the login, and you can also hash it using a md5 to even keep it in the server (I try never to store password in the server, just in case).

###### Response

```
{
    "token": <token value>
}
```

### 3. Check all the user in the database

Because we are going to make a lot of secured calls, we are going to use the request header to store the username and the token. The token is the one returned by the login, so use it here.

###### GET

```
http://localhost:5000/users
```

###### Headers

__username__ -> my_username

__token__ -> `<token value>`

### 4. Add a new user

Be careful because we just add the user but here we don't check if the username already exists. We just do that in the register.

###### POST

```
http://localhost:5000/users
```

###### Headers

__username__ -> my_username

__token__ -> `<token value>`

###### Content

```
{
    "name": "Your Name",
    "surname": "Your Surname",
    "username": "your_username",
    "email"<EMAIL_ADDRESS>    "password": "123456",
}
```

### 5. Get the new user

The same as get all the user but passing the user `username`. This is because the parameter we pass on the query call is optional (`{username?}`), so we decide what we return whether if exists or not.

###### GET

```
http://localhost:5000/users/your_username
```

###### Headers

__username__ -> my_username

__token__ -> `<token value>`

### 6. Edit the new user

Just change the data in the new user.

###### PUT

```
http://localhost:5000/users/your_username
```

###### Headers

__username__ -> my_username

__token__ -> `<token value>`

###### Content

```
{
    "name": "His Name",
    "surname": "His Surname",
    "username": "your_username",
    "email"<EMAIL_ADDRESS>    "password": "12345678",
}
```

### 6. Delete the new user

And finally get rid of him.

###### DELETE

```
http://localhost:5000/users/your_username
```

###### Headers

__username__ -> my_username

__token__ -> `<token value>`

## The Modules Used

The modules we have used here are the following:

* [hapi](http://hapijs.com/) : This is the wonderful tool to create the REST routing.
* [good](https://github.com/hapijs/good) : This is a logger tool to see the server log in the terminal.
* [joi](https://github.com/hapijs/joi) : A tool to verify the fields passed to the route.
* [bcrypt](https://www.npmjs.org/package/bcrypt) : To make the encryption to store the password in the database and to check it when login.
* [mongoose](http://mongoosejs.com/) : Our ODM for MongoDB.
* [redis](https://github.com/mranney/node_redis) : The Redis connection for Node.js.
* [hiredis](https://github.com/mranney/node_redis) : The Redis tools.

## Websocket API

When we launch the test client `siotest.js` that use `socket.io-client`, we create a new websocket with the server and to test it we just need to use two services that emit two messages to the client that responds and match two listeners in the server:

* http://localhost:5000/ping
* http://localhost:5000/pang

Just launch the server and the test client, and use the explorer to visit the two addresses.

## GRUNT Work-flow

> Under construction...

## License

MIT

Hope you find it useful :)

repository: timbergus/generator-back

repo_name: timbergus/generator-back


text:
# Ansible Inventory

The [inventory](../../../inventory) file stores an information about hosts, managed by **CIKit**.

To specify a new host you have to use the following lines:

```ini
host-name ansible_host=cikit01.example.com ansible_user=root ansible_port=2201
```

- `host-name` is a human-readable name which you have to use in `--limit` parameter for `cikit` utility.
- `cikit01.example.com` - hostname you want to provision (could be IP, but will [complicate your life](../../matrix/domain)).
- `ansible_user` - username for accessing the host via SSH.
- `ansible_port` - number of port for accessing the host via SSH.

The next SSH command illustrates an example above:

```shell
ssh -p2201<EMAIL_ADDRESS>```

*Assumed that you have an access to the host via key pair.*

All other SSH-related variables can be found here: http://docs.ansible.com/ansible/intro_inventory.html#list-of-behavioral-inventory-parameters

repository: spheresh/cikit

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: spheresh/cikit


text:
# Limitations and known issues

* The library is spec compliant with one limitation. In case of power loss the following is not honored:

> Must be kept in memory:
* All messages in a QoS 1 or 2 flow, which are not confirmed by the broker
* All received QoS 2 messages, which are not yet confirmed to the broker

This means retransmission is not honored in case of a power failure. This behaviour is like explained in point 4.1.1 of the MQTT specification v3.1.1

* You cannot send payload larger that what can fit on RAM.

## SSL limitations

* SSL requires the build flag -DASYNC_TCP_SSL_ENABLED=1
* SSL only supports fingerprints for server validation.
* If you do not specify one or more acceptable server fingerprints, the SSL connection will be vulnerable to man-in-the-middle attacks.
* Some server certificate signature algorithms do not work. SHA1, SHA224, SHA256, and MD5 are working. SHA384, and SHA512 will cause a crash.
* TLS1.2 is not supported.

license: MIT

repository: marvinroger/async-mqtt-client

branch_name: refs/heads/develop

gha_license_id: MIT

repo_name: marvinroger/async-mqtt-client


text:
# qsim: A discrete-event simulator for queuing systems

## Requirements
- Python 3.4+
- scipy
- numpy

The simulator uses multiprocessing to speed up the simulation, however that means it requires a considerable amount of memory. Modify the `MULTIPROCESSING_CPUS` accordingly.

## Usage
```
    simulator.py [-h] {optimal_cores,tail} [--datapoints DATAPOINTS] [--iterations ITERATIONS]
               [--cpus CPUS] [--max-cpus MAX_CPUS] [--interval INTERVAL]
               [--utilization UTILIZATION] [--sla SLA] [--discipline {fifo|sjf}]
               [--service_time [SERVICE_TIME_DISTRIBUTION [Dist args ...]]]
               [--interarrival_time [INTERARRIVAL_TIME_DISTRIBUTION [Dist args ...]]]
               [--quanta PS_QUANTA_US] [--warmup WARMUP_MS] [--dump DUMPFILE]
               [--rps MRPS] [--mean-service-time MST]

        Supported distributions are:
            constant <val>
            exponential <scale>
            normal <mean> <stddev>
            lognormal <mean> <stddev>
            gpareto <scale> <c>
            uniform <a> <b>
            bimodal <mean1> <percent1> <mean2> <percent2>
            All distribution parameters should be in microseconds

        Supported disciplines:
            fifo
            sjf
            ps
            psjf
            nwc (Non-work-conserving scheduler)
    ----------------------------------------------------------------

    positional arguments:
  {optimal_cores,tail}  Number of rate points to simulate, default=10

optional arguments:
  -h, --help            show this help message and exit
  --datapoints DATAPOINTS
                        Number of rate points to simulate, default=10
  --iterations ITERATIONS
                        Number of simulation iterations, default=1
  --cpus CPUS           Starting number of CPUs to simulate, default=10
  --max-cpus MAX_CPUS   Maximum number of CPUs to simulate, default=16
  --interval INTERVAL   Length of simulation interval in seconds, default=1s
  --utilization UTIL    Number of processor to fully utilize, default=8
  --sla SLA             Service Level Objective for p999 latency, default=200us
  --quanta QUANTA       Processor-sharing/PSJF time quanta in microseconds, default=5us
  --warmup WARMUP       The latency results for this duration will be ignored at the start of the experiments, default=10ms
  --rps RPS             Used in optimal core mode to find the optimal number of core for that given rps, default=0MRPS
  --mean-service-time   MEAN_SERVICE_TIME
                        Mean service time is used to automatically determine the max load the system can tolerate, default=10us
  --dump DUMP           You can specify a file for the simulator to dump all the request latencies
  --discipline DISC     Queuing discipline, default=fifo
  --service_time        SERVICE_TIME_DISTRIBUTION [parameters ...]
  --interarrival_time   INTERARRIVAL_TIME_DISTRIBUTION [parameters ...]
```
The only positional argument is `mode`. Select between `optimal_cores,tail`. The `tail` mode reports the latency percentiles for the given rates. The `optimal_cores` mode tries to find the optimal number of servers (cores) for a given rate and SLA combination.

## Example
`$ python3 main.py tail --interarrival_time exponential 200  --service_time exponential 10 --utilization 16 --discipline sjf --max-cpus 16 --datapoints 30 --cpus 16 --mean-service-time 10`

Simulates a queuing system with 16 servers, single queue with SJF scheduling the arrivals are exponentially distributed with lambda of 200us and service times have a lambda of 10us. The simulation will try 30 different rates from near zero to the point where system utilization becomes 1. You must specify the mean service time parameter explicitly to allow the proper definitions of data points for interarrival times.

The result will be something like this:

```
Util, Requests/s, avg, p50, p90, p95, p99, p999, Cores
0.53, 53333.33, 10.02, 7.00,23.09,29.93,45.78,67.47, 0.0
1.07, 106666.67, 10.00, 6.91,23.03,29.94,46.07,69.44, 0.0
1.60, 160000.00, 9.97, 6.91,22.90,29.83,45.66,69.54, 0.0
2.13, 213333.33, 10.00, 6.94,22.91,29.91,45.77,68.90, 0.0
2.67, 266666.67, 10.00, 6.93,23.06,29.95,46.00,68.99, 0.0
3.20, 320000.00, 9.98, 6.92,22.96,29.88,46.21,69.59, 0.0
3.73, 373333.33, 9.99, 6.92,22.99,29.94,46.05,69.15, 0.0
4.27, 426666.67, 9.99, 6.93,22.99,29.88,45.94,69.12, 0.0
4.80, 480000.00, 9.99, 6.92,23.05,29.94,46.03,68.45, 0.0
5.33, 533333.33, 10.01, 6.94,23.03,29.91,46.05,69.32, 0.0
5.87, 586666.67, 10.00, 6.92,23.06,29.92,46.00,68.59, 0.0
6.40, 640000.00, 10.00, 6.94,23.03,29.89,46.10,68.71, 0.0
6.93, 693333.33, 10.00, 6.94,22.99,29.94,46.12,69.68, 0.0
7.47, 746666.67, 10.00, 6.94,23.00,29.89,46.00,69.13, 0.0
8.00, 800000.00, 10.00, 6.94,23.02,29.92,45.95,69.24, 0.0
8.53, 853333.33, 10.02, 6.95,23.02,29.98,46.12,68.86, 0.0
9.07, 906666.67, 10.02, 6.95,23.04,30.02,46.31,69.35, 0.0
9.60, 960000.00, 10.05, 6.98,23.13,30.09,46.17,69.16, 0.0
10.13, 1013333.33, 10.09, 6.98,23.23,30.27,46.63,69.86, 0.0
10.67, 1066666.67, 10.16, 7.03,23.37,30.41,46.78,69.91, 0.0
11.20, 1120000.00, 10.21, 7.08,23.45,30.52,46.98,71.08, 0.0
11.73, 1173333.33, 10.28, 7.12,23.62,30.81,47.37,71.86, 0.0
12.27, 1226666.67, 10.40, 7.18,23.85,31.19,48.33,73.16, 0.0
12.80, 1280000.00, 10.60, 7.28,24.30,31.86,49.83,78.68, 0.0
13.33, 1333333.33, 10.83, 7.38,24.76,32.59,52.04,84.65, 0.0
13.87, 1386666.67, 11.16, 7.49,25.42,33.74,55.22,98.30, 0.0
14.40, 1440000.00, 11.68, 7.65,26.36,35.49,61.05,125.16, 0.0
14.93, 1493333.33, 12.62, 7.85,27.90,38.54,72.79,190.18, 0.0
15.47, 1546666.67, 14.76, 8.09,30.33,43.83,101.35,437.06, 0.0
16.00, 1600000.00, 197.97, 8.48,35.61,57.21,231.96,12421.20, 0.0
```

## Author
Erfan Sharafzadeh (e.[last<EMAIL_ADDRESS>

gha_language: Python


text:
# Flood Detection Challenge

This repository contains code for our submission to the [ETCI 2021 Competition on Flood Detection](https://competitions.codalab.org/competitions/30440) (Winning
Solution #2).

Accompanying paper: [Flood Segmentation on Sentinel-1 SAR Imagery with Semi-Supervised Learning](http://arxiv.org/abs/2107.08369).

by Sayak Paul\*, Siddha Ganju\*.

(\*) equal contribution.

## Team

* [Siddha Ganju](http://sidgan.github.io/siddhaganju)
* [Sayak Paul](https://sayak.dev)

## Executing the code

We executed the scripts and notebooks on a [Vertex AI](https://cloud.google.com/vertex-ai) Notebook instance. The instance has four
Tesla V100 GPUs and its base configuration is [`n1-standard-16`](https://cloud.google.com/compute/docs/machine-types).

We use Python 3.8 and PyTorch 1.9. Apart from the requirements specified in `requirements.txt` you'd need to install the following
as well to run the scripts and notebooks:

```shell
$ pip install git+https://github.com/qubvel/segmentation_models.pytorch
$ pip install git+https://github.com/lucasb-eyer/pydensecrf.git
```

Our scripts and notebooks make use of mixed-precision training (via [`torch.cuda.amp`](https://pytorch.org/docs/stable/notes/amp_examples.html)) and distributed training (via [`torch.nn.parallelDistributedDataParallel`](https://pytorch.org/docs/stable/generated/torch.nn.parallel.DistributedDataParallel.html)). With this combination we are able to achieve significant boosts in the overall model training time.

**Execution instructions for the scripts (`src`) and notebooks (`notebooks`) are provided in their respective directories.**

## Pre-trained weights

For complete reproducibility, we provide the pre-trained weights [here](https://github.com/sidgan/ETCI-2021-Competition-on-Flood-Detection/releases/download/v1.0.0/pretrained_weights.tar.gz). With these weights and the workflow depicted in the notebooks and scripts one should be able to get an IoU of ~0.76 (as per the [competition leaderboard](https://competitions.codalab.org/competitions/30440#results)) on the test set provided at the competition.

## Results

You can verify the reported results [here](https://competitions.codalab.org/competitions/30440#results). Just switch to "Test (Phase 2)" after
clicking the link.

## FAQ

- [Create a new Notebooks instance](https://cloud.google.com/notebooks/docs/create-new)

## Acknowledgements

* We are grateful to the [ML-GDE program](https://developers.google.com/programs/experts/) for providing GCP credits to support our experiments.
* Thanks to [Charmi Chokshi](https://in.linkedin.com/in/charmichokshi), and domain experts Nick Leach and Veda Sunkara for insightful discussions.

## Citation

```
@misc{paul2021flood,
      title={Flood Segmentation on Sentinel-1 SAR Imagery with Semi-Supervised Learning},
      author={Sayak Paul and Siddha Ganju},
      year={2021},
      eprint={2107.08369},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}
```

branch_name: refs/heads/main


text:
# Python Standards

1. [Linting](#linting)
1. [Imports](#imports)
3. [Python versions](#python-versions)
4. [`requirements.txt`, `setup.py`, and specifying dependencies](#requirementstxt-setuppy-and-specifying-dependencies)

## Linting

All of our Python code should match the [PEP8 style guide](https://www.python.org/dev/peps/pep-0008/) and the [Django coding style guidelines](https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/).

We follow [PEP8's line length](https://www.python.org/dev/peps/pep-0008/#maximum-line-length) instead of Django's for consistency with our other development standards. We follow [Django's recommended import ordering in Django projects](https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/#imports).

For linting we recommend [flake8](http://flake8.pycqa.org/en/latest/), and provide a [sample flake8 configuration](../.flake8).
Exceptions to PEP8 are found in that [sample flake8 configuration](../.flake8), and include:

- `E731`, we allow assignment of `lambda` expressions
- `W503`, we allow line breaks after binary operators
- `W504`, we allow line breaks before binary operators

On the whole, generated Python files like Django migrations can be safely ignored.

The flake8 and configuration can go into a `tox.ini` file under a `[flake8]` header.

It is highly recommended to configure flake8 linting in your editor of choice to use the configuration file above or one provided in the project you're working on.

## Imports

See [Imports in PEP8](https://www.python.org/dev/peps/pep-0008/#imports) and [Imports in Django Coding Style](https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/#imports).

We use [isort](https://github.com/timothycrosley/isort) to lint imports to comply with both style guidelines, and provide a [sample isort configuration](../.isort.cfg). This configuration attempts to enforce the following conventions:

- Multiple-line `from` imports become grouped within parenthesis with one imported name per-line and a trailing comma for the last imported name.
- Consider `six` to be equivalent to `__future__` imports.
- Django imports are included as their own section between the standard library and third-party imports.
- For Wagtail-specific projects like [cfgov-refresh](https://github.com/cfpb/cfgov-refresh), Wagtail imports are included as their own section between Django and third-party imports.

The isort configuration can go into a `tox.ini` file under an `[isort]` header.

## Python versions

As we transition from Python 2.7 to Python 3 it is highly recommended to test against both Python 2.7 and Python 3.6.

We recommend using [tox](https://tox.readthedocs.io/en/latest/) for matrix testing, and provide a [sample tox configuration](../tox.ini) that tests against Python 2.7 and 3.6 and Django LTS versions 1.8 and 1.11.

For writing code that is Python 2 and 3-compatible, please see the [Python Porting HOWTO](https://docs.python.org/3/howto/pyporting.html) and the [Django Porting to Python3](https://docs.djangoproject.com/en/1.11/topics/python3/). In particular, we prefer to:

- [Use feature detection instead of version detection](https://docs.python.org/3/howto/pyporting.html#use-feature-detection-instead-of-version-detection)
- Use absolute imports (`from __future__ import absolute_import`)
- Use the `print()` function instead of the `print` statement (`from __future__ import print_function`)
- Use unicode literals (`from __future__ import unicode_literals`), and [the corresponding Django `python_2_unicode_compatible`](https://docs.djangoproject.com/en/1.11/ref/utils/#django.utils.encoding.python_2_unicode_compatible) (`from django.utils.encoding import python_2_unicode_compatible`)
- Use Python 3 division wherein dividing `int`s results in a `float` (`from __future__ import division`)
- Capture exceptions using the `as` keyword (`except Exception as exc`)

## `requirements.txt`, `setup.py`, and specifying dependencies

The difference between pinned versions of dependencies in `requirements.txt`  and dependencies specified in `setup.py` is frequently confusing and often misunderstood. The difference is between *concrete* and *abstract* dependencies, which is most easily understood in terms of applications (intended to be deployed and run), which specify *concrete* dependencies, and libraries (reusable code that may be included in applications), which specify *abstract* dependencies.

[Donald Stufft has an excelent article with a more in-depth discussion of this difference](https://caremad.io/posts/2013/07/setup-vs-requirement/). For our purposes, we use both requirements files and requirements specified in `setup.py` depending on the circumstance of the dependency.

- Applications should use requirements files with pinned versions.

  For example, [cfgov-refresh has several requirements](https://github.com/cfpb/cfgov-refresh/tree/master/requirements) files that pin all relevant versions for deployment, testing, local execution, and other specific needs. Some of these requirements files dependend on each other ([`-r libraries.txt`](https://github.com/cfpb/cfgov-refresh/blob/master/requirements/base.txt#L3)).

- Libraries should specify dependencies with supported version ranges ([and those ranges should be tested with tox](../tox.ini)) in `setup.py` using [the appropriate setuptools `_requires` keyword](https://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-dependencies).

  For example, our [wagtail-sharing library](https://github.com/cfpb/wagtail-sharing) declares install-time requirements with `install_requires` and testing requirements with `extras_require={'testing': testing_extras}`.

Satellite apps of cfgov-refresh are considered for these purposes to be libraries.

repository: DalavanCloud/development

repo_name: DalavanCloud/development


text:
---
title: '`ospgrillage`: A bridge deck grillage analysis preprocessor for `OpenSeesPy`'
tags:
  - Python
  - Bridge
  - grillage
  - finite element
  - load analysis

authors:
  - name: J.W. Ngan^[co-first author]
    orcid: 0000-0001-7514-0065
    affiliation: 1
  - name: C.C. Caprani^[corresponding author]
    orcid: 0000-0001-6166-0895
    affiliation: 1

affiliations:
 - name: Monash University, Australia
   index: 1

date: 1 February 2022
bibliography: paper.bib

---

# Summary

The structural analysis of bridge decks is a vital part of the design and assessment of bridges.
`ospgrillage` is an open source Python package that extends the `OpenSeesPy` package to create bridge deck grillage models using the Open System for Earthquake Engineering Solution (`OpenSees`) framework.
The `OpenSees` framework combines the power of scripting languages (either Tcl or Python) with cutting-edge finite element analysis for various structural and geotechnical systems.
As such, the `OpenSees` framework has significant potential for both practitioners and researchers in creating and analyzing advanced bridge deck grillage models.
However, directly using the low-level `OpenSees` framework is time-consuming and tedious for the creation of comprehensive grillage models.
A main motivation for `ospgrillage` is that the `OpenSees` framework would benefit greatly from having a pre-processing package that automates the bridge deck grillage modelling process for common model types.
Similarly, users of `ospgrillage` can benefit from the vast library of elements and computational modules available now and in future, from `OpenSees`.

`ospgrillage` provides a simple user interface for making grillage models based on the `OpenSeesPy` package (itself a Python wrapper to `OpenSees`).
The `ospgrillage` interface consist of API functions that wrap `OpenSeesPy` commands as tailored to bridge deck analysis.
For example, a single `create_section()` command runs all relevant `OpenSeesPy` commands to create a section representing a structural member.
With `ospgrillage`, it is possible to create a variety of complex grillage models with far fewer lines of codes.
In addition, `ospgrillage` allows users to output an executable Python script containing the relevant `OpenSeesPy` commands to create the prescribed grillage model when executed.
This secondary feature of `ospgrillage` is useful for users who wishes to further develop these models and leverage the full power of `OpenSees`.
Alongside model generation, `ospgrillage` also contains comprehensive load analysis utilities, allowing users to perform multiple loadcase analyses on the created grillage model.
Detailed online documentation is provided which includes tutorials and examples for `ospgrillage`.
Overall, `ospgrillage` should reduce the time needed to create bridge deck grillage models in terms of the scripting process; which not only opens up the powerful `OpenSees` framework to a wider audience but also lowers the bar for users to adopt and learn the `OpenSeesPy` package in their workflow.

# Statement of Need

`OpenSees` is a software framework allowing users to create advanced finite element applications for simulating the static and dynamic linear and non-linear responses of structural and geotechnical systems [@Mckenna2011].
The modularized `OpenSees` framework is highly robust and efficient, particularly for research studies pertaining to combined analyses such as post-seismic fire performance [@Elhami2014].
Initially available to interface through the Tcl language, a Python interpreter `OpenSeesPy` has recently been made available and has seen a large uptake [@ZHU20186].
This allows users to take advantage of `OpenSees` computational framework while integrating their analysis with other tools from the enormous Python eco-system.

In recent years, `OpenSees` has seen an increase usage in bridge engineering research studies [@wang2017;@scott:2008].
The element library of `OpenSees` caters to a wide variety of bridge modelling techniques; from a simple one-dimensional (1-D) line model consisting of linear beam elements [@Almutairi2016AnalysisOM], to comprehensive nonlinear three-dimensional (3-D) models [@Benjumea].
On the other hand, bridge deck analysis is a vital part of both research and practice in bridge design and assessment.
As the structure is subjected to many sources of moving and dynamic loads, the three-dimensional behaviour is complex.
However, it is critical for public safety that this behaviour is properly modelled and understood.
The most popular bridge deck modelling approach is grillage modelling, as it has been used for many decades around the world [@carlross].
Previously, grillage modelling was restricted to one-dimensional elements, but now shell elements are increasingly accepted, all of which is readily accommodated in `OpenSees`.
In addition to modelling, the scripting nature of `OpenSees`---as compared with the graphical interfaces prevalent in commercial engineering practice software---is well-suited to performing a series of analyses for parametric studies in bridge engineering.

A significant shortcoming of `OpenSees` in bridge engineering application is that the low-level scripting is extremely voluminous and time-consuming for grillage modelling and analysis.
A typical script for a model consists of `OpenSeesPy` commands under several domains including the construction (e.g. *node*, and *element* commands), and the analysis domain (e.g. *load* commands).
In turn, such scripts are usually very lengthy when considering model with many elements and nodes, let alone adding multiple subsequent analyses within the same script.
Hence these numerical models are very error prone, and become tedious to modify or troubleshoot.
Furthermore, there is no established interface to import such models into `OpenSees` framework.
In other words, users wishing to model a specific bridge deck would be required to create its scripts from scratch.
Therefore, `OpenSees` users would enormously benefit from having a package that creates grillage models instead of having users writing scripts from scratch.

`ospgrillage` is a Python package designed to address the aforementioned gap by providing users a simple interface for creating bridge grillage models without needing to script from scratch.
`ospgrillage` contains simple user interface functions that wrap `OpenSeesPy` commands for creating models in `OpenSees` framework.
For example, a single `create_grillage()` function automatically executes the model generating commands of `OpenSeesPy`, i.e. `node()`, and `element()`.
Furthermore, the simple interface functions provided by `ospgrillage` also allow users to create and add analyses onto the created grillage models - these functions wrap `OpenSeesPy`'s load module commands.
`opsgrillage` automates the generation of three types of grillage models, the enveloping of moving load analyses results, and the combination of multiple load cases.
Consequently, `ospgrillage` significantly reduces the time required for numerical analysis of bridge grillage models using `OpenSeesPy` and opens up the potential for massive parametric analysis of bridge families to researchers, for example.

`ospgrillage` is intended for two groups of users who would like to utilize `OpenSees` in the Python language.
Firstly, the interface for creating grillage model instantaneously in `OpenSees` framework is suited for users who wish to quickly create and analyze grillage models (i.e. practitioners).
Secondly, `ospgrillage`'s ability to generate and export fully-fledged Python scripts caters for users who wish to create and store multiple grillage models for uses outside of `ospgrillage`.
For example, these users could opt to leverage `ospgrillage`'s meshing capabilities to quickly generate command lines of nodes and elements which they can then use as the basis for more advanced analysis (e.g. seismic nonlinear material and geometric analysis).
Finally, `ospgrillage` is written to be easily extensible, and the roadmap allows for curved and multi-span bridge decks, for example.

# Availability
The `ospgrillage` package is available at [ospgrillage](https://monashsmartstructures.github.io/ospgrillage/index.html), where the source code, issue trackers, and documentation can be found.
Guides and examples for creating grillage models have been provided in the documentation.
Additionally, details of `ospgrillage`'s package design can also be found on the *Package Design* section of documentation.
Furthermore, a workshop on `ospgrillage` was held on 30 November 2021 and the recording is available on [YouTube](https://www.youtube.com/watch?v=8idPqdT_AhI&ab_channel=ColinCaprani).

# Acknowledgements

The authors would like to thank all contributors of `ospgrillage`.
In particular, the authors would like to thank Dr. Mayer Melhem for his contributions to testing the package and producing illustrations for the documentation, including the `ospgrillage` logo.

# References

repository: MonashSmartStructures/ospgrillage

repo_name: MonashSmartStructures/ospgrillage


text:
## Last Week's Accomplishments

> Divided the team into small subgroups including, front-end, back-end, architecture.

> I will be working on the front end with Gabe. We will be developing in AngularJS, so I've been learning about that

>Cloned an angular-seed repository from GitHub and began tinkering with it

## This Week's Plan

> Modify the angular-seed repo to bette represent the design and information we want to represent

> Gabe and I will have to sit down this week and create a preliminary layot for the site

## Anything Blocking?

> Currently, the only road block is my lack of knowledge of AngularJS. I'm actively learning more about it.

repository: Nicholas-Nazario/rcos-status-updates

repo_name: Nicholas-Nazario/rcos-status-updates


text:
# Purpose:

NumPy offers the `save` method for easy saving of arrays into .npy and `savez` for zipping multiple .npy arrays together into a .npz file.

`cnpy` lets you read and write to these formats in C++.

The motivation comes from scientific programming where large amounts of data are generated in C++ and analyzed in Python.

Writing to .npy has the advantage of using low-level C++ I/O (fread and fwrite) for speed and binary format for size.
The .npy file header takes care of specifying the size, shape, and data type of the array, so specifying the format of the data is unnecessary.

Loading data written in numpy formats into C++ is equally simple, but requires you to type-cast the loaded data to the type of your choice.

# Installation:

Default installation directory is /usr/local.
To specify a different directory, add `-DCMAKE_INSTALL_PREFIX=/path/to/install/dir` to the cmake invocation in step 4.

1. get [cmake](https://cmake.org/)
2. create a build directory, say $HOME/build
3. cd $HOME/build
4. cmake /path/to/cnpy
5. make
6. make install

# Using:

To use, `#include"cnpy.h"` in your source code. Compile the source code mycode.cpp as

```bash
g++ -o mycode mycode.cpp -L/path/to/install/dir -lcnpy -lz --std=c++11
```

# Description:

There are two functions for writing data: `npy_save` and `npz_save`.

There are 3 functions for reading:
- `npy_load` will load a .npy file.
- `npz_load(fname)` will load a .npz and return a dictionary of NpyArray structues.
- `npz_load(fname,varname)` will load and return the NpyArray for data varname from the specified .npz file.

The data structure for loaded data is below.
Data is accessed via the `data<T>()`-method, which returns a pointer of the specified type (which must match the underlying datatype of the data).
The array shape and word size are read from the npy header.

```c++
struct NpyArray {
    std::vector<size_t> shape;
    size_t word_size;
    template<typename T> T* data();
};
```

repository: openvinotoolkit/openvino

repo_name: openvinotoolkit/openvino


text:
---
layout: page
#
# Content
#
#subheadline: "Dummy"
title: "Download docker images from docker hub"
#teaser: "...."
categories:
  - blog
tags:
  - deegree
  - java
  - cloud
  - docker
---
Get current deegree release versions on docker from [docker hub](https://hub.docker.com/r/deegree/deegree3-docker/):

* 3.4.10 - `docker pull deegree/deegree3-docker:v3.4.10`

`docker pull deegree/deegree3-docker:latest` will pull the latest image which is currently 3.4.10! All images are based on
on the offical Apache Tomcat 8.5+ with OpenJDK 8 image.

To start a docker container with the name deegree on port 8080 run the following command:

`docker run -p 8080:8080 --name deegree --rm deegree/deegree3-docker`

The Dockerfile is available at [https://github.com/deegree/deegree3-docker](https://github.com/deegree/deegree3-docker).

Older versions of deegree Docker images are available from [https://hub.docker.com/r/tfr42/deegree/](https://hub.docker.com/r/tfr42/deegree/). The related Dockerfile is available at [https://github.com/tfr42/deegree-docker](https://github.com/tfr42/deegree-docker).

---

_Update 2019-10-26:_
Updated links to official deegree docker repository and versions.

repository: stephanr/deegree-website

gha_language: JavaScript

repo_name: stephanr/deegree-website


text:
# snmp_cisco_info

A script that presents information about Cisco devices using SNMP.

Suitable to use as a plugin for any Nagios compatible monitoring system.

The script utputs a string with:
>hostname,
 model,
 IOS version,
 serial nr.,
 location,
 contact"

All the fields are queried by SNMP from the device.

The location field is whatever is configured with "snmp-server location" in running-config on the device.

The contact field is whatever is configured with "snmp-server contact".

The formatting of the output string can easily be modified at the top of the script.
The string can then be used by some external system or just as information as is.
It is for example possible to query the API in Op5 Monitor for the information gathered by this plugin.
Logical devices in a stack or cluster configuration will output one row of
information per physical device.

This script was wtitten for OP5 Monitor in order to populate a database for device inventory
consisting of more than 2000 Cisco network devices.
It has been tested with with: 6500, ASR and other routers, different Catalyst, Nexus...

See also [snmp_genera_info](https://gitlab.com/faridj/snmp_general_info).

### USAGE
Add this script as a service check in Op5/Nagios for a Cisco device.

Apply the SNMP authentication information as variables to the service.

The check will always return OK, even if the host is down.

## Version history
* 3.2 2019-04-24  Added dupport for C9500-48Y4C.
* 3.1 2016-08-26  Added support for WS-C3850-24XS-S.
* 3.0 2016-06-21  Major cleaning since the script had grown + support for C6807-XL.
* 2.1 2016-06-08  Replaced the OID for Nexus model.
* 2.0 2015-10-27  Cleanups, more error handling and support for C3850.
* 1.0 2015-08-19  Initial public release with some added comments and a new name.
     2015-06-08  Added support for stacks bigger than 4.
     2015-05-22  Added support for some old ASR version.
     2014-11-07  Updated the logic for model 4500.
     2014-11-05  Added Cisco 4500 VSS logic to get serial of switch2.
     2014-10-23  Fixed a bug with Nexus serial.
     2014-10-14  Added section for Cisco WS-6500, and handling of SNMP error.
     2014-04-16  First version.

___

Licensed under the [__Apache License Version 2.0__](https://www.apache.org/licenses/LICENSE-2.0)

Written by<EMAIL_ADDRESS>
http://www.joubbi.se/monitoring.html


text:
# togglore
Tool for the timetracker [toggle](http://toggl.com/) to calculate the difference between tracked time and the time you should have worked in a given range.

## Setup

Create a config file and save it at ~/.togglore.
```sh
[Authentication]
API_KEY = 5b9f5e3fd7745a022781daf205f62c72

[Work Hours]
hours_per_day = 8.4
excluded_days = 2016.01.01

[User Info]
id = 1
workspace = 1
```

## Run
```sh
# show diff for today
python3 run.py today

# show diff for the current week
python3 run.py thisweek

# show diff for the current month
python3 run.py thismonth

# show diff for the current year
python3 run.py thisyear

# show diff for the given month
python3 run.py month 08

# show diff from 2016.08.01 until today
python3 run.py since 2016.08.01
```
The output is something like:
```
Hours to do: 176.00h (22.00 days)
Hours worked: 186.65h (23.33 days)
Difference: 10.65h (1.33 days)
```

# HowTo for Win10, WSLv2, AlpineWSL, Python3.9.5
```
apk update
apk upgrade
apk add python3 git
cat .togglore > ~/.togglore
cd
git clone https://github.com/ynop/togglore.git
cd togglore/
python3 run.py
time python3 run.py since 2021.11.01
```
E-mail notification
```
apk add msmtp mailx
cat /mnt/d/WSL/Alpine/msmtprc > /etc/msmtprc
ln -sf /usr/bin/msmtp /usr/sbin/sendmail
cd ~/togglore/
python3 run.py since 2021.10.1 | mail -s "Toggl"<EMAIL_ADDRESS>```

## or Thanks to christiandt we can use Python2
```
apk update
apk upgrade
apk add python2 git
python -m ensurepip --upgrade
mkdir ~/Dropbox
cat .togglore > ~/Dropbox/toggl.txt
cd
git clone https://github.com/christiandt/togglore.git
cd togglore/
pip install -r requirements.txt
time python run.py since 2021.11.01
```


text:
# Real World React Native

> Real World React Native apps and their open source codebases for developers to learn from

Learn from React Native apps written by experienced developers.

You'll find the source code for the Real World React Native apps in the [`apps/`](apps/) subdirectory.

Thank you to every developer who has worked on a project this repo links to, your work is helping developers learn React Native.

## How to install on your computer

```bash
# Clone this git repo:
git clone git@github.com:jeromedalbert/real-world-react-native.git

cd real-world-react-native/

# The apps are linked to as git submodules.
# This will take some time...
git submodule update --init
```

## Other Real World codebase collections

- Real World React https://github.com/jeromedalbert/real-world-react
- Real World Ember https://github.com/eliotsykes/real-world-ember
- Real World Rails https://github.com/eliotsykes/real-world-rails
- Real World Sinatra https://github.com/jeromedalbert/real-world-sinatra
- Know any others? Please open a PR and add the link here

## Information for contributors

#### How to add a Real World app

Given a GitHub repo for an app `githubuser/foo`:

```bash
# Inside the project root:
git submodule add -b master git@github.com:githubuser/foo.git apps/foo
```

#### Updating the apps submodules to latest

The apps in `apps/` are git submodules. Git submodules are locked to a revision and don't stay in sync with the latest revision.

To update the revisions, run:

```bash
# This will take some time:
git submodule foreach git pull origin master
```

---

# Contributors

- Jerome Dalbert http://jeromedalbert.com
- Contributions are welcome, fork the GitHub repo, make your changes, then submit your pull request! Reach out if you'd like some help.

repository: farazjalili/AuthenticationDjango

repo_name: farazjalili/AuthenticationDjango


text:
# Hydra Cardano API

A Haskell API for Cardano, tailored to the Hydra project. This package provides
a wrapper around the cardano-ledger, cardano-api and plutus libraries with extra
utilities and function commonly used across the Hydra project.

Some of those addition may be likely candidates for upstream change requests,
but having this extra space gives us an opportunity to iterate faster and to
unify not-always-consistent names / approches across the Cardano ecosystem.

In addition, the top-level module `Hydra.Cardano.Api` does re-export only
specialized types and constructors for all underlying types. Everything is
indeed specialized to the **latest era** (e.g. `Babbage`) and **latest plutus
version** (e.g. `PlutusV2`) making the era type parameter redundant in most
cases. This also removes the need for extra indirections or, for proxy-values
witnessing era types as present in many `cardano-api` constructors. For example,
a vanilla usage of the `cardano-api` would looks like the followings:

```hs
changeOutput :: Address ShelleyAddr -> TxOut CtxUTxO BabbageEra
changeOutput =
  TxOut
    (AddressInEra (ShelleyAddressInEra ShelleyBasedEraBabbage) addr)
    (TxOutValue MultiAssetInBabbageEra (lovelaceToValue $ initialAmount - amount - fee))
    (TxOutDatumHash ScriptDataInBabbageEra (hashScriptData $ fromPlutusData someDatum))
```

...whereas, the wrapped API would offer a more lightweight notation:

```hs
changeOutput :: Address ShelleyAddr -> TxOut CtxUTxO
changeOutput =
  TxOut
    (AddressInEra addr)
    (lovelaceToValue $ initialAmount - amount - fee)
    (TxOutDatumHash $ hashScriptData $ fromPlutusData someDatum)
```

## Organization & naming conventions

This package follows some simple rules to remain tidy and organized:

1. Modules are scoped to only data-type, and named after it. Examples:
    - `Hydra.Cardano.Api.AddressInEra` / `AddressInEra`
    - `Hydra.Cardano.Api.TxIn` / `TxIn`

2. Functions are placed in a module if their _return type_ matches the module's scope.

    ```hs
    mkVkAddress
      :: IsShelleyBasedEra era
      => NetworkId
      -> VerificationKey PaymentKey
      -> AddressInEra era
    ```

    belongs to `Hydra.Cardano.Api.AddressInEra` but:

    ```hs
    getPaymentScriptHash ::
      AddressInEra AlonzoEra ->
      Maybe ScriptHash
    ```

    belongs to `Hydra.Cardano.Api.ScriptHash`.

    > NOTE: 3. For conversions functions to ledger / plutus types for which the return type is isomorphic to the module's scope, we place them in that same module.

3. Builders are prefix with `mk` (as in 'make').

4. Getters are prefix with `get` unless they have an equivalent in `cardano-api`, for which we adopt `cardano-api`'s naming convention as much as possible.

5. Functions outside of the top-level `Hydra.Cardano.Api` are unspecialized and written for _any era_ (where it does make sense!). Said differently, it should be easy to move those functions upstream if need be. Specialization only happens at the very frontier, in the top-level module..

repository: input-output-hk/hydra

gha_language: Haskell

repo_name: input-output-hk/hydra


text:
# Thought experiment
### Completed over the weekend
* User can log in
* User can search twitter for a query
* User can save their scheduled query
* Models for user query
* Models for query job
* Models for the results of the query job
* Deployment to amazon ec2 http://<IP_ADDRESS>
* Draft of blog post about deployment (https://medium.com/@bsadkhin/deploying-a-django-app-to-amazon-ec2-3f17a735a561)

### ToDo
* Task scheduling http://django-extensions.readthedocs.io/en/latest/jobs_scheduling.html
* Cron jobs for above tasks
* Create task to query job
* Create page to view results of query job
* Add other APIS

## Setting Up Your Users
``` python manage.py createsuperuser ```

## Testing with PyTest
* Todo

# Installing Libraries on ec2 AMI Linux
```
  yum groupinstall 'Development Tools'
  yum install libffi-devel.x86_64
  yum install zlib-devel
  yum install libjpeg-turbo-devel libpng-devel
  yum install postgresql95.x86_64
  yum install postgresql95-contrib.x86_64
  yum install postgresql95-devel.x86_64
  yum install postgresql95-docs.x86_64
  yum install postgresql95-libs.i686
  yum install postgresql95-libs.x86_64
  yum install postgresql95-server.x86_64
  yum install postgresql95-static.x86_64
  yum install postgresql95-test.x86_64
  yum install postgresql95-plperl.x86_64
  yum install postgresql95-plpython26.x86_64
  yum install postgresql95-plpython27.x86_64
```

# Getting dependencies
``` virtualenv django; source django/bin/activate
 cd social_media_scanner
 pip install -U pip setuptools
 pip install -r requirements/production.txt
 pip install -r requirements.txt
 ```

# Postgres
```
sudo service postgresql95 initdb
sudo service postgresql95 start
sudo su postgres
createdb analyte
psql
ALTER USER postgres WITH PASSWORD '$password';
```
# WSGI Setup and deployment to amazon ec2
 Read more at https://medium.com/@bsadkhin/deploying-a-django-app-to-amazon-ec2-3f17a735a561

# Other
 * https://www.slideshare.net/jkatz05/webscale-postgresql-jsonb
 * https://gist.github.com/webinista/812c20247a6c21e639ce
 * https://heap.engineering/when-to-avoid-jsonb-in-a-postgresql-schema/


text:
# Tensorflow-cl

Run [Tensorflow](https://github.com/tensorflow/tensorflow) on OpenCL™ 1.2 devices

- tested on Mac Sierra and Ubuntu 16.04
- should work theoretically on any OpenCL 1.2 GPU

## What's working

- unary operations, eg `tanh`, `log`, `exp`, `sigmoid`, `sqrt`, `abs`, `ceil`, `floor`, `argmax`, `argmin`
- binary operations, eg `pow`, `mul`, `add`, `maximum`, `minimum`, `squared_difference`
- reductions, eg `reduce_sum`, `reduce_max`, `reduce_min`, `reduce_prod`, `reduce_mean`
- variables, `tf.Variable`
- matrix multiplication, `matmul`
- random numbers, eg `tf.random_uniform`, `tf.random_normal`
- softmax, eg `tf.nn.softmax_cross_entropy_with_logits`
- gradients, automatic differentiation, back-propagation
- trainers, eg `tf.train.AdamOptimizer`
- ReLU, `tf.nn.relu`

## Piccie

On a Mac:

<img src="doc/img/multilayerperceptron.png" />

## Test results

Latest results, [v0.18.3](https://github.com/hughperkins/tf-coriander/releases/tag/v0.18.3):

| test | Mac Sierra, using Radeon Pro 450 GPU (thank you [ASAPP](http://asapp.com) :-) ) | Ubuntu 16.04, using NVIDIA K520 |
|----- |-------|-------|
| unit tests (`py.test -v`) | All pass :-) | All pass :-) |
| [linear_regression.py](https://github.com/hughperkins/TensorFlow-Examples/blob/enforce-gpu/examples/2_BasicModels/linear_regression.py) |  Runs ok, loss decreases  | Runs ok, loss decreases |
| [logistic_regression.py](https://github.com/hughperkins/TensorFlow-Examples/blob/enforce-gpu/examples/2_BasicModels/logistic_regression.py) | Runs ok, loss decreases  | Runs ok, loss decreases |
| [nearest_neighbor.py](https://github.com/hughperkins/TensorFlow-Examples/blob/enforce-gpu/examples/2_BasicModels/nearest_neighbor.py) | Runs ok, accuracy 0.92  | Runs ok, accuracy 0.92 |
| [autoencoder.py](https://github.com/hughperkins/TensorFlow-Examples/blob/enforce-gpu/examples/3_NeuralNetworks/autoencoder.py)| Runs ok, loss decreases | Runs ok, loss decreases |
| [multilayer_perceptron.py](https://github.com/hughperkins/TensorFlow-Examples/blob/enforce-gpu/examples/3_NeuralNetworks/multilayer_perceptron.py) | Runs ok, loss decreases | Runs ok, loss decreases |
| [recurrent_network.py](https://github.com/hughperkins/TensorFlow-Examples/blob/enforce-gpu/examples/3_NeuralNetworks/recurrent_network.py) | Runs ok, loss decreases | Runs ok, loss decreases |
| [bidirectional_rnn.py](https://github.com/hughperkins/TensorFlow-Examples/blob/enforce-gpu/examples/3_NeuralNetworks/bidirectional_rnn.py) | Runs ok, loss decreases | Runs ok, loss decreases |
| [dynamic_rnn.py](https://github.com/hughperkins/TensorFlow-Examples/blob/enforce-gpu/examples/3_NeuralNetworks/dynamic_rnn.py) | Runs ok, loss decreases | Runs ok, loss decreases |

## Installation

- You will need:
  - the tensorflow non-gpu installation pre-requisites
  - an OpenCL 1.2-enabled GPU, and OpenCL 1.2-enabled drivers (check that `clinfo` shows your GPU, and that is shows as a GPU device)
  - python 3

For Ubuntu 16.04 and Mac Sierra, there are pre-built wheels available:

- [Mac Sierra](https://github.com/hughperkins/tf-coriander/releases/download/v0.18.3/tensorflow-cl-v0.18.3-macsierra-python3.zip)
- [Ubuntu 16.04](https://github.com/hughperkins/tf-coriander/releases/download/v0.18.3/tensorflow-cl-v0.18.3-ubuntu1604-python3.zip)

Simply download, unzip, then install using `pip`:
```
pip install --upgrade tensorflow-0.11.0rc0-py3-none-any.whl
```

For other operating systems, please [build from source](doc/build-from-source.md)

By default, Tensorflow-cl will run using the first GPU available on your system. You can use the environment variable `CL_GPUOFFSET` to choose others:

- `export CL_GPUOFFSET=1` chooses the second GPU (ie, index 1)
- `export CL_GPUOFFSET=2` chooses the third GPU

## Testing

- [Testing](doc/testing.md)

## Design/architecture

- tensorflow code stays 100% [NVIDIA® CUDA™](https://www.nvidia.com/object/cuda_home_new.html)
- [Coriander](https://github.com/hughperkins/Coriander) compiles the NVIDIA® CUDA™ code into OpenCL
- Cedric Nugteren's [CLBlast](https://github.com/CNugteren/CLBlast) provides BLAS (matrix multiplications)

Presentation on [Coriander](https://github.com/hughperkins/Coriander) at this year's [IWOCL 2017](http://www.iwocl.org/iwocl-2017/conference-program/)

## Enabling new operations

- [Enabling operations](doc/enabling-operations.md).

## Related projects

### DNN Libraries
- [OpenCL Torch](https://github.com/hughperkins/distro-cl)
- [DeepCL](https://github.com/hughperkins/DeepCL)

## News

- June 7 2017:
  - created [v0.18.3](https://github.com/hughperkins/tf-coriander/releases/tag/v0.18.3) release:
    - `tf.split` enabled
    - following examples from Aymeric Damien's [Tensorflow-Examples](https://github.com/aymericdamien/TensorFlow-Examples) run now:
      - [recurrent_network.py](https://github.com/hughperkins/TensorFlow-Examples/blob/enforce-gpu/examples/3_NeuralNetworks/recurrent_network.py)
      - [bidirectional_rnn.py](https://github.com/hughperkins/TensorFlow-Examples/blob/enforce-gpu/examples/3_NeuralNetworks/bidirectional_rnn.py)
      - [dynamic_rnn.py](https://github.com/hughperkins/TensorFlow-Examples/blob/enforce-gpu/examples/3_NeuralNetworks/dynamic_rnn.py)
  - (note that earlier v0.18.2 release had a regression)
- June 2 2017:
  - created [v0.17.3 release](https://github.com/hughperkins/tf-coriander/releases/tag/v0.17.3):
    - bug fix release:
      - `tf.random_uniform` and `tf.random_normal` should give equal results to the cpu version, on both Mac and Ubuntu
      - `tf.random_normal` should no longer give all zeros results on Ubuntu, ie should fix https://github.com/hughperkins/tf-coriander/issues/35
      - the Mac wheel should have `RPATH` set correctly, ie hopefully should not give error messages about unable to load `libclew.dylib` or similar, ie should fix https://github.com/hughperkins/tf-coriander/issues/39

repository: tzry/tf-coriander

repo_name: tzry/tf-coriander


text:
# CDSP - Compositional DSP Library for C++

CDSP is a header only DSP library written with [CNL](https://github.com/johnmcfarlane/cnl)
aiming for floating point and fixed-point implementation of typical DSP kernels.

## Requirements are the same as with [CNL](https://github.com/johnmcfarlane/cnl)
### Linux
Requires:
* GCC 5.1 / Clang 3.5
* [Cmake](https://cmake.org/) 3.2.2

Optional:
* [Boost](https://www.boost.org/) - for multiprecision support with [CNL](https://github.com/johnmcfarlane/cnl)
* [Doxygen](https://www.doxygen.org/) - generates documentation in the doc/gh-pages directory

### Mac
See the instructions for Linux. Works similarly.
For missing packages please use [Homebrew](https://brew.sh/).

### Windows
* MSBuild 15.0 (VS 2017)
* [Cmake](https://cmake.org/) 3.8.0

## Instructions
### Download
The library is hosted on [GitHub](https://github.com/hbe72/dsp)
```
cd /some/directory
git clone https://github.com/hbe72/dsp.git
```

### Build
1. Generate the build system
    ```
    mkdir build
    cd build
    cmake /some/directory/dsp -DCMAKE_INSTALL_PREFIX=/directory/to/install
    ```

2. Build tests:
    * Linux and Mac parallel with 8 cores
    ```
    cmake --build . --target tests -- -j8
    ```
    * Windows
    ```
    cmake --build . --target test/tests
    ```
3. Run the tests
    ```
    ctest
    ```
4. Install

    If you want to install the CDSP and CNL libraries to location specified by
    CMAKE_INSTALL_PREFIX.
    ```
    cmake --build . --target install
    ```

    By default CDSP and CNL install to /usr/local.

repository: kraiskil/cdsp

repo_name: kraiskil/cdsp


text:
# Natural Language Statistics

[![Build Status](https://travis-ci.org/jamesjoshuahill/language.svg?branch=master)](https://travis-ci.org/jamesjoshuahill/language) [![Go Report Card](https://goreportcard.com/badge/github.com/jamesjoshuahill/language)](https://goreportcard.com/report/github.com/jamesjoshuahill/language) [![GoDoc](https://godoc.org/github.com/jamesjoshuahill/language?status.svg)](https://godoc.org/github.com/jamesjoshuahill/language)

## Get

```bash
$ go get github.com/jamesjoshuahill/language
```

## Run

```bash
$ language                                             # Start server
$ echo "here are some more words" | nc localhost 5555  # Send some language
$ curl http://localhost:8080/stats                     # Request language stats
{"count":5,"top5words":["some","more","words","here","are"],"top5letters":["s","o","e","r","m"]}
```

The server can be configured with flags:
```bash
$ language -h  # Outputs usage
```

## Test

The test suite uses [Ginkgo](https://onsi.github.io/ginkgo/) and [Gomega](https://onsi.github.io/gomega/) and can be run with `go test`, or using the `ginkgo` CLI:

```bash
$ cd $GOPATH/src/github.com/jamesjoshuahill/language
$ go get github.com/onsi/ginkgo/ginkgo
$ go get github.com/onsi/gomega
$ ginkgo -r -randomizeSuites -randomizeAllSpecs -cover
```

## Exercise

Build a simple Go application. When started, it will listen on port 5555 (but this may be configurable through a command-line flag). Clients will be able to connect to this port and send arbitrary natural language over the wire. The purpose of the application is to process the text, and store some stats about the different words that it sees.

The application will also expose an HTTP interface on port 8080 (configurable): clients hitting the /stats endpoint will receive a JSON representation of the statistics about the words that the application has seen so far.

Specifically, the JSON response should look like:

```json
{
  "count": 42,
  "top5words": ["lorem", "ipsum", "dolor", "sit", "amet"],
  "top5letters": ["e", "t", "a", "o", "i"]
}
```

Where "count" represents the total number of words seen, "top5words" contains the 5 words that have been seen with the highest frequency, and "top5letters" contains the 5 letters that have been seen with the highest frequency (you may choose to transform all letters to lowercase if you so wish).

A few things to look out for:
* The number of words to process may be large, although you may safely assume that they will fit within main memory.
* The application should support a high degree of concurrency, whereby many clients would be sending text at the same time.
* While we only expect three metrics over the collection of words, you should assume that a more fully-fledged version of the application would be collecting many more of these.
* We would like to see your approach to automated testing for this type of Go program.

license: Unlicense

repository: jamesjoshuahill/language

repo_name: jamesjoshuahill/language


text:
# urban-bot

Urban dictionary regex scrapper wrapped with Discord.js (Node API)

Add it to your Discord server using [this link](https://discordapp.com/oauth2/authorize?client_id=530775816003649546&scope=bot)!

Gets trigerred by define <word[s]> command.

If you want to run it, clone repo, do npm i, and put your token in config.json.

repository: aakatev/urban-bot

repo_name: aakatev/urban-bot


text:
---
layout: post
title: "Create ll alias in Mac"
subtitle: "Use ll in Mac"
author: "Jinfeng"
header-mask: 0.4
tags:
  - Linux
  - Mac
---

In '~/.bashrc' file add this line to allow using ll in your Mac

```
alias ll='ls -lG'
```

branch_name: refs/heads/gh-pages

gha_language: HTML


text:
+++
image = "img/django_blog/blog_head.png"
showonlyimage = false
title = "A Django Blog Platform"
draft = false
weight = 4
+++

A modern, fully open-source, blog web application built in Django.

Pluggable blog post & search apps, user management, security, Django authentication. Post drafts, saving & editing. Complex lookups.

<!--more-->

- [View Source Code](https://github.com/andybyers21/django-blog-platform)

## Tech Stack

- Built in a Python 3.6 virtual environment
- JavaScript
- Django 2.2
- SQLite 3
- Bootstrap 4

![blog page](/img/django_blog/blog_page.png)

## Features

- Pluggable blog post & search apps.
- Sessions. Login, user management, security, Django authentication.
- Draft post saving & editing (visible only to admin & superusers).
- Complex lookups, search for user, title, content, slug etc…
- Monitor lookups & search queries.
- Static file & Image uploads.
- Forms / model forms.
- URL routing.
- Optimized for speed.

## Logins for testing

- **User**, _username:_ test-user _Password:_ story011
- **Admin**, _username:_ test-staff _Password:_ afraid357
- **Superuser**, _username:_ test-super _Password:_ current912

![code page](/img/django_blog/blog_code.png)

## Admin Panel

Also features a complete admin panel.

![admin page](/img/django_blog/blog_admin.png)

## Depandancies

|             |        |
| ----------- | ------ |
| autopep8    | 1.5.4  |
| Django      | 2.2    |
| Pillow      | 7.2.0  |
| pip         | 20.2.2 |
| pycodestyle | 2.6.0  |
| pytz        | 2020.1 |
| setuptools  | 49.6.0 |
| sqlparse    | 0.3.1  |
| toml        | 0.10.1 |
| wheel       | 0.35.1 |

Hosted under [the MIT license](https://opensource.org/licenses/MIT).

---

## TO-DO

- [ ] Define Error / 404 page.
- [ ] Refactor & document code.
- [ ] Take out of Debug Mode
- [ ] Host.


text:
---
layout: post
title: "Writing at the Command Line"
date: 2016-11-20T00:00:00-05:00
---

One of my favorite quotes is this one by Manuel Blum:

> You are all computer scientists.

> You know what FINITE AUTOMATA can do.

> You know what TURING MACHINES can do.

> For example, Finite Automata can add but not multiply.

> Turing Machines can compute any computable function.

> Turing machines are incredibly more powerful than Finite Automata.

> Yet the only difference between a FA and a TM is that

> the TM, unlike the FA, has paper and pencil.

> Think about it.

> It tells you something about the power of writing.

> Without writing, you are reduced to a finite automaton.

> With writing you have the extraordinary power of a Turing machine.
>
> — Manuel Blum, _Advice to a Beginning Graduate Student_

Writing is a critically important skill for various reasons. Once you've
convinced yourself *to write*, the next question becomes *how to write*. Writing
at the Command Line introduces a handful of workflows, tools, and suggestions
for writing in plain text, with a particular emphasis on Markdown.

- [Writing at the Command Line](../slides/writing-cli/writing-cli.pdf)
- [Markdown sources (GitHub)](https://github.com/jez/talks/tree/master/slides/writing-cli)

repository: jez/talks

gha_language: TeX

repo_name: jez/talks


text:
# Cheat Sheet

[:arrow_backward: Algebra / Web Designer / Module 4 - WordPress](./)

---

**Create a theme**

1. Create theme directory (e.g. 'my-theme') in /wp-content/themes
2. Add `style.css` and `index.php` to theme directory

The theme definition is contained as a comment in `style.css`. For example:

```css
/*
Theme Name: Twenty Seventeen
Theme URI: https://wordpress.org/themes/twentyseventeen/
Author: the WordPress team
Author URI: https://wordpress.org/
Description: Twenty Seventeen brings your site to life with immersive featured
images and subtle animations. With a focus on business sites, it features multiple
sections on the front page as well as widgets, navigation and social menus, a logo,
and more. Personalize its asymmetrical grid with a custom color scheme and showcase
your multimedia content with post formats. Our default theme for 2017 works great
in many languages, for any abilities, and on any device.
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: twentyseventeen
Tags: one-column, two-columns, right-sidebar, flexible-header, accessibility-ready,
custom-colors, custom-header, custom-menu, custom-logo, editor-style,
featured-images, footer-widgets, post-formats, rtl-language-support, sticky-post,
theme-options, threaded-comments, translation-ready
This theme, like WordPress, is licensed under the GPL.
Use it to make something cool, have fun, and share what you've learned with others.
*/
```

See:
- [WordPress theme development](https://codex.wordpress.org/Theme_Development)

**Template files**

| File | Description |
| - | - |
| `style.css` | Theme’s main stylesheet file. |
| `index.php` | Main template file. |
| `single.php` | Single post file. Used to display single posts only. |
| `archive.php` | Archive or Category template file. |
| `searchform.php` | Search form file. |
| `search.php` | Search results file. |
| `404.php` | 404 error page file. Will be displayed if no page can be found. |
| `comments.php` | Comments template file. |
| `footer.php` | Footer content file. |
| `header.php` | Header content file. |
| `sidebar.php` | Sidebar content file. |
| `page.php` | Single page file. Used for pages only. |

See:
- [WordPress template hierarchy](https://developer.wordpress.org/themes/basics/template-hierarchy/)
- [WordPress cheat sheet](https://cdn.rawgit.com/hostinger/banners/b2416e91/tutorials/pdf/Wordpress-Cheat-Sheet-V-1.pdf)

**Theme functions**

Theme functions are added to `functions.php`.

```php
function my_theme_init() {
    // ...
}

add_action('init', 'my_theme_init');
```

**Thumbnails**

Inside `functions.php` theme init function:

```php
add_theme_support('post-thumbnails');
```

See:
- [WordPress theme support](https://developer.wordpress.org/reference/functions/add_theme_support/)

**Navigation menus**

Inside `functions.php` theme init function:

```php
register_nav_menus(array(
    'menu_1' => 'Menu 1'
));
```

Inside page template:

```php
if (has_nav_menu('menu_1')) {
    wp_nav_menu('menu_1');
}
```

**Post loop**

Single post:

```php
if (have_posts()) {
    the_post();
}
```
OR

```php
<?php if ( have_posts() ) : the_post(); ?>
    // Display post content
<?php endif; ?>
```

Multiple posts:

```php
if (have_posts()) {
    while (have_posts()) {
        the_post();
    }
}
```

OR

```php
<?php if ( have_posts() ) : ?>
    <?php while ( have_posts() ) : the_post(); ?>
    // Display post content
    <?php endwhile; ?>
<?php endif; ?>
```

Query posts:

```php
$query = new WP_Query();

if ($query->have_posts()) {
    while ($query->have_posts()) {
        $query->the_post();
    }
}
```

OR

```php
<?php $query = new WP_Query(); ?>
<?php if ( $query->have_posts() ) : ?>
    <?php while ( $query->have_posts() ) : $query->the_post(); ?>
    // Display post content
    <?php endwhile; ?>
<?php endif; ?>
```

See:
- [Working with WP_Query: The Complete User's Guide](https://wpshout.com/courses/wp_query/)

**Template tags**

| Tag | Description |
| --- | --- |
| `the_content();` | Get post content. |
| `the_excerpt();` | Get the post excerpt. |
| `the_title();` | Get the title of the post. |
| `the_permalink();` | Display post link. |
| `the_category(', ');` | Display category of a post. |
| `the_author();` | Show post author. |
| `the_ID();` | Display post ID. |
| `edit_post_link();` | Show Edit link for a post. |
| `next_post_link(' %link ');` | Display next page URL. |
| `previous_post_link('%link');` | Display previous page URL. |
| `get_links_list();` | Retrieve blogroll links. |
| `wp_list_pages();` | Retrieve all pages. |
| `wp_get_archives();` | Retrieve archive for the site. |
| `wp_list_cats();` | Retrieve all categories. |
| `get_calendar();` | Show the built-in WordPress calendar. |
| `wp_register();` | Show register link. |
| `wp_loginout();` | Displays login or logout links (for registered users). |

See: [WordPress function reference](https://codex.wordpress.org/Function_Reference)

**Include tags**

| Tag | Description |
| --- | --- |
| `<?php get_header(); ?>` | Includes header.php and display its content. |
| `<?php get_sidebar(); ?>` | Includes sidebar.php. |
| `<?php get_footer(); ?>` | Includes the footer.php. |
| `<?php comments_template(); ?>` | Load specific template for comments. |


text:
# Development Process

## Research

To begin with I know I want to output all my results into a CSV file so I know I'm going to want to write some code to manage outputting the list as a CSV. After a quick google I found a [library called csv](https://docs.python.org/3/library/csv.html) which manages the whole writing to a file thing for me. Next I need to work out how to actually get HTML off any site for my purposes I decided to go with the  [beautiful soup](https://realpython.com/beautiful-soup-web-scraper-python/) method because it looks easy to use.

## CSV Development

I wrote a quick bit of code to manage the IO with the CSV file and then unit tested the whole thing to make sure that it worked, last thing I want is to run the code and then it doesn't output the emails to my CSV so I have to wait for it to run again.

To finish this section of development up I made a blank csv file called email-list.csv and added some unit testing to it. Things like checking that specific societies existed and also that the number of societies in the list was roughly what was expected. These all failed for the moment but that's because it was testing a blank list.

![Failed email list tests](images/failed_email_list_tests.png)

## Planning To Scrape

Now that I have my IO sorted I need to work out how I'm going to find all the emails on the SU site, I know [this page](https://su.sheffield.ac.uk/activities/find-a-society) has a list of all the society pages but none of their emails. If I click on each of the links I can find the society's name and email so now I need to find a way to make my python script do that for me.

So I started poking around in the code of the website using the inspection tool and found that each society has a div dedicated to it that has a very specific class "g__4--m g__4--t g__3--d mgn__b--1" which I could only find in those sections of HTML.

![Inspecting the society list](images/inspecting_society_list.png)

Then I noticed that within each of those sections was an "a" tag which had the link to the society's specific page in the href attribute. This was all the information I'd need to get started on the scrape.

## Scraping the Links

So my first objective was to find all the links that went to each of the individual pages. Therefor I found all those "div" tags from before with that specific class. To do this you first get the page using the request library like so:

```python
page = requests.get(SOCIETY_LIST_URL)
```

Then parse the page using beautiful soup and use it's selector to get all those society specific tags.

```python
societiesSection = pageSoup.find('section', id="socListings")
societies = societiesSection.findAll(class_="g__4--m g__4--t g__3--d mgn__b--1")
```

And finally to pull each of the links out of those sections a simple for loop does the job.

```python
links = []
for society in societies:
    linkTag = society.find('a')
    link = linkTag['href']
    links.append(link)

return links
```

## More Planning

Now that I have a program that outputs a list that looks like this:

```
['/activities/view/a-cappella-and-beatbox-society-supertones', '/activities/view/academic-medicine-society', ...
```

I need to use those links to get me to each of the society pages. Given that these are relative links if we just take the first section of the su website (https://su.sheffield.ac.uk) and then append the path that each of those we should get a link that we can request a page from (https://su.sheffield.ac.uk/activities/view/a-cappella-and-beatbox-society-supertones)

Now I can get all the pages using the request library in a for loop I just need to work out how to get all the info from the page. Luckily again the tags related to this were relatively easy to identify using the chrome inspect tool. The title is in a "h2" tag and the class is "t__none f__b--eb" with the email in a "div" tag with another strange class "outlet__header--contact t__def-bl--pri contact__align mgn__t--1 mgn__b--1"

## Getting the Emails

Adding those selectors was easy enough so now my code should output all the the emails for the societies into the CSV. However this is actually what I got:

![Problem at 96%](images/failure_near_end.png)

After a brief debugging process I found that the issue was with the Bummit society page. The format for this page is very different to all the other pages up to this point and as such it no longer has title or email sections that the selectors can latch onto. Here's a side by side of how different this page is the the others:

![Bummit page](images/bummit_page.png)
![Card soc page](images/card_games_society.png)

So to make sure that strange pages don't cause me any problems I'll add some checks:

```python
nameContainer = pageSoup.find('h2', class_="t__none f__b--eb")
name = ""
if nameContainer != None:
    name = nameContainer.text
```

All this code does is make sure that the section of the page I've tried to select exists and if it doesn't then the name is just left blank. I did the same thing for the email.

## Completion

After some tidy up the code now successfully gives me a CSV of all the societies names and their emails. Running the unit testing on the email list I get a pass on all tests meaning it's about what I was expecting.


text:
# DynAlloy Analyzer

DynAlloy is an extension of the formal specification language [Alloy](https://alloytools.org). Alloy is a relatively popular formal specification language because of various reasons, including:
- it has simple formal semantics, based on relations
- its syntax is simple, with a few constructs (with intuitive meaning)
- its specifications follow an OO-like style
- it is designed with fully automated analysis support in mind

Alloy is suitable for specifying static structural properties of systems, but is less adequate for the specification of dynamic properties of systems, i.e., properties regarding executions. **DynAlloy extends Alloy by incorporating the notion of action to better describe state change and properties of state changing situations.** An example is available in this [tutorial](https://github.com/gregistecco/dynalloy/wiki).

## Download

Last release:
[Download](https://github.com/gregistecco/dynalloy/releases)

## Run

`$ java -jar dynalloy.jar`

java 1.8 required

---

##### [Tutorial](https://github.com/gregistecco/dynalloy/wiki)

##### [Sample Models](https://github.com/gregistecco/dynalloy/tree/master/Sample%20Models)

##### [New debbuger-like trace visualization](https://github.com/gregistecco/dynalloy/wiki)

---

### Current Collaborators

- César Cornejo
- Germán Regis
- Nazareno Aguirre
- Marcelo Frias

### Publications

-  [DynAlloy analyzer: a tool for the specification and analysis of alloy models with dynamic behaviour.](https://dl.acm.org/doi/10.1145/3106237.3122826)
Regis, G.; Cornejo, C.; Brida, S. G.; Politano, M.; Raverta, F.; Ponzio, P.; Aguirre, N.; Galeotti, J. P.; and Frias, M. F.
In Bodden, E.; Schäfer, W.; van Deursen, A.; and Zisman, A., editor(s), Proceedings of the 2017 11th Joint Meeting on Foundations of Software Engineering, ESEC/FSE 2017, Paderborn, Germany, September 4-8, 2017, pages 969–973, 2017. ACM

repository: gregistecco/dynalloy

repo_name: gregistecco/dynalloy


text:
### Optimal BST Problem

Originally, a perfectly balanced BST, like a Red-Black Tree will provide the best performance (O(log n)) when frequency of access is uniform (or unknown, and thus must be infered as uniform).

***

Inspiration from Huffman encoding:

When the frequency distribution of the characters is non-uniform, we can use variable-length encoding to better compress the overall encoding length.

***

=> When frequency of access if non-uniform, the perfectly balanced BST **NEED NOT** be the best BST.

i.e., You might want to have a possibly unbalanced BST, with the more frequently accessed objects closer to the root, to get a better overall search time.

**Input:**

Items 1, 2, …, $n$ (assume in sorted order), with positive frequencies $p_1$, $p_2$, …, $p_n$

**Output:**

Compute a valid BST that minimize the **weighted** search time (WST):
$$
C(T) = \Sigma_i p_i * [search \ time \ for \ item-i]
$$
where the search time for item-i is defined to be the number of nodes you have to visit until you find it (inclusive).

url: https://raw.githubusercontent.com/binxxx/Coursera-Algorithms/337dcc8820c6bf003755e790fcc375e7a784079b/3-Greedy Algorithms, Minimum Spanning Tree, and Dynamic Programming/2-Dynamic Programming/5-Optimal BST Problem/Optimal BST Problem.md

repository: binxxx/Coursera-Algorithms

filename: Optimal BST Problem.md

repo_name: binxxx/Coursera-Algorithms


text:
# Uint Array Utils
A small library with useful functions for Solidity Uint arrays.

**Please keep in mind that this library is a work in progress, new things will be added or modified in the future.**

## Installation
npm package will be released later.

For now, simply copy the `UintArrayUtils.sol` file in your contracts folder, import it with `import "./UintArrayUtils.sol"` and use it with `using UintArrayUtils for uint[];`.

Additionally, you may need to link the library to your contract with `deployer.link(UintArrayUtils, YourContract);` in your migration files.

(If you're stuck, take a look at the project files, you'll find a complete example there!)

## Usage
Available functions:
`getMax(uint[] a)`
`getMin(uint[] a)`
`sum(uint[] a)`
`checkDuplicates(uint[] a)`
`checkMatchingValues(uint[] a, uint[] b)`
`concat(uint[] a, uint[] b)`

## Contribution
Feel free to share any ideas to improve this library!

## License
MIT

repository: clemlak/Uint-Array-Utils

repo_name: clemlak/Uint-Array-Utils


text:
# libezsp developper information

## Source code organisation

This repository is organised following DDD conventions.
This means that the core code of the library (domain) is isolated from the code that allows this library to make use of external resources or library (spi) and from translation code that makes information available from this library to other software (api).

* `src/domain` contains most of the library code (EZSP/ASH encoding/decoding and protocol sequence implementation)
* `src/spi` contains the adapters for platform-specific implementations of timers and serial port access
* `src/spi/serial` contains the concrete implementations of an adapter to read/write on the serial port for Linux and Windows (using libserialcpp)
* `src/spi/cppthreads` contains the concrete implementation of timers using C++11 threads
* `src/spi/mock-uart` contains a framework to emulate a serial port for unit testing
* `src/spi/raritan` contains the concrete implementations of adapters for the Raritan framework (using selectors and an event-driven main loop)
* `src/spi/console` contains the concrete implementations of a console logger
* `src/example` contains the code for a sample demo program to read and report sensor values from a zigbee network
* `src/tests` contains code for automatic unit testing

SPI connectors implement a concrete implementation that complies to a specified interface declared in interface headers (.h header files which filename starts with a capital I).
This allows dependency inversion paradigm, where the connector depends on the library, rather than the library depends on the underlying connectors. Connectors then become interchangeable, and we use this method a lot to abstract the library from the services it uses (a version of these services are using the Raritan framework, another version is independent from the Raritan framework and can run outside of it).

## SPI interface definition

* spi/ITimer.h and spi/ITimerFactory.h

  Abstract interface to which must conforms implementations of classes that handle timed callbacks and factory classes that generate the associated ITimer objects

  Concrete implementation in the raritan framework:
  * spi/raritan/RaritanTimer.{h,cpp}
  * spi/raritan/RaritanTimerFactory.{h,cpp}

  Concrete implementation using C++ threads:
  * spi/cppthreads/CppThreadsTimerFactory.{h,cpp}
  * spi/cppthreads/CppThreadsTimer.{h,cpp}

* spi/ILogger.h

  Abstract interface to which must conforms implementations of classes that log debug/warning/error messages

  Concrete implementation in the raritan framework:
  * spi/raritan/RaritanLogger.{h,cpp}

  Concrete implementation that outputs messages on the system console:
  * spi/console/ConsoleLogger.{h,cpp}

* spi/IAsyncDataInputObserver.h

  Abstract interface to which must conforms implementations of classes that get asynchronous notifications on incoming data
  This is an exception, it is not a DIP implementation, the concrete implementation lies inside the applicative code (inside the library)

* spi/IUartDriver.h

  Abstract interface to which must conforms concrete implementations of classes that manipulate UARTs

  Concrete implementation in the raritan framework:
  * spi/raritan/RaritanUartDriver.{h,cpp}

  Concrete implementation using libserial:
  * spi/serial/SerialUartDriver.{h,cpp}

  Concrete implementation of a robotized emulated serial port for unit testing:
  * spi/mock-uart/MockUartDriver.{h,cpp}

## Generating doxygen documentation

In order to generate the source code documentation out of the doxygen tags contained inside the code, run the following command:
```
cd /path/to/libezsp
doxygen Doxyfile.dev
```

The resulting doc will be available via a browser by opening `~/libezsp/doc/html/index.html

## Running automated unit tests

Unit tests are located under `src/tests`, and are grouped by families in common .cpp files.

Unit tests can be run inside the cpputest framework (requires installing cpputest) or as a standalone executable (using the lightweight unit test utilities locateds in `src/tests/TestHarness.h`).
When run as standalone, an executable named `test_runner` will be compiled and will contain all the code to run for automated unit testing.

In order to both compile and run unit tests, run the following command:
```
cd src/tests
make check
```

If all tests pass, the above command will succeed with exit code 0.

repository: Openwide-Ingenierie/libezsp

repo_name: Openwide-Ingenierie/libezsp


text:
# About

JavaScript includes the capabilities for object-oriented programming ([OOP][wiki-oop]).
In OOP, you want to create objects (_instances_) from "templates" (_classes_) so that they include certain data and functionality.
The data properties are called _fields_ in the OOP context, the function properties are called _methods_.

JavaScript did not have classes at all before they were added to the language specification in 2015 but allowed for object-oriented programming using prototype-based inheritance.
And even though a `class` keyword is available nowadays, JavaScript is still a _prototype-based_ language.

To understand what it means to be a prototype-based language and how JavaScript actually works, we will go back to the time when there were no classes.

## Prototype Syntax

### Constructor Function

In JavaScript, the template (class) is facilitated by a regular function.
When a function is supposed to be used as such a template, it is called a _constructor function_ and the convention is that the function name should start with a capital letter.
Instances (objects) are derived from the template using the `new` keyword when invoking the constructor function.

```javascript
function Car() {
  // ...
}

const myCar = new Car();
const yourCar = new Car();
```

It is important to note that in JavaScript, the instances and the constructor function keep a relationship to each other even after the instances were created.
Every instance object includes a hidden, internal property referred to as `[[prototype]]` in the language specification.
It holds a reference to the value of the `prototype` key of the constructor function.
Yes, you read that correctly, a JavaScript function can have key/value pairs because it is also an object behind the scenes.

Since 2015, `[[prototype]]` can be accessed via `Object.getPrototypeOf()`.
Before that, it was accessible via the key `__proto__` in many environments.

Do not confuse the prototype of an object (`[[prototype]]`) with the `prototype` property of the constructor function.

```exercism/note
To summarize:

- Constructors in JavaScript are regular functions.
- Constructing a new instance creates an object with a relation to its constructor called its _prototype_.
- Functions are objects (callable objects) and therefore they can have properties.
- The constructor's (function) `prototype` property will become the instance's _prototype_.
```

### Instance Fields

Often, you want all the derived objects (instances) to include some fields and pass some initial values for those when the object is constructed.
This can be facilitated via the [`this` keyword][mdn-this].
Inside the constructor function, `this` represents the new object that will be created via `new`.
`this` is automatically returned from the constructor function when it is called with `new`.

That means we can add fields to the new instance by adding them to `this` in the constructor function.

```javascript
function Car(color, weight) {
  this.color = color;
  this.weight = weight;
  this.engineRunning = false;
}

const myCar = new Car('red', '2mt');
myCar.color;
// => 'red'
myCar.engineRunning;
// => false
```

### Instance Methods

Methods are added via the `prototype` property of the constructor function.
Inside a method, you can access the fields of the instance via `this`.
This works because of the following general rule.

> When a function is called as a method of an object, its `this` is set to the object the method is called on. [^1]

```javascript
function Car() {
  this.engineRunning = false;
  // ...
}

Car.prototype.startEngine = function () {
  this.engineRunning = true;
};

Car.prototype.addGas = function (litre) {
  // ...
};

const myCar = new Car();
myCar.startEngine();
myCar.engineRunning;
// => true
```

### The Prototype Chain

`myCar` in the example above is a regular JavaScript object and if we would inspect it (e.g. in the browser console), we would not find a property `startEngine` with a function as a value directly inside the `myCar` object.
So how does the code above even work then?

The secret here is called the _prototype chain_.
When you try to access any property (field or method) of an object, JavaScript first checks whether the respective key can be found directly in the object itself.
If not, it continues to look for the key in the object referenced by the `[[prototype]]` property of the original object.
As mentioned before, in our example `[[prototype]]` points to the `prototype` property of the constructor function.
That is where JavaScript would find the `startEngine` function because we added it there.

```javascript
function Car() {
  // ...
}

Car.prototype.startEngine = function () {
  // ...
};
```

And the chain does not end there.
The `[[prototype]]` property of `Car.prototype` (`myCar.[[prototype]].[[prototype]]`) references `Object.prototype` (the `prototype` property of the `Object` constructor function).
It contains general methods that are available for all JavaScript objects, e.g. `toString()`.
The `[[prototype]]` of `Object` is usually `null` so the prototype chain ends there.
In conclusion, you can call `myCar.toString()` and that method will exist because JavaScript searches for that method throughout the whole prototype chain.
You can find a detailed example in the [MDN article "Inheritance and the prototype chain"][mdn-prototype-chain-example].

```exercism/caution
Note that the prototype chain is only travelled when retrieving a value.
Setting a property directly or deleting a property of an instance object only targets that specific instance.
This might not be what you would expect when you are used to a language with class-based inheritance.
```

### Dynamic Methods (Adding Methods to All Existing Instances)

JavaScript allows you to add methods to all existing instances even after they were created.

We learned that every instance keeps a reference to the `prototype` property of the constructor function.
That means if you add an entry to that `prototype` object, that new entry (e.g. a new method) is immediately available to all instances created from that constructor function.

```javascript
function Car() {
  this.engineRunning = false;
}

const myCar = new Car();
// Calling myCar.startEngine() here would result in "TypeError:
// myCar.startEngine is not a function".

Car.prototype.startEngine = function () {
  this.engineRunning = true;
};

myCar.startEngine();
// This works, even though myCar was created before the method
// was added.
```

In theory, dynamic methods can even be used to extend the functionality of built-in objects like `Object` or `Array` by modifying their prototype.
This is called _monkey patching_.
Because this change affects the whole application, it should be avoided to prevent unintended side effects.
The only reasonable use case is to provide a [polyfill][wiki-polyfill] for a missing method in older environments.

## Class Syntax

Nowadays, JavaScript supports defining classes with a `class` keyword.
This was added to the language specification in 2015.
On the one hand, this provides syntactic sugar that makes classes easier to read and write.
The new syntax is more similar to how classes are written in languages like C++ or Java.
Developers switching over from those languages have an easier time adapting.
On the other hand, class syntax paves the way for new language features that are not available in the prototype syntax.

### Class Declarations

With the new syntax, classes are defined with the `class` keyword, followed by the name of the class and the class body in curly brackets.
The body contains the definition of the constructor function, i.e. a special method with the name `constructor`.
This function works just like the constructor function in the prototype syntax.
The class body also contains all method definitions.
The syntax for the methods is similar to the shorthand notation we have seen for adding functions as values inside an object, see [Concept Objects][concept-objects].

```javascript
class Car {
  constructor(color, weight) {
    this.color = color;
    this.weight = weight;
    this.engineRunning = false;
  }

  startEngine() {
    this.engineRunning = true;
  }

  addGas(litre) {
    // ...
  }
}

const myCar = new Car();
myCar.startEngine();
myCar.engineRunning;
// => true
```

Similar to function declarations and function expressions, JavaScript also supports [class expressions][mdn-class-expression] in addition to the _class declaration_ shown above.

Keep in mind that behind the scenes, JavaScript is still a prototype-based language.
All the mechanisms we learned about in the "Prototype Syntax" section above still apply.

### Private Fields, Getters and Setters

By default, all instance fields are public in JavaScript.
They can be directly accessed and assigned to.

Adding actual private fields to the language specification is a work in progress, see the [proposal document][proposal-private-fields] for details.

In the meantime, you can make use of the established convention that fields and methods that start with an underscore should be treated as private.
They should never be accessed directly from outside the class.

Private fields are sometimes accompanied by [getters][mdn-get] and [setters][mdn-set].
With the keywords `get` and `set` you can define functions that are executed when a property with the same name as the function is accessed or assigned to.

```javascript
class Car {
  constructor() {
    this._mileage = 0;
  }

  get mileage() {
    return this._mileage;
  }

  set mileage(value) {
    throw new Error(`Mileage cannot be manipulated, ${value} is ignored.`);
    // Just an example, usually you would not provide a setter in this case.
  }
}

const myCar = new Car();
myCar.mileage;
// => 0
myCar.mileage = 100;
// => Error: Mileage cannot be manipulated, 100 is ignored.
```

### Class Fields and Class Methods

In OOP, you sometimes want to provide utility fields or methods that do not depend on the specific instance.
Instead, they are defined for the class itself.
This can be achieved with the `static` keyword.

```javascript
class Car {
  static type = 'vehicle';

  static isType(targetType) {
    return targetType === 'vehicle';
  }
}

Car.type;
// => 'vehicle'

Car.isType('road sign');
// => false
```

### Class-Based Inheritance

Besides the type of [inheritance][wiki-inheritance] along the prototype chain we saw earlier, you can also represent inheritance between classes in JavaScript.
This is covered in the [Concept Inheritance][concept-inheritance].

---

[^1]: `this` Examples - As an object method, MDN. <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this#as_an_object_method> (referenced December 03, 2021)

[wiki-oop]: https://en.wikipedia.org/wiki/Object-oriented_programming
[mdn-prototype-chain-example]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain#inheritance_with_the_prototype_chain
[concept-inheritance]: /tracks/javascript/concepts/inheritance
[mdn-class-expression]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#Class_expressions
[wiki-inheritance]: https://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming)
[proposal-private-fields]: https://github.com/tc39/proposal-private-methods#private-methods-and-fields
[mdn-get]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get
[mdn-set]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set
[wiki-polyfill]: https://en.wikipedia.org/wiki/Polyfill_(programming)
[mdn-this]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this
[concept-objects]: /tracks/javascript/concepts/objects

repository: tejasbubane/xjavascript

repo_name: tejasbubane/xjavascript