text:
# EKS Fargate Profiles - Basics

## Step-01: What are we going to learn?

- **Assumptions:**
  - We already havea EKS Cluster whose name is **eksdemo1** created using eksctl
  - We already have a Managed Node Group with private networking enabled with two worker nodes
- We are going to create a fargate profile using `eksctl` on our existing EKS Cluster eksdemo1
- We are going to deploy a simple workload
  - **Deployment:** Nginx App 1
  - **NodePort Service:** Nginx App1
  - **Ingress Service:** Application Load Balancer
- Ingress manifest going to have a additional annotation related to `target-type: ip` as these are going to be fargate workloads we are not going to have `Dedicated EC2 Worker Node - Node Ports`

## Step-02: Pre-requisites

### Pre-requisite Note about eksctl CLI

- eksctl will have continuous releases with new feature additions to it. Its always good to be on latest version of eksctl.
- You can upgrade to latest version using below command on Mac
- Currently highly evolving space (continuous features and new releases) from Kubernetes in AWS is eksctl and Fargate.
- **eksctl Releases URL:** https://github.com/weaveworks/eksctl/releases

```
# Check version
eksctl version

```

### Pre-requisite check about ALB Ingress Controller & external-dns

- We need to have the below two listed components to be already running on our NodeGroup before deploying our application on fargate.
  - ALB Ingress Controller
  - External DNS
- For our application, in addition to just deploying it we are going to access it via DNS registed url `fpdev.awseksstudy.com`

```
# Get Current Worker Nodes in Kubernetes cluster
kubectl get nodes -o wide

# Verify Ingress Controller Pod running
kubectl get pods -n kube-system

# Verify external-dns Pod running
kubectl get pods
```

## Step-03: Create Fargate Profile on cluster eksdemo1

### Create Fargate Profile

```
# Get list of Fargate Profiles in a cluster
eksctl get fargateprofile --cluster eksdemo1

# Template
eksctl create fargateprofile --cluster <cluster_name> \
                             --name <fargate_profile_name> \
                             --namespace <kubernetes_namespace>

# Replace values
eksctl create fargateprofile --cluster eksdemo1 \
                             --name fp-demo \
                             --namespace fp-dev

If applications are deployed in this namespace fb-dev, then  then the application pods will be scheduled under this fargate profile
```

### Output

```log
[ℹ]  Fargate pod execution role is missing, fixing cluster stack to add Fargate resources
[ℹ]  checking cluster stack for missing resources
[ℹ]  cluster stack is missing resources for Fargate
[ℹ]  adding missing resources to cluster stack
[ℹ]  re-building cluster stack "eksctl-eksdemo1-cluster"
[ℹ]  updating stack to add new resources [FargatePodExecutionRole] and outputs [FargatePodExecutionRoleARN]
[ℹ]  creating Fargate profile "fp-demo" on EKS cluster "eksdemo1"
[ℹ]  created Fargate profile "fp-demo" on EKS cluster "eksdemo1"
```

## Step-04: Review NGINX App1 & Ingress Manifests

- We are going to deploy a simple NGINX App1 with Ingress Load Balancer
- We cannot use Worker Node Node Ports for Fargate Pods for two reasons
  - Fargate Pods are created in Private Subnets, so no access to internet to access
  - Fargate Pods are created on random worker nodes whose information is unknown to us to use NodePort Service
  - But in our case, we are in mixed environment with Node Groups and Fargate, if we create a NodePort service, it will create the service with Node Group EC2 Worker Nodes Ports and it will work but when we delete those Node Groups, we will have an issue.
  - Always recommended to use `alb.ingress.kubernetes.io/target-type: ip` in ingress manifest for Fargate workloads

### Create Namespace Manifest

- This namespace manifest should match the one with we have created the Fargate Profile namespace value `fp-dev`

```yml
apiVersion: v1
kind: Namespace
metadata:
  name: fp-dev
```

### Update All other manifests with namespace tag in metadata section

```yml
namespace: fp-dev
```

### Update All Deployment Manifests with Resources in Pod Template

- In Fargate, it is super highly recommended to provide the `resources.requests, resources.limits` about `cpu and memory`. Almost you can make it mandatory.
- This will help Fargate to schedule a Fargate Host accordingly.
- As fargate follows `1:1` ratio `Host:Pod`, one pod per host concept, we defining `resources` section in pod template (Deployment pod template spec) should be our mandatory option.
- Even if we forget to define `resources` in our Deployment Pod Template, low memory using pods like NGINX will come up, high memory using Apps like Spring Boot REST APIs will keep restarting continuously due to unavailable resources.

```yml
resources:
  requests:
    memory: "128Mi"
    cpu: "500m"
  limits:
    memory: "500Mi"
    cpu: "1000m"
```

### Update Ingress Manifest

- As we are running our pods on Fargate Serverless, we need to change our target-type to IP as there is no dedicated EC2 worker nodes concept in Fargate.
- **Important Note:** When we are using same ingress in mixed mode deployments `Node Groups & Fargate` we can use this annotation at service level.

```yml
# For Fargate
alb.ingress.kubernetes.io/target-type: ip
```

- Also update the DNS Names

```yml
# External DNS - For creating a Record Set in Route53
external-dns.alpha.kubernetes.io/hostname: fpdev.kubeoncloud.com
```

## Step-05: Deploy Workload to Fargate

```
# Deploy
kubectl apply -f kube-manifests/

# List Namespaces
kubectl get ns

# List Pods from fpdev namespace
kubectl get pods -n fp-dev -o wide

# List Worker Nodes
kubectl get nodes -o wide

# List Ingress
kubectl get ingress -n fp-dev
```

## Step-06: Access Application & Test

```
# Access Application
http://fpdev.kubeoncloud.com/app1/index.html
```

## Step-07: Delete Fargate Profile

```
# Get list of Fargate Profiles in a cluster
eksctl get fargateprofile --cluster eksdemo1

# Delete Fargate Profile
eksctl delete fargateprofile --cluster <cluster-name> --name <Fargate-Profile-Name> --wait
eksctl delete fargateprofile --cluster eksdemo1 --name fp-demo --wait
```

## Step-08: Verify NGINX App1 got scheduled on Managed Node Group

- After fargate profile deletions, apps running on fargate will be scheduled on Node Groups if they exists if not will go to pending state

```
# List Pods from fpdev namespace
kubectl get pods -n fp-dev -o wide
```

## Step-09: Clean-up

```
# Delete
kubectl delete -f kube-manifests/
```

## References

- https://eksctl.io/usage/fargate-support/
- https://docs.aws.amazon.com/eks/latest/userguide/fargate.html
- https://github.com/kubernetes-sigs/aws-load-balancer-controller/blob/main/docs/guide/ingress/annotations.md#target-type
- https://github.com/kubernetes-sigs/aws-load-balancer-controller/blob/main/docs/guide/ingress/annotations.md#traffic-routing

repository: mhnvelu/aws-eks

repo_name: mhnvelu/aws-eks


text:
# Separate to Adapt: Open Set Domain Adaptation via Progressive Separation
 (CVPR 2019)
Code release for Separate to Adapt: Open Set Domain Adaptation via Progressive Separation (CVPR 2019)

## Dataset
### Office-31

## Requirements

- python 2.7
- PyTorch 0.4
- Tensorflow >= 1.0
- Tensorlayer >= 1.11
- Tensorboard
- torchvision

## Training

- Download datasets
- Step 1: `python step_1.py`, the known\unknown discriminator is saved as `discriminator_a.pkl`
- Step 2: `python step_2.py`
- Optional: iterate between step 1&2 to achieve better results
- Monitor
  `tensorboard --logdir .`

## Citation
please cite:
```
@InProceedings{Liu_2019_CVPR,
author = {Liu, Hong and Cao, Zhangjie and Long, Mingsheng and Wang, Jianmin and Yang, Qiang},
title = {Separate to Adapt: Open Set Domain Adaptation via Progressive Separation},
booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2019}
}
```

## Reference codes
**https://github.com/thuml/easydl**

## Contact
-<EMAIL_ADDRESS>-<EMAIL_ADDRESS>

license: MIT

branch_name: refs/heads/master

extension: md

gha_license_id: MIT

license_type: permissive


text:
Developer: Ryna
Contributors: Jason Few, Dez Teague

# Implement a Queue using two Stacks.
Implement a queue using two stacks

## Challenge
Create a brand new PseudoQueue class. Do not use an existing Queue. Instead, this PseudoQueue class will implement the standard queue interface, but will internally only utilize 2 Stack objects. Ensure that you create your class with the following methods:
enqueue(value) which inserts value into the PseudoQueue, using a first-in, first-out approach.
dequeue() which extracts a value from the PseudoQueue, using a first-in, first-out approach.

## Approach & Efficiency
BigO
Time O(1)
Space O(1)

## Solution
![Whiteboard](https://github.com/rynnnaa/data-structures-and-algorithms/blob/master/assets/queue_with_stacks.jpg)

repository: rynnnaa/data-structures-and-algorithms

gha_language: JavaScript

repo_name: rynnnaa/data-structures-and-algorithms


text:
# The dataProcessor schema Schema

```txt
#/properties/dataProcessor#/properties/dataProcessor
```

A Data Processor, in relation to any Data Subject data, specifically personal data, means any person/entity (other than an employee of the data controller) who processes the data on behalf of the data controller.

| Abstract            | Extensible | Status         | Identifiable            | Custom Properties | Additional Properties | Access Restrictions | Defined In                                                                                |
| :------------------ | ---------- | -------------- | ----------------------- | :---------------- | --------------------- | ------------------- | -------------------------------------------------------------------------------------------------- |
| Can be instantiated | No         | Unknown status | Unknown identifiability | Forbidden         | Allowed               | none                | [dataset.schema.json\*](../../../schema/dataset/latest/dataset.schema.json "open original schema") |

## dataProcessor Type

merged type ([The dataProcessor schema](dataset-properties-the-dataprocessor-schema.md))

any of

-   [Untitled string in HDR UK Dataset](dataset-properties-the-dataprocessor-schema-anyof-0.md "check type definition")
-   [Untitled string in HDR UK Dataset](dataset-properties-the-dataprocessor-schema-anyof-1.md "check type definition")

repository: HDRUK/schemata

gha_language: HTML

repo_name: HDRUK/schemata


text:
**script-template**
PowerCLI workflow script for building VMware vSphere ESXi images

### LICENSE
This script is released under the MIT license. See the License file for more details

| | |
|---|---|
| Version | 0.0.1|
| branch | master|

### CHANGE LOG
|build|branch |  Change |
|---|---|---|
|0.0| Master| Initial release|

### How do I get set up?

#### Dependencies

	- PowerShell 3.0
	- PowerCLI > 6.5.x

repository: brtlvrs/PowerCLI-scriplets

repo_name: brtlvrs/PowerCLI-scriplets


text:
## Synopsis

A PHP wrapper for accessing the Jefferson County Department of Health API (Alabama) for collecting scores and reports on all of the communal living, food, hotels, pools, and tanning salons in the county.

[See a demo here](https://www.jcdh.jrquick.com)

* Visit [my website](https://jrquick.com) for me cool stuff!

## Code Examples

##### Create Instance of API Wrapper
```php
$api = new JcdhApi(JcdhOutput::JSON);
```

##### Get food scores
```php
$results = $api->getScores(JcdhTypes:FOOD);
```

```php
$results = $api->getFoodScores(JcdhTypes:FOOD);
```

##### Get food scores starting with A, B, or C
```php
$results = $api->getFoodScores('ABC');
```

##### Get multiple types of scores
```php
$results = $api->getScores("${JcdhTypes:COMMUNAL_LIVING},${JcdhTypes:FOOD},${JcdhTypes:POOL}");
```

## Output Examples

##### Communal Living Output
```json
[
  {
    "score":     "88",
    "date":      "04/11/1990",
    "name":      "Artificial Homes",
    "address":   "1300 Mardis Drive BIRMINGHAM 35235",
    "location": {
      "lat": 22.1414424,
      "lng": -44.4124124
    },
    "deductions": [
      // See deduction output example
    ]
  }
]
```

##### Food Output
```json
[
  {
    "permit_no":  "615",
    "score":      "96",
    "name":       "Fake Cinemas",
    "date":       "04/11/1990",
    "address":    "1303 Decatur HWY GARDENDALE 35071",
    "smoke_free": true,
    "location": {
      "lat": 33.6579989,
      "lng": -86.8112498
    },
    "deductions": [
      // See deduction output example
    ]
  }
]
```

##### Hotel Output
```json
[
  {
    "score":                "53",
    "name":                 "Not Real, But Really Crummy Inne",
    "date":                 "04/11/1990",
    "address":              "12 19th St S BIRMINGHAM 35205",
    "establishment_number": "5245235",
    "number_of_units":      "13",
    "location": {
      "lat": -33.424242,
      "lng": 53.525525
    },
    "deductions": [
      // See deduction output example
    ]
  }
]
```

##### Pool Output
```json
[
  {
    "score":     "88",
    "date":      "04/11/1990",
    "name":      "Pretend Pool Party",
    "address":   "1212 Taco Bell DR CLAY 35235",
    "type":      "public",
    "location": {
      "lat": 24.435252,
      "lng": 55.352552
    },
    "deductions": [
      // See deduction output example
    ]
  }
]
```

##### Pool Output
```json
[
  {
    "score":     "88",
    "date":      "04/11/1990",
    "name":      "Fake Orange Tanners",
    "address":   "1600 Pennsylvania AVE CLAY 35235",
    "permit_no": "232",
    "location": {
      "lat": -55.435252,
      "lng": 55.352552
    },
    "deductions": [
      // See deduction output example
    ]
  }
]
```

###### Deduction/Reports Output
```json
{
    "value":              "4",
    "compliance_number":  "2-102.11(B)",
    "compliance_details": "Keep food-contact surfaces of cooking equipment (grills, fryers, etc.) and pans free of encrusted grease deposits and other soil accumulations.",
    "notes":              "Popcorn lid inside popcorn popper has heavy grease residue."
  }
```

## Motivation

I made this project out of personal curiosity, feel free to contribute or send me ideas/improvements (though I cannot promise I will get to it ~~very quickly~~ ever).

## Installation

// TODO

## API Reference

// TODO

## Tests

I know, I know. I will get to it _eventually_.

## Contributors

I currently maintain this project alone, you can find more of my projects and contact me on [my website](https://www.jrquick.com). If you would like to be a contributor then please do!

## License

MIT License

>Copyright (c) 2018 Jeremy Quick

>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.

>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 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.

## Upcoming

Send me ideas!


text:
[[source]](https://github.com/polyaxon/polyaxon/blob/master/polyaxon/processing/data_providers.py#L15)
### Dataset

```python
polyaxon.processing.data_providers.Dataset(data_sources, reader, decoder, num_samples=None, items_to_descriptions=None, meta_data=None)
```

Represents a Dataset specification.
----

[[source]](https://github.com/polyaxon/polyaxon/blob/master/polyaxon/processing/data_providers.py#L43)
### DataProvider

```python
polyaxon.processing.data_providers.DataProvider(items_to_tensors, num_samples)
```

Maps a list of requested data items to tensors from a data source.
(A mirror to tf.slim.data DataProvider)

All data providers must inherit from DataProvider and implement the Get
method which returns arbitrary types of data. No assumption is made about the
source of the data nor the mechanism for providing it.

----

[[source]](https://github.com/polyaxon/polyaxon/blob/master/polyaxon/processing/data_providers.py#L118)
### DatasetDataProvider

```python
polyaxon.processing.data_providers.DatasetDataProvider(dataset, num_readers=1, reader_kwargs=None, shuffle=True, num_epochs=None, common_queue_capacity=256, common_queue_min=128, record_key='__record_key__', seed=None, scope=None)
```

----

[[source]](https://github.com/polyaxon/polyaxon/blob/master/polyaxon/processing/data_providers.py#L164)
### ParallelDatasetProvider

```python
polyaxon.processing.data_providers.ParallelDatasetProvider(dataset_source, dataset_target, shuffle=True, num_epochs=None, common_queue_capacity=4096, common_queue_min=1024, seed=None)
```

Creates a ParallelDatasetProvider. This data provider reads two datasets
in parallel, keeping them aligned.

- __Args__:
	- __dataset_source__: The first dataset. An instance of the Dataset class.
	- __dataset_target__: The second dataset. An instance of the Dataset class.
	Can be None. If None, only `dataset1` is read.
	- __shuffle__: Whether to shuffle the data sources and common queue when
	  reading.
	- __num_epochs__: The number of times each data source is read. If left as None,
	  the data will be cycled through indefinitely.
	- __common_queue_capacity__: The capacity of the common queue.
	- __common_queue_min__: The minimum number of elements in the common queue after a dequeue.
	- __seed__: The seed to use if shuffling.

repository: rjhere/polyaxon

repo_name: rjhere/polyaxon


text:
# Timmy

**Time execution of commands and their stages based on console output.**

Measure how much time an arbitrary command spends on each stage of execution by annotating the command output with timestamps as well as running command-specific targeted timers. Profile slowest stages. Save and replay each session (for benchmarking purposes).

Tool is named after an unfortunate character from the *Giants: Citizen Kabuto* game who happened to be in the wrong place at the wrong time (learn more: [EN](https://www.youtube.com/watch?v=4Sh_VuxYqBY) / [PL](https://www.youtube.com/watch?v=hoVxsSvEpOo)).

## Installation

Install the gem as a global executable:

    gem install timmy

## Usage

### Basic example

Pipe output from command, e.g. from `docker build`:

```sh
docker build . | timmy
```

Pass command as argument (records STDERR, gives more precise results):

```sh
timmy docker build .
```

Each line of the command output will be prefixed by total time elapsed since it has started. You can set the precision used when printing that time:

```sh
docker build . | timmy --precision 1
```

Entire output from command, including time annotations, will be written to a log file in `/tmp` so that the session can be replayed.

### Replay session

You can replay previous session via:

```sh
cat /tmp/timmy-1572347993+235.log | timmy
```

Currently passed options and targeted timers will be applied to the output just like the command would've been executed with them in the first place.

By default the session will be replayed as fast as possible, but it's possible to simulate the actual time flow via:

```sh
cat /tmp/timmy-1572347993+235.log | timmy --replay-speed 1    # original speed
cat /tmp/timmy-1572347993+235.log | timmy --replay-speed 0.5  # 2x slower
cat /tmp/timmy-1572347993+235.log | timmy --replay-speed 10   # 10x faster
```

### Targeted timers

You can run command-specific timers in order to measure specific stages of command execution by matching the output against regular expressions that detect the moment when stage begins and (optionally) when it ends.

For example, there's a built-in support provided for `docker build` which means that:

- timer starts when Docker outputs `Step 16/22 : RUN bundle`
- timer stops and stage time gets logged when Docker outputs ` ---> 8912f93fa8a5`

You can add your own targeted timers via the configuration file.

### Profile

You can present a list of slowest targeted timers after the command ends via:

```sh
docker build . | timmy --profile
cat /tmp/timmy-1572347993+235.log | timmy --profile
```

### Options

Learn more about the tool usage and command line options available:

```sh
timmy --help
```

Note that command line options will ovverride relevant calls in a configuration file.

## Configuration

You can add your own timers or adjust logging behavior by creating `~/.timmy.rb`.

Here's a complete example of such file:

```ruby
Timmy.configure do |config|
  config.set_quiet(true)           # Don't print the times (default: false)
  config.set_profile(true)          # Profile slowest targeted timers (default: false)
  config.set_logger_output_dir("~") # Save logs to different directory (default: "/tmp")
  config.set_precision(1)           # Set precision used when printing time (default: 0)
  config.set_replay_speed(1.0)      # Replay with given speed (default: instant)

  # Define custom timer with no label and no stop_regex
  config.add_timer(:simple, start_regex: /^--- /)

  # Define custom timer that groups timers by service names from `docker-compose logs`
  config.add_timer(:grouped,
    start_regex: /((?<group>[\w\-]+) +\| )?Begin (?<label>.*)$/,
    stop_regex: /((?<group>[\w\-]+) +\| )?End$/)

  # Delete the default "docker_build" timer
  config.delete_timer(:docker_build)
end
```

repository: karolsluszniak/timmy

repo_name: karolsluszniak/timmy


text:
### Author: Dhruv Relwani
### Date: 10/07/2021
### A1: Data Curation
### Goal:
We want to analyse the network traffic on English Wikipedia from December 2007 to August 2021.
### License:
The data for this project is obtained from [Wikimedia Foundation REST API](https://www.mediawiki.org/wiki/Wikimedia_REST_API#Terms_and_conditions).
This repository is licensed under the MIT license. The MIT License is a permissive free software license originating at the Massachusetts Institute of Technology (MIT).
### Data:
This data was collected through 2 different APIs provided by the Wikimedia foundation (the legacy PageCounts API and PageViews API). This change between the APIs occured around May 2015 when the new Pageviews API eliminated traffic data from webcrawlers and only included organic user traffic data. We can see that in our timeseries representation of traffic with the dashed and normal graph lines. All values in the fields were primarily numerical (representing network traffic) and datetime.

branch_name: refs/heads/main


text:
# Changelog

All notable changes to `laravel-subby` will be documented in this file.

## 3.0.2

## Fix

- Update docs broken link
- Remove art from repo, use external url

## 3.0.1

### Fix

- Removed whitespace at the end of migration filename

## 3.0.0

### Breaking Changes

- Rename `User` to `Subscriber` for a more generic use. Was not thought that a subscriber could be a customer, team,
  account... etc
- `ofUser()` method in `PlanSubscription` now is `ofSubscriber()`

Changed method names to avoid confusion with possible scopes.

```php
$user->subscribedTo($planId);
$user->subscription('main')->active();
$user->subscription('main')->canceled();
$user->subscription('main')->ended();
$user->subscription('main')->onTrial();
```

Now are:

```php
$user->isSubscribedTo($planId);
$user->subscription('main')->isActive();
$user->subscription('main')->isCanceled();
$user->subscription('main')->hasEnded();
$user->subscription('main')->isOnTrial();
```

### Changes

- Default value in *plans* table for `invoice_period` is now 1.
- Removed softDeletes

repository: Kollynce/laravel-subby

repo_name: Kollynce/laravel-subby


text:
# Laptop configuration with ansible

## Installation

- Install git
```sh
sudo apt install git
```
- Clone this repository
```sh
git clone https://github.com/ptavares/ansible-laptop-conf.git
```
- Run install script
```sh
cd ansible-laptop-conf/
./install.sh
```

repository: ptavares/ansible-laptop-conf

repo_name: ptavares/ansible-laptop-conf


text:
# Vim

## Memorize

- xX -> delete one char
- oO -> new line
- jJ -> Join
- a -> append end of the line
- u -> undo
- d -> delete (dd, dw)
- G -> go line nr(10G, 1G = 1st line, G = end)
- y -> yank/copy (yy, yw, 3yy= copy 3lines)
- pP-> paste
- /X-> search X
- \$ -> end of line
- ^ -> start of line
- . -> repeat

## Open side by side

```bash
vim -O file1.c file2.c
```

- Ctrl+W + →← to Switch between views

## Commands

| Command                                   | Desc                                        |
| ----------------------------------------- | ------------------------------------------- |
| Esc/ Ctrl+C                               | Switch Modes                                |
| i                                         | InsertMode                                  |
| A                                         | Append at end of line                       |
| o                                         | i + NewLine Below Cursor                    |
| u                                         | Undo                                        |
| dd                                        | delete line                                 |
| shift+o                                   | i + NewLine Above Cursor                    |
| :w filename                               | Save File                                   |
| :sav                                      | Save As                                     |
| :q!                                       | force exit                                  |
| :e                                        | Open                                        |
| :sp                                       | Split Open                                  |
| :tabe                                     | Open in new Tab                             |
| :browse e                                 | Open with FileExplorer                      |
| :sh                                       | fg, Like Ctrl+Z                             |
| :!(any bash cmd)                          | To execute Bash Cmd in Vim                  |
| :syntax on                                | Syntax Highlighter                          |
| :set syntax=perl                          | Set Syntax Lang                             |
| :set number                               | Enable Line Number                          |
| :set tabstop=4 shiftwidth=4 softtabstop=4 | Set default TAB width                       |
| 10w                                       | skip forward 10 words                       |
| 10dd                                      | delete 10 lines                             |
| _ # g_ g#                                 | find word under cursor (forwards/backwards) |
| %                                         | match brackets {}[]\(\)                     |
| :set ignorecase                           | Search ignorecase                           |
| /wordRegex                                | Search word from top to bottom              |

repository: yazdipour/notes

repo_name: yazdipour/notes


text:
# About this project {#about}

The *C* standard library, differently from those of more modern programming languages like *Java*, *C++*, *Python* and *Go*,
does not provides data structures or more complex algorithms. Instead, this task is assigned to the community.

The purpose of *YADSL* is to provide data structures and algorithms that are:

* *readable* even for begginers to *C*;
* *reusable* for new and more complex constructions;
* *robust* for large applications.

repository: guidanoli/yadsl

repo_name: guidanoli/yadsl


text:
# JSON Stream Stringify

[![NPM version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Build Status][travis-image]][travis-url]
[![Coverage Status][coveralls-image]][coveralls-url]
[![License][license-image]](LICENSE)
[![Donate][donate-image]][donate-url]

JSON Stringify as a Readable Stream with rescursive resolving of any readable streams and Promises.

## Important and Breaking Changes in v3.1.0

- Completely rewritten from scratch - again
- Buffer argument added (Stream will not output data untill buffer size is reached - improves speed)
- Dropped support for node <7.10.1 - async supporting environment now required

## Main Features

- Promises are rescursively resolved and the result is piped through JsonStreamStringify
- Streams (Object mode) are recursively read and output as arrays
- Streams (Non-Object mode) are output as a single string
- Output is streamed optimally with as small chunks as possible
- Cycling of cyclical structures and dags using [Douglas Crockfords cycle algorithm](https://github.com/douglascrockford/JSON-js)*
- Great memory management with reference release after processing and WeakMap/Set reference handling
- Optimal stream pressure handling
- Tested and runs on ES5**, ES2015**, ES2016 and later
- Bundled as UMD and Module

\* Off by default since v2
\** With [polyfills](#usage)

## Install

```bash
npm install --save json-stream-stringify

# Optional if you need polyfills
# Make sure to include these if you target NodeJS <=v6 or browsers
npm install --save @babel/polyfill @babel/runtime
```

## Usage

Using Node v8 or later with ESM / Webpack / Browserify / Rollup

### No Polyfills, TS / ESM

```javascript
import { JsonStreamStringify } from 'json-stream-stringify';
```

### Polyfilled, TS / ESM

install @babel/runtime-corejs3 and corejs@3

```javascript
import { JsonStreamStringify }  from 'json-stream-stringify/polyfill';
import { JsonStreamStringify }  from 'json-stream-stringify/module.polyfill'; // force ESM
```

### Using Node >=8 / Other ES2015 UMD/CommonJS environments

```javascript
const { JsonStreamStringify } = require('json-stream-stringify'); // let module resolution decide UMD or CJS
const { JsonStreamStringify } = require('json-stream-stringify/umd'); // force UMD
const { JsonStreamStringify } = require('json-stream-stringify/cjs'); // force CJS
```

### Using Node <=6 / Other ES5 UMD/CommonJS environments

```javascript
const { JsonStreamStringify } = require('json-stream-stringify/polyfill');
const { JsonStreamStringify } = require('json-stream-stringify/umd/polyfill');
const { JsonStreamStringify } = require('json-stream-stringify/cjs/polyfill');
```

**Note:** This library is primarily written for LTS versions of NodeJS. Other environments are not tested.
**Note on non-NodeJS usage:** This module depends on node streams library. Any Streams3 compatible implementation should work - as long as it exports a `Readable` class, with instances that looks like readable streams.
**Note on Polyfills:** I have taken measures to minify global pollution of polyfills but this library **does not load polyfills by default** because the polyfills modify native object prototypes and it goes against the [W3C recommendations](https://www.w3.org/2001/tag/doc/polyfills/#advice-for-library-and-framework-authors).

## API

### `new JsonStreamStringify(value[, replacer[, spaces[, cycle[, bufferSize=512]]]])`

Streaming conversion of ``value`` to JSON string.

#### Parameters

- ``value`` ``Any``
  Data to convert to JSON.

- ``replacer`` Optional ``Function(key, value)`` or ``Array``
  As a function the returned value replaces the value associated with the key. [Details](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter)
 As an array all other keys are filtered. [Details](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Example_with_an_array)

- ``spaces`` Optional ``String`` or ``Number``
  A String or Number object that's used to insert white space into the output JSON string for readability purposes. If this is a Number, it indicates the number of space characters to use as white space. If this is a String, the string is used as white space. If this parameter is not recognized as a finite number or valid string, no white space is used.

- ``cycle`` Optional ``Boolean``
  ``true`` enables cycling of cyclical structures and dags.
  To restore cyclical structures; use [Crockfords Retrocycle method](https://github.com/douglascrockford/JSON-js) on the parsed object (not included in this module).

#### Returns

- ``JsonStreamStringify`` object that exposes a [Streams3 interface](https://nodejs.org/api/stream.html#stream_class_stream_readable).

### jsonStreamStringify#path

Get current path begin serialized.

#### Returns

- ``Array[String, Number]``
  Array of path Strings (keys of objects) and Numbers (index into arrays).
  Can be transformed into an mpath with ``.join('.')``.
  Useful in conjunction with ``.on('error', ...)``, for figuring out what path may have caused the error.

## Complete Example

```javascript
const { JsonStreamStringify } = require('json-stream-stringify');

const jsonStream = new JsonStreamStringify({
    // Promises and Streams may resolve more promises and/or streams which will be consumed and processed into json output
    aPromise: Promise.resolve(Promise.resolve("text")),
    aStream: ReadableObjectStream({a:1}, 'str'),
    arr: [1, 2, Promise.resolve(3), Promise.resolve([4, 5]), ReadableStream('a', 'b', 'c')],
    date: new Date(2016, 0, 2)
});
jsonStream.once('error', () => console.log('Error at path', jsonStream.stack.join('.')));
jsonStream.pipe(process.stdout);
```

Output (each line represents a write from jsonStreamStringify)

```text
{
"aPromise":
"text"
"aStream":
[
{
"a":
1
}
,
"str"
]
"arr":
[
1
,
2
,
3
,
[
4
,
5
]
,
"
a
b
c
"
],
"date":
"2016-01-01T23:00:00.000Z"
}
```

## Practical Example with Express + Mongoose

```javascript
app.get('/api/users', (req, res, next) => {
  res.type('json'); // Required for proper handling by test frameworks and some clients
  new JsonStreamStringify(Users.find().stream()).pipe(res);
});
```

### Why do I not get proper typings? (Missing .on(...), etc.)

install ``@types/readable-stream`` or ``@types/node`` or create your own ``stream.d.ts`` that exports a ``Readable`` class.

## License

[MIT](LICENSE)

Copyright (c) 2016 Faleij [faleij<EMAIL_ADDRESS>
[npm-image]: http://img.shields.io/npm/v/json-stream-stringify.svg
[npm-url]: https://npmjs.org/package/json-stream-stringify
[downloads-image]: https://img.shields.io/npm/dm/json-stream-stringify.svg
[downloads-url]: https://npmjs.org/package/json-stream-stringify
[travis-image]: https://travis-ci.org/Faleij/json-stream-stringify.svg?branch=master
[travis-url]: https://travis-ci.org/Faleij/json-stream-stringify
[coveralls-image]: https://coveralls.io/repos/Faleij/json-stream-stringify/badge.svg?branch=master&service=github
[coveralls-url]: https://coveralls.io/github/Faleij/json-stream-stringify?branch=master
[license-image]: https://img.shields.io/badge/license-MIT-blue.svg
[donate-image]: https://img.shields.io/badge/Donate-PayPal-green.svg
[donate-url]: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=faleij%40gmail%2ecom&lc=GB&item_name=faleij&item_number=jsonStreamStringify&currency_code=SEK&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted

repository: Faleij/json-stream-stringify

gha_language: TypeScript

repo_name: Faleij/json-stream-stringify


text:
![](docs/vertigo.png)

Vertigo allows you to treat raw bytes like a normal Clojure data structure.  This allows for faster reads and reduced memory footprint, and can also make interop with C libraries significantly simpler and more efficient.  With certain safety checks turned off, this yields performance a bit faster than Java arrays on a much wider variety of datatypes.

Full documentation can be found [here](http://ideolalia.com/vertigo).

### usage

[![Build Status](https://travis-ci.org/ztellman/vertigo.png?branch=master)](https://travis-ci.org/ztellman/vertigo)

```clj
[vertigo "0.1.3"]
```

### defining a type

To define a typed structure, we use `vertigo.structs/def-typed-struct`:

```clj
(use 'vertigo.structs)

(def-typed-struct vec3
  :x float64
  :y int32
  :z uint8)
```

Each field is defined as a pair: a name and a type.  The resulting typed-struct can itself by used as a type:

```clj
(def-typed-struct two-vecs
  :a vec3
  :b vec3)
```

In the `vertigo.structs` namespace, there are a number of predefined primitive types, including `int8`, `int16`, `int32`, `int64`, `float32`, and `float64`.  Any integer type can be made unsigned by adding a `u` prefix, and all primitive types can have an `-le` or `-be` suffix for explicit endianness.  Without a suffix, the endianness will default to that of the underlying buffer.

We can also define a fixed-length n-dimensional array of any type using `(array type & dims)`:

```clj
(def-typed-struct ints-and-floats
  :ints (array uint32 10)
  :floats (array float32 10))
```

### creating a sequence

To create a sequence, we can either **marshal** an existing sequence onto a byte-buffer, or **wrap** an existing byte source.  To marshal a sequence, we can either use `vertigo.core/marshal-seq` or `vertigo.core/lazily-marshal-seq`:

```clj
> (require '[vertigo.core :as v])
nil
> (def s (range 5))
#'s
> (v/marshal-seq uint8 s)
(0 1 2 3 4)
```

While the marshaled seq is outwardly identical, under the covers it is just a thin object wrapping a 5 byte buffer.  In this case we could get an identical effect with an array, but this extends to types of any size or complexity:

```clj
> (def x {:ints (range 10), :floats (map float (range 10))})
#'x
> (v/marshal-seq ints-and-floats [x])
({:ints (0 1 2 3 4 5 6 7 8 9), :floats (0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0)})
```

Using `marshal-seq` will realize and copy over the entire sequence at once.  For large or unbounded sequences, `lazily-marshal-seq` is preferred.  While the performance characteristics of the two methods may differ, the resulting seq is otherwise the same.

To create a sequence that wraps an already encoded source of bytes, you may use `vertigo.core/wrap`.  Vertigo seqs created via `wrap` or `marshal-seq` can be turned back into bytes using `byte-streams/to-*` from the [byte-streams](https://github.com/ztellman/byte-streams) library.

### interacting with a sequence

While we can use `first`, `rest`, `nth`, `get-in` and all the other normal Clojure functions on these sequences, we can also do something other data structures can't.  Consider the above example of a map containing sequences of ints and floats.  To get the fifth element under the `:floats` key, we call `(get-in s [:floats 4])`.  This will first get the sequence under the `:floats` key, and then look for the fifth element within the sequence.

However, in our data structure we're guaranteed to have a fixed layout, so _we know exactly where the data is already_.  We don't need to fetch all the intermediate data structures, we simply need to calculate the location and do a single read.  To do this, we use `vertigo.core/get-in`:

```clj
> (def ^:int-and-floats s (v/marshal-seq ints-and-floats [x]))
#'s
> (v/get-in s [0 :floats 4])
4.0
```

Notice that we have hinted the sequence with the keyword `:ints-and-floats`.  To work with our compile-time `get-in`, all sequences must be hinted with their element type in this way.  In return, we get a read time that even for moderately nested structures can be several orders of magnitude faster.

Since everything's just bytes under the covers, we can also overwrite existing values.  While this isn't always necessary, it's certainly useful when you need it.  To write to the sequence, we may either use `vertigo.core/set-in!` or `vertigo.core/update-in!`:

```clj
> (def ^:int8 s (v/marshal-seq int8 (range 5)))
#'s
> (v/set-in! s [5] 42)
nil
> (v/update-in! s [0] - 42)
nil
> s
(-42 1 2 3 42)
```

### selecting sub-sequences

Calling something like `map` on a Vertigo sequence means that we can no longer use `vertigo.core/get-in`, `update-in!`, or any of the other special operators that only work on Vertigo sequences.  This is mostly unavoidable, but in the specific case where we simply want to pull out a subset of the sequence, we can hold onto these properties using `(over s fields)`:

```clj
> (require '[vertigo.structs :as s])
nil
> (def matrix (s/array s/int64 2))
#'matrix
> (marshal-seq matrix [[0 1] [2 3]])
((0 1) (2 3))
> (def s *1)
#'s

;; if we define both indices as 'free', then we see a flattened iteration over all elements
> (over s [_ _])
(0 1 2 3)

;; if we fix the first index, we only iterate over the first array
> (over s [0 _])
(0 1)

;; if we fix the second index, we only iterate over the first elements of each array
> (over s [_ 0])
(0 2)
```

A free variable is either `_` or anything that begins with `?`, like `?i` or `?a-gratuitously-long-name`.

### iterating over sequences

Since we can directly access the underlying memory, we can do very efficient iteration, but Clojure's normal iteration primitives use too many levels of indirection for us to realize this.

Instead, Vertigo provides `doreduce`, a primitive that is a fusion of Clojure's `doseq` and `loop`:

```clj
> (def ^:s/int64 s (marshal-seq s/int64 (repeat 100 1)))
#'s
> (doreduce [x s] [sum 0]
    (+ sum x))
100
```

Notice that `doreduce` takes two binding forms, one for sequences, and another for accumulators.  Unlike `loop`, the `recur` here is implicit; the value returned for one element is propagated to the next.  If we want to propagate multiple values, we simply return a vector:

```clj
> (doreduce [x s] [sum 0, product 1]
    [(+ sum x) (* product x)])
[100 1]
```

Note that we're not actually allocating a new vector for each element, it's just sugar over a multi-value recursion.

If we explicitly don't want to recur, we can use `break`:

```clj
> (doreduce [x s] [all-even? true]
    (if (odd? x)
      (break false)
      true))
```

We can iterate over multiple sequences in parallel:

```clj
> (doreduce [x s, y s] [sum 0]
    (+ x y sum))
200
```

We can also iterate over subsets of sequences using the `over` syntax:

```clj
> (doreduce [x (over s [?i])] [sum 0]
    (+ x ?i sum))
5050
```

Finally, we can set the `:step` and `:limit` for iteration:

```clj
> (doreduce [x s, :step 2, :limit 10] [sum 0]
    (+ x sum))
5
```

Or, if there are multiple iterators, `:steps` and `:limits`:

```clj
> (doreduce [x (over s [?i]), :steps {?i 2}, :limits {?i 10}] [sum 0]
    (+ x sum))
5
```

Common use cases are exposed as `vertigo.core/sum`, `every?`, and `any?`.

### turning off bounds checks

By default, every index is checked at compile time if possible, and runtime if necessary.  However, if your access patterns are predictable and no runtime exceptions are thrown, you can turn off bounds checking by adding `-Dvertigo.unsafe` as a command-line parameter.  When this is enabled, `(vertigo.core/sum s)` is ~10% faster than the equivalent operation using Clojure's `areduce`, and ~10x faster than `(reduce + array)`.

### when to use vertigo

Any long-lived data which has a fixed layout can benefit from Vertigo, both with respect to performance and memory efficiency.  However, sequences which contain sub-sequences of unpredictable length cannot be represented using Vertigo's structs, and sequences which are discarded after a single iteration won't be worth the trouble of calling `marshal-seq`.

### license

Copyright © 2013 Zachary Tellman

Distributed under the [MIT License](http://opensource.org/licenses/MIT)

repository: luxbock/vertigo

repo_name: luxbock/vertigo


text:
# Kent Panopto recordings downloader

The idea is to take an RSS feed of Panopto recordings from the University of Kent and download them to `~/Movies/Kent-Recordings/%feed name%`

Seems to work, to use it simply clone the repository then run:

```
go run main.go https://whateverthereallylongrssfeedurlis
```

repository: jamesjarvis/panopto-downloader

repo_name: jamesjarvis/panopto-downloader


text:
local-links
===========

Determine cross-browser if an event or anchor element should be handled locally.

[![NPM](https://nodei.co/npm/local-links.png)](https://nodei.co/npm/local-links/)
[![Build Status](https://travis-ci.org/lukekarrys/local-links.png?branch=master)](https://travis-ci.org/lukekarrys/local-links)
[![Greenkeeper badge](https://badges.greenkeeper.io/lukekarrys/local-links.svg)](https://greenkeeper.io/)
[![Sauce Test Status](https://saucelabs.com/browser-matrix/lukekarrys-loclinks.svg)](https://saucelabs.com/u/lukekarrys-loclinks)

## Install

`npm install local-links --save`

## Why?

Browsers have quirks. Knowing if a link is local should be easy, since we
just want to know if the hosts are the same. But this can be difficult because
of the aforementioned browser quirks. A few of them:

- IE9 will add `:80` to the host of an anchor, but not the window
- IE9 wont put a leading slash on the pathname of an anchor, but will on the window
- Chrome 36 will report anchor.hash as '' if it has `href="#"`
- More? Please report test cases!

Because of that and a few other things I was doing all the time, such as
finding the closest anchor to an element based on an event object, I decided
it would be a good module (that at least I would use all the time).

## Usage

```html
<a href='/page2' id="local">Local</a>
<a href='#hash' id="hash">Local</a>
<a href='http://google.com' id="google">Google</a>
```

```js
var local = require('local-links');

// `pathname()` will return the pathname as a string
// if the link is local, otherwise it will return null
local.pathname(document.getElementById('local')) // '/page2'
local.pathname(document.getElementById('hash')) // null
local.pathname(document.getElementById('google')) // null

// `hash()` will return the hash as a string
// if the hash is to this page, otherwise it will return null
local.hash(document.getElementById('local')) // null
local.hash(document.getElementById('hash')) // '#hash'
local.hash(document.getElementById('google')) // null
```

## API

### Methods

#### `getLocalPathname(Event or HTMLElement [, HTMLElement])`

Returns the pathname if it is a non-hash local link, or null if it is not.
Always includes the leading `/`.

*Alias: `pathname`*

#### `getLocalHash(Event or HTMLElement [, HTMLElement])`

Returns the hash if it is an in-page hash link, or null if it is not. Always
includes the leading `#`.

*Alias: `hash`*

#### `isActive(Event or HTMLElement [, String comparePath])`

Returns true/false depending on if the anchor pathname is equal to the `comparePath`
(which defaults to `window.location.pathname`). Calls `pathname()` internally.

*Alias: `active`*

#### `isLocal(event, anchor, [, Boolean lookForHash])`

Returns the pathname (or hash if `lookForHash` is true) for local links, or null
if it is not. This is used by `pathname()` and `hash()` under the hood. The main
difference here is that you need to specify the `event` and `anchor` yourself, and
the `anchor` wont be looked up from `event.target` like it would from the other methods.

#### Supply either Event or HTMLElement

The above methods will accept an `Event` object, like the one you get from
click event handlers, or any `HTMLElement`. You can also supply an `Event` object
and a different `HTMLElement` as the second parameter and it will take precedence.

If only an `Event` object is supplied, the `HTMLElement` will be found from
`Event.target`.

#### Nested HTML Elements

In the case that any `HTMLElement` your provide is not an anchor
element, the module will look up `parentNodes` until an anchor is found.

#### Events

If an `Event` object is supplied, all methods will return `null` if any of the following
are true `altKey`, `ctrlKey`, `metaKey`, `shiftKey`. This is because you almost always
want to treat modified click events as external page clicks.

#### `target="_blank"`

If the anchor has target="_blank" it will return `null` for both the `pathname()` and
`hash()` methods.

#### Hash links

Using the `pathname` method will return null for hash links that do not point
to a different page. To get the hash for one of these links use the `hash()` method.

### Tests

Run `npm start` and open [`http://localhost:3000`](http://localhost:3000) to run the tests in your browser.

It is also a good idea to run `sudo npm run start-80` (requires admin) which will run the tests on [`http://localhost`](http://localhost)
because there can be unexpected behavior when the host has no port in [IE9](https://github.com/lukekarrys/local-links/blob/master/local-links.js#L26) and [IE10](https://github.com/lukekarrys/local-links/blob/master/local-links.js#L28).

To run the tests in the cli, just run `npm test`.

#### License

MIT

repository: lukekarrys/local-links

repo_name: lukekarrys/local-links


text:
# RGBDecomposer
![](images/rgb_decomposer_sample_image.png)

Split the original color image into 3 greyscale image of each color(RGB) strength.

## Subscribing Topic
* `~input` (`sensor_msgs/Image`)

  Divide input camera image into 3 image (R,G,B) according to its color info.

## Publishing Topic
* `~output/red` (`sensor_msgs/Image`)
* `~output/green` (`sensor_msgs/Image`)
* `~output/blue` (`sensor_msgs/Image`)

## Parameters
none

## Samples

```bash
roslaunch jsk_perception sample_rgb_decomposer.launch
```

branch_name: refs/heads/carma-develop


text:
---
layout: default
---

[home](/)  /  [bedrock141](/protocol/bedrock141)  /  [play](/protocol/bedrock141/play)  /  mob-equipment

# Mob equipment

Encode/decode this packet in [Sandbox](../../../sandbox/bedrock141#Play.MobEquipment)

**Id**: 31

**Id** (hex): 1F

**Id** (bin): 00011111

**Clientbound**: ✔

**Serverbound**: ✔

Sent when the client puts an item in its hotbar or selects a new hotbar slot.

## Fields

Name | Type
---|---
entity id | varlong
item | [slot](/protocol/bedrock141/types/slot)
[inventory slot](#inventory-slot) | ubyte
[hotbar slot](#hotbar-slot) | ubyte
? | ubyte

### inventory slot

Slot of the inventory where the item is. The hotbat slots (0-8) are not counted. 255 means that a generic empty slot has been selected.

### hotbar slot

Slot of the hotbar where the item is being moved.


text:
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) > [@apextoaster/js-config](./js-config.md) > [SchemaDef](./js-config.schemadef.md)

## SchemaDef type

<b>Signature:</b>

```typescript
export declare type SchemaDef = Record<string, unknown>;
```

repository: ssube/js-config

repo_name: ssube/js-config


text:
# MJExtensionValidation

[![Build status](https://github.com/ElfSundae/MJExtensionValidation/workflows/Build/badge.svg)](https://github.com/ElfSundae/MJExtensionValidation/actions?query=workflow%3ABuild)
![CocoaPods](https://img.shields.io/cocoapods/v/MJExtensionValidation)
![Platforms](https://img.shields.io/cocoapods/p/MJExtensionValidation)

MJExtensionValidation provides an opportunity of validating converted model objects for [MJExtension] (A fast, convenient and nonintrusive conversion framework between JSON and model).

为 [MJExtension] 的 JSON-to-Model 转换增加校验接口。

## Installation

```ruby
pod 'MJExtensionValidation'
```

## Usage

Implement `+mj_validateConvertedObject:withKeyValues:` method for your model to validate the converted object:

```objc
#import <MJExtensionValidation/MJExtensionValidation.h>

@implementation User

+ (BOOL)mj_validateConvertedObject:(User *)user withKeyValues:(id)keyValues
{
    return user.ID.length > 0;
}

@end
```

Then the JSON-to-model converting methods such as `+mj_objectWithKeyValues:` will return `nil` if the converted object could not pass the validation.

## License

MJExtensionValidation is available under the MIT license. See the [LICENSE](LICENSE) file for more info.

[mjextension]: https://github.com/CoderMJLee/MJExtension

repository: ElfSundae/MJExtensionValidation

repo_name: ElfSundae/MJExtensionValidation


text:
---
title: "Dissecting Bitcoin’s Unrealised On–Chain Profit/Loss"
permalink: "/dissecting-bitcoins-unrealised-on-chain-profit-loss"

author: rafaelschultzekraft

tags:
  - Rafael Schultze-Kraft
  - CY19 Q4
  - Financials
  - On-Chain Analysis
  - On-Chain
  - Market Cycles
  - Metrics

excerpt: Rafael Schultze-Kraft and the Glassnode team released an interesting look at some new Bitcoin indicators. Posted November 13, 2019.

defaults:
  - scope:
      type: posts
---

{% include donation.md %}

***

# [Dissecting Bitcoin’s Unrealised On–Chain Profit/Loss](https://medium.com/glassnode-insights/dissecting-bitcoins-unrealised-on-chain-profit-loss-73e735020c8d)
## Introducing a New Set of Metrics to Help Time Bitcoin Market Cycles
### By [Rafael Schultze-Kraft](https://twitter.com/n3ocortex)
### Posted November 13, 2019

![](/assets/images/cy19/cy19m11/g1.png)

Understanding the state of the Bitcoin blockchain with respect to the price at which BTC is being valued by the market is indispensable for any investor in this new asset.

In fact, Bitcoin _on–chain_ data has been used in conjunction with _off–chain_ market data in order to create metrics and indicators that help investors gain fundamental insights into the current state of the market, understand investor sentiment, or model the value of Bitcoin.

Popular examples are [MVRV](https://medium.com/adaptivecapital/bitcoin-market-value-to-realized-value-mvrv-ratio-3ebc914dbaee) and [SOPR](https://insights.glassnode.com/sopr-announcment/).

These metrics have in common that they make use of Bitcoin’s underlying UTXO structure by comparing the value of Bitcoin at two different points in time: The **current price** and the price at the time a UTXO (bitcoin) was created (last moved), i.e. the **realised price**.

* * *

Here, we make use of the same underlying concept in order to answer a fundamental question:

> **If all bitcoins were sold today, how much would investors stand to gain or lose**?

Or to put it differently: **How much of Bitcoin’s circulating supply is at any given point in time in profit or loss — and to what extent?**

The ability to access this information is important to investors with regard to Bitcoin’s primary narrative: to act as a digital, permissionless, censorship-resistant Store of Value (SoV).

To answer these questions, we take three different approaches and define new sets of metrics — each adding an additional level of detail:

### 1\. The number of current UTXOs that are in profit/loss

_A UTXO is in profit (loss) if the current price is higher (lower) than the price at the time the UTXO was created._

### 2\. The current supply of Bitcoin that is in profit/loss

_A bitcoin is in profit (loss) if the current price is higher (lower) than the price at the time the bitcoin last moved._

### 3\. The unrealised profit/loss of the current Bitcoin supply

_The profit (loss) of a bitcoin is calculated by taking the difference between the current price and the price at the time the bitcoin last moved._

Let’s dig in.

* * *

## Number of UTXOs in Profit/Loss

The number of UTXOs in profit/loss is computed in a straight-forward manner: We simply count all existing UTXOs whose price at creation time was lower or higher than the current price, respectively.

_Figure 1_ below shows the absolute amount of UTXOs in profit/loss at any given point in time.

![](/assets/images/cy19/cy19m11/g2.png)
*Figure 1 — Number of UTXOs in Profit and Loss*

In order to account for the increasing number of UTXOs over time, we normalise these time series by the size of the UTXO set and obtain the relative number of UTXOs in profit/loss, i.e. the percentage.

_Figure 2_ below represents the _50d MA_ of the relative UTXO counts in profit. Note that when this metric approaches 100%, it has historically been a good indicator for global market tops.

![](/assets/images/cy19/cy19m11/g3.png)
*Figure 2 — Relative Number of UTXOs in Profit, 50d Moving Average*

The bull run of 2017, however, shows a distinct behaviour with a sustained period of profitable UTXOs above 95% – a clear indication of the remarkable nature of the bull run that year. Throughout those months, the metric can be used to help identify short-term cycles and as a clear indicator to stay highly alerted throughout the mania of such periods.

Note that the relative number of UTXOs in profit approaches 100% every time a previous ATH price is broken – this is self-evident as it becomes nearly impossible to be in losses once a new ATH is surpassed. Therefore, we applied the simple _50d MA_, which we have found to fit historic data optimally and which creates a signal that serves to indicate global/local Bitcoin cycle tops as shown above.

> Live implementations of UTXOs in Profit/Loss metrics are available in Glassnode Studio:
>
> [**Percent UTXOs in Profit**](https://studio.glassnode.com/metrics?a=BTC&c=native&m=blockchain.UtxoProfitRelative)  [**UTXOs in Profit**](https://studio.glassnode.com/metrics?a=BTC&m=blockchain.UtxoProfitCount)  [**UTXOs in Loss**](https://studio.glassnode.com/metrics?a=BTC&m=blockchain.UtxoLossCount)

* * *

## Circulating Supply in Profit/Loss

A similar but even more informative metric is the number of circulating bitcoins that are in profit or loss. Instead of counting UTXOs, we now consider their bitcoin value (i.e. individual bitcoins) and sum up those whose price at the time they last moved was lower or higher than the current price, respectively.

The stacked graph below shows the supply of bitcoins in profit/loss at any given point in time.

![](/assets/images/cy19/cy19m11/g4.png)
*Figure 3 — Circulating Bitcoin Supply in Profit and Loss*

Similarly, we adjust this data by dividing by the circulating supply and obtain the relative Bitcoin supply (i.e. percentage) that is in profit/loss.

![](/assets/images/cy19/cy19m11/g5.png)
*Figure 4 — Relative Bitcoin Supply in Profit and Loss*

The resulting graph is a metric we have found to be exceptionally useful to help understand Bitcoin market cycles.

Let’s take close look at the **Percent of Supply in Profit**, again applying the _50d MA_.

![](/assets/images/cy19/cy19m11/g6.png)
*Figure 5 — Relative Bitcoin Supply in Profit, 50d Moving Average*

The Percent of Supply in Profit metric represents an oscillator that allows us to better understand the current state of the Bitcoin market:

*   In a similar fashion to the relative UTXO count chart above, using a simple threshold at `95%` helps to identify **market tops**.
*   By looking at periods in which the relative supply in profit falls below `50%`, this indicator is useful to help identify **market bottoms** and convenient entry points.

> Live implementations of Supply in Profit/Loss metrics are available in Glassnode Studio:
>
> [**Percent Supply in Profit**](https://studio.glassnode.com/metrics?a=BTC&m=supply.ProfitPercent)  [**Supply in Profit**](https://studio.glassnode.com/metrics?a=BTC&m=supply.ProfitSum)  [**Supply in Loss**](https://studio.glassnode.com/metrics?a=BTC&m=supply.ProfitLoss)

* * *

## Unrealised Profit/Loss

Finally, we take a step further and look at the **Unrealised Profit/Loss** of Bitcoin.

In comparison to simply summing up the circulating supply that is in profit or loss, Unrealised Profit/Loss takes into account the actual USD value by which a bitcoin is in gains/losses. In other words, we weight each circulating bitcoin by the difference between the current price and its realised price and sum up all bitcoins in profit and loss, respectively.

Mathematically speaking _Unrealised Profit (UP)_ and _Unrealised Loss(UL)_ are defined as

![](/assets/images/cy19/cy19m11/g7.png)

and

![](/assets/images/cy19/cy19m11/g8.png)

respectively.

The following graph shows Bitcoin’s raw Unrealised Profit/Loss.

![](/assets/images/cy19/cy19m11/g9.png)
*Figure 6 — Unrealised Bitcoin Profit and Loss*

While the UP line very much resembles the shape of the Bitcoin price, the amount of unrealised loss (UL) shows a distinctive pattern with clear-cut downward spikes at periods in which the losses are virtually non-existent. These moments naturally correspond to those in which the relative number of bitcoins/UTXOs in profit approaches `100%` (_see Figures 2+5_).

In order to obtain a conclusive and more informative metric, we normalise the data by the market cap, giving us the **Relative Unrealised Profit (RUP)** and the **Relative Unrealised Loss (RUL)**. The resulting signals clearly reveal distinct patterns at different states of the market cycles.

![](/assets/images/cy19/cy19m11/g10.png)
*Figure 7 — Relative Unrealised Profit and Loss*

In particular we see how the RUP spikes (`RUP > 0.75`) indicate potential tops and selling points. Conversely, periods in which the RUL exceeds the RUP (`RUP < RUL`) have been historically indicative of market bottoms and good buying opportunities.

By taking the delta of both curves, we finally calculate the **Net Unrealised Profit/Loss (NUPL)**.

Deconstructing this signal into different bands gives insight into market sentiment derived from on–chain data. The thresholds below are set at `0.0`, `0.25`, `0.5`, and `0.75`. Even though arbitrary, historically they show accurate patterns that can be attributed to distinct sentiments throughout the macro cycles of Bitcoin.

![](/assets/images/cy19/cy19m11/g11.png)
*Figure 8 — Net Unrealised Profit/Loss (NUPL)*

By mapping these bands to the price of Bitcoin we see how the **NUPL** represents different periods of the Bitcoin market cycles. Understanding the current NUPL value can help investors navigate through different stages of the market and identify periods of profit taking as well as efficient entry points.

![](/assets/images/cy19/cy19m11/g12.png)
*Figure 9 — NUPL Bands applied to the Bitcoin Price*

**UPDATE:** Net Unrealised Profit/Loss has been [previously derived by Adamant Capital](https://medium.com/@adamant_capital/a-primer-on-bitcoin-investor-sentiment-and-changes-in-saving-behavior-a5fb70109d32) in a different manner: They calculate it by subtracting realised cap from market cap, and dividing the result by the market cap, i.e.`(Market Cap — Realised Cap) / Market Cap`. This is mathematically in fact equivalent to the derivation introduced here: `Unrealised Profit * Market Cap — Unrealised Loss * Market Cap`.

> Live implementations of Unrealised Profit/Loss metrics are available in Glassnode Studio:
>
> [**Net Unrealised Profit/Loss**](https://studio.glassnode.com/metrics?a=BTC&m=indicators.NetUnrealizedProfitLoss) **(NUPL)** [**Relative Unrealised Profit**](https://studio.glassnode.com/metrics?a=BTC&m=indicators.UnrealizedProfit) **(RUP)** [**Relative Unrealised Loss**](https://studio.glassnode.com/metrics?a=BTC&m=indicators.UnrealizedLoss) **(RUL)**

* * *

## Summary

We explored and presented a set of on–chain metrics that incorporate the relationship between the current price and the realised price of Bitcoin. In particular we defined metrics related to

1) the **Number of UTXOs in Profit/Loss**, 2) the **Bitcoin Supply in Profit/Loss**, and 3) the **Unrealised Profit/Loss**.

These metrics help in understanding the current profit and loss of stakeholders in the Bitcoin network using on–chain data — information that is crucial to evaluate the state of Bitcoin as a Store of Value (SoV).

Moreover, these metrics are indicative of the Bitcoin market cycles and shed light on investor sentiment at different stages, most notably using [Net Unrealised Profit/Loss](https://studio.glassnode.com/metrics?a=BTC&m=indicators.NetUnrealizedProfitLoss).

With the present work, we have equipped Bitcoin investors with a new set of tools providing a better understanding of Bitcoin’s market cycles and its economics. The introduced metrics are can be used to assist investment strategies that go beyond simple HODLing, and help to avoid buying towards the top and selling near the bottom of Bitcoin’s cycles.

* * *

### Metrics Overview

**UTXOs**

> [Percent UTXOs in Profit](https://studio.glassnode.com/metrics?a=BTC&c=native&m=blockchain.UtxoProfitRelative) [UTXOs in Profit](https://studio.glassnode.com/metrics?a=BTC&m=blockchain.UtxoProfitCount) [UTXOs in Loss](https://studio.glassnode.com/metrics?a=BTC&m=blockchain.UtxoLossCount)

**Supply**

> [Percent Supply in Profit](https://studio.glassnode.com/metrics?a=BTC&c=native&m=supply.ProfitRelative) [Supply in Profit](https://studio.glassnode.com/metrics?a=BTC&m=supply.ProfitSum) [Supply in Loss](https://studio.glassnode.com/metrics?a=BTC&m=supply.ProfitLoss)

**Unrealised Profit/Loss**

> [Net Unrealised Profit/Loss](https://studio.glassnode.com/metrics?a=BTC&m=indicators.NetUnrealizedProfitLoss) (NUPL) [Relative Unrealised Profit](https://studio.glassnode.com/metrics?a=BTC&m=indicators.UnrealizedProfit) (RUP) [Relative Unrealised Loss](https://studio.glassnode.com/metrics?a=BTC&m=indicators.UnrealizedLoss) (RUL)

* * *

![](/assets/images/cy19/cy19m11/g13.png)

_All analyses in this article were done using data from_ [Glassnode Studio](https://studio.glassnode.com/)_._ _For API access to this data visit the_ [_Glassnode API page_](https://www.glassnode.com/api)_._

*   Sign up for the [Glassnode Insights](https://cdn.forms-content.sg-form.com/f6bb0156-cafb-11e9-941a-e2e604f90f01?source=post_page-----73e735020c8d----------------------) Newsletter
*   Follow us and reach out on [Twitter](https://twitter.com/glassnode)
*   For on–chain metrics and activity graphs, visit [Glassnode Studio](https://studio.glassnode.com/)
*   For automated updates about on–chain activity on exchanges, visit our [Glassnode Alerts Twitter](https://twitter.com/glassnodealerts)

_Disclaimer: This report does not provide any investment advice. All data is provided for information purposes only. No investment decision shall be based on the information provided here and you are solely responsible for your own investment decisions._

### Glassnode

#### Contextualised and actionable market insights, reports and analyses drawn from on-chain data.

#### Thanks to Rafal Bromirski, Glassnode, and Matthias Bachmann.

***

{% include signup.md %}

gha_language: CSS


text:
## Summary ##

This folder contains the scripts used to generate all of figures in the paper:

* Sharrock, L. and Kantas, N. (2020). Joint Online Parameter Estimation and Optimal Sensor Placement for the Partially Observed Stochastic Advection Diffusion Equation. Submitted to SIAM Journal of Uncertainty Quantification. arXiv preprint: https://arxiv.org/pdf/2009.08693.pdf.

repository: louissharrock/RML-ROSP

repo_name: louissharrock/RML-ROSP


text:
# eb-custom-platforms-samples
Elastic Beanstalk samples for running on custom platforms.

## Pre-requisites

Ensure that you have the latest version of the EB CLI installed before using the samples.
Instructions for installing the EB CLI can be found [here](http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install.html).

## Using the provided samples
1. To use these samples, clone this git repo.
2. **cd** into the directory for the platform to test. For example, the Node platform on Ubuntu is under *NodePlatform_Ubuntu*.
```
cd NodePlatform_Ubuntu
```
### Updating Packer template
All provided custom platform samples use [Packer](http://www.packer.io) for creating AMIs.

We have provided Packer templates (*custom_platform.json* or *tomcat_platform.json*) along with our sample plaforms.

- **Note**: None of the Packer templates in the samples contain values for **region** and **source_ami**. You must supply those values before you attempt to create a custom platform.
- The **source_ami** in the Packer template depends on the *[flavor](http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/platform-yaml-format.html)* of the sample. See the value of **platform.yaml** in each sample template for the *flavor*.
- The latest AMI for the *flavor* can be found from the AWS EC2 console by searching for official AMIs provided by the operating system provider. Copy the AMI ID from the EC2 console and update the provided Packer template.
- The **region** in the Packer template should match the region from where you copied the value of the EC2 AMI.

### Creating Custom platforms

Initialize a EB CLI platform workspace by entering the following command and following the prompts.
```
$ ebp init
...
$ ebp create
```
After the platform has been created successfully, you will see the ARN for the Beanstalk platform in the event stream on your console. Note the platform ARN, you will need it to create your environment below.

**Note** : You will need an instance profile to create a platform successfully. The CLI will create an instance profile for you named **aws-elasticbeanstalk-custom-platform-ec2-role** with the correct permissions for the samples to work. To use your own instance profile, ensure that your instance profile has all of the policies included in the Beanstalk Managed role under the name **AWSElasticBeanstalkCustomPlatformforEC2Role**. You can read more on attaching managed policies to your role [here](http://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html#aws-managed-policies)

As your custom platform is creating, you will see logs from the Packer build stream to your console. Any errors when building the platform when running Packer should be relayed back. You can check the logs for any platform build using the logs command below.
```
$ eb platform logs --help
```

### Creating Beanstalk environment
Once you have succesfully created the platform you can test the platform by creating an Elastic Beanstalk environment in a new workspace using the platform ARN that was provided in the previous step.
```
$ cd /path/to/new/environment/workspace
$ eb init
$ eb create -p <platform arn>
```

repository: upugo-dev/eb-custom-platforms-samples

gha_language: Shell

repo_name: upugo-dev/eb-custom-platforms-samples


text:
RailsMagicClipboard
========

Sublime text plugin to convert CSS, HTML or JavaScript in the clipboard to SASS, CoffeeScript or HAML on your screen. View on package control [here](https://sublime.wbond.net/packages/Rails%20Magic%20Clipboard "Rails Magic Clipboard on Package Control").

![demo](images/RailsMagicClipboard.gif)

> "The best Sublime Text plugin I have ever used. Saved me 5 minutes already in the past 5 minutes."
> \- @jrnbs

### Installation

###### Installing through package control

1. In Sublime Text open up the package control menu bar (`super+shift+p`) and type `install package`
2. Search for `RailsMagicClipboard`, and click on it to install the package.
3. Look through the setup issues to see if you need to install any extra services.

###### Installing the hard way

1. Clone this repository to your Sublime Text Packages directory.
2. Follow all other instructions (especially the _Setup Issues_ section!)

### Usage

Insert CSS, Javascript or HTML (including from .html.erb files) from your clipboard into a .css.sass, .js.coffee or .html.haml file using `"super+k+v"`. The copied data will be inserted into your file as SASS, CoffeeScript, and HAML respectively. Perfect for copying straight from Stack Overflow.

This plugin is intended to be very much something you install and forget about until your co-worker leans over your shoulder and is absolutely amazed. To that end, I recommend mapping `"super+v"` to the `"rails_magic_clipboard"` command in your user key bindings. This mapping is of course completely optional.

```json
# Preferences/Key Bindings - User

[
    {
        "keys": ["super+v"], "command": "rails_magic_clipboard"
    }
]
```

From there, you can start pasting raw CSS into your .css.sass files and be amazed as pure sass goodness is pasted into your file, and all text pasted into other files will be pasted in as usual (so no worries there!) Same magical goodness applies to the other supported formats.

### Setup Issues

###### Converting CSS to SASS

You must have the sass gem installed to use the CSS to SASS feature of this plugin. Internally, we use the `sass-convert` command, which requires the sass gem. To install the sass gem visit http://sass-lang.com/install.

###### Converting JS to CoffeeScript

To use the JS to Coffeescript automagical conversion you need to have the `js2coffee` Node Package Module installed (https://www.npmjs.org/package/js2coffee). If you don't have js2coffee installed, you can easily install it with the following command:

```bash
$ npm install -g js2coffee
```

If you don't have npm installed then you can follow the instructions here http://blog.npmjs.org/post/85484771375/how-to-install-npm.

###### Converting HTML to HAML

To use the HTML to HAML features of this plugin you need to have the HAML gem installed (`gem install haml`). If you're still having problems it might be because recently the HTML to HAML functionality has been stripped out into its own gem, unsurprisingly called html2haml. Installing the htmt2haml gem in the standard way (`gem install html2haml`) should fix the issue. If you an error about hpricot not being found when pasting HTML into a haml file try installing the hpricot gem and then restarting Sublime (`gem install hpricot`), see this issue for more info: https://github.com/haml/haml/issues/504. If you still have issues, raise a github issue with me! Unfortunately at the moment erb flavoured HTML will not be parsed correctly.

###### Ruby Version Managers

If you are using RVM or rbenv etc, then you will need to set the path in settings, as RVM/rbenv modify the environment path, which messes with sublimes use of the path.

To find your path you can run `echo $PATH` on the command line. Copy the result then paste it into the RailsMagicClipboard user settings file, as shown below.

```json
# Preferences/Package Settings/RailsMagicClipboard/Settings - User

{
    "path": "your/copied/path/here"
}
```

### Known Issues

There is an issue with the paths and RVM/rbenv. Sublime Text will not load with the correct paths to find Sass if it is not loaded from the command line. At the moment I am not sure what to do about it, and am happy to hear ideas. The same issue is occuring here https://github.com/badsyntax/SassBeautify/issues/53. You can get around this by opening Sublime Text from the command line, or, if you're hardcore and want to solve the issue permanently, you can follow these instructions: http://unix.stackexchange.com/questions/89076/how-to-set-the-path-osx-applications-use/89077#89077.

If you find more, create an issue or let me know on twitter ([@nick_dowse](http://www.twitter.com/nick_dowse "Nick Dowse twitter")). Most of the hard work was done by the creators and maintainers of SassBeautify, another great Sublime Text Plugin. So, thanks to them!

repository: nickdowse/RailsMagicClipboard

repo_name: nickdowse/RailsMagicClipboard


text:
---
id: 97
title: My top favourite twitter tools
date: 2009-03-10T00:00:00+00:00
categories:
  - Technology
tags:
  - General Techie Stuff
  - Misc
---
UPDATEI'm constantly finding new tools that help me to use my twitter account in a better way. Some of the tools are really great, but I can't be bothered to remember all of the URLs, and bookmarking doesn't seem to help at all.

So I decided to compile a list and post here. I'll update the list as I find new tools, so keep an eye on this space, and instead of bookmarking all the url's, simply [bookmark this post](http://www.placona.co.uk/97/misc/my-top-favourite-twitter-tools/ "Placona.co.uk - My top favourite twitter tools"){.jqbookmark}.

  * http://www.tweetdeck.com/
    TweetDeck is an Adobe Air desktop application that is currently in public beta. It aims to evolve the existing functionality of Twitter by taking an abundance of information i.e twitter feeds, and breaking it down into more manageable bite sized pieces.
  * http://twuffer.com/
    Twuffer allows the Twitter user to compose a list of future tweets, and schedule their release.
  * http://www.tweetconvo.com/
    TweetConvo is a new way to view twitter conversations. Long gone are the days of going through all of a tweet's @replies to get a grasp of the conversation. All you have to do now is enter a tweet's URL below!
  * http://friendorfollow.com/
    Who are you following that's not following you back? Who's following you that you're not following back? Find out!
  * http://twitterfeed.com/
    Feed your blog to twitter, identi.ca, HelloTxt or Ping.fm
  * http://twitterfall.com/
    Twitterfall is a way of viewing the latest 'tweets' of upcoming trends and custom searches on the micro-blogging site Twitter.
  * http://useqwitter.com/
    Qwitter e-mails you when someone stops following you on Twitter.
  * http://www.twitthis.com/
    TwitThis is an easy way for people to send Twitter messages about your blog post or website.

**UPDATE:**

  * http://tweeteffect.com
    Find out which of your Twitter updates made people follow or leave you.


text:
Version 1.5 (2023/02/04)
===
  - Drop support for Python 3.7
  - Added tests for Python 3.11
  - Adding explicit Pypy 3.7, 3.8 & 3.9 support

Version 1.4 (2022/01/20)
===
  - Drop support for Python 3.6

Version 1.3 (2018/03/17)
===
  - Drop support for Python 2.6
  - Improved documentation

Version 1.2 (2017/08/12)
===
  - Add configuration through environment variables
  - Add option for case insentive search
  - Use entrypoint instead of custom script
  - LAST VERSION TO SUPPORT PYTHON 2.6

Version 1.1 (2017/02/11)
===
  - Tests added
  - More CI tools integration

Version 1.0 (2016/05/08)
===
  - Able to execute Python modules  and scripts directly
  - Reporting errors improvements
  - Add Travis CI testing

Version 0.9 (2015/12/24)
===

  - Keep the code compatible with Python3

Version 0.8 (2015/05/09)
===

  - Performance improvements
  - Fuzzy search support
  - Man page

Version 0.7 (2013/10/26)
===
No release notes yet, starting on version 0.8

repository: jaimebuelta/ffind

gha_language: Python

repo_name: jaimebuelta/ffind


text:
---
title: "How To Write Cleaner CSS With BEM"
date: "2020-05-25"
description: "This article covers everything you need to know about BEM in order to start using BEM to clean up and organize your CSS styles."
tags: ['CSS']
---

If you have worked with CSS for any amount of time, then you know that inheritance, specificity, and naming are some of the hardest things to deal with.  This issue is compounded by the fact that naming css classes is already difficult and handling CSS specificity across an entire codebase is nearly impossible. Luckily, there are solutions to these problems. One of the more popular solutions is a style of coding called Block Element Modifier which is more commonly referred to as BEM.

## What Is BEM?

BEM was created to help alleviate many of the issues around naming, specificity, and inheritance by being a set of guidelines which force you to create CSS in a way that avoids specificity and inheritance issues. This is done by using a special naming convention which is broken into three different parts. Blocks, Elements, and Modifiers. In order to explain how this all works, let's use the following navbar HTML as an example.
```html
<nav>
  <span>Brand Name</span>
  <ul>
    <li>Pricing</li>
    <li>Contact</li>
  </ul>
</nav>
```

### Blocks

In terms of BEM this entire navbar would be considered a block. This is because a block is any standalone component on a page. This could be anything, such as, a button, an input, or even a full widget style card. In order to name a block you must use only letters, numbers, or hyphens to denote the name. Essentially, the naming of a block follows standard CSS naming conventions. In our case, we will call this navbar block `.navbar`. This now gives us the following HTML.
```html {1}
<nav class="navbar">
  <span>Brand Name</span>
  <ul>
    <li>Pricing</li>
    <li>Contact</li>
  </ul>
</nav>
```
So far, this probably looks just like how you would normally apply CSS naming, but when we add in elements things start to look quite a bit different.

### Elements

If a block is any standalone component on the page, then an element is any component/part in a block that cannot stand on its own. For example the list in our navbar is tied directly to our navbar and cannot stand on its own since it does not make sense for it to be outside the navbar. Because of this, the list would be considered an element inside our navbar block. The brand name span is also an element in this block since again it is tied directly to the block and is not its own component.

Here is where the naming starts to differ from what you are most likely used to. Since we know that elements are always tied to a particular block, we can take advantage of that in our naming. To name an element you must prefix it with the name of the block followed by two underscores. For example, these elements would be prefixed with `.navbar__` since our block is called `.navbar`. After the prefix, our naming follows normal CSS naming standards just like the block. Here is an example of our CSS with all elements properly named.
```html {2-5}
<nav class="navbar">
  <span class="navbar__brand-name">Brand Name</span>
  <ul class="navbar__list">
    <li class="navbar__list-item">Pricing</li>
    <li class="navbar__list-item">Contact</li>
  </ul>
</nav>
```
As you can see each of our elements are prefixed with the block name which makes it completely clear which component each element is a part of. You will also notice that the list items do not contain the selector their parent as a prefix (`.navbar__list__list-item`). This is because in BEM, you do not need to care about the hierarchy of elements when creating names. The only thing you need to worry about is which block an element is inside of. This helps make names clearer and easier to read/write.

### Modifiers

The final part of BEM are the modifiers. These modifiers are essentially like themes, because they can be applied to any element or block in order to change the look of the element or block. Common use cases for modifiers are things like primary/danger buttons, active states, and big/small text. In our above example some modifiers we could have would be a dark theme for our navbar block, as well as, an active theme for the active item in the list.

In order to name a modifier all you need to do is take the entire selector for the block/element you are modifying, add two hyphens, and then use that as the prefix for the selector. For example to modify the `.navbar` block you would use the prefix `.navbar--`. After this prefix we again can use normal CSS naming standards just like with blocks and elements. Here is our complete HTML if we add a dark theme for the nav and an active theme for one of the list items.
```html {1,4}
<nav class="navbar navbar--dark">
  <span class="navbar__brand-name">Brand Name</span>
  <ul class="navbar__list">
    <li class="navbar__list-item navbar__list-item--active">
      Pricing
    </li>
    <li class="navbar__list-item">Contact</li>
  </ul>
</nav>
```
You will notice that instead of overriding the block/element selector with the modifier, we actually add a second selector just for the modifier. This makes it so that we can use all the base styles of the normal block/element selector, and we only have to override the individual styles we want to change in the modifier.

## Why Is BEM Useful?

If you are anything like me, then you are probably looking at this HTML and thinking it is a giant mess of class names. There better be some serious benefits to this naming to justify the ugly code it produces. Luckily, there are quite a few major benefits.

### Never Worry About Specificity Again

With BEM, since every name is prefixed with the block it is inside, or the block/element it is modifying there is no need to ever nest styles or use multiple CSS classes in a single selector. This is actually a rule of BEM. You should never nest selectors or select anything other than one single CSS class in your CSS files. This makes it so that every single selector has the same specificity so you never have to worry about specificity. For example, the following CSS selectors would be used for our navbar.
```css
.navbar {}
.navbar--dark {}
.navbar__brand-name {}
.navbar__list {}
.navbar__list-item {}
.navbar__list-item--active {}
```
This rule actually helps with inheritance as well.

### Fixes Inheritance Issues

Have you ever worked in a codebase where someone created a CSS style for `.active`? If so, then you have probably seen firsthand the pain of inheritance in CSS, because now everywhere you try to use the `.active` class you are stuck with the styles from the `.active` selector even if you do not want them. This is a common problem when writing CSS that uses classes like this.
```html
<button class="active primary large">Bad Idea</button>
```
Generally, to get around this problem most people will use another class such as `.btn` which they combine with the other selectors to make them more unique.
```html
<button class="btn active primary large">Bad Idea</button>
```
This then would give you CSS selectors like the following.
```css
.btn {}
.btn.active {}
.btn.primary {}
.btn.large {}
```
This helps solve polluting the global namespace with generic class names like `.active`, but it still doesn't fix inheritance. What happens if you have a navbar list item that is a button and also active.
```html
<button class="btn list-item active">Overlap!</button>
```
```css
.btn {}
.list-item {}
.btn.active {}
.list-item.active {}
```
As you can see we now have overlap between out `.btn.active` and our `.list-item.active` selectors. Are we saying the `.btn` is active, the `.list-item` is active, or that both are active. The above HTML has no way to distinguish between which is active and not, which is a very common problem to run into when writing CSS.

### Stop Worrying About Naming

Since BEM has a set naming convention you never have to worry about naming elements in a way that will guarantee uniqueness across your entire application. BEM's naming convention does all the hard work in making sure your names are unique so you never have unexpected clashes to worry about. When coding without BEM it is hard to use short names, such as, `list-item` since this same name could be used to describe a list item in a navbar, a sidebar, or even an accordion list. This leads to names, such as, `navbar-list-item` or `accordion-list-item`, but there is no consistent convention so different developers will most likely use slightly differing naming conventions. With BEM you never have to worry about any of this.

## Conclusion

Writing CSS is hard enough on its own without having to worry about managing a global namespace, inheritance, and specificity. With BEM you can get rid of all your worries around global namespaces, inheritance, and specificity, so you can focus your attention on actually writing CSS and not fighting it.


text:
# springboot-csv-chart
Simple web application which takes data from the server and displays the data in a table and a chart. The server reads data from a CSV file stored at a specific location and sends it to the webapp. Use attached csv file for the data and the mockup below for the table and chart. The X Axis for the chart is “Words” and y axes are “Score” and “Avg Score”

run project using `mvn spring-boot:run`

then go to http://localhost:8080/


text:
Windows RQ Worker
======

Provides a WindowsWorker class that allows you to use
[Redis Queue (RQ)](https://github.com/nvie/rq) on Windows systems.
This is for development/testing purposes only.

Since Windows does not support fork(), we execute all work in the main
worker thread instead of forking off a separate worker process.
As a result, workers may not be as stable and crash resistant.

Further, since Windows does not support SIGALRM, WindowsWorkers
do not provide any of the work timeout controls that normal workers provide.

Installation and Use
-----------

You can install this package directly from GitHub with pip:

```bash
$ pip install git+https://github.com/michaelbrooks/rq-win.git#egg=rq-win
```

To start an RQ worker using the WindowsWorker class:

```bash
$ rqworker -w rq_win.WindowsWorker
```

Contributions and improvements are welcome!

repository: luisgustavossdd/rq-win

repo_name: luisgustavossdd/rq-win


text:
## Changelog for the 2.4.0 milestone

### Major features

* **[use select2 for many to many](https://github.com/locomotivecms/engine/issues/838)** (feature)
* **[missing url_to tag](https://github.com/locomotivecms/engine/issues/837)** (feature)
* **[Don't show "already signed in" message](https://github.com/locomotivecms/engine/issues/815)** (feature)
* **[Mark fields as translatable](https://github.com/locomotivecms/engine/pull/710)**
* **[Accounts API Update](https://github.com/locomotivecms/engine/issues/594)** (feature, question)

### List of the most important closed issues

* **[Search Does Not Save 2.3.1](https://github.com/locomotivecms/engine/issues/836)** (issue)
* **[Its not possible to include a snippet with "-" in the name](https://github.com/locomotivecms/engine/issues/831)** (issue)
* **[Public submission error_callback only works for default locale](https://github.com/locomotivecms/engine/issues/845)** (issue)
* **[File inputs inside has many relationship editor are not refreshed](https://github.com/locomotivecms/engine/issues/844)** (issue)
* **[local_path => is already taken pushing images from wagon](https://github.com/locomotivecms/engine/issues/824)** (issue)

### People who participated:

Please let us know if we forgot somebody.

* [wupdiwup](https://github.com/wupdiwup)
* [did](https://github.com/did)
* [kkrol89](https://github.com/kkrol89)
* [stunjiturner](https://github.com/stunjiturner)
* [stephenson](https://github.com/stephenson)
* [miletbaker](https://github.com/miletbaker)
* [Cornflex](https://github.com/Cornflex)
* [benhutton](https://github.com/benhutton)
* [youroff](https://github.com/youroff)
* [widescape](https://github.com/widescape)
* [greeneca](https://github.com/greeneca)

repository: LaunchPadLab/engine

branch_name: refs/heads/tukaiz

gha_language: Ruby

repo_name: LaunchPadLab/engine


text:
title: Events
---
Events are important for the inner workings of your App.
Sometimes you need an event bus or a publish/subscribe channel. Quasar provides this out of the box:

``` js
import { Events } from 'quasar'
```

## Methods

> **NOTE**
> Event name must *NOT* contain space characters, otherwise the string will be considered as containing multiple events names.

### Registering an Event/Callback
`Events.on(String eventNames, Function callback [, Object context])`

Example:
``` js
import { Events } from 'quasar'

let context = {...} // will be used as *this* within callback
Events.on('event-name', function(param1, param2, ...paramN) { ... }, context)

// The params that are used when triggering the event are passed on
// to each callback.

// We can register multiple events at once:
Events.on('event1 event2 eventN', callback)
```

### Removing an Event/Callback
`Events.off(String eventNames [, Function callback])`

``` js
import { Events } from 'quasar'

// Unregistering an event:
Events.off('event-name')
// 'event-name' does no longer has any callbacks

// Unregistering a specific callback for an event:
let callback = function(...) {...}
Events.on('event-name', callback)
Events.off('event-name', callback)
// 'event-name' still exists (if other callbacks are registered to this event),
// but does not contain the above callback anymore

// We can remove callback from multiple events at once:
Events.off('event1 event2 eventN', callback)

// or we can remove all callbacks from multiple events at once:
Events.off('event1 event2 eventN')

// or we can remove all callbacks and all events at once:
Events.off()
```

### Registering a Callback to Be Run Only Once
`Events.once(String eventNames, Function callback [, Object context])`

Sometimes you need to trigger a callback only once. Example:
``` js
import { Events } from 'quasar'

let callback = function(...) {...}
Events.once('event-name', callback)
// callback will be triggered only once

// We can also register callback to be triggered once
// for multiple events at once:
Events.once('event1 event2', callback)
// callback will be triggered only once for 'event1'
// AND only once more for 'event2'
// ... so triggering 'event1' and 'event2' multiple times
// will run callback a total of 2 times
```

### Triggering an Event
`Events.trigger(String eventNames [, Anything *args])`

Example:
``` js
import { Events } from 'quasar'

Events.trigger('event-name')
// All callbacks associated with 'event-name' will be triggered
// in the order that they were registered.

// Trigger with parameters (as many as you want):
Events.trigger('event-name', 10, 'wow', {obj: true})
// These parameters will be used when calling all registered
// callbacks for 'event-name' --> callback(10, 'wow', {obj: true});

// We can also trigger multiple events at once:
Events.trigger('event1 event2 event3')
Events.trigger('event1 event2 event3', 10, 'wow', {obj: true})

// We can also trigger ALL registered events at once:
Events.trigger()
```

### Checking for Subscribers
`Boolean Events.hasSubscriber(String eventNames [, Function callback])`
or
`Boolean Events.hasSubscriber(Function callback)`

Example:
``` js
import { Events } from 'quasar'

// Check if 'event-name' has any callbacks associated
let exists = Events.hasSubscriber('event-name')

// Check if a callback is registered for an event:
function myFunction() {...};
let exists = Events.hasSubscriber('event-name', myFunction)

// Check if a callback is registered for any of the specified events
let exists = Events.hasSubscriber('event1 event2', myFunction)

// Check if a callback is registered for any events
let exists = Events.hasSubscriber(myFunction)

// Check if an emitter has any events/callbacks at all:
let exists = Events.hasSubscriber()
```

### Getting List of Events
`Array Events.getEventsList()`

Example:
``` js
import { Events } from 'quasar'

let eventsList = Events.getList()
```

## Events List
``` js
import { Events } from 'quasar'

Events.on('event-name', callback)
```

### Global Events

| Event Name | Description |
| --- | --- |
| app:error | Triggered for any Javascript error. See parameters below. |

#### Parameter supplied by `app:error`
`app:error` event is triggerd with one parameter, an Object containing the following properties:

| Property Name | Type | Description |
| --- | --- | --- |
| message | String | Error message |
| source | String | URL of the script where the error was raised |
| lineno | Number | Line number where error was raised |
| colno | Number | Column number for the line where the error occurred |
| error | Object | Error Object containing amongst other things the stack trace |

### App Visibility

| Event Name | Parameters | Description |
| --- | --- | --- |
| app:visibility | (String) state | App got focus if `state` is `visible` or lost focus if `state` is `hidden` |

Read more about it [here](/api/js-app-visibility.html).

### Toast

| Event Name | Parameters | Description |
| --- | --- | --- |
| app:notify | (String) html | Is triggered whenever a Toast is displayed. |

Read more about it [here](/components/toast.html).

### Loading

| Event Name | Parameters | Description |
| --- | --- | --- |
| app:loading | (Boolean) status | Triggered when Loading component is displayed (with `true` as param) or hidden (with `false` as param). |

Read more about it [here](/components/loading.html).

repository: CookieJon/quasar-site

repo_name: CookieJon/quasar-site


text:
# Vertu
A web app focused on helping users engage a thirteen week experiment in personal development based upon [Benjamin Franklin’s thirteen virtues](http://www.thirteenvirtues.com/).

repository: justinbryeans/vertu

repo_name: justinbryeans/vertu


text:
# JSS

*[Repo](https://github.com/cssinjs/jss) – [Docs](https://github.com/cssinjs/jss/tree/master/docs)*

```JS
// app.js
import injectSheet from 'react-jss';

const styles = {
  container: {
    margin: '0 auto',
    width: '100%',
    '@media screen and (min-width: 360px)': {
      maxWidth: '400px',
    },
    '@media screen and (min-width: 600px)': {
      maxWidth: '600px',
    },
  },
};

const App = (props) => (
  <div className={props.sheet.classes.container}>
    <Tweet data={data} />
  </div>
);

export default injectSheet(styles)(App);
```

## Checklist

- ✅ No build requirements
- ✅ Small and lightweight
- 😕 Supports global CSS (requires separate setup)
- ✅ Supports entirety of CSS
- ✅ Colocated
- ✅ Isolated
- ✅ Doesn’t break inline styles
- 😕 Easy to override (inline styles, but no standard mechanism)
- ❌ Theming
- ❌ Pre-build
- ✅ Server side rendering
- ❌ No wrapper components
- ❌ ReactNative support

Legend: ✅ = Yes, ❌ = No, 😕 = Kinda, refer to notes or parentheses

#### Notes

- Has plugin system
- Supports all selectors (nesting, children, siblings,…), _requires_ custom `'&selector'` notation though (e.g. `'&:hover'`, `& div`)