text:
Copyright @ 2019 Grecu Andrei-George, All rights reserved

		Sheriff of Nottingham - A variation of the base game implemented in java

		Text : http://elf.cs.pub.ro/poo/teme/tema

	Structure:
		common package:
		Constants - all constants used
		ChainedComparator - for Players
		ChainedComparator2 - for Goods
		CoinsComparator - for Players coins
		ProfitComparator - for Goods profit
		IdComparator - for Goods id
		OrdComparator - for Players Order

		main package:
		Main -> Game -> SubRound -> Player -> Basic
						   \-> Greedy
						    \-> Bribe

	Explanation:
		Game: Takes the input and processes it. Creates the players according to the input.

			Starts the game: For every round, do a new subround for every player to be sheriff.

			After the rounds finnished, we transform the illegals in their bonus, add profits
			and compute the king and queen for every good.

			Sort the players and display the leaderboard.

		Subround: At the start of the subround, every player needs to take his bag and declare
			the bag to sheriff according to his strategy, or set the sheriff.

			Inspection is used a single tie for bribed sheriff (as he checks up to two players
			takes bribe from others), or for every player besides the sheriff.

			Clear the hands and the bag for the sheriff for every player as the subround has finished.

		Player: The class implements the bag method that adds cards from the pile in hand.

			The declaration method is used to build the bag (BagToSheriff) that gets to be checked by the sheriff and
			the declaration (BagDeclaration), for the basic startegy.

			The inspection method is for every basic sheriff and implements the method trough which he inspects the
			other players.

			ProfitAdd method is used to add the profit for the goods that every player has on the stall, called by Game.

		Basic: Extends the Player class and has all the implementation already set,
			but in the constructor, the name is set accordingly.

		Greedy: Extends the Player class and has the name set accordingly in the constructor.

			The declaration method from Player is Overriden. It calls the declaration of the Basic and
			then it implements the Greedy startegy mention in the text.

			The inspection method from Player is Overriden. Checks if a player has bribe, if yes, then
			it takes the bribe, else inspects the player with the basic strategy.

		Bribe: Extends the Player class and has the name set accordingly in the constructor.

			The declaration methos is Overriden from Player and it is implementing the strategy described in the text.

			The inspection method from Player is Overriden. It computes the left and right neighbours for the sheriff
			and then applies the inspection method based on the basic strategy. If there are more than two players,
			from the rest of them it takes the bribe, if they have.

repository: grecuandrei/Sheriff-of-Nottingham

repo_name: grecuandrei/Sheriff-of-Nottingham


text:
# niko

🚧 extremely experimental / alpha 🚧

An XNA-like game engine for building games with wasm & webgl.

[demo on itch.io](https://vengarioth.itch.io/niko-test)

## getting started

niko uses [niko-cli](https://github.com/niko-rs/niko-cli) to help you get started quickly!

### niko setup

* First make sure you have cargo installed, or go to https://rustup.rs/.
* Then run `cargo install wasm-pack` because niko-cli will invoke it.
* After that run `cargo install niko-cli`
* Lastly, make sure `~/.cargo/bin` is in your `PATH`.

### creating a project

🚧 proof of concept 🚧

After you installed `wasm-pack` and `niko`, you can create a new niko project with `niko new <name>` (or `niko init`, just like cargo).

### running the development environment

🚧 proof of concept 🚧

When your project is set up, run `niko watch` in your project's directory. It builds your project and opens a browser window in your default browser with the result.
It will rebuild the project when a `.rs` file is changed in the current path.

## publishing to itch.io

🚧 not started 🚧

Run `niko bundle` in your project's directory and upload the `<project-name>.zip` to itch.io!

## license

[MIT](LICENSE)

license: MIT

repository: niko-rs/niko

branch_name: refs/heads/main

extension: md

license_type: permissive

repo_name: niko-rs/niko


text:
# log Plugin

This example plugin provides a way to generate hashes of strings.

## Installation

Add the plugin to the `Plugins` option in the Applications options:

```go
    Plugins: map[string]application.Plugin{
        "log": log.NewPlugin(),
    },
```

## Usage

You can then call the methods from the frontend:

```js
    wails.Plugin("log","All","hello world").then((result) => console.log(result))
```

This method returns a struct with the following fields:

```typescript
    interface Hashes {
        MD5: string;
        SHA1: string;
        SHA256: string;
    }
```

A TypeScript definition file is provided for this interface.

## Support

If you find a bug in this plugin, please raise a ticket [here](https://github.com/plugin/repository).
Please do not contact the Wails team for support.

repository: wailsapp/wails

branch_name: refs/heads/master

gha_language: MDX

gha_license_id: MIT

repo_name: wailsapp/wails


text:
---
layout: default
---

# 1996-06-12 - Re: Kahn's "The CodeBreakers"

## Header Data

From: "Brad Shantz"<EMAIL_ADDRESS>To<EMAIL_ADDRESS>Message Hash: cb865866a870365b89c111a5793c5544f2c32e846b4eac3c42cf31258022e79c

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1996-06-12 03:03:26 UTC

Raw Date: Wed, 12 Jun 1996 11:03:26 +0800

## Raw message

```
{% raw  %}From: "Brad Shantz"<EMAIL_ADDRESS>Date: Wed, 12 Jun 1996 11:03:26 +0800
To<EMAIL_ADDRESS>Subject: Re: Kahn's "The CodeBreakers"
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

Good call, Tim.  That is correct.  I had forgotten.

> Ah, but it does have some significance. "Liberty" is published out of Port
> Townsend. (More precisely, it was the last time I looked.)

> And it's near Hump Tulips, Sequim, and Chimicum (sp?). Ma and Pa Kettle country.

Sequim is further west along the Olympic Peninsula, and Chimacum is
just south of Port Townsend towards Port Hadlock and the Hood Canal
bridge.

Once again, good call, Tim.

{% endraw %}
```

## Thread

+ Return to [June 1996](/archive/1996/06)

+ Return to "["Brad Shantz" <bshantz@nwlink.com>](/authors/brad_shantz_bshantz_at_nwlink_com_)"

+ 1996-06-12 (Wed, 12 Jun 1996 11:03:26 +0800) - Re: Kahn's "The CodeBreakers" - _"Brad Shantz"<EMAIL_ADDRESS>


text:
# Harvest Cell

The objective of this protocol is to collect cell pellet by a centrifuge.

- Workflow:
  - IPTG induction > *Harvest Cell* > Column Packing
- Steps:
  - [01] Retrieve the cell culture from 37°C shaker.
  - [02] Reserve 1 mL of cell culture in a 1.5 mL tube.
  - [03] Pour 200 mL cell culture into a 225 mL Falcon tube.
  - [04] Spin down the cell at 4696g for 15 minutes.
  - [05] Remove the tube from the centrifuge and discard supernatant.
  - [06] Pour all the remaining cell culture to the tube and spin down the cell at 4696g for another 15 minutes.
  - [07] Pour off supernatant and keep the cell pellet at -80°C freezer.
### Inputs

- **Overexpression** [P]
  - Plasmid / TB Overnight (400 mL) of Plasmid

### Outputs

- **After IPTG** [P]
  - Plasmid / Overexpression of Plasmid

- **Cell pellet** [P]
  - Plasmid / Cell Pellet of protein

### Precondition [hide]
```ruby
def precondition(_op)
  true
end
```

### Protocol Code [hide]
```ruby
# Author: Pei Wu , Sep 2018

needs "Standard Libs/Feedback"

class Protocol
  include Feedback
  def main

    # Remove the overexpression culture from the shaker.
    operations.retrieve.make

    op_in_overexpression = []
    op_out_cell_pellet = []
    op_out_after = []
    op_count = 0
    operations.running.each do |op|
        op_count = op_count + 1
        op_in_overexpression << op.input("Overexpression").item.id
        op_out_cell_pellet << op.output("Cell pellet").item.id
        op_out_after << op.output("After IPTG").item.id
    end

    # Reserve 1ml cell culture after IPTG induction in Eppendorf with design ID
    reserve_culture_after_iptg(op_count,op_in_overexpression,op_out_after,op_out_cell_pellet)

    take_tubes_and_label(op_count,op_in_overexpression,op_out_cell_pellet)

    spin_down_cell(op_count,op_out_after,op_in_overexpression,op_out_cell_pellet)

    # Measure OD600 value cell culture after IPTG induction by nanodrop (Prof. James Carother’s lab).
    od_value_after = measure_od_value op_out_after

    # Record the OD value.
    i = 0
    operations.running.each do |op|
        sample_after = op.output("After IPTG").item
        sample_after.associate :od_value, od_value_after[i]
        i = i + 1
    end

    spin_down_pellet(op_out_after)

    spin_down_remaining_cell(op_count,op_out_after,op_in_overexpression,op_out_cell_pellet)

      operations.running.each do |op|
      op.output("Cell pellet").child_item.move "-80°C freezer"
    end

    operations.store(io: "output", interactive: true, method: 'boxes')

    clean_up

    get_protocol_feedback

    return {}
  end

  def measure_od_value(meas_sample)
    od_value = []
    show do
        title "Measure OD600 value of cell culture in MolES lab"
        check "Grab a box to carry the following items:"
        bullet "a box of 1000 µl tip"
        bullet "a P1000 pipettor"
        bullet "a tip waste container"
        bullet "#{meas_sample.size+1} plastic cuvettes"
        bullet "1 mL of TB aliquot"
        bullet "a marker pen"
        bullet "sample in a 1.5 mL tube: #{meas_sample.to_sentence}"
    end

    show do
        title "Measure OD600 value of cell culture in MolES lab"
        note "Perform the following steps with #{meas_sample.to_sentence}."
        bullet "Open Nanodrop 2000 <b>></b> Home <b>></b> cell culture <b>></b> use cuvette <b>></b> pathlength: 10mm <b>></b> stir speed: off"
        bullet "Blank with 1 mL TB in a cuvette."
        bullet "Discard TB to the liquid waste container."
        bullet "Transfer 1 mL of sample to a new cuvette."
        bullet "Measure OD600 value and record it on the 1.5 mL tube wall."
        bullet "Transfer sample from the cuvette back to its 1.5 mL tube."
        warning "In this step, be careful not to pour samples into the liquid waste container."
        image "Actions/ProteinPurification/cuvette_nanodrop.jpg"
    end

  def spin_down_pellet(op_out_after)
    show do
        title "Spin down cell"
        note "Perform the steps with 1.5 mL sample tubes: #{op_out_after.to_sentence}."
        check "Spin down at 8000 g for 3 minutes."
        check "Remove tubes from the centrifuge. Pipette out the supernatant and keep pellet."
        check "Place 1.5 mL sample tubes aside for later processing."
    end
  end

    meas_sample.each do |id|
      od = show do
        title "Enter OD value"
        get "number", var: "x", label: "Enter OD600 value of #{id}", default: 0
      end
      od_value << od[:x]
    end
    return od_value
  end

  def reserve_culture_after_iptg(op_count,op_in_overexpression,op_out_after,op_out_cell_pellet)
    op_table = [["Cell culture ID","Volume","1.5 mL tube ID"]]
    for i in 0..(op_count-1)
        row = []
        row << op_in_overexpression[i]
        row << "1 mL"
        row << {content:op_out_after[i], check: true}
        op_table << row
    end

    show do
        title "Pre-cool a centrifuge"
        check "Set the centrifuge to 4°C."
        image "Actions/ProteinPurification/centrifuge.jpg"
    end

    show do
        title "Reserve 1 mL of cell culture before harvesting cell"
        # after IPTG induction
        check "Grab <b>#{op_count}</b> 1.5 mL tube(s)."
        check "Label the tube with ID: #{op_out_after.to_sentence}."
        check "Spray a P1000 pipettor with ethanol and wipe it dry."
        check "Swirl the bottle and transfer 1 mL of cell culture to the corresponding 1.5mL tube."
        note "**Use a new tip for each batch to avoid cross contamination.**"
        check "Place the 1.5 mL sample tubes aside for later task."
        table op_table
    end
  end

  def take_tubes_and_label(op_count,op_in_overexpression,op_out_cell_pellet)
    op_table = [["Cell culture ID","Volume","225 mL Falcon tube ID"]]
    for i in 0..(op_count-1)
        row = []
        row << op_in_overexpression[i]
        row << "220 mL"
        row << {content:op_out_cell_pellet[i], check: true}
        op_table << row
    end

    show do
        title "Prepare tubes"
        check "Grab a ice bucket and fill it with ice."
        check "Grab <b>#{op_count}</b> 225 mL Falcon tube(s) and label with ID: #{op_out_cell_pellet.to_sentence} on the tube wall."
        check "Place tubes in ice bath."
        image "Actions/ProteinPurification/225_falcon_tube.jpg"
    end

    show do
      title "Harvest cell"
      check "Pour approximately 220 mL of cell culture into the corresponding tube and screw the cap."
      table op_table
    end
  end

  def spin_down_cell(op_count,op_out_after,op_in_overexpression,op_out_cell_pellet)

    run = (op_count/4).floor
    remainder = op_count % 4
    if (remainder) != 0
        run = run + 1
    end

    for i in 1..run
        if (i*4 > op_count)
            leng = remainder
        else
            leng = 4
        end
        tube_id = op_out_after[(i-1)*4,leng]

        show do
            title "Spin down the cell"
            note "Perform the steps with the following tubes: #{op_out_cell_pellet.to_sentence}."
            check "Balance samples in tubes."
            check "Spin tubes at 4696g for 20 minutes."
            check "While waiting, proceed to measure OD value of reserved 1.5 mL tubes on the rack."
        end
    end
  end

  def spin_down_remaining_cell(op_count,op_out_after,op_in_overexpression,op_out_cell_pellet)
    op_table = [["Cell culture ID","225 mL Falcon tube ID"]]
    for i in 0..(op_count-1)
        row = []
        row << op_in_overexpression[i]
        row << {content:op_out_cell_pellet[i], check: true}
        op_table << row
    end

    run = (op_count/4).floor
    remainder = op_count % 4
    if (remainder) != 0
        run = run + 1
    end

    for i in 1..run
        if (i*4 > op_count)
            leng = remainder
        else
            leng = 4
        end
        tube_id = op_out_after[(i-1)*4,leng]

        show do
            title "Continue to harvesting the remaining cell in 2L flask"
            note "Perform the steps with the tubes: #{op_out_cell_pellet.to_sentence}."
            check "Remove tubes from 4°C centrifuge after the first 20-min spin is done."
            check "Pour supernatant into a liquid waste container or sink. Keep pellet."
            check "Pour approximately 220 mL of cell culture into a tube according to the table."
            table op_table
            check "Balance samples in tubes."
            check "Spin tubes at 4696g for 20 minutes."
        end

        show do
            title "Retrieve tubes"
            check "Remove tubes from centrifuge after the 20-min spin is done."
            check "Reset the centrifuge to 23°C."
            check "Pour supernatant into a the used 2L flask or sink. Keep pellet."
            check "Store #{op_out_cell_pellet.to_sentence} in -80°C freezer."
        end
    end
  end

  def clean_up
    show do
        title "Clean up"
        check "Place used 2L flask in the dishwashing area."
        check "Return ice bucket."
        check "Clean plastic cuvettes by rinsing with water twice."
        check "Rinse cuvettes with 70% ethanol."
        check "Return them back to the storage box."
    end
  end

end

```


text:
Badger
======

I am not sure what i want this to be right now, but when i do know...it will be FIERCE.

Somewhat of a Purpose
---------------------

I am initially using this as a way to learn different third party WPF libraries. This repo may end not doing anything more than a hodge podge of different code examples. Here is a list of 'Frameworks' that I am planning to use:

- ReactiveUI (holding off on this for now)
- Caliburn.Micro
- NLog
- MahApps.Metro
- Akavache (Maybe)
- Squirrel (Somehow)
- MEF

[Trello Board Link](https://trello.com/b/tgGmYKFs)

repository: lucasbrendel/Badger

repo_name: lucasbrendel/Badger


text:
## DP-GMM

Implementation of the Dirichlet-Process Gaussian Mixture model presented in [Infinite Gaussian Mixture Model](https://www.seas.harvard.edu/courses/cs281/papers/rasmussen-1999a.pdf)

### Notes:

  * DP are not perfect:
    http://arxiv.org/pdf/1301.2708v1.pdf

repository: alumbreras/DP-GMM

repo_name: alumbreras/DP-GMM


text:
---
layout: index
title: Turn-based events
---

If your game is only responding to what the player does, it feels dead. Bring it alive by having events occur that are not simply reacting to the player's actions (even if they are reacting to what he did four turns ago, it will still feel like it is not).

Here then is a simple framework for turn-based events.

Set up the framework
--------------------

1. Set an int attribute on game called "turn".

2. Create two dummy rooms, "active\_events" and "dead\_events". They should have no exits and should not be accessible by the player.

3. Copy this turnscript and type into your game code. Insert it at the end, just before the last line (which will be "</asl>")

      <turnscript name="eventhandler">
        <enabled />
        <script><![CDATA[
          game.turn = game.turn + 1
          foreach (evt, GetDirectChildren (active_events)) {
            if (evt.turn <= game.turn) {
              do (evt, "action")
              if (evt.auto) {
                evt.parent = dead_events
                if (HasAttribute (evt, "next")) {
                  evt.next.turn = evt.nextturn + game.turn
                  evt.next.parent = active_events
                }
              }
            }
          }
        ]]></script>
      </turnscript>

      <type name="event_type">
        <done type="boolean">false</done>
        <auto />
        <turn type="int">-1</turn>
        <action type="script">
          msg ("TODO")
        </action>
      </type>

Set up events
-------------

Each event needs to be an object in one of the rooms, "active\_events" and "dead\_events". The room "active\_events" is for events that are counting down, while "dead\_events" is for events that have expired or are waiting in the wings to be used.

For each event, set it to inherit "event\_type". You also need to set the "action" attribute; this is the script that will get run.

For events in "active\_events", you need to set the "turn" attribute. The event will be fired in that number of turns, and will then get moved to the "dead\_events" room.

For events in "dead\_events", you need to set up something to start them off. This needs to move the event into the "active\_events", and to set the "turn" attribute to game.turn plus the number of turns to wait. It might look something like this, when the event, event3, is set to occur in 2 turns:

      event3.turn = 2 + game.turn
      event3.parent = active_events

Chaining events
---------------

You can set up one event to start the count down to another very easily. Just set the "next" attribute to the event to be started, and the "nextturn" attribute to the number of turns to wait.

Turn off auto
-------------

By default, events are automatically moved to "dead\_events" and start the next chained event (if set) when they trigger. Setting the "auto" attribute to false stops that behaviour. This may be desirable if you want to wait until the player is in a certain room, for example. In that case, turn off auto, and the event will fire every turn. Each time it fires, you can have it test to see if the player is in the room; if she is, perform the special action, and then move the event to dead\_events in the script.

Note
----

Quest counts each player input as a turn. If the player spending 10 turns typing commands that are not recognised, that is still 10 turns.

Example game
------------

There are only two rooms and three events. Event 1 initiates the countdown to event 2, which in turn sets off event 3. Event 2 has "auto" set to false, so it keeps going until a condition is met (player in room 2), and only then starts the countdown to event 3.

    <!--Saved by Quest 5.4.4873.16527-->
    <asl version="540">
      <include ref="English.aslx" />
      <include ref="Core.aslx" />
      <dynamictemplate name="ObjectNotOpen">DoObjectNotOpen (object)</dynamictemplate>
      <game name="events">
        <gameid>17fa10af-9205-4eba-a5ad-65d3166864e7</gameid>
        <version>1.0</version>
        <firstpublished>2013</firstpublished>
        <turn type="int">0</turn>
        <statusattributes type="stringdictionary">
          <item>
            <key>turn</key>
            <value></value>
          </item>
        </statusattributes>
        <subtitle>A demonstration of simple turn-based events</subtitle>
        <author>The Pixie</author>
      </game>
      <object name="room">
        <inherit name="editor_room" />
        <alias>First Room</alias>
        <usedefaultprefix type="boolean">false</usedefaultprefix>
        <object name="player">
          <inherit name="editor_object" />
          <inherit name="editor_player" />
        </object>
        <exit alias="west" to="room2">
          <inherit name="westdirection" />
        </exit>
      </object>
      <object name="room2">
        <inherit name="editor_room" />
        <alias>Second Room</alias>
        <usedefaultprefix type="boolean">false</usedefaultprefix>
        <exit alias="east" to="room">
          <inherit name="eastdirection" />
        </exit>
      </object>
      <object name="active_events">
        <inherit name="editor_room" />
        <object name="event1">
          <inherit name="editor_object" />
          <inherit name="event_type" />
          <turn type="int">3</turn>
          <nextturn type="int">2</nextturn>
          <next type="object">event2</next>
          <action type="script">
            msg ("Event 1")
          </action>
        </object>
      </object>
      <turnscript name="eventhandler">
        <enabled />
        <script><![CDATA[
          game.turn = game.turn + 1
          foreach (evt, GetDirectChildren (active_events)) {
            if (evt.turn <= game.turn) {
              do (evt, "action")
              if (evt.auto) {
                evt.parent = dead_events
                if (HasAttribute (evt, "next")) {
                  evt.next.turn = evt.nextturn + game.turn
                  evt.next.parent = active_events
                }
              }
            }
          }
        ]]></script>
      </turnscript>
      <object name="dead_events">
        <inherit name="editor_room" />
        <object name="event2">
          <inherit name="editor_object" />
          <inherit name="event_type" />
          <auto type="boolean">false</auto>
          <action type="script">
            if (player.parent = room2) {
              msg ("Event 2")
              event3.turn = 2 + game.turn
              event3.parent = active_events
              this.parent = dead_events
            }
            else {
              msg ("... waiting")
            }
          </action>
        </object>
        <object name="event3">
          <inherit name="editor_object" />
          <inherit name="event_type" />
          <action type="script">
            msg ("Event 3")
          </action>
        </object>
      </object>
      <type name="event_type">
        <done type="boolean">false</done>
        <auto />
        <turn type="int">-1</turn>
        <action type="script">
          msg ("TODO")
        </action>
      </type>
    </asl>

repository: textadventures/quest

gha_language: C#

repo_name: textadventures/quest


text:
# Context Detective #

This is a simple bit of Apex, paired with a custom object, that will help you explore the various limits that are applied by Salesforce in different execution contexts where Apex can run.

The main thing we're trying to surface with this is figuring out when Apex is running in a "synchronous" context vs an "asynchronous" context, which is not as intuitive as you might hope.

## Sample Results ##

![Here are the standard contexts the ContextDetective will expose](/data/contexts.png)

## Building the DX Project ##

By default this repo is set up as DX project for you to run ContextDetective in a scratch org. Clone this repo to your local machine and then execute the following build script from the repository root folder:

`./build`

This build script is a convenience, and will run the following commands in sequence:

1. `sfdx force:org:create -s -f config/context-detective-scratch-def.json -a 'context-detective'`
2. `sfdx force:source:push`
3. `sfdx force:user:permset:assign -n Context_Detective`
4. `sfdx force:apex:execute -f investigate.apex`
5. `sfdx force:org:open -p lightning/o/Context__c/list?filterName=All`

This will cause a number of Context__c records to be created, which you can inspect to gain insight into what limits are applied where.

If there are additional contexts you'd like to investigate, from your Apex inside those contexts simply call `ContextDetective.dumpContext('Some Description of your Context');`.

*Keep in mind that some of the contexts that are checked are scheduled and will take a minute or two to execute, so you will likely need to refresh the Context__c list view until the scheduled stuff appears.*

repository: sf-wilson/context-detective

repo_name: sf-wilson/context-detective


text:
[![Gem Version](https://badge.fury.io/rb/pronto-android_lint.svg)](https://badge.fury.io/rb/pronto-android_lint)

# ProntoAndroidLint

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ProntoAndroidLint`. To experiment with that code, run `bin/console` for an interactive prompt.

TODO: Delete this and the text above, and describe your gem

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'ProntoAndroidLint'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install ProntoAndroidLint

## Environment variables
Path to lint result files
Multiple paths should be separated by comma
PRONTO_ANDROID_LINT_RESULT_PATHS=app/build/reports/lint-results.xml,app/build/reports/lint-results-release-fatal.xml

## Usage
pronto run

or

PRONTO_GITHUB_ACCESS_TOKEN=tokken PRONTO_PULL_REQUEST_ID= pronto run -f github_pr_review github -c origin/master

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).

repository: amitkuet/amit-pronto-android-lint

gha_language: Ruby

repo_name: amitkuet/amit-pronto-android-lint


text:
Reaction Game
===============

This game was written in ruby using the [Ruby2d](https://www.ruby2d.com).
This is, basically, a game that the user needs to click the square as fast as possible.

![React](Reaction1.png)
![React](Reaction2.png)

path: /Reaction Game/readme.md


text:
---
title: "CSS Fun"
date: "2018-10-10"
description: "CSS Fun"
---
Like most developers, I've been using bootstrap for just about every project in the past 5 years. A challenge my team has taken on recently has been to learn CSS so we are not so reliant on Bootstrap.  We've come across 2 really cool and fun tutorials to learn how to leverage CSS for layouts:

http://cssgridgarden.com/

http://flexboxfroggy.com/

Check em out! They're both really easy to do. I was able to move through both of them in less than an hour.

branch_name: refs/heads/dev

gha_language: TypeScript


text:
Docker Sentinel Image
=====================
A Docker base image which includes [Sentinel][1].

Building
--------
To do the thing:

    git clone https://github.com/BlueDragonX/docker-sentinel.git
    docker build --rm -t bluedragonx/sentinel docker-sentinel

Configuration
-------------
The Sentinel image is meant to be used as a base image. The image expects
Sentinel's config file to be located at `/etc/sentinel/config.yml`. The
directory already exists. It is the inheriting image's job to place a file
there so that Sentinel runs accordingly.

License
-------
Copyright (c) 2014 Ryan Bourgeois. Licensed under BSD-Modified. See the LICENSE

[1]: https://github.com/BlueDragonX/sentinel "Sentinel"

repository: ianblenke/docker-sentinel

repo_name: ianblenke/docker-sentinel


text:
# A0121608N
###### \DeveloperGuide.md
``` md

#### Use case 6: Mark task as completed

**MSS**<br>
1. User requests to list tasks<br>
2. `Dowat` displays a list of tasks<br>
3. User requests to mark a task as completed with the index of task in the list<br>
4. `Dowat` marks the existing task as completed and archives the completed task<br>
5. `Dowat` displays the updated list of tasks<br>

  Use case ends.

**Extensions**<br>
3a. The given index is invalid
  > 3a1. `Dowat` displays an error message that the task cannot be found
  Use case resumes at step 2

<br>

#### Use case 7: Delete task or event

**MSS**<br>
1. User requests to list tasks or events<br>
2. `Dowat` displays a list of tasks or events<br>
3. User requests to delete an existing task or event with the index in the list<br>
4. `Dowat` deletes the task or event<br>
5. `Dowat` displays the updated list of tasks or events<br>

  Use case ends.

**Extensions**<br>
3a. The given index is invalid
  > 3a1. `Dowat` displays an error message that the task or event cannot be found
  Use case resumes at step 2

<br>
```
###### \DeveloperGuide.md
``` md

```
###### \Userguide.html
``` html

<h4 id="marking-a-task-as-completed"><a name="user-content-marking-a-task-as-completed" href="#marking-a-task-as-completed" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>Marking a task as completed</h4>
<p>Mark an existing task as completed in dowat.</p>
<p>Format: <code>mark INDEX</code></p>
<blockquote>
<p>Marks the task at the specified <code>INDEX</code> as completed. The index refers to the index number shown in the most recent listing of tasks.<br />
Completed tasks will not be shown in the list of tasks and will be archived in dowat.</p>
</blockquote>
<p>Examples: <br />
* <code>mark 1</code><br />
  Marks the 1st task as completed</p>
<h4 id="deleting-a-taskevent"><a name="user-content-deleting-a-taskevent" href="#deleting-a-taskevent" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>Deleting a task/event</h4>
<p>Deletes an existing task/event from dowat storage completely.  </p>
<p>Format: <code>delete /t|/e INDEX</code></p>
<blockquote>
<p>Deletes the task/event at the specified <code>INDEX</code> in the most recent task/event listing.<br />
Deleted tasks/event will not be shown even with <code>list /e|/t /a</code> command. </p>
</blockquote>
<p>Examples:<br />
* <code>delete /t 1</code><br />
  Deletes the 1st task in the most recent listing</p>
```
###### \Userguide.html
``` html

<h4 id="clearing-of-tasks"><a name="user-content-clearing-of-tasks" href="#clearing-of-tasks" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>Clearing of tasks</h4>
<p>Clears all completed tasks or clears all tasks. <br></p>
<p>Format: <code>clear /t [/a]</code></p>
<blockquote>
<p>An <code>/a</code> optional flag will request the TaskBook to clear all tasks, both marked done and not yet marked done. </p>
</blockquote>
<p>Examples: <br />
<em> <code>clear /t</code> <br><br />
  Clears tasks that are marked done.<br />
</em> <code>clear /t /a</code> <br><br />
  Clears all tasks.</p>
<h4 id="clearing-of-events"><a name="user-content-clearing-of-events" href="#clearing-of-events" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>Clearing of events</h4>
<p>Clears all completed events or clears all events. <br></p>
<p>Format: <code>clear /e [/a]</code></p>
<blockquote>
<p>An <code>/a</code> optional flag will request the TaskBook to clear all events. </p>
</blockquote>
<p>Examples: <br />
<em> <code>clear /e</code> <br><br />
  Clears events that are marked done.<br />
</em> <code>clear /e /a</code> <br><br />
  Clears all events.</p>
<h4 id="clearing-of-tasks-and-events"><a name="user-content-clearing-of-tasks-and-events" href="#clearing-of-tasks-and-events" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>Clearing of tasks and events</h4>
<p>Clears all completed tasks and events or clears all tasks and events. <br></p>
<p>Format: <code>clear [/a]</code></p>
<blockquote>
<p>An <code>/a</code> optional flag will request the TaskBook to clear all tasks and events.</p>
</blockquote>
<p>Examples: <br />
<em> <code>clear</code> <br><br />
  Clears all completed tasks and events.<br />
</em> <code>clear /a</code> <br><br />
  Clears all tasks and events.</p>
```
###### \Userguide.html
``` html

<h2 id="ui-control"><a name="user-content-ui-control" href="#ui-control" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>UI Control</h2>
<h4 id="traversing-between-windows"><a name="user-content-traversing-between-windows" href="#traversing-between-windows" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>Traversing between Windows</h4>
<p>The four main windows in which the user can traverse are:</p>
<pre><code>* Command Box
* Result Display Panel
* Task Panel
* Event Panel
</code></pre>
<p>By utilizing the TAB key, the user is able to switch between the different windows in the above-mentioned order. The order of traversal is descending down the list before it loops back to the beginning. </p>
<p>The window in which the user is currently on is shown by a brown border highlight.</p>
<p><img src="///C://Users/User/Documents/Main/docs/images/MockUI.PNG" width="600"></p>
<h4 id="command-box-features"><a name="user-content-command-box-features" href="#command-box-features" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>Command Box Features</h4>
<p>When the Command Box is selected, it has 2 main features:</p>
<ul>
<li>
<p>Clearing the Command Box</p>
<p>Pressing the DELETE key will clear the Command Box of its text content. This allows for easy clearing of commands.</p>
</li>
<li>
<p>Accessing past History of Commands</p>
<p>Pressing the UP key will access the previous command in the history and will copy it into the Command Box. Pressing the DOWN key will access the next command in the history and will copy it into the Command Box. </p>
<p>The Command history resets itself after each session of usage (i.e exit the program).</p>
</li>
</ul>
<h4 id="result-display-panel-features"><a name="user-content-result-display-panel-features" href="#result-display-panel-features" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>Result Display Panel Features</h4>
<p>When the Result Display Panel is selected, it has a scrolling feature where the UP and DOWN key would be able to control the scroll bar within the window. This prevents the need to use the mouse wheel for scrolling.</p>
<h4 id="task-and-event-panel-features"><a name="user-content-task-and-event-panel-features" href="#task-and-event-panel-features" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>Task and Event Panel Features</h4>
<p>When the Task or Event Panel is selected, it has a scrolling feature where the UP and DOWN key would be able to control the scroll bar within the window. This prevents the need to use the mouse wheel for scrolling.</p>
```
###### \UserGuide.md
``` md

#### Marking a task as completed
Mark an existing task as completed in dowat.

Format: `mark INDEX`

> Marks the task at the specified `INDEX` as completed. The index refers to the index number shown in the most recent listing of tasks.
> Completed tasks will not be shown in the list of tasks and will be archived in dowat.

Examples:
* `mark 1`
  Marks the 1st task as completed

#### Deleting a task/event
Deletes an existing task/event from dowat storage completely.

Format: `delete /t|/e INDEX`

> Deletes the task/event at the specified `INDEX` in the most recent task/event listing.
> Deleted tasks/event will not be shown even with `list /e|/t /a` command.

Examples:
* `delete /t 1`
  Deletes the 1st task in the most recent listing

```
###### \UserGuide.md
``` md

#### Clearing of tasks
Clears all completed tasks or clears all tasks. <br>

Format: `clear /t [/a]`

> An `/a` optional flag will request the TaskBook to clear all tasks, both marked done and not yet marked done.

Examples:
* `clear /t` <br>
  Clears tasks that are marked done.
* `clear /t /a` <br>
  Clears all tasks.

#### Clearing of events
Clears all completed events or clears all events. <br>

Format: `clear /e [/a]`

> An `/a` optional flag will request the TaskBook to clear all events.

Examples:
* `clear /e` <br>
  Clears events that are marked done.
* `clear /e /a` <br>
  Clears all events.

#### Clearing of tasks and events
Clears all completed tasks and events or clears all tasks and events. <br>

Format: `clear [/a]`

> An `/a` optional flag will request the TaskBook to clear all tasks and events.

Examples:
* `clear` <br>
  Clears all completed tasks and events.
* `clear /a` <br>
  Clears all tasks and events.

```
###### \UserGuide.md
``` md

## UI Control

#### Traversing between Windows
The four main windows in which the user can traverse are:

	* Command Box
	* Result Display Panel
	* Task Panel
	* Event Panel

By utilizing the TAB key, the user is able to switch between the different windows in the above-mentioned order. The order of traversal is descending down the list before it loops back to the beginning.

The window in which the user is currently on is shown by a brown border highlight.

<img src="images/MockUI.PNG" width="600">

#### Command Box Features
When the Command Box is selected, it has 2 main features:

* Clearing the Command Box

	Pressing the DELETE key will clear the Command Box of its text content. This allows for easy clearing of commands.

* Accessing past History of Commands

	Pressing the UP key will access the previous command in the history and will copy it into the Command Box. Pressing the DOWN key will access the next command in the history and will copy it into the Command Box.

	The Command history resets itself after each session of usage (i.e exit the program).

#### Result Display Panel Features
When the Result Display Panel is selected, it has a scrolling feature where the UP and DOWN key would be able to control the scroll bar within the window. This prevents the need to use the mouse wheel for scrolling.

#### Task and Event Panel Features
When the Task or Event Panel is selected, it has a scrolling feature where the UP and DOWN key would be able to control the scroll bar within the window. This prevents the need to use the mouse wheel for scrolling.

```

repository: JIAHUIs/main

repo_name: JIAHUIs/main


text:
# Read 4 Notes

# [CSS Grid Garden](https://cssgridgarden.com/)

# [RegExr](https://regexr.com/)
RegExr is an online tool to learn, build, & test Regular Expressions (RegEx / RegExp).

# [CSS Grid Reference](https://css-tricks.com/snippets/css/complete-guide-grid/)

CSS Grid Layout is the most powerful layout system available in CSS. It is a 2-dimensional system, meaning it can handle both columns and rows, unlike flexbox which is largely a 1-dimensional system.

### [home](https://misalz.github.io/reading_notes2/)


text:
# Redis Docker

## Overview

These files are intended to provide a ready-to-use [redis](https://redis.io/)
environment based on Docker.

The Dockerfile aims to be generic, easily extensible and used according to the
user's will such as a redis master, a redis [slave](https://redis.io/topics/replication)
or a redis [sentinel](https://redis.io/topics/sentinel).

## Quickstart

Let's start by building the Docker Image:

![Redis-Build](../assets/gifs/redis/redis-build.gif)

From here you got a new shiny Docker Image of a redis server you can play with:

![Redis-Test](../assets/gifs/redis/redis-test.gif)

## Dockerfile

The Docker Image you just created is based on [Alpine](https://alpinelinux.org/)
distribution and its total size is 23.82 MB.

This is lightweight and that works, though I would not use it in production as
it is because of my special needs. That is why you can override the redis
configuration in command line without specifying a redis configuration file that
would force you to create the Docker Image again.

Let's say you would like to change the port the redis server listens to:

![Redis-Override](../assets/gifs/redis/redis-override.gif)

Nevertheless, you would have to specify TONS of arguments in command line, and
that is not really practical.

That is why you should directly use the Compose file instead.

## Compose File

The present Compose file sets up a basic redis cluster composed of six services:
* one redis master
* two redis slaves
* three redis sentinels

```
    +-------------------+    +-------------------+    +-------------------+
    |                   |    |                   |    |                   |
    | redis-sentinel-01 |    | redis-sentinel-02 |    | redis-sentinel-03 |
    |                   |    |                   |    |                   |
    +-------------------+    +-------------------+    +-------------------+
              |                        |                         |
              |                +----------------+                |
              +--------------->|                |<---------------+
                             +>|    redis-01    |<+
                             | |                | |
                             | +----------------+ |
                             |                    |
                    +----------------+    +----------------+
                    |                |    |                |
                    |    redis-02    |    |    redis-03    |
                    |                |    |                |
                    +----------------+    +----------------+
```

But you can use it as you want in adding or updating provided services by
editing this very file.

Using this Compose file is as easy as:

![Redis-Compose](../assets/gifs/redis/redis-compose.gif)

## Not Good Enough ?

If you encouter any issue by using what is provided here, please
[let me know](https://github.com/TimTosi/mechanist/issues) !
Help me to improve by sending your thoughts to<EMAIL_ADDRESS>!

repository: eevalaiho/mechanist

repo_name: eevalaiho/mechanist


text:
# Child Health Data - 2008 to 2020

## About the dataset
Child Health Data for the years 2008 to 2020. Available in National Health Mission data portal.

Source: Health Information Management System (HIMS), Ministry of Health and Family Welfare

### Download URL
Available for download as xls and zip files.

[Performance of Key Indicators in HIMS (District level)](https://nrhm-mis.nic.in/hmisreports/frmstandard_reports.aspx)

### Overview
Child Health Data is available for financial year starting from 2008. The xls files are under 'data/' folder.
The dataset contains key performance indicators of Child Health Data for the particular financial year.

#### Cleaned data
- [NHM_ChildHealth.csv](NHM_ChildHealth.csv)

The cleaned csv has the following columns:

- District: District
- DistrictCode: lgdCode
- Date: Date
- Count_BirthEvent_LiveBirth: Total number of reported live births
- Count_BirthEvent_StillBirth: Total number of reported still births
- Count_BirthEvent_LiveBirth_AsFractionOf_Count_ChildDeliveryEvent: Percent of total reported live births to total deliveries
- Count_Infant_VaccineAdministered_BCG: Number of infants given BCG vaccine
- Count_Infant_VaccineAdministered_OPV: Number of infants given OPV 0 Vaccine (Birth Dose)
- Count_Infant_VaccineAdministered_DPTDose1: Number of infants given DPT Vaccine Dose 1
- Count_Infant_VaccineAdministered_DPTDose2: Number of infants given DPT Vaccine Dose 2
- Count_Infant_VaccineAdministered_DPTDose3: Number of infants given DPT Vaccine Dose 3
- Count_ChildVaccinationEvent_MMR: Number of infants given MMR Vaccine
- Count_Infant_VaccineSideEffect_Adverse_Deaths: Adverse events following immunization (Deaths)
- Count_Infant_VaccineSideEffect_Adverse_Others: Adverse events following immunization (Others)
- Count_Death_Infant: Total number of infant deaths reported

#### TMCF
- [NHM_ChildHealth.tmcf](NHM_ChildHealth.tmcf)

#### Scripts
- [preprocess.py](preprocess.py): Clean up data and generate TMCF file

repository: Ghaiyur-wipro/data

repo_name: Ghaiyur-wipro/data


text:
# Jhovanic IP Ban

This wordpress plugin enables IP ban for your site. You can also add a whitelist of IPs to bypass ban and set how long the ban will have effect (e.g. 10 days)

## Install

* Download this repo in wp-content/plugins/
* Activate the plugin in the admin interface
* Configure the redirect URL and ban time

## Uninstall

* Deactivate the plugin in the admin interface
* Delete the plugin in the admin interface

## License

MIT

repository: jhovanic/jhovanic-ip-ban

repo_name: jhovanic/jhovanic-ip-ban


text:
---
title: "Supports for the Self-Employed "
date: 2022-01-01T11:15:08.644Z
description: " "
---
### Why is the Working Family Payment not available to the self-employed?

To qualify for Working Family Payment, a person must be engaged in full time paid employment as an employee. They must also have at least one qualified child who normally resides with them or is supported by them.

It is possible for a household of a self-employed person to receive a working family payment where the spouse, civil partner or cohabitant of the self-employed person meets the qualifying criteria.

Instead there are a number of other schemes available to self-employed individuals, including:

* The [Back to Work Family Dividend](https://www.gov.ie/en/service/93cd55-back-to-work-family-dividend/) - which helps families to move from social welfare into employment, including self-employment, by retaining their qualified child increase for up to two years
* The [Back to Work Enterprise Allowance scheme](https://www.gov.ie/en/service/f215a4-back-to-work-enterprise-allowance/) - which encourages people getting certain social welfare payments to become self-employed. Where a person takes part in the Back to Work Enterprise Allowance scheme, they can keep a percentage of their social welfare payment for up to 2 years;
* The [Short-Term Enterprise Allowance](https://www.gov.ie/en/service/538ba3-short-term-enterprise-allowance-stea/) - which gives support to people who have lost their job and want to start their own business.

repository: green-party-dublin-central/nh-web

gha_language: CSS

repo_name: green-party-dublin-central/nh-web


text:
# Introduction

browscap-js is a port of PHP's get_browser function to JavaScript

It makes available a `getBrowser` function which takes a browser user agent string
and returns an associative array of properties and abilities of that browser.

You must use a preprocessed browscap.json file, which is provided too with the name `browscap.preprocessed.json`:

Example:

	var browscap = require('browscap-js');
	browscap.setJson('./browscap.preprocessed.json');

	var browser = browscap.getBrowser("Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; WinTSI 05.11.2009)");

	//Will print "IE 8.0"
	console.log(browser['Browser'] + " " + browser['Version']);

Thanks to [torvalamo](http://github.com/torvalamo) for some rewrites to
improve performance.

# Installation

Using npm run `npm install browscap-js`

You can get npm from http://npmjs.org/

Alternatively you can clone the git repository

# Examples

There is a test.js file which demonstrates how to use node-browscap and tests
several user agents.

To run:

	$ npm test

repository: rwheaton/browscap-js

repo_name: rwheaton/browscap-js


text:
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/35802256-2d93-489b-bf26-42ef3880b209/big.png)](https://insight.sensiolabs.com/projects/35802256-2d93-489b-bf26-42ef3880b209) [ ![Codeship Status for Stamplia/stamplia-php](https://codeship.com/projects/f74ee750-3a90-0133-ea16-2693e5cde95b/status?branch=master)](https://codeship.com/projects/101917)

stamplia-php
============

A PHP library to access the [Stamplia](https://stamplia.com) API. It requires PHP 5.4+.

Setup
-----

Using [composer](https://getcomposer.org) you can add the following to your composer.json file:

    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/Stamplia/stamplia-php.git"
        }
    ],
    "require": {
        "php": ">=5.4.0",
        "Stamplia/stamplia-php": "~1.0"
    },
    "minimum-stability": "stable",
    "config": {
        "process-timeout": 3600
    }

Then in your PHP code include the composer autoloader, something similar to this:

    <?php
    require_once 'vendor/autoload.php';

Usage
-----

To instantiate the client it's pretty straightforward:

    $client = new \Stamplia\ApiClient();

Here's how to list templates available on our marketplace:

    $templates = $client->getTemplates();

All method parameters need to be set within a single array as the function parameter.

To log in and then be able to access private methods (user methods):

    $client->login(array(
        'email'         => '**',
        'password'      => '**',
        'app_id'        => '**',
        'app_secret'    => '**'
    ));

To see all methods available with this ApiClient you can use the following tool from the command line:

    php doc.php | more

Please read [our API documentation](http://doc.stamplia.com/documentation/getting_started/) for a more precise description of the parameters
that each method accepts and their response.

repository: Stamplia/stamplia-php

gha_language: PHP

repo_name: Stamplia/stamplia-php


text:
# Misc. Sensors

There are other various sensors that are less commonly used but can still be encountered. We will list some here, as well as links to where you can find out how to program them.

> [!NOTE]
> If you're using sensors made by other companies, you may need to install vendor libraries to handle them.

Many of the more basic types of sensors can be found [here.](https://docs.wpilib.org/en/latest/docs/software/sensors/ultrasonics-software.html)

One other sensor is the REV Robotics color sensor (which we have used in the past). The sensor can detect the color of what it looks at and can also serve as a distance sensor.

- [JavaDocs](http://www.revrobotics.com/content/sw/color-sensor-v3/sdk/docs/javadoc/index.html)
- [Example Code](https://github.com/REVrobotics/Color-Sensor-v3-Examples)

gha_language: Java


text:
The sbt equivalent of the [JAX-WS Maven plug-in][1]. It's a bit of a poor relation at the moment, supporting `wsimport` only (to generate Java from WSDL).

You should also consider using [scalaxb][2].

Compatible with sbt 0.12.x and 0.13.x.

Configuration
-------------

Put this in your `project/plugins.sbt`:

    addSbtPlugin("net.koofr" % "sbt-jaxws" % "0.2")

Light configuration example (in `build.sbt`):

    sbtJaxWsSettings

    SbtJaxWsKeys.wsdlFiles <+= baseDirectory(_ / "service.wsdl")

    SbtJaxWsKeys.bindingFiles <+= baseDirectory(_ / "message.xsd")

    SbtJaxWsKeys.targetVersion := "2.1"

Full configuration example:

    import sbtjaxws.Plugin.{ SbtJaxWsKeys, sbtJaxWsSettings }

    class MyBuild extends Build {
         lazy val myProject = Project("Mine", file("."), settings = Defaults.defaultSettings ++ sbtJaxWsSettings ++ Seq(
             SbtJaxWsKeys.wsdlFiles <+= baseDirectory(_ / "service.wsdl"),
             SbtJaxWsKeys.bindingFiles <+= baseDirectory(_ / "message.xsd"),
             SbtJaxWsKeys.targetVersion := "2.1"))
    }

There is an `SbtJaxWsKeys.otherArgs` for other `wsimport` arguments -- if you use this,
please consider adding a new setting to the plug-in and sending a pull request ;-)

  [1]: http://jax-ws-commons.java.net/jaxws-maven-plugin/
  [2]: http://scalaxb.org/sbt-scalaxb

repository: koofr/sbt-jaxws

gha_language: Scala

repo_name: koofr/sbt-jaxws


text:
# **NodeMCU_MQTT_Hacked** #

Derived from version 0.9.5

This is a forked version of nodemcu-firmware: https://github.com/nodemcu/nodemcu-firmware

The changes from the original version are relatives to how MQTT "publish" is managed.

I removed the queue mechanism on publish: now message are directly sent and not ordered.

This question on stackoverflow it explains why I made this changes:
http://stackoverflow.com/questions/33414441/nodemcu-and-esp8266-slow-mqtt-publish

Inside **bin** directory you will find 2 already prepared binary file to flash on the esp8266: **0x00000.bin** and **0x10000.bin**

Check my blog for other details: http://pestohacks.blogspot.com and description of a sample project


text:
# Alfred, the butler

Alfred is the butler bot of [Insight Data Science Lab](http://insightlab.ufc.br) based on [BotFather](https://core.telegram.org/bots).

repository: InsightLab/alfred

repo_name: InsightLab/alfred


text:
### WebdriverIO Baseline project with Cucumber

This project is a ready to go foundation for using WebdriverIO v5 framework with Typescript and Cucumber.

Run `npm run test` for basic Google search test in Chrome

#### Project highlights:
 - **Page Object** pattern [showcase](src/page-objects/google-check.po.ts)
 - **Composition pattern** [showcase](src/web-elements) - wrapping common web elements like buttons, dropdowns and text fields for stable re-use and encapsulation
 - Cucumber WDIO config set up - [wdio.conf.js](config/wdio.conf.js)
 - beautiful **Cucumber reporter** by _Wim Selles_ [multiple-cucumber-html-reporter](https://www.npmjs.com/package/multiple-cucumber-html-reporter) all set up [here](src/lib/multipleCucumberReporter.js)
 - **Winston** logger configured [here](src/lib/winston-logger.ts)
 - centralised and readable **wait time control** under [timeouts](src/data/timeouts.ts)

With this base, you can simply copy paste new step definitions and page objects and scale your coverage with speed and confidence.

Feel free to visit [my Medium](https://medium.com/beargineer) for more detailed content on pattern usage in automation.

Thank you. I aim to continuously expand this baseline over time. All feedback is welcome.

![alt text](https://cdn-images-1.medium.com/max/249/1*y_euvEopwrhPAT2meoPTkg@2x.png)

repository: FilipSwiatczak/webdriverio-baseline

repo_name: FilipSwiatczak/webdriverio-baseline


text:
# Resource: Servicegroup

## Overview

This resource manages Nagios servicegroups. It can be used to create, update and delete service groups, as well as manage all attributes currently supported by Nagios.

Refer to the object definition for [servicegroups](https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/3/en/objectdefinitions.html#servicegroup) from Nagios to learn more

## Example

```hcl
resource "nagios_servicegroup" "servicegroup1" {
    name    = "servicegroup1"
    alias   = "This is an example servicegroup"
    members = [
        "svcgroup1",
        "ping_check"
    ]
    notes   = "Example notes"
    notes_url   = "https://docs.example.com/servicegroup/notes"
    action_url  = "https://dovs.example.com/servicegroup/action"
}
```

## Arguments

`name`: The name of the Nagios service group
`alias`: The description or other name that the servicegroup may be called. This field can be longer and more descriptive
`members`: A list of services and other service groups that should be members of the service group. The members must be valid services and service groups within Nagios and must be active. The provider will NOT validate that the object is correctly configured in Nagios. The reason for this is, if the membership grows to hundreds or thousands of hosts, querying for each one of those would create performance issues.
`notes`: Notes about the service group that may assist with troubleshooting
`notes_url`: URL to a third-party documentation respoitory containing more information about the service group
`action_url`: URL to a third-party documentation repository containing actions to take in the event the service group goes down


text:
# Clean Architecture

![iOS](https://img.shields.io/badge/iOS-9.0%2B-blue.svg)
![Swift](https://img.shields.io/badge/Swift-4.2-blue.svg)
[![Build Status](https://app.bitrise.io/app/04e42b095f2aed11/status.svg?token=7ZlxOD8DBPw6ho39Xb9CRw&branch=master)](https://app.bitrise.io/app/04e42b095f2aed11)

1. [Description](#description)
2. [Rationale](#rationale)
3. [Motivation](#motivation)
4. [Applicability](#applicability)
5. [Structure](#structure)
6. [Implementation](#implementation)
7. [Demo](#demo)

## Description

Clean Architecture is a Framework that will help create a separation of concerns in your application;
it is greatly inspired by Uncle Bob's _Clean Architecture_. You can find more about it at [The Clean Code Blog](http://blog.cleancoder.com)

### Framework

**Design reuse over code reuse**
- Predefines the design parameters so that the implementers can concentrate on the specifics of the application.
- Defines the overall structure, its partitioning into classes and objects, the key responsibilities thereof, how the classes and objects collaborate, and the thread of control.
- It's *not* meant to help you write less code, it's meant to help you have a unified code base design.

## Rationale

Separating the concerns of your application on different layers according to their responsibilities will enable you to embrace change and have a software structure more flexible.

Your application details (the user interface for example) should depend on your business logic and not the other way around.

Having a concise and cohesive design across your application can help boost productivity, refactoring and maintenance in general.

## Motivation

There are many ways to structure an application and if the overall architecture is not implicit from the beginning developers could end creating different structures for different features of the project.

While having different architectures in an application doesn't harm directly the functionality in itself it can definitely harm the maintenance and make it difficult to refactor or allow changes in general.

Without refactoring the code starts to rot and decay.

Without changes you cannot implement new features or modify existing ones.

Deciding what architecture you should implement in your project is difficult at the beginning, because most of the time the project evolves with the code itself and before starting to code there is little information on the inner workings of the application hence little is known of how it should be designed.

Deciding for very complex and rigid architecture since the beginning could lead your project to a dooming failure; the more complex the architecture more difficult to implement and even the slightest change requires a big effort creating boiler plate like protocols and delegates that are little meaningful for a small project.

On the other hand, deciding for a very basic o no architecture at all could be useful at the beginning but once the project starts to grow the architecture will reach its limit and wear off.

This lead us to the big question: What could be a good architecture than can be used for a small project but will also support it growing to big and complex one?

## Applicability

Any application written in Swift targeting iOS 9 or higher.

It doesn't matter if your application consists of just one screen or several dozens. Clean Architecture is perfect for big and modularized projects, but it's boiler plate foot print is so low than even the simplest application can benefit from implementing it.

Ideally for new projects, but it is also possible to implement it in an existing application by an in-depth refactoring.

Monolithic and modularized projects can benefit from Clean Architecture.

## Structure

Clean Architecture follows the [Dependency Inversion Principle](https://cleancoders.com/episode/clean-code-episode-13/show).

Lower level policies depend upon higher level policies, and higher level policies are able to communicate to lower level ones through the use of interfaces or protocols.

The highest level policy is your application domain or in other words the business logic.

The lowest level policy is your user interface, i.e. labels, buttons, images, etc.

<img src="https://raw.githubusercontent.com/velvetroom/clean-architecture/master/Design/dependencies.png" width="1000" alt="Structure" />

## Implementation

### Install

You can get Clean Architecture with **CocoaPods**.

Add to your Podfile

```
pod 'CleanArchitecture'
```

Install and download

```
> pod install
```

If you are wondering what is CocoaPods take a look at: [https://cocoapods.org](https://cocoapods.org)

### Interactor

Interactors are the higher level layer in Clean Architecture, that is, the closer to your business level.

They should know nothing about the user interface or how it is displayed to the user.

They should depend (know everything or import) on your business layer.

In a new file import Clean Architecture

```
import CleanArchitecture
```

Create a class that implements Interactor and add the required boiler plate:

```
class MyInteractor:Interactor {
    weak var delegate:InteractorDelegate?

    required init() { }
}
```

- `delegate` A weak reference to the InteractorDelegate; this is the only communication going from the Interactor to the Presenter, the Interactor notifies the Presenter when it should update the presentation.
- `required init` Initialize any property that you need or leave it empty if none.

### Presenter

Presenters are in charge of how to interpret your application data so it can be displayed to the user.

Should depend on Interactor and know nothing specific about the View.

They communicate to the View via the ViewModel.

In a new file import Clean Architecture

```
import CleanArchitecture
```

Create a class that implements Presenter and add the required boiler plate:

```
class MyPresenter:PresenterProtocol {
    var viewModels:ViewModels!
    var interactor:MyInteractor!

    required init() { }
}
```

- `viewModels` A container for your view models. Presenter edits ViewModels and View gets notifified of a change, then View can display the change to the user.
- `interactor` Presenter is the owner of the interactor.
- `required init` Initialize any property if needed.

### View

View is in charge of the user interface layer and is also carrying the heavy weight of your application architecture.

Should know everything about Presenter, ideally only interact with it and no other layer in your application should depend on View, i.e. this is the front line to the user and the lower level of abstraction.

Applications in iOS usually consist of transitions between view controllers and most of the time there is only one of these active.

When your View is instantiated it creates instances of your Presenter, Interactor and ViewModels, connects them accordingly and assigns them their responsibilities.

If your View gets released also your Presenter, Interactor and ViewModel will be released.

You can abstract each View as a section or screen in your application. You should create a View for each section, each View will have their own ViewModels ideally they will also have their own specific Presenter. Interactors can be shared or could also be specific for each section.

View inherits from UIViewController.

In a new file import Clean Architecture

```
import CleanArchitecture
```

Create a new class that inherits from View.

View is a Generic class that needs to be specialized with a class conforming to Presenter.

```
class MyView:View<MyPresenter> { }
```

- `MyPresenter` Your class conforming to Presenter

### ViewModels

The structure of information that will be presented to the user.

You don't create a ViewModels object, Presenter has a ViewModels object already and you rather create as many ViewModel structs as your View needs.

Presenter is in charge of updating the ViewModel whenever it is needed. Every ViewModel can have an observer which will be notified via a closure when the property changes; ideally this observer would be your View.

You can define anything that you need in a ViewModel from basic types like Bool or String, to more complex ones like UIColor or UIImage or even your own structures.

You can also decide if your properties are optional or not.

In a new file import Clean Architecture

```
import CleanArchitecture
```

Create a new structure that implements ViewModel.

```
struct MyViewModel:ViewModel {
    var userName:String
    var buttonEnabled:Bool
    var buttonColor:UIColor?
    var icon:UIImage?

    init() {
        self.userName = String()
        self.buttonEnabled = false
    }
}
```

#### Updating the ViewModel

Your Presenter is in charge of updating the ViewModel and you can decide when to do it, it can be done on any thread as it is thread safe.

In your Presenter class

```
func update(userName:String) {
    var viewModel:MyViewModel = MyViewModel()
    viewModel.userName = userName
    self.viewModels.update(viewModel:viewModel)
}
```

And that's it, ViewModels will take care of updating the listener if there is any.

#### Listening for ViewModel updates

Usually you want your View to listen for ViewModel updates.

Listening to updates is thread safe, it doesn't matter if your Presenter is updating in a background thread you will always be notified on the Main thread.

In your DemoView class

```
func listenToUpdates() {
    self.presenter.viewModels.observe { [weak self] (viewModel:MyViewModel) in
        self?.title = viewModel.userName
    }
}
```

## Demo

Clone or download this repository, it contains a simple Demo application that will help you have a clear vision of how to implement Clean Architecture.

repository: velvetroom/legacy-catban

gha_language: Swift

repo_name: velvetroom/legacy-catban


text:
# My Web Page
- author: andreasl<EMAIL_ADDRESS>
This project contains My static Web Page and its resources.

## TODO:
- Re-work the whole page
- think of adding a showreel page
- Add something about the following:
  - Linux ****
  - Mac OS X ***
  - Windows ****
  - Gerrit *****
  - JIRA ***
  - QtCreator ***
  - CMake *****

- What do I want to do in 5 years?
- What do I want to do in 10 years?

- Mention what you like to do:
  - automate, improve, support,
  - plan and structure
  - learn

- nice inspiration: http://www.sebastien-eustace.fr/
- nice CSS: https://codepen.io/HelKyle/pen/ePyENP


text:
# Dialog.js
_Dialog plugin for Mochi._

> [v1.0](https://github.com/codeworksdev/mochi/blob/master/dist/mochi/js/plugins/dialog/CHANGELOG.md)

This plugin uses the **[jQuery UI Dialog Widget](https://jqueryui.com/dialog/)** as a base and introduces new features while not obstructing the options already provided by the standard widget.

## INSTALLATION
To use Dialog.js in your app, simply drop this single file as a `<script>` import in your HTML files (i.e., just before your `onload.js` is loaded). The plugin will register itself as `$m.dialog`, making it instantly accessible by the rest of your application. That's it! You now have a reliable dialog widget installed as a Mochi plugin.

**FILES**
* mochi/js/plugins/dialog/dist/dialog.js

```html
...
        <script src="mochi/js/mochi.min.js"></script>
        <script src="mochi/js/plugins/dialog/dist/dialog.min.js"></script>
        <script src="frontend/js/onload.js"></script>
    </body>
</html>
```

As you may have already guessed, you can do a bunch of stuff with Dialog.js when you combine it with jQuery or add your own CSS rules. For example, you can dynamically open a simple dialog with:

```javascript
$m.dialog.open(
    '<p>Hello, world!</p>'
    );
```

The statement above would:

1. Open a new dialog with [modal](http://api.jqueryui.com/dialog/#option-modal) behavior.
2. Add "Confirm" as the [title](http://api.jqueryui.com/dialog/#option-title) of the dialog.
3. Add a [button](http://api.jqueryui.com/dialog/#option-buttons) labeled "OK" (clicking it immediately closes the dialog).
4. Add "Hello, world!" to the body of the dialog.

## GENERATED HTML EXAMPLE
_**Note:** The code below is generated automatically by the dialog widget._
```html
<div
  tabindex="-1"
  role="dialog"
  class="ui-dialog ui-corner-all mochi-plugin-dialog ui-widget ui-widget-content ui-front ui-dialog-buttons"
  aria-describedby="mochi-plugin-dialog"
  aria-labelledby="ui-id-1"
  style="height: auto; width: 640px; top: 0px; left: 599.5px; z-index: 101;">
    <div class="ui-dialog-titlebar ui-corner-all ui-widget-header ui-helper-clearfix">
        <span id="ui-id-1" class="ui-dialog-title">Confirm</span>
        <button type="button" class="ui-button ui-corner-all ui-widget ui-button-icon-only ui-dialog-titlebar-close" title="close">
            <span class="ui-button-icon ui-icon ui-icon-closethick"></span>
            <span class="ui-button-icon-space"></span>close
        </button>
    </div>
    <div
      data-mochi="plugin"
      id="mochi-plugin-dialog"
      class="ui-dialog-content ui-widget-content"
      style="width: auto; min-height: 13.078px; max-height: none; height: auto;">
        <p>Hello, world!</p>
    </div>
    <div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix">
        <div class="ui-dialog-buttonset">
            <button type="button" class="ui-button ui-corner-all ui-widget">OK</button>
        </div>
    </div>
</div>
```

## THEMING
You can easily theme your dialogs by studying the standard HTML example above, or by digging through your own HTML source code. For example, to alter the border radius of your dialogs you can do:

```css
.ui-dialog.mochi-plugin-dialog {
    border-radius: 10px;
    }
```
_**Note:** You can use the [classes](http://api.jqueryui.com/dialog/#option-classes) option if you'd like to alter the CSS classes defined for each of your dialogs. This is especially useful if you have multiple dialog instances that require unique styles per instance._

___
# API

## PUBLIC METHODS

> ### html
> _instance_ **$m.dialog.html(** _string_ **html** [, _string_ selector] **)**
>
> Inserts `html` into the body of the dialog (or the child elements identified by the optional CSS `selector`). Any existing HTML (i.e., from a previously opened dialog) would be replaced. See the "generated html example" section below as a reference. This method does not open the dialog or alter it's visibility.

> ### open
> _instance_ **$m.dialog.open(** _string_ **html** [, _object_ options] [, _function_ onOpen] **)**
>
> Opens the dialog and inserts the given `html` to the body of the dialog. Any existing HTML (i.e., from a previously opened dialog) would be replaced. `options` are identical to the [options](http://api.jqueryui.com/dialog/) provided by the standard jQuery UI distribution, but with different default values (see "options" section below). The `onOpen` parameter is an optional function you'd like to be called once the dialog is generated. If provided, the `onOpen` function would have `this` reference the dialog container in jQuery object form.

## OPTIONS
_**Note:** See [jQuery UI dialog widget options](http://api.jqueryui.com/dialog/) for detailed documentation on each option listed below._
```
OPTION NAME   | DEFAULT VALUE
---------------------------------------------------------------------------------------------------------
appendTo      | 'body'
autoOpen      | true
buttons       | {OK : function(){$(this).dialog('close')}}
classes       | {'ui-dialog': 'ui-corner-all mochi-plugin-dialog', 'ui-dialog-titlebar': 'ui-corner-all'}
closeOnEscape | false
closeText     | 'close'
draggable     | false
height        | 'auto'
hide          | null
maxHeight     | false
maxWidth      | false
minHeight     | 150
minWidth      | 150
modal         | true
position      | {my : 'top', at : 'center top', of : window}
resizable     | false
show          | null
title         | null
width         | (function(w){return w>670?640:(w-30)})($('body').width())
```

___
And there you have it! What a ride. Please head on over to [jQuery UI](http://api.jqueryui.com/dialog/) for detailed documentation and to take full advantage of what the dialog widget can offer.

# LICENSE
Dialog.js is licensed under the MIT license. (http://opensource.org/licenses/MIT)

repository: codeworksdev/mochi

repo_name: codeworksdev/mochi


text:
## Properties

`Name` - (Required) The name of the project on Packet.net.

`OrganizationId` - The UUID of organization under which you want to create the project. If you leave it out, the project will be create under your the default organization of your account.

`PaymentMethodId` - The UUID of payment method for this project. The payment method and the project need to belong to the same organization (passed with `OrganizationId`, or default).

`BgpConfig` - Optional BGP settings. Refer to [Packet guide for BGP](https://support.packet.com/kb/articles/bgp).

`Asn` - Autonomous System Numer for local BGP deployment.

`Md5` - (Optional) Password for BGP session in plaintext (not a checksum).

`DeploymentType` - `private` or `public`, the `private` is likely to be usable immediately, the `public` will need to be review by Packet engineers.

## Return Values

### Fn::GetAtt

`Id` - The unique ID of the project.

`PaymentMethodId` - The UUID of payment method for this project.

`OrganizationId` - The UUID of this project's parent organization.

`Created` - The timestamp for when the project was created.

`Updated` - The timestamp for the last time the project was updated.

`Status` - status of BGP configuration in the project.

`MaxPrefix` - The maximum number of route filters allowed per server.

## See Also

* [packet_project](https://www.terraform.io/docs/providers/packet/r/project.html) in the _Terraform Provider Documentation_


text:
# book_search

A simple flutter Book search application using flutter sdk and Google book API.

## Screesnhot

![Material design flutter crosss platform book search api](https://user-images.githubusercontent.com/24621701/41241761-c00f870c-6d95-11e8-8885-51c3e2bdfe43.gif)

## Getting Started

For help getting started with Flutter, view our online
[documentation](https://flutter.io/).


text:
# patchwork

[![Maven Central][maven-central-badge]][maven-central-link]

Create ANSI patches of text strings which can be printed to a console to update
existing text. This library supports multiline output which allows for
combination with all sorts of text based console output.

## Examples

### Progress Bar

To display some kind of progress bar in the console as a task is being
performed, the following pattern can be used.

```kotlin
fun progressBarString(progress: Int): String = ...

var previous: String? = null
while (progress in 1..100) {
  val next = progressBarString(progress)
  print(previous.patch(next))
  previous = next
}
```

### Logging With Progress Bar

To display some kind of progress bar in the console while also logging text,
you can use the following pattern.

```kotlin
fun progressBarString(progress: Int): String = ...

var previous: String? = null
while (progress in 1..100) {
  val log = "... lines you would like logged ..."
  val next = progressBarString(progress)
  print(previous.patch(log + next))
  previous = next
}
```

### Table Progress

To display more complex messages you can use a library like
[picnic](https://github.com/JakeWharton/picnic) to generate a user-friendly
table which can display progress for multiple things at the same time. See the
sample project for an [example][picnic-example].

![picnic-example](docs/picnic-example.svg)

## Platforms

Some platforms (Windows) do not natively support ANSI text manipulation. Some
third-party libraries like [jansi](https://github.com/fusesource/jansi) can add
this support through platform specific APIs.

## What's Next?

- ANSI Colors: ANSI text styling really messes with the diff calculation. Text
  changes in the middle of styled text will also require tracking the style of
  both text strings and applying the correct style in the patched text.

[maven-central-badge]: https://maven-badges.herokuapp.com/maven-central/com.bnorm.patchwork/patchwork/badge.svg
[maven-central-link]: https://maven-badges.herokuapp.com/maven-central/com.bnorm.patchwork/patchwork
[picnic-example]: https://github.com/bnorm/patchwork/blob/main/sample/src/main/kotlin/main.kt

repository: bnorm/patchwork

repo_name: bnorm/patchwork


text:
---
title: "Authentication with AWS Amplify and Android: Integrating TOTP"
categories:
  - Android
tags:
  - Kotlin
---

This will be an in-depth series on authentication with [AWS Amplify]. Here are the topics I am going to cover, and I will update each blog with the links as I complete the articles.

* [The basics - a username/password system]({% post_url 2018/2018-09-18-auth-with-aws-amplify-1 %}).
* [Customizing the UI]({% post_url 2018/2018-09-23-auth-with-aws-amplify-2 %}).
* [Authenticating with Facebook]({% post_url 2018/2018-10-01-auth-with-aws-amplify-3 %}).
* [Authenticating with Google]({% post_url 2018/2018-10-08-auth-with-aws-amplify-4 %}).
* [Using third-party authentication providers]({% post_url 2018/2018-10-15-auth-with-aws-amplify-5 %}).
* [Using Time-based One-time passwords (TOTP)]({% post_url 2018/2018-10-22-auth-with-aws-amplify-6 %}).
* [Using Biometric authentication]({% post_url 2018/2018-10-29-auth-with-aws-amplify-7 %}).
* [Doing fraud protection and analytics]({% post_url 2018/2018-11-05-auth-with-aws-amplify-8 %}).

Over the last five articles, I've covered several methods of authenticating your users. With this article, I'm forgetting Facebook, Google, and OIDC exist and concentrating on a basic username / password system. Specifically, I'm going to start talking about security and how to ensure your users credentials are protected.

If you wish to start your backend from scratch (and I recommend you do as some settings in Amazon Cognito can only be set on initial configuration), use `amplify delete` to easily delete all the backend resources.

The service I am using for the username and password storage is Amazon Cognito user pools. This is an OIDC compliant provider that gives you sign-in capabilities together with self-service sign-up and forgot password flows. We integrated those into the app in the first and second articles. However, that isn't enough. Most users want more security today, especially if the data you are storing is important to them. For that reason, it's a good idea to think about multi-factor authentication.

There are three factors of authentication:

* Something you know (for example, a username and password)
* Something you have (for example, a hardware token, or your phone)
* Something you are (for example, your fingerprint)

Multi-factor authentication requires multiple factors to authenticate. For example, in this article, we are going to deal with "something you know" (the username and password) and combine it with "something you have" (an app on your phone).

There is a technicality here - if we are on the phone doing the username and password, and that same phone receives the token, is it really multi-factor authentication? The jury is out on that and it's up to you to decide for yourself.

## Time-based One Time Passwords

The second factor could be a code that is sent via email or SMS (which is the "normal" multi-factor authentication mode). Recently, time-based one-time passwords (or TOTP) have become popular. If you have used the Facebook "Code Generator" or Google Authenticator, then you already have something that generates TOTP tokens. They are used in place of the code that is sent via email or SMS.

In this article, we are going to go back to our original username and password authentication system that we produced in the first two articles. We will then extend that system to configure and then use TOTP for the multi-factor authentication.

## Configuring the backend

You can easily re-create the backend using the following:

```bash
$ amplify init
$ amplify add auth
$ amplify add analytics
$ amplify push
```

Setting up TOTP is easily accomplished when using `amplify add auth` with the following answers:

![]({{ site.baseurl }}/assets/images/2018/2018-10-22-image1.png)

The important question here is "_For user login, select the MFA types_". You can select SMS and TOTP. You can express a preference for the type on a per-user basis.

## Front end -- the process

There are two parts for the front end that we must consider. Firstly, some time after sign-in, we must configure TOTP within Amazon Cognito. This involves linking the TOTP application (e.g. Google Authenticator) with Amazon Cognito. The second thing is that we must use the authenticator when asked for the multi-factor authentication during the login process. The fortunate thing here is that asking for the TOTP is already done - we've integrated multi-factor authentication within our app already (as a dialog) and the request for the TOTP is delivered the same way.
That leaves us with configuring TOTP for an individual user. For this, I'm going to establish a new activity (called `ConfigureTOTPActivity`) that will do the work for me. This implements the following logic:

1. The activity initiates the TOTP sign-up. This is another "authentication flow" that needs to be managed.
2. The callback is called with a "Secret Code". This is used to generate the QR Code and configure the TOTP generator.
3. The user is prompted for a code from the TOTP generator. Once provided, the continuation is called.
4. If the code matches, the callback is called with SUCCESS.

To implement this, I've added a new method to the `IdentityRepository` interface:

```kotlin
/**
 * Initiate registration for TOTP passwords
 */
fun initiateTOTPSignup(handler: IdentityHandler)
```

This has also been added to the `AuthenticatorViewModel` as a pass-thru, similar to the other flow initiation methods. I've also added an element into the `nav_drawer_menu.xml` file:

```xml
<item
    android:id="@+id/main_drawer_totp"
    android:icon="@drawable/ic_password_black_24dp"
    android:title="@string/nav_totp"
    android:enabled="false" />
```

I've updated the `updateNavigationDrawer()` method in the `MainActivity` to enable or disable the menu item based on the authentication:

```kotlin
private fun updateNavigationDrawer(isSignedIn: Boolean = false) {
    val loginItem = nav_view.menu.findItem(R.id.main_drawer_login)
    val totpItem = nav_view.menu.findItem(R.id.main_drawer_totp)
    if (!isSignedIn) {
        loginItem.title = resources.getString(R.string.nav_signin)
        totpItem.isEnabled = false
    } else {
        loginItem.title = resources.getString(R.string.nav_signout)
        totpItem.isEnabled = true
    }
}
```

Finally, I've added some code to the `onNavigationItemSelected()` method in the `MainActivity` to switch to the `ConfigureTOTPActivity` when the menu item is clicked:

```kotlin
override fun onNavigationItemSelected(item: MenuItem): Boolean {
    when (item.itemId) {
        R.id.main_drawer_login -> {
            if (authModel.currentUser.value != null) {
                authModel.signOut()
                toast("Successfully signed out")
            } else {
                startActivity<AuthenticatorActivity>()
            }
        }
        R.id.main_drawer_totp -> {
            startActivity<ConfigureTOTPActivity>()
        }
    }
    drawer_layout.closeDrawer(GravityCompat.START)
    return true
}
```

Now that the basics of switching to the new activity are covered, let's take a look at implementation of the TOTP initialization process.

## The IdentityRepository

We've already established that the initiation of the TOTP configuration flow will trigger the `initiateTOTPSignup()` method. This will call `associateSoftwareTokenInBackground()` to initiate the process on the backend. There are three callbacks:

* `onVerify()` is called first. This contains the "secret key". To progress, the user needs to configure their TOTP app with the secret key (more on how to do that in a little bit), then call` setVerificationResponse()` with a TOTP that has been generated.
* `onSuccess()` is then called to indicate success. This isn't the end of the process, as we will see.
* `onFailure()` is called if there are any problems with the process.

Once successful, you need to also set TOTP as the preferred method. This is done with `setUserMfaSettingsInBackground()` once the TOTP registration is successful.

Let's turn this into code:

```kotlin
override fun initiateTOTPSignup(handler: IdentityHandler) {
  userPool.currentUser.associateSoftwareTokenInBackground(null, object : RegisterMfaHandler {
      override fun onSuccess(sessionToken: String?) {
          val mfaSettings = listOf(
                  CognitoMfaSettings(CognitoMfaSettings.SMS_MFA).apply {
                      isEnabled = true
                      isPreferred = false
                  },
                  CognitoMfaSettings(CognitoMfaSettings.TOTP_MFA).apply {
                      isEnabled = true
                      isPreferred = true
                  }
          )
          userPool.currentUser.setUserMfaSettingsInBackground(mfaSettings, object : GenericHandler {
              override fun onSuccess() = runOnUiThread { handler(IdentityRequest.SUCCESS, null) { /* Do Nothing */ } }
              override fun onFailure(exception: Exception?) = handleFailure(handler, exception?.message)
          })
      }

      override fun onFailure(exception: java.lang.Exception?) = handleFailure(handler, exception?.message)

      override fun onVerify(continuation: VerifyMfaContinuation?) {
          runOnUiThread {
              handler(IdentityRequest.NEED_MULTIFACTORCODE, continuation?.parameters) { response -> run {
                  with (continuation!!) {
                      thread(start = true) {
                          setVerificationResponse(response?.get("mfaCode"), "Android App")
                          continueTask()
                      }
                  }
              }}
          }
      }
  })
}
```

## The ConfigureTOTPActivity

The activity uses the same `AuthenticatorViewModel` as all the other auth activities. In the `onCreate()` method, we initiate the TOTP signup:

```kotlin
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_configure_totp)
    model.initiateTOTPSignup { i,p,c -> handler(i, p, c) }
}
```

The handler is where the main work happens. We need to deal with three callbacks (values of `identityRequest`):

* `NEED_MULTIFACTORCODE` is called when the `associateSoftwareToken` needs validating. We need to show the secret key to the user, allow them to configure their TOTP generator app and then gather one token.
* `SUCCESS` is called when the process is successful.
* `FAILURE` is called when the process fails.

The secret key can be generated in one of two ways. First, there is a very long and obnoxious random secret to enter manually into the TOTP generator. This is good if the user is using "copy-and-paste" to set up their TOTP generator app. The other method is to create a URI and turn that URI into a QR code. The URI must have the form:

<tt style="margin-left: 2em">otpauth://totp/_Issuer_:_account_?secret=_secretKey_&issuer=_Issuer_</tt>

The _issuer_ and _account_ are strings that you provide. So you might want to set the issuer to your app name and the account to the username of the user. The _secretKey_ is provided by Amazon Cognito. To turn this into a QR code, I'm using the [QRGen library](https://android-arsenal.com/details/1/2209) that I found on [Android Arsenal](https://android-arsenal.com). This is an easy-to-use QR code generator that can generate bitmaps for an `ImageView`.

Let's look at this in practice:

```kotlin
private fun handler(identityRequest: IdentityRequest, params: Map<String,String>?, callback: IdentityResponse) {
    when(identityRequest) {
        IdentityRequest.SUCCESS -> {
            Log.d(TAG, "handler: SUCCESS")
            this@ConfigureTOTPActivity.finish()
        }

        IdentityRequest.FAILURE -> {
            Log.d(TAG, "handler: FAILURE")
            alert(params!!.get("message")!!) {
                title = "TOTP Configuration Failed"
                positiveButton("Close") { this@ConfigureTOTPActivity.finish() }
            }.show()
        }

        IdentityRequest.NEED_MULTIFACTORCODE -> {
            try {
                if (params != null) {
                    val secretCode = params["secretKey"]
                    if (secretCode != null) {
                        totp_secretcode.text = secretCode
                        val uri = "otpauth://totp/Amazon%20Cognito:${model.currentUser.value?.id}?secret=$secretCode&issuer=Amazon%20Cognito"
                        val bitmap = QRCode.from(uri).bitmap()
                        totp_qrcode.imageBitmap = bitmap

                        // Set up the Validate button to validate the code
                        totp_validatecode.onClick {
                            val mfaDialog = layoutInflater.inflate(R.layout.dialog_multifactor_auth, null)
                            val mfaCodeInput = mfaDialog.find(R.id.dialog_mfa_code) as EditText
                            val mfaInstructions = mfaDialog.find(R.id.dialog_mfa_instructions) as TextView
                            mfaInstructions.text = resources.getString(R.string.totp_validate_instructions)
                            alert {
                                title = "Enter TOTP Code"
                                customView = mfaDialog
                                positiveButton("OK") { callback(mapOf("mfaCode" to mfaCodeInput.text.toString())) }
                            }.show()
                        }
                        totp_validatecode.isEnabled = true
                    } else {
                        throw IllegalArgumentException("No secretCode provided")
                    }
                } else {
                    throw IllegalArgumentException("No parameters provided")
                }
            } catch (error: Exception) {
                alert(error.localizedMessage) {
                    title = "Something went wrong!"
                    positiveButton("Close") { this@ConfigureTOTPActivity.finish() }
                }
            }
        }

        else -> {
            analyticsService.recordEvent("ERROR", mapOf("error" to "unexpected identity request"))
            alert("Unknown or unexpected identity request") {
                title = "Something went wrong!"
                positiveButton("Close") { /* Do Nothing */ }
            }.show()
        }
    }
}
```

## Other concerns

What happens if you do not set TOTP as the default preferred multi-factor authentication provider? (Yes, I did this!)

When you sign-in, the` authenticationChallenge()` is called with a challengeName of `SELECT_MFA_TYPE`. The challenge parameters contain (among other things) a list of configured MFA types - most notably, they will be `SMS_MFA` and `SOFTWARE_TOKEN_MFA`. You have to respond to that challenge with an `MFA_TYPE` set to the appropriate value. The authentication process will then continue as before.

What about asking the appropriate question when asking for TOTP?

When `getMFACode()` is called, the `challengeName` will be set to `SOFTWARE_TOKEN_MFA` or `SMS_MFA`, depending on what sort of code it is expecting. You can use this to adjust the message that is provided to the user.

## Wrap up

I'm not a big fan of TOTP for mobile apps. (I'm a big fan of TOTP for web apps, however). The TOTP is in another app, but on the same phone, so it's hard to configure and requires you to swap apps to get the token. However, it's unavoidable because of security requirements sometimes. Fortunately, Amazon Cognito supports this mode and can be adaptive in its requirements (as we shall see in the last article in this series). Also fortunately, it's easy to configure and use within a mobile app, and the multi-factor authentication feature is flexible enough to accomodate whatever features you want.

gha_language: JavaScript


text:
---
title: "Lulworth Cove Drama Club"
date: 2019-01-08
---

# Lulworth Cove Drama Club
A complete dynamic web site developed using plain PHP.

Features:
* Setup page to configure tables in the database.
* Login and Registration System
* Security: Login blocking and disabling
* Online Forum
* Mobile accessible
* Cookie use
* Newsletter sign up
* Almost all features are dynamic.

Find it in GitHub: [here](https://github.com/elwyncrestha/LulworthCoveDramaClub)

repository: elwyncrestha/elwyncrestha-blog

repo_name: elwyncrestha/elwyncrestha-blog


text:
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.2.4](https://github.com/nearform/graphql-hooks/compare/graphql-hooks-full-ws-transport-example<EMAIL_ADDRESS>(2023-07-18)

**Note:** Version bump only for package graphql-hooks-full-ws-transport-example

## [1.2.3](https://github.com/nearform/graphql-hooks/compare/graphql-hooks-full-ws-transport-example<EMAIL_ADDRESS>(2023-04-26)

**Note:** Version bump only for package graphql-hooks-full-ws-transport-example

## [1.2.2](https://github.com/nearform/graphql-hooks/compare/graphql-hooks-full-ws-transport-example<EMAIL_ADDRESS>(2023-03-31)

**Note:** Version bump only for package graphql-hooks-full-ws-transport-example

## [1.2.1](https://github.com/nearform/graphql-hooks/compare/graphql-hooks-full-ws-transport-example<EMAIL_ADDRESS>(2023-02-25)

**Note:** Version bump only for package graphql-hooks-full-ws-transport-example

# [1.2.0](https://github.com/nearform/graphql-hooks/compare/graphql-hooks-full-ws-transport-example<EMAIL_ADDRESS>(2023-02-17)

**Note:** Version bump only for package graphql-hooks-full-ws-transport-example

# [1.1.0](https://github.com/nearform/graphql-hooks/compare/graphql-hooks-full-ws-transport-example<EMAIL_ADDRESS>(2023-01-10)

**Note:** Version bump only for package graphql-hooks-full-ws-transport-example

## [1.0.5](https://github.com/nearform/graphql-hooks/compare/graphql-hooks-full-ws-transport-example<EMAIL_ADDRESS>(2022-11-16)

**Note:** Version bump only for package graphql-hooks-full-ws-transport-example

## [1.0.4](https://github.com/nearform/graphql-hooks/compare/graphql-hooks-full-ws-transport-example<EMAIL_ADDRESS>(2022-11-07)

**Note:** Version bump only for package graphql-hooks-full-ws-transport-example

## [1.0.3](https://github.com/nearform/graphql-hooks/compare/graphql-hooks-full-ws-transport-example<EMAIL_ADDRESS>(2022-10-11)

**Note:** Version bump only for package graphql-hooks-full-ws-transport-example

## [1.0.2](https://github.com/nearform/graphql-hooks/compare/graphql-hooks-full-ws-transport-example<EMAIL_ADDRESS>(2022-10-11)

**Note:** Version bump only for package graphql-hooks-full-ws-transport-example

## [1.0.1](https://github.com/nearform/graphql-hooks/compare/graphql-hooks-full-ws-transport-example<EMAIL_ADDRESS>(2022-10-05)

**Note:** Version bump only for package graphql-hooks-full-ws-transport-example

# [1.0.0](https://github.com/nearform/graphql-hooks/compare/graphql-hooks-full-ws-transport-example<EMAIL_ADDRESS>(2022-09-26)

**Note:** Version bump only for package graphql-hooks-full-ws-transport-example

## [0.6.4](https://github.com/nearform/graphql-hooks/compare/graphql-hooks-full-ws-transport-example<EMAIL_ADDRESS>(2022-05-25)

**Note:** Version bump only for package graphql-hooks-full-ws-transport-example

## [0.6.3](https://github.com/nearform/graphql-hooks/compare/graphql-hooks-full-ws-transport-example<EMAIL_ADDRESS>(2022-05-05)

**Note:** Version bump only for package graphql-hooks-full-ws-transport-example

## [0.6.2](https://github.com/nearform/graphql-hooks/compare/graphql-hooks-full-ws-transport-example<EMAIL_ADDRESS>(2022-04-29)

**Note:** Version bump only for package graphql-hooks-full-ws-transport-example

## [0.6.1](https://github.com/nearform/graphql-hooks/compare/graphql-hooks-full-ws-transport-example<EMAIL_ADDRESS>(2022-04-21)

**Note:** Version bump only for package graphql-hooks-full-ws-transport-example

# [0.6.0](https://github.com/nearform/graphql-hooks/compare/graphql-hooks-full-ws-transport-example<EMAIL_ADDRESS>(2022-04-20)

**Note:** Version bump only for package graphql-hooks-full-ws-transport-example

# [0.5.0](https://github.com/nearform/graphql-hooks/compare/graphql-hooks-full-ws-transport-example<EMAIL_ADDRESS>(2022-04-15)

**Note:** Version bump only for package graphql-hooks-full-ws-transport-example

# [0.4.0](https://github.com/nearform/graphql-hooks/compare/graphql-hooks-full-ws-transport-example<EMAIL_ADDRESS>(2022-03-25)

**Note:** Version bump only for package graphql-hooks-full-ws-transport-example

# [0.3.0](https://github.com/nearform/graphql-hooks/compare/graphql-hooks-full-ws-transport-example<EMAIL_ADDRESS>(2022-03-25)

**Note:** Version bump only for package graphql-hooks-full-ws-transport-example

## [0.2.1](https://github.com/nearform/graphql-hooks/compare/graphql-hooks-full-ws-transport-example<EMAIL_ADDRESS>(2022-03-11)

**Note:** Version bump only for package graphql-hooks-full-ws-transport-example

# 0.2.0 (2022-02-10)

### Features

- add fullWsTransport support ([#767](https://github.com/nearform/graphql-hooks/issues/767)) ([6a3e7ab](https://github.com/nearform/graphql-hooks/commit/6a3e7ab879e8d2a85ded42fb6cf34e124541018f))

repository: nearform/graphql-hooks

gha_license_id: NOASSERTION

repo_name: nearform/graphql-hooks


text:
# Simple Linear Regression

![](http://ForTheBadge.com/images/badges/made-with-python.svg)

## Dependencies

![](https://img.shields.io/badge/pandas-1.2.3-150458?style=for-the-badge&logo=pandas)
![](https://img.shields.io/badge/numpy-1.19.2-013243?style=for-the-badge&logo=NumPy)
![](https://img.shields.io/badge/matplotlib-3.3.4-224099?style=for-the-badge)
![](https://img.shields.io/badge/scikit_learn-0.24.1-F7931E?style=for-the-badge&logo=scikit-learn)

## Introduction

In statistics, `simple linear regression` is a linear regression model with a single explanatory variable. That is, it concerns two-dimensional sample points with one independent variable and one dependent variable (conventionally, the x and y coordinates in a Cartesian coordinate system) and finds a linear function (a non-vertical straight line) that, as accurately as possible, predicts the dependent variable values as a function of the independent variable. The adjective simple refers to the fact that the outcome variable is related to a single predictor.

In the [Notebook](Notebook.ipynb), we learn how to use scikit-learn to implement simple linear regression.

![](img.png)

## Thanks for Reading :)

gha_language: Jupyter Notebook