text:
# Modern C++: Snippets and Examples

> GitHub Pages with snippets for Modern C++

[![](docs/img/banner.png)](https://alandefreitas.github.io/moderncpp/)

* We often need to copy and paste some snippets to code more productively.
* Snippets can help us when it's not easy to remember all high levels features Modern C++ has to offer.
* This repository contains lots of organized, reusable, and safe snippets for Modern C++.
* All snippets are available in [GitHub pages](https://alandefreitas.github.io/moderncpp/) in a convenient way for copying and pasting.

[EXPLORE THE SNIPPETS HERE](https://alandefreitas.github.io/moderncpp/)

[![Facebook](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&label=Share+on+Facebook&logo=facebook)](https://www.facebook.com/sharer/sharer.php?t=ModernCpp%20Snippets%20and%20Examples&u=https://github.com/alandefreitas/moderncpp/)
[![QZone](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&label=Share+on+QZone&logo=qzone)](http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=https://github.com/alandefreitas/moderncpp/&title=ModernCpp%20Snippets%20and%20Examples&summary=ModernCpp%20Snippets%20and%20Examples)
[![Weibo](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&label=Share+on+Weibo&logo=sina-weibo)](http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=https://github.com/alandefreitas/moderncpp/&title=ModernCpp%20Snippets%20and%20Examples&summary=ModernCpp%20Snippets%20and%20Examples)
[![Reddit](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&label=Share+on+Reddit&logo=reddit)](http://www.reddit.com/submit?url=https://github.com/alandefreitas/moderncpp/&title=ModernCpp%20Snippets%20and%20Examples)
[![Twitter](https://img.shields.io/twitter/url/http/shields.io.svg?label=Share+on+Twitter&style=social)](https://twitter.com/intent/tweet?text=ModernCpp%20Snippets%20and%20Examples&url=https://github.com/alandefreitas/moderncpp/&hashtags=Cpp,Snippets,ModernCpp,ScientificComputing,Examples,Developers)
[![LinkedIn](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&label=Share+on+LinkedIn&logo=linkedin)](https://www.linkedin.com/shareArticle?mini=false&url=https://github.com/alandefreitas/moderncpp/&title=ModernCpp%20Snippets%20and%20Examples)
[![WhatsApp](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&label=Share+on+WhatsApp&logo=whatsapp)](https://api.whatsapp.com/send?text=ModernCpp%20Snippets%20and%20Examples:+https://github.com/alandefreitas/moderncpp/)
[![Line.me](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&label=Share+on+Line.me&logo=line)](https://lineit.line.me/share/ui?url=https://github.com/alandefreitas/moderncpp/&text=ModernCpp%20Snippets%20and%20Examples)
[![Telegram.me](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&label=Share+on+Telegram.me&logo=telegram)](https://telegram.me/share/url?url=https://github.com/alandefreitas/moderncpp/&text=ModernCpp%20Snippets%20and%20Examples)
[![HackerNews](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&label=Share+on+HackerNews&logo=y-combinator)](https://news.ycombinator.com/submitlink?u=https://github.com/alandefreitas/moderncpp/&t=ModernCpp%20Snippets%20and%20Examples)

Table of Contents

- [Quick Start](#quick-start)
  - [How this repository works](#how-this-repository-works)
  - [Why Modern C++](#why-modern-c)
- [Installing C++20](#installing-c20)
  - [Linux / GCC](#linux--gcc)
  - [Mac OS / Clang](#mac-os--clang)
  - [Windows / MSVC](#windows--msvc)
  - [WebAssembly / Emscripten](#webassembly--emscripten)
  - [Interpreter / Cling](#interpreter--cling)
  - [IDEs](#ides)
- [Basic Syntax](#basic-syntax)
  - [Input / Output](#input--output)
  - [Control flow](#control-flow)
  - [Data types](#data-types)
  - [Basic Data Types](#basic-data-types)
  - [Pointers](#pointers)
  - [Functions](#functions)
  - [Files](#files)
- [Algorithms / Data Structures](#algorithms--data-structures)
  - [Date and time](#date-and-time)
  - [Random](#random)
  - [Template](#template)
  - [Algorithm](#algorithm)
  - [Data structures](#data-structures)
  - [Heterogeneous Types](#heterogeneous-types)
- [Programming Paradigms](#programming-paradigms)
  - [Basic Paradigms](#basic-paradigms)
  - [Parallelism](#parallelism)
- [Utilities](#utilities)
  - [Regular Expressions](#regular-expressions)
  - [Networking](#networking)
- [GUIs](#guis)
  - [Build script](#build-script)
  - [Qt](#qt)
  - [OpenGL + SDL](#opengl--sdl)
  - [OpenGL + GLFW](#opengl--glfw)
  - [IMGUI](#imgui)
  - [Webview](#webview)
  - [System tray](#system-tray)
- [Testing](#testing)
  - [Build script](#build-script-1)
  - [Catch2](#catch2)
  - [boost.ut](#boostut)
  - [Source Location](#source-location)
  - [Plots](#plots)
- [CMake Functions](#cmake-functions)
  - [Project Flags](#project-flags)
  - [Target Options](#target-options)
  - [Sanitizers](#sanitizers)
  - [Qt Helpers](#qt-helpers)
- [FAQ](#faq)
- [Get involved](#get-involved)

## Quick Start

### How this repository works

This is how this repository works:

* The [`snippets`](./snippets/CMakeLists.txt) directory has lots of short programs with useful C++20 snippets
* The [`examples`](./examples/CMakeLists.txt) directory has lots of short tasks using these snippets
* [GitHub actions](https://github.com/alandefreitas/moderncpp/actions?query=workflow%3ABuild) ensures all snippets are working on GCC, MSVC, and Clang
* We generate GitHub pages with all snippets by groups of tasks using [mkdocs material](https://squidfunk.github.io/mkdocs-material/) and [mdsplit](https://alandefreitas.github.io/mdsplit/)

**Libraries**

We give preference to libraries in this order:

1. Libraries [supported](https://en.cppreference.com/w/cpp/compiler_support) by most C++ compilers
2. Libraries [accepted](https://timsong-cpp.github.io/cppwp/n4861/) into the C++ standard
3. Libraries [likely to be accepted](https://eel.is/c++draft/) into the next C++ standard
4. Libraries representative of existing practice

**External Libraries**

For external libraries, we also include a short CMake snippet in the build script with:

* [`find_package`](https://cmake.org/cmake/help/latest/command/find_package.html) to find, setup, and link the large external libraries
* [`FetchContents`](https://cmake.org/cmake/help/latest/module/FetchContent.html) to download, build, and link the external library

**Snippets and Examples**

The snippets, as they are, might seem like they are examples in the sense that they are in long files sometimes. What makes them snippets is that, at the source file level, they represent lots of independent short tasks separated by comments. Unlike in the examples, the tasks separated by comments are unrelated. You can just copy and paste the snippets between pairs of comments.

**GitHub Pages**

We generate GitHub pages with all snippets:

* The GitHub pages are generated with [mkdocs material](https://squidfunk.github.io/mkdocs-material/) and [mdsplit](https://alandefreitas.github.io/mdsplit/)
* Snippets organized are categorized by groups of tasks
* Sections are easy to explore, copy, and paste

### Why Modern C++

**Why use C++**

C++ has always been a great language for Scientific Computing, High-Performance Computing, and Data Analysis:

* Most programmers are familiar with its basic syntax;
* It's been among the most popular languages over last 40 years;
* Access to hundreds of thousands of high-performance libraries;
* Performance level [almost no other language](http://tempesta-tech.com/blog/fast-programming-languages-c-cpp-rust-assembly) can achieve;
* Complex abstractions with [zero-overhead](https://en.cppreference.com/w/cpp/language/Zero-overhead_principle);
* [Easy access to parallelism](https://en.cppreference.com/w/cpp/algorithm/execution_policy_tag_t);
* [Numerous compilers](https://www.stroustrup.com/compilers.html) with great [optimization](https://queue.acm.org/detail.cfm?id=3372264) options available;
* Innumerable target platforms, from [microcontrollers](https://www.arduino.cc), to [GPUs](https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html), to [mobile](https://github.com/leetal/ios-cmake), to [webassembly](https://emscripten.org);
* Does not rely on any virtual machine;
* Easy bindings from/to virtually any other programming language ([Python](https://github.com/pybind/pybind11), [Javascript](https://github.com/Chobolabs/jsbind), [PHP](http://www.php-cpp.com), [R](http://www.rcpp.org), [Java](https://www.baeldung.com/jni), [Matlab](https://www.mathworks.com/solutions/matlab-and-c.html), [Rust](https://rust-lang.github.io/rust-bindgen/cpp.html), [Swift](https://medium.com/@anuragajwani/how-to-consume-c-code-in-swift-b4d64a04e989), [Julia](https://github.com/JuliaInterop/CxxWrap.jl), [C](https://isocpp.org/wiki/faq/mixing-c-and-cpp), ... you name it);
* Great tools for [static analysis](https://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis#C,_C++) to avoid bugs;
* Avoids the [two-languages problem](https://www.quora.com/What-is-the-2-language-problem-in-data-science) in scientific computing: one for prototyping and one to reimplement all the work once the experiments are successful;
* No need for special licenses to distribute your compiled code, like it is common in technical languages that rely on virtual machines;
* Allows saving tons of money and extra-security for applications to be run in the cloud or dedicated servers.

**Why use Modern C++**

Many people have move from C++ over the last decade and might not be aware that the Modern C++ ecosystem has evolved to cover almost all use cases that made C++ inconvenient for certain tasks in the past:

* Efficient [interpreters](https://cling.web.cern.ch) with beautiful [IDEs](http://xeus-cling.readthedocs.io);
* Cross-platform [build systems](http://cmake.org), including [microcontrollers](https://www.arduino.cc), [GPUs](https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html), [mobile](https://github.com/leetal/ios-cmake) and [webassembly](https://emscripten.org);
* [Package managers](http://conan.io);
* [Type deduction](https://en.cppreference.com/w/cpp/language/auto);
* [Variant types](https://en.cppreference.com/w/cpp/header/variant);
* [Types for optional data](https://en.cppreference.com/w/cpp/utility/optional);
* Cheap automatic memory management via [smart pointers](https://en.cppreference.com/w/cpp/memory/shared_ptr);
* Numerous [data structures](https://en.cppreference.com/w/cpp/container) out of the box;
* [Modules](https://en.cppreference.com/w/cpp/language/modules);
* [Concepts](https://en.cppreference.com/w/cpp/language/constraints);
* [Functional programming](https://en.cppreference.com/w/cpp/language/lambda);
* Convenient [meta programming](https://www.modernescpp.com/index.php/c-core-guidelines-programming-at-compile-time-with-constexpr);
* [Structured bindings](https://en.cppreference.com/w/cpp/language/structured_binding) and [tuples](https://en.cppreference.com/w/cpp/utility/tuple);
* [Ranges](https://en.cppreference.com/w/cpp/ranges);
* [Move semantics](https://en.cppreference.com/w/cpp/language/move_assignment).

By incentivizing and highlighting modern [C++ features in instructional content](https://docs.microsoft.com/en-us/cpp/cpp/welcome-back-to-cpp-modern-cpp?view=msvc-160), it's also possible to combine the familiar syntax of C and old C++ to achieve high levels of abstraction with a gentle learning curve.

## Installing C++20

### Linux / GCC

Many operating systems don't come with a C++20 compiler by default. Follow these instructions to install C++20.

Update GCC:

```bash
sudo apt install build-essential
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt install gcc-10
sudo apt install g++-10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10
```

Set your default compiler with:

```bash
update-alternatives --config g++
```

### Mac OS / Clang

Many operating systems don't come with a C++20 compiler by default. Follow these instructions to install C++20.

Download a [recent version](https://releases.llvm.org/download.html) of Clang.

```bash
curl --output clang.tar.xz -L https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/clang+llvm-11.0.0-x86_64-apple-darwin.tar.xz
mkdir clang
tar -xvJf clang.tar.xz -C clang
```

Copy the files to `usr/local/`:

```bash
cd clang/clang+llvm-11.0.0-x86_64-apple-darwin
sudo cp -R * /usr/local/
```

Let CMake know that's the compiler you want to use.

If you want this to be your default compiler, you can set the `CXX` environment variable:

```bash
export CXX=/usr/local/bin/clang++
```

If you want to use this compiler in a single project, run CMake with these options:

```bash
-DCMAKE_C_COMPILER=/usr/local/bin/clang -DCMAKE_CXX_COMPILER=/usr/local/bin/clang++
```

Or tell you IDE to pass these options to CMake:

![](docs/img/set_compiler.png)

### Windows / MSVC

Many operating systems don't come with a C++20 compiler by default. Follow these instructions to install C++20.

Update your [Visual Studio](https://visualstudio.microsoft.com) Compiler.

The most recent version of Visual Studio should include C++20.

!!! warning "Help wanted"
    We still don't know of a script for installing C++20 on Windows from the terminal.

    This would be especially useful for our [build workflow](./.github/workflows/build.yml), which has not been testing MSVC since we moved to C++20.

    Please let us know or open a PR if you know of such a script.

### WebAssembly / Emscripten

If you are programming for the web, a common option for C++ and WebAssembly is [emscripten](https://emscripten.org/docs/getting_started/index.html).

You can install emscripten from most package managers for [Windows](https://chocolatey.org/packages/emscripten), [Linux](https://pkgs.org/search/?q=emscripten), or [Mac OS](https://formulae.brew.sh/formula/emscripten). You can also follow the [instructions](https://emscripten.org/docs/getting_started/downloads.html) on their website to build from source.

Then follow [these instructions](https://emscripten.org/docs/getting_started/Tutorial.html) to compile your first "Hello World!" for the web. Your C++ program will become this beautiful webpage:

![](docs/img/hello_emscripten.png)

### Interpreter / Cling

If you are using C++ for scientific computing or learning C++, it's often useful to have a C++ interpreter for short experiments.

You can install Cling from most package managers for [Linux](https://pkgs.org/download/cling) or [Mac OS](https://formulae.brew.sh/formula/cling). You can also follow the [instructions](https://root.cern/cling/cling_build_instructions/) on their website to download the binaries or build it from source.

Although you can use `cling` directly, it is much more convenient to use the interpreter as a Jupyter notebook kernel. You can follow [these instructions](https://jupyter.org/install.html) to install Jupyter Lab, and [these instructions](https://xeus-cling.readthedocs.io/en/latest/installation.html) to install the `xeus-cling` kernel.

This creates a beautiful environment for playing with C++ interactively:

![](docs/img/hello_cling.png)

### IDEs

These are the most common IDEs and text editors [most commonly used](http://blog.davidecoppola.com/2018/02/market-share-most-used-c-cpp-ides-in-2018-statistics-estimates/) for C++ programming:

| IDE or Text Editor | Users | Notes             |
|--------------------|-------|-------------------|
| Visual Studio      | 28%   | Windows           |
| Vim                | 17%   | (Text Editor)     |
| Qt Creator         | 12%   | Best for Qt Users |
| Visual Studio Code | 10%   |                   |
| CLion              | 9%    |                   |
| Emacs              | 7%    | (Text Editor)     |
| Xcode              | 4%    | Mac OS            |
| Eclipse            | 4%    |                   |
| Others             | 9%    |                   |

!!! warning
    These numbers are constantly changing.

## Basic Syntax

### Input / Output

#### Build script

```cmake
--8<-- "snippets/input_output/CMakeLists.txt"
```

#### Hello World

```cpp
--8<-- "snippets/input_output/hello_world.cpp"
```

#### Input

```cpp
--8<-- "snippets/input_output/cin.cpp"
```

#### Output

```cpp
--8<-- "snippets/input_output/printing.cpp"
```

Related examples:

* [`examples/datetime/flushtime.cpp`](examples/datetime/flushtime.cpp)

!!! info "Some people told me `std::endl` is evil. Is that true?"

    The reason people say that is because std::endl costs more than `'\n'`. But it costs more because it does not do the same thing. It exists for a reason. There are [some situations](https://en.cppreference.com/w/cpp/io/manip/flush) where it makes sense to flush the stream.

    On the other hand, some people will simply say `std::endl` is evil, but this is a little misleading. They are usually generalizing from benchmarks that explore specific edge cases to prove a point. These benchmarks are usually meant to show the difference between `'\n'` and `std::endl` and not as proof that `std::endl` is evil per se, or significantly more expensive than `'\n'` in all possible use cases.

    In the end, I can't tell which is always better because they do different things. But I can tell you their differences and their cost. So here are some differences:

    * The definitions:

        * The buffer: The streams usually store the data in a buffer, which is meant to make things more efficient. The buffer reduces the number of trips to their final destination.

        * Flushing: Once the buffer is full, then the data goes to its final destination, which is usually the console or a file. For convenience, when that happens, we say the stream is flushing the buffer.

        * Commands: C++ gives you the option to flush what is in the buffer immediately or you might wait for the stream to flush automatically according to some internal heuristic.

        * Automatically flushing: This heuristic is usually when the buffer is full, or when the buffer is about to be destructed. Sometimes, it flushes automatically when it sees a new line. That depends on the kind of stream.

    * What the commands mean: Flushing does have a semantic meaning different from `'\n'`, and this might be a good convention for some pieces of code, especially when you want to make sure you will see the output immediately. Particularly for `std::cout`:
        * `'\n'` means "put a newline in the buffer"
        * `std::flush` means "show me what's in the buffer now"
        * `std::endl` means "put a newline in the buffer and then show me what's in the buffer now"
    * Their cost: By the definition above, std::endl logically costs more than `'\n'` because it's doing what `'\n'` does plus one more thing. Some people often use examples and benchmarks flushing files often as evidence that `std::endl` is evil per se. But there's a catch here:
        * There's very little reason to flush to files because we don't usually care if the data gets in the file a little later.
        * Flushing to files is much more comparatively expensive than flushing to `std::cout`.
        * If you benchmark this difference, you will see the time difference of flushing std::cout to the console (not files!) is negligible:
            * *GCC -O2: Flush: 2.32234e-06 / Don't Flush: 2.26303e-06*
            * *Clang -O2: Flush: 2.33343e-06 / Don't Flush: 2.23031e-06*
        * Besides this small difference flushing to console is much more likely to be useful than flushing to a file.
        * Also, this difference is almost certainly even smaller in a real application. Almost no application is spending more time flushing than calculating things to flush. Unless it's a flushing benchmark like the one above.

    In the end, flushing to a file is almost always a bad idea. Flushing to the console won't probably have any significant impact. In that second case, if not flushing can cause you any problems, just flush.

#### Format

```cpp
--8<-- "snippets/input_output/format.cpp"
```

#### Tabulate

```cpp
--8<-- "snippets/input_output/tabulate.cpp"
```

!!! note
    While this library is not very representative of existing practice, we use it in lots of examples to report results. An alternative could be snippets with `std::setw` and `std::setfill` to manually create tables.

 They are *not* about how to achieve the tasks in these functions. The tasks are just placeholders and the C++ STL already provides much better alternatives for most of these [algorithms](#basic-algorithms).

```cpp
--8<-- "snippets/functions/functions.cpp"
```

Related examples:

* [`examples/functions/recursive_bench.cpp`](examples/functions/recursive_bench.cpp)

#### Lambda

```cpp
--8<-- "snippets/functions/lambda.cpp"
```

### Files

#### Build script

```cmake
--8<-- "snippets/files/CMakeLists.txt"
```

FindFilesystem.cmake:

```cmake
--8<-- "cmake/FindFilesystem.cmake"
```

#### File streams

```cpp
--8<-- "snippets/files/files.cpp"
```

#### Filesystem

```cpp
--8<-- "snippets/files/filesystem.cpp"
```

## Algorithms / Data Structures

### Date and time

#### Build script

```cmake
--8<-- "snippets/datetime/CMakeLists.txt"
```

#### Clock

```cpp
--8<-- "snippets/datetime/clock.cpp"
```

Related examples:

* [`examples/datetime/flushtime.cpp`](examples/datetime/flushtime.cpp)

#### Datetime

```cpp
--8<-- "snippets/datetime/datetime.cpp"
```

### Random

#### Build script

```cmake
--8<-- "snippets/random/CMakeLists.txt"
```

#### Random

```cpp
--8<-- "snippets/random/random.cpp"
```

#### PCG

```cpp
--8<-- "snippets/random/pcg.cpp"
```

### Template

#### Build script

```cmake
--8<-- "snippets/templates/CMakeLists.txt"
```

#### Template function

```cpp
--8<-- "snippets/templates/template_functions.cpp"
```

#### Template aliases

```cpp
--8<-- "snippets/templates/template_alias.cpp"
```

#### Concepts

```cpp
--8<-- "snippets/templates/concepts.cpp"
```

FindConcepts.cmake:

```cmake
--8<-- "cmake/FindConcepts.cmake"
```

#### SFINAE

```cpp
--8<-- "snippets/templates/sfinae.cpp"
```

### Algorithm

#### Build script

```cmake
--8<-- "snippets/algorithm/CMakeLists.txt"
```

#### Searching

!!! hint

    The standard [algorithms](#basic-algorithms) for searching elements in a container are:

    * `std::find` for linear search
    * `std::lower_bound` and `std::upper_bound` for binary search

    These snippets include extra functions describing how these algorithms can be implemented. They are mostly relevant for people studying these algorithms for the first time.

```cpp
--8<-- "snippets/algorithm/searching.cpp"
```

#### Sorting

!!! hint

    The standard [algorithms](#basic-algorithms) for sorting containers are `std::sort` and `std::stable_sort`.

    These snippets include extra functions describing how these tasks can be implemented with many other classic sorting algorithms. They are mostly relevant for people studying sorting algorithms for the first time.

```cpp
--8<-- "snippets/algorithm/sorting.cpp"
```

#### Basic Algorithms

```cpp
--8<-- "snippets/algorithm/algorithms.cpp"
```

#### Ranges

```cpp
--8<-- "snippets/algorithm/ranges.cpp"
```

### Data structures

#### Build script

```cmake
--8<-- "snippets/data_structures/CMakeLists.txt"
```

#### Sequential Containers

```cpp
--8<-- "snippets/data_structures/sequential_containers.cpp"
```

#### Associative Containers

```cpp
--8<-- "snippets/data_structures/associative_containers.cpp"
```

#### Memory resource

```cpp
--8<-- "snippets/data_structures/memory_resource.cpp"
```

FindPMR.cmake:

```cmake
--8<-- "cmake/FindPMR.cmake"
```

!!! warning "PMR"

    Not all compilers implement PMR yet, even though it's a C++17 feature. We need the CMake script [`FindPMR.cmake`](cmake/FindPMR.cmake) to identify if your compiler implements it.

 Are the snippets examples?**

The complete examples are in the [`examples`](./examples) directory, but they not explicitly replicated in the docs because they are much longer than the snippets.

**What's the difference between snippets and examples?**

Examples are often long and don't represent independent tasks you can copy and paste. Snippets represent independent
tasks between pairs of comments that you can copy and paste.

**Shouldn't the snippet files be short files?**

The snippets could go into a new category level and we could separate them at their lowest level by file, but that would
make them difficult to explore if the resolution is too high, like 3-4 lines of code per file. Also, because snippets
have pre-conditions and post-conditions, it would make it much harder to test all snippets.

**Why not get my snippets directly from cppreference or cplusplus.com?**

The cppreference is not meant for snippets and this repository is not meant to be a reference for the C++ standard. Some
implications are:

* The snippets:
    * Meant to list the commands you most often need in a library.
    * Lots of independent tasks for copying and pasting
    * Include corresponding build scripts when something more complex is required
    * Include external libraries when it's existing practice
    * Organized roughly in the order someone learning C++ might need them
* The examples in cppreference or cplusplus.com:
    * Meant to make points about the internals of the libraries.
    * A single task meant to prove a point
    * Has nothing to do with build scripts
    * Has nothing to do with external libraries
    * Mix simple and complex concepts to make a point

**Why do you use `std::endl` so much in the snippets? Isn't it evil?**

The snippets usually use `std::endl` instead of `'\n'`:

* Flushing *does* have a [semantic meaning](https://en.cppreference.com/w/cpp/io/manip/flush) different from `'\n` which is a nice convention for small snippets (please show me what's in the buffer vs. put a newline in the buffer)
* Most snippets require creating variables first and using them later so that we can test the snippets with GitHub Actions. The flushing part is not what you are going to copy and paste in a snippet.
* The time difference of flushing `std::cout` to the console (not files!) is [negligible](./examples/datetime/flushtime.cpp)
* Almost no application is spending more time flushing than calculating things to flush. Unless it's a flushing benchmark.

## Get involved

* After getting started with this library, please complete this [survey](http://www.alandefreitas.com/survey/alandefreitas/moderncpp) to let us know how we can improve your experience.
* Discussions are concentrated on our GitHub [discussions](https://github.com/alandefreitas/moderncpp/discussions) page. Don't refrain from asking questions and proposing ideas.
* If you are a programmer with good ideas, please [share](https://github.com/alandefreitas/moderncpp/discussions/new) these ideas with us.
* Academic collaboration is more than welcome.

**Contributing**

Feel free to contribute with new snippets to this repository. For complex features and changes, consider [getting feedback](https://github.com/alandefreitas/moderncpp/discussions/new) from the community first.

There are many ways in which you can contribute to this library:

* Testing the library in new environments
* Contributing with interesting snippets and examples
* Finding problems in the documentation
* Finding bugs in general
* Whatever idea seems interesting to you

The only thing we ask you is to make sure your contribution is not destructive. Some contributions in which we are not interested are:

* "I don't like this optional feature so I removed/deprecated it"
* "I removed this feature to support older versions of C++" but have not provided an equivalent alternative. This repository is focused on Modern C++.
* "I removed this feature so I don't have to install/update ______" but have not provided an equivalent alternative
* "I'm creating this high-cost promise that we'll support ________ forever" but I'm not sticking around to keep that promise

In doubt, please open a [discussion](https://github.com/alandefreitas/moderncpp/discussions) first.

**Guidelines**

If contributing with code, please leave the pedantic mode ON (`-DBUILD_WITH_PEDANTIC_WARNINGS=ON`), use [cppcheck](http://cppcheck.sourceforge.net/), and [clang-format](https://clang.llvm.org/docs/ClangFormat.html).

    Example: CLion

![CLion Settings with Pedantic Mode](docs/img/pedantic_clion.png)

If contributing to the documentation, please edit [`README.md`](README.md) directly, as the files in this documentation are automatically generated with [mdsplit](https://github.com/alandefreitas/mdsplit).

repository: blockspacer/moderncpp

repo_name: blockspacer/moderncpp


text:
# Koerper

> Körper, from Middle High German, from Latin *corpus*, meaning *body*.

Koerper provides a virtual DOM interface, based on [Wizdom][], that implements
an additional "body" node type and proxies attributes and event listeners
through the actual document.
Body nodes enable encapsulation of a region within a document without
necessitating a container element.
This enables [Gutentag][] to farm out portions of its actual document to
components, giving those components great flexibility to determine the shape of
their content, simultanously allowing components to be composed with any
structure.
This is particularly useful for components that do not need a container element,
like repeat and reveal tags, as well as components that need to be peers in the
flex-box model.

[Wizdom]: https://github.com/gutentags/wizdom
[Gutentag]: https://github.com/gutentags/gutentag

## Installation

```
npm install --save koerper
```

## Examples

Koerper provides a Document constructor that accepts an element from the actual
document.
The virtual document will control the content of the actual node.

```js
var Document = require("koerper");
var document = new Document(window.document.body);
```

The document has a `createBody()` method that will return an instance of the new
body node type.

```js
var body = document.createBody();
```

Body elements can be added and removed from the virtual document, and their
content will be added or removed from their corresponding position in the actual
document.

```js
body.appendChild(document.createTextNode("Guten Tag, Welt!"));
var em = document.createElement("em");
em.appendChild(body);
document.documentElement.appendChild(em);
```

Body elements can contain deeply nested body elements and retain the ability to
add and remove their children from the actual document.

```js
var subBody = document.createBody();
body.appendChild(subBody);
```

Because body nodes do not introduce container elements, you can even interpolate
text on the actual document.

```js
var body = document.createBody();
var greet = document.createTextNode("Guten Tag");
var who = document.createTextNode("Welt");
body.appendChild(greet);
body.appendChild(document.createTextNode(", ");
body.appendChild(who);
body.appendChild(document.createTextNode("!");
document.documentElement.appendChild(body);
```

And you can insert or remove the body within another body.

```js
var quoted = document.createBody();
quoted.appendChild(document.createTextNode("\""));
quoted.appendChild(body);
quoted.appendChild(document.createTextNode("\""));

// later ...
quoted.removeChild(body);
```

## Copyright and License

Copyright (c) 2015 Kristopher Michael Kowal and contributors.
All rights reserved.
MIT License.

license: MIT

repository: gutentags/koerper

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: gutentags/koerper


text:
# Never Lost
if you are tired of looking for your ip and doing _ifconfig_ and getting sometimes a big response like this

```bash
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
	inet6 ::1 prefixlen 128
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
	inet <IP_ADDRESS> netmask 0xff000000
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	ether 34:15:9e:02:5b:24
	media: autoselect
	status: inactive
fw0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 4078
	lladdr 34:15:9e:ff:fe:02:5b:24
	media: autoselect <full-duplex>
	status: inactive
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	ether f8:1e:df:e5:17:d9
	inet6 fe80::fa1e:dfff:fee5:17d9%en1 prefixlen 64 scopeid 0x6
	inet <IP_ADDRESS> netmask 0xffffff00 broadcast <IP_ADDRESS>
	media: autoselect
	status: active
vmnet1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	ether 00:50:56:c0:00:01
	inet <IP_ADDRESS> netmask 0xffffff00 broadcast <IP_ADDRESS>
vmnet8: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	ether 00:50:56:c0:00:08
	inet <IP_ADDRESS> netmask 0xffffff00 broadcast <IP_ADDRESS>
```

and would like less complicated, like this

```bash
nlost
```
![nlost growl sample](http://cl.ly/image/0J0M2q1W0h0F/Screen%20Shot%202013-02-19%20at%2013.11.07.png "nlos Growl Sample")

or would like to output the buffer to your clipboard using pbcopy (_warning as this will replace everything on your current clipboard_)

```bash
nlost pb
-> WIFI: <IP_ADDRESS>
nlost pb wifi
-> <IP_ADDRESS>
```
## USAGE
#### Growl Sample
```bash
nlost
```
#### pbcopy Samples
```bash
nlost pb
nlost pb eth
nlost pb wifi
```

## INSTALLATION
First make sure you have something on your path

```bash
echo $PATH -> /opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
```
it should output something similar to the above, now the next part depends on your preferences, my favorite place to store my scripts is on /usr/local/bin (if you don't know or don't have a preference then just use the script below)

```bash
git clone git://github.com/mrpollo/Never-Lost.git Never-Lost | sudo ln -sv Never-Lost/nlost /usr/local/bin/nlost
```
_if you need further assistance just email me_<EMAIL_ADDRESS>
## REQUIREMENTS
### OSX:
_OSX_ is required to run initially but support for other OS's will be added in the future
### Growl (_growlnotify_):
requires that you previously installed _'growlnotify'_ Growl and _growlnotify_ can be found on their website [http://growl.info/](http://growl.info/downloads#generaldownloads)
please see them for help installing or using
### pbcopy
pbcopy comes standard on OSX since 10.3

repository: mrpollo/Never-Lost

repo_name: mrpollo/Never-Lost


text:
**GRUNT AND BOWER**

<b>npm</b>

npm in Node Package Manager(npm). It is painful to fetch all the dependency files one after the other.
So, we use npm to install all the packages in one shot.

    STEP 1:
        visit https://nodejs.org/en/download/ can download the nodejs.
        This will install npm and also, put the node and npm in our Environment variable's PATH location.

    STEP 2:
        to create a project from scratch, we need to create 'package.json'.
        this is an entry point for npm to install all the packages.

            npm init

        follow the steps required when you execute the above command.

    ***WE NEED TO DO THIS ONLY ONCE PER PROJECT***

        sample:
            {
              "name": "loginportalapp",
              "version": "1.0.0",
              "description": "this is a angular class dated 01/02/2017",
              "author": "Srikar Shastry",
              "license": "MIT",
              "dependencies": {
                "bower": "^1.8.0",
                "grunt": "^1.0.1"
              },
              "devDependencies": {
                "grunt-contrib-jshint": "^1.1.0"
              }
            }

    STEP 3:
        We need to add node_modules to our gitignore file so that it is not getting uploaded to our repo.
        Create a '.gitignore' file and all the relative path of 'node_modules' inside that file.

    STEP 4:
        Visit https://www.npmjs.com/ and search for packages. Once you find the exact name, use the command:

            npm install <package name> --save
                        or
            npm install -s <package name>

        The above command will install the <package name> in the local project as well as adds an entry in our package.json file.

    *** **REMEMBER npm SHOULD ONLY BE USED TO INSTALL DEPENDENCIES NOT THE WEB PACKAGES LIKE ANGULAR, JQUERY, ETC.** ***

    STEP 5:
        There are certain packages that we need at a global level so that we can access the same packages to all the projects in our machine.
        such dependencies (NOT DEVDEPENDENCIES) are needed to be installed at a global level.
        to install these packages we simply run:

            npm install <package name> --global
                        or
            npm install -g <package name>

        **We need to install the same global <package name> locally.

__________________________________________________________________________________________________________________________________

**Bower**

Bower is a web package manager. This means that the packages related to UI development like angular, jquery, bootstrap, backbonejs, etc. can be installed from bower.
Bower does not have any packages related to server side development.

    Step 1:
        To install bower, we need npm and we execute this command:

            npm install -g bower
                    &
            npm install bower --save

    Step 2:
        Once the above commands are executed, we now can run bower from any location inside our terminal
        To install angular components, we simply run the command:

            bower install angular --save

_______________________________________________________________________________________________________________________________

**YEOMAN GENERATORS**

Over the time, we have become so lazy and fat that we do not have time and patience to construct the project from scratch.
So, some geniuses came up with an automation tool to install the entire project including the dependency components like grunt, bower, angular, jquery, etc.
This automation tool is yeoman generator.

    Step 1:
        To install yeoman, simply run this command:

            npm install -g yo

    Step 2:
        Search for generators from this url: http://yeoman.io/generators/
        For this example, we are using 'angular generator'
        To install it, simply run this command:

            npm install -g generator-angular

    Step 3:
        Once all the components are ready to be executed, we run the next command:

            yo angular

        Follow the on screen instructions by carefully reading the instructions.

    Step 4:
        Just for safe precaution, we delete 'node_modules' and 'bower_components' if installed.
        Then, we run the following commands:

            npm install
                &
            bower install

        This will install all the packages needed for our project

    Step 5:
        By this time, all the dependencies and devDependencies are installed. So, we can execute our task runner.
        a. To build the UI, we run:

            grunt build

        b. To start the server and deploy the code, we run:

            grunt serve

        c. To run the production(minified) version of the code, we run:

            grunt serve:dist

        Now, the default should open and our application will run @ http://localhost:9000

    *** REMEMBER NOT TO CLOSE THE TERMINAL IN WHICH WE ARE RUNNING, grunt server, COMMAND.


text:
---
published: true
layout: post
code: 1.1.3
tags: PHYA1
category: physics
summary: A summary of antimatter and photons
title: "Particles, antiparticles, and photons"
---

# Antiparticles
For every single kind of subatomic particle, there is an **antiparticle** with the following properties:

+ Equal rest mass.
+ Opposite charge.
+ Annihilates it and the particle when they meet, and convert their masses into photons.

## Fundamental antiparticles
+ **Positrons** ($_{-1}^0\beta$) are the antiparticle to **electrons**, as they have opposite charge ($ -e $) and equal rest mass.
+ **Antiprotons** ($\overline{p}$) are the antiparticle to **protons**, as they have opposite charge ($ -e $ but equal rest mass.
+ **Antineutrons** ($\overline{n}$) are the antiparticle to **neutrons**, as they have opposite charge (still $ 0 $) but equal rest mass.
+ **Antineutrinos** ($\overline{v}$) are the antiparticle to **neutrinos**, as they have opposite charge (still $ 0 $) but equal rest mass.

# Photons
Electromagnetic waves are emitted in packets that leave the source in various different directions; these packets are known as **photons**. Their energy can be calculated by:

$$ E_p = hf = \frac{hc}{f} $$

## The phlanck constant
$$ h = 6.63 \times 10^-34 Js $$


text:
# Deploying declaratively with the Kubernetes dashboard

The Kubernetes dashboard helps to visualize and understand what is happening with your deployments and the cluster itself.

We're going to install it as an example deploying declaratively in Kubernetes.

!!! warning

    The instructions below are suitable for a **local development environment only**!

    This article from Heptio is essential reading for [securing the Kubernetes dashboard](https://blog.heptio.com/on-securing-the-kubernetes-dashboard-16b09b1b7aca).

## Step 1. Install it

Let's use the `kubectl` (Kube Control) CLI tool to install a the required objects for the dashboard.

    kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml

By the end of the training, you will understand this entire file.

## Step 2. Kubernetes dashboard access

Even for our development environment, we don't want to expose the dashboard publicly, so we have two simple options:

    kubectl proxy

or

    kubectl port-forward

I prefer the `kubectl port-forward` option as when using Docker for Desktop, you access it at localhost:<port>.

`kubectl proxy` may be better if you need to access other internal services, or if the self-signed certification is giving you problems.

It's up to you and below, we'll use both.

### Step 2.1 Kubernetes Dashboard with Port Forwarding

The `kubectl port-forward` command needs the Pod name, the host machine port, and the local port.

!!! note:
    The following code presumes the existence of bash so if you're on Windows, you'll have to grab the pod name and insert it into the port forward command manually.

Grab the name of the Pod:

    kube_dashboard_name=$(kubectl get pods --namespace=kube-system | grep kubernetes-dashboard | awk '{print $1}')

Setup the port forwarding

    kubectl port-forward ${kube_dashboard_name} 30000:8443 --namespace=kube-system

Now you can access the dashboard at https://localhost:30000

Want to run the port forwarding in the background with a single command?

From the learn-kubernetes directory.

    make k8s-dashboard-up

To kill the port forwarding process and remove the dashboard.

    make k8s-dashboard-down

### Step 2.2 Kubernetes Dashboard with `kubectl proxy`

The command is easy to remember, the URL not so much:

    kubectl proxy

Then go to http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#!/overview

!!! note

    The `kubectl proxy` makes it possible to access any Service. TODO: LINK.

## Step 3. Access the Dashboard

If this is the first time you've accessed the dashboard, you'll be greeted with a setup screen.

We're going to click **SKIP** as we're using the Dashboard for our development environment.

## Kubernetes Dashboard in Production

Access should be controlled via a Service token and it shoule be used as a read-only dashboard, not as a way to manage your cluster.

!!! danger

    Never expose it publicly!

    Read more about [securing the Kubernetes dashboard](https://blog.heptio.com/on-securing-the-kubernetes-dashboard-16b09b1b7aca).

repository: zhenjunz/learn-kubernetes

repo_name: zhenjunz/learn-kubernetes


text:
# sonosopencontroller
An open source sonos controller written in python.
Relies on PySide and the [soco](https://github.com/SoCo/SoCo) library.
Work in Progress.
I am making this application to be able to use my Sonos Play 1 on linux.
I'm trying to make this controller as complete as possible, so hopefully we will have a good controller for linux instead of having to rely on our phones and tablets to control our devices.

# Installation and Requirements
As this application relies on [soco](https://github.com/SoCo/SoCo) and [PySide](https://github.com/PySide/PySide), sonosopencontroller needs Python 2.7 or 3.3 or newer.
Do note that officially PySide does <u>not</u> support Python 3.5.

I've had problems installing SoCo through
`pip install soco`
So I cloned the soco repo and used
`pip install .`
whilst in the directory, this did work perfectly.

# License
sonosopencontroller is released under the [MIT license](https://opensource.org/licenses/mit-license.php).

repository: codedwrench/sonosopencontroller

repo_name: codedwrench/sonosopencontroller


text:
# oop_hw3

Use the link below to answer the following questions.

1) Why do we use "this" in a class?

"This" grabs the specific instance of that class and uses it to define its methods and properties.

2) How would you create a class without using "this"?

You can use constructors when creating a class, and you can also use the JS method, create().

https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/Object-oriented_JS#A_simple_example


text:
# Angular2-gantt v0.0.1

Work in progress!

## Description
A simple Angular2 Gantt component. Uses "2.1.0" of Angular2.
This project was generated with [angular-cli](https://github.com/angular/angular-cli) version 1.0.0-beta.18.

## Getting Started
1. Fork and clone this repo
2. npm install
3. ng serve

## Installation

To install this component to an external project:
TBA

## Usage
TBA

## Demo
![Demo](Demo.gif)

## Compatibility (tested with)
* Firefox (latest)
* Chromium (latest)
* IE (latest)

## License
* License: MIT

gha_language: TypeScript


text:
# avertR
Avert potentially harmful incidents before they happen by notifying security providers in a smooth way

## Demo video
Click the GIF below to check out the demo video!

[![alt text](https://media.giphy.com/media/RMyRaTQYy6Jnu48cJd/giphy.gif)](https://youtu.be/22iTt0Nb-rA)

## What is avertR?
avertR is an app that makes it easy for citizens to notify security providers in the event of a threatening situation. With just one click, your location is sent to the relevant security provider - you may also provide additional information about the incident

The responsible security provider gets a live overview of reported incidents in the area and can easily distribute personnel accordingly. Together with recent activity data from the police the provider can optimize the allocation of resources and help citizens more efficiently, with the added benefit of cutting costs.

The data collected provides an insight into when and where these situations occur, which can be used for future predictions.

## Try it out
avertR uses [yarn](https://yarnpkg.com) to manage dependencies and run the servers, so make sure it is installed and then follow the instructions below.

### Backend
```
cd backend
yarn
yarn start
```
The backend can be found at [localhost:3000](http://localhost:3000).

### Admin view
```
cd frontend/admin
yarn
yarn start
```
The admin view can be found at [localhost:3001](http://localhost:3001).

### App
```
cd frontend/client
yarn
yarn start
```
The app can be found at [localhost:3002](http://localhost:3002).

## License
See the `LICENSE` file in the repository root.

repository: forsstromerik/avertR

gha_language: JavaScript

gha_license_id: MIT

repo_name: forsstromerik/avertR


text:
# SocketMobile NFC scanner apps for D600 and S550

This application will collect NFC scan data from [SocketMobile](https://www.socketmobile.com/products/contactless/socketscan/s550-Bluetooth-RFID-reader) D600 and S550 scanners. The scanners are interfaced to a [Netrunr Bluetooth Gateway](http://www.axiomware.com) and uses the [Gateway API V3 SDK](https://github.com/axiomware/gapi-v3-sdk-js.git).

This Program will illustrate the following API functions:
- Install and include the SDK in a NodeJS Program.
- Connect to a MQTT broker and collect heartbeat data.
- Connect to multiple Netrunr gateways and initiate scan process.
- Detect and connect to one or more D600 scanners with pairing/bonding functionality
- Detect and connect to one or more S550 scanners.
- Run continuous background scan for BLE advertisements.
- Manage data collection from multiple concurrent devices using event handlers.
- Verify the configuration of the gateway and MQTT broker.
- TLS support
- Use MQTT5 protocol `request/response` features
- Use MQTT5 protocol `correlationData` features

**This example uses promises and async/await functionality present in Nodejs version 8.+**.

## SDK, Documentation and examples
- [Netrunr Gateway API V3 Documentation](http://www.axiomware.com/apidocs/index.html)
- [Netrunr Gateway API V3 SDK](https://github.com/axiomware/gapi-v3-sdk-js.git)

## Requirements

- [Netrunr E24](https://www.axiomware.com/netrunr-e24-product/) gateway
- A D600 or S550 NFC scanner
- Nodejs (see [https://nodejs.org/en/](https://nodejs.org/en/) for download and installation instructions)
  - Nodejs version 8.x.x or higher is required due to the use of promises/async/await
- NPM (Node package manager - part of Nodejs)
- Windows, MacOS or Linux computer with access to internet

## Installation

Clone the repo

`git clone https://github.com/axiomware/socket-mobile-nfc-scanner-app.git`

or download as zip file to a local directory and unzip.

Install all module dependencies by running the following command inside the directory

```bash
cd socket-mobile-nfc-scanner-app

npm install
```

## Optional customization before running the program
This example uses the default setup of the Netrunr gateway:
- The client computer is connected to the LAN port of Netrunr gateway
- The built-in MQTT broker is used and the IP address of the gateway is `<IP_ADDRESS>`
- The MQTT broker port is `1883`
- The MQTT topic prefix is `netrunrfe`

## Usage

Run the nodejs application to collect NFC scan indications:

`node socketMobile-NFC-scanner-app.js -h "<IP_ADDRESS>" -p 1883 -t "netrunrfe"`

To force exit at any time, use:

`CTRL-C`

## Usage with TLS

The `tls` flag will enable operation over MQTTS. This mode will use client certificates and collect data over secure link:

`node socketMobile-NFC-scanner-app.js -h 'yourmqtthostname.com' -p 8883 -t 'netrunrfe' --tls --ca-filename='./yourRootCA.pem' --key-filename='./your-private-key.pem.key' --crt-filename='./your-client-certificate.pem.crt'`

To force exit at any time, use:

`CTRL-C`

## D600 and S550 Library tests

To test the D600 NFC scan library (no hardware required):

`node d600-data-test.js`

To test the S550 NFC scan library (no hardware required):

`node s550-data-test.js`

## Error conditions/Troubleshooting

- If the program fails with module not installed errors, make sure `npm Install` is run prior to connecting to Netrunr gateway.
- This program caches GATT table in the config directory. If the GATT table of the device has changed, delete the `config-gatt.json` file. This file will be regenerated after connecting to a new BLE device.
- If bond has been erased, security keys have to be erased on the gateway too (see `unpair` command)
- For security reasons, Clients connected to LAN ports of Netrunr gateway have limited access to upstream network.
- If you do not see any heartbeat activity, verify network connections and your configuration.

repository: axiomware/socket-mobile-nfc-scanner-app

branch_name: refs/heads/main

repo_name: axiomware/socket-mobile-nfc-scanner-app


text:
Preparing and searching a PFAS structure and in silico MS/MS library
================

## Installation and setup

``` r
library(devtools)
install_github('gjgetzinger/PFAScreeneR')
install_github('gjgetzinger/cfmR')
library(PFAScreeneR)
library(reticulate)
library(DBI)
library(tidyverse)
library(cfmR)
library(MSnbase)
library(pbapply)
```

# Making the molecular database and spectral library

## Read input molecules, consolidate structures and predict transformations

Input molecules are read from xls files stored in the system files of
the `PFAScreeneR` packge.

``` r
mollist_path <- system.file(package = 'PFAScreeneR') %>%
  list.dirs() %>%
  .[grep('mass_lists', .)] %>%
  paste0(., '/')
```

The functions for collecting, standardizing and prediting
transformations of input molecules are performed by calling
`make_pfas_masslist`, which is imported from a python script stored in
the system files of this package.

``` r
py_file <- system.file(package = 'PFAScreeneR') %>%
  list.dirs() %>%
  .[grep('python',.)] %>%
  list.files(full.names = T)
reticulate::source_python(file = py_file)
```

Biotransformation is performed using the `BioTransformer` algorithm. See
<http://biotransformer.ca> for installation intructions and to cite the
original work. The path to the `BioTransformer` jar file must be
designated.

``` r
biotrans_jarfile <- '~/path/to/biotransformerjar/biotransformer-1.1.2.jar'
```

Results are written to SDF and SQLite files.

``` r
result_db <- '/path/to/result/PFAScreenR.db'
```

Calling `make_pfas_masslist` performs all the steps for intial database
creation.

``` r
make_pfas_masslist(
  mollist_path = mollist_path,
  biotrans_jarfile = biotrans_jarfile,
  hyd_sdf = 'hydrolysis_out.sdf',
  biotrans_in_sdf = 'biotrans_in.sdf',
  biotrans_out_sdf = 'biotrans_out.sdf',
  result_sdf = 'PFAScreeneR.sdf',
  result_db = result_db
)
```

## Predict MS/MS spectra using CFM

This step requires execution on a Linux compute cluster running a SLURM
scheduler and with CFM-ID installed as a commandline tool. See
<https://cfmid.wishartlab.com> for installation instructions for CFM-ID.

``` r
conn <- dbConnect(RSQLite::SQLite(), result_db)
mass_list <- tbl(conn, 'molecules')
```

### Negative ion

``` r
cfm_predict_batch(
  id = pull(mass_list, ID),
  input_smiles_or_inchi = pull(mass_list, InChI),
  prob_thresh_for_prune = 0.001,
  include_annotations = 1,
  apply_post_processing = 1,
  out_dir = '/path/to/negative_ion/storage/',
  param_filename = '/path/to/negative_ion/param_output1.log',
  config_filename = 'path/to/negative_in/param_config_neg.txt',
  slurm_options = list(partition = 'your_partition', 'mem' = '16G'),
  cpus_per_node = 1,
  nodes = 1000
)
```

### Positive ion

``` r
cfm_predict_batch(
  id = pull(mass_list, ID),
  input_smiles_or_inchi = pull(mass_list, InChI),
  prob_thresh_for_prune = 0.001,
  include_annotations = 1,
  apply_post_processing = 1,
  out_dir = '/path/to/positive_ion/storage/',
  param_filename = '/path/to/positive_ion/param_output1.log',
  config_filename = '/path/to/positive_ion/param_config_pos.txt',
  slurm_options = list(partition = 'your_partition', 'mem' = '16G'),
  cpus_per_node = 1,
  nodes = 1000
)
```

Disconnect from the result database before attempting to retrieve the
results.

``` r
dbDisconnect(conn)
```

### Collecting results

Once CFM prediction has completed, results can be written to the databse
file.

``` r
cfm_read_batch(out_dir = '/path/to/negative_ion/storage/',
               table_name = 'cfm_neg',
               output_path = result_db)

cfm_read_batch(out_dir = '/path/to/positive_ion/storage/',
               table_name = 'cfm_pos',
               output_path = result_db)
```

# Searching the spectral library

MS/MS spectra in a MGF format can be searched against the spectral
library.

``` r
pfas_exp_msms <-
  readMgfData(list.files(
    system.file(package = 'PFAScreeneR'),
    pattern = '.mgf',
    full.names = T
  ))

# get the ionization polarity
pol <-
  ifelse(fData(pfas_exp_msms)$CHARGE == '1-', 'negative', 'positive')
# set the database table name based on ionization polarity
spec_table_name <- ifelse(pol == 'negative', 'cfm_neg', 'cfm_pos')
ID <- as.character(fData(pfas_exp_msms)$ID)
instrument_type <- as.character(fData(pfas_exp_msms)$INSTRUMENT)
ppm <- ifelse(instrument_type == 'Orbitrap', 10, 50)
mol_form <- as.character(fData(pfas_exp_msms)$FORMULA)
exact_mass <-
  as.numeric(as.character(fData(pfas_exp_msms)$EXACT_MASS))
nom_mass_ppm <-
  sapply(exact_mass, function(x)
    1e6 * (diff(x + c(-0.5, 0.5)) / x))
```

## Search by ID

Searching by identifier retrieves library spectra from molecules with
the same ID. In this case, the ID assigned to experimental spectra
(`pfas_exp_msms`) matches the identifiers used to store molecules in the
library. The ID in thise case is the first-14 characters of the hashed
InChI string (i.e., InChI Key).

``` r
sim_id_search <- pbapply::pblapply(seq(along = pfas_exp_msms),
                                   function(x) {
                                     cfm_search(
                                       query_spectrum = pfas_exp_msms[[x]],
                                       spec_table_name = spec_table_name[x],
                                       pol = pol[x],
                                       db_file = db_file,
                                       mol_table_name = 'molecules',
                                       molprop_table_name = 'mol_props',
                                       fun = 'dotproduct',
                                       mol_form = NULL,
                                       exact_mass = NULL,
                                       bin = 0.005,
                                       ID = ID[x],
                                       ppm = ppm[x]
                                     )
                                   })
```

## Search by molecular formula

Searhing by molecular formula retrieves only library spectra with a
particular molecular formula.

``` r
sim_molform_search <- pbapply::pblapply(seq(along = pfas_exp_msms),
                                        function(x) {
                                          cfm_search(
                                            query_spectrum = pfas_exp_msms[[x]],
                                            spec_table_name = spec_table_name[x],
                                            pol = pol[x],
                                            db_file = db_file,
                                            mol_table_name = 'molecules',
                                            molprop_table_name = 'mol_props',
                                            fun = 'dotproduct',
                                            mol_form = mol_form[x],
                                            exact_mass = NULL,
                                            bin = 0.005,
                                            ID = NULL,
                                            ppm = ppm[x]
                                          )
                                        })
```

## Search by neutral exact mass

Searching by neutral exact mass retrieves library spectra with molecular
weights within the designated ppm range.

``` r
sim_neutralmass_search <-
  pbapply::pblapply(seq(along = pfas_exp_msms),
                    function(x) {
                      cfm_search(
                        query_spectrum = pfas_exp_msms[[x]],
                        spec_table_name = spec_table_name[x],
                        pol = pol[x],
                        db_file = db_file,
                        mol_table_name = 'molecules',
                        molprop_table_name = 'mol_props',
                        fun = 'dotproduct',
                        mol_form = NULL,
                        exact_mass = exact_mass[x],
                        bin = 0.005,
                        ID = NULL,
                        ppm = ppm[x]
                      )
                    })
```

## Search by neutral nominal mass

Same as above, except with nominal
mass.

``` r
sim_nominalneutralmass_search <- pbapply::pblapply(seq(along = pfas_exp_msms),
                                                     function(x) {
                                                       cfm_search(
                                                         query_spectrum = pfas_exp_msms[[x]],
                                                         spec_table_name = spec_table_name[x],
                                                         pol = pol[x],
                                                         db_file = db_file,
                                                         mol_table_name = 'molecules',
                                                         molprop_table_name = 'mol_props',
                                                         fun = 'dotproduct',
                                                         mol_form = NULL,
                                                         exact_mass = exact_mass[x],
                                                         bin = 0.005,
                                                         ID = NULL,
                                                         ppm = nom_mass_ppm[x]
                                                       )
                                                     })
```

## Search by exact precursor m/z

Searching by precursor m/z takes the precursor ion m/z and calculates a
series of netural masses based on common ESI/APCI adduct ions. The
resultant neutral masses are used as described above for neutral mass
look-up.

``` r
sim_precurmz_search <- pbapply::pblapply(seq(along = pfas_exp_msms),
                                         function(x) {
                                           cfm_search(
                                             query_spectrum = pfas_exp_msms[[x]],
                                             spec_table_name = spec_table_name[x],
                                             pol = pol[x],
                                             db_file = db_file,
                                             mol_table_name = 'molecules',
                                             molprop_table_name = 'mol_props',
                                             fun = 'dotproduct',
                                             mol_form = NULL,
                                             exact_mass = NULL,
                                             bin = 0.005,
                                             ID = NULL,
                                             ppm = ppm[x]
                                           )
                                         })
```

## Search by nominal precursor m/z

Same as above, except with nominal mass.

``` r
sim_nominalprecurmz_search <-
  pbapply::pblapply(seq(along = pfas_exp_msms),
                    function(x) {
                      cfm_search(
                        query_spectrum = pfas_exp_msms[[x]],
                        spec_table_name = spec_table_name[x],
                        pol = pol[x],
                        db_file = db_file,
                        mol_table_name = 'molecules',
                        molprop_table_name = 'mol_props',
                        fun = 'dotproduct',
                        mol_form = NULL,
                        exact_mass = NULL,
                        bin = 0.005,
                        ID = NULL,
                        ppm = nom_mass_ppm[x]
                      )
                    })
```

repository: gjgetzinger/PFAScreeneR

repo_name: gjgetzinger/PFAScreeneR


text:
# OCP - Open Close Principle

The OCP (Open-Close Principle) is one of the core principles of SOLID.

OCP speaks about the design principle Open for extension but Closed for modification.

repository: d-subrahmanyam/design-patterns

repo_name: d-subrahmanyam/design-patterns


text:
# Religious fallacies examples in numbers - Work in Progress

Across religious debates, arguments are thrown left and right without much quantification, which makes the discussion
very counter productive. Therefore, I have setup this repository as a collection of examples.

It consists of both the raw data (or how to get it) and ways to plot it.

Feel free to contibute and/or suggest any changes.

## Authors

* **Daniel Prelipcean** - *Initial work* - [dprelipcean](https://github.com/dprelipcean)

## License

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


text:
# qhulltest
Test QHull library with PCL, perform RANSAC GPF, Convex Hull and Pyramidal Extraction

## Prerequisites

Unix
```
apt-get install pcl vtk
```
Windows

VCPKG, PCL with VTK and QHull installed
```
C:\vcpkg>vcpkg install vtk[opengl] --triplet x64-windows
C:\vcpkg>vcpkg install pcl[opengl] pcl[qt] pcl[pcap] pcl[tools] pcl --triplet x64-windows
```

Tabletop/Planar Pointcloud

[countertop.zip](https://sourceforge.net/projects/pointclouds/files/PCD%20datasets/countertop.zip)

## Building

Unix
```
cd qhulltest; mkdir build; cd !$ && cmake ..
make
```
Windows
```
devenv /rebuild Release qhull_gpf_test.sln
```

## Running

Issue the command below on your favorite Point cloud:

```
 ../build/Release/qhull_gpf_test 9.pcd
Planar segmentation:55854 points
Convex hull:23 points
Prism:37101 points
```

The PCL viewer will start, press "r" to recenter the point cloud. Use the wheel mouse to zoom in and out, and press center / left button amd move mouse to change the view. See below for details:

![alt text](https://github.com/jafrado/qhulltest/raw/master/qhull.jpg "Qhull Test Example")

repository: EEGKit/qhulltest

repo_name: EEGKit/qhulltest


text:
# Hello, \<your name here\>!

After successfully writing the Hello, world! program, one likely next step is to write a program that asks the user to enter their name, then greets them by name.

In a console based program, the behavior might look something like this.
```
Enter your name: Dave
Hello, Dave!
```
The program prints a prompt, followed by a colon. The user then types their input.

The code to do this is probably straightforward. But depending on the PL and the environment that it runs in, there may be some complicated details involving libraries, runtime configuration, etc.


text:
# Examples

## Example configuration of Ingress with SSL

    ---
    apiVersion: extensions/v1beta1
    kind: Ingress
    metadata:
      name: my-ingress
      annotations:
        kubernetes.io/ingress.class: "nginx"
        cert-manager.io/cluster-issuer: "letsencrypt-staging"
    spec:
      tls:
      - hosts:
        - <domain>
        secretName: "<domain>-staging-tls"
      rules:
      - host: <domain>
        http:
          paths:
            - path: /
              backend:
                serviceName: <service_name>
                servicePort: 80
    ---

## Example persistent volume configuration

First add a definition of the volume, path and size. Add file example.nfs.persistentvolume.yaml:

    # example.nfs.persistentvolume.yaml
    ---
    apiVersion: v1
    kind: PersistentVolume
    metadata:
      name: example-ssd-volume
      labels:
        type: local
    spec:
      storageClassName: manual
      capacity:
        storage: 1Gi
      accessModes:
        - ReadWriteOnce
      hostPath:
        path: "/mnt/ssd/example"
    ---

Apply the configuration:

    kubectl apply -f example.nfs.persistentvolume.yaml

To apply the claim for a volume do like this. Add file example.bfs.persistentvolumechaim.yaml

    # example.nfs.persistentvolumeclaim.yml
    ---
      apiVersion: v1
      kind: PersistentVolumeClaim
      metadata:
        name: example-ssd-volume
      spec:
        storageClassName: manual
        accessModes:
          - ReadWriteOnce
        resources:
      requests:
            storage: 1Gi
    ---

    kubectl apply -f example.nfs.persistentvolumeclaim.yaml

[Kubernetes PersistentVolumes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/}

# Other useful information

## Useful commands

    kubectl -n <service> logs -f $(kubectl -n <service> get pod -o name)
    kubectl -n <service> decribe $(kubectl -n <service> get pod -o name)

## Helm Commands
[https://helm.sh/docs/intro/quickstart/#initialize-a-helm-chart-repository]

Search the repo

        helm search repo stable

Update the repo

        helm repo update

Install a pod

        helm install stable/hackmd --generate-name

Get information

        helm show chart stable/hackmd

or

        helm show all stable/hackmd

Removing a pod

        helm uninstall hackmd

## Watching deployment status
It takes a while to deploy a container, just like docker pull.  Watch the progress like this

        kubectl get pods -w

When it says "Running" you are good to go.

## Initial contact
Follow the instauction emitted by Helm.  This will not create a link to Traefik, just a temporary port forward to the new service.

        kubectl port-forward hackmd-1593264092-7984f4cfd6-4q9r6 8080:3000

Note the help text for this particular Helm Chart is wrong on the listening port of that container.
This was found by issuing a `kubectl logs <pod nmae>` and looking at the logfile.

## Securing Helm
Skipped for now:
[https://v2.helm.sh/docs/using_helm/#understand-your-security-context]

# Add the Petri Helm Chart Repo
TODO [https://helm.sh/docs/howto/chart_repository_sync_example/]

# Links
LetsEncrypt Clusterissuer and more:
https://medium.com/containerum/how-to-launch-nginx-ingress-and-cert-manager-in-kubernetes-55b182a80c8f

repository: PetriPod/PetriPod

repo_name: PetriPod/PetriPod


text:
# gift-center
## Our website provides the suggestions and ideas of gifts for different occasions.

### Domain Model
![Domain Model 1](https://github.com/gift-center/gift-center/blob/main/assests/domainModel1.png)
![Domain Model 2](https://github.com/gift-center/gift-center/blob/main/assests/domainModel2.png)

repository: gift-center/gift-center

repo_name: gift-center/gift-center


text:
---
redirect_from: "/Update"
---

# How to update AzerothCore to the latest stable version

## Verify that you're on the latest release

1. Type `.server debug` in your console.

    1. If it outputs `Using World DB: ACDB 335.4-dev` then you can proceed to [Update your local source](#update-your-local-source).

    1. If it outputs anything else for `Using World DB:` then you first need to follow [this guide on updating to latest master](upgrade-from-pre-3.0.0-to-latest-master.md).

We'd also highly recommend following the #announcements channel on the AzerothCore discord so you'll know about any other important changes to AzerothCore.

## Update your local source

Move to your AzerothCore sources directory.

- If you have your own fork of AzerothCore, you need to [sync it](Syncing-your-fork).

- Otherwise, if you cloned AzerothCore directly from the main repo, you have to `git pull` to update it.

## Recompile

Compile again your sources, this step is the same as the [Compilation step during Installation](Installation#3-compiling), but generally you can skip the CMake part unless you're adding new modules.

For example, in Linux/Mac you just have to `cd build;` and run `make -j 8; make install`. Of course you can change the value of the `-j` paramether according to your CPU.

## Update the Database

**If you are updating your production environment, BACKUP your databases BEFORE updating them!**

You need to import the **new** sql update files (located at https://github.com/azerothcore/azerothcore-wotlk/tree/master/data/sql/updates) to each database.

To automate this process you can use the db-assembler bash script `bash apps/db_assembler/db_assembler.sh`.

If this is the first time you are using it [READ THIS FIRST](database-installation.md) and properly configure your `conf/config.sh` file.

![](https://user-images.githubusercontent.com/75517/50738699-6912ee80-11d7-11e9-95ea-667baa0bda70.png)

repository: Bogir/wiki

repo_name: Bogir/wiki


text:
# Contributing to Deno

Want to contribute to Deno? There are a few things you need to know.

We wrote a **[contribution guide](https://deno.land/manual.html#contributing)**
to help you get started.

repository: IAmNithi/deno

repo_name: IAmNithi/deno


text:
# neighbourapp
  This is a python application for user post in his neighbourhood.
  it includes search and project.

  ## setUp instruction

   | Required                                  | Description                                                       | How to run                            |
|-------------------------------------------|-------------------------------------------------------------------|---------------------------------------|
| A user visit the website signs up or logs in       | S/he can see post,search neighbourhood                             | The project is run using the browser |

   ### Technologies used

     -Python
     -Django
   ### BDD
   <img src='./media/neighbour.png' alt='image'>

   ### Contact information

<EMAIL_ADDRESS>
   ### MIT License and Copyright information

  [MIT](https://choosealicense.com/licenses/mit/)
  Copyright ©2019 Annick-Francine-M

repository: mfannick/neighbourhood

gha_language: Python

repo_name: mfannick/neighbourhood


text:
ABOUT
================

This repository contains Chef recipes for building and
configuring instances related to the database migration project
at WormBase:

   http://www.wormbase.org/

Todd Harris

ACKNOWLEDGEMENTS
==================

chef-aws-tag:
Because I couldn't see how to use more than a single custom chef recipe
repository in AWS OpsWorks, "chef-aws-tag" was lifted unmodified
from Stuart Warren and placed alongside our other recipes.

   https://github.com/stuart-warren/chef-aws-tag

Thanks, Stuart!

repository: WormBase/cookbooks-db-migration

repo_name: WormBase/cookbooks-db-migration


text:
# DCP
C++ implementation of the Dark Channel Prior algorithm for single image haze removal.
Input: folder containing input images path (string), *.txt file path containing input parameters for dehazing (string), output folder path.
Dehazing parameters txt file contains: patch size, percentage of pixel for airlight estimation, omega regularization parameter,
  laplacian window size, epsilon (laplacian matrix parameter, lambda smooth factor (soft matting), transmission lower threshold (double).
  suggested values:
    15 10 0.95 3 0.0000001 0.0001 0.1
Output: original image, dehazed image, transmission map, airlight (same size as the input image) saved in a seperate directory
  for each input image.

repository: yanchevskyroman/DCP

repo_name: yanchevskyroman/DCP


text:
# Razzle x After.js

## How to use

Download the example [or clone the whole project](https://github.com/jaredpalmer/razzle.git):

```bash
curl https://codeload.github.com/jaredpalmer/razzle/tar.gz/master | tar -xz --strip=2 razzle-master/examples/with-afterjs
cd with-afterjs
```

Install it and run:

```bash
yarn install
yarn start
```

## Idea behind the example

This is a basic, bare-bones example of how to use After.js and Razzle.

repository: lucaslago/after-js-playground

repo_name: lucaslago/after-js-playground


text:
## Scopes
Contrary to some other ioc containers Singularity will not cleanup resources automagically for you. This makes it more clear when resources are cleaned up and also saves some performance when its not needed.
You can use the `OnDeath` method to execute code such as calling `Dispose` when the scope ends:
```cs
config.Register<ITestService10, TestService10>().OnDeath(instance => instance.Dispose());
```

A scope ends when the container is disposed. This means it will execute the OnDeath actions on all created instances. You can create a new scope by creating a nested container and passing in a new scope:
You can create a new scope this way:
```cs
var config = new BindingConfig();
config.Register<IDisposable, Disposable>().OnDeath(x => x.Dispose());

var container = new Container(config);

Scoped scope = container.BeginScope();
var disposable = scope.GetInstance<IDisposable>();
scope.Dispose(); //disposable will now get disposed
```

Creating a container will also create a implicit scope:
```cs
var config = new BindingConfig();
var container = new Container(config);

var nestedConfig = new BindingConfig();
Container nestedContainer = container.GetNestedContainer(nestedConfig);

var disposable = container.GetInstance<IDisposable>();
var disposableNested = nestedContainer.GetInstance<IDisposable>();
nestedContainer.Dispose(); //disposableNested will now get disposed
container.Dispose(); //disposable will now get disposed
```


text:
# iGD1348 model files

This archive contains the iGD1348 metabolic reconstruction as:
1) a SBML formatted file
2) an easy to read table in Excel format
3) a COBRA-formatted metabolic model saved as a MATLAB file.

The archive additionally contains the working version of the iGD1348 model, with unnecessary 'Unknown' GPRs removed from the model (i.e., GPRs such as [GeneA or Unknown] were replaced with [GeneA]), and with the gene 'NonEssential' removed.


text:
# internorns

a live-coding interface that interconnects norns.

![internorns](https://user-images.githubusercontent.com/6550035/124368779-70d17380-dc19-11eb-9590-3fa4101337c9.jpg)

https://vimeo.com/570686702

this script is a cross between a [live coding environment](https://llllllll.co/t/live-coding/5032) and a [tracker](https://llllllll.co/t/trackers/38551) - its sorta a tracker you sequence with code. the code you can sequence is any norns lua code. using code you can access any of the standard norns features (midi, osc, crow), and I've also added interfaces to "lite" versions of several of my own scripts (like [*oooooo*](https://llllllll.co/t/oooooo), [supertonic](https://llllllll.co/t/supertonic/), [amen](https://llllllll.co/t/amen/), and [mx.samples](https://llllllll.co/t/mx-samples/)). some basic features of internorns:

- sequence pitches with text, in chords (e.g. `Cm7/Eb`) or notes (e.g. `a4 eb3`)
- sequence midi devices and add cc lfos
- sequence crow with pitches, automatically generating voltage/envelope
- play/rec into three stereo loops via softcut
- built-in drum synth that can be sequenced/modulated in realtime
- built-in sample player that can be quantized
- sequence notes/chords from any instrument in [mx.samples](https://llllllll.co/t/mx-samples/)
- special tape stop / start global fx

internorns works quite simply: it runs an internal sequencer that runs code. there is an internal clock that makes 4 steps per beat, and 4 beats per measure. at each step it checks to see if there is code to run in that step in the current measure and attempts to run it. code can be added to steps using the built-in functions.

see [`data/getting-started.lua`](https://github.com/schollz/internorns/blob/main/data/getting-started.lua) to get started and preview how it works. the process is music.

## Requirements

- computer
- norns
- midi device (optional)
- crow (optional)

## Documentation

start the internorns script on norns.

now choose an editor to live-code, I suggest usig either maiden (in the browser), visual studio code, or vim. instructions for each are below.

maiden

open up a webbrowser to [http://norns.local/maiden/#edit/dust/data/internorns/getting-started.lua](norns.local/maiden/#edit/dust/data/internorns/getting-started.lua).

you can select any code and press ctl+enter to send that code to the norns.

_note:_ requires latest version of maiden.

visual studio code

[download visual studio code](https://code.visualstudio.com/) and then install [the Norns REPL extension](https://llllllll.co/t/norns-repl-vscode-extension/41382). use software like [sftp drive](https://www.nsoftware.com/sftp/drive/) to mount your norns on your computer. then you can directly edit `~/dust/data/internorns/getting-started.lua`.

press ctl+enter to send the current line to the norns.

vim

lines from a norns script can be quickly and easily run using vim.

to use with vim, first download `wscat` - a utility for piping commands to the maiden websocket server.

```
wget https://github.com/schollz/wscat/releases/download/binaries/wscat
chmod +x wscat
sudo mv wscat /usr/local/bin/
```

then you can edit your `.vimrc` file to include these lines which will automatically run
the current selected line when you press ctl+c:

```vim
set underline
nnoremap <C-c> <esc>:silent.w !wscat<enter>
inoremap <C-c> <esc>:silent.w !wscat<enter>i
```

now whenever you use the key combo ctl+c it will send the current line in vim into maiden!

open up `dust/data/internorns/getting-started.lua` in your editor to learn how to use internorns.

### Install

make sure you install all of the following (or update if you already have them):

```
;install https://github.com/schollz/mx.samples
;install https://github.com/schollz/supertonic
;install https://github.com/schollz/internorns
```

then restart your norns.

repository: schollz/internorns

gha_language: Lua

repo_name: schollz/internorns


text:
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

# Name of the enhancement/ feature added
<!-- Please give a clear and consise descsription of the work done -->

# Screenshots
<!-- If applicable, add screenshots to help explain your apporach. -->

# References
<!-- Don't forget to cite the resources that helped you to build this -->

# Further Discussion
<!-- Next Goals, Any Feedback Required? -->

repository: smaranjitghose/DeepPixel

repo_name: smaranjitghose/DeepPixel


text:
#Basic Data

##User
> GET https://api.fidor.de/users/current

```json
{
    "id": "94070746",
    "email"<EMAIL_ADDRESS>    "last_sign_in_at": "2014-10-22T13:44:52+02:00",
    "created_at": "2014-10-10T17:41:58+02:00",
    "updated_at": "2014-10-23T14:49:21+02:00"
}
```

After the authorization you can query the data for the user using your app. You will get only high-level user information. Following fields will be delivered upon requesting the user information:

Parameter | Description | Format
--------- | ----------- | -----------
id   | Unique user identifier | String
email | The user's email address that can also be used as login | String
last_sign_in_at | Last time the user accessed fidor | String (date-time)  ISO 8601 Date-Time
created_at | Creation date-time, never changes | String (date-time) ISO 8601 Date-Time
updated_at | Last update date-time | String (date-time) ISO 8601 Date-Time

### HTTP Request
`GET https://api.fidor.de/users/current` current user

##Customer
> GET https://api.fidor.de/customers

```json
{
    "data": [
        {
            "id": "71616244",
            "email"<EMAIL_ADDRESS>            "first_name": "John",
            "last_name": "Doe",
            "gender": "m",
            "title": "Herr",
            "nick": "kycfull",
            "maiden_name": null,
            "adr_street": "teststr",
            "adr_street_number": "2",
            "adr_post_code": "50733",
            "adr_city": "Köln",
            "adr_country": "DE",
            "adr_phone": null,
            "adr_mobile": "+49 555 55 55",
            "adr_fax": null,
            "adr_businessphone": null,
            "birthday": "1973-07-02",
            "is_verified": true,
            "nationality": null,
            "marital_status": null,
            "religion": 0,
            "id_card_registration_city": null,
            "id_card_number": null,
            "id_card_valid_until": null,
            "created_at": "2014-10-10T17:41:58+02:00",
            "updated_at": "2015-02-04T04:08:54+01:00",
            "creditor_identifier": ""
        }
    ],
    "collection": {
        "current_page": 1,
        "per_page": 10,
        "total_entries": 1,
        "total_pages": 1
    }
}
```
Customer gives you much more information about the user

Parameter | Description | Format
--------- | ----------- | -----------
id   | Unique customer identifier | String
email | The customer's email address - same as the user's email address | String
first_name | Customer's first name | String
last_name | Customer's last name | String
gender | Customer's gender | String (enum) - Valid Values: "m", "f"
title | Salutation e.g "Mr." or "Mrs." | Enum
nick | Nickname used in community - can be used as login  | String
maiden_name | Customer's maide name | String
adr_street | Street address of the customer | String
adr_street_number | House number | String
adr_post_code | Postcode of the customer | String
adr_city | City customer lives in | String
adr_country | Country customer lives in | String
adr_phone | Customer's phone number | String
adr_mobile | Customer's mobile phone number | String
adr_fax | Customer's fax number | String
adr_businessphone | Customer's business phone number | String
birthday | Customer's birhday e.g. "1973-07-02" | Date
is_verified | Indicates whether KYC has been performed | Boolean
nationality | Customer's nationality - Country code as defined in ISO3166 alpha2. e.g "DE", "GB" | String
marital_status | Customer's marital status | Integer (enum) - 1: single, 2: married, 3: widowed, 4: divorced, 5: seperated, 6: de facto
religion | Customer's religion - denomination for tax reasons. 0: no information, 1: no denomination, 2: Protestant, 3: Roman-Catholic, 4-18: Other denominations| Integer (enum) - Valid Values "0", "1", "2", "3", "4", "5", "6", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", 18"
id_card_registration_city | The | String
id_card_number | The number of customer's identity document |
id_card_valid_until | The expiration date of customer's identity document| String (date)
created_at | Creation date-time, never changes. ISO 8601 Date-Time e.g. "2014-10-10T17:41:58+02:00" | Datetime
updated_at | Last update date-time. ISO 8601 Date-Time e.g. "2015-02-04T04:08:54+01:00" | Datetime
creditor_identifier | Creditor Identifier ID set if the customer wants to create direct debits | String

## Account

> GET https://api.fidor.de/accounts

```json
{
    "data": [
                {
                    "id": "71616244",
                    "account_number": "9510260101",
                    "iban": "DE32700222009510260101",
                    "balance": 264398,
                    "balance_available": 264398,
                    "preauth_amount": 0,
                    "cash_flow_per_year": 0,
                    "is_debit_note_enabled": null,
                    "is_trusted": null,
                    "is_locked": false,
                    "currency": "EUR",
                    "overdraft": 0,
                    "created_at": "2014-10-10T17:41:58+02:00",
                    "updated_at": "2015-02-13T04:08:53+01:00",
                    "customers": [
                    {
                      "id": "71616244",
                      "email"<EMAIL_ADDRESS>                      "first_name": "John",
                      "last_name": "Doe",
                      "gender": null,
                      "title": "Herr",
                      "nick": "kycfull",
                      "maiden_name": null,
                      "adr_street": "teststr",
                      "adr_street_number": "2",
                      "adr_post_code": "50733",
                      "adr_city": "Köln",
                      "adr_country": "DE",
                      "adr_phone": null,
                      "adr_mobile": null,
                      "adr_fax": null,
                      "adr_businessphone": null,
                      "birthday": "1973-07-02",
                      "is_verified": true,
                      "nationality": null,
                      "marital_status": null,
                      "religion": 0,
                      "id_card_registration_city": null,
                      "id_card_number": null,
                      "id_card_valid_until": null,
                      "created_at": "2014-10-10T17:41:58+02:00",
                      "updated_at": "2015-02-13T04:08:53+01:00",
                      "creditor_identifier": ""
                    }
                 ]
              }
          ],
    "collection": {
        "current_page": 1,
        "per_page": 10,
        "total_entries": 1,
        "total_pages": 1
    }
}
```

Parameter | Description | Format
--------- | ----------- | -----------
id   | Unique account identifier | String
account_number | The bank account number | String
iban | IBAN | String
balance | Account balance in minor units | Integer
balance_available | Available account balance in minor units | Integer
preauth_amount | Amount available for pre-authorization in minor units | Integer
cash_flow_per_year | Amount available for yearly cash flow in minor units. This is the limit of funds an account holder has at their disposal without fulfilling Germany KYC requirements | Integer
is_debit_note_enabled | Whether this account is authorized to initiate direct debit transactions | Boolean
is_trusted | Indicates if this is an escrow account | Boolean
is_locked | Indicates whether the account is locked | Boolean
currency | Currency of Account or Amount. ISO 4217 alpha-3 - 3 letter upcase e.g EUR | String (enum)
overdraft | Available account overdraft in minor units | Integer
created_at | Creation date-time, never changes. ISO 8601 Date-Time e.g. "2014-10-10T17:41:58+02:00" | Datetime
updated_at | Last update date-time. ISO 8601 Date-Time e.g. "2015-02-04T04:08:54+01:00" | Datetime

For your convenience we also include the information about the customers of the account in a response.

### HTTP Requests

`GET https://api.fidor.de/accounts`
index

`GET https://api.fidor.de/accounts/{id}`
self

`GET https://api.fidor.de/accounts/{id}/transactions`
account transaction

`GET https://api.fidor.de/accounts/{id}/internal_transfers`
See also: [Internal_transfers](#internal-transfer)

`GET https://api.fidor.de/accounts/{id}/sepa_credit_transfers`
account SEPA credit transfers

`GET https://api.fidor.de/accounts/{id}/sepa_direct_debits`
See also: [SEPA direct debit](#sepa-direct-debit)

## Transactions
> GET https://api.fidor.de/transactions/:id

```json
{
  "id": "666",
  "account_id": "66666666",
  "transaction_type": "payout_fidorpay",
  "subject": "\"Send money to Friends\" recipient: Walter White: Heisenberg",
  "amount": -100000,
  "booking_code": "725",
  "booking_date": 2015-03-01,
  "value_date": "2015-03-02",
  "return_transaction_id": "",
  "created_at": "2015-03-02T13:58:59+01:00",
  "updated_at": "2015-03-02T13:58:59+01:00",
  "currency": "EUR",
  "transaction_type_details": {
    "internal_transfer_id": "286",
    "remote_account_id": "71616244"
}
```

Parameter | Description | Format
--------- | ----------- | -----------
id   | Unique customer identifier | String
account_id | Fidor account the transaction belongs to | String
transaction_type | Type of the transaction | String (enum)
subject | Transfer subject (reference) | String
amount | The transferred amount in account currency, in minor units, e.g. 1EUR is represented as 100. Can be negative e.g. if something was withdrawn from an account. | Integer
booking_code | Accounting transaction code in the central banking system | String
booking_date | Date the transaction was booked. ISO 8601 Date | String (date)
value_date | Date the amount was credited to the account. ISO 8601 Date | String (date)
return_transaction_id | If the transaction was marked for return, this references the new return transaction | String
created_at | Creation date-time, never changes. ISO 8601 Date-Time e.g. "2014-10-10T17:41:58+02:00" | Datetime
updated_at | Last update date-time. ISO 8601 Date-Time e.g. "2015-02-04T04:08:54+01:00" | Datetime
currency | Currency of Account or Amount. ISO 4217 alpha-3 - 3 letter upcase e.g EUR | String (enum)
transaction_type_details | Details specific to this transaction type are collected here |

repository: agalloch/api-docs

repo_name: agalloch/api-docs


text:
OTTO WG Minutes: 11/10/2016
STATUS: Approved

## Attending:
 - Mike Schwartz
 - Leif Johansson
 - Janusz Ulanowski
 - Yuriy Zabrovarnyy
 - David Walker
 - Andy Gilbert (MCNC)
 - Eric Goodman
 - Ken Klingenstein

## Notes (not totally complete)

This is an non-WG meeting to get feedback from Leif based on concerns
he raised on the refeds mailing list about trust management.

Background is in minutes from 11/9/16:
 https://github.com/KantaraInitiative/wg-otto/blob/master/minutes/059-otto_minutes-11-9-2016.md

What kind of problems are we trying.

There are reasons why SAML bundles keys with endpoint information:
a way to avoid key hierarchies. One of the issues with Roland's approach
avoids one problem: complex data structures, by introducing a
complex key hierarchy, and may be as bad as the PKI we were trying to
avoid in the first place. False simplicity can lead to a situation
where you remove something that you have tenfold.

Are we gaining from removing asymetric keys?

In Roland's proposal, we are removing the entity keys

Federation operator is a CA and revocation service at the same time
(loosely). In a metadata aggregate, when you remove an entity,
that is the act of asserting trust and removing the old key at the
same time. Its an expression of the simplicity--all you have to
do is get the latest federation entity.

You have to analyze the trust propeties of the API you are designing,
how it is equivalent to a simple GET of the metadata aggregate.

Some of the calls are about how you get data into the aggregate--that
doesn't matter to many parties.

The important stuff is to figure out how to obtain information from the
aggregate, and how do you trust the result. Today: fetch the whole thing
and update the local copy. That model is straining at the envelope. There
are already a few cases where this process is becoming cumberson.

Leif see's MDQ as the answer. Mike raised the point that MDQ would require
some discovery service.

Every federation has a local trust oracle--that is the thing you would
talk MDQ to. There doesn't have to be a "home federation". You use the
local trust oracle to find out where the metadata is. Federations
are a good policy object but not a good trust management object-SP
should be able to determine locally who you want to trust.

David Walker: This is why I've been talkign about certifiers. Federation
ties trust to a legal structure--there is value in that. There will be
other entities that cetify things about your domain--multiple legal
structures. This challenges the notion of a single local oracle of trust.

Leif: The local source aggregates the trust information.

David Walker: How do you do the aggregation. In Roland's solution, you
only get one signer of the metadata statements.

Leif: Take a library example in the UK: available from both EduGain
and UK Access federation. I can give preference to UK Access Federation.
The problem with Roland's proposal is that it puts the burden
on the asserter of the trust to inlcude the required info, not the
receiver of the trust. There are other things that go into the trust
decision.

David: In the current model, the organizations trust what the federations,
but does not enable the incorporation of other trust parties.

Leif: You can't make assumptions about what kind of meaning the signature
entails.

Mike: Can MDQ meet these requirements.

Leif: Yes, MDQ can and is doing this today. In simplest case you
outsource trust management to the federation. But after a while, you
need to have a little bit of aggregation yourself.  For example, a
single MDQ server, for the R&S websites.

Leif: Invite Ian Young to OTTO call. He thinks we're missing aspects
of how MDQ could be used and extended. Having to introduce a data type
to address OAuth2 is needed.

Is the federation the first level trust oracle... that needs to change.
How can we efficiently get aggregators to inform and trust each other
about changes.

If I'm a trust oracle, and talk to edugain--I want certified IDPs.
I want to efficiently get updates, and publish downstream endpoints
to my relying parties.

David: However you do the verification, the oracle would have the
list of public keys of the certifiers that it trusts.

Eric: Is the concern whether the application is talking to the trust
sources or the local oracle? Is MDQ good enough, or does OTTO provide
improvements to the communication?

Leif: Leif doesn't care about CRUD stuff--leave that aside. Focus on
fetching stuff from trust oracle: data types, ok... but for the
biggest problem with API, not what I saw, but what I didn't see.
The biggest problem is not that we haven't deployed MDG. The biggest
problem is the aggregator-aggregator communication is too slow,
too cumbersome, doesn't scale well. Need an asynchronous update
mechanism... the problem of who talks to who, and how what are the
data types are incidental.

David: Agreed, but the other thing we need to remember is that the
aggregation of trust happens at the Edugain level, and needs to
happen much closer to the organization. We can't entirely fix it with
technology

Leif: If we make it much easier to deploy aggregators. If it's simple
enough to deploy, it can be possible.

Mike: We considered MDQ at OTTO, but found it didn't meet all our
requirements. For example, how can you query by entityID for an
OpenID Connect RP (which has no such entityID--a different client ID
is issued by each OpenID Provider)? Also, MDQ seems tightly bundled
with SAML / XML metadata... not developer friendly. Part of the
challenge was to make a more flexible query mechanism--OTTO offers
filters and "depth" (depth is a way to specify which types of objects
you want to return...). While you might say the backend datatype doesn't
matter, in order to make the right kind of queries, it helps if you
have stored the data in a manner condusive to searching. Furthermore,
http://schema.org provides a base schema, and an easy way to extend.
Linked data was designed to help search engines index websites more
efficiently and provide more meaningful search results--we can use the
same strategy for federation data.

## Summary / Action Items

1. Leif thinks the simplicity of a federation publishing its metadata
should be maintained.

2. Maybe we should give MDQ more consideration--invite Ian Young as a
guest to the OTTO WG to provide a deeper overview.

3. Roland's spec involves the SP pushing signed data, moving complexity
out of the federation, but perhaps creating more complexity than it
eliminates. However, OpenID Connect presents some new challenges,
especially around the lack of an RP entityID that need consideration.

repository: KantaraInitiative/wg-otto

gha_language: XSLT

repo_name: KantaraInitiative/wg-otto


text:
sandbox
=======

Test repo for trying out GitHub APIs, hooks, git and everything else.

Complete auto-close test for #39 and #38 and #56 and unassigns it.

Unassigning #57

Testing tags.s

See [Resetting Visual Studio Experimental Instance](#resetting-visual-studio-experimental-instance)

# Header that I'll link to

some text

# Some other header

Please see [Header that I'll link to](#header-that-ill-link-to).

## Resetting Visual Studio Experimental Instance

![Icon](https://raw.github.com/clariuslabs/clide/master/icon/64.png) Clide
==================

<img align="center" src="https://raw.github.com/clariuslabs/clide/master/icon/64.png" /> Clide
==================

repository: abock/sandbox

repo_name: abock/sandbox