text:
# osrm-backend for Kubernetes
[![](https://images.microbadger.com/badges/image/peterevans/osrm-backend-k8s.svg)](https://microbadger.com/images/peterevans/osrm-backend-k8s)
[![CircleCI](https://circleci.com/gh/peter-evans/osrm-backend-k8s/tree/master.svg?style=svg)](https://circleci.com/gh/peter-evans/osrm-backend-k8s/tree/master)

Open Source Routing Machine (OSRM) [osrm-backend](https://github.com/Project-OSRM/osrm-backend) for Kubernetes on Google Container Engine (GKE).

This Docker image and sample Kubernetes configuration files are one solution to persisting [osrm-backend](https://github.com/Project-OSRM/osrm-backend) data and providing immutable deployments.

If you are looking for a more general purpose docker image, see [osrm-backend-docker](https://github.com/peter-evans/osrm-backend-docker).

## Supported tags and respective `Dockerfile` links

- [`1.21.1`, `1.21`, `latest`  (*1.21/Dockerfile*)](https://github.com/peter-evans/osrm-backend-k8s/tree/master)
- [`1.20.0`, `1.20` (*1.20/Dockerfile*)](https://github.com/peter-evans/osrm-backend-k8s/tree/master/archive/1.20)
- [`1.19.0`, `1.19` (*1.19/Dockerfile*)](https://github.com/peter-evans/osrm-backend-k8s/tree/master/archive/1.19)
- [`1.18.0`, `1.18` (*1.18/Dockerfile*)](https://github.com/peter-evans/osrm-backend-k8s/tree/master/archive/1.18)
- [`1.17.1`, `1.17` (*1.17/Dockerfile*)](https://github.com/peter-evans/osrm-backend-k8s/tree/master/archive/1.17)

For earlier versions see [releases](https://github.com/peter-evans/osrm-backend-k8s/releases) and the available [tags on Docker Hub](https://hub.docker.com/r/peterevans/osrm-backend-k8s/tags/).

## Usage
The Docker image can be run standalone without Kubernetes:

```bash
docker run -d -p 5000:5000 \
-e OSRM_PBF_URL='http://download.geofabrik.de/asia/maldives-latest.osm.pbf' \
--name osrm-backend peterevans/osrm-backend-k8s:latest
```
Tail the logs to verify the graph has been built and osrm-backend is serving requests:
```
docker logs -f <CONTAINER ID>
```
Then point your web browser to [http://localhost:5000/](http://localhost:5000/)

## Kubernetes Deployment
The [osrm-backend](https://github.com/Project-OSRM/osrm-backend) builds a data graph from a PBF file. This process can take over an hour for a single country.
If a pod in a deployment fails, waiting over an hour for a new pod to start could lead to loss of service.

The sample Kubernetes files provide a means of persisting a data graph in storage that is used by all pods in the deployment.
Each pod having their own copy of the graph is desirable in order to have no single point of failure.

#### Explanation
Initial deployment flow:

1. Create a secret that contains the JSON key of a Google Cloud IAM service account that has read/write permissions to Google Storage.
2. Deploy the canary deployment.
3. Wait for the graph to be built and uploaded to Google Storage.
4. Delete the canary deployment.
5. Deploy the stable track deployment.

To update the live deployment with a new graph:

1. Deploy the canary deployment alongside the stable track deployment.
2. Wait for the graph to be built and uploaded to Google Storage.
3. Delete the canary deployment.
4. Perform a rolling update on the stable track deployment to create pods using the new graph.

#### Creating the secret

```bash
# Google Cloud project ID and service account details
PROJECT_ID=my-project
SA_NAME=my-service-account
SA_DISPLAY_NAME="My Service Account"
<EMAIL_ADDRESS>KEY_FILE=service-account-key.json

# Create a new GCP IAM service account
gcloud iam service-accounts create $SA_NAME --display-name "$SA_DISPLAY_NAME"

# Create and download a new key for the service account
gcloud iam service-accounts keys create $KEY_FILE --iam-account $SA_EMAIL

# Give the service account the "Storage Object Viewer" and "Storage Object Creator" IAM roles
gcloud projects add-iam-policy-binding $PROJECT_ID --member serviceAccount:$SA_EMAIL --role roles/storage.objectViewer
gcloud projects add-iam-policy-binding $PROJECT_ID --member serviceAccount:$SA_EMAIL --role roles/storage.objectCreator

# Create a secret containing the service account key file
kubectl create secret generic osrm-storage-secret --from-file=$KEY_FILE
```

#### Deployment configuration
Before deploying, edit the `env` section of both the canary deployment and stable track deployment.

- `OSRM_MODE` - `CREATE` from PBF data, or `RESTORE` from Google Storage.
- `OSRM_PBF_URL` - URL to PBF data file. (Optional when `OSRM_MODE=RESTORE`)
- `OSRM_GRAPH_PROFILE` - Graph profile; `car`,`bicycle` or `foot`. (Optional when `OSRM_MODE=RESTORE`)
- `OSRM_DATA_LABEL` - A meaningful and **unique** label for the data. e.g. maldives-car-20161209
- `OSRM_SA_KEY_PATH` - Path to the JSON service account key. This needs to match the `mountPath` of the volume mounted secret.
- `OSRM_PROJECT_ID` - Google Cloud project ID.
- `OSRM_GS_BUCKET` - Google Storage bucket.

## License

MIT License - see the [LICENSE](LICENSE) file for details


text:
SimpleGA - basic genetic algorithm for Scala
============================================

SimpleGA is simple in use genetic algorithm library for Scala.
It provides predefined population model and allows to define new populations for all users needs.

The library comes with two predefined population types:

* binary population
* permutation population

For both of them are defined basic genetic operators for selection, crossover and mutation.
With their generic interface it is very easy to add new custom operator functions.

TODO:
=====

* create operators for permutation population
* write more example
* use State monad and more "functional" way of program structure

license: MIT

repository: rafalnowak/simplega

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: rafalnowak/simplega


text:
bupstash-list-contents(1)
=========================

## SYNOPSIS

List snapshot contents.

`bupstash list-contents [OPTIONS] QUERY... `

## DESCRIPTION

`bupstash list-contents` lists the contents of the item matching the given query.

Items created by using `bupstash put` on a directory will have an associated index, other items
are not listable.

## OUTPUT FORMATS

### Human

When `--format` is set to `human`, `bupstash list-contents` outputs aligned rows consisting of:

```
PERMS SIZE YYYY/MM/DD HH:MM:SS PATH...
```

The included date is the time of the last change to a given file as reported by the
operating system at the time of the snapshot.

Prefer using one of the versioned machine readable formats when writing scripts.

### JSONl1

When `--format` is set to `jsonl1`, `bupstash list-contents` outputs one json object per line.

Each line has the following json schema:

```
{
  "path": string | [ bytes... ],
  "mode": number,
  "size": number,
  "uid": number,
  "gid": number,
  "mtime": number,
  "mtime_nsec": number,
  "ctime": number,
  "ctime_nsec": number,
  "norm_dev": number,
  "ino": number,
  "nlink": number,
  "link_target": string | null,
  "dev_major": number | null,
  "dev_minor": number | null,
  "xattrs": {string : string | [bytes...] ...} | null,
  "sparse": boolean,
  "data_hash": "$KIND[:$HEXBYTE]" | null
}
```

## QUERY LANGUAGE

For full documentation on the query language, see bupstash-query-language(7).

## QUERY CACHING

The list-contents command uses the same query caching mechanisms as bupstash-list(1), check that page for
more information on the query cache.

## OPTIONS

* -r, --repository REPO:
  The repository to connect to, , may be of the form `ssh://$SERVER/$PATH` for
  remote repositories if ssh access is configured. If not specified, is set to `BUPSTASH_REPOSITORY`.

* -k, --key KEY:
  Key used to decrypt data and metadata. If not set, defaults
  to `BUPSTASH_KEY`.

* --format FORMAT:
  Set output format to one of the following 'human', 'jsonl'.

* --query-cache PATH:
  Path to the query-cache file, defaults to one of the following, in order, provided
  the appropriate environment variables are set, `$BUPSTASH_QUERY_CACHE`,
  `$XDG_CACHE_HOME/.cache/bupstash/bupstash.qcache` or `$HOME/.cache/bupstash/bupstash.qcache`.

* --pick PATH:
  List a sub-directory of the query.

* --utc-timestamps:
  Display and search against timestamps in utc time instead of local time.

  * --no-progress:
  Suppress progress indicators (Progress indicators are also suppressed when stderr
  is not an interactive terminal).

* -q, --quiet:
  Be quiet, implies --no-progress.

## ENVIRONMENT

* BUPSTASH_REPOSITORY:
  The repository to connect to. May be of the form `ssh://$SERVER/$PATH` for
  remote repositories if ssh access is configured.

* BUPSTASH_REPOSITORY_COMMAND:
  A command to run to connect to an instance of bupstash-serve(1). This
  allows more complex connections to the repository for less common use cases.

* BUPSTASH_KEY:
  Path to a primary key that will be used for decrypting data and metadata.

* BUPSTASH_KEY_COMMAND:
  A command to run that must print the key data, can be used instead of BUPSTASH_KEY
  to fetch the key from arbitrary locations such as the network or other secret storage.

* BUPSTASH_QUERY_CACHE:
  Path to the query cache file to use.

## EXAMPLES

### Get an item with a specific id from the repository

```
$ bupstash list-contents id="14eb*"
drwxr-xr-x 0     2020/10/30 13:32:04 .
-rw-r--r-- 1967  2020/10/30 13:32:04 data.txt
```

## SEE ALSO

bupstash(1), bupstash-put(1), bupstash-diff(1), bupstash-keyfiles(7), bupstash-query-language(7)

repository: andrewchambers/bupstash

gha_language: Rust

gha_license_id: MIT

repo_name: andrewchambers/bupstash


text:
---
layout: post
title:  "Web Development Bootcamp"
categories: [ Web Development ]
image: assets/images/2.jpg
---
The goal of our Web Development Bootcamp is to transform you into a professional developer. You’ll come to understand coding logic using popular languages and frameworks like JavaScript & React, while learning how to think like a programmer by building software from the ground up. Bootcamp will provide you with mentorship, data-driven curriculum, and a top notch learning environment that will launch you into your first Junior Developer role.

Our curriculum was created to simulate a real developer’s job environment. You'll be exposed to industry-relevant technologies, and then immediately reinforce that knowledge by building applications & completing daily programming projects.

repository: the-code-school/tcs-page

repo_name: the-code-school/tcs-page


text:
- [Español](https://github.com/ceoaliongroo/conectados/blob/master/README-ES.md)
- [English](https://github.com/ceoaliongroo/conectados/blob/master/README.md)

Conectados
==========

Application for the Community

## Installation

Require install Node.js.
* [Install node.js](http://nodejs.org/download/) (require node.js version >= 0.10.x)

* Clone the project.

```bash
git clone https://github.com/ceoaliongroo/conectados.git
```
__Note:__ It's recommended do it with ssh keypair, to avoid to asking the user and the password constantlly. ([Mas información](https://help.github.com/articles/which-remote-url-should-i-use/))

* Install dependencies as global modules, open de the terminal and write::

```bash
npm install -g grunt grunt-cli yo
```

```bash
gem install bundler
```
__Nota:__ Execute as ``sudo`` if you need permission to install.

```
touch Gemfile
```

* Install libraries of the project.

```bash
cd conectados
npm install
bower install
```

## Demo

* Configure the client application:
```
cp config.example.json config.json
```

* Execute demo site:

```
grunt serve
```

## Technical general description of the project

 The application web:

* It's programmed with [AngularJS](https://www.angularjs.org/).
* Follow the design specification of [Google Design](http://www.google.com/design/)
* Use the library [Angular Material](https://material.angularjs.org/#/) witch contain components in angularjs
flollowing the Google Design specifications.

## Questions

Write a mail to [soporte<EMAIL_ADDRESS>

repository: bblatino/conectados

gha_language: JavaScript

repo_name: bblatino/conectados


text:
---
title: Power Generation
permalink: /singapores-climate-action/power-generation/
third_nav_title: Mitigation Efforts
---

### POWER GENERATION

Power generation is one of the major sources of carbon emissions. With our limited capacity to tap on alternative energy resources, we rely heavily on imported fossil fuel to power our nation.

**A More Environment-friendly Method to Power Our Nation**

Since 2000, we have increased the percentage of natural gas used in electricity generation from 19 per cent to 95 per cent today. Among all fossil fuels, natural gas produces the least amount of carbon emissions per unit of electricity. By so doing, we have cut the amount of carbon we release into the atmosphere.

Our fuel mix makes us much less carbon intensive than many other nations still use coal as an important part of their power generation.

![A More Environment-friendly Method to Power Our Nation](/images/a-more-enviroment-friendly-method-to-power-our-nation.jpg "A More Environment-friendly Method to Power Our Nation")
*Singapore has switched from fuel oil to natural gas as out main energy source for electricity generation. The picture above shows Senoko Energy's repowered units that were completed in 2005. The repowering involved the conversion of three oil-fired steam thermal plants into three gas-fired combined cycle plant. (Image courtesy of Senoko Energy)*

**Fuel Mix for Power Generation by Country (2013)**

![Fuel Mix for Power Generation by Country (2013)](/images/fuel-mix-for-power-generation-by-country-2013.jpg "Fuel Mix for Power Generation by Country (2013)")

**Decreasing Our Fuel Oil Usage**

Our electricity is produced by the combustion of natural gas that is piped from Malaysia and Indonesia. We have diversified our supply of natural gas with the development of a liquefied natural gas (LNG) terminal on Jurong Island. There are further plans to build a second LNG terminal to support new industrial sites and power plants. This will not only provide critical mass for enhanced energy security, but it will also enable Singapore to be a hub for LNG-related businesses.

![Decreasing Our Fuel Oil Usage](/images/decreasing-our-fuel-oil-usage.jpg "Decreasing Our Fuel Oil Usage")

Source: Energy Market Authority

**Finding Ways to Increase Solar Power Generation**

Among the alternative energy options available to us, solar energy offers the most promising opportunity for Singapore. With the fall in solar photovoltaic (PV) panel prices, solar energy is currently economically comparable to electricity derived from fossil fuels.

To accelerate solar deployment in Singapore, the SolarNova programme has been launched to promote and aggregate solar demand across government agencies. In Nov 2015, the first SolarNova tender was awarded for solar photovoltaic (PV) systems to be deployed on the facilities of government agencies including the Housing Development Board (HDB), the Ministry of Home Affairs (MHA), and PUB, the national water angecy.

**Notable Solar Installations**

The total installed solar PV capacity in Singapore is currently about 47 megawatt peak (MWp) for both residential and non-residential areas. This includes installations at:

* HDB rooftops
* Keppel Seghers Ulu Pandan NEWater Plant
* Resorts World Sentosa
* GreenPac Pte Ltd
* Applied Materials Singapore Operational Centre
* Sheng Siong Supermarket
* Singapore Sports Hub

repository: nccs-mq/pmo-nccs

branch_name: refs/heads/staging

gha_language: CSS

gha_license_id: NOASSERTION

repo_name: nccs-mq/pmo-nccs


text:
# DataDog Solutions Engineer Exercise
Datadog is a cloud monitoring service for different applications. They can analyze and monitor servers, containers, container managements services, datadabases or if they don't have the integration you can make it :)

If you want more information or want to see it in action log in for their trial at [Datadog](https://datadoghq.com)

## Environment
- I created a droplet in [DigitalOcean](https://m.do.co/c/a4c588c90cf4), you can use the referral code if you want to test it out.
- You can simply start an Ubuntu 16.04 or any version of Ubuntu with a simply click.
- Install the agent
```bash
DD_API_KEY=$YOUR_API_KEY_HERE bash -c "$(curl -L https://raw.githubusercontent.com/DataDog/datadog-agent/master/cmd/agent/install_script.sh)"
```
- You will get a confirmation that its running and how to start / stop it. If you want more set of commands for the latest agent you can go to [Agent Usage](https://docs.datadoghq.com/agent/basic_agent_usage/ubuntu/)
- All the configuration of the agent can be found
```bash
/etc/datadog-agent/datadog.yaml
```

## Collecting Metrics:
### Tagging
> Add tags in the Agent config file and show us a screenshot of your host and its tags on the Host Map page in Datadog.
Based on the [Tagging Documentation](https://docs.datadoghq.com/getting_started/tagging/) we created the following tags
```bash
tags:
   - ddse
   - env:dev
   - role:app
   - hosted:digitalocean
   - region:us_east
```
You can see the tags on the Host in the following screenshot
![cli_tags](/images/cli_tags.png)

And then we can validate them on the Datadog UI
![ui_tags](/images/ui_tags.png)

### Databases
> Install a database on your machine (MongoDB, MySQL, or PostgreSQL) and then install the respective Datadog integration for that database.
Selected to install MySQL with the following 3 commands
```bash
sudo apt-get update
sudo apt-get install mysql-server
mysql_secure_installation
```
Then we need to install & configure the mysql agent. Luckily most of the agents are already installed in the `conf.d` under the `datadog-agent` folder.
```bash
/etc/datadog-agent/conf.d/mysql.d/
```
It has an example configuration named `conf.yaml.example`.
For readability, I chose to call it `mysql.yaml` and added the basic configuration
```bash
init_config:

instances:
  - server: localhost
    user: datadog
    pass: <removed>
    port: 3306
    tags:
      - mysql_do
    replication: 0
    galera_cluster: 1
    extra_status_metrics: true
    extra_performance_metrics: true
    schema_size_metrics: false
    disable_innodb_metrics: false
```
Finally we reloaded the Datadog configuration `sudo service datadog-agent restart` and then check the mysql configuration using the `status`
```bash
ddse:/etc/datadog-agent/conf.d/mysql.d# sudo datadog-agent status | grep -A6 mysql
    mysql
    -----
      Total Runs: 188
      Metrics: 61, Total Metrics: 11467
      Events: 0, Total Events: 0
      Service Checks: 1, Total Service Checks: 188
```
With this we have double checked that its running and it has metrics.
Finally after a few minutes we checked it in the UI as well as the console
![cli_mysql_statusCheck](/images/cli_mysql_statusCheck.png)
![ui_mysql_hostCheck](/images/ui_mysql_hostCheck.png)

### Custom Agents
> Create a custom Agent check that submits a metric named my_metric with a random value between 0 and 1000.
We created a custom Metric analizying and reviewing the [documentation](https://docs.datadoghq.com/agent/agent_checks/) the code can be seen below and in the scripts directory
```python
import random
from checks import AgentCheck

class CustomAgent(AgentCheck):
  def check(self, instance):
    self.gauge('ddse.my_metric',random.randint(0,1000))
```
and the configuration
```yaml
init_config:

instances:
    [{}]
```

This can be checked via the status
```bash
ddse:/etc/datadog-agent/checks.d# sudo datadog-agent status | grep -A6 customagent
    customagent
    -----------
      Total Runs: 81
      Metrics: 1, Total Metrics: 81
      Events: 0, Total Events: 0
      Service Checks: 0, Total Service Checks: 0
```
And the same can be seen in the UI.

> Change your check's collection interval so that it only submits the metric once every 45 seconds.
I modified it using the configuration in the yaml file which answers the bonus question below.

> Bonus Question Can you change the collection interval without modifying the Python check file you created?
```yaml
init_config:
    min_collection_interval: 45
instances:
    [{}]
```
## Visualizing Data
> Utilize the Datadog API to create a Timeboard that contains:
> - Your custom metric scoped over your host.
> - Any metric from the Integration on your Database with the anomaly function applied.
> - Your custom metric with the rollup function applied to sum up all the points for the past hour into one bucket
>
> Please be sure, when submitting your hiring challenge, to include the script that you've used to create this Timemboard.
The following code is an excerpt that will create the timeboard (3 of them)  as described above. The full code can be found in the scripts section named `timeboard.py`
```python
graphs = [
  {
    "definition": {
        "events": [],
        "requests": [
            {"q": "ddse.my_metric{*}"}
        ],
        "viz": "timeseries"
    },
    "title": "Custom Metric"
  },
  {
    "definition": {
        "events": [],
        "requests": [
            {"q": "anomalies(mysql.performance.user_time{*}, 'basic', 2)"},
        ],
        "viz": "timeseries"
    },
    "title": "Anomalies - MySQL Performance User Time"
  },
  {
    "definition": {
      "viz": "query_value",
      "events": [],
      "requests": [
        {"q": "avg:ddse.my_metric{*}.rollup(sum, 3600)"}
      ]
    },
    "title": "Average Custom Metric RollUp Sum last hour",
  }
]
```
> Once this is created, access the Dashboard from your Dashboard List in the UI:
> - Set the Timeboard's timeframe to the past 5 minutes
> - Take a snapshot of this graph and use the @ notation to send it to yourself.
![snapshot_email](/images/snapshot_email.png)

The below will show the last hour with the full RollUp
![timeboard-lasthour](/images/timeboard-lasthour.png)

And then
![timeboard-last5mins](/images/timeboard-last5mins.png)

> - Bonus Question: What is the Anomaly graph displaying?

The anomaly is an algorithmic feature, that displays a metric and analyzes the current, and past data to detect what is normal and what is not. Considering that if the data is brand new it might not have all the prediction needed to be accurate. IT also depends on the bounderies that you give it and the type of algorithm that its selected.
In my case I selected the basic type and a bound of 2.

## Monitoring Data
> Since you’ve already caught your test metric going above 800 once, you don’t want to have to continually watch this dashboard to be alerted when it goes above 800 again. So let’s make life easier by creating a monitor.
>
> Create a new Metric Monitor that watches the average of your custom metric (my_metric) and will alert if it’s above the following values over the past 5 minutes:
> - Warning threshold of 500
> - Alerting threshold of 800
> - And also ensure that it will notify you if there is No Data for this query over the past 10m.

After creating the alert here is the exported JSON
```json
{
	"name": "Custom Metric is Alerting",
	"type": "metric alert",
	"query": "max(last_5m):avg:ddse.my_metric{ddse} > 800",
	"message": "{{#is_alert}} Metric is too high! {{/is_alert}}\n<EMAIL_ADDRESS>	"tags": [],
	"options": {
		"notify_audit": false,
		"locked": false,
		"timeout_h": 0,
		"new_host_delay": 300,
		"require_full_window": true,
		"notify_no_data": true,
		"renotify_interval": "0",
		"evaluation_delay": "",
		"escalation_message": "",
		"no_data_timeframe": 10,
		"include_tags": false,
		"thresholds": {
			"critical": 800,
			"warning": 500
		}
	}
}
```
> Please configure the monitor’s message so that it will:
> - Send you an email whenever the monitor triggers.
Just add the team member in step 5
> - Create different messages based on whether the monitor is in an Alert, Warning, or No Data state.
> - Include the metric value that caused the monitor to trigger and host ip when the Monitor triggers an Alert state.
```markdown
{{#is_alert}}
ALERT on Custom Metric.
Value is: {{value}}
Passed the threshold of: {{threshold}}
{{/is_alert}}
{{#is_warning}}
Warning on Custom Metric.
Value is: {{value}}
Passed the threshold of: {{threshold}}
{{/is_warning}}
{{#is_no_data}}There is no data for Custom Metric{{/is_no_data}}<EMAIL_ADDRESS>```
> - When this monitor sends you an email notification, take a screenshot of the email that it sends you.
![monitor_notification](/images/monitor_notification.png)

> Bonus Question: Since this monitor is going to alert pretty often, you don’t want to be alerted when you are out of the office. Set up two scheduled downtimes for this monitor:
> - One that silences it from 7pm to 9am daily on M-F,
> - And one that silences it all day on Sat-Sun.
> - Make sure that your email is notified when you schedule the downtime and take a screenshot of that notification.
Here we can see the daily downtimes
![daily_downtime](/images/daily_downtime.png)
![daily_downtime2](/images/daily_downtime.png)

And here we can see the weekend downtimes
![weekend_downtime](/images/weekend_downtime2.png)
![weekend_downtime2](/images/weekend_downtime2.png)

## Collecting APM Data
Given the flask app, connect it to Data Dog APM or ddtrace and run the APM.
Here you can see the App being monitored by the APM
![apm_working](/images/apm_working.png)

> Provide a link and a screenshot of a Dashboard with both APM and Infrastructure Metrics.
The combined infrastructure can be found here https://app.datadoghq.com/dash/630840/apm--infrastructure
or viewed here
![combined_apm_infra](/images/combined_apm_infra.png)

> Bonus Question: What is the difference between a Service and a Resource?
"Service"  is the name of the processes that work together to resolve the code, in our case is Flask (since we are using the standard cli for ddtrace, but it can be modified in the Middleware, for example
```python
traced_app = TraceMiddleware(app, tracer, service="my-flask-app", distributed_tracing=False)
```
In the above example, the service would be named `my-flask-app`

"Resource" is an specific query to a service. For example in our case, we are hitting the `/` root of by executing a loop
```bash
for i in {1..500}; do curl <IP_ADDRESS>:5000; done
```
and that will query according to the code the following piece:
```python
@app.route('/')
def api_entry():
    return 'Entrypoint to the Application'
```
So the function or Resource being tracked will be `api_entry`
![apm_service_resource](/images/apm_service_resource.png)

## Final Question
> Datadog has been used in a lot of creative ways in the past. We’ve written some blog posts about using Datadog to monitor the NYC Subway System, Pokemon Go, and even office restroom availability!
> Is there anything creative you would use Datadog for?
A few ideas that come to my mind are:
1. How many times we are leaving one set of lights during a day on or off. Have metrics compared how much electricity we are using during the day wwhen its sunny and the light doesn't need to be on.
2. Gather how many times the metro in DC has been delayed and gather statistics on the cost of commute that the delay represents
3. Compare number 2 with the cost of the HOV / EZ Pass lanes are, to validate if its worth it driving vs metroing
4. Get at regular intervals the traffic of a given distance (for commuting purposes) to know what is are the best times in different days.

## Helpful Resources
1. [Notifications](https://docs.datadoghq.com/monitors/notifications/)
2. [API](https://docs.datadoghq.com/api/)
3. [Graphing](https://docs.datadoghq.com/graphing/)
4. [How the DD Agent works](https://docs.datadoghq.com/agent/)
5. [Custom Checks](https://docs.datadoghq.com/agent/agent_checks/)

repository: enriquemanuel/DataDog-SolutionsEngineer

repo_name: enriquemanuel/DataDog-SolutionsEngineer


text:
# Daily-Task-Manager

## Description

The purpose of this project is to create a simple calendar application that allows a user to save events for each hour of the day by modifying starter code. This app will run in the browser and feature dynamically updated HTML and CSS powered by jQuery and the [Moment.js](https://momentjs.com/) library to work with date and time.

<!-- Published URL -->

https://SavannahF.github.io/Daily-Task-Manager/

Screen Shots can be found below:

<!-- INSERT FINAL SCREENSHOTS HERE -->

![Front Page (top half)](./assets/FRONT_PAGE.png)
![If Present Hour is 2pm](./assets/PRESENT_HOUR_2PM.png)
![P element clicked for input](./assets/INPUT_DATA.png)
![Saved 4pm Task](./assets/SAVED_DATA.png)

## Installation

1. Download or clone repository
2. Open the main page (index.html) on your browser to view webpage
3. Use a text editor to view all coding, Visual Studio Coding is recommended.

_or_

Visit the github-hosted webpage for the user experience.

## Instructions

The user enters and saves text into each of the hourly fields. Data entered and Saved (by clicking on the blue storage button) is then saved to the browser's local storage.

Past hours are displayed in gray, present in red, and future hours are green.

## Websites

- Github: https://github.com/SavannahF/Daily-Task-Manager/
- Deployed: https://SavannahF.github.io/Daily-Task-Manager/

## License

MIT

Copyright (c) [2021] [Savannah L. Fortson]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

 IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

repository: SavannahF/Daily-Task-Manager

branch_name: refs/heads/main

repo_name: SavannahF/Daily-Task-Manager


text:
# Controller abstract interface

This package provides an abstract interface to the RENOIR robot with a simple example.
The aim of this abstract interface is to handle various implementations of controllers and
load them in the RENOIR robot (for now we have the TALOS robot).

The nominalSetSensors method provides the sensor information from the robot.
A map of double vectors allows differenciating betwen IMU data, force data, encoders and so on.

The getControl method provides the call to compute the control law.
The user is expected to fill in the map of control double vector values.

# Cloning, building and installing

```
mkdir -p tirrex_renoir_ws/src
cd tirrex_renoir_ws/src
git clone https://github.com/olivier-stasse/renoir_controller_abstract_interface.git
catkin build renoir_controller_abstract_interface
```

# Testing

There is a simple node loading an interface and making a simple call to each abstract method
(setupSetSensors, nominalSetSensors, cleanupSetSensors, getControl).

```
rosrun renoir_controller_abstract_interface load_renoir_controller_node ./devel/lib/librenoir_controller_example_interface.so
```

The current expected output is:
```
Calling ./install/lib/renoir_controller_abstract_interface/load_renoir_controller_node with ./install/lib/librenoir_controller_example_interface.so
Tried loading
Succedded in loading ./install/lib/librenoir_controller_example_interface.so
control (0)=-1280
control (1)=-1300
control (2)=-3376.77
control (3)=2956.98
control (4)=-3600.2
control (5)=-146.54
control (6)=-1400
control (7)=-1420
control (8)=-3496.77
control (9)=2836.98
control (10)=-3720.2
control (11)=-83.54
control (12)=-760
control (13)=-763.239
control (14)=-3874.15
control (15)=-3915.39
control (16)=-800.01
control (17)=-107.268
control (18)=-82
control (19)=-83
control (20)=-79
control (21)=0
control (22)=-4351.69
control (23)=-878.652
control (24)=-87.99
control (25)=-115.268
control (26)=-90
control (27)=-91
control (28)=20.8
control (29)=0
control (30)=0
control (31)=0
```

# Docker (to use the package renoir_pal_controller_interface)

To get the docker file:
```
docker pull registry.gitlab.com/pal-robotics/tirrex/dockers/talos_pal_physics_simulator_vnc_renoir:latest
```

To start the docker image:
```
docker run --rm -it -p 6080:6080 registry.gitlab.com/pal-robotics/tirrex/dockers/talos_pal_physics_simulator_vnc_renoir:latest
```

The output displayed in the terminal is:
```
Please be aware that you are exposing your VNC server to all users on the
local machine. These users can access your server without authentication!
/usr/bin/xauth:  file /root/.Xauthority does not exist

New '0080c85e41cf:1 (root)' desktop at :1 on machine 0080c85e41cf

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/0080c85e41cf:1.log

Use xtigervncviewer -SecurityTypes None :1 to connect to the VNC server.

Warning: could not find self.pem
Starting webserver and WebSockets proxy on port 6080
WebSocket server settings:
  - Listen on :6080
  - Flash security policy server
  - Web server. Web root: /usr/share/novnc
  - No SSL/TLS support (no cert file)
  - proxying from :6080 to localhost:5901

Navigate to this URL:

    http://localhost:6080/vnc.html?host=localhost&port=6080

Press Ctrl-C to exit
```

To start accessing the linux X-Window system open your navigator and copy paste the URL given in the previous terminal output (here http://localhost:6080/vnc.html?host=localhost&port=6080)

This should display the following image:
![novnc image](./doc/novnc.jpg)

Clic on connect on the upper right corner to access the linux X-Window system and get the following input:
![xfce image](./doc/xfce_0.jpg)

# Testing with the PAL simulator

## To start the PAL simulator:
```
roslaunch talos_pal_physics_simulator talos_pal_physics_simulator_with_actuators_wo_rviz.launch robot:=full_v2 headless:=false speedrun:=false
```
or it is possible to use the following alias:
```
start_renoir
```

## To display the robot from the simulator:
```
rosrun rviz rviz -d /opt/pal/ferrum/share/talos_pal_physics_simulator/config/rviz/
```
or it is possible to use the following alias:
```
start_renoir_rviz
```

## Half sitting starting position
The robot starts with a straight position.
It can be problematic as the robot is near a singularity.
It is necessary to put it in a specific configuration.
In another terminal:
```
roslaunch talos_controller_configuration position_controllers.launch
```
or
```
start_pos_ctrl
```

In a third terminal, you need to first load the half sitting position:
```
rosparam load ./src/renoir_pal_controller_interface/config/half_sitting.yaml
```
Once this is done the following line makes the robot moves from the straight position to the half-sitting position:
```
rostopic pub /play_motion/goal play_motion_msgs/PlayMotionActionGoal '[1, now, nope]' '[now,nope]' '[half_sitting,True,0]'
```

The two previous action are launched by the following alias:
```
launch_half_sitting
```

## Starting your controller
Finally when the robot has reached this position, you can stop the position controller with CTRL+C, and then
launch your controller:
```
roslaunch renoir_pal_controller_interface renoir_controller_effort.launch
```

The result is depicted in the following image
![simulation image](./doc/simulation_pal_physics_simulator.jpg)


text:
[![CircleCI](https://circleci.com/gh/Zenika/terraform-azure-cli.svg?style=svg)](https://circleci.com/gh/Zenika/terraform-azure-cli)
[![Docker Pulls](https://img.shields.io/docker/pulls/zenika/terraform-azure-cli.svg)](https://hub.docker.com/r/zenika/terraform-azure-cli/)

# Terraform and Azure CLI Docker image

## :package: Supported tags and respective Dockerfile links
Repository available on Docker Hub: [zenika/terraform-azure-cli](https://hub.docker.com/r/zenika/terraform-azure-cli)

* [zenika/terraform-azure-cli:latest](https://github.com/Zenika/terraform-azure-cli/blob/master/Dockerfile)
* [zenika/terraform-azure-cli:3.0-alpine](https://github.com/Zenika/terraform-azure-cli/blob/3.0/alpine.Dockerfile)
* [zenika/terraform-azure-cli:3.0-debian](https://github.com/Zenika/terraform-azure-cli/blob/3.0/debian.Dockerfile)
* [zenika/terraform-azure-cli:2.1-alpine](https://github.com/Zenika/terraform-azure-cli/blob/2.1/alpine.Dockerfile)
* [zenika/terraform-azure-cli:2.1-debian](https://github.com/Zenika/terraform-azure-cli/blob/2.1/debian.Dockerfile)
* [zenika/terraform-azure-cli:1.0](https://github.com/Zenika/terraform-azure-cli/blob/v1.0/Dockerfile) - Debian only

:warning: alpine build support is deprecated, new versions will only be debian based.

## :bulb: Motivation
Many Docker images including the Terraform and Azure CLI already exist out there, both on the Docker Hub and Github.
But they all are quite oversized.

The goal is to create a **minimalist** and **lightweight** image with these tools in order to reduce network and storage impact.

This image gives you the flexibility to be used for development or as a base image as you see fits.

## :wrench: What's inside ?

* [Azure CLI](https://docs.microsoft.com/cli/azure/?view=azure-cli-latest), see available version on the [pip repository](https://pypi.org/project/azure-cli/)
* [Terraform CLI](https://www.terraform.io/docs/commands/index.html), see available versions on the [project release page](https://github.com/hashicorp/terraform/releases)
* [Git](https://git-scm.com/), see available versions on the [Debian Packages repository](https://packages.debian.org/search?suite=buster&arch=any&searchon=names&keywords=git)

## :rocket: Usage

### Launch the CLI
Simply launch the container and use the CLI as you would on any other platform, for instance using the latest image:

```bash
docker container run -it --rm --mount type=bind,source="$(pwd)",target=/workspace zenika/terraform-azure-cli:latest
```

> The `--rm` flag will completely destroy the container and its data on exit.

### Build the image
You can build the image locally directly from the Dockerfiles, using the build script:

```bash
# launch build script
./dev-build.sh
```

Optionally, it is possible to choose the tools desired versions using [Docker builds arguments](https://docs.docker.com/engine/reference/commandline/build/#set-build-time-variables---build-arg) :

```bash
# Set tools desired versions
AZURE_CLI_VERSION=2.0.74
TERRAFORM_VERSION=0.12.9

# launch the build script with parameters
./dev-build.sh $AZURE_CLI_VERSION $TERRAFORM_VERSION
```

## :pray: Roadmap & Contributions
Please refer to the [github project](https://github.com/Zenika/terraform-azure-cli/projects/1) to track new features.

Do not hesitate to contribute by [filling an issue](https://github.com/Zenika/terraform-azure-cli/issues) or [a PR](https://github.com/Zenika/terraform-azure-cli/pulls) !

## :book: License
This project is under the [Apache License 2.0](https://raw.githubusercontent.com/Zenika/terraform-azure-cli/master/LICENSE)

repository: daniel-simpson/terraform-azure-cli

repo_name: daniel-simpson/terraform-azure-cli


text:
# City of Tshwane ambulance crew robbed at gunpoint in Soshanguve

Published at: **2019-11-06T20:29:00+00:00**

Author: **Sesona Ngqakamba**

Original: [News24](https://www.news24.com/SouthAfrica/News/city-of-tshwane-ambulance-crew-robbed-at-gunpoint-in-soshanguve-20191106)

A City of Tshwane emergency service crew was robbed when they responded to an apparent medical emergency in Block GG, Soshanguve, just after 02:00 on Wednesday.
It is alleged that the call centre received a call requesting assistance with a patient who had difficulty breathing. When the crew arrived at the address, they found the house with its lights off and a locked gate.
While phoning the call centre to confirm the address, an unknown man pounced on the crew. He informed them he had called them, before robbing them at gunpoint.
"The unknown male proceeded to give the ambulance crew the exact location of where the patient was and before they realised what was happening, the unknown male confronted the official with a gun through an open window, demanding cellphones from the crew," said City spokesperson Thabo Charles Mabaso.
After instructing the crew to hand over their cellphones, the suspect then told them to drive off.
A case of armed robbery was opened at Phuthanong police station.
"The Tshwane emergency services department would like to condemn such acts of criminality against its personnel.
"Emergency services personnel are dedicated to the care, treatment and transportation of the sick and injured without any prejudice," said Mabaso.
The City said while it had no intention to label parts of the city no-go areas, it would, however, not hesitate to consider the safety of its staff first before dispatching crews to these areas.

license: Unlicense

repository: dsadlollioygjmzvcxv/tdc-exported

repo_name: dsadlollioygjmzvcxv/tdc-exported


text:
# Puma

[Puma](https://github.com/puma/puma) is the default web server used by GitLab.com and
the GDK.

To reduce memory usage in GDK, the `nakayoshi_fork` is enabled by default in GDK.
According to the
[`nakayoshi_fork` pull request](https://github.com/puma/puma/pull/2256), the fork was
added to:

> Reduce memory usage in preloaded cluster-mode apps by GCing before
> fork and compacting, where available.

## Disable `nakayoshi_fork`

The `nakayoshi_fork` can be disabled if needed by setting the
`DISABLE_PUMA_NAKAYOSHI_FORK` environment variable to `true`:

```shell
export DISABLE_PUMA_NAKAYOSHI_FORK=true
gdk restart
```

repository: nberveiler/gitlab-development-kit

repo_name: nberveiler/gitlab-development-kit


text:
# MyReads

This Project keeps track of your books which have you read or currently reading or wants to read.

## Installation and Launching

- install all project dependencies with `npm install` or `yarn`
- start the development server with `npm start` or `yarn start`

repository: Fiju/my-reads-app

repo_name: Fiju/my-reads-app


text:
---
title: AreaSeries
page_title: AreaSeries | RadChartView | Telerik UI for Xamarin.Android Documentation
description: A page desribing the AreaSeries in RadChartView for Android. This article explains the most important things you need to know before using AreaSeries.
slug: chart-series-area
tags: radchartview, areaseries, area, chart
publish: true
position: 3
---

## ChartView for Xamarin.Android: AreaSeries

**RadCartesianChartView** visualizes **AreaSeries** as an area on the chart that is enclosed by the coordinate axes and straight line segments that connect the data points represented by these series. The **AreaSeries** extend **CategoricalStrokedSeries**, so they are also **CategoricalSeries** and require one **CategoricalAxis** and one **LinearAxis**.

## Example

You can read from the [Getting Started]({% slug chart-gettingstarted %} "Read how to define the MonthResult type") page how to define the `MonthResult` type and declare the **initData()** method.

After you create the method for initialization of sample data, you can create a **RadCartesianChartView** with **AreaSeries** by adding the following code to the **onCreate()** method of your Activity.

```C#
InitData();

RadCartesianChartView chartView = new RadCartesianChartView(this);

AreaSeries areaSeries = new AreaSeries();
areaSeries.CategoryBinding = new MonthResultDataBinding ("Month");
areaSeries.ValueBinding = new MonthResultDataBinding ("Result");
areaSeries.Data = (Java.Lang.IIterable)this.monthResults;
chartView.Series.Add(areaSeries);

CategoricalAxis horizontalAxis = new CategoricalAxis();
chartView.HorizontalAxis = horizontalAxis;

LinearAxis verticalAxis = new LinearAxis();
chartView.VerticalAxis = verticalAxis;

ViewGroup rootView = (ViewGroup)FindViewById(Resource.Id.container);
rootView.AddView(chartView);
```

Here's the result:

![TelerikUI-Chart-Series-Area](images/chart-series-area-1.png "Demo of Cartesian chart with AreaSeries.")

## Customization

**AreaSeries** extend **CategoricalStrokedSeries** which provides the following way to change their style:

* **StrokeColor**: changes the color used to draw lines.
* **StrokeThickness**: changes the width of the lines.

Additionally, **AreaSeries** can change the color of their fill with the **FillColor** property.

You can also customize the appearance of **AreaSeries** by using [Palettes]({% slug chart-palettes %} "Read how to use Palettes in RadChartView").

repository: telerik/xamarin-forms-docs

repo_name: telerik/xamarin-forms-docs


text:
---
layout: post
title: B+ Tree
subtitle:
categories: [Database]
tags: [ComputerScience]
---

### Basic Concepts
Indexing mechanisms used to speed up access to desired data
- E.g., author catalog in library

Search Key : attribute used to look up records in a file.

An index file consists of records (called index entries) of the form
- Index files are typically much smaller than the original file
- Two basic kinds of indices:
	- Ordered indices: search keys are stored in sorted order
    - Hash indices: search keys are distributed uniformly across “buckets” using a “hash function”.

### Multilevel Index
- If primary index does not fit in memory, access becomes expensive.
- To reduce number of disk accesses to index records, treat primary index kept on disk as a sequential file and construct a sparse index on it.
    - outer index : a sparse index of primary index
    - inner index : the primary index file
- If even outer index is too large to fit in main memory, yet another level of index can be created, and so on.
- Indices at all levels must be updated on insertion or deletion from the file.

![1.1](/assets/images/database/11.1.png)

### B+ tree index files
: B+-tree indices are an alternative to indexed-sequential files.
Advantages of B+-trees outweigh disadvantages, and they are used extensively.

Disadvantage of indexed-sequential files
- performance degrades as file grows, since many overflow blocks get created. Periodic reorganization of entire file is required.

Advantage of B+-tree index files
- automatically reorganizes itself with small, local, changes, in the face of insertions and deletions. Reorganization of entire file is not required to maintain performance.

Disadvantage of B+-trees
- extra insertion and deletion overhead, space overhead.

A B+-tree is a rooted tree satisfying the following properties
- All paths from root to leaf are of the same length
- Each node that is not a root or a leaf has between [n/2] and n children.
- A leaf node has between [(n–1)/2] and n–1 values
- Special cases:
    - If the root is not a leaf, it has at least 2 children
    - If the root is a leaf (that is, there are no other nodes in the tree), it can have between 0 and (n–1) values.

### Node structure
![1.1](/assets/images/database/11.2.png)

### Leaf nodes
![1.1](/assets/images/database/11.3.png)￼

### Non-Leaf Nodes
![1.1](/assets/images/database/11.4.png)
￼
### Summary
![1.1](/assets/images/database/11.5.png)￼

- Since the inter-node connections are done by pointers, “logically” close blocks need not be “physically” close.
- The non-leaf levels of the B+-tree form a hierarchy of sparse indices.
- The B+-tree contains a relatively small number of levels (logarithmic in the size of the main file), thus searches can be conducted efficiently.
- Insertions and deletions to the main file can be handled efficiently, as the index can be restructured in logarithmic time (as we shall see).


text:
# National Data Science Bowl (Kaggle)

Report for work done as part of UCL's Applied Machine Learning module, Spring 2020.

The challenge had already completed, but our score on the private leaderboard would have been position 14/1049  (Top 2% - this challange was several years old however, so we were able to make use of advancements in deep learning that have occurred since the challange was first released).

![Plankton](https://storage.googleapis.com/kaggle-competitions/kaggle/3978/media/Plankton-Diagram3.png)<br/>


text:
A hyper-awareness of how I use the internet for marketing makes me do some weird things. Psst! These are my secrets. (Marketing-related secrets, at least.)  A hyper-awareness of how I use the internet for marketing makes me do some weird things.

Psst! These are my secrets. (Marketing-related secrets, at least.) Can I hear some of yours?

Confession #1: I never click on AdWords or pay-per-click ad links
-----------------------------------------------------------------

**Scenario**: I google “San Antonio web design” and the following results are returned.

![san-antonio-web-design-results.png](/assets/san-antonio-web-design-results.png)

There’s a paid search result (in yellow at the top) for another shop in San Antonio. But look below! The first organic, non-paid result (in white) is for the same company.

Now, I know if I click on the paid ad I’m going to cost Boss money. And I can’t do it! I’m not legitimate business for them; I’m not who they’re really looking for with their AdWords campaign. Plus, I’d appreciate it if they didn’t click on a Digett ad and somehow, some way, I’m sure their thought process will be similar to mine.

So hey, companies with AdWords campaigns, I’m reading your ads and then finding you in organic results. I’m saving you pennies!

You’re welcome.

Confession #2: I always use “unsubscribe” links instead of the “mark as spam” button.
-------------------------------------------------------------------------------------

I want to stand on a mountain with a yodel-horn-style megaphone and educate the world about the difference between the “mark as spam’ button and the “unsubscribe” feature included in any legitimate email.

_Please, friends! Don’t click the spam button on my email campaign! I am legitimately emailing you because you gave me permission! If you’ve changed your mind, please just unsubscribe._

Because I worry about clean subscriber lists and [good opt-in practices](/blog/06/09/2011/email-marketing-what-am-i-doing-wrong) to avoid any kind of blacklisting, I don’t want to bring that same pain to fellow marketers by clicking the “spam” button. Thus, my confession that I always unsubscribe.

Confession #2b: I will totally use the “mark as spam” button if you annoy me.
-----------------------------------------------------------------------------

My goodwill has boundaries, of course. Know what will make me click the “spam” button every time? An inconvenient unsubscribe process.

There are too many email marketing solutions that make it easy to implement a one-click unsubscribe link or one-click access to a subscription preferences screen. If you make it harder than that, I’ll ruthlessly mark you as spam.

I imagine somewhere there’s a big bucket of marketer-to-marketer karma filling up as a result of my over-conscientiousness. ...Right?

### We’re a quirky profession.  What weird thing do you do?

\[Image credt: [Hans\_van\_Rijnberk](http://www.flickr.com/photos/hansvanrijnberk/)\]

repository: alexander-digett/digett

repo_name: alexander-digett/digett


text:
---
title: 设计模式22-享元模式
tags: [设计模式]
---
# 设计模式22-享元模式
享元模式：运用共享技术有效地支持大量细粒度的对象。 ![设计模式-享元模式](/images/sjms22_xyms.png)<br/>

## 代码实例
Flyweight 享元接口
```
public interface Flyweight {
    public void operation(int extrinsicstate);
}
```
ConcreteFlyweight 享元接口实现类
```
public class ConcreteFlyweight implements Flyweight {
    @Override
    public void operation(int extrinsicstate) {
        System.out.println("具体的flyweight" + extrinsicstate);
    }
}

```
UnsharedConcreteFlyweight 非共享类
```
public class UnsharedConcreteFlyweight implements Flyweight {
    @Override
    public void operation(int extrinsicstate) {
        System.out.println("不共享的具体FlyWeight" + extrinsicstate);
    }
}

```
FlyweightFactory享元工厂类
```
public class FlyweightFactory {
    private Map<String, Flyweight> flyweightMap = new HashMap<String, Flyweight>();

    public FlyweightFactory() {
        this.flyweightMap.put("X",new ConcreteFlyweight());
        this.flyweightMap.put("Y",new ConcreteFlyweight());
        this.flyweightMap.put("Z",new ConcreteFlyweight());
    }

    public Flyweight getFlyweightInstance(String key){
        return flyweightMap.get(key);
    }
}

```

测试类
```
public class FlyweightMain {
    public static void main(String[] args) {
        int ext = 22;
        FlyweightFactory flyweightFactory = new FlyweightFactory();
        Flyweight flyweightX = flyweightFactory.getFlyweightInstance("X");
        flyweightX.operation(--ext);
        Flyweight flyweightY = flyweightFactory.getFlyweightInstance("Y");
        flyweightY.operation(--ext);
        Flyweight flyweightZ = flyweightFactory.getFlyweightInstance("Z");
        flyweightZ.operation(--ext);

        UnsharedConcreteFlyweight unsharedConcreteFlyweight = new UnsharedConcreteFlyweight();
        unsharedConcreteFlyweight.operation(--ext);

    }
}
```
## 应用场景
- 一个应用程序使用了大量的对象，大量的这些对象造成了很大的存储开销时就应该考虑使用。
- 对象的大部分状态是外部状态，如果删除对象的外部状态，可以用相对较少的共享对象取代很多组对象，此时可以考虑使用享元模式。

repository: dumingcode/blog

path: /docs/blog/设计模式/2018-12-27-设计模式22-享元模式.md

repo_name: dumingcode/blog


text:
# math-utils
This is a very simple Python project, meant to be used in my tutorials.

By design, the Python files in this project do not contain comments.

There are two modules: `math_utils.operations` and `math_utils.calculator`. The operations module contains some simple mathematical operations, and the calculator module contains a stateful class that maintains a current number and apply operations from the operations module to it.

repository: naphatkrit/math-utils

repo_name: naphatkrit/math-utils


text:
---
title: "Network State"
author: Jonas Kgomo
tags: ["New"]
image: img/state.png
date: "2021-04-09T10:00:00.000Z"
draft: false
---

# How to Start a New Country

This post is a review of Balaji S. Srinivasan's post at [1729.com](https://1729.com/how-to-start-a-new-country/)

The necessity of starting a new country is fundamental to innovation and jurisdiction often puts limitations on what can be done in practice. Prior to the 17th century, the first corporations were not-for-profit, these included universities and hospitals, as they were public goods. It was not imaginable to form a company in that time, after the 17th century it was possible to do so, mostly by European imperialists looking to control trade, resources and territory in Asia and Africa. Right now it is not easy to imagine forming a nation, however with the cloud it is clear that in the forseable future we will be in place to form a country.

There is already a great interest in [community](https://www.communityled.com/) and technology founders are starting to build their products around community instead of platforms.

# The Four Places To Build

The internet can expand the possibilies of ownership in the metaverse. There are no limits on the expanse. We started the internet by uploading the atoms into bits, now is time to reverse that taking the bits and creating spaces and communities in the real world.

| Frontier |    Metric     |Denizens|
|----------|:-------------:|------:|
| Earth    |    population | 7.7B |
| Water    |    crew ships | 2M |
| Space    |   outer space | 7 |
| Internet | online users  | 3.5B |

> "Still, once we remember that Facebook has 3B users, Twitter has 300M, and many individual influencers have more than 1M followers,it starts to be not too crazy to imagine we can build a 1-10M person social network with a genuine sense of national consciousness -- Balaji .S Srinivasan

Some of the numbers are variable, check [space](https://www.howmanypeopleareinspacerightnow.com/) for auto-updates.

  This account is ever-interesting when you think of the 6 degrees of separation
    1
   .
  Social media sites usually have less than 6 steps of social distance,  for example LinkedIn always shows your 1st and 2nd degree connections with people. On Twitter the separation is 4.67, around 50% people on Twitter are 4 steps away from each  other, almost everyone is less than 5 steps away.  In the real world it takes more steps to connect with people than in the online world. Balaji refers to this new ansemble and social networks meshing together to form a network state, we can digitally sew these disjoint enclaves together into a new kind of polity, a network state.

# How to Start a New Country

Balaji has proposed 6 methods to build a country, the first 3 conventional ones are usually based on violence or can lead to violence. The others are not tested at scale, but inhibit violence.

### 1. Elections

The election process like the electoral college system in the US provides a fortified method against cabal, faction and corruption.  Since it has existed since the `1780s` , it is a conventional way to build a country.  but it can work in different ways that can help the.

### 2. Revolution &  War

This approach is violent and is therefore not advised.

  The aim is "spreading individual freedom while preventing cataclysmic mimetic
    3

 violence"   Peter Thiel

Some example of this recently, 2006 is the [Afrikaners](https://en.wikipedia.org/wiki/Suidlanders) in South Africa who have been preparing for a hypothetical "revolution risk" of 50%. They have even succeded in building states where only Afrikaners reside, like [Orania](https://en.wikipedia.org/wiki/Orania,_Northern_Cape), a whites-only town for self-determination of Afrikaners in South Africa, either on federal principles or as a fully independent Boer homeland.

### 4.  Some other forms of micronations experiments include [Charter Cities](https://www.chartercitiesinstitute.org/).

The Vatican is one example of a city state, an enclave within Rome, which is a theocracy. Swaziland

    2
 is a landlocked country in Southern Africa, it is a monarchy, another example of tribal state. East Timor (Timor Leste) is another example of a micronation inside Indonesia that relequinshed control over the territory. It became the first soveriegn state  of the 21st century and ASEAN member aspirant.

### 5. Seasteading

Seasteads are dwellings that are at seas, they can be made from cruise ships, and floating islands.  The Seasteading Institute, is founded by Wayne Gramlich and Patri Friedman who are working on making this feasible. The UN uses the Exclusive Economic Zone of 200 nautical miles (370 km) extending from shore to define a country by the sea.

#### 5.1 [Artificial Islands](https://en.wikipedia.org/wiki/Artificial_island)
Man-made islands are usually government projects for geopolitics, the island are constructed by people rather than formed by natural means. China has made at least seven artificial islands in the South China Sea totaling 200 nautical acres, beyond that boundary anyone can experiment with governance systems.

### 6. Space

Space colonization  has always been a frontier that most cultures in the past found as a possible habitat, from science fiction to natural philosphy. This is much more socially acceptible endeavour. Elon Musk's SpaceX is one entity seriously contemplating the logistics of starting a new state on Mars.

### 7. Cloud Countries

These are nations created from the cloud and recruiting happens in the cloud and then later assume them in the physical world. These are created trough virtual social or interest networks which can eventually be countries.

> [Epic Games](https://www.epicgames.com/site/en-US/news/announcing-a-1-billion-funding-round-to-support-epics-long-term-vision-for-the-metaverse) has raised 1B USD to create a metaverse where anyone can assume an avatar(meta humans) in a digital world, this will kick-start the global community to be involved!

The premise of a cloud city is that , its downloading internet cultures to the real world, which can be thought of as a cloud embassy. Bitcoin and Ethereum both have these nature of expansion.

> VR is timeless since you could interact with spaces that where created in the past. You can have infinite space and land in virtual reality, because the design of the world is not necessarily newtownian.

[Decentraland](https://decentraland.org/) : is a platform where you could own digital real-estate and assets. This community can then later be assimilated in the real world.

[Próspera](https://www.bloomberg.com/news/articles/2021-03-27/prospera-in-honduras-a-private-tech-city-now-open-for-business) : a mini startup nation with its own set of laws has begun recruiting residents in 2021.

![img](img/hn.jpg)

Countries like Finland are begining to offer relocation packages, such recruiting can translate to cloud city member harvesting.

The United States has in the past restricted export of software and encryption with [crypto wars](https://en.wikipedia.org/wiki/Crypto_Wars), the antithesis, is to export of software and internet communities into the real world, to expand the freedom of the internet into civil societies, for example the US government practices [export of cryptography](https://en.wikipedia.org/wiki/Export_of_cryptography_from_the_United_States), which made cryptography equivalent to amunitions. In a cloud city,  statutes can be applied from the cities laws to then be applied in the physical city.

 The idea that all people on average are six, or fewer, social connections away from each other.

      ↩

The Kingdom of Eswatini aka Swaziland, is a landlocked country in Southern Africa.

      ↩

      ↩ Peter Thiel & Eric Weinstein

      ↩ Balaji on cloud cities, decentralized credentials and pseudonymity

repository: jonas-kgomo/OarystisVR

gha_language: TypeScript

repo_name: jonas-kgomo/OarystisVR


text:
---
layout: post
title: What does getting ready for the first time speaking in person at a tech conference
  feels like
date: 2022-04-23T22:33:34.000-03:00
image: https://res.cloudinary.com/jesstemporal/image/upload/v1652632564/covers/personal_hjhwwt.png
tags:
- pessoal
- English
comments: true
description: And why should you get back on the road
lang: en
translator: false
related: false
author_note_link: "https://jtemporal.com/como-e-se-preparar-para-palestrar-pela-primeira-vez-num-evento-tech-presencial"
author_note: "Você pode ler esse artigo em Português"
translated: "/como-e-se-preparar-para-palestrar-pela-primeira-vez-num-evento-tech-presencial"

---
If nothing else, sharing knowledge is a joyful experience. Think of the first time you learned to do something. Really learned. Didn’t it feel amazing? Didn’t you want to tell everyone and see their reactions when they saw that cool thing?

I know I did. This is the same feeling I have in mind when I’m creating a new piece of content, be it a blog post, a video, a podcast episode, or a new talk. It is always the same. I want to share this cool thing with anyone that will listen.

The thing is, for the past two years, I’ve been talking to a camera. I had to change the interaction and questions to the crowd into questions that nobody could answer back. Sure there were chats, but it wasn’t the same thing, and that is okay, but I miss the exchange. It feels like talking to the void and never getting an answer back.

I had forgotten how the build-up of happiness goes right before the trip. Planning the talk, getting the suitcase ready, making a mental note to print invitation letters, grabbing the passport, and so on.

After two years, I’ll be able to ask questions and see the people’s faces light up when they arrive at a conclusion they want to share.

For the first time in forever, I’ll ask the questions, and there will be people there to actually answer. It feels great to know that I won’t be only talking to a camera anymore.

If you talk at events, you may not be ready to get back on the road just yet, and that’s okay. Take your time, and don’t rush it. It is hard to change two years’ worth of habits.

But as the world falls into a post-pandemic rhythm of new normalcy, remember what it felt like when you shared that cool thing with other humans. Hold on to that for when you are ready to get back on the road. I’m sure it will be great.

gha_language: HTML


text:
## Shared-State Concurrency

Message passing is a fine way of handling concurrency, but it’s not the only
one. Consider this part of the slogan from the Go language documentation again:
“do not communicate by sharing memory.”

What would communicating by sharing memory look like? In addition, why would
message-passing enthusiasts not use it and do the opposite instead?

In a way, channels in any programming language are similar to single ownership,
because once you transfer a value down a channel, you should no longer use that
value. Shared memory concurrency is like multiple ownership: multiple threads
can access the same memory location at the same time. As you saw in Chapter 15,
where smart pointers made multiple ownership possible, multiple ownership can
add complexity because these different owners need managing. Rust’s type system
and ownership rules greatly assist in getting this management correct. For an
example, let’s look at mutexes, one of the more common concurrency primitives
for shared memory.

### Using Mutexes to Allow Access to Data from One Thread at a Time

*Mutex* is an abbreviation for *mutual exclusion*, as in, a mutex allows only
one thread to access some data at any given time. To access the data in a
mutex, a thread must first signal that it wants access by asking to acquire the
mutex’s *lock*. The lock is a data structure that is part of the mutex that
keeps track of who currently has exclusive access to the data. Therefore, the
mutex is described as *guarding* the data it holds via the locking system.

Mutexes have a reputation for being difficult to use because you have to
remember two rules:

* You must attempt to acquire the lock before using the data.
* When you’re done with the data that the mutex guards, you must unlock the
  data so other threads can acquire the lock.

For a real-world metaphor for a mutex, imagine a panel discussion at a
conference with only one microphone. Before a panelist can speak, they have to
ask or signal that they want to use the microphone. When they get the
microphone, they can talk for as long as they want to and then hand the
microphone to the next panelist who requests to speak.  If management of the shared microphone goes wrong, the panel won’t work
as planned!

Management of mutexes can be incredibly tricky to get right, which is why so
many people are enthusiastic about channels. However, thanks to Rust’s type
system and ownership rules, you can’t get locking and unlocking wrong.

#### The API of `Mutex<T>`

As an example of how to use a mutex, let’s start by using a mutex in a
single-threaded context, as shown in Listing 16-12:

Filename: src/main.rs

```rust
{{#rustdoc_include ../listings/ch16-fearless-concurrency/listing-16-12/src/main.rs}}
```

Listing 16-12: Exploring the API of `Mutex<T>` in a
single-threaded context for simplicity

As with many types, we create a `Mutex<T>` using the associated function `new`.
To access the data inside the mutex, we use the `lock` method to acquire the
lock. This call will block the current thread so it can’t do any work until
it’s our turn to have the lock.

The call to `lock` would fail if another thread holding the lock panicked. In
that case, no one would ever be able to get the lock, so we’ve chosen to
`unwrap` and have this thread panic if we’re in that situation.

After we’ve acquired the lock, we can treat the return value, named `num` in
this case, as a mutable reference to the data inside. The type system ensures
that we acquire a lock before using the value in `m`: `Mutex<i32>` is not an
`i32`, so we *must* acquire the lock to be able to use the `i32` value. We
can’t forget; the type system won’t let us access the inner `i32` otherwise.

As you might suspect, `Mutex<T>` is a smart pointer. More accurately, the call
to `lock` *returns* a smart pointer called `MutexGuard`, wrapped in a
`LockResult` that we handled with the call to `unwrap`. The `MutexGuard` smart
pointer implements `Deref` to point at our inner data; the smart pointer also
has a `Drop` implementation that releases the lock automatically when a
`MutexGuard` goes out of scope, which happens at the end of the inner scope in
Listing 16-12. As a result, we don’t risk forgetting to release the lock and
blocking the mutex from being used by other threads because the lock release
happens automatically.

After dropping the lock, we can print the mutex value and see that we were able
to change the inner `i32` to 6.

#### Sharing a `Mutex<T>` Between Multiple Threads

Now, let’s try to share a value between multiple threads using `Mutex<T>`.
We’ll spin up 10 threads and have them each increment a counter value by 1, so
the counter goes from 0 to 10. The next example in Listing 16-13 will have
a compiler error, and we’ll use that error to learn more about using
`Mutex<T>` and how Rust helps us use it correctly.

Filename: src/main.rs

```rust,ignore,does_not_compile
{{#rustdoc_include ../listings/ch16-fearless-concurrency/listing-16-13/src/main.rs}}
```

Listing 16-13: Ten threads each increment a counter
guarded by a `Mutex<T>`

We create a `counter` variable to hold an `i32` inside a `Mutex<T>`, as we
did in Listing 16-12. Next, we create 10 threads by iterating over a range
of numbers. We use `thread::spawn` and give all the threads the same closure,
one that moves the counter into the thread, acquires a lock on the `Mutex<T>`
by calling the `lock` method, and then adds 1 to the value in the mutex. When a
thread finishes running its closure, `num` will go out of scope and release the
lock so another thread can acquire it.

In the main thread, we collect all the join handles. Then, as we did in Listing
16-2, we call `join` on each handle to make sure all the threads finish. At
that point, the main thread will acquire the lock and print the result of this
program.

We hinted that this example wouldn’t compile. Now let’s find out why!

```console
{{#include ../listings/ch16-fearless-concurrency/listing-16-13/output.txt}}
```

The error message states that the `counter` value was moved in the previous
iteration of the loop. So Rust is telling us that we can’t move the ownership
of lock `counter` into multiple threads. Let’s fix the compiler error with a
multiple-ownership method we discussed in Chapter 15.

#### Multiple Ownership with Multiple Threads

In Chapter 15, we gave a value multiple owners by using the smart pointer
`Rc<T>` to create a reference counted value. Let’s do the same here and see
what happens. We’ll wrap the `Mutex<T>` in `Rc<T>` in Listing 16-14 and clone
the `Rc<T>` before moving ownership to the thread.

Filename: src/main.rs

```rust,ignore,does_not_compile
{{#rustdoc_include ../listings/ch16-fearless-concurrency/listing-16-14/src/main.rs}}
```

Listing 16-14: Attempting to use `Rc<T>` to allow
multiple threads to own the `Mutex<T>`

Once again, we compile and get... different errors! The compiler is teaching us
a lot.

```console
{{#include ../listings/ch16-fearless-concurrency/listing-16-14/output.txt}}
```

Wow, that error message is very wordy! Here’s the important part to focus
on: `` `Rc<Mutex<i32>>` cannot be sent between threads safely ``. The compiler
is also telling us the reason why: ``the trait `Send` is not implemented for
`Rc<Mutex<i32>>` ``. We’ll talk about `Send` in the next section: it’s one of
the traits that ensures the types we use with threads are meant for use in
concurrent situations.

Unfortunately, `Rc<T>` is not safe to share across threads. When `Rc<T>`
manages the reference count, it adds to the count for each call to `clone` and
subtracts from the count when each clone is dropped. But it doesn’t use any
concurrency primitives to make sure that changes to the count can’t be
interrupted by another thread. This could lead to wrong counts—subtle bugs that
could in turn lead to memory leaks or a value being dropped before we’re done
with it. What we need is a type exactly like `Rc<T>` but one that makes changes
to the reference count in a thread-safe way.

#### Atomic Reference Counting with `Arc<T>`

Fortunately, `Arc<T>` *is* a type like `Rc<T>` that is safe to use in
concurrent situations. The *a* stands for *atomic*, meaning it’s an *atomically
reference counted* type. Atomics are an additional kind of concurrency
primitive that we won’t cover in detail here: see the standard library
documentation for [`std::sync::atomic`][atomic] for more
details. At this point, you just need to know that atomics work like primitive
types but are safe to share across threads.

You might then wonder why all primitive types aren’t atomic and why standard
library types aren’t implemented to use `Arc<T>` by default. The reason is that
thread safety comes with a performance penalty that you only want to pay when
you really need to. If you’re just performing operations on values within a
single thread, your code can run faster if it doesn’t have to enforce the
guarantees atomics provide.

Let’s return to our example: `Arc<T>` and `Rc<T>` have the same API, so we fix
our program by changing the `use` line, the call to `new`, and the call to
`clone`. The code in Listing 16-15 will finally compile and run:

Filename: src/main.rs

```rust
{{#rustdoc_include ../listings/ch16-fearless-concurrency/listing-16-15/src/main.rs}}
```

Listing 16-15: Using an `Arc<T>` to wrap the `Mutex<T>`
to be able to share ownership across multiple threads

This code will print the following:

```text
Result: 10
```

We did it! We counted from 0 to 10, which may not seem very impressive, but it
did teach us a lot about `Mutex<T>` and thread safety. You could also use this
program’s structure to do more complicated operations than just incrementing a
counter. Using this strategy, you can divide a calculation into independent
parts, split those parts across threads, and then use a `Mutex<T>` to have each
thread update the final result with its part.

### Similarities Between `RefCell<T>`/`Rc<T>` and `Mutex<T>`/`Arc<T>`

You might have noticed that `counter` is immutable but we could get a mutable
reference to the value inside it; this means `Mutex<T>` provides interior
mutability, as the `Cell` family does. In the same way we used `RefCell<T>` in
Chapter 15 to allow us to mutate contents inside an `Rc<T>`, we use `Mutex<T>`
to mutate contents inside an `Arc<T>`.

Another detail to note is that Rust can’t protect you from all kinds of logic
errors when you use `Mutex<T>`. Recall in Chapter 15 that using `Rc<T>` came
with the risk of creating reference cycles, where two `Rc<T>` values refer to
each other, causing memory leaks. Similarly, `Mutex<T>` comes with the risk of
creating *deadlocks*. These occur when an operation needs to lock two resources
and two threads have each acquired one of the locks, causing them to wait for
each other forever. If you’re interested in deadlocks, try creating a Rust
program that has a deadlock; then research deadlock mitigation strategies for
mutexes in any language and have a go at implementing them in Rust. The
standard library API documentation for `Mutex<T>` and `MutexGuard` offers
useful information.

We’ll round out this chapter by talking about the `Send` and `Sync` traits and
how we can use them with custom types.

[atomic]: ../std/sync/atomic/index.html

repository: rust-lang-cn/book-cn

repo_name: rust-lang-cn/book-cn


text:
# Asynchronous Programming

Given that the JavaScript runtime is single-threaded, it can be difficult to
ensure that processor-intensive tasks are executed in a manner that doesn't
prevent the UI from being responsive

## What is Asynchronous?

It is important to know whether resources in JavaScript are synchronous or
asynchronous. Synchronous code means the result can be returned relatively
immediately, so the application will block until the action is complete.
With asynchronous resources, it can be hard to know how long an operation will
take, so the results are typically provided through a callback.

This includes:

* Fetching server resources (AJAX)
* Working with local databases
* Accessing hardware resources (geolocation, camera, etc.)

## setTimeout/setInterval

## Error Handling and Exceptions

## Promise/Deferred APIs

## Publish/Subscribe Pattern

repository: WebDevBootcamp/course-content

repo_name: WebDevBootcamp/course-content


text:
# errors

This module provides helpers for patterns regarding *didEncounterError* events.

## Contents

**Module Members**

- [errorPublisherForFeature()](#errorPublisherForFeature)

## Module Members

#### errorPublisherForFeature( context, featurePath, options )

Creates and returns a function to publish *didEncounterError* events related to a specific feature.
Generated events will not be delivered to the sender.

The returned publisher function takes these arguments:
- `code` (`String`): a generic code that identifies the failing operation (such as `'HTTP_PUT'`,
  `'HTTP_GET'` ...)
- `messagePath` (`String`): path to the message (or i18n message object) located under
  ```context.features.${featurePath}``` to send along with the error event
- `data` (`any`): additional information to be used for substituting in the message. It should contain the
  fields `resource` and `location` if applicable.
- `cause` (`any`): more diagnostic information on the error's cause, such as the underlying HTTP status
  code

Example:

Possible feature configuration:
```json
{
   "features": {
      "myFeatures": {
         "failureMessage": "Something really bad happened!"
      }
   }
}
```
Creating and using a publisher:
```js
const publisher = errors.errorPublisherForFeature( context, 'myFeature' );
// ...
publisher( 'HTTP_GET', 'failureMessage', {
   resource: 'user',
   moreInfo: 'Probably under DoS attack'
} );
```

##### Parameters

| Property | Type | Description |
| -------- | ---- | ----------- |
| context | `AxContext` |  the widget context to work on |
| featurePath | `String` |  the configuration path for (i18n) error-messages to publish |
| _options_ | `Object` |  an optional object with additional configuration |
| _options.localizer_ | `Function` |  a function such as `i18nHandler.localize` to prepare messages |
| _options.formatter_ | `Function` |  a `laxar.string.format`-compatible function to interpolate named message arguments. It will always be called with `( message, [], data )` where `data` was passed to the publisher by the user |

##### Returns

| Type | Description |
| ---- | ----------- |
| `Function` |  a publisher function with four arguments as described above |

repository: LaxarJS/laxar-patterns

repo_name: LaxarJS/laxar-patterns


text:
# Super-Card App
A simple app made with React that allows users to check for services that have a discount

```
> git clone https://github.com/Super-Card/Super-Card.git
> cd Super-Card
> yarn
> yarn start
```

repository: Super-Card/Super-Card

branch_name: refs/heads/develop

repo_name: Super-Card/Super-Card


text:
<!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
-->

# MCJS - *Milagro Crypto JavaScript*

* **category**:    Library
* **copyright**:   2023 The Apache Software Foundation
* **license**:     ASL 2.0 - http://www.apache.org/licenses/LICENSE-2.0
* **link**:        https://github.com/apache/incubator-milagro-crypto-js

## Description

*MCJS - Milagro Crypto JavaScript*

* MCJS is a standards compliant JavaScript cryptographic library with no
external dependencies except for the random seed source.

* MCJS supports the standards for RSA, ECDH, ECIES, ECDSA and M-PIN, AES-GCM
encryption/decryption, SHA256, SHA384, SHA512 and SHA3 hash functions and a
cryptographically secure random number generator. Furthermore we recently
added New Hope, a post-quantum key exchange.

* MCJS is [Node.js](https://nodejs.org/en/) compatible and browser compatible
(see some examples below).

## Install and run  tests

[Node.js](https://nodejs.org/en/) (maximum v8.0.0) and
[npm](https://www.npmjs.com/) are required in order to build the library and
run the tests. Install also the node.js modules required with the command

```
npm install
```

Run all the tests with the following command

```
npm test
```

## Docker

To create the image execute;

```
docker build -t mcjs:builder .
```

To run the tests;

```
docker run --rm mcjs:builder
```

## Quick Start

#### Elliptic Curves

Suppose you want to implement ECDH with NIST256 elliptic curve. First you need
to initialize the context:

```
var CTX = require("milagro-crypto-js");

var ctx = new CTX("NIST256");
```

then you can call the functions as follows:

```
ctx.ECDH.KEY_PAIR_GENERATE(...);
ctx.ECDH.ECPSVDP_DH(...);
```

If you need to use more than one elliptic curve in the same script you only
need to initialize two different contexts, for example

```
var ctx1 = new CTX("NIST256");
var ctx2 = new CTX("C25519");
```

The following is the list of all elliptic curves supported by MCJS

```
['ED25519', 'C25519', 'SECP256K1', 'NIST256', 'NIST384', 'BRAINPOOL', 'ANSSI', 'HIFIVE', 'GOLDILOCKS', 'C41417', 'NIST521', 'NUMS256W', 'NUMS256E', 'NUMS384W', 'NUMS384E', 'NUMS512W', 'NUMS512E', 'FP256BN', 'FP512BN', 'BN254', 'BN254CX', 'BLS383', 'BLS24', 'BLS48', 'BLS381', 'BLS461'];
```

#### RSA

This library supports also RSA encryption/decryption and RSA signature. The following is a quick example on how to use RSA. First initialize the context

```
var CTX = require("milagro-crypto-js");

var ctx = new CTX("RSA2048");
```
then you can call the RSA functions as follows:

```
ctx.RSA.ENCRYPT(...);
ctx.RSA.DECRYPT(...);
```

The following is the list of all the RSA security level supported by *MCJS*

```
['RSA2048','RSA3072','RSA4096'];
```

#### Other functions

MCJS supports SHA256, SHA384, SHA512, AES-GCM encryption and Marsaglia & Zaman
random number generator. Those functions are contained in every context initialized
with RSA or with an elliptic curve. If you want to create a context supporting only
those general functions then initialize it with no parameter as follows:

```
var CTX = require("milagro-crypto-js");

var ctx = new CTX();
```

## Run examples

[Node.js](https://nodejs.org/en/) examples are provided - please see
`./examples/node`. Use the following command to run an example

```
node ./examples/node/example_ECC_NIST256.js
```

## Browsers

The library source code is browser compatible. The browser examples are located
in `./examples/browser`.

## Docker

The tests can be run using Docker:

```
docker build -t mcjs:builder .
docker run --rm mcjs:builder
```

## Contributors

The following people have contributed to milagro-crypto-js

- Mike Scott
- Kealan McCusker
- Alessandro Budroni
- Samuele Andreoli

Please add yourself here if you make or have made a contribution.

## Making a Contribution

1.  [Check for open issues](https://github.com/apache/incubator-milagro-crypto-js/issues)
    or start a discussion around a feature idea or a bug by sending a mail to
<EMAIL_ADDRESS>2.  Fork the repository to start making your changes. Please use the master branch
    as a basis.
3.  Write a test which shows that the bug was fixed or that the feature works as expected.
4.  Make a pull request with a reference to the issue

## Crypto Notice

This distribution includes cryptographic software. The country in which you
currently reside may have restrictions on the import, possession, use, and/or
re-export to another country, of encryption software. BEFORE using any
encryption software, please check your country's laws, regulations and
policies concerning the import, possession, or use, and re-export of encryption
software, to see if this is permitted. See <http://www.wassenaar.org/> for
more information.

The Apache Software Foundation has classified this software as Export Commodity
Control Number (ECCN) 5D002, which includes information security software using
or performing cryptographic functions with asymmetric algorithms. The form and
manner of this Apache Software Foundation distribution makes it eligible for
export under the "publicly available" Section 742.15(b) exemption (see the BIS
Export Administration Regulations, Section 742.15(b)) for both object code and
source code.

## Disclaimer

Apache Milagro is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.

repository: apache/incubator-milagro-crypto-js

repo_name: apache/incubator-milagro-crypto-js


text:
# Stanford-Dogs-Dataset-Parser
Easy way to parse Stanford dogs dataset and have it ready to train on tensorflow or add more images and regenrate the dataset
Requirments:
- tqdm
- python3
Steps to run parser. (run all commands from root directory)
1. run `sh ./src/setup/creatPaths.sh`
2. run `sh ./src/setup/downloadStanfordDataset.sh`
3. run `python3 -m src.parser`


text:
# Hardware

# Quark Processor

> Intel Quark is a line of 32-bit x86 SoCs and μCs by Intel, designed for small size and low power consumption, and targeted at new markets including wearable devices. The line was introduced at Intel Developer Forum in 2013. Quark processors, while slower than Atom processors, are much smaller and consume less power. They lack support for SIMD instruction sets (such as MMX and SSE)[1] and only support embedded operating systems. Quark powers the Intel Galileo developer microcontroller board. [Wikipedia](https://en.wikipedia.org/wiki/Intel_Quark)

- [Intel® Quark™ SoC Family Ark](http://ark.intel.com/products/family/79047)

> "Lakemont" (32 nm)
> > The name Lakemont has been used in reference to the processor core in multiple Quark-series processors.

> "Clanton"
> > [Quark X1000](Intel® Quark™ SoC X1000) .. [Quark X1021D](http://ark.intel.com/products/81329)

> "Silver Butte"
> > [Quark D1000](http://ark.intel.com/products/86826)

> "Mint Valley"
> > [Quark D2000](http://ark.intel.com/products/91947)

> "Atlas Peak"
> > [Quark SE C1000](http://ark.intel.com/products/91949)


text:
# movieRecModel

# Model
We are using Neural Colaberative Filtering in order to map user interactions with items
to ratings.

NCF is a generalization on Matrix Factorization. MF is used for reccomender systems but is not able to fully leverage large amounts of data as well as a neural net can.

Below is a diagram of the model:
![](images/ncf_diagram.png)

On the left we embed users and items into an n dimentional latent vector space. We then take the dot product of the two vectors which encodes some information about the similarity of the user and item. After taking the dot product we concatenate the resulting vector with the output of the Multi Layered Perceptron on the right.

On the right we do a similar embedding into an m dimentional latent vector space. This time we concatenate the two vectors and pass them through an MLP.

Finally we concatenate the MF and the MLP outputs into an n + m dimentional vector and pass that through the final layer which maps from m + n -> 1. The final output is passed through a sigmoid function to bound it between 0 and 1.

# Data exploration

![](images/distribution_of_reviews.png)

avg # of reviews/user:<PHONE_NUMBER>3278687

avg # of reviews/movie: 10.369806663924312

One concern I have is that most items have a very small number of reviews since there are so many items.

# Results

![](images/loss.png)

### Prerequisites
```
pip3 install requirements.txt
```

## Authors
Tristan Shah

## Credits
NVIDIA:

https://github.com/NVIDIA/DeepLearningExamples/tree/master/PyTorch/Recommendation/NCF

## License

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

repository: gladisor/movieRecModel

gha_language: Python

repo_name: gladisor/movieRecModel


text:
# Readme Generator

![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)

## Description
ReadMe Generator is an application that generates readmes using the commanline. Simply answer some questions and it will automatically generate a readme for you. Try it on your next project!

## Table of Contents
* [Installation](#installation)
* [Usage](#usage)
* [License](#license)
* [Contribution](#contribution)
* [Questions](#questions)

## Installation
Download the application and run:
```
npm install
```

## Usage
Open a terminal window, type in "node index" and answer the questions. Once done the application will generate the ReadMe.

## Sample
Here is a sample readme https://github.com/ortizjavier10/readme-generator/blob/master/sample/sample-readme.md

## License
Readme Generator is licensed under the MIT License.

## Questions
If you have any question please check out my GitHub https://github.com/ortizjavier10 or email me at<EMAIL_ADDRESS>.


text:
A wallet management system for cryptocurrency exchanges and custodians

  About ◈
  Prerequisites ◈
  Installation ◈
  Getting started ◈
  API reference ◈
  Supporting the project ◈
  Joining the discussion

---

## About

Hub is a wallet management system for cryptocurrency exchanges and custodians. Through its application programming interfaces (APIs), Hub offers you an easy way to integrate IOTA into your application by allowing you to do the following:

- Create user accounts
- Manage users' [IOTA tokens](root://getting-started/0.1/clients/token.md)
- Keep a record of users' [addresses](root://getting-started/0.1/clients/addresses.md)
- Keep a record of users' [transactions](root://getting-started/0.1/transactions/transactions.md)

This is beta software, so there may be performance and stability issues.
Please report any issues in our [issue tracker](https://github.com/iotaledger/hub/issues/new).

## Prerequisites

To install Hub, you need one of the following:

- Docker
- A Linux operating system

## Installation

For installation instructions, see the [documentation portal](https://docs.iota.org/docs/wallets/0.1/hub/how-to-guides/install-hub).

## Getting started

Depending on how you configured Hub, you can use either its gRPC or REST API to start creating new users.
For a guide on using the gRPC API, see the [documentation portal](https://docs.iota.org/docs/wallets/0.1/hub/how-to-guides/get-started-with-grpc-api).

### Getting started with the RESTful API

To create a new user, do the following:

```bash
curl http://localhost:50051 \
-X POST \
-H 'Content-Type: application/json' \
-H 'X-IOTA-API-Version: 1' \
-d '{
  "command": "CreateUser",
  "userId": "Jake"
}'
```
To generate a new deposit address for the user, do the following:

```bash
curl http://localhost:50051 \
-X POST \
-H 'Content-Type: application/json' \
-H 'X-IOTA-API-Version: 1' \
-d '{
  "command": "GetDepositAddress",
  "userId": "Jake",
  "includeChecksum": "true"
}'
```
In the output, you should see a 90-tryte deposit address:

```
"address": "RDZVDZKRBX9T9L9XXONXDVJDRKYPAABWMQLORGCDCWHDDTSOPRZPCQB9AIZZWZAQ9NBZNVUUUSPQHRGWDYZUVP9WSC"
```

**Note:** In the database, addresses are always saved without the checksum.

## API reference

For details on all available API methods, see the [documentation portal](https://docs.iota.works/docs/wallets/0.1/hub/references/restful-api-reference).

## Supporting the project

If you want to contribute to Hub, consider posting a [bug report](https://github.com/iotaledger/hub/issues/new), [feature request](https://github.com/iotaledger/hub/issues/new) or a [pull request](https://github.com/iotaledger/hub/pulls/).

See the [contributing guidelines](CONTRIBUTING.md) for more information.

## Joining the discussion

If you want to get involved in the community, need help with getting setup, have any issues related with the library or just want to discuss IOTA, Distributed Registry Technology (DRT) and IoT with other people, feel free to join our [Discord](https://discord.iota.org/).

repository: iotaledger/hub

repo_name: iotaledger/hub


text:
---
title: "ods-aggregation"
description: "Various examples to showcase ods-aggregation. This widget exposes the results of an aggregation (sum, average, minimum, maximum etc...) function."
tags: ["aggregation", "ods-aggregation"]
height: 340
resources:
- src: '*/'
  name: folder-:counter
---

**The technical documentation says :**

This widget exposes the results of an aggregation function over a context... The result is exposed into a new variable that you can use in other widgets or directly in your HTML.

**More concretely :**

It computes a function like the sum, average, minimum, maximum etc.. over a numerical field. Depending on the context parameters, if filtered (queries, refines, etc...) it will compute the aggregation on a subset of the records, if not, on the entire dataset.

repository: mani-peclet/codelibrary

repo_name: mani-peclet/codelibrary


text:
---
title: COVID Symptom Survey
has_children: true
nav_order: 2
---

# COVID Symptom Survey

Delphi conducts a voluntary COVID-19 symptom survey, distributed daily via a
partnership with Facebook. This survey asks respondents about COVID-like
symptoms, their behavior (such as social distancing), mental health, and
economic and health impacts they have experienced as a result of the pandemic. A
high-level overview of the survey is posted [on the COVIDcast
website](https://covidcast.cmu.edu/surveys.html).

Aggregate data from this survey is available through the [COVIDcast API](../api/covidcast.md)
as the [`fb-survey` data source](../api/covidcast-signals/fb-survey.md).

This documentation is for users who have a signed Data Use Agreement to receive
individual response data from the survey. It describes the survey items, data
coding, data distribution, and the survey weights computed by Facebook. If you
are a researcher and would like to get access to the data, see our page on
getting [data access](data-access.md).

If you have questions about the survey or getting access to data, contact us at
<EMAIL_ADDRESS>

repository: shekelto/delphi-epidata

repo_name: shekelto/delphi-epidata


text:
# ZfrForum - Forum Module For Zend Framework 2

Master: [![Build Status](https://secure.travis-ci.org/zf-fr/ZfrForum.png)](http://secure.travis-ci.org/zf-fr/ZfrForum)

NOTE : the development of ZfrForum is currently halted (mainly because I'm working on ZfrRest, which is a module
that simplify REST that I need for my next project and that Zend Framework 2 really needs to have, and also because
I will be launching my first website soon, so I kinda lack of time). However, we plan to finish it (we hope this year),
but if you want to contribute don't hesitate, I'll carefully review any PR !).

Thanks for waiting !

---

## Français

ZfrForum est un module de forum pour Zend Framework 2. Il est actuellement en cours de développement et sera
utilisé pour le forum de [http://www.z-f.fr](http://www.z-f.fr).

### Dépendances

* ZfcUser
* DoctrineORMModule

### Documentation

### Installation (avec composer)

### Installation (sans composer)

---

## English

ZfrForum is a forum module for Zend Framework 2. It's currently in development and will be used by the French
ZF 2 community [http://www.z-f.fr](http://www.z-f.fr).

### Dependencies

* ZfcUser
* DoctrineORMModule

### Documentation

### Installation (with composer)

### Installation (without composer)

repository: raichand/zfr-forum

repo_name: raichand/zfr-forum


text:
# OSS-CtrlR : Arduino

A controller is based on an Arduino Nano board. Just select the latest firmware and flash your device with it.

Don't forget to install libraries of the `deps` folder. Those libraries are required for the `MPU 6050`.

repository: idoment/OSS-CtrlR

repo_name: idoment/OSS-CtrlR