text:
# Hermes

Are you seeing this on GitHub? You can view this on it's [Home page](https://backupbrain.github.io/hermes/).

Hermes is a lightweight  [CGI](https://en.wikipedia.org/wiki/Common_Gateway_Interface) web application framework. It is designed to make getting started quick and easy, with the ability to scale up to complex applications. It began as an easy way to make database-driven APIs and web applications without the need for complex server configuration.

### Friendly and Unopinionated

Hermes doesn't enforce conventions and doesn't have dependencies. It works with many existing tools such as [Jinja](https://jinja.palletsprojects.com/en/2.11.x/), but doesn't require them. It is as simple or as complex as your project wants it to be.

### Small Footprint

Because it uses CGI, the standard protocol for dynamic web server content, no modules such as WSGI are required to run. Also because of this, it allows the web server to do what it does best - routing and caching. Because it is designed to be import-driven, dependencies can be loaded on each page as needed, reducing the CPU time, memory requirements, and dependencies required for each page or API call.

### A Part of a Team

Hermes lets other programs do their job, so you'll have to configure your other programs as needed to work with Hermes. This is great if you have a team where each person has a different role. For instance a sys-admin, a front-end engineer, back-end engineer, and a database technician. Each person can work on their part of the project without disrupting the each others' workflow.

This is because it doesn't replace the web server's routing and security, and it doesn't try to replace the database's schema management.

### Live-deployment

Since Hermes uses CGI, each request is handled by the server at on its own terms. This means that changes you make to your website code are deployed live, such as when pulling code from git as a result of a post-commit hook. It also means that the server's buil-in routing and security can be used on a per-page or per-folder basis, such as with `.htaccess` in Apache.

### React-compatible

It also makes for easy integration with [ReactJS](https://reactjs.org/) and [VueJs](https://vuejs.org/) since there is no need to define routes in Hermes. If React says that `/folder` exists, Hermes doesn't fight it. Plus obviously Hermes can create REST and GraphQL APIs.

### Static-Asset compatible

Since Hermes uses the web server's built-in CGI protocol, dynamic content can live side-by-side with static content. That means that static assets can be in the same folder structure as Python files. There's no need to serve files separately or create route conditions to access static content from the browser.

### Testing
Hermes doesn't read data directly from CGI. Instead, you must tell it what data to parse. This makes it possible to put dummy data in for testing at any time.

The native format is HTTP text from the web server's CGI input, something ilke this:

```data
GET /index.py HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT)
Host: example.com
Content-Type: text/html
Content-Length: 0
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: Keep-Alive

```

#### Live Data
To feed CGI data directly from your web server into Hermes, do this:

```python3
#!/usr/bin/env python3
import sys
from os import environ
http_server = HttpServer(environ, sys.stdin)
```

### Test Data

To feed test data into Hermes, do this:

```python3
#!/usr/bin/env python3
from os import environ

test_http_request = """
GET /index.py HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT)
Host: example.com
Content-Type: text/html
Content-Length: 0
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: Keep-Alive

"""
http_server = HttpServer(environ, test_http_request)
```

## Why This Exists

Hermes was created as an alternative to Django and Flask, the dominant Python web frameworks. Django is monolithic opinionated, which can be a problem for small projects or ones that integrate with legacy code. Flask has a complex way of dealing with database objects. Both require WSGI which is a challenge to set up on Apache and requires a web server restart every time a change is made to the web application code. Sometimes it's convenient to have something lightweight to use in a small project.

Hermes is named after the messenger god in Greek mythology. Hermes' job was to pass messages between gods, humans, and animals.

## Installing

Download code using Git:
```console
git clone https://github.com/backupbrain/hermes
```

## Set-up

Hermes works on a variety of web servers.

### Apache

Make sure CGI is enabled in Apache2
```console
$ sudo a2enmod cgi
```

In your Apache VirtualHost, enable `ExecCGI` and add the `.py` handler.

```apache
<Directory /var/www/example.com/www>
	Options +ExecCGI
	AddHandler cgi-script .py
</Directory>
```

Create your first Hermes web page in `/var/www/example.com/www/index.py`:

```python3
#!/usr/bin/env python3
import sys
from os import environ
from hermes import HttpServer
from hermes import WebManager

# Initialize a CGI processor
http_server = HttpServer(environ, sys.stdin)

def handle_get(http_server):
    '''Respond to a GET request with static HTML content."""
    http_server.print_headers()  # Print HTTP headers
    output = "<html><body><h1>Hello world</h1><body></html>"
    http_server.print_json(output)  # Print output

# Create a web manager
web_manager = WebManager(http_server, database_manager)

# Tell the manager to respond to GET requests.
web_manager.set_method_callback(
    WebManager.HTTP_METHOD_GET,
    handle_get
)
web_manager.run()
```

Make sure this file is executable
```console
chmod +x /var/www/example.com/www/index.py
```

Restart Apache2 to make sure the folder is active and the settings took effect.
```console
$ sudo systemctl restart apache  # or whatever your flavor of *nix prefers
```

Remove `.py` extension by adding .htaccess in the `/var/www/example.com/www` folder:
```.htaccess
# check if a /path/to/file.py file exist
# and rewrite it as /path/to/file
# otherwise - leave it alone, it's a static file or folder
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) $1.py [L]
```

## Ngnx

Enable Fastcgi the virtual host config
```data
server {
[...]
   location /cgi-bin/ {
     # Disable gzip (it makes scripts feel slower since they have to complete
     # before getting gzipped)
     gzip off;
     # Set the root to /usr/lib (inside this location this means that we are
     # giving access to the files under /usr/lib/cgi-bin)
     root  /var/www/www.example.com;
     # Fastcgi socket
     fastcgi_pass  unix:/var/run/fcgiwrap.socket;
     # Fastcgi parameters, include the standard ones
     include /etc/nginx/fastcgi_params;
     # Adjust non standard parameters (SCRIPT_FILENAME)
     fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
   }
[...]
}
```

Reload nginx:
```console
/etc/init.d/nginx reload  # or whatever your flavor of *nix prefers
```

## Including in a Project
Hermes can be included in any way you want. It can be a file in your virtual host root folder, or from another folder. It just needs to be included in the file that's being served.

Therefore your project structure can to your tastes. I happen to like this for a web site that serves both a top level domain (e.g. `https://example.com`) and an api subdomain (e.g. `https://api.example.com`):

```bash
/var/www/example.com/    # This is the example.com virtualhost folder
├── api/                 # https://api.example.com via Apache <Directory> setting
│   ├── path/
│   │   ├── endpoint.py
│   ├── endpoint.py
│   ├── index.html       # documentation
│   ├── .htaccess        # turn off .py extension
├── modules              # Custom classes, not accessible via HTTP
│   ├── lib/
│   │   ├── hermes.py    # HERMES!
│   │   ├── hades.py
│   ├── myobjectclasses.py
├── templates            # jinja templates, not accessible via HTTP
│   ├── www/
│   │   ├── file.jinja.htm
│   │   ├── subfolder/
│   │   │   ├── file.jinja.htm
├── www/                 # http://www.example.com via Apache <Directory> setting
│   ├── index.py
│   ├── subfolder/
│   │   ├── file.py
│   ├── .htaccess        # turn off .py extension
├── requirements.txt     # For easy installing of python dependencies
└── .gitignore
```

# Serving Content

### GET, POST, PATCH, and DELETE

Hermes connects HTTP methods with callback functions in your code. So if you want to support POST and PATCH, just tell hermes to connect that method to a function. In case you are making an API, Hermes will automatically update your `OPTIONS` method with the appropriate `Access-Control-Allow-Methods` header.

For example:

`/var/www/example.com/www/index.py`:

```python3
import sys
from os import environ
from hermes import HttpServer, WebManager

http_server = HttpServer(environ, sys.stdin)
web_manager = WebManager(http_server, database_manager)

def handle_get(http_server, database_manager):
    http_server.print_headers()
    print("<html><body><h1>GET method</h1></body></html>")

def handle_put_post(http_server, database_manager):
	# get form-encoded POST body - assume "name=John"
    post_parameters = http_server.get_post_parameters()
    name = post_parameters["name"]

    http_server.print_headers()
    print("<html><body>")
    print("<h1>POST or PUT method</h1>")
    print("<p>POST name=" + name + "</p>")
    print("</body></html>")

# connect GET HTTP method to local handle_get function
web_manager.set_method_callback(
    WebManager.HTTP_METHOD_GET,
    handle_get
)
# connect PUT and POST HTTP method to local handle_put_post function
web_manager.set_method_callback(
    WebManager.HTTP_METHOD_PUT,
    handle_put_post
)
web_manager.set_method_callback(
    WebManager.HTTP_METHOD_POST,
    handle_put_post
)
# unsupported methods will result in an
# HTTP 405 Method not allowed error response
#web_manager.set_method_callback(
#    WebManager.HTTP_METHOD_DELETE,
#    handle_delete
#)
web_manager.run()
```

### Using a template library
If you are serving web content, you'll want a template library. You can use any one you want, but Jinja happens to be popular. Just follow the documentation for your favorite template library.

Here's an example of how to integrate with Jinja.

Your Jinja template might look like this:

`/var/www/example.com/templates/index.jinja.html`:
```markup
<!DOCTYPE html>
<html>
	<head>
    	<title>Welcome {{ name }}</title>
    </head>
    <body>
        <h1>Welcome {{ name }}</h1>
    </body>
</html>
```

Your hermes file will import jinja2 libraries and have a way to fetch a template file, like this:

`/var/www/example.com/www/index.py`:
```python3
import sys
from os import environ
from hermes import HttpServer, WebManager
# Import jinja libraries
from jinja2 import Environment, select_autoescape, FileSystemLoader

http_server = HttpServer(environ, sys.stdin)
web_manager = WebManager(http_server, database_manager)

def fetch_template(template_file):
	"""Try to get a Jinja template."""
    template_loader = FileSystemLoader(
        settings["login_page"]["templates_folder"]
    )
    env = Environment(
        loader=template_loader,
        autoescape=select_autoescape(['html', 'xml'])
    )
    template = env.get_template(template_file)
    return template

def handle_get(http_server, database_manager):
	# Define what variables to populate in the template
    keys = {
        "name": "John",
    }
    # render the template to a string
    output = template.render(keys)
    # output the resulting HTML to your web server
    http_server.print_headers()
    print(output)

web_manager.set_method_callback(
    WebManager.HTTP_METHOD_GET,
    handle_get
)
web_manager.run()
```

### Using a database

Hermes is database agnostic, so you can attach any database you like. If you want a database that's designed with Hermes in mind, check out [Hades](https://github.com/backupbrain/hades), a lightweight MySQL database that creates objects from a detected table structure.

Let's assume you have a table with the following structure:
```sql
CREATE TABLE `person_info` {
	`id` UNSIGNED INT AUTO_INCREMENT PRIMARY_KEY,
    `name` VARCHAR(100) NOT NULL,
    `age` UNSIGNED INT,
    `created` DATETIME DEFAULT CURRENT_TIMESTAMP
}
```
And assume you the table is populated with the following data:
|id|name|age|created            |
|-:|----|--:|------------------:|
|1 |John|32 |2019-04-12 12:23:33|
|1 |Mary|41 |2019-02-21 05:07:53|

Your Hades object will look like this:
`/var/www/example.com/modules.py`
```
from hades import DatabaseObject

class PersonInfo(DatabaseObject):

    def __init__(self, database_manager):
        self.database_manager = database_manager

```

Create a project settings file:

`/var/www/example.com/www/settings.py`:
```python3
mysql = {
  'server': '<IP_ADDRESS>',
  'port': '3306',
  'username': 'mysql_username',
  'password': 'mysql_password',
  'db': 'project_database',
  'charset': 'utf-8'
}

```

You may want to use Jinja to make templating easier:

`/var/www/example.com/templates/person.jinja.html;
```markup
<!DOCTYPE html>
<html>
	<head>
    	<title>Welcome {{ person.name }}</title>
    </head>
    <body>
        <h1>Welcome {{ person.name }}</h1>
        <p>I see you are {{ person.age }} years old this year!</p>
    </body>
</html>
```

Your Hermes file will need to load Hades libraries, connect to the database, fetch a Person object, and render the output using Jinja.

`/var/www/example.com/www/subfolder/person.py`:
```python3
import sys
# make it easier to load libraries that exist outside of this folder
# we've put the modules.py and settings.py in the parent folder, so this makes it accessible with Python's import system
sys.path.append("../")
from os import environ
from hermes import HttpServer, WebManager
from hades import DatabaseManager, DatabaseObject
from modules import Person
from jinja2 import Environment, select_autoescape, FileSystemLoader
from settings import mysql  # a shared settings file

http_server = HttpServer(environ, sys.stdin)
web_manager = WebManager(http_server, database_manager)
# get query parameters for use later. Expect "?id=1" for this example
query_parameters = http_server.get_query_parameters()
# Connect to the database using the settings file
database_manager = DatabaseManager.from_settings(mysql)

def fetch_template(template_file):
	"""Try to get a Jinja template."""
    template_loader = FileSystemLoader(
        settings["login_page"]["templates_folder"]
    )
    env = Environment(
        loader=template_loader,
        autoescape=select_autoescape(['html', 'xml'])
    )
    template = env.get_template(template_file)
    return template

def handle_get(http_server, database_manager):
	id = int(query_parameters['id'])
    person = Person.fetch_by([
    	{key: 'id', 'equivalence': '=', 'value': 1}
    ])
    template = fetch_template("templates/person.jinja.htm")
    keys = {
        "person": person,
    }
    output = template.render(keys)
    http_server.print_headers()
    print(output)

def handle_post(http_server, database_manager):
	# get JSON POST body. Assume name=John&age=32
    # However Hermes supports multipart/form-data as well
    post_parameters = http_server.get_post_json()
	id = int(query_parameters['id'])
    person = Person.fetch_by([
    	{key: 'id', 'equivalence': '=', 'value': 1}
    ])
    person.name = post_parameters["name"]
    person.age = int(post_parameters["age"]
    person.update()
    template = fetch_template("templates/person.jinja.htm")
    keys = {
        "person": person,
    }
    output = template.render(keys)
    http_server.print_headers()
    print(output)

web_manager.set_method_callback(
    WebManager.HTTP_METHOD_GET,
    handle_get
)

web_manager.set_method_callback(
    WebManager.HTTP_METHOD_POST,
    handle_post
)
web_manager.run()

```

You can then fetch this REST Resource with an HTTP GET:

*Request:*
```data
GET /subfolder/person
Accept: text/html

```
*Response:*
```
HTTP 1.1 200 OK
Content-Type: text/html; encoding=utf-8

<!DOCTYPE html>
<html>
	<head>
    	<title>Welcome John</title>
    </head>
    <body>
        <h1>Welcome John</h1>
        <p>I see you are 32 years old this year!</p>
    </body>
</html>
```

Or update this REST Resource with an HTTP POST :

*Request:*

```
POST /subfolder/person HTTP/1.1
Accept: text/html
Content-Type: x-www-form-urlencoded

name=John&age=32
```

*Response:*

```
HTTP 1.1 200 OK
Content-Type: text/html; encoding=utf-8

<!DOCTYPE html>
<html>
	<head>
    	<title>Welcome John</title>
    </head>
    <body>
        <h1>Welcome John</h1>
        <p>I see you are 32 years old this year!</p>
    </body>
</html>
```

### Serving REST APIs

For Hermes, the only difference between serving Web content and serving a REST API is that the API is JSON. It expects to deliver different headers and expects the outbound content to be JSON rather than HTML.

For this it uses the `http_server.print_json(output)` method.
`web_manager.set_method_callback()` updates the `ALLOWED_METHODS` header of the HTTP Response automatically.

Let's serve a static REST API.

To be fully REST compatible, we turn off `.py` in Apache:

Remove `.py` extension by adding .htaccess in the
`/var/www/example.com/www` folder:
```.htaccess
# check if a /path/to/file.py file exist
# and rewrite it as /path/to/file
# otherwise - leave it alone, it's a static file or folder
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) $1.py [L]
```

We create a person endpoint using Hermes:

`/var/www/example.com/www/api/1.0/person.py`:
```python3
import sys
from datetime import datetime
# make it easier to load libraries that exist outside of this folder
# we've put the modules.py and settings.py in the parent folder, so this makes it accessible with Python's import system
sys.path.append("../")
from os import environ
from hermes import HttpServer, WebManager

http_server = HttpServer(environ, sys.stdin)
web_manager = WebManager(http_server, database_manager)

def handle_get(http_server, database_manager):
    output = {
        "name": "John",
        "age": "32",
        "created": datetime.now().strftime('%Y-%m-%d %H:%M:%S')
    }
    http_server.print_headers()
    # Output JSON to the browser
    http_server.print_json(output)

def handle_post(http_server, database_manager):
	# get JSON POST body. Assume {"name":"John","age":33}
    post_parameters = http_server.get_post_json()
    person = {
    	"name": post_parameters["name"],
        "age": post_parameters["age"],
        "created"
    ])
    person.name = post_parameters["name"]
    person.update()
    template = fetch_template("templates/person.jinja.htm")
    keys = {
        "person": person,
    }
    output = template.render(keys)
    http_server.print_headers()
    print(output)

web_manager.set_method_callback(
    WebManager.HTTP_METHOD_GET,
    handle_get
)
web_manager.set_method_callback(
    WebManager.HTTP_METHOD_POST,
    handle_post
)
# Enable CORS for any host here
http_server.set_header('Access-Control-Allow-Origin', '*')
# This will output JSON
http_server.set_header('Conten-Type', 'application/json; encoding=utf=8')
web_manager.run()
```

The resulting GET response will be:

*Request:*
```
GET /api/1.0/person HTTP/1.1
Accept: application/json
Content-Type: application/json

```
*Response:*
```
HTTP 1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: application/json; encoding=utf-8

{"name":"John","age":32","created":"2019-02-21 05:07:53"}
```

And you can POST JSON to the API as well:

*Request:*
```
POST /api/1.0/person HTTP/1.1
Accept: application/json
Content-Type: application/json

{"name":"John","age":33"}
```
*Response:*
```
HTTP 1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: application/json; encoding=utf-8

{"name":"John","age":33","created":"2019-02-21 05:07:53"}
```

### Error Handling
Hermes has some error handling features as well. By design, Hermes doesn't print errors to the browser. This is considered a security feature. You can, however catch errors however you want and print to the browser.

For Hermes, errors are just HTTP status codes, so you can output whatever standard HTTP error you want.

`/var/www/example.com/www/error.py`:
```python3
import sys
from datetime import datetime
# make it easier to load libraries that exist outside of this folder
# we've put the modules.py and settings.py in the parent folder, so this makes it accessible with Python's import system
sys.path.append("../")
from os import environ
from hermes import HttpServer, WebManager

http_server = HttpServer(environ, sys.stdin)
web_manager = WebManager(http_server, database_manager)

def handle_get(http_server):
	# tell Hermes what error to show. for example a "404 Not Found"
    http_server.set_status(404)
    http_server.print_headers()
    # Custom 404 page
	print("<html><body><h1>Not Found</h1></body></html>")

web_manager.set_method_callback(
    WebManager.HTTP_METHOD_GET,
    handle_get
)
web_manager.run()
```

Your error will be output like this:

*Request:*
```
GET /error HTTP/1.1
Accept: text/html

```
*Response:*
```
HTTP 1.1 404 Not Found
Content-Type: text/html

<html><body><h1>Not Found</h1></body></html>
```

For reference, here's list of [HTTP 1.1 Status Codes](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes)

### Cookies

Hermes can work with Cookies as well.

#### Drop a Cookie
You can drop a cookie

`/var/www/example.com/www/cookies/drop.py`:
```python3
import sys
from datetime import datetime
# make it easier to load libraries that exist outside of this folder
# we've put the modules.py and settings.py in the parent folder, so this makes it accessible with Python's import system
sys.path.append("../")
from os import environ
from hermes import HttpServer, WebManager

http_server = HttpServer(environ, sys.stdin)
web_manager = WebManager(http_server, database_manager)

def handle_get(http_server):
	http_server.set_cookie("key","value")
    http_server.print_headers()
	print("<html><body><h1>Cookie Dropped</h1></body></html>")

web_manager.set_method_callback(
    WebManager.HTTP_METHOD_GET,
    handle_get
)
web_manager.run()
```

The result will look like this:

*Request:*
```
GET /cookies/drop.py HTTP/1.1
Accept: text/html

```
*Response:*
```
HTTP 1.1 404 Not Found
Content-Type: text/html
Cookie: key=value

<html><body><h1>Cookie Dropped</h1></body></html>
```

#### Read a Cookie
You can read a cookie

`/var/www/example.com/www/cookies/drop.py`:
```python3
import sys
from datetime import datetime
# make it easier to load libraries that exist outside of this folder
# we've put the modules.py and settings.py in the parent folder, so this makes it accessible with Python's import system
sys.path.append("../")
from os import environ
from hermes import HttpServer, WebManager

http_server = HttpServer(environ, sys.stdin)
web_manager = WebManager(http_server, database_manager)

def handle_get(http_server):
	# get a cookie with the default value being "unset" if not found
	cookie_value = http_server.get_cookie("key", "unset")
    http_server.print_headers()
	print(
    	"<html><body><h1>Cookie:</h1><p>{}</p></body></html>".format(
            cookie_value
        )
    )

web_manager.set_method_callback(
    WebManager.HTTP_METHOD_GET,
    handle_get
)
web_manager.run()
```

#### Delete a Cookie
You can read a cookie

`/var/www/example.com/www/cookies/drop.py`:
```python3
import sys
from datetime import datetime
# make it easier to load libraries that exist outside of this folder
# we've put the modules.py and settings.py in the parent folder, so this makes it accessible with Python's import system
sys.path.append("../")
from os import environ
from hermes import HttpServer, WebManager

http_server = HttpServer(environ, sys.stdin)
web_manager = WebManager(http_server, database_manager)

def handle_get(http_server):
	# get a cookie with the default value being "unset" if not found
	http_server.delete_cookie("key", "unset")
    http_server.print_headers()
	print(
    	"<html><body><h1>Cookie Deleted</h1></body></html>")
    )

web_manager.set_method_callback(
    WebManager.HTTP_METHOD_GET,
    handle_get
)
web_manager.run()
```

repository: backupbrain/hermes

repo_name: backupbrain/hermes


text:
# win

Run bootstrap.ps1 in Powershell.

Then setup your env:

Golang
User Level:
GOROOT = C:\Users\HOME\scoop\apps\go\current

System Level:
PATH to have: C:\Users\Saadi\scoop\apps\go\current\bin

THen try to run the examples....

# TODO

Flutter, IOS and android setup to be like the MAC7 Linux ones.....

go-releaser can release to scoop:
- https://godoc.org/github.com/goreleaser/goreleaser/internal/pipe/scoop
- so we can release to a private scoop and then update apps this way.

repository: dominicporter/bootstrap

branch_name: refs/heads/master

extension: md

gha_language: Go

license_type: permissive

repo_name: dominicporter/bootstrap


text:
# Improved data citations in workspace provenance

## Background

The KBase Workspace service supports adding information about external data used in the creation
of a workspace data object to that object's provenance data structure at the time the object
is saved. After saving, the object and its provenance are immutable.

The KBase data citation effort would like to expand the fields available in the external data
data structure to support data citations and add an ability to add more external data information
to an object post save.

## Document purpose

This document provides options for improvements to the workspace external data records to
support data citations and post creation updates.

## Author

Gavin Price, 2022/04/09

## Nomenclature

NMDC - The [National Microbiome Data Collaborative](https://microbiomedata.org/)

EDU - The external data unit data structure in the KBase Workspace Service object provenance
    data structure

UPA - The Unique Permanent Address of a data object in KBase

## Resources

[NMDC citation fields](https://microbiomedata.org/nmdc-data-use-policy/)

[Workspace API](https://ci.kbase.us/services/ws/docs/Workspace.html)

[External data unit data structure in the workspace API](https://ci.kbase.us/services/ws/docs/Workspace.html#typedefWorkspace.ExternalDataUnit)

## Notes

* The workspace provenance data structure is limited to 1MB of information per object.
* Work estimates assume that the engineer is familiar with the workspace database and
  requires no learning curve. They take normal meetings and other standard distractions into
  account, but not rare distractions such as devPOC duty, etc.

## Proposal stage 1 - add new fields to the Workspace EDU data structure

The intent is to be able to support NMDC citations (and presumably other citation sources)
in the external data unit structure of the workspace. Mapping NMDC fields to the current EDU
structure results in

**Author** -> new field
**Public Release Date** -> `resource_release_[date|epoch]`
**Title** -> new field, since the `data_id` and `description` fields have different semantics
**Version ID** -> `resource_version`
**Repository** -> `resource_name`
**Resolvable Persistent Identifier(s)** -> related to `data_url`, but needs to be a list among
other issues, so new field
**Access Date** -> new field

Most new fields are simple to add:
**Title** -> `title`, an arbitrary string
**Resolvable Persistent Identifiers(s)** -> `resolvable_persistent_identifiers`, a list of
arbitrary strings. No validation is possible here as it's not given that any particular
identifier is resolvable via a network query [1].
**Access Date** -> `access_epoch`, the access date in Unix epoch milliseconds.

**Author**, however, is much more difficult. Human names are
[notoriously difficult](https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/)
to represent - most humans have two names, but some have one, some have many, and legally a human
can change their name to [almost anything](https://en.wikipedia.org/wiki/Prince_(musician)).
As such, the standard convention of two name fields can't
accommodate all human names. Furthermore, human names are not necessarily unique.

One approach for representing names, as taken in the
[KBase auth2 service](https://github.com/kbase/auth2), is to represent names by a single
completely arbitrary string, which can handle most cases. We use the same approach here.

Note that for all the cases below, the EDUs in the `MongoDB` database are currently stored in
a list embedded in a list of provenance actions, which means they are unindexable. No features in
this proposal require indexing so this case is not addressed.

1. Another option is making the identifier entries a structure instead of an arbitrary string.
   Whether the identifier is resolvable by a network query could then be added as a field,
   and the workspace could validate the identifier. This seems generally unnecessary, however -
   it seems reasonable for the code saving the object to validate the identifier when necessary.

### Author option 1 - arbitrary strings

In this case the `authors` field is a list of arbitrary strings which will be populated
verbatim from the data source.

Pros:

* Simple implementation

Cons:

* Names don't uniquely identify people
* Names can change over time, leaving outdated records in the database
* The same names can be represented differently, meaning the database could have different
  records that refer to the same person
* No possibility of adding new fields in the future

Estimated work: Conservatively 1 week

### Author option 2 - structure

In this case the `authors` field is a list of structures with the fields

* `name` - an arbitrary string
* `kbaseid` - the person's KBase ID, if any. Any entries will be validated as existing users.
* `orcid` - the persons's OrcID, if any. See validations options below.

Pros:

* Relatively simple implementation
* Allows for more information about the person, including theoretically unique IDs (although
  a person can have many KBase accounts. A person *should* only have one OrcID but it's not clear
  if that constraint is enforced or enforceable).
* Allows for adding more fields in the future to add more information about people in data
  citations.

Cons:

* In many cases only the person's name will be available
* Names don't uniquely identify people
* Names can change over time, leaving outdated records in the database
* The same names can be represented differently, meaning the database could have different
  records that refer to the same person
* The name could be entered differently for the same KBase or OrcID in different records
* If a person creates a KBase ID or OrcID after data creation, that will not be reflected in
  the database records

Estimated work: 1 week

Further options:

* Validate OrcIDs
  * Needs further research but probably work estimate + 1 week
* If a KBase ID is present, populate the name and OrcID (if present) from the Auth2 server
  * The workspace will need access to an Auth2 Administrator account
  * Work estimate + 1 week
  * Note that the OrcID in the Auth2 server can change or be removed for a specific user over time,
    hence storing them permanently with the user record at the time of creation

### Names option 3 - central DB with unique ID in structure

In this case the `authors` field is a list of IDs, each of which uniquely identifies a person
in the world. Each IDs refers to a record in a database which contains the user's name,
optionally a KBase ID, and optionally an OrcID. Other fields may be present as needed.

This option requires the discovery or creation of a database of humans, uniquely
identified with no duplication, with the fields we need. The database must be updateable by
anyone who wishes to add EDUs to an object, and must ensure that duplicate records are not
added for the same person.

Pros:

* Each ID uniquely identifies a single person in the world. Workspace provenance records
  will not contain multiple different records referring to the same person.
* As a user's information changes over time, those changes can be reflected in views of the
  EDU data by pulling the information from the central database, rather than storing it in the
  records.
* Allows for adding more fields in the future to add more information about people in data
  citations.

Cons:

* Extremely difficult implementation. It is not clear if there is any way to prevent duplicate
  records for the same person from being added to the database.
* Privacy is a concern, as we are creating a database, presumably separate from the workspace,
  which will need access control.

Estimated work: Unable to estimate without extensive research into uniquely identifying
people globally and avoiding duplicate entries in a database

## Proposal stage 2 - adding new EDUs to an existing object

Currently once an object is saved it is impossible to update the provenance, including adding
EDUs. Ideally all EDU information is known at the time of object creation, but that is not always
the case.

Add new APIs to add and view EDUs after objects have been saved. These post-save EDUs
will be stored in a different `MongoDB` collection, indexed by object UPA, to keep them separate
from the EDUs present at save time, thus maintaining reproducibility of results.

A new field, `added`, will be added to the EDU structure that contains the Unix epoch timestamp,
in milliseconds, when the EDU was added to the object post-save.

A Kafka event will be sent any time an EDU is added to an object.

There are at least two implementation options:

1. Set a maximum number of EDUs that can be added to any particular object post-creation.
  We propose 1000 here. In this case, all the EDUs can be stored in a single `MongoDB` document
  with plenty of room (~15KB each for 1000) for each EDU.
  * When the maximum number of EDUs has been added for a particular object, any further attempts
    to add an EDU fail.
  * Add a new API to add EDUs to objects after save.
  * Add a toggle to the `get_objects2` method to include all post-save EDUs, if present, in
    the returned data structure.
  * Since `get_objects2` can return 10K objects and this design allows 15MB of EDUs per object
    when serialized, that means up to 150GB of JSON EDU data could be returned in one call, which
    is clearly excessive. Worse, deserialized JSON data is often 5-20x larger in memory.
    * Store the sizes of the EDU objects and check sizes before returning the data. If the total
      size is more than some limit (100MB?) throw an error.
    * Add a field to `get_object_info3` that provides the total EDU size for an object.
    * If we wish to reduce memory usage pull the EDUs in batches and serialize, then discard
      the object data (is there a way to pull the raw BSON from Mongo rather than returning
      deserialized data?).
  * Work estimate: 3 weeks
2. Allow any number of EDUs to be added to any particular object.
  * In this case, each EDU will get its own `MongoDB` document.
  * Add a new API to add EDUs to objects after save.
  * Add a new API to list, sort, filter, and paginate EDUs.
  * Work estimate: 6 weeks

license: MIT

branch_name: refs/heads/develop

gha_language: Java

gha_license_id: MIT


text:
## What

Rails controller spec helpers for Warden. If you're using Warden
without Devise in rails, due to how ActionController sets up the test
environment, custom test setup code is necessary.

## Usage

```ruby
# Gemfile
group :test do
  gem 'warden-rspec-rails'
end

# spec_helper.rb
RSpec.configure do |c|
  c.include Warden::Test::ControllerHelpers, type: :controller
end
```

This will define helper methods in controller tests that you can use to manage
authentication, such as:
- `warden`: Access the `Warden::Proxy`.
- `login_as`: Same as the `Warden::Test::Helpers` `login_as` method.
- `logout`: Same as the `Warden::Test::Helpers` `logout` method.
- `unlogin`: Removes the user(s) from the logged-in list, but leaves the
    session value so the user can be fetched on access.

## Thanks

* Devise: https://github.com/platformatec/devise
* Kentaro Imai: http://kentaroimai.com/articles/1-controller-test-helpers-for-warden

repository: ajsharp/warden-rspec-rails

gha_language: Ruby

repo_name: ajsharp/warden-rspec-rails


text:
Author:  Ryan Beck
This  is  the  Git  lab  for  CSCI  213  Software  Development.   One  class  was  added,  Car.java,
which extends the abstract Vehicle class.  The Car class contains the following:
•two instance variables
•a parameterized constructor for all current and super instance variables
•getters for the instance variables in this class
•the toString method
•the equals method
•a copy method

![This is a alt text.](https://www.pixelstalk.net/wp-content/uploads/2016/07/Pretty-Picture-HD-Tumblr.jpg "This is a sample image.")

branch_name: refs/heads/main


text:
# Service Control Filter

[Google Service Infrastructure](https://cloud.google.com/service-infrastructure/docs/overview)
is Google's foundational platform for creating, managing, and consuming APIs and services.

This filter uses [Google Service Control's REST API](https://cloud.google.com/service-infrastructure/docs/service-control/reference/rest/)
to check authentication, rate-limit calls, report metrics, and create logs for API requests.

## Prerequisites

This filter will not function unless the following filters appear earlier in the filter chain:

- [Path Matcher](../path_matcher/README.md)


text:
+++
title = "Why Should I Practice or Adopt Chaos Engineering?"
chapter = false
weight = 20
+++

There are many reasons to perform chaos engineering. We see teams across the industry turn to this practice to reduce incidents, lower the cost of downtime, train their team and prepare for moments that matter.

#### Reduce Incidents
By practicing chaos engineering you are able to detect issues before they become incidents and before your customers get affected.

#### Cost of Downtime
The cost of downtime is very expensive, the average company loses $300,000/hour of downtime. The numbers get larger with the companies that operate at internet scale, and if it's during a high traffic event like a sale or launch. You can read more on this [here](https://www.gremlin.com/blog/the-cost-of-downtime/)

#### Train your Team
Give your team a chance to build their muscle memory. Run planned Chaos Engineering experiments to train your engineers on how to be on call and respond to incidents.

#### Prepare for moments that matter
By working on the three points above your team will feel more confident everyday as they build their respective applications and systems. Less time will be spent fire fighthing and  more time building and creating value.

repository: crepers/aws-modernization-with-gremlin

repo_name: crepers/aws-modernization-with-gremlin


text:
# hello-react-native
Getting started with react-native and redux. Implementing basic login-signup and navigation-drawer
using react-native-router-flux.

### How to install

1. clone this project `git clone https://github.com/varunon9/hello-react-native.git`
2. `cd hello-react-native`
3. Install dependencies `npm install`
4. Start server `react-native start`
5. If Emulator is running `react-native run-android`

### Additional Dependencies

1. react-native-elements
2. react-native-router-flux
3. react-redux
4. redux-thunk

## Screenshots
|  |  |
| --- | --- |
|![Login](./screenshots/login.png) | ![Navigation Drawer](./screenshots/navigation-drawer.png)|
|![Home](./screenshots/home.png) | ![Profile](./screenshots/profile.png)|


text:
# module::Copyable [![status](https://github.com/Wandalen/wCopyable/actions/workflows/StandardPublish.yml/badge.svg)](https://github.com/Wandalen/wCopyable/actions/workflows/StandardPublish.yml) [![experimental](https://img.shields.io/badge/stability-experimental-orange.svg)](https://github.com/emersion/stability-badges#experimental)

Copyable mixin adds copyability and clonability to your class. The module uses defined relation to deduce how to copy / clone the instance.

### Try out
```
npm install
node sample/Base.s
```
```
npm install
node sample/Descendant.s
```

repository: Wandalen/wCopyable

gha_language: JavaScript

repo_name: Wandalen/wCopyable


text:
# WebSocket Client + Server Demo

WebSockets is a technology, based on the ws protocol, that makes it possible to establish a continuous full-duplex connection stream between a client and a server.  A typical websocket client would be a user's browser, but the protocol is platform independent. It is the closest API to a raw network socket in the browser. Except a WebSocket connection is also much more than a network socket, as the browser abstracts all the complexity behind a simple API and provides a number of additional services:

* Connection negotiation and same-origin policy enforcement
* Interoperability with existing HTTP infrastructure
* Message-oriented communication and efficient message framing
* Subprotocol negotiation and extensibility

This is a demo shows a demo of a client connecting to a websocket server and sharing data.

## Getting Started

This demo requires a server for your client - install `http-server` with `npm i -g http-server`

* `npm i`
* `node server.js`
* `http-server`
* Go to [http://localhost:8081/](http://localhost:8081/)


text:
---
id: 368
title: Spring Integration Hello World tutorial
date: 2013-04-20T19:34:44+00:00
author: Marco Molteni
layout: post
guid: http://javaee.ch/?p=368
permalink: /2013/04/20/spring-integration-hello-world-tutorial/
video_type:
  - '#NONE#'
categories:
  - Intellij
  - java
  - Java 6
  - Maven
  - Spring
---
Here you can find another Hello World example that shows the first steps to build a Spring Integration application.

In our example we create a new Java application that send a message ‘World’ to a channel, a Spring service receives and modifies this string (‘Hello World!’). Eventually and the message is sent to a print service through a second channel.

[]({{site.baseurl}}/assets/img/uploads/2013/04/spring_integration_1.png)

The structure of the application is very simple:

[]({{site.baseurl}}/assets/img/uploads/2013/04/spring_integration_2.png)

You can find all the code on gitHub: https://github.com/marco76/SpringIntegrationExamples

The project is build with maven (and developed using IntelliJ). In the pom.xml you have to import the usual libraries and Spring Integration:

```xml
<dependency>
    <groupId>org.springframework.integration</groupId>
    <artifactId>spring-integration-core</artifactId>
    <version>2.2.3.RELEASE</version>
</dependency>
```

The _spring-config.xml_ configure the channels used by the application:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:integration="http://www.springframework.org/schema/integration"
       xmlns:beans="http://www.springframework.org/schema/beans"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd">

    <context:annotation-config />

    <context:component-scan base-package="ch.javaee.integration.example.helloWorld"/>

    <!-- this channel is called by the application and the message is passed to it -->
    <integration:channel id="inputChannel"/>

    <!-- this channel receive the modified message -->
    <integration:channel id="outputChannel"/>

    <!-- this service transform the message in input-channel and send the result to output-channel -->
    <!-- the service method to call is referenced in explicitly -->
    <integration:service-activator input-channel="inputChannel" ref="helloService" method="sayHello" output-channel="outputChannel"/>

    <!-- this service receives a message and pass it to printerService -->
    <!-- the method that consumes the message is implicitly defined by the @ServiceActivator annotation or it should be the only
    method in the class -->
    <integration:service-activator input-channel="outputChannel" ref="printerService"/>

</beans>
```

We have 2 channels that are used to transfer messages between services. The _service-activator_ wait for messages sent to the _input-channel_ it call a predefined service (ex. _helloService_). If the called service returns a value this value is sent to the _output-channel_.

```java
/**
 * The goal of this example is to show how a message can be sent to one input channel,
 * be transformed by a service, sent to a second channel and consumed by a second service
 */
public class HelloApp {
    public static void main(String[] args) {

        // load the Spring context
        ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");

        // get the reference to the message channel
        MessageChannel channel = context.getBean("inputChannel", MessageChannel.class);

        // create a message with the content "World"
        Message<String> message = MessageBuilder.withPayload("World").build();

        // send the message to the inputChannel
        channel.send(message);
    }
}
```

The main class of the application (_HelloApp_) load the spring beans and send a message to the _inputChannel_.

The _service-activator_ read the message and pass it to method _sayHello_ _helloService_:

```xml
<integration:channel id="inputChannel"/>
<integration:service-activator input-channel="inputChannel" ref="helloService" method="sayHello" output-channel="outputChannel"/>
```

```java
/**
 * This service simply modify the original message and return the new message
 */
@Component
public class HelloService {

    public String sayHello(String name) {
        return "Hello " + name + "!";
    }
}
```

HelloService is a simple bean Spring (_@Component_), it doesn’t know anything about Spring integration.

The method _sayHello_ return a String value (“Hello ” + “world” + “!”). Spring send this string to the _output-channel_ defined in the configuration.

```xml
<integration:channel id="outputChannel"/>
<integration:service-activator input-channel="outputChannel" ref="printerService"/>
```
In this case we don’t need to define which method will receive the message. Spring doesn’t need to explicitly know the name if:

– there is only one method in the class

– the method is annotated with @ServiceActivator (as in our case)

```java
/**
 * This service consume the message and print it on the console
 */

@Component
public class PrinterService {

    // if only one method is present in the class the @ServiceActivator is not necessary
    // in alternative the method has to be explicitly declared in the configuration

    @ServiceActivator
    public void printValue(String value){
        System.out.println(value);
    }
}
```

The PrinterService receive the message from _outputChannel_ and print it (“Hello World!”) to the console. The method should not return any value to avoid the following error:

_Exception in thread “main” org.springframework.integration.support.channel.ChannelResolutionException: no output-channel or replyChannel header available_

gha_language: HTML

gha_license_id: NOASSERTION


text:
---
layout: post
title: Jake It Off!
permalink: /portfolio/jake-it-off/
---

A short, relatively straightforward To Do list application.

gha_language: CSS


text:
# Ansible Role: istio

An Ansible Role that deploys Istio (https://istio.io) in an OpenShift cluster running locally, generally created by using Minishift (https://www.openshift.org/minishift).
This Role performs the following tasks:

- Check if OpenShift is running locally.
- Downloads and installs the specified version or latest of Istio.
- Uses the latest `oc` binary from `~/.minishift/cache/oc/<VERSION>/<OS>/` and `istioctl` from downloaded Istio binary.

## Prerequisites

- Ansible 2.3+
- Prior to running the role, clear your terminal session of any DOCKER* environment variables.
- `sudo` access in your host is required for installing `istioctl` (optional).
- OpenShift running locally. See `https://galaxy.ansible.com/chilcano/minishift` to get OpenShift running in a VM.

## Observations

The Istio Ansible Role has been tested with:
- minishift v1.11.0+4459917
- kubernetes 3.7
- istio 0.2.7
- VirtualBox 5.1.30
- macOS High Sierra, version 10.13.2 (17C88)

## Default Role variables

The default variables are in `defaults/main.yml`.

## Example Playbook

See `sample-1-istio.yml` file for an example.

```
$ cat sample-1-istio.yml
```

```yaml
---
- name: Install Istio.
  hosts: Pisc0
  connection: local
  gather_facts: yes
  vars:
    vm: openshift0

  roles:
    - role: chilcano.istio
      istio:
        action_to_trigger: clean  # [ deploy | clean ]
        action:
          deploy:
            istioctl: true    # istioctl
            core: true        # core components
            addons: true      # prometheus, graphana, zipkin, servicegraph
            sample_apps: true # bookinfo
        minishift:
          profile: "{{ vm }}"
        openshift:
          project: istio-system    # default
          hostname: "{{ vm }}"
          admin_usr: "system:admin"
          admin_pwd: anypassword
          istio_usr: developer
          istio_pwd: anypassword
        repo:
          #release_tag_name: ""   # latest
          release_tag_name: "0.2.7"
          #release_tag_name: "0.2.6"
```

## Using the Ansible Role

Install the role:
```
$ sudo ansible-galaxy install chilcano.istio
```

Copy the playbook from your roles path to the current working directory:
```
$ cp ${ANSIBLE_ROLES_PATH}/chilcano.istio/sample-1-istio.yml .
```

Create an `inventory` file
```
$ echo $(hostname) > ./inventory
```

Run the playbook:
```
$ ansible-playbook -i inventory --ask-become-pass sample-1-istio.yml
```

When Playbook execution has been finished, check if all Pods, Services, etc. have been deployed and running.

```
$ eval $(minishift oc-env)

$ oc project bookinfo

$ oc status
In project bookinfo on server https://<IP_ADDRESS>:8443

svc/details - <IP_ADDRESS>:9080
  pod/details-v1-1464079269-wxfl5 runs istio/examples-bookinfo-details-v1:0.2.3, docker.io/istio/proxy_debug:0.2.7

svc/productpage - <IP_ADDRESS>:9080
  pod/productpage-v1-3915871613-p2cp6 runs istio/examples-bookinfo-productpage-v1:0.2.3, docker.io/istio/proxy_debug:0.2.7

svc/ratings - <IP_ADDRESS>:9080
  pod/ratings-v1-327106889-rvqpv runs istio/examples-bookinfo-ratings-v1:0.2.3, docker.io/istio/proxy_debug:0.2.7

svc/reviews - <IP_ADDRESS>:9080
  pod/reviews-v1-3806695627-2xkg6 runs istio/examples-bookinfo-reviews-v1:0.2.3, docker.io/istio/proxy_debug:0.2.7
  pod/reviews-v2-3096629009-2cfht runs istio/examples-bookinfo-reviews-v2:0.2.3, docker.io/istio/proxy_debug:0.2.7
  pod/reviews-v3-1994447391-ws74d runs istio/examples-bookinfo-reviews-v3:0.2.3, docker.io/istio/proxy_debug:0.2.7

View details with 'oc describe <resource>/<name>' or list everything with 'oc get all'.

$ oc get pods
NAME                              READY     STATUS     RESTARTS   AGE
details-v1-1464079269-wxfl5       0/2       Init:0/2   0          1m
productpage-v1-3915871613-p2cp6   0/2       Init:0/2   0          1m
ratings-v1-327106889-rvqpv        0/2       Init:0/2   0          1m
reviews-v1-3806695627-2xkg6       0/2       Init:0/2   0          1m
reviews-v2-3096629009-2cfht       0/2       Init:0/2   0          1m
reviews-v3-1994447391-ws74d       0/2       Init:0/2   0          1m

$ oc get pods
NAME                              READY     STATUS     RESTARTS   AGE
details-v1-1464079269-wxfl5       0/2       Init:1/2   0          2m
productpage-v1-3915871613-p2cp6   0/2       Init:1/2   0          2m
ratings-v1-327106889-rvqpv        0/2       Init:1/2   0          2m
reviews-v1-3806695627-2xkg6       0/2       Init:1/2   0          2m
reviews-v2-3096629009-2cfht       0/2       Init:1/2   0          2m
reviews-v3-1994447391-ws74d       0/2       Init:1/2   0          2m

$ oc get pods
NAME                              READY     STATUS            RESTARTS   AGE
details-v1-1464079269-wxfl5       0/2       PodInitializing   0          3m
productpage-v1-3915871613-p2cp6   0/2       PodInitializing   0          3m
ratings-v1-327106889-rvqpv        0/2       PodInitializing   0          3m
reviews-v1-3806695627-2xkg6       0/2       PodInitializing   0          3m
reviews-v2-3096629009-2cfht       0/2       PodInitializing   0          3m
reviews-v3-1994447391-ws74d       0/2       PodInitializing   0          3m

$ oc get pods
NAME                              READY     STATUS    RESTARTS   AGE
details-v1-1464079269-wxfl5       2/2       Running   0          7m
productpage-v1-3915871613-p2cp6   2/2       Running   0          7m
ratings-v1-327106889-rvqpv        2/2       Running   0          7m
reviews-v1-3806695627-2xkg6       2/2       Running   0          7m
reviews-v2-3096629009-2cfht       2/2       Running   0          7m
reviews-v3-1994447391-ws74d       2/2       Running   0          7m
```

Finally you will see Istio and BookInfo App running in your OpenShift Cluster. The `Init:0/2`, `Init:1/2` and ``PodInitializing` mean that BookInfo App is  initializing/starting and it isn't ready to use.
All pictures below were captured from Weave Scope App. It's a tool to manage, monitor and visualize your OpenShift Cluster. If you want to install it, you can use the Weave Scope Ansible Role that I've created for you (https://github.com/chilcano/ansible-role-weave-scope).

* Exploring all Istio components (select `istio-system` namespace).

![Selecting istio-system namespace](https://github.com/chilcano/ansible-role-istio/blob/master/imgs/api-mesh-security-7-weave-scope-istio-system.png "Selecting istio-system namespace")

* Exploring BookInfo App deployed on OpenShift (select `bookinfo` namespace).

![Selecting bookinfo namespace](https://github.com/chilcano/ansible-role-istio/blob/master/imgs/api-mesh-security-8-weave-scope-bookinfo.png "Selecting bookinfo namespace")

* Exploring in depth the BookInfo App.

![Exploring in depth the API Mesh](https://github.com/chilcano/ansible-role-istio/blob/master/imgs/api-mesh-security-9-weave-scope-bookinfo-mesh.png "Exploring in depth the API Mesh")

* Using BookInfo Web App and making calls to BookInfo APIs.

![Using BookInfo App deployed on OpenShift](https://github.com/chilcano/ansible-role-istio/blob/master/imgs/api-mesh-security-3-istio-bookinfo-app.png "Using BookInfo App deployed on OpenShift")

* The Istio Addons: Tracing with Zipkin.

![Tracing with Zipkin](https://github.com/chilcano/ansible-role-istio/blob/master/imgs/api-mesh-security-4-istio-zipkin.png "Tracing with Zipkin")

* The Istio Addons: Exploring metrics with Grafana.

![Exploring metrics with Grafana](https://github.com/chilcano/ansible-role-istio/blob/master/imgs/api-mesh-security-5-istio-grafana.png "Exploring metrics with Grafana")

* The Istio Addons: Viewing the flows with ServiceGraph.

![Viewing the flows with ServiceGraph](https://github.com/chilcano/ansible-role-istio/blob/master/imgs/api-mesh-security-6-istio-servicegraph.png "Viewing the flows with ServiceGraph")

## License

MIT / BSD

## Author Information

This role was created in 2017 by [Roger Carhuatocto](https://www.linkedin.com/in/rcarhuatocto), author of [HolisticSecurity.io Blog](https://holisticsecurity.io).

repository: polarisintellect/AnsibleZone

repo_name: polarisintellect/AnsibleZone


text:
# Abstract Data Types

## 4.4 Stack ADT Implementations

To allow the stack to grow and shrink gracefully, we may wish to consider using a linked list.


text:
# sphere-wireless

Once the system is installed you can use the wpa_cli to configure a wireless connection.

```
ubuntu@localhost:~$ sudo -i
root@localhost:~# wpa_cli
wpa_cli v2.1
Copyright (c) 2004-2014, Jouni Malinen<EMAIL_ADDRESS>and contributors

This software may be distributed under the terms of the BSD license.
See README for more details.

Selected interface 'wlan0'

Interactive mode

> add_network 0
0
> set_network 0 ssid "homenetlol"
OK
> set_network 0 psk "XXX"
OK
> enable_network 0
OK
...
> save
OK
```

repository: ninjasphere/ninjasphere-snappy

gha_language: Shell

repo_name: ninjasphere/ninjasphere-snappy


text:
# PROJECT TITLE
_by Adela_

## Project Developers
 - Max Eckardt

## Project Description
Installation and Configuration notes of JupyterHub for Researchers at Aarhus University.

server:
internal name: chcaa-worker02.uni.au.dk

## Data Assessment ##
| Source | risk | Storage | Comment|
| --- |:---:|---|---|
|||| |

## Time Estimate ##

## Deadline ##

## License ##
This software is [MIT licensed](./LICENSE.txt).


text:
# mpretty
example number prettifier code for fun and profit.  Take an input of an integer and get rid of the insignificant digits to make it look better.

## Use Cases
```
input: 1000000
output: 1M

input: 2500000.34
output: 2.5M

input: 532
output: 532

input:<PHONE_NUMBER>
output: 1.1B
```

## Code Examples

```
>>> from mpretty import mpretty
>>> x =<PHONE_NUMBER>
>>> print(mpretty(x))
1.3B
>>> x = 1.234e8
>>> print(mpretty(x))
123.4M
```

# Documentation
Documentation for the project is in the ./docs directory

## Running on command line
```
./mpretty<PHONE_NUMBER>
1.1B
```

## Running tests
```
python3 -m pytest
```
Note: Depending on your distribution, you might have to install pytest: `pip install pytest`

## Build & Install
```
python setup.py build
python setup.py install
```

gha_language: Python


text:
## React.js slider component

A simple slider made with react.js

[demo](http://emadb.github.com/react-discrete-slider/)

Install with

```npm install react-discrete-slider --save```

Properties and configuration

```jsx
<Bar
  value={this.state.value}
  showLabel
  buttons
  getColor={getColorFunction}/>
```

- `value` (number): value to be shown
- `showLabel` (bool): true if you want to view the  labels
- `buttons` (bool): true if you want to use the buttons
- `getColor` (function): function to get the color. The function receive the current value so that the bar color can change based on value
- `size` (number): number of steps
- `step` (number): size of step for dividing the bar

repository: emadb/react-discrete-slider

repo_name: emadb/react-discrete-slider


text:
# Vortex
## Commander-style File Manager in 16-bit Assembler for DOS

### Build

Requires [A86 Assembler](http://www.eji.com) to be in the PATH

From the command-line: `build`

### Run

From the command-line: `VX`

### Screenshots

![Screenshot 2022-09-12 174116](https://user-images.githubusercontent.com/72200979/189709919-88f0104d-df7a-42c3-b0c5-cc095c629ee1.png)

repository: brentengelbrecht/vortex-file-manager

repo_name: brentengelbrecht/vortex-file-manager


text:
## What’s changed

## 🐛 Bug fixes

- Fix typo in Ingress NGINX template @frenck (#60)

## 🚀 Enhancements

- Refactor NGINX configuration @frenck (#56)

## 🧰 Maintenance

- Cleanup repository @frenck (#51)
- Happy New Year @frenck (#52)
- Upgrade Code of Conduct @frenck (#53)
- Add new repository workflow @frenck (#54)
- Remove obsolete webui from configuration @frenck (#59)

## ⬆ Dependency updates

- Upgrade add-on base image to 9.1.0 @frenck (#55)
- ⬆ Bump actions/stale from v3.0.14 to v3.0.15 @dependabot (#58)
- ⬆ Bump frenck/action-addon-linter from v1.3.1 to v1.4 @dependabot (#57)
- Upgrade add-on base image to 9.1.1 @frenck (#61)

repository: ohormazabal/repository

repo_name: ohormazabal/repository


text:
# CryptAPic
An [entry for HackRiddle 2016](http://devpost.com/software/cryptapic) by:
 * [ThomasBassa](https://github.com/ThomasBassa)
 * [NewittAll](https://github.com/NewittAll)
 * [n-vijaykarthik](https://github.com/n-vijaykarthik)
 * & [aJulian42](https://github.com/aJulian42)

This is an Android application, intended to allow people
to both store and share pictures in a secure manner,
using public key encryption. It is far from complete.

The project was built using Android Studio, and should be easily checked out
using that tool.

## Design Sketch
![A whiteboard drawing depicting the flow of information throughout our app](Design.jpg)

## Licence
MIT

repository: ThomasBassa/cryptapic

repo_name: ThomasBassa/cryptapic


text:
## imgtoolpy

![build](https://github.com/UBC-MDS/imgtoolpy/workflows/build/badge.svg) [![codecov](https://codecov.io/gh/UBC-MDS/imgtoolpy/branch/master/graph/badge.svg)](https://codecov.io/gh/UBC-MDS/imgtoolpy) ![Release](https://github.com/UBC-MDS/imgtoolpy/workflows/Release/badge.svg)

[![Documentation Status](https://readthedocs.org/projects/imgtoolpy/badge/?version=latest)](https://imgtoolpy.readthedocs.io/en/latest/?badge=latest)

### Team Members

|Name    |  Github   |
|---------|---------------------|
|Ruidan Ni |  [rita-ni](https://github.com/rita-ni)|
|Frank Lu|  [Frank Lu](https://github.com/franklu2014)|
|Kexin Zhao| [Margaret8521](https://github.com/Margaret8521)|

### Package Overview

`imgtoolpy` is a Python package that is intended to allow users to compress, sharpen and crop an input image.
Our package only allows the input image to be a 3D numpy array and output the manipulated image as a 3D numpy array. It contains three functions: `compress()`, `sharpen()`, and `crop()`.

### Feature Description

- `compress`:
  - This function quantizes an image by restricting each pixel to only take on one of the desired colour values
  and return a version of the image (the same size as the original) where each pixel's original colour is replaced with the nearest prototype colour.

- `crop`:
  - A function that crop image size by removing border pixels until desired height and width are reached. This function take image input in the form of a 3D array.

- `sharpen`:
  - This function enhances the edges in the image and returns a sharper-looking image.  At this moment, this function is restricted to gray-scale images only

### Installation:

```
pip install -i https://test.pypi.org/simple/ imgtoolpy
```

### Related Packages

  There are a few existing Python packages that perform content-aware image resizing, such as `pyCAIR` (available on [PyPI](https://pypi.org/project/pyCAIR/)), and [seam-carver](https://pypi.org/project/seam-carver/). Currently, there is no package available on CRAN to resize images based on the same mechanism, however, there is a package available on Github to [seam carve image](https://github.com/vgorte/SC-Package-R).  Also, there are similar packages for image manipulation such as [scikit-image](https://github.com/scikit-image/scikit-image), which could be used for filtering and transforming images.

### Dependencies

[tool.poetry.dependencies]
- python = "^3.7"
- sklearn = "^0.0"
- numpy = "^1.18.1"
- pandas = "^1.0.1"
- scipy = "^1.4.1"
- scikit-image = "^0.16.2"

[tool.poetry.dev-dependencies]
- pytest-cov = "^2.8.1"
- pytest = "^5.3.5"
- sphinx = "^2.4.3"
- sphinxcontrib-napoleon = "^0.7"

### Usage

|Task    |  `from imgtoolpy import compress, crop, sharpen`   |
|---------|---------------------|
|Compress an image to 4 bits per channel (2^4=16 colors)|  `compress.compress(image, 4)` |
|crop an image to desired width and height  |  `crop.crop(image, 20, 20)`|
|Sharpen an image by detecting and enhancing the edges|  `sharpen.sharpen(image)`|

### Usage Scenarios

First, we should load the `imgtoolpy` library:

`from imgtoolpy import compress, crop, sharpen`

We are going to use `butterfly.jpg` image which is in the `img` folder of this repository for illustration.

![](img/butterfly.jpg)

We can apply the compress function:
`compress.compress(image, 4)`

```python
import os

from matplotlib.pyplot import imread, imshow, imsave

image = imread(os.path.join("img", "butterfly.jpg"))

imsave(os.path.join("img", "compress.jpg"), compress.compress(image, 4))
```
![](img/compress.jpg)

We can also apply the crop function:
`crop.crop(image, 400, 400)`

```python
import os

from matplotlib.pyplot import imread, imshow, imsave

image = imread(os.path.join("img", "butterfly.jpg"))

imsave(os.path.join("img", "crop.jpg"), crop.crop(image, 400, 400))
```

![](img/crop.jpg)

We can also apply the sharpen function:
`sharpen.sharpen(image)`

```python
import os
from matplotlib.pyplot import imread, imsave, cm

image = imread(os.path.join("img", "free-wallpaper.jpg"))
res = sharpen.sharpen(image)
# save the monotoned original image
imsave(os.path.join("img", "sharpen_before.png"), res[0], cmap = cm.gray)
# save the sharpened image
imsave(os.path.join("img", "sharpen_after.png"), res[1], cmap = cm.gray)
```

### Documentation
The official documentation is hosted on Read the Docs: <https://imgtoolpy.readthedocs.io/en/latest/>

### Credits
This package was created with Cookiecutter and the UBC-MDS/cookiecutter-ubc-mds project template, modified from the [pyOpenSci/cookiecutter-pyopensci](https://github.com/pyOpenSci/cookiecutter-pyopensci) project template and the [audreyr/cookiecutter-pypackage](https://github.com/audreyr/cookiecutter-pypackage).


text:
`mulefa`
========

Just a small Python script,
displaying a transparent full screen window.
The purpose of this for me
is to capture mouse wheel inputs
while using the enhanced desktop zoom feature
of hte Compiz window manager,
to keep them away from other windows
like browsers
which might interpret them
as an intent to scroll.

Usage
-----

Just bind this program
to a global keyboard shortcut
that includes the Windows key.
I have it set to `Windows + Z`
The idea is that you press that combination,
release everything **but** the Windows key,
adjust your zoom level using the mouse wheel,
and then release the Windows key as well.
The last step will automatically close the window opened by this program.

Requirements
------------

This program is not Compiz specific at all.
I don't know how other window managers
handle the situation described above,
but if yours has this problem as well,
you should still be able to use this workaround.

You **do** hovever need Python and PyQt, specifically.

repository: JulianKniephoff/mulefa

repo_name: JulianKniephoff/mulefa


text:
# Communication Plan

## How will you communicate after hours and on weekends?
We will communicate after hours through Slack. We'll generally all be available on all school days (mon-thu, sat) from 8AM-10PM.

## What is you strategy for ensuring everyone's voices are heard?
Daily group stand-ups at the start and end of the day. In that stand-up we'll make sure that each person speaks.

## How will you ensure that you are creating a safe environment where everyone feels comfortable speaking up?
By continuing to nuture and environment of open communication. And by keeping up with our stand-up meetings to address issuee before they become problems.

repository: Mac-Track/macTrack

repo_name: Mac-Track/macTrack


text:
# ImapLib-email-retreival-example
Created by Jiggs
Intended as a base code to assist with building an email checking program and provide an example of cleaning up the email text.
Basic python script to connect to an IMAP mailbox, retrieve a specific line of text from an email body and write it to a
csv file.
Includes various functions for cleaning up the returned email body if necessary.

To retrieve emails and write them to a csv file, use the Basic_Retrieval.py
For the additional functions, use the Basic_with_Added_Functions.py

repository: JiggsUK/ImapLib-email-retreival-example

repo_name: JiggsUK/ImapLib-email-retreival-example


text:
RegistrationShutdown function
======

Starts the shutdown process for all connections in the registration.

# Syntax

```C
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
void
(QUIC_API * QUIC_REGISTRATION_SHUTDOWN_FN)(
    _In_ _Pre_defensive_ HQUIC Registration,
    _In_ QUIC_CONNECTION_SHUTDOWN_FLAGS Flags,
    _In_ _Pre_defensive_ QUIC_UINT62 ErrorCode // Application defined error code
    );
```

# Parameters

`Registration`

The valid handle to an open registration object.

`Flags`

The flags that control the behavior of the shutdown.

Value | Meaning
--- | ---
**QUIC_CONNECTION_SHUTDOWN_FLAG_NONE**
0 | The connection is shutdown gracefully and informs the peer.
**QUIC_CONNECTION_SHUTDOWN_FLAG_SILENT**
1 | The connection is immediately shutdown without informing the peer.

`ErrorCode`

The 62-bit error code to indicate to the peer as the reason for the shutdown.

# Remarks

**TODO**

# See Also

[RegistrationOpen](RegistrationOpen.md)

[RegistrationClose](RegistrationClose.md)

[ConnectionShutdown](ConnectionShutdown.md)

repository: microsoft/msquic

gha_language: C

repo_name: microsoft/msquic


text:
---
layout: post
title: Videodashboard Honest Review
image: 10.jpg
tags: 'videodasboard, videodasboard review'
published: true
---
## Introduction
Hello! As we all know if you're a content creator in this modern day it can be hard to gain views and traffic
to your content as well as keeping up on the ever-changing trends of the digital universe. You could spend
hours to days researching on what is currently trending today and what type of keywords and hashtags would
bring traffic to your content, until today! If this is your problem, VideoDashboard is your solution.

## What is VideoDashboard?
VideoDashboard is a program which leverages all the social media platforms and combines them into one
singular viewing plane for easy access on what is currently trending on social media. VideoDashboard
effectively allows you to automate content creation, as it comes with features such as ready-made video
templates based upon current trends in which you can customize so it is based around your own channel and
community, it also has Traffic Automation which publishes your video to over eleven of the hottest social
media platforms right now, including YouTube, TikTok, Twitter, Facebook, Instagram, Reddit and so much
more! It's most useful and sought-after feature, however, is it's "Trending Market Pulse Finder" which
compiles literal millions of social media videos and posts in seconds which will then tell you what the
hottest trends are right now in the social media space.

### How does VideoDashboard work?
VideoDashboard works by using new unseen technologies to help leverage the trends on all social media
platforms and bring them into one, simple to understand plane which will help new and upcoming content
creators compete with the established players who have got whole SEO and Search Optimisation teams
behind them. VideoDashboard is for sure an exciting new program which, combined with its low price for
customers, will help boost those new content creators into the playing field and will give them the views and
subscribers that they sought after and deserve.
VideoDashboard is expected to launch at 3PM EST on the 11th of February where the programme will
become purchasable by everyone. Once again I urge you to check VideoDashboard out if your a new or
growing content creator if you really want that boost that will propel you into fame without having to
sacrifice thousands of dollars on advertising that will have terrible turn-outs.

## My Review of VideoDashboard
So far my experience with VideoDashboard has been excellent, the application was worth the money I
spent on it and has brought a lot of success to my Social Media outlets as promised. The features within the
program such as the Trending Market Pulse Finder and the various other means of content creation
automation has not only made getting my content out there a hundred times easier but has also made making
the content itself easier and more affordable, knowing that my videos will be successful has made me more
energetic and proud in my work and has also freed up time for me to work on revision and overall has
released a massive burden from my shoulders! Thanks VideoDashboard !

### Pros and Cons
For VideoDashboard I have struggled to find things wrong with it, as really you can not go wrong with it
considering the groundbreaking technology yet affordable price, however here are my pros and cons

Pros:
- New unseen technology
- Automates Content Creation
- Instantly posts your videos to all 11 of the hottest Social Media sites
- Amazing premade video templates
- Incredible keyword optimisation
- Brings tons of organic traffic to content

Cons:
- Isn't launching for everyone until 11th February (though this is done to make sure VideoDashboard is
polished and ready for release)

First Header | Second Header
------------ | -------------
New unseen technology | Isn't launching for everyone until 11th February (though this is done to make sure VideoDashboard is
polished and ready for release)
Automates Content Creation |
Instantly posts your videos to all 11 of the hottest Social Media sites |
Amazing premade video templates |
Incredible keyword optimisation |
Brings tons of organic traffic to content |

## Conclusion
In conclusion, VideoDashboard is a real breakthrough in the space of Social Media, it will enable the
newcomers to the game to be able to finally compete with the established players and ultimately can bring
success to almost anyone. By telling you what the current trends are you can tailor your new videos towards
them and it eliminates the process of brainstorming ideas that may not work. It also lets you automate your
social media which is once again unseen unless you have a big team of people working for you. I highly
recommend you all to check out VideoDashboard and to buy it as soon as it comes out in February, if you
don't and you have seen this article then you are really missing out on something great and which will be the
next revolution in terms of creating content for social media.

<colgroup>
<col width="30%" />
<col width="70%" />
</colgroup>

Field
Description

First column **fields**
{% fa_svg fab.fa-twitter %}Some descriptive text. This is a markdown link to [Google](http://google.com). Or see [some link][mydoc_tags].

<ion-icon name="partly-sunny"></ion-icon>Second column **fields**
Some more descriptive text.

repository: thegeekreview/thegeek

repo_name: thegeekreview/thegeek


text:
# Editing Markdown Files

Markdown is a lightweight markup language. It allows people "to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML)". [Syntax Reference](http://daringfireball.net/projects/markdown/syntax)

Seafile supports editing and viewing Markdown files directly in the web app.

![](./imgs/markdown.png)

repository: cervere/seafile-user-manual

repo_name: cervere/seafile-user-manual


text:
# Code Generation as a Dual Task of Code Summarization

[![render](https://img.shields.io/badge/render-nbviewer-orange)](https://nbviewer.jupyter.org/github/code-gen/cscg/tree/master/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

Ad-hoc implementation of the CS/CG model proposed by [Wei et al.](https://arxiv.org/abs/1910.05923)

## Getting started

- Each dataset must be defined as a sub-class of `torch.utils.data.Dataset`, with methods for
  - preprocessing and vocab builder (text -> vocab look-up indices)
  - `__getitem__` which must return a training example
  - `__len__`
  - generating train/test/valid splits
  - computing language model probabilites (i.e. `P(x)`, where `x`: anno/code tensor)

### Computing LM probabilities

- Get train/test/valid splits for a dataset.
- Construct a configuration for the LM.
- For each kind (anno/code), train a LM and dump the model as `lm-{dataset_name}-{kind}.pt` (e.g. `lm-django-anno.pt`).
- Finally, using these models, compute `P(x)` for each `x` (anno/code tensor).

## Reference
```
@article{wei2019code,
  title={Code Generation as a Dual Task of Code Summarization},
  author={Wei, Bolin and Li, Ge and Xia, Xin and Fu, Zhiyi and Jin, Zhi},
  journal={arXiv preprint arXiv:1910.05923},
  year={2019}
}
```

repository: lunaryan/cscg

repo_name: lunaryan/cscg


text:
### Image processing

Based on the Image of [Chichen Itza pyramid](https://en.wikipedia.org/wiki/Chichen_Itza) program tries to reconstruct its 3D image.

It applies [Sobel filter](https://en.wikipedia.org/wiki/Sobel_operator) to detect edges of the object so it can remove background from the image and calculate slope of the pyramid walls.

#### Build and run

##### Linux

Install dependencies
```
apt-get update && apt-get install -y g++ freeglut3-dev libglm-dev
```

Build
```
g++ -std=c++11 main.cpp -lGL -lGLU -lglut -o main
```

Run binary with argument pointing to the image
```
./main "$(pwd)/assets/Wall.bmp"
```

##### Mac
Mac comes with OpenGL and GLUT preinstalled. To install `g++` you can do `brew install gcc`

Build
```
g++ -std=c++11 main.cpp -L/System/Library/Frameworks -framework GLUT -framework OpenGL -o main
```

Run binary with argument pointing to the image
```
./main "$(pwd)/assets/Wall.bmp"
```

#### Licence
[MIT license](https://opensource.org/licenses/MIT)

repository: MichalGallovic/Computer-Graphics

repo_name: MichalGallovic/Computer-Graphics


text:
# Java library for opensubtitles.org

OpenSub4j is an open source Java library for opensubtites. It provides an object-oriented abstraction over XML-RPC opensubtitles.org API.

## Installation

Simply add the dependency to the pom.xml with the latest release:

```
<dependency>
    <groupId>com.github.pmanent</groupId>
    <artifactId>opensub4j</artifactId>
    <version>0.1.3</version>
</dependency>
```

## Usage

### Creating the client

```
URL serverUrl = new URL("https", "api.opensubtitles.org", 443, "/xml-rpc");
OpenSubtitlesClient osClient = new OpenSubtitlesClientImpl(serverUrl);
```

### Getting server info

```
ServerInfo serverInfo = osClient.serverInfo();
```

### Authentication

```
osClient.login("username", "password", "en", "TemporaryUserAgent");
(...)
osClient.logout()
```

### Search

```
// searching for subtitles matching a file
List<SubtitleInfo> subtitles = osClient.searchSubtitles("eng", new File("/path/to/file.mkv"));

// searching by imdb id
List<SubtitleInfo> subtitles = osClient.searchSubtitles("eng", "movie IMDB id");

// searching by string query + season/episode
List<SubtitleInfo> subtitles = osClient.searchSubtitles("eng", "Friends", "1", "1");
```

### Downloading subtitles

```
List<SubtitleFile> subtitleFiles = osClient.downloadSubtitles(subtitleInfo.getId());
```

## Logging

Library uses slf4j logging facade, it can be bound to any logger implementation that has bindings to slf4j.

For binding with log4j:
```
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.7.25</version>
</dependency>
```

For more information please refer to slf4j documentation.

## Building from sources

To build the library from sources, you just need to invoke:
```
mvn clean package
```
Optional you can build the library without executing tests:
```
mvn clean package -DskipTests
```

Note: Java JDK 8 is required.


text:
# C++ in Zircon

A subset of the C++17 language is used in the Zircon tree.  This includes both
the kernel and userspace code.  C++ is mixed with C (and some assembly) in
both places.  Some C++ language features are avoided or prohibited.  Use of
the C++ standard library features is very circumspect.

## Language features

- Not allowed
  - Exceptions
  - RTTI and `dynamic_cast`
  - Operator overloading
  - Virtual inheritance
  - Statically constructed objects
  - Trailing return type syntax
    - Exception: when necessary for lambdas with otherwise unutterable return types
  - Initializer lists
  - `thread_local` in kernel code
- Allowed
  - Pure interface inheritance
  - Lambdas
  - `constexpr`
  - `nullptr`
  - `enum class`es
  - `template`s
  - Default parameters
    - But use judgment. One optional out parameter at the end is
      probably fine. Four optional bool arguments, probably not.
  - Plain old classes
  - `auto`
  - Multiple implementation inheritance
    - But be judicious. This is used widely for e.g. intrusive
    container mixins.
- Needs more ruling TODO(cpu)
  - Global constructors
    - Currently we have these for global data structures.

**TODO:** pointer to style guide(s)?

## C++ Standard Edition

Zircon code is built with `-std=c++17` and in general can use C++ 17 language
and library features freely (subject to style/feature constraints described
[above](#language-features) and library use guidelines described
[below](#standard-library)).  There is no *general* concern with staying
compatible with C++ 14 or earlier versions.  When a standard C++ 17 feature is
the cleanest way to do something, do it that way.

All pure C code (`.c` source files and headers used by them) is C 11.  Some
special exceptions are made for code meant to be reused by out-of-tree boot
loaders, which stick to a conservative C 89 subset for embedded code.

## Standard Library

The C++ standard library API has many interfaces of widely varying
characteristics.  We subdivide the standard library API into several
categories below, based on the predictability and complexity of each
particular interface's code generation and use of machine and OS facilities.
These can be thought of as widening concentric circles of the API from the
most minimal C-like subset out to the full C++ 17 API.

#### Context Matters

This section gives guidelines for how to think about the impact of using a
particular standard C++ library API on the system as a whole.  There are no
hard and fast rules, except for the kernel (see the next section)--and except
for implementation constraints, which one always hopes should be temporary.

The overwhelming rule is **be circumspect**.

 * Consider how well you understand the time and space complexity, the dynamic
   allocation behavior (if any), and the failure modes of *each API you use*.

 * Then consider the specific *context* where it's being used, and how
   sensitive that context is to those various kinds of concerns.

 * Be especially wary about **input-dependent** behavior that can quickly
   become far harder to predict when using nontrivial library facilities.

If you're writing the main I/O logic in a driver, or anything that's in a hot
path for latency, throughput, or reliability, in any kind of system service,
then you should be pretty conservative in what library facilities you rely on.
They're all technically available to you in userspace (though far fewer in the
kernel; see the next section).  But there's not so many you actually should
use.  You probably don't want to lean on a lot of `std` containers that do
fancy dynamic allocation behind the scenes.  They will make it hard for you to
understand, predict, and control the storage/memory footprint, allocation
behavior, performance, and reliability of your service.

Nonetheless, even a driver is a userspace program that starts up and parses
configuration files or arguments and so on.  For all those nonessential or
start-time functions that are not part of the hot path, using more complex
library facilities is probably fine when that makes the work easier.  Just
remember to pay attention to overall metrics for your code, such as
minimal/total/peak runtime memory use, code bloat (which uses both device
storage and runtime memory), and resilience to unexpected failure modes.
Maybe don't double the code size and memory footprint of your driver just to
leverage that fancy configuration-parsing library.

#### No `std` in kernel

The C++ `std` namespace **cannot** be used in [kernel](/zircon/kernel) code, which
also includes [bootloader](/src/firmware/gigaboot).  The few C++ standard library
headers that don't involve `std::` APIs can still be used directly.  See the
next section.

No other C++ standard headers should be used in kernel code.  Instead,
any library facilities worthwhile to have in the kernel (such as
`std::move`) are provided via kernel-specific APIs (such as
`ktl::move`).  The kernel's implementations of these APIs may in fact
rely on toolchain headers providing `std::` implementations that are
aliased to kernel API names.  But only those API implementations and
very special cases in certain library headers should ever use `std::`
in source code built into the kernel.

#### Universal headers

These header APIs are safe to use everywhere, even in the kernel.

They include the C++ wrappers on the subset of standard C interfaces that the
kernel supports:

 * [`<cstdarg>`](https://en.cppreference.com/w/cpp/header/cstdarg)
 * [`<cstddef>`](https://en.cppreference.com/w/cpp/header/cstddef)
 * [`<climits>`](https://en.cppreference.com/w/cpp/header/climits)
 * [`<cstdint>`](https://en.cppreference.com/w/cpp/header/cstdint)
 * [`<cinttypes>`](https://en.cppreference.com/w/cpp/header/cinttypes)
 * [`<cassert>`](https://en.cppreference.com/w/cpp/header/cassert)
 * [`<cstring>`](https://en.cppreference.com/w/cpp/header/cstring)

The `std` namespace aliases for C library APIs from these headers should not
be used in kernel code.

One pure C++ header is also available even in the kernel:

 * [`<new>`](https://en.cppreference.com/w/cpp/header/new)

   The vanilla non-placement `operator new` and `operator new[]` are not
   available in the kernel.  Use [`fbl::AllocChecker`
   `new`](/zircon/system/ulib/fbl/include/fbl/alloc_checker.h) instead.

#### Conservative userspace

These header APIs are safe to use everywhere.  They're not allowed in the
kernel because they're all entirely in the `std` namespace.  But subsets of
these APIs are likely candidates to get an in-kernel API alias if there is a
good case for using such an API in kernel code.

These are pure header-only types and templates.  They don't do any dynamic
allocation of their own.  The time and space complexity of each function
should be clear from its description.

 * [`<algorithm>`](https://en.cppreference.com/w/cpp/header/algorithm)
 * [`<array>`](https://en.cppreference.com/w/cpp/header/array)
 * [`<atomic>`](https://en.cppreference.com/w/cpp/header/atomic)
 * [`<bitset>`](https://en.cppreference.com/w/cpp/header/bitset)
 * [`<initializer_list>`](https://en.cppreference.com/w/cpp/header/initializer_list)
 * [`<iterator>`](https://en.cppreference.com/w/cpp/header/iterator)
 * [`<limits>`](https://en.cppreference.com/w/cpp/header/limits)
 * [`<optional>`](https://en.cppreference.com/w/cpp/header/optional)
 * [`<tuple>`](https://en.cppreference.com/w/cpp/header/tuple)
 * [`<type_traits>`](https://en.cppreference.com/w/cpp/header/type_traits)
 * [`<utility>`](https://en.cppreference.com/w/cpp/header/utility)
 * [`<variant>`](https://en.cppreference.com/w/cpp/header/variant)

These involve some dynamic allocation, but only what's explicit:

 * [`<any>`](https://en.cppreference.com/w/cpp/header/any)
 * [`<memory>`](https://en.cppreference.com/w/cpp/header/memory)

   The `std::shared_ptr`, `std::weak_ptr`, and `std::auto_ptr` APIs should
   **never** be used.  Use `std::unique_ptr` and `fbl::RefPtr` instead.

##### Userspace-only

These are not things that would ever be available at all or by any similar API
or name in the kernel.  But they are generally harmless everywhere in
userspace.  They do not involve dynamic allocation.

 * Floating-point is never available in kernel code, but can be used
   (subject to performance considerations) in all userspace code.
   * [`<cfenv>`](https://en.cppreference.com/w/cpp/header/cfenv)
   * [`<cfloat>`](https://en.cppreference.com/w/cpp/header/cfloat)
   * [`<cmath>`](https://en.cppreference.com/w/cpp/header/cmath)
   * [`<complex>`](https://en.cppreference.com/w/cpp/header/complex)
   * [`<numeric>`](https://en.cppreference.com/w/cpp/header/numeric)
   * [`<ratio>`](https://en.cppreference.com/w/cpp/header/ratio)
   * [`<valarray>`](https://en.cppreference.com/w/cpp/header/valarray)

 * Full C 11 standard library, via C++ wrappers or in standard C `<*.h>`.
   * [`<csetjmp>`](https://en.cppreference.com/w/cpp/header/csetjmp)
   * [`<cstdlib>`](https://en.cppreference.com/w/cpp/header/cstdlib)
   * [Standard C11 interfaces](https://en.cppreference.com/w/c/header)

 * Synchronization and threads.  These standard APIs are safe to use in all
   userspace code with appropriate discretion.  But it may often be better to
   use Zircon's own library APIs for similar things, such as
   [<lib/sync/...>](/zircon/system/ulib/sync/include).
   * [`<condition_variable>`](https://en.cppreference.com/w/cpp/header/condition_variable)
   * [`<execution>`](https://en.cppreference.com/w/cpp/header/execution)
   * [`<mutex>`](https://en.cppreference.com/w/cpp/header/mutex)
   * [`<shared_mutex>`](https://en.cppreference.com/w/cpp/header/shared_mutex)
   * [`<thread>`](https://en.cppreference.com/w/cpp/header/thread)

#### Kitchen sink

These involve dynamic allocation that is hard to predict and is generally out
of your control.  The exact runtime behavior and memory requirements are often
hard to reason about.  Think very hard before using these interfaces in any
critical path for reliability or performance or in any component that is meant
to be lean and space-efficient.

 * The entire [Containers library](https://en.cppreference.com/w/cpp/container)

 * [`<functional>`](https://en.cppreference.com/w/cpp/header/functional)

   See [`<lib/fit/function.h>`](/sdk/lib/fit/include/lib/fit/function.h)
   for a homegrown alternative.

 * [`<memory_resource>`](https://en.cppreference.com/w/cpp/header/memory_resource)
 * [`<scoped_allocator>`](https://en.cppreference.com/w/cpp/header/scoped_allocator)

 * [`<filesystem>`](https://en.cppreference.com/w/cpp/header/filesystem)
 * [`<regex>`](https://en.cppreference.com/w/cpp/header/regex)

## FBL

FBL is the Fuchsia Base Library, which is shared between kernel and userspace.
As a result, FBL has very strict dependencies.  For example, FBL cannot depend
on the syscall interface because the syscall interface is not available within
the kernel.  Similarly, FBL cannot depend on C library features that are not
available in the kernel.

1. [system/ulib/fbl](/zircon/system/ulib/fbl), which is usable from both
   kernel and userspace.
2. [kernel/lib/fbl](/zircon/kernel/lib/fbl), which is usable only from
    the kernel.

Note: Some FBL interfaces below that overlap with standard C++ library
interfaces will probably be either removed entirely or made kernel-only (and
perhaps renamed inside the kernel) once userspace code has migrated to using
standard C++ library facilities where appropriate.

FBL provides:

- utility code
  - [basic algorithms](/zircon/system/ulib/fbl/include/fbl/algorithm.h)
  - [alloc checking new](/zircon/system/ulib/fbl/include/fbl/alloc_checker.h)
- allocators
  - [slab allocation](/zircon/system/ulib/fbl/include/fbl/slab_allocator.h)
  - [slab malloc](/zircon/system/ulib/fbl/include/fbl/slab_malloc.h)
- arrays
  - [fixed sized arrays](/zircon/system/ulib/fbl/include/fbl/array.h)
  - [fixed sized arrays](/zircon/system/ulib/fbl/include/fbl/inline_array.h),
    which stack allocates small arrays
- inline containers
  - [doubly linked list](/zircon/system/ulib/fbl/include/fbl/intrusive_double_list.h)
  - [hash table](/zircon/system/ulib/fbl/include/fbl/intrusive_hash_table.h)
  - [singly linked list](/zircon/system/ulib/fbl/include/fbl/intrusive_single_list.h)
  - [wavl trees](/zircon/system/ulib/fbl/include/fbl/intrusive_wavl_tree.h)
- smart pointers
  - [intrusive refcounted mixin](/zircon/system/ulib/fbl/include/fbl/ref_counted.h)
  - [intrusive refcounting pointer](/zircon/system/ulib/fbl/include/fbl/ref_ptr.h)
- raii utilities
  - [AutoLock](/zircon/system/ulib/fbl/include/fbl/auto_lock.h)

FBL has strict controls on memory allocation.  Memory allocation should be
explicit, using an AllocChecker to let clients recover from allocation
failures.  In some cases, implicit memory allocation is permitted, but
functions that implicitly allocate memory must be #ifdef'ed to be unavailable
in the kernel.

FBL not available outside the Platform Source Tree.

## ZX

ZX contains C++ wrappers for the Zircon [objects](/docs/reference/kernel_objects/objects.md) and
[syscalls](/docs/reference/syscalls/README.md).  These wrappers provide type safety and move semantics
for handles but offer no opinion beyond what's in syscalls.abigen.  At some
point in the future, we might autogenerate ZX from syscalls.abigen, similar to
how we autogenerate the syscall wrappers in other languages.

ZX is part of the Fuchsia SDK.

## FZL

FZL is the Fuchsia Zircon Library.  This library provides value-add for common
operations involving kernel objects and is free to have opinions about how to
interact with the Zircon syscalls.  If a piece of code has no dependency on
Zircon syscalls, the code should go in FBL instead.

FZL not available outside the Platform Source Tree.

## Hermetic C++

We encourage using C++ rather than C as the implementation language throughout
Fuchsia.  However, in many instances we require a narrow ABI bottleneck to
simplify the problem of preventing, tracking, or adapting to ABI drift.  The
first key way to keep the ABI simple is to base it on a pure C API (which can
be used directly from C++, and via foreign-function interfaces from many other
languages) rather than a C++ API.  When we link together a body of code into a
module with a pure C external API and ABI but using C++ internally for its
implementation, we call that _hermetic C++_.

 * The kernel itself could be said to be implemented in hermetic C++.
 * The [vDSO](/docs/concepts/kernel/vdso.md) is a shared library implemented in hermetic C++.
 * Fuchsia's [standard C library](/zircon/system/ulib/c), while largely implemented
   in C, also uses hermetic C++ in its implementation.
 * Most Fuchsia device drivers are implemented in hermetic C++.

It's a hard and fast rule for binaries exported in the Fuchsia's public SDK
that **shared libraries must have a pure C API and ABI**.  Such libraries can
_and should_ use C++ rather than C in their implementations, and they can use
other *statically-linked* libraries with C++ APIs as long as ABI aspects of
those internal C++ APIs don't leak out into the shared library's public ABI.

A "loadable module" (sometimes called a "plug-in" module) is very similar to a
shared library.  The same rules about pure a C ABI bottleneck apply for
loadable module ABIs.  Fuchsia device drivers are just such loadable modules
that must meet the driver (pure C) ABI.  Hence, every driver implemented in
C++ must use hermetic C++.

The Fuchsia C++ toolchain provides the full C++17 standard library using the
[libc++](https://libcxx.llvm.org/) implementation.  In C++ executables (and
shared libraries with a C++ ABI) this is usually dynamically linked, and
that's the default behavior of the compiler.  The toolchain also provides
`libc++` for *hermetic static linking* via the `-static-libstdc++` switch to
the compiler (`clang++`).  In the Zircon GN build system, a linking target
such as `executable()`, `test()`, or `library()` (with `shared = true`), uses
this line to request the hermetic C++ standard library:

```gn
    configs += [ "//zircon/public/gn/config:static-libc++" ]
```

This is **required** in each `library()` that is exported to the public IDK
_in binary form_ via `sdk = "shared"`.

Every `driver()` automatically uses hermetic C++ and so this line is not
required for them.  (Drivers cannot depend on their own shared libraries, only
the dynamic linking environment provided by the driver ABI.)

For executables and non-exported shared libraries, it's a judgment call
whether to use static linking or dynamic linking for the standard C++ library.
In Fuchsia's package deployment model, there is no particular updatability
improvement to using shared libraries as in many other systems.  The primary
trade-off is between the savings in memory and storage from many stored
packages and running processes on the system using exactly the same shared
library binary and compactness and (sometimes performance) of the individual
package.  Since many packages in the system build will all use the same shared
`libc++` library, that's usually the right thing to do unless there are
special circumstances.  It's the default in the compiler and build system.

repository: gnoliyil/fuchsia

repo_name: gnoliyil/fuchsia


text:
# Co-Unity App(Frontend)

**Deployed Site** : https://co-unity.netlify.app/

# Description
Co-Unity is an application where people can post their issues concerning their community, and everyone can help prioritize issues through votes.

## Frontend Tech Stack
### **ReactJS**
### **Redux**
### **React-Bootstrap + Bootstrap**

# Installation Guide
1. Git clone ``https://github.com/Team-Button/co-unity-fe.git``
2. ``cd`` into project folder
3. In your terminal, type ``yarn`` or ``yarn``
4. Run ``yarn start``

The default port should be http://localhost:3000

repository: Team-Button/co-unity-fe

repo_name: Team-Button/co-unity-fe


text:
# Release Tools

Scripts to help with releasing a version to PyPI.

## Instructions

1. Grab last version, `X.Y.Z`
1. Generate changelog: `python scripts/generate_changelog.py -v X.Y.Z`
1. Cut a release on GitHub
1. Upload to PyPI

## PyPI Workflow

### Set up ~/.pypirc

```text
[distutils]
index-servers=
  pypi
  testpypi

[pypi]
repository=https://upload.pypi.org/legacy/
username=alysivji
password=[password]

[testpypi]
repository: https://test.pypi.org/legacy/
username=alysivji
password=[password]
```

### Test it on TestPyPI

```console
pip install twine
pip install wheel
python setup.py sdist bdist_wheel
twine upload --repository testpypi dist/*
pip install --index-url https://test.pypi.org/simple/ sivtools
```

### Release to PyPI

```console
twine upload --repository pypi dist/*
```

repository: louis-jaris/falcon-apispec

repo_name: louis-jaris/falcon-apispec


text:
# Bitwarden to 1Password csv converter

This cli tool helps to convert exported logins from [Bitwarden](https://bitwarden.com) to [1Password](https://1password.com) compatible csv format.

1. [Export Bitwarden vault to csv file](https://bitwarden.com/help/article/export-your-data/#export-a-personal-vault)
2. Use exported csv file as input
3. [Import result to 1Password](https://support.1password.com/import-1password-com/)

## Options

**`-h`** usage info

**`-i`** path to csv file with logins exported from  (default "in.csv")

**`-o`** csv file name which will has logins in format accepted by  (default "out.csv")

## Example

```shell
bwto1pcsv_macos -i bw_logins.csv -o 1p_logins.csv
```