text:
- Start Date: 02/19/2020
- HIP PR:
- Tracking Issue:

# Summary

[summary]: #summary

A comprehensive set of improvements to Proof-of-Coverage, the scoring system, how Hotspots join the network, and
participate in mining and the HBBFT consensus group.

# Motivation

[motivation]: #motivation

On the Helium network today, only Hotspot hardware purchased from Helium Inc. is considered trustworthy. These Hotspots
are sold using a hardware key storage device (a secure element) that makes it reasonably challenging for an attacker to
create a virtual network of Hotspots that have valid keys. The downside of this situation is that the tens of thousands
of non-Helium Inc. LoRa gateways that exist in the world cannot join the network and participate in mining.

The goal of this proposal is to propose a set of measures that make it safe for LoRa gateways of unknown origin to
participate in Proofs-of-Coverage and earn tokens for that participation. This goal poses some interesting challenges,
as in the current system the network loses the ability to verifiably prove that any sub-network created by such new
gateways truly exists since it's possible for dishonest actors to fake geographic locations and radio activitity.

# Stakeholders

[stakeholders]: #stakeholders

- 3rd party Hotspot manufacturers
- DIY miners

# Problem Definition

[problem-definition]: #problem-definition

There are a number of problems we hope to address with this proposal:

1. Allow non-Helium Inc manufactured Hotspots to participate in Proof-of-Coverage and mining
2. Provide a way for non-radio hardware to participate in consensus groups
3. Increase the requirements for consensus group participation to improve the overall health of the network
4. Introduce a number of penalties for failing to perform any of the roles required for earning HNT

# Allowing non-Helium Inc manufactured Hotspots to participate in Proof-of-Coverage

[non-helium-hotspots]: #non-helium-hotspots

## The problem

Consider the below network where Hotspots A through F are of unknown origin, with the lines representing reported RF
connectivity between hotspots.

                     +------+
                     |      |
         +-----------+  A   |
         |           |      |
         |           +------+
         |
    +------+
    |      |
    |  F   |
    |      |
    +------+
        |            +------+
        |            |      |
        |            |  B   |
        |            |      |
        |            +------+            +------+
    +------+             |               |      |
    |      |             |               |  C   |
    |  E   +-----------------------------+      |
    |      |             |               +------+
    +------+             |
        |                |
        |             +------+
        |             |      |
        +-------------+  D   |
                      |      |
                      +------+

Since it is possible for RF data to be fabricated - there is no way to verify that data was sent via RF once it has been
demodulated - the network does not know whether these Hotspots are part of a virtual network, or whether they are
physically deployed at their claimed locations.

To correctly identify whether the above network is legitimate, we can introduce a Helium Inc (or authorized 3rd party
reseller) 'trusted' Hotspot into the network and learn more about the behavior of the Hotspots A-F. Only real Hotspots
will be able to successfully participate in PoC challenges involving the trusted Hotspot.

Reimagining the above network with the introduction of a trusted Hotspot, consider the below:

                     +------+
                     |      |
                     |  A   +---------------+
                     |      |               |
                     +------+               |
                                         +--+---+
    +------+                             |      |
    |      |                             |  X   +<--+ Trusted Hotspot
    |  F   |             +---------------+      |
    |      |             |               +------+
    +------+             |
                     +---+--+
                     |      |
                     |  B   |
                     |      |
                     +---+--+            +------+
    +------+             |               |      |
    |      |             |               |  C   |
    |  E   |             |               |      |
    |      |             |               +------+
    +---+--+             |
        |                |
        |             +--+---+
        |             |      |
        +-------------+  D   |
                      |      |
                      +------+

With this information, we can verify that A, B, D and E can successfully complete PoC challenges which involve X. Since
we know that Hotspot X is trustworthy, we can conclude that any Hotspot which can participate in a PoC challenge
involving X can only do so if it's operating within the rules set by the consensus mechanism and also has an operating
radio chip.

However, even with this scheme we still need a way to allow Hotspots not manufactured by Helium Inc or authorized
manufacturers to not only participate in PoC but also be candidates for consensus membership.

To counter that and allow any hotspot to participate in PoC and have consensus membership candidacy, we propose to
introduce "Levels of Trust".

## Current Network Behavior

In the current network, onboarding a Helium Inc manufactured Hotspot grants full Proof-of-Coverage priviledges.

As mentioned in the problem defintion, we cannot assume that every single DIY hotspot is going to incorporate a GPS chip
or a radio chip. Malicious enttities may try to game the system by tweaking/removing hardware and yet be able to
participate in PoC. Currently we _know_ that every single hotspot being added to the network is manufactured by helium
and has the required hardware to participate in proof-of-coverage challenges, as soon as we allow other hotspots to join
the network we have no verifiable way of being able to separate a virtual network from a real one.

To mitigate that, we propose a new model for establishing trust among hotspots and subsequently change how hotspots earn
HNT, named "Levels of Trust".

## Levels of Trust

Below is a visual representation of the aforementioned Levels, the most important takeaway here is that any higher Level
encompasses all the benefits and constraints of the lower Levels (with a few exceptions).

                                                        +-----------------------------+
                                                        |                             |
                                                  +---->+          Level 3A           +----+
                                                  |     |    (Organic Challenger)     |    |
    +--------------+       +---------------+      |     |                             |    |      +-----------------------+
    |              |       |               |      |     +-----------------------------+    |      |                       |
    |   Level 1    +------>+   Level 2     +------+                                        +----->+        Level 4        |
    |  (Observer)  |       | (Participant) |      |                                        |      | (Consensus Candidate) |
    |              |       |               |      |     +----------------------------+     |      |                       |
    +---------+----+       +---------------+      |     |                            |     |      +-----------------------+
              |                                   |     |          Level 3B          |     |
              |                                   +---->+   (Governance Challenger)  +-----+
              |                                         |                            |
              |                                         +-----------------+----------+
              |                                                           ^
              |                                                           |
              +-----------------------------------------------------------+

Before we get into the details and constraints of each level, we need to set some common ground:

- Every hotspot joining the network starts at the first level.
- Every successive level is granted the priviledges of all previous levels.
- Organic network growth allows hotspots to get to level 3A. In order to reach level 4, the owner must stake HNT.
- There is a path to get to level 3B from level 1 via on-chain governance mechanism (TBD).

### Level I: Network Observer

- Every hotspot which joins the helium network starts at Level 1 by issuing an `add_gateway` transaction.
- The entry fee is set to burning data credits worth $10 USD.
- A hotspot at Level 1 does not have any location asserted on the network, however, it is allowed to witness nearby PoC
  challenges. This is to ensure that when the hotspot does assert a location via `assert_location` transaction, we can
  be confident about its claim of location by analyzing its witness list.
- A hotspot at Level 1 is allowed to transmit data and earn HNT based only on transmitting network data.

### Level 2: Network Participant

- A hotspot must satisfy the below minimum criteria to enter Level 2:
  - It must be a Level 1 hotspot for X number of blocks.
  - Issue an `assert_location` transaction by incurring a $40 USD data credit burn fee.
  - Witness sufficient number of PoC challenges involving Level 3 and above hotspots.
- A hotspot at Level 2 gains access to participate in PoC challenges (become a member in the PoC path).

### Level 3: Network Challenger

Level 3 is divided into two broad categories:

#### Level 3A: Organic Network Challenger

- A hotspot must satisfy the below minimum criteria to enter Level 3A:
  - It must be a Level 2 hotspot for X number of blocks.
  - Successfully participate in X number of PoC challenges involving other Level 3 and above hotspots.
  - A successful challenge comprises of the hotspot being able to receive a PoC packet from a Level 3 hotspot,
    successfully decrypt it and successfully transmit it to a Level 2 or above hotspot.
- A hotspot at Level 3A gains access to construct PoC challenges.

#### Level 3B: Governance Network Challenger

- A hotspot must satisfy the below minimum criteria to enter Level 3B:
  - It must be a Level 1 hotspot for X number of blocks.
  - It must be voted in via the on-chain governance mechanism (TBD) wherein either Helium (or an authorized 3rd party)
    countersigns the `assert_location` transaction on the hotspot owner's behalf.
- A hotspot at Level 3B gains access to construct PoC challenges.

### Level 4: Consensus Candidates

- A hotspot must satisfy the below minimum criteria to enter Level 4:
  - It must be a Level 3 hotspot for X number of blocks.
  - The hotspot owner or another miner in the network must stake 10000 HNT in order to claim Level 4 status for the
    hotspot.
- A hotspot at Level 4 gains access to consensus membership candidacy.

## Level Demotion

With the exception of Level 3B and Level 4 hotspots, any hotspot belonging to other levels is susceptible to level
demotion governed by the hotspot's score.

### Level 4 to Level 3A

TBD

### Level 3A to Level 2

A hotspot operating at Level 3A may get demoted to Level 2 and lose challenger priviledges if its score continually
drops below a chain-var configured threshold for X number of blocks.

### Level 2 to Level 1

- A hotspot operating at Level 2 may get demoted to Level 1 and lose challenging priviledges if its score continually
  drops below a chain-var configured threshold for X number of blocks.

- Once this happens, the hotspot would lose its asserted location via an `unassert_location` transaction and would go
  back to observer mode.

- The hotspot owner must issue an `assert_location` and incur the onboarding fee to get back onto the network and
  qualify for Level 2 and above organic network growth.

# Drawbacks

[drawbacks]: #drawbacks

TBD

# Rationale and Alternatives

[alternatives]: #rationale-and-alternatives

TBD

# Unresolved Questions

[unresolved]: #unresolved-questions

1. Under what conditions do we remove the stake for Level 4 hotspots?
2. Where does the removed stake go to? Does it just vanish?
3. How do we actually remove the stake?

# Deployment Impact

[deployment-impact]: #deployment-impact

1. We need to ensure we transition the existing hotspots on the network in a meaningful way. Whether every single existing
   hotspot goes into the same level or not is yet to be determined.

2. We would also need to determine which hotspots qualify for Level 4 access as we need an initial pool of consensus
   members candidates which would continue to miner the blocks once this HIP goes live in production.

# Success Metrics

[success-metrics]: #success-metrics

NA

repository: jmarcelino/HIP

repo_name: jmarcelino/HIP


text:
## Re-bootstrapping

Re-bootstrapping allows deno devs to bench/profile/test JS-side changes without
doing a full `cargo build --release --bin deno` which takes roughly ~4mn on M1s
more on other machines which significantly slows down iteration &
experimentation.

## Example

```js
import { benchSync, rebootstrap } from "./tools/bench/mod.js";

const bootstrap = rebootstrap([
  "webidl",
  "console",
  "url",
  "web",
  "fetch",
]);

benchSync("resp_w_h", 1e6, () =>
  new bootstrap.fetch.Response("yolo", {
    status: 200,
    headers: {
      server: "deno",
      "content-type": "text/plain",
    },
  }));
```

This code can then benched and profiled (using Chrome's DevTools) similar to
regular userland code and the original source files appear in the DevTools as
you would expect.

license: MIT

repository: dplewis/deno

branch_name: refs/heads/master

extension: md

gha_license_id: MIT

license_type: permissive

repo_name: dplewis/deno


text:
DokuWiki plugin Reveal.js
=========================

Reval.js plugin for DokuWiki

This started as a fork of Andreas Gohr's S5 plugin https://www.dokuwiki.org/plugin:s5.

It uses Reveal.js https://github.com/hakimel/reveal.js/.

Install
-------

Paste the address git config http://github.com/neuralyzer/dokuwiki-plugin-revealjs/zipball/master in the manual installation field or use Dokuwiki's extension manager.

Usage
-----

Add `~~REVEAL~~` to a page to insert a button for presentation start. In the past this was optional - now it is mandatory, because the plugin logic depends on the information, if reveal is used on the page or not. And the keyword `~~REVEAL~~` on the top of the page is used to indicate this.

Every new H1 or H2 section, that is 6 equal signs or 5 equal signs open per default a new slide horizontally.
New H3 sections (4 equal signs) are appended vertically if they follow after an H2 section.

Check also the source code of the [example presentation](example_presentation.dokuwiki)

Include plugin compatibility
----------------------------

Edit in the file dokuwiki/lib/plugin/include/syntax/wrap.php in the function render the line

```
if ($mode == 'xhtml') {
```
to

```
if ( ($mode == 'xhtml') && (! is_a($renderer, 'renderer_plugin_revealjs')) ) {
```
The include plugin will otherwise put some

```
<div class= "plugin_include_content ..." ...> ...</div>
```

at such places that the closing and opening div tags interfere with the reveal.js section tags.

MathJax compatibility
----------------------

At the moment this plugin loads MathJax from the MathJax CDN directly whether the Dokuwiki MathJax plugin is installed or not. It ignores Dokuwiki's MathJax plugin and the custom settings you might have made.

Configuration options
---------------------

Configuration is done in DokuWiki's configuration manager.

![Reveal.js configuration](revealjs_configuration.png)

### Available themes

Available themes are the Reveal.js themes. Possible values:

  * black
  * white
  * beige
  * blood
  * league
  * default
  * moon
  * night
  * serif
  * simple
  * sky
  * solarized
  * dokuwiki (solarized with DokuWiki default theme background color, switched on image borders are recommended :-)

The default is white.

### Controls

Show the reveal.js controls. Two values

  * false
  * true

The default is false.

### Progress bar

Show the reveal.js progress bar. Two values

  * false
  * true

The default is false.

### Build all lists

Whether to build up all lists point by point. Two values

  * false
  * true

The default is false.

### Transition

The slide transition. Possible settings:

  * none
  * fade
  * slide
  * convex
  * concave
  * zoom

The default is fade.

### Horizontal slide level

Headers on this level or above starting a horizontal slide. Levels below starting a vertical (nested) slide - no effect on slides, which are indicated by alternative slide indicators (`---->` and `---->>`). Possible settings:

  * 1
  * 2

The default is 2.

### Enlarge vertical slide headers

Enlarge headers on slides below horizontal_slide_level - no effect on slides, which are indicated by alternative slide indicators (`---->` and `---->>`). Boolean:

* false
* true

The default is false.

### Image borders

Show image borders (default in Reveal.js). Boolean:

* false
* true

The default is false.

### Size

Base size of the slides in pixels - slides will bee zoomed to fit in the available space

* `<width>x<height>`
* Default is `960x700`

### Auto Slide

Automatically move the presentation to the next slide in milliseconds. If this is set to 0, automatic progression is disabled.

* Numeric value to wait in milliseconds

The default is 0.

### Loop

Loop the presentation back to the first slide after the last slide. Boolean:

* false
* true

The default is false.

Supported dokuwiki syntax
-------------------------

Apart of the ordinary things like headlines, tables, italic, bold etc. the following syntax elements are supported:

  * alignment of images: either left or right or centered
  * dokuwiki plugin wrap's `<wrap lo></wrap>` and `<WRAP lo></WRAP>` produce also in the presentation smaller text.
  * `<WRAP clear></WRAP>` for clearing of floats

Extra syntax
------------

### Theme selection and button for presentation start

Putting on the top of the page a
```
~~REVEAL~~
```
will insert at this position a button. A click on this button then starts the presentation with the default theme.

Alternatively, to select a theme put a
```
~~REVEAL theme_name~~
```
with `theme_name` replaced by one of the reveal.js themes as listed under "Available themes".

All other options are also overwritable in a wiki page by using the URL query parameter syntax:
```
~~REVEAL theme=sky&transition=convex&controls=1&show_progress_bar=1&build_all_lists=1&show_image_borders=0&horizontal_slide_level=2&enlarge_vertical_slide_headers=0&show_slide_details=1&open_in_new_window=1&auto_slide=6000&loop=1~~
```
Please note that boolean values must be numeric (1 or 0). If you want to be able to change the options directly in the URL after the presentation has started, then you have to disable DokuWiki's caching by putting `~~NOCACHE~~` at the top of the page.

### Slide background

The plugin introduces the syntax

```
{{background>parameters}}
```

For all possible parameters see alternative slide indicator below.

The so defined background will be applied to the next slide. I.e. the background tag has to preceed the heading opening the next slide and will only apply to that slide. For example

```
{{background>:wiki:dokuwiki-128.png}}
===== my heading=====

slide with background

===== my second heading=====

slide without background
```

produces one slide with background and a second slide without background.

### Alternative slide indicators

```
---- salmon wiki:dokuwiki-128.png 10% repeat bg-slide no-footer ---->

<notes>
This slide has no content, but therefore a fancy background...
</notes>

<----
```

- `---->` opens a new slide with the default transition in the default speed (open previous slides will be closed implicitly)
- Full example - parameters are parsed dynamically like in CSS, the parameter order is not important and whitespaces are not allowed because we split all keywords on whitespaces: `---- orange wiki:dokuwiki-128.png 10% repeat bg-slide zoom-in fade-out slow no-footer ---->`
    - All possible HTML color names and codes are supported: `red`, `#f00`, `#ff0000`, `rgb(255,0,0)`, `rgba(255,0,0,0.5)`, `hsl(0,100%,50%)`, `hsla(0,100%,50%,0.5)`
    - Background images are recognized case insensitive by the endings gif, png, jpg, jpeg, svg and can be a DokuWiki image identifier (`:wiki:dokuwiki-128.png`) or a normal image link ('http://host.tld/path/to/image.png')
    - Background image size is recognized by postfix `%` and `px` or by keywords `auto`, `contain` and `cover` (cover is the default in Reveal.js) - example: `10%` or `250px` (it is generally recommended to use only percent values - they are scaling nice with the rest of the slide and the slide background preview on the wiki page shows you a "real" preview)
    - Background image position is recognized by keywords `top`, `bottom`, `left`, `right`, `center` (center is the default in Reveal.js) or alternative by x,y values in px or % - examples: `top left`, `bottom center`, `3%,5%`, `20px,5%` (the comma is needed to distinguish between image size and position - it is generally recommended to use only percent values - they are scaling nice with the rest of the slide and the slide background preview on the wiki page shows you a "real" preview)
    - Background image repeat is recognized by the keyword `repeat` (no-repeat is the default in Reveal.js)
    - Background transition: prefix `bg-` followed by `none`, `fade`, `slide`, `convex`, `concave` or `zoom`
    - Slide transition: `none`, `fade`, `slide`, `convex`, `concave` or `zoom` followed by optional postfix `-in` or `-out` for different transitions on one slide
    - Transition speed: `default`, `fast`, `slow`
- `---->>` opens a new slide container for vertical (nested) slides and a new slide with the given options - example: `---- red zoom ---->>`
- The next `---->>` will close the previous container (and slide) implicitly
- Technical details:
    - In the rendering the slide mode changes from "headers driven" to "special horizontal rule driven" - headers are no longer interesting in this mode for slide changes
    - You can create of course a whole presentation with this alternative slide indicator
    - if you want to leave this slide mode you need a way to explicit close a slide or container:
        - `<<----` closes a slide container (and possibly open slide inside)
        - `<----` closes a slide

### Footers

Sometimes you might want to have a footer for all the pages. This footer might contain your company's logo or similar things. Footers are most conveniently added using in addition the dokuwiki plugin "wrap". To get a footer on each page put at the very beginning of your document, i.e. before the first heading but possibly after a ``~~NOCACHE~~`` or ``~~REVEAL~~`` the following block
```
<wrap footer>Footer content here.</wrap>
```
This inserts a footer on every single page. If you want the footer to disappear for a specific page place before that page's heading a ``{{no-footer}}``. For example
```
{{no-footer}}
===== my heading=====

slide without footer

{{no-footer}}
{{background>:images:image1.png}}
===== my heading=====

Slide without footer and with background

{{background>:images:image1.png no-footer}}
===== my heading=====

no-footer as option in background definition

---- no-footer ---->

Slide with alternative slide indicator

---->

Next slide with footer and stop alternative
slide indicator mode

<----

```

### Speaker notes

- https://github.com/hakimel/reveal.js#speaker-notes
- keyword: `<notes>` (no parameters)
- No changes on wiki pages
- On a slideshow the content is wrapped into `<aside class="notes">` and invisible (only shown on speaker notes - shortkey s)
- Lists in notes are always NOT incremental, because the list is unvisible and you would have to press the next key for each entry without any obvious effect

Example:
```
<notes>
- your content
- here
</notes>
```

### Fragments

- https://github.com/hakimel/reveal.js#fragments
- `<fragment>` for inline usage (only formatting and substitutions supported)
- `<fragment-block>` for any wiki content
- `<fragment-list>` to overwrite the global option build_all_lists (if false)
- `<no-fragment-list>` to overwrite the global option build_all_lists (if true)
- support for style and index where possible - see also example_presentation.dokuwiki and http://lab.hakim.se/reveal-js/#/7/1

Example:
```
<fragment>Hit the next arrow...</fragment>

<fragment>... to step through ...</fragment>

<fragment>... a</fragment> <fragment>fragmented</fragment> <fragment>slide.</fragment>
```

PDF export
----------

Presentations can be exported as PDF. To do so append a `&print-pdf` to the URL. When you are able to edit the page,  there is a export PDF link rendered under the start slideshow button.

For example if the URL of your DokuWiki reveal.js presentation is usually
```
http://example-dokuwiki.com/doku.php?do=export_revealjs&id=example:page
```
you would have to change this manually in the address bar of your browser to

```
http://example-dokuwiki.com/doku.php?do=export_revealjs&id=example:page&print-pdf
```
After that the presentation looks weird in the browser but can be printed via you browser's print function.
Officially only Chromium and Chrome are supported for PDF export. Check also the  [Reveal.js PDF export documentation](https://github.com/hakimel/reveal.js#pdf-export).

repository: neuralyzer/dokuwiki-plugin-revealjs

gha_language: JavaScript

repo_name: neuralyzer/dokuwiki-plugin-revealjs


text:
# Boost One Dark Theme

[One Dark](https://github.com/atom/one-dark-ui) command line theme for Boost powered applications.
Ideal for dark terminals.

```
yarn install @boost/theme-one-dark --dev
```

Enable with `--theme=one-dark`.

repository: ryanbarr/boost

repo_name: ryanbarr/boost


text:
"Basic" & "Display" Air Quality Sensor firmware for D1 Mini
============================================================

NOTE: This version of the firmware is for the "Basic" and "Display"
versions of the SuperHouse Air Quality Sensor project. It does not
work on the "Pro" version of the project.

Read from a Plantower PMS5003 particulate matter sensor using a Wemos D1
Mini (or other ESP8266-based board) and report the values to an MQTT
broker and show them on a 128x32 OLED display.

The mode button and OLED are optional. You can build this device with
nothing but a PMS5003 and a D1 Mini, and it will work just fine.

On startup, the device reads its own ESP8266 chip ID and uses this as the
basis for its MQTT topics and client ID, to ensure that they will be
unique for each device.

It displays this ID on the OLED display so you can read it off the
display if you have one installed. In case you don't, it also reports
the ID via the serial console at 9600bps, and publishes a startup
message to the topic "events" including its own ID. You can watch that
topic while the device is booting to see what ID it reports.

This ID is then used to generate topics for it to report its readings.
The topics take the following form, with its unique ID substituted:

 * tele/d9616f/PM1
 * tele/d9616f/PM2.5
 * tele/d9616f/PM10
 * tele/d9616f/PPD0.3
 * tele/d9616f/PPD0.5
 * ...etc

The values are also reported in a combined format as JSON, in the same
structure used by Tasmota, at a topic similar to:

 * tele/d9616f/SENSOR

If you install the OLED and the mode button, you can use the button to
toggle the display between different screens. The first screen shows the
most recent readings in micrograms per cubic meter. The second screen
shows the most recent readings in particles per deciliter. The third
screen shows network information including the MQTT ID, IP address, WiFi
SSID, WiFi connection status, and uptime.

Dependencies
------------

These dependencies can all be fulfilled in the Arduino IDE using
"Sketch -> Include Library -> Manage Libraries..."

 * GFX library by Adafruit https://github.com/adafruit/Adafruit-GFX-Library
 * SSD1306 library by Adafruit https://github.com/adafruit/Adafruit_SSD1306
 * PubSubClient library by Nick O'Leary https://pubsubclient.knolleary.net

It also uses a version of Mariusz Kacki's "PMS" library that was forked by
SwapBap. You do not need to install this library separately, because it's
included in the project.

Connections
-----------

For particulate matter sensor:
 * PMS5003 pin 1 (VCC) to D1 Mini "5V" pin
 * PMS5003 pin 2 (GND) to D1 Mini "GND" pin
 * PMS5003 pin 4 (RX) to D1 Mini "D8" pin
 * PMS5003 pin 5 (TX) to D1 Mini "D4" pin

For mode button:
 * Button connected between D1 Mini "D7" pin (GPIO13) and GND

For 128x32 I2C OLED:
 * OLED VCC to D1 Mini 3.3V
 * OLED GND to D1 Mini GND
 * OLED SCL to D1 Mini "D1" pin
 * OLED SDA to D1 Mini "D2" pin

To do
-----

 *

Credits
-------

Written by Jonathan Oxer for www.superhouse.tv
https://github.com/superhouse/AQS

Inspired by https://github.com/SwapBap/WemosDustSensor

repository: SuperHouse/AQS

branch_name: refs/heads/main

repo_name: SuperHouse/AQS


text:
## Angular 7 Data Tables
This is a fork of package [https://github.com/ggmod/angular-2-data-table] (https://github.com/ggmod/angular-2-data-table)

A simple Angular 7 data table, with built-in solutions for features including:

* pagination
* sorting
* row selection (single/multi)
* expandable rows
* column resizing
* selecting visible columns

The component can be used not just with local data, but remote resources too: for example if the sorting and paging happen in the database.

The templates use bootstrap and font-awesome CSS class names, so the component requires a bootstrap and font-awesome .css files to be present in the application using it.

## Installing:
`npm install angular-data-tables`

#### Licensing
MIT License


text:
---
layout: post
title: Introducing Surya care
categories: [elder care]
tags: [elder care]
---

#### Introduction

If you are trying to understand your options for caring for senior family members for friends, you are in the right place. There are several options and the rest of this post goes into some level of detail on each of the options,

 * Independent Living Communities
 * Assisted Living
 * Nursing Homes
 * Speciality Care (Eg, Alzheimer's Care)
 * Residential Home Care
 * Respite Care
 * Home Care

#### Independent Living Communities
These communities are geared towards seniors who are very independent but have a few medical issues that require care. Residents live in fully equipped private homes. Given that these are communities, there's a good chance at social gatherings and finding people with similar interests to spend time with.

Cost: These could cost any where from $1500 to $3500.

#### Assisted Living
These communities are geared towards seniors who are not able to live safely on their own but do not yet require the high level of care provided by nursing homes. There are nurses on duty at all hours of the day and seniors are assisted with food, medication and housekeeping. Guests live in private apartments that may have limited kitchen facilities.

Cost: These could cost any where from $2500 to $4000.

#### Nursing Homes
Nursing homes provide around-the-clock skilled nursing care for the frail elderly who require a high level of medical care and assistance.  Twenty-four hour skilled nursing services are available from licensed nurses. Many nursing homes now provide short-term rehabilitative stays for those recovering from an injury, illness or surgery. Long-term care residents generally have high care needs and complex medical conditions that require routine skilled nursing services. Residents typically share a room and are served meals in a central dining area unless they are too ill to participate.

Cost: These could cost any where from $4000 to $8000.

#### Speciality Care (Eg, Alzheimer's Care)
Numerous senior housing options for people with dementia or Alzheimer's are available. With memory impaired, it is important to have 24-hour support and structured activities to ensure their safety and quality of life. Many families try to care for their loved ones at home, which can be extremely difficult given the skill that is required to care for a person with memory problems. Generally, the residents live in semi-private apartments and have structured activities delivered by trained staff members. Most of these living environments have secured or locked areas to ensure no one wanders off. Many times, within the secured areas, residents have access to outdoor walking paths or gardens.

Cost: These could cost any where from $3000 to $7000.

#### Residential Home Care
Residential care homes are private homes that typically serve residents who live together and receive care from live-in caretakers. These homes offer assisted care services for seniors who want a more private, home-like community. Assistance with activities of daily living such as bathing and dressing are typically provided. Amenities and nursing services vary greatly between homes.

Cost: These could cost any where from $1500 to $3500, depending on services provided.

#### Respite Care
Respite care provides a temporary break for caregivers by allowing a resident to have a short-term stay in a community that can meet their needs. Many assisted living communities and nursing homes have a respite care program. Residents typically stay from a week to a month, depending on their situation. They receive all of the services of the community.  Respite stays may also serve as a "get acquainted" period for the senior. Many residents find that they enjoy their stay and decide to move in soon after the short-term visit. Respite programs are available for assisted living and Alzheimer's residents.

Cost: These could cost any where from $75 to $150 per day.

#### Home Care
Home care allows older people to remain in their own homes while receiving the assistance they need to help them remain independent.  Typically, home care involves providing assistance with Activities of Daily Living (ADLs) such as bathing, dressing and meal preparation or Instrumental Activities of Daily Living (IADLs) such as transportation, paying bills, making appointments and simply being there to provide companionship and emotional support. Home care services range from once a week to 24 hours a day depending on the needs of the client.

Cost: These could cost any where from $20 to $40 per hour.


text:
# permcheck

Permission Control

## Spec

permcheck specifies the action level of a certain role over certain permission:

```
    permcheck({role, perm, action})
      .then( ... )
      .catch( ... );
```

### role

`role` provides information of the attributes of a certain instance, such as an user. For example, assume an user with key `1` is a member of team `1`, `2`, `3` and access certain resource with a token `a`, then the `role` will be:

```
    {
      user: [1]
      team: [1,2,3]
      token: ["a"]
    }
```

### perm - by action level

In the meanwhile, the requested resource contains permission information for controlling access to it. It will be an object in following format:

```
    {
      list: [
        {type: "...", key: "...", action: "..."},
        ...
      ]
    }
```

Each entry in the list contains following fields:

 * type - can be `user`, `team`, `token` or any string defined by user, or `null` to apply to any request.
 * key - primary key for certain type.
 * action - what kind of action does this entry grant. could be user defined or one of following:
   - list: can access metadata of this resource.
   - read: can read full content of this resource.
   - write: can modify content of this resource.
   - admin: full control ( delete )

For default actions, admin action is by default can write, write action is by default can read, etc.

### perm - by action type

```
    {
      name: 'optional-group-name',
      list: [
        {type: "...", key: "..."},
        ...
      ]
      config: { ... }
    }
```

Additionally, if config is supplied within the perm object, permcheck will instead check if

 * `role` matches any entry in `list`
 * action is true in `config`.

`config` is an object with actions as each of its key.

If `perm` is an array, then permission should be granted if `role` matches any of the permission matched.

## Usage

To check permission for specific role over certain resource, prepare both `role` and `perm` object, and check for desired action:

```
    permcheck({role, perm, action})
      .then( ... )   # action granted
      .catch( ... ); # action denied
```

`action` could be an array ( for checking multiple actions ) or a simple string:

```
    permcheck({role, perm, action: ["read", "fork"]});
```

You can also ignore the `action` parameter at all for listing all granted actions for certain object:

```
    permcheck({role, perm}).then(function(actionList) { ... });
```

All available actions will be listed as strings ( above `actionList` argument ) with Promise.

### Multiple Permission Sets

You can combine multiple permission objects to make it easier to check through different set of permission rules:

```
    permcheck({role, perm: [perm1, perm2]}).then( ... );
```

For example, following example controls permission with a per-object permission and per-type permission:

```
    require("perms");
    objperm = {
      list: [
        {action: 'list'},
        {type: 'user', key: 1, action: 'read'},
      ]
    };
    role = {
      user: [2],
      role: ["reviewer"]
    };
    permcheck({role, perm: [objperm, perms.article]}).then( ... );
```

where perms can be a hardcoded file with following content:

```
    module.exports {
      article: {
        list: [
          {'type': 'role', 'key': 'admin', action: 'admin'},
          {'type': 'role', 'key': 'owner', action: 'admin'}
          {'type': 'role', 'key': 'reviewer', action: 'comment'}
        ]
      }
    };
```

## Compatibility

permcheck uses following modern APIs and thus might need polyfill for using in older browsers:

 * Array.isArray
 * Promise

## License

MIT

repository: plotdb/permcheck

repo_name: plotdb/permcheck


text:
# Güttli's opinionated Django Tips

# If you are new to Software Development

If you are new to software development, then there is a long road before you. But Django is a good choice, since it is a well established and very good documented framework.

First learn Python, then some HTML and CSS. Then Django and SQL.

After you learned the basics (Python, some HTML, some CSS), then use the [Django tutorial](https://docs.djangoproject.com/en/dev/intro/tutorial01/).

Avoid ReactJS or Vue, since you might not need them. First start with the traditional approach: Create HTML on
the server and send it to the web browser.

If you want to use a CSS library, then I recommend [Bootstrap5](https://getbootstrap.com/).

You can start with SQLite, but sooner or later you should switch to PostgreSQL.

My hint: Don't dive too deep into JavaScript. It is less important than most people think.

# How to extend the user model in Django?

The answer is simple: Don't extend the Django user model via inheritance and don't replace the original implementation.

Just use a [OneToOneField](https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.OneToOneField)

There is a nice article about how to integrate this into the admin: [Vitor Freitas "How to Add User Profile To Django Admin"](https://simpleisbetterthancomplex.com/tutorial/2016/11/23/how-to-add-user-profile-to-django-admin.html)

# Project vs App

It is important to understand the difference between a project and an application in the context of Django.
Please read [Projects and Applications](https://docs.djangoproject.com/en/3.1/ref/applications/#projects-and-applications)

I always try to keep the project small. The project is a small container. One projects contains several apps.
The project contains settings, but almost no code.

# Project `mysite`

I always call the project `mysite`, like in the Django tutorial.

This has the benefit that settings.py, pytest.ini, wsgi.py and many other
files are almost identical between my different projects.

# Templates

## Use CSS, not "cycle"

Don't use (or try to understand) the [Django cycle](https://docs.djangoproject.com/en/3.1/ref/templates/builtins/#cycle) templatetag. Today you don't need to alter the css class to create cebra-tables. Vanilla CSS is enough.

## How to debug Django's url resolving?

If you are new to a big project, you might not easily see which view function does handle an URL.

You can use [resolve()](https://docs.djangoproject.com/en/dev/ref/urlresolvers/#resolve) to get the answer:

```
import django
django.setup()
from django.urls import resolve
print(resolve('/foo/bar/'))

--> ResolverMatch(func=foocms.views.bar_handler, args=('/foo/bar/',), kwargs={}, url_name=foocms, ...)

```

Now you know that `foocms.views.bar_handler` will handle requests to the URL `/foo/bar/`.

## Keep opening and closing tag together

foo/start-overview.html
```
<table>
 <tr><th>Col1</th>...</tr>
 ...
```

foo/end-overview.html
```
</table>
```

===> NO!

Keep the opening and closing tag together!

foo/overview.html
```
<table>
 {% include 'foo/overview-heading.html' %}
 ...
</table>
```

# Django Debug Toolbar

The [Django Debug Toolbar](https://django-debug-toolbar.readthedocs.io/en/latest/) is really useful. I even enable it
in production.

# Testing

## pytest-django for Unittests

I use the library [pytest-django](https://github.com/pytest-dev/pytest-django). Their docs are good.

If you want to get an exception (as opposed to an empty string) if a template variable is unknown, then you can use this config:

pytest.ini:
```
[pytest]
DJANGO_SETTINGS_MODULE = mysite.settings
FAIL_INVALID_TEMPLATE_VARS = True
```

`FAIL_INVALID_TEMPLATE_VARS` causes the rendering of a template to fail, if a template variable does not exist. I like this. See Zen-of-Python "Errors should never pass silently."

See [pytest-django docs "fail for invalid variables in templates](https://pytest-django.readthedocs.io/en/latest/usage.html#fail-on-template-vars-fail-for-invalid-variables-in-templates)

## Avoid Selenium Tests

Selenium automates browsers. It can automated modern browsers and IE. It is flaky. It will randomly fail, and you will waste a lot of time.
Avoid to support IE, and prefer to focus on development.

[Google Trend "Selenium"](https://trends.google.com/trends/explore?date=all&q=%2Fm%2F0c828v) is going down.

I heared that PlayWright is modern solution to automate Chromium, Firefox and WebKit with a single API.

## html_form_to_dict()

If possible, I test methods without a http request in a small unittest.

On the other hand I would like to know if the html forms are usable by a web-browser.

I like to test my django forms like this:

1. I use `reverse()` to get an URL
1. I use the [pytest client](https://pytest-django.readthedocs.io/en/latest/helpers.html#client-django-test-client) to get a http response
1. I use [html_form_to_dict()](https://github.com/guettli/html_form_to_dict) to get a dictionary of the form which is in `response.content`
1. I set some values on `data`
1. I use the `client.post(url, data)` to submit the form

For an example, please see the README of [html_form_to_dict()](https://github.com/guettli/html_form_to_dict)

## Fixtures

Software test fixtures initialize test functions. They provide a fixed baseline so that tests execute reliably and produce consistent, repeatable, results.

I don't need [Django Fixtures](https://docs.djangoproject.com/en/3.1/howto/initial-data/). If I need data in a production systems, I can use a script or database migration.

If I need data for a test, then I use [pytest fixtures](https://docs.pytest.org/en/stable/fixture.html)

And I don't see a reason to use a library like [factory-boy](https://factoryboy.readthedocs.io/en/stable/). Pytest and Django-ORM gives me all I need.

# Django Typed Models

[Django Typed Models](https://github.com/craigds/django-typed-models) brings [Single Table Inheritance](https://en.wikipedia.org/wiki/Single_Table_Inheritance) to Django.

I like it for use-cases like this: Imagine you want to track the changes which get done by a user. The user creates an account,
then the user adds his address. Later he creates an order, ....

You could create a model like this:

```Python
class Log(models.Model):
    user = models.ForeignKey(User)
    time = models.DateTimeField(auto_add_now=True)
    action = ....
    data = models.JSONField()
```

`action` could be a CharField with choices, or a ForeignKey to a Model which contains all the possible choices as rows.

`data` stores the changes which fit to the specific action.

Example: the action "Order Created" needs a link to the relevant offer.

Every action has its own data schema.... Things get fuzzy if you use JSON.

OR you could use Single Table Inheritance:

```Python
class Log(TypedModel):
    user = models.ForeignKey(User)
    time = models.DateTimeField(auto_add_now=True)

class OrderCreatedLog(Log):
    offer = models.ForeignKey(Offer)
```

This way you don't need JSON, you can use database column to store the values.

# Django Packages Overview

[djangopackages.org](https://djangopackages.org/)

# htmx

If you follow the current hype, you get the impression that web applications must be build like this:

There is a backend (for example Django) which provides an http-API. This API gets used by a
JavaScript application written in Angular, React, or Vue.

Wait, slow down.

I think there is a simpler and more efficient way to develop an web application: Just create
HTML on the server side with Django.

To make your application load/submit HTML snippets (to avoid the full screen refresh) you can use [htmx](https://htmx.org).

# One Page, three forms

You want to create one HTML page which contains three forms. The Django forms library is great, but it does not solve this problem for you.

You could use [Prefixes for forms](https://docs.djangoproject.com/en/3.1/ref/forms/api/#prefixes-for-forms) and put your three django-forms
onto one big page. Depending on the context, this often feels too heavy.

That's where [htmx](#htmx) can help you: With htmx you can load/submit html fragments easily. No need to write a SPA (Single Page Application),
but if you want to, htmx gives you all you need.

# Responsive Web Design with Bootstrap

To make your HTML look good on mobile and desktop I use [Bootstrap5](https://getbootstrap.com/docs/5.0/getting-started/introduction/).

# Learn to distinguish between Django and Python

The Python ecosystem is much bigger than the Django ecosystem.

For example you want to visualize data.
Don't search for a django solution, search for a Python solution. For example: [Holoviews](https://github.com/holoviz/holoviews)

Or use a JS based solution. For example [d3](https://github.com/d3/d3)

# Avoid request.user

Imagine you write a page so that the user is able to edit his/her address. You use request.user and everything works fine.

Now you want to make the same form available
to a superuser, so that the superuser can edit the address of a user.

Now things get mixed up. Because `request.user` is not longer the user of the address ....

You can avoid the confusion if you avoid `request.user` and instead require that the caller explicitly gives you
an `user` object.

# Development Environment

In the past I had the whole stack installed in my local development environment (Apache or Nginx/Gunicorn), but
I don't do this any more. The `runserver` of Django is enough for development. You usualy don't need https during development, http is enough.

This contradicts the guideline that the development environment and the production environment should be equal.
The runserver reloads code fast,
which is great for a fluent "edit test" cycle.

I develop on Ubuntu Linux with PyCharm.

But I use PostgreSQL even for development. If you use the same username for your PostgreSQL-user like for your
Linux-user, then you don't need to configure a password for the database.

# Production Environment

I use a cheap VPS from Hetzner. Every system I run on the VPS has its own Linux user. Every Linux-User has a virtualenv in $HOME,
which gets activated in .bashrc. This is handy if you want to check something with SSH.

I run `gunicorn` webserver via an Systems like explained in the [Gunicorn Deploying Docs](https://docs.gunicorn.org/en/stable/deploy.html#systemd)

This way I can run several systems on one VPS. This means there are N gunicorn processes.

As reverse proxy and https endpoint I use Nginx.

Sooner or alter I will switch to containers, but at the moment my current setup works fine.

# Django's Jobs vs Webserver's Jobs

You should understand that's the job of the webserver to provide `https` (Certificates ...) or to compress the responses.

It makes no sense to use the Django [GZipMiddleware](https://docs.djangoproject.com/en/dev/ref/middleware/#module-django.middleware.gzip).

# Backup

First I run pg_dump, then [timegaps](https://pypi.org/project/timegaps/) to remove outdated dumps, then rsync to a second VPS.

# Login via Google, Amazon, ...?

Use [django-allauth](https://django-allauth.readthedocs.io/en/latest/)

# Static files

Use the library WhiteNoise, [even during development](http://whitenoise.evans.io/en/latest/django.html#using-whitenoise-in-development)

# Ask Questions

Asking questions is important. It pushes you and others forward.

But you need to dinstinguish between vague and specific questions.

## Vague Question?

Ask in the [Django Forum](https://forum.djangoproject.com/) or in a Django Facebook Group. For example [Django Python Web Framework](https://www.facebook.com/groups/python.django)

For example: "Which library should I use for ...".

## Specific Question?

Ask on [Stackoverflow](https://stackoverflow.com/questions/tagged/django)

The best questions provide some example code which can be executed easily. This increases the likelihood that
someone will provide an answer soon.

If your code creates a stacktrace, then please add the whole stacktrace to the question.

# Survey

[Community Survey 2020](https://www.djangoproject.com/weblog/2020/jul/28/community-survey-2020/)

Unfortunately not that cool like [state of js](https://stateofjs.com/) or [state of css](https://stateofcss.com/),
but the Django Survey gives you a nice overview, too.

# FBV vs CBV

"Function based Views" vs "Class based Views".

I like both.

CBV have some draw-back. If something does not work the way you want, then it is harder to debug the root-cause.

Example:

```
class MyView(FormView):
    form = MyForm
```

This will give you:

```
TypeError 'NoneType' object is not callable

.../django/views/generic/edit.py, line 33, in get_form
 return form_class(**self.get_form_kwargs())
 ```

 It will need some time to detect the root-cause. In this example the reason is a typo. You need to use `form_class = MyForm`.

# Uncaught Exception Handling: Sentry

During development on your local machine you get a nice debug-view if there is an uncaught exception.

On the production system you get a white page "Server Error (500)".

And of course, you want to know if users of your site get server error.

Personally I prefer simple open source solutions to free and great commercial solutions. But in this case I settled with [Sentry](//sentry.io/).

It is simple to set up, is free and shows all uncaught exceptions in an easy to use web GUI.

And Sentry is a [Gold Corporate Member](https://www.djangoproject.com/foundation/corporate-members/) of the Django Software Foundation.

# Uptime Monitoring

Sentry won't help you, if there is something broken and your http server does not start. To be sure that your site is running you can use a free service.
There are several, I use https://uptimerobot.com/

They check your site every N minutes from outside via https.

# Page Speed

You can use [Lighthouse](https://developers.google.com/web/tools/lighthouse) (via Chrome) or [PageSpeed Insights (Google)](https://developers.google.com/speed/pagespeed/insights/) to check your page.

# Software built with Django

* [OpenSlides](https://openslides.com/) OpenSlides is the all-in-one solution for running your plenary meetings and conferences.
* [Taiga](https://github.com/taigaio/taiga-back) Agile project management platform. Built on top of Django and AngularJS
* [Saleor](https://saleor.io/) e-commerce plattform

# Things which could get improved

"There are only two hard things in Computer Science: cache invalidation and naming things."

In ModelForm it is called "instance". In a class-based-view it is called "object". In Admin templates it is called "original". It would be nice to have **one** term for the thing.

# Dependecies to non-Python packages

Example: include a JS library like Bootstrap:

https://github.com/xstatic-py/xstatic

# Related

* [Güttli django-htmx-fun](https://github.com/guettli/django-htmx-fun) Small intro to htmx.
* [Güttli's opinionated Python Tips](https://github.com/guettli/python-tips)
* [Güttli, why I like PyCharm](https://github.com/guettli/why-i-like-pycharm/)
* [Güttli working-out-loud](https://github.com/guettli/wol)

repository: Tuhin-thinks/django-tips

repo_name: Tuhin-thinks/django-tips


text:
# Ansible user role

An ansible role that creates a user for running playbooks and allows connections via SSH for users from `ansible_users` list (using public keys).

The role includes the following tasks:

1. Create a group `ansible_playbook_group` for an ansible user.
2. Create a user `ansible_playbook_user` for processing ansible tasks. Add the user to the newly created group.
3. Set sudo rights for the ansible user.
4. Authorize users from `ansible_users` to login as an ansible user via SSH.

This role can be run under all versions of Ubuntu and Debian.

## Requirements

None

## Role Variables

Available variables are listed below, along with default values (see `defaults/main.yml`):

```yaml
ansible_playbook_user: ansible      # An ansible user and a group to create
ansible_playbook_group: ansible
```

After that you can use the created account to login as an ansible user. Add existed users (see `users_accounts` variable, ansible role `users`) to the `ansible_users` list in the playbook to do that (see `vars/users.yml`).

```yaml
ansible_users: []     # A list of ansible users
```

For each user you need to specify `name` (required) and an SSH public key as `key` (required). You can also add `state` parameter (by default, it's `present`). Set `absent` to revoke the user authorization as an ansible user.

```yaml
ansible_users:
  - name: ""      # A user name
    key: ""       # An SSH user public key as a string or (since 1.9) url
```

## Dependencies

None

## Example Playbook

```yaml
- hosts: all
  roles:
    - role: ansible-user
  vars_files:
    - vars/users.yml
```

Inside `vars/users.yml`:

```yaml
ansible_users:
  - name: alex    # Allow the user `alex` to login as an ansible user via SSH with the key:
    key: "{{ lookup('file', 'files/public_keys/alex.pub') }}"
    state: present
  - name: jack
    key: "{{ lookup('file', 'files/public_keys/jack.pub') }}"
    state: present
```

where `files/public_keys/alex.pub` is a user public key.

## License

Licensed under the [MIT License](https://opensource.org/licenses/MIT).

repository: cimon-io/ansible-role-ansible-user

repo_name: cimon-io/ansible-role-ansible-user


text:
# eini

[![Build Status](https://travis-ci.org/jeffutter/eini.svg?branch=master)](https://travis-ci.org/jeffutter/eini)

`eini` is a utility for managing a collection of secrets in source control. The
secrets are encrypted using [public
key](http://en.wikipedia.org/wiki/Public-key_cryptography), [elliptic
curve](http://en.wikipedia.org/wiki/Elliptic_curve_cryptography) cryptography
([NaCl](http://nacl.cr.yp.to/) [Box](http://nacl.cr.yp.to/box.html):
[Curve25519](http://en.wikipedia.org/wiki/Curve25519) +
[Salsa20](http://en.wikipedia.org/wiki/Salsa20) +
[Poly1305-AES](http://en.wikipedia.org/wiki/Poly1305-AES)). Secrets are
collected in an ini file, in which all the string values are encrypted by default. Public
keys are embedded in the file, and the decrypter looks up the corresponding
private key from its local filesystem or stdin.

`eini` is based on [ejson](http://github.com/shopify/ejson) using the same encryption code, while offering a more human-readable ini format and optional unencrypted values.

The main benefits provided by `eini` are:

* Secrets can be safely stored in a git repo.
* Changes to secrets are auditable on a line-by-line basis with `git blame`.
* Anyone with git commit access has access to write new secrets.
* Decryption access can easily be locked down to production servers only.
* Secrets change synchronously with application source (as opposed to secrets
  provisioned by Configuration Management).
* Simple, well-tested, easily-auditable source.

## Installation

You can download binaries from [Github Releases](https://github.com/jeffutter/eini/releases)

## Workflow

### 1: Create the Keydir

By default, EJSON looks for keys in `/opt/ejson/keys`. You can change this by
setting `EJSON_KEYDIR` or passing the `-keydir` option.

```
$ mkdir -p /opt/ejson/keys
```

### 2: Generate a keypair

When called with `-w`, `eini keygen` will write the keypair into the `keydir`
and print the public key. Without `-w`, it will print both keys to stdout. This
is useful if you have to distribute the key to multiple servers via
configuration management, etc.

```
$ eini keygen
Public Key:
63ccf05a9492e68e12eeb1c705888aebdcc0080af7e594fc402beb24cce9d14f
Private Key:
75b80b4a693156eb435f4ed2fe397e583f461f09fd99ec2bd1bdef0a56cf6e64
```

```
$ ./eini keygen -w
53393332c6c7c474af603c078f5696c8fe16677a09a711bba299a6c1c1676a59
$ cat /opt/ejson/keys/5339*
888a4291bef9135729357b8c70e5a62b0bbe104a679d829cdbe56d46a4481aaf
```

### 3: Create an `eini` file

The format is described in more detail [later on](#format). For now, create a
file that looks something like this. Fill in the `<key>` with whatever you got
back in step 2.

Create this file as `test.eini`:

```ini
_public_key = <key>
database_password = 1234password
```

### 4: Encrypt the file

Running `eini encrypt test.eini` will encrypt any new plaintext keys in the
file, and leave any existing encrypted keys untouched:

```ini
_public_key = 63ccf05a9492e68e12eeb1c705888aebdcc0080af7e594fc402beb24cce9d14f
database_password = EJ[1:WGj2t4znULHT1IRveMEdvvNXqZzNBNMsJ5iZVy6Dvxs=:kA6ekF8ViYR5ZLeSmMXWsdLfWr7wn9qS:fcHQtdt6nqcNOXa97/M278RX6w==]
```

Try adding another plaintext secret to the file and run `eini encrypt
test.eini` again. The `database_password` field will not be changed, but the
new secret will be encrypted.

### 5: Decrypt the file

To decrypt the file, you must have a file present in the `keydir` whose name is
the 64-byte hex-encoded public key exactly as embedded in the `eini` document.
The contents of that file must be the similarly-encoded private key. If you used
`eini keygen -w`, you've already got this covered.

Unlike `eini encrypt`, which overwrites the specified files, `eini decrypt`
only takes one file parameter, and prints the output to `stdout`:

```
$ eini decrypt foo.eini
_public_key = 63ccf05a9492e68e12eeb1c705888aebdcc0080af7e594fc402beb24cce9d14f
database_password = 1234password
```

## Format

The `eini` document format is simple, but there are a few points to be aware
of:

1. It's just an ini file.
2. There *must* be a key at the top level named `_public_key`, whose value is a
   32-byte hex-encoded (i.e. 64 ASCII byte) public key as generated by `eini
   keygen`.
3. Any string literal that isn't an object key will be encrypted by default (ie.
   in `a = b`, `"b"` will be encrypted, but `"a"` will not.
4. If a key has a `#decrypted` comment at the end of the line or on the preceding
   line, its corresponding value will not be encrypted.

repository: jeffutter/eini

gha_language: Go

repo_name: jeffutter/eini


text:
To bypass, the scripts
automatically expose an `XLSX` variable that can be used if the require callback
argument is `_XLSX` rather than `XLSX`:

```js
require(["xlsx.full.min"], function(_XLSX) { /* ... */ });
```

This demo uses the `r.js` optimizer to build a source file.

repository: stephensong/js-xlsx

repo_name: stephensong/js-xlsx


text:
# Introduction

NOTE: The documentation is a work in progress and is being integrated into GitHub Pages here:
[https://jacknino.github.io/MessageSerializer/](https://jacknino.github.io/MessageSerializer/):

The MessageSerializer is intended to allow the user to define a class in C# that corresponds
to a message that will actually be sent/received as a string of bytes.  The MessageSerializer
is designed to do the conversion from the string of bytes into the class and vice-versa.

Currently the structure of the message can either be defined purely through the class definition
and a series of attributes or through an XML definition.

**Note**: The MessageSerializer uses Reflection to determine how to process messages.
When using the attribute method of loading the class description it uses an unofficial feature
that presumes that when reflecting through a class the properties will be returned in order.  .NET does not actually guarantee
that will be the case but it seems to hold true in practice.  If this is a concern, use the XML
file method of defining your class

# Example

As a very simple example take this example message:

`[1 byte MessageType][1 byte Length][2 bytes Id]`

We will say the MessageType is 0x23 and the Id is 0x1234.
The length is the length of the rest of the message, so 2.
For this example we will say that multi-byte values are sent LSB.

In that case the message being sent would be:

`[0x23][0x02][0x34][0x12]`

To declare a class for this message you could use:

```
public class SampleMessage : IMessageSerializable
{
    public byte MessageType { get; set; }
    public byte Length { get; set; }
    public ushort Id { get; set; }
}
```

Then to use the class:

```
using MessageSerializer;

SampleMessage sampleMessage = new SampleMessage();
sampleMessage.MessageType = 0x23;
sampleMessage.Id = 0x1234;

byte[] sampleMessageSerialized = Serializer.Instance.Serialize(sampleMessage);
SampleMessage sampleMessageDeserialized = Serializer.Instance.Deserialize<SampleMessage>(sampleMessageSerialized);
```

A couple things to note:
* The SampleMessage class inherits from IMessageSerializable.  That is currently required but will be removed in the future as it isn't providing any functionality and is unnecessary.
* Currently the fields for the messages must be defined as Properties in the class definition.  This will be expanded in the future to support fields and possibly functions.
* There aren't any attributes on the properties.  The MessageSerializer does it's best to figure out as much as it can just from the definition of the properties, such as:
  * Numeric fields default to being the size of the variable being used to store them
  * Properties named Length are expected to be the Length field and default to it representing the rest of the bytes in the message
* The MessageSerializer will figure out what a Length field should be set to and will set it automatically.
* When you Serialize or Deserialize using a particular class and you haven't purposely loaded it beforehand, its first usage will cause the MessageSerializer to process the class and configure how that class should be used

# How To Define Properties

This section is intended to outline how to define different types of Properties and the options you can use to affect
how they are interpreted when serializing or deserializing.

Because the XML file format essentially recreates the Property/Attribute format when using the attributes to configure
how a class should be processed, for the most part the instructions here will only mention the attributes.

## Standard Numeric Fields

As a general rule if have a numeric property you should just declare the property to be of the type that fits
with the data in the message.

If you have a 1 byte value you normally would define the property as a `byte`, a 2-byte field would either be
a `short` or `ushort`, etc.

**TODO: Currently this feature is broken so numeric types need to be defined as the same type as fits the output size**
If for some reason you don't want the number of bytes that the numeric value takes up in the message to match the number
of bytes that the numeric type takes up you can use the Length property of the MessageSerializedProperty attribute to
indicate how many bytes the value should actually take up

```
[MessageSerializedProperty(Length = 10)]
ushort Takes10Bytes { get; set; }
```

## BCD Numeric Fields

Numeric values that should be sent as BCD work the same as regular numerics except for the length
that they take up is not just the size of the variable but the minimum number of bytes that it would
take to hold the maximum value that the numeric type could hold.

As an example, since the maximum value a `ushort` could hold is 65535, this requires at least two and a half bytes.
Therefore, the number of bytes used would be 3 by default.

These end up being the default lengths:
* byte = 2 bytes
* ushort = 3 bytes
* uint = 5 bytes
* ulong = 10 bytes

Note that it doesn't make sense to use a signed value for a BCD property since BCD doesn't have the concept
of a negative number.

There are two ways to indicate that a property should be treated as BCD.  You can either start the name
of the property with Bcd, like BcdMeterValue or you can set the IsBcd property of MessageSerializedProperty
to true.

Note that if you start the name of a property with Bcd but it isn't supposed to be treated as Bcd you must set IsBcd to false.

## Enums

Enums are essentially treated the same way as a standard numeric type matching the underlying numeric type that holds the enum
and the value of the enum is what will be serialized into the message.

## Date/Time

DateTime types are serialized based on 3 parameters:
* Format (defaults to `MMddyyyyHHmmss`) and conforms to the ToString specification for DateTime types
* IsBcd (defaults to true for DateTime types) determines if the resulting value is serialized as BCD or as a number.
Currently only IsBcd = true is supported
* Length (defaults to the length of Format / 2) determines the final length of the value.  Currently only the default is supported.

## Strings

Strings are sent as their ASCII equivalents (currently no Unicode support) but can take a variety of forms
* NULL terminated or not
* Fixed length (NULLs being used for any bytes beyond what the length supports)
* Variable length (based on length bytes)
* Variable length with a maximum length

Here are some general rules
* The Length property of MessageSerializedProperty should be set to make the string field a fixed length
* If a string is shorter than the number of bytes it is allowed to occupy in a fixed length string field any remaining bytes will be NULLs.
* When a string is longer than the length it is allowed to be in a fixed length string field, it will be truncated and will not be null-terminated
* A string is variable length by default or can be be explicitly made variable length by using IsVariableLength = true of MessageSerializedProperty
* If a string is to be variable length, then it should either be the only variable length field in the message or it should be part of a blob pair

## Length Bytes

Many messages are not fixed in length and therefore have a length property.  The MessageSerializer is designed so that rather than
the user's code having to determine how long a message is in order to fill in the length property the MessageSerializer will calculate
the length and not only include it in the serialized bytes but set the value in the class structure.

Here are some rules for `Length` properties:
* There can only be one `Length` property per message
* A property can be excluded from the length calculation when it otherwise would have been included by setting the
`ExcludeFromLength` property of the `MessageSerializedProperty` attribute to `true`.
* There are three length types that are supported: `EntireMessage`, `RestOfMessageIncludingLength` and `RestOfMessage`.
The `Length` property can be designated by setting the `MessageLengthType` property of the `MessageSerializedProperty` attribute
on the appropriate property to one of the three values.  The meaning of the values are as follows:
  * `EntireMessage` sets the length to the number of bytes in the entire message except for those bytes that have been specifically excluded.
  * `RestOfMessageIncludingLength` sets the length to the number of bytes that occur starting from the `Length` field until the
  end of the message except for those bytes that have been specifically excluded.
  * `RestOfMessage` is the same as `RestOfMessageIncludingLength` except the `Length property itself is not included in the
  length calculation.
* By default, if a property is named `Length` it will be assumed to be a length field of type `RestOfMessage` as long as there
isn't another property that is specifically designated as the `Length` property.  If a property meets these conditions but
shouldn't actually be considered the `Length` property it should have its `MessageLengthType` property of the
`MessageSerializedProperty` attribute set to `None`.

## Blob Fields (Length/Value Pairs)

Often there will be more than one field in a message that is variable length.  For those fields, there is usually a length field
that is specifically for the variable length field.  These length/value pairs in the MessageSerializer are referred to as Blob Fields.

They can be defined by using the `BlobType` property of the `MessageSerializedProperty` attribute as shown:

```
[MessageSerializedProperty(BlobType = BlobTypes.Length)]
int BlobLength { get; set; }
[MessageSerializedProperty(BlobType = BlobTypes.Data)]
string BlobData { get; set; }
```

Some notes:
* Similar to `Length` properties in a message the MessageSerializer will compute and automatically fill in the
Blob Length property.
* The Data field does not actually have to be a variable length type and it can also be an IMessageSerializable
class or a List of some type (and thus actually contain multiple fields).
* There can be any number of Blob Fields in a message.
* If a Blob Length field is detected, by default the next encountered Blob Data property is expected to be the Data
associated with that Length. If a different property should be used the `AssociatedBlobProperty` property of the
`MessageSerializedProperty` of the Blob Length property should be set to the name of the property that the data
should be associated with.

As an example of the `AssociatedBlobProperty` in the following example class, `MeterSize2` will be associated with `BcdValue2`
and `MeterSize` will be associated with `BcdValue` even though neither Length/Value pair appear next to each other in the message
and they occur in a different order in the message.

```
public class DoubleGapBlob : IMessageSerializable
{
	[MessageSerializedProperty(BlobType = BlobTypes.Length, AssociatedBlobProperty = "BcdValue2")]
	public byte MeterSize2 { get; set; }

	[MessageSerializedProperty(BlobType = BlobTypes.Length)]
	public byte MeterSize { get; set; }

	public int SomeOtherField { get; set; }
	public short OtherField { get; set; }

	[MessageSerializedProperty(BlobType = BlobTypes.Data)]
	public ulong BcdValue { get; set; }

	[MessageSerializedProperty(BlobType = BlobTypes.Data)]
	public int BcdValue2 { get; set; }
}
```

## Message Authentication

The MessageSerializer supports automatically calculating message verification codes from the bytes of a message.

There are multiple built in verification methods:
* CRC16 (should have a type of ushort) - AuthenticationCrc16
* CRC32 (should have a type of ulong) - AuthenticationCrc32
* SHA-1 (should have type of byte[]) - AuthenticationSha1
* SHA-256 (should have type of byte[]) - AuthenticationSha256
* SHA-512 (should have type of byte[]) - AuthenticationSha512

To compute an authentication value create a field and set the `AuthenticationClass` property of the `MessageSerializedProperty` attribute
to the Type of the class that has the calculation mechanism you want to use.  The class should be of type `AuthenticationBase`
and the type of the property that will hold the value should be of the same type that the `AuthenticationClass` is designed to
return.

When there is an authentication field, it is expected that all of the fields in the message (except the Authentication field itself)
will be included in the calculation unless you mark them with `ExcludeFromAuthentication = true` in the `MessageSerializedProperty` attribute.

Here is a simple example:
```
public class

Note: If the name of a property starts with Crc it will default to being a CRC16 field and defaults to being excluded from the calculation

## Lists

## Sub-classes

## Excluding Property

If you want to exclude a public property that would otherwise be included in serialization/deserialization
set the `Exclude` property of the `MessageSerializedProperty` attribute to `true`.

repository: jacknino/MessageSerializer

repo_name: jacknino/MessageSerializer


text:
![logo](https://github.com/bioneos/backup-system/blob/devel/public/img/mark.png)

# Alcove Backup System

Yes... we now have a name!

The Bio::Neos backup system has a long history, starting as a BASH script
written by @rossj when he was a high school intern for us, then later converted
to a Ruby script, with an addition of Sinatra for a basic monitoring web
interface, then an initial porting to NodeJS by @malyon. After the port of the
Ruby version, more or less directly, we needed to do a big reorganization to
adjust to Node / JS norms. Although I am sure we still have a long way to
go with this, the basic functionality in this updated version is mostly in
place.

Now we have decided to put this in a more public location before finishing
the work on it, enter: GitHub. If you would like to contribute, comment, or
just review the system -- go ahead and browse around. We welcome any and all
helpful commentary.

## Requirements

Required version of Node.js: **10.x**

Older versions might work as well, but recent development has been using this
version of Node exclusively.

## Usage

The system will not start without a system config and at least one machine config.

### System Config

Look at the example in `<project_root>/etc/alcove/alcove.ini.example`. Your config only
needs to contain the *required* options that don't have defaults (`data_dir`,
`notifications.email_to` & `notifications.email_from`)

### Machine Config

Look at the example in `<project_root>/etc/alcove/machines/machine.ini.example`. Your
config only needs to have the *required* options. (`name`, `ip`, and `schedule`)

### Connections

The system using rsync over an SSH connection, and works best if you do not have
to worry about permission issues. For this reason, the system should be authorized
to connect to the remote machine using the `root` user with an strong SSH Key Pair.
By default, the connection will use the identity of the user that runs the system
(`~/.ssh/id_rsa`), but we suggest generating a new identity just for this system,
and to enable automated operation you cannot set a passphrase with this key.

```
$ ssh-keygen -f <project_root>/etc/backup/id_rsa
```

Within your config specify this identity with the option `rsync.identity` by
setting it equal to the location of the private key `id_rsa` with the public key
accessible at the same level.

Be sure to set the appropriate username and permissions if the key is generated by
a user different than the one that will be used to execute this system.

license: ISC


text:
---
path: "/posts/l4w9"
title: "Simple foreach loop to output an array value only if it's from today or a future date."
author: "JD Tadlock"
---

Simple, but may come in handy for any beginners out there. ;)

So, let's say we have a multidimensional array with arrays of events inside. Example:
```
<?php
$eventArray = [
  'events' => [
	[
	'title'		=> "Some Title Here",
	'date' 		=> "December 3rd, 2015",
	'speaker'	=> "John Smith",
	'description'=> "A brief description of event here"
	],
	[
	'title'		=> "Another Event",
	'date' 		=> "October 10th, 2016",
	'speaker'	=> "Brad Bradley",
	'description'	=> "Another brief description of event here.  Shank pork belly leberkas hamburger, short ribs shoulder salami strip steak. Filet mignon tongue doner tenderloin kielbasa cupim meatloaf turducken kevin shank prosciutto ham hock meatball alcatra.  Kevin picanha leberkas pastrami ribeye andouille. Pancetta shank turkey, tongue ball tip pastrami chuck beef ribs. Landjaeger prosciutto tail, bresaola shank bacon ball tip beef salami ham hock tri-tip hamburger."
	],
	[
	'title'	        => "One More Event",
	'date' 		=> "November 12th, 2015",
	'speaker'	  => "Janet Wilson",
	'description'	  => "Yet another brief description of event here"
	]
];
?>
```

This array could either be at the top of your page before the html content, or better yet saved into another file. Let's say we save it into another file in the same directory. Example: (EventsArray.php)
- Now at the top of the index.php file let's require it.

```
<?php

require_once('EventsArray.php');

```

We will now use the PHP strtotime() function to convert today's date into a number.
The output would be a string "October 12th, 2015" using just the date() function.
When we wrap the date() function in the strtotime() function we get<PHONE_NUMBER>.
We can use this to logically test if the date value in our array is greater than or equal to $today's value.

Below our require, let's create a variable and store today's date wrapped in the strtotime() function.
```
$today = strtotime(date('F jS, Y'));

```
Let's close our php block and add the html header code for the page
```
?>
<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Untitled</title>
        <style><!--  We'll iterate through the arrays and check the 'date' value to see if the number outputted is equal to or greater than $today's value. In our if() statement we'll use the strtotime() function once again to convert the 'date' value from the array into a number.
```
		<?php foreach ( $eventArray as $events ) {
			foreach ( $events as $array => $key ) {
				if ( strtotime($key['date']) >= $today ) { ?>

<?php echo $key['title']; ?>

<?php echo $key['date']; ?>

<?php echo $key['speaker']; ?>

<?php echo $key['description']; ?>

		<?php } } } ?>

```

Now, play around with the EventsArray and change some dates. As long as you keep the same format, you can make them any date you wish(ex. January 1st, 2016). If you change one of them to a past date, you'll see that the foreach won't output that event. Enjoy!

repository: codebeeio/archive

repo_name: codebeeio/archive


text:
# QTI Gem

The Qti gem supports QTI 1.2 and 2.1. It currently supports the following interaction types:

  - True/False
  - Multiple Choice
  - Multiple Answer

## Installation

```sh
$ cd your_project
$ bundle install qti
```

## Usage

```rb
require 'qti'
@gem = Qti::Importer.new(path_of_quiz)
```

You can use the gem to access the manifest, the assessments, and the assessment
items and use it in your own code!

### Available methods

   - `import_manifest`

Returns the version appropriate href from the manifest.xml

   - `test_object`

Returns the version appropriate Assessment/AssessmentTest model

  - `create_assessment_item(assessment_item_ref)`

Returns the version appropriate AssessmentItem model

#### Available Methods on the Assessment (QTI 1.2)
  - `title`
  - `assessment_items`

#### Available Methods on the AssessmentTest (QTI 2.1)
  - `title`
  - `assessment_item_reference_hrefs` (the hrefs of the xml files in the assessment.xml)
  - `test_parts`
  - `assessment_sections`

#### Available Methods on the AssessmentItem
  - `identifier`
  - `title`
  - `points_possible`
  - `rcardinality` (QTI 1.2)
  - `interaction_model` (ie Choice Interaction)
  - `scoring_data_structs`

## Development

A simple docker environment has been provided for spinning up and testing this
gem with multiple versions of Ruby. This requires docker and docker-compose to
be installed. To run specs, run the following:

```bash
docker-compose build --pull
docker-compose run --rm app
```

This will install the gem in a docker image with all versions of Ruby installed,
and install all gem dependencies in the Ruby 2.5 set of gems. Then it will run
[wwtd](https://github.com/grosser/wwtd), which runs all specs across all
supported versions of Ruby and gem dependencies.

The first build will take a long time, however, docker images and gems are
cached, making additional runs significantly faster.

Individual spec runs can be started like so:

```bash
docker-compose run --rm app bash -lc \
  "BUNDLE_GEMFILE=spec/gemfiles/rails-6.1.gemfile rvm-exec 2.7 rspec"
```

If you'd like to mount your git checkout within the docker container running
tests so changes are easier to test, use the override provided:

```bash
cp docker-compose.override.example.yml docker-compose.override.yml
```

## Contributing

Bug reports and pull requests are welcome on GitHub at:

- https://github.com/instructure/qti

## License

The gem is available as open source under the terms of the
[MIT License](http://opensource.org/licenses/MIT).

repository: instructure/qti

gha_language: Ruby

repo_name: instructure/qti


text:
# Flickr

Image Slideshow using [Flickr open API](https://www.flickr.com/services/feeds/docs/photos_public/)

Used MVVM based architecture pattern

## Features

* Using [RxSwift, RxCocoa](https://github.com/ReactiveX/RxSwift) for reactive programming
* Using [SDWebImage](https://github.com/rs/SDWebImage) to handle images
* Using [ViewModelBindable](https://github.com/makesource/ViewModelBindable) for easy ViewModel binding
* Using [ReactorKit](https://github.com/devxoul/ReactorKit)

## Requirements

* iOS 9.0+
* Swift 4.0
* Cocoapods

## Screenshots

## License
Flickr is available under the MIT license. See the LICENSE file for more info.

repository: seongwonbang/Flickr

repo_name: seongwonbang/Flickr


text:
---
layout: default
title:  "BITBOX Explorer"
date:   2018-03-14
---

Each time you start BITBOX it creates a fresh Bitcoin Cash blockchain just for you. This blockchain doesn't connect to the actual $BCH network and only consists of blocks and transactions which you create locally so it's quick and responsive. You can mine new blocks with the click of a button and the coinbase reward will go to the first account in your BITBOX wallet.

![Blockchain]({{ "/assets/blockchain.png" | absolute_url }})

Click on any block to learn more.

## Blocks

Each block consists of an index, timestamp, array of transactions and the previous block's header. All of these are hashed and stored as the block's header.

![Block]({{ "/assets/block.png" | absolute_url }})

Click on any transaction to learn more.

## Transactions

Transactions consist of the value, transaction encoded as hex, timestamp, hash, inputs and outputs.

![Transaction]({{ "/assets/transaction.png" | absolute_url }})

### Inputs

Inputs consist of hex, inputPubKey and script.

### Outputs

Outputs consist of hex, outputPubKey and script.

## Search

BITBOX now has a search field at the top right into which you can input a block height/hash or a transaction hash/rawHex and you'll be redirected to that page.

![Search]({{ "/assets/searchbar.png" | absolute_url }})

## Summary

BITBOX is a full local $BCH blockchain. It's quick and responsive. You can now easily explore your BITBOX via search or clicking from block to transaction.

[More info](https://www.bitbox.earth/bitboxcli/bitcoincash)

repository: bigearth/bitblog

repo_name: bigearth/bitblog


text:
This page explains how to set up Zipkin on a single Mac (typically for local
testing) with Cassandra, the most common choice of database for use with Zipkin.
To run Zipkin out of the box without using Cassandra, see
[install.md](https://github.com/openzipkin/zipkin/blob/master/doc/install.md).

Scala 2.11.7 or later is required.

## Installing Cassandra

[Install Homebrew](http://mxcl.github.io/homebrew/) if you haven't already. It
will make your life easier. Then run the following commands to install
and set up Cassandra:

```bash
# Cassandra is the most common choice, though Zipkin supports other databases
brew install cassandra
# Start Cassandra on login
ln -sfv /opt/twitter/opt/cassandra/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.cassandra.plist
```

## Install Zipkin

Now we can install Zipkin itself:

```bash
# WORKSPACE is wherever you want your Zipkin folder
cd WORKSPACE
# If you don't have git, `brew install git` or just download Zipkin directly
git clone https://github.com/openzipkin/zipkin.git
cd zipkin
# Install the Zipkin schema
cassandra-cli -host localhost -port 9160 -f zipkin-cassandra/src/schema/cassandra-schema.txt
```

## Run Zipkin

Now you can run Zipkin (you'll need to leave these processes running, so use
separate bash windows if you're doing it that way):

```bash
# Collect data
bin/collector cassandra
# Extract data
bin/query cassandra
# Display data
bin/web
```

Zipkin should now be running and you can access the UI at http://localhost:8080/

## Next Steps

The next step is to collect trace data to view in Zipkin. To do this, interface
with the collector (e.g. by using Scribe) to record trace data. There are
several libraries to make this easier to do in different environments. Twitter
uses [Finagle](https://github.com/twitter/finagle/tree/master/finagle-zipkin);
external libraries (currently for Python, REST, node, and Java) are listed in the
[wiki](https://github.com/openzipkin/zipkin/wiki#external-projects-that-use-zipkin);
and there is also a [Ruby gem](https://rubygems.org/gems/finagle-thrift) and
[Ruby Thrift client](https://github.com/twitter/thrift_client). Additional
information is available in
[install.md](https://github.com/openzipkin/zipkin/blob/master/doc/install.md).

repository: elodina/zipkin

repo_name: elodina/zipkin


text:
---
layout:     post
title:      CAS Vulnerability Disclosure
summary:    Disclosure of a security issue with the CAS software.
tags:       [CAS]
---

# Overview

This is the initial version of an [Apereo CAS project vulnerability disclosure](https://apereo.github.io/cas/developer/Sec-Vuln-Response.html), describing an issue in CAS that affects multifactor authentication using the `mfa-simple` mode. All other multifactor authentication integrations are unaffected by this vulnerability.

When CAS is configured to act as a multifactor authentication provider in `mfa-simple` mode, the validation process that accepts a token from the user is not
enforcing token ownership. As a result, any valid token that may not have been issued to the user could be used as he multifactor authentication token
to successfully complete the authentication transaction.

# Credits

Special thanks to Pavlos Drandakis, member of the [GUnet Identity Team](www.gunet.gr) for originally reporting
the issue to the CAS application security group as well as preparing and contributing an immediate fix.

# Affected Deployments

The attack vector applies to deployments of the CAS server for the following versions:

```
- 6.0.x
- 6.1.x
```

# Severity

To fully exercise a breach, an attacker must have already obtained a valid multifactor authentication token issued by CAS. The attacker
would then need to *somehow* hijack the user's in-progress authentication attempt, or have access to their credentials already to login, and
supply their own token instead of one issued to and shared with the active user.

The severity of this issue is considered medium for CAS. It is recommended that upgrades be carried out to removes any chances of security breaches.

# Patching

Patch releases are available to address CAS deployments. Upgrades to the next patch version for each release should be a drop-in replacement.

## Timeline

The issue was originally reported to the CAS application security team on November 21st, 2019 and upon confirmation, CAS was patched on November 22nd.

## Procedure

### 6.0.x

Modify your CAS overlay to point to the version `6.0.7`. A snippet of a `gradle.properties` for a CAS overlay follows:

```properties
cas.version=6.0.7
```

### 6.1.x

Modify your CAS overlay to point to the version `6.1.2`. A snippet of a `gradle.properties` for a CAS overlay follows:

```properties
cas.version=6.1.2
```

### 6.2.x

Modify your CAS overlay to point to the version `6.2.0-RC1`, *when released*. A snippet of a `gradle.properties` for a CAS overlay follows:

```properties
cas.version=6.2.0-RC2
```

# Support

CAS is Apache v2 open source software under the sponsorship of the Apereo Foundation, supported by community
volunteers and enthusiasts. Support options may be [found here](https://apereo.github.io/cas/Support.html).

# Resources

* [CAS Security Vulnerability Response Model](https://apereo.github.io/cas/developer/Sec-Vuln-Response.html)
* [CAS Maintenance Policy](https://apereo.github.io/cas/developer/Maintenance-Policy.html)

On behalf of the CAS Application Security working group,

[Misagh Moayyed](https://fawnoos.com)

gha_language: SCSS


text:
# DFA Minimization - Direct DFA construction

Enter a regexp, then get your minimized DFA & direct DFA creation.

## Getting Started

Fork the project or download it. Then just add the project
to your prefered IDE or compile it from Console.

## Video Demonstration & Results Documentation

IMPORTANT: for the documentation please see:

```
\doc\LAB_4_RESULTS_BRO15105.pdf
```

You can see a demonstration at:

```
https://youtu.be/55QhKtiMM0k
```

Note: video is in spanish.

### Prerequisites

Java SE8. SDK 8.

### Installing

Load the project to an IDE or copy the contents to a folder.
Then compile the project from console or with IDE.

Note: Automated support for Jetbrains' IntelliJ (just load the project).

Main class is:

```
src\Run\Runnable.java
```

## Running the program

Enter a regular expression in console. Valid operators are:

```
'|', '*', '+', '?', '^', '.'
```

And for the symbols you may use any other Ascii or Unicode symbol.
Note: you MUST use the epsilon symbol to represent an empty
word:

```
ε
```

Example of a valid regular expression may be:

```
ab*ab*
```

Note that you can use abbreviations and yuxtaposed concatenation, ie. no
need for placing '.' in your expression.

For a list of regular expressions examples you can see:

```
root_directory\REGEXPS.txt
```

## Deployment

After running the program, a text file with the contents of the minimized
DFA will be exported as:

```
root_directory\MIN_DFA.txt
```

The direct generation will be exported to:

```
root_directory\DIRECT_DFA.txt
```
## Authors

* **Gabriel Brolo**

## License

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

## Acknowledgments

* Big shoutout to Guillaume Ménard who's code helped me finish the infix to postfix converter:
https://gist.github.com/gmenard/6161825
* To Alfred Aho, for making such explicit algorithms in his book 'Compilators'.
* To Barry Brown, for explaining the algorithm here: https://www.youtube.com/watch?v=taClnxU-nao
* However, the previous video NEEDED to be supplemented with:
http://web.cecs.pdx.edu/~harry/compilers/slides/LexicalPart3.pdf
* Minimization algorithm: http://www.cs.odu.edu/~toida/nerzic/390teched/regular/fa/min-fa.html

repository: gbrolo/dfa-minimization

repo_name: gbrolo/dfa-minimization


text:
## Uniswap

Hi Folx,

I've been hanging around the DeFi space and participating in governance for the past few months, primarily in MakerDAO and Compound governance, but also with a few other projects.

You can find me on discourse forums as [@monet-supply](https://gov.uniswap.org/u/monet-supply) and on [twitter](https://twitter.com/MonetSupply). You can also review my voting history with Compound [here](https://compound.finance/governance/address/0x8d07d225a769b7af3a923481e1fdf49180e6a265) to see if our governance philosophies align.

My commitments as a delegate:

-   12+ hrs advanced notice before I submit votes, giving time to un-delegate your stake if you disagree
-   100% vote participation

Cheers and happy voting!

repository: boardroom-inc/voter-Info

gha_language: TypeScript

repo_name: boardroom-inc/voter-Info


text:
# Devchain User Group Environment Repository

This page describes the steps for the installation on Windows / OSX

### Windows / OSX

For non Linux systems we use Vagrant to provide  full environment to operate Docker containers.
Vagrant will automatically setup a virtual machine for you.

1. Install [Vagrant](https://www.vagrantup.com/downloads)
1. Install [Virtualbox](https://www.virtualbox.org/wiki/Downloads)
1. And for Windows user install [Cmder](http://cmder.net/) > Downloads full

1. In your terminal (or cmder) go on the Devchain dedicated folder. Checkout this repository (it's possible your MacBook ask you to install Xcode, just do it)

		git clone https://github.com/DevchainUserGroup/environment.git

1. Check you have 10 Go spaces on your drive.

1. Run the Vagrant image:

		cd ./environment/vagrant
		vagrant up

1. Connect to the VM

		vagrant ssh

#### Update VM Vagrant image

1. Remove the VM Vagrant image:

    1. Connect to the VirtualBox Manager
    1. Select the devchain-vm VM
    1. Go to menu "Machine > Close > Power Off"
    1. Go to menu "Machine > Remove > Delete all files"

1. Incorporates changes from the DevchainUserGroup repository

		git pull https://github.com/DevchainUserGroup/environment.git

1. Check you have 10 Go spaces on your drive.

1. Run the Vagrant image:

		cd ./environment/vagrant
		vagrant up

## License

Copyright 2017 - Dechain User Group
Apache License (./LICENSE.txt)[./LICENSE.txt]

repository: DevchainUserGroup/environment

gha_language: Shell

repo_name: DevchainUserGroup/environment


text:
## [Tree: Huffman Decoding](https://www.hackerrank.com/challenges/tree-huffman-decoding/problem)

Difficulty: **Medium**
Data Structure Domain: **Trees**
_Note_ - When solving in Hackerrank, only the function "decode_huff" need to be completed


text:
##Ember Builds

The Ember Release Management Team maintains a variety of ways to get  Ember and Ember Data builds.

###Channels
The latest [Release](/builds#/release), [Beta](/builds#/beta), and [Canary](/builds#/canary) builds of Ember and Ember data can be found [here](/builds). For each channel a development, minified, and production version is available. For more on the different channels read the [Post 1.0 Release Cycle](/blog/2013/09/06/new-ember-release-process.html) blog post.

###Tagged Releases
Past release and beta builds  of Ember and Ember Data are available at [Tagged Releases](/builds#/tagged). These builds can be useful to track down regressions in your application, but it is recommended to use the latest stable release in production.

##Bower

Bower is a package manager for the web. Bower makes it easy to manage dependencies in your application including Ember and Ember Data. To learn more about Bower visit [http://bower.io/](http://bower.io/).

Adding Ember to your application with Bower is easy; simply run `bower install ember --save`. For Ember Data, run `bower install ember-data --save`. You can also add `ember` or `ember-data` to your `bower.json` file as follows.

```json
{
	"name": "your-app",
	"dependencies": {
		"ember": "~1.6",
		"ember-data": "~1.0.0-beta.8"
	}
}

```

##RubyGems

If your application uses a Ruby based build system, you can use the [ember-source](http://rubygems.org/gems/ember-source) and [ember-data-source](http://rubygems.org/gems/ember-data-source) RubyGems to access ember and ember data sources from Ruby.

If your application is built in Rails, the [ember-rails](http://rubygems.org/gems/ember-rails) RubyGem makes it easy to integrate Ember into your Ruby on Rails application.

repository: ember-learn/guides-source

gha_language: HTML

repo_name: ember-learn/guides-source


text:
# Eval Library

The `(scheme eval)` library exports procedures for evaluating Scheme data as programs.

For more information see the [R7RS Scheme Specification](../../r7rs.pdf).

- [`eval`](#eval)
- [`create-environment`](#create-environment)
- [`setup-environment`](#setup-environment)
- [`expand`](#expand)

# eval

    (eval expr . environment)

Evaluate `expr` in the specified environment and return the resulting value(s).

A non-standard extension is provided to supply a default global environment if the `environment` argument is not specified.

# create-environment

    (create-environment vars values)

A non-standard function to create a new environment on top of the default one.

`vars` is a list of identifiers in the new environment, and `values` is a list of each value assigned to each identifier.

# setup-environment

    (setup-environment)

A non-standard function to initialize a new global environment.

# expand

    (expand expr [[environment] [rename-environment]])

Perform macro expansion on `expr` and return the resulting expression.

`environment` may be optionally passed as the current environment.

`rename-environment` is an optional argument of an environment containing variables renamed directly by macros. This would generally be an empty environment when using this function for macro debugging.

repository: justinethier/cyclone

gha_language: Scheme

repo_name: justinethier/cyclone