text:
---
date: 2017-05-20
title: 'Fun with TensorFlow'
tagline: Presentation
category: AI
tags:
- Presentation
- TensorFlow
- Keras
- ReinforcementLearning
- BubbleBreaker
- AlphaGo
layout: post
published: true
---
{% include JB/setup %}

Because of my involvement in organising the TensorFlow & Deep Learning MeetUp group,
and I happened to be in the right place at the right time, I was selected to represent Singapore's
Data Science community at the
[APAC Machine Learning & Data Science Community Summit](http://m.onoffmix.com/event/97444/content)
hosted by Microsoft in Seoul, Korea.

In addition to a short talk I gave at the 'Community Bootcamp' on the Friday, I also gave
a talk at the main summit.  This 45 minute talk included a

TensorFlow/Keras version of the Reinforcement Learning example for 'Bubble Breaker'.

The updated workbook now includes both Theano/Lasagne and TensorFlow/Keras versions of the code,
each of which builds identical models (and have been adapted to provide the same functional interface).  Moreover,
because I've spent more time with the notebook improving it, the example is now even stronger than before.

![Presentation Screenshot]({{ site.url }}/assets/img/2017-05-20_APAC-Summit_600x390.png)

If there are any questions about the presentation please ask below,
or contact me using the details given on the slides themselves.

![Presentation Content Example]({{ site.url }}/assets/img/2017-05-20_APAC-Summit_5_600x390.png)

### Refactoring

By the way, the deep-learning-workshop repo is undergoing some major refactoring.  The aim is to
make the individual examples work in a stand-alone fashion (downloading the necessary dependencies) while
the assembled-into-a-VM still works with everything pre-loaded.

That means that downloading an individual notebook and stepping through it should *just work*.  If it doesn't
please let me know, and I'll prioritorize fixing it.

PS:  And if you liked the Workshop, please 'star' the Deep Learning Workshop repo ::

Star


text:
# Data Mining

In the Hogwarts University examinations conducted during
the past 5 years, the toppers registration numbers were
7128, 80197128, 7678 and 6567.

Rachel Green is an expert in data mining and she could
easily infer a pattern in the toppers registration numbers.

In all the registration numbers listed here, the sum of
the odd digits is equal to the sum of the even digits
in the number. She termed the numbers that satisfy
this property as Probable Topper Numbers.

Now, write a C++ program to find whether a given number
is a probable topper number or not.

### INPUT & OUTPUT FORMAT:

Input consists of a single integer. <br>
The output consists of a single line. Refer the sample output for details.

### SAMPLE INPUT 1:

```
143
```

### SAMPLE OUTPUT 1:

```
Yes
```

### SAMPLE INPUT 2:

```
234
```

### SAMPLE OUTPUT 2:

```
No
```

### SAMPLE INPUT 3:

```
127
```

### SAMPLE OUTPUT 3:

```
No
```

### SAMPLE INPUT 4:

```
678
```

### SAMPLE OUTPUT 4:

```
No
```

license: MIT

repository: KamalDGRT/ProgrammingPractice

branch_name: refs/heads/main

extension: md

gha_license_id: MIT

license_type: permissive

repo_name: KamalDGRT/ProgrammingPractice


text:
# sparkySeedTools

[![Build Status](https://travis-ci.com/tuck1s/sparkySeedTools.svg?branch=master)](https://travis-ci.com/tuck1s/sparkySeedTools)

## count-domains

Extract and count the distinct domains of email addresses.

The output is in “comma separated variable” (CSV) format, so it can be processed by other tools.

### Usage
```
./count-domains.py -h
usage: count-domains.py [-h] [-mx] [file [file ...]]

List the distinct domains (and their frequency) from file(s) of email addresses

positional arguments:
  file        input filename. If omitted, will read from stdin

optional arguments:
  -h, --help  show this help message and exit
  -mx         show MX record lookup

```

### Example

```
./count-domains.py -mx test_list.txt
domain,count,"MX"
gmail.com,1,"gmail-smtp-in.l.google.com. alt4.gmail-smtp-in.l.google.com. alt1.gmail-smtp-in.l.google.com. alt2.gmail-smtp-in.l.google.com. alt3.gmail-smtp-in.l.google.com."
yahoo.com,2,"mta5.am0.yahoodns.net. mta6.am0.yahoodns.net. mta7.am0.yahoodns.net."
```

branch_name: refs/heads/master


text:
---
layout: default
---

# 1996-03-07 - Re: Square pegs in round holes, matchmaking, corporate mailservers

## Header Data

From: Hal<EMAIL_ADDRESS>To<EMAIL_ADDRESS>Message Hash: 21887ccbb6e041435f5f489bc45d476a78933c1f9fc8fc6849e42c13daedaa0a

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1996-03-07 21:36:51 UTC

Raw Date: Fri, 8 Mar 1996 05:36:51 +0800

## Raw message

```
{% raw  %}From: Hal<EMAIL_ADDRESS>Date: Fri, 8 Mar 1996 05:36:51 +0800
To<EMAIL_ADDRESS>Subject: Re: Square pegs in round holes, matchmaking, corporate mailservers
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

-----BEGIN PGP SIGNED MESSAGE-----

Dimitris Tsapakidis<EMAIL_ADDRESS>wrote:
>Bob must find out whether Alice has declared (commited) her interest
>in him, if and only if he has declared (commited) his interest in her.
>Before he does so, he can at most know that a girl is interested in him.
>Another description: Bob and Alice can have a date if they both commit
>to each other. If only one commits, nobody will ever find out about it.

To avoid a trusted intermediary, the problem can be thought of as a
secure multi-party communication problem with private inputs, which is
much studied in the literature.  The easiest formulation is pairwise:
Alice and Bob mutually engage in the calculation of "Alice loves Bob"
AND "Bob loves Alice".  Each inputs his feelings as an input bit, and
the output will be true only if they have mutual feelings.  Each pair of
potential lovers would then go through the protocol with each other.

This problem is solved in "Multiparty Computations Ensuring Privacy of
Each Party's Input and Correctness of the Result", by Chaum, Damgard,
and van de Graaf, in the proceedings of the Crypto 87 conference.  They
even discuss this application directly:  "Note that this AND-gate
computation, where both parties want to hide their input from each
other, has a meaningful application: consider the situation where Alice
and Bob have just met, and each considers dating the other.  Neither
wishes to lose face in the following sense: if Alice wants a date but
Bob doesn't, Alice does not want to let Bob know that she wanted the
date.  And the same holds for Bob.  In other words: if a party does not
want the date it does not find out the other party's decision."

The solution is reasonably practical, involving scrambled truth tables
and bit commitments, and is related to some of Chaum's work on
zero-knowledge.  The paper is a bit theoretical and hard to read,
though.  I can write up the protocol if anyone is interested.

Hal

-----BEGIN PGP SIGNATURE-----
Version: 2.6

iQBVAwUBMT8p4RnMLJtOy9MBAQHUAQIAv6tTbhLvTnbxX+7BlSIQcxCBfF+FhL1E
mR57Ks8Rklg2PxEotSl9BDEtKWVFoqXg8UdNhsj6d3ASFzdQe0B6Hg==
=tCch
-----END PGP SIGNATURE-----

{% endraw %}
```

## Thread

+ Return to [March 1996](/archive/1996/03)

+ Return to "[Hal <hfinney@shell.portal.com>](/authors/hal_hfinney_at_shell_portal_com_)"

+ 1996-03-07 (Fri, 8 Mar 1996 05:36:51 +0800) - Re: Square pegs in round holes, matchmaking, corporate mailservers - _Hal<EMAIL_ADDRESS>


text:
---
title: PagerDuty v1 event handler
description: The PagerDuty v1 event handler allows you to send Kapacitor alerts to PagerDuty. This page includes configuration options and usage examples.
---

[PagerDuty](https://www.pagerduty.com/) is an incident management platform that
helps teams detect and fix infrastructure problems quickly.
Kapacitor can be configured to send alert messages to PagerDuty.

    This page is specific to PagerDuty's v1 API which has been deprecated.
    PagerDuty recommends migrating to their v2 API. View the
    PagerDuty API migration guide
    for more information about upgrading. If using the v2 API, view the
    PagerDuty v2 event handler documentation.

## Configuration
Configuration as well as default [option](#options) values for the PagerDuty v1
event handler are set in your `kapacitor.conf`.
Below is an example configuration:

```toml
[pagerduty]
  enabled = true
  service-key = ""
  url = "https://events.pagerduty.com/generic/2010-04-15/create_event.json"
  global = false
```

#### `enabled`
Set to `true` to enable the PagerDuty v1 event handler.

#### `service-key`
Your [PagerDuty Service Key](https://support.pagerduty.com/docs/services-and-integrations).

#### `url`
The PagerDuty API v1 URL. _**This should not need to be changed.**_

#### `global`
If `true`, all alerts will be sent to PagerDuty without explicitly specifying
PagerDuty in TICKscripts.

## Options
The following PagerDuty v1 event handler options can be set in a
[handler file](/kapacitor/v1.5/event_handlers/#handler-file) or when using
`.pagerDuty()` in a TICKscript.

| Name        | Type   | Description                                     |
| ----        | ----   | -----------                                     |
| service-key | string | The PagerDuty service key to use for the alert. |

### Example: handler file
```yaml
id: handler-id
topic: topic-name
kind: pagerduty
options:
  service-key: 'myservicekey'
```

### Example: TICKscript
```js
|alert()
  // ...
  .pagerDuty()
    .serviceKey('myservicekey')
```

## PagerDuty Setup
To allow Kapacitor to send alerts to PagerDuty
[enable a new "Generic API" integration](https://support.pagerduty.com/docs/services-and-integrations#section-create-a-generic-events-api-integration).
Use the generated "Integration Key" as the `service-key` under the `[pagerduty]`
section of your `kapacitor.conf`.

##  Using the PagerDuty v1 Event Handler
With the PagerDuty v1 event handler enabled in your `kapacitor.conf`, use the
`.pagerDuty()` attribute in your TICKscripts to send alerts to a PagerDuty or
define a PagerDuty v1 handler that subscribes to a topic and sends published
alerts to PagerDuty.

The examples below use the following PagerDuty v1 configuration defined in the `kapacitor.conf`:

_**PagerDuty v1 settings in kapacitor.conf**_
```toml
[pagerduty]
  enabled = true
  service-key = "myservicekey"
  url = "https://events.pagerduty.com/generic/2010-04-15/create_event.json"
  global = false
```

### Send alerts to PagerDuty from a TICKscript

The following TICKscript uses the `.pagerDuty()` event handler to send the
message, "Hey, check your CPU", whenever idle CPU usage drops below 10%.

_**pagerduty-cpu-alert.tick**_
```js
stream
  |from()
    .measurement('cpu')
  |alert()
    .crit(lambda: "usage_idle" < 10)
    .message('Hey, check your CPU')
    .pagerDuty()
```

### Send alerts to PagerDuty from a defined handler

The following setup sends an alert to the `cpu` topic with the message,
"Hey, check your CPU".
A PagerDuty v1 handler is added that subscribes to the `cpu` topic and publishes
all alert messages to PagerDuty.

Create a TICKscript that publishes alert messages to a topic.
The TICKscript below sends an alert message to the `cpu` topic any time CPU
idle usage drops below 10% _(or CPU usage is above 90%)_.

_**cpu\_alert.tick**_
```js
stream
  |from()
    .measurement('cpu')
  |alert()
    .crit(lambda: "usage_idle" < 10)
    .message('Hey, check your CPU')
    .topic('cpu')
```

Add and enable the TICKscript:

```bash
kapacitor define cpu_alert -tick cpu_alert.tick
kapacitor enable cpu_alert
```

Create a handler file that subscribes to the `cpu` topic and uses the PagerDuty
v1 event handler to send alerts to PagerDuty.

_**pagerduty\_cpu\_handler.yaml**_
```yaml
topic: cpu
id: pagerduty-cpu-alert
kind: pagerduty
options:
  service-key: 'myservicekey'
```

Add the handler:

```bash
kapacitor define-topic-handler pagerduty_cpu_handler.yaml
```


text:
# COVID-19-Statistics app
A tool fully based off of web scraping for covid-19 stats. The libraries used in this are Beautiful soup for parcing, requests for getting the information online and easygui for a graphical interface.

Shows Worldwide cases, deaths, recovered and active cases.

It also shows total cases, total deaths, new cases, and total recovered for each and every country.

https://youtu.be/6DjgnRSULb0

# Language
Requires Python 3.x


text:
## f\_eof

The f\_eof function tests for end-of-file on a file.

    int f_eof (
      FIL* fp   /* [IN] File object */
    );

#### Parameters

  - fp
    Pointer to the open file object structure.

#### Return Values

The `f_eof()` function returns a non-zero value if the read/write
pointer has reached end of the file; otherwise it returns a zero.

#### Description

In this revision, this function is implemented as a macro.

    #define f_eof(fp) (((fp)->fptr) == ((fp)->fsize) ? 1 : 0)

#### QuickInfo

Always available.

#### See Also

`f_open, f_lseek, FIL`

repository: Zeke-OS/zeke

gha_language: C

gha_license_id: NOASSERTION

repo_name: Zeke-OS/zeke


text:
---
graph_type: line
national_geographical_coverage: United States
has_metadata: true
indicator_sort_order: 03-0c-01
indicator: 3.c.1
variable_notes: null
variable_description: null
layout: indicator
permalink: /3-c-1/
sdg_goal: 3
actual_indicator_available: 'Number of health workers per 1000 population and by metropolitan status '
actual_indicator_available_description: >-
  Health care workers include active physicians, physician assistants, and
  advanced practice registered nurses. Advanced practice registered nurses
  includes nurse practitioners, clinical nurse specialist, certified registered
  nurse anesthetists, and advance practice nurse midwives.
comments_and_limitations: >-
  Data points from 2010 to 2016 are updated in May 2019 due to change in
  methodology.
computation_units: Number of health care workers (per 1000 population)
data_non_statistical: false
date_metadata_updated: May 2019
date_of_national_source_publication: July 2018
disaggregation_geography: National and by metro status
goal_meta_link: 'http://unstats.un.org/sdgs/files/metadata-compilation/Metadata-Goal-3.pdf'
graph_title: US health care workers per 1000 population
indicator_definition: Number of health workers per 1000 population.
indicator_name: Health worker density and distribution
indicator_variable: healthworker_density
method_of_computation: >-
  Number of health workers by cadre / Total population. Method of measurement:
  National database or registry of health workers, preferably at individual
  level. Method of estimation: If there is a national database or registry,
  there should be regular assessment of completeness using census data,
  professional association registers, facility censuses, etc. Health worker
  concentration: percentage of all health workers working in urban areas divided
  by percentage of total population in urban areas.
periodicity: Annual
published: true
reporting_status: complete
scheduled_update_by_national_source: July 2019
source_active_1: true
source_agency_staff_email_1<EMAIL_ADDRESS>source_agency_staff_name_1: Yahtyng Sheu
source_agency_survey_dataset_1: >-
  Health Resources and Services Administration, Area Health Resources Files
  (AHRF)
source_organisation_1: >-
  Health Resources and Services Administration, Bureau of Health Workforce,
  National Center for Health Workforce Analysis
source_url_1: 'http://ahrf.hrsa.gov/'
source_url_text_1: 'http://ahrf.hrsa.gov/'
target: >-
  Substantially increase health financing and the recruitment, development,
  training and retention of the health workforce in developing countries,
  especially in least developed countries and small island developing States.
target_id: 3.c
title: Health worker density and distribution
un_custodial_agency: WHO
un_designated_tier: '1'
us_method_of_computation: >-
  Data come from 2017-2018 Area Health Resources Files (AHRF), which
  incorporates several data sources at the aggregated level. Physician
  information, including non-federal doctors of medicine (M.D.) and doctors of
  osteopath (D.O.), is from the American Medical Association Physician Master
  file. Physician assistant and advanced practice registered nurse (including,
  nurse practitioner, clinical nurse specialist, certified registered nurse
  anesthetists, and advance practice nurse midwife) data are from the Centers
  from Medicare and Medicaid Services (CMS) National Provider Identification
  (NPI) File. The Administrative Simplification provisions of the Health
  Insurance Portability and Accountability Act of 1996 (HIPAA) mandated the
  adoption of standard unique identifiers for health care providers and health
  plans. The NPI is a unique identifier developed by CMS. Covered health care
  providers and all health plans and health care clearinghouses must use the
  NPIs in the administrative and financial transactions adopted under HIPAA. The
  2010 Population information is from 2010 Census Redistricting Data (Public Law
  94-171) Summary File, The 2011-2016 Population Estimates are from the Census
  Bureau and include the calculated number of people living in an area as of
  July 1. The estimated population is calculated from a components of change
  model that incorporates information on natural change (births, deaths) and net
  migration (net internal migration, net international migration) that has
  occurred in an area since a Census 2010 reference date for 2011-2016
  estimates.  Metro/non-metro classification is from Census Bureau and defined
  based on the Office of Management and Budget’s 2017 delineation of
  Metropolitan and Micropolitan Statistical Area. The 2017 updates are based on
  the applications of the 2010 Standards for Delineating the Metropolitan and
  Micropolitan Statistical areas to Census population estimate for July 2014 and
  July 2015.
goal_meta_link_text: UN metadata
data_show_map: false
source_active_2: false
disaggregation_categories: NA
international_and_national_references: NA
time_period: 2010-2016
source_notes_1: >-
  Area Health Resources Files (AHRF) incorporates several data sources at the
  aggregated level, including health workers data, population data, and
  geographic data.
---

repository: GSA/sdg-data-usa

branch_name: refs/heads/develop

gha_language: Python

repo_name: GSA/sdg-data-usa


text:
## Apps (or Kubernetes Application Templates)

Apps (or Kubernetes Application Templates) are a Kubernetes extension proposed by OpenShift 3 to enable a single JSON file to configure various Kubernetes resources ([Pods](pods.html), [Replication Controllers](replicationControllers.html), [Services](services.html)).

So an App could define some database containers, cache tier and application servers; it represents a typical enterprise or web application (as opposed to a mobile or desktop app).

Here's an [example template](https://github.com/openshift/origin/blob/master/api/examples/template.json).

A template is also **parameterizable**; so that as the template is instantiated by a tool (command line, web console) the user is prompted to enter the parameter values to create the configuration used to generate the pods, replication controllers and services.

For example an App could generate an ActiveMQ regional cluster; where the template is parameterised with the region name, it's service port number and the number of replicas.

You can install or upgrade application using the [helm command line tool](helm.html).

gha_language: Java


text:
# Host-target interaction tests

For the purposes of this doc "target" is the machine running a version of
Fuchsia being tested, and "host" is the machine running some stable OS. A
host-target interaction test runs on the host and interacts with the target.

## Declaration in GN

To declare a host-target interaction test in GN:

1.  Declare a test executable.
2.  Specify one or more [environments](/docs/contribute/testing/environments.md)
    that include Fuchsia (target) devices.
3.  Add a dependency between a
    [tests bundle](/docs/development/build/build_system/bundles.md) and the test
    executable, *specifying `host_toolchain`*.

For example:

```gn
# Doesn't have to be go_test. This is just an example.
go_test("an_hti_test") {
    ...
    # Declares that Fuchsia should be running in an emulator before this test
    # starts on the host.
    environments = [emu_env]
    ...
}

# This should be included in the transitive deps of some tests bundle.
group("tests") {
    testonly = true
    # Anything that depends on ":tests" will build the test as a host test.
    public_deps = [":an_hti_test($host_toolchain)"]
}
```

## Host test API

The continuous integration infrastructure (AKA "infra") and `fx test` start the
target and then invoke the test on the host.

[SL4F](/docs/development/drivers/concepts/driver_development/sl4f.md) is one way for the host to interact with
the target. The SL4F host libraries take responsibility for establishing a
connection with the target.

Tests that don't want to use SL4F can parse these environment variables and
handle their own communication with the host:

*   `FUCHSIA_IPV4_ADDR`: IPv4 address.
*   `FUCHSIA_IPV6_ADDR`: IPv6 address.
*   `FUCHSIA_SSH_KEY`: SSH key file path.

repository: gnoliyil/fuchsia

repo_name: gnoliyil/fuchsia


text:
# Integrated Rating Request
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-integrated-rating-request-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/????)
[![Platform](https://img.shields.io/badge/platform-android-green.svg)](http://developer.android.com/index.html)
[![API](https://img.shields.io/badge/API-11%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=11)
[![License](https://img.shields.io/badge/License-MIT-blue.svg?style=flat)](http://opensource.org/licenses/MIT)

#### A better way to ask for ratings.

<img src="https://github.com/mediavrog/integrated-rating-request/blob/master/art/flow.png?raw=true" width="500">

As [popularized by Circa](https://medium.com/circa/the-right-way-to-ask-users-to-review-your-app-9a32fd604fca).

* get better ratings by showing the rate reminder in your layout instead of popup
* full control over design, irr manages only the flow and visibility of the rate reminder
* customize the conditions when to show the rate reminder
* .. or supply your own RuleEngine altogether for full control
* adjustable callbacks for rating and feedback
* list adapter decorator can manage visibility of irr in a list automatically so you don't have to

## Demo application

[Get from Play Store](https://play.google.com/store/apps/details?id=net.mediavrog.samples.irr)

repository: gitter-badger/integrated-rating-request

repo_name: gitter-badger/integrated-rating-request


text:
# puppet-wait-for

[![Build Status](https://img.shields.io/travis/heini/puppet-wait-for.svg)](https://travis-ci.org/heini/puppet-wait-for)

A Puppet resource type that enables you to wait for certain conditions. You can use shell commands to query arbitrary things and either react on the exit code or match the output of the command against a regular expression.

Warning: By using this module you are leaving the purist Puppet philosophy - this is not really a resource whose state can updated/kept in sync by Puppet. Also, you might be tempted to use this module to work around issues that should be fixed by other means.

That said, there are situations where this might come in handy - for example, when you need to start/stop services in some asynchronous fashion. Puppet's basic assumption is, that when the code to update a resource has finished, then the resource is in the desired state, period. In the real world, this is not always the case, especially if you are doing a lot of things via exec resources and even more if the exec commandforks or kicks off a process which needs some time to come up.

## Installation

Either install the latest release from puppet forge:

```text
puppet module install heini-wait_for
```

Or add to your Puppetfile:

```text
mod 'heini/wait_for'
```

## Usage

Simply add this module to your Puppetfile to make the type available.

## Examples

Wait for a Linux sshd service to start:

```puppet
service { 'logstash':
  ensure => running,
  enable => true,
}

# Wait for the service to really start.
wait_for { 'logstash':
  query             => 'cat /var/log/logstash/logstash-plain.log 2> /dev/null',
  regex             => 'Successfully started Logstash API endpoint',
  polling_frequency => 5,  # Wait up to 2 minutes (24 * 5 seconds).
  max_retries       => 24,
  refreshonly       => true,
}
```

Wait for a Windows MySQL service to start:

```puppet
wait_for { 'sc query MySQL5':
  regex => '.*STATE\s*:\s*4\s*RUNNING.*',
}
```

Wait until a command returns an exit code of 5:

```puppet
wait_for { 'scp big_file user@remote.com:/tmp':
  exit_code         => 5,   # Handle exit code 5, connection lost.
  polling_frequency => 0.3,
  max_retries       => 5,
}
```

Just wait for 1 minute:

```puppet
wait_for { 'a_minute':
  seconds => 60,
}
```

Execute a command and inject some environment variables (just like 'exec' does).

```puppet
wait_for { 'env':
  environment => ['FOO=bar', 'BAR=baz'],
  regex       => 'FOO=.*',
}
```

Use the query namevar:

```puppet
wait_for { 'without implicit namevar':
  query => 'echo foobar',
  regex => 'foobar',
}
```

## Testing

### Testing

Make sure you have:

* rake
* bundler
* Vagrant (for the Beaker tests)

Install the necessary gems:

```text
bundle install
```

To run the tests from the root of the source code:

```text
bundle exec rake spec
```

To also run the acceptance tests:

```text
export BEAKER_PUPPET_COLLECTION=puppet6
export BEAKER_PUPPET_INSTALL_VERSION=6.4.2
bundle exec rspec spec/acceptance
```

Tested using Puppet 6.4.2 and Ruby 2.4.1.

### Release

This module uses Puppet Blacksmith to publish to the Puppet Forge.

Ensure you have these lines in `~/.bash_profile`:

```text
export BLACKSMITH_FORGE_URL=https://forgeapi.puppetlabs.com
export BLACKSMITH_FORGE_USERNAME=heini
export BLACKSMITH_FORGE_PASSWORD=xxxxxxxxx
```

Build the module:

```text
bundle exec rake build
```

Push to Forge:

```text
bundle exec rake module:push
```

Clean the pkg dir (otherwise Blacksmith will try to push old copies to Forge next time you run it and it will fail):

```text
bundle exec rake module:clean
```

repository: heini/puppet-wait-for

gha_language: Ruby

repo_name: heini/puppet-wait-for


text:
---
topic: "Java: Tutorials"
desc: "Online resources for learning Java"
---

* [A small collection of Java tutorials from Oracle](http://docs.oracle.com/javase/tutorial/)
* [A "Really Big Index" of Java tutorials from Oracle](http://docs.oracle.com/javase/tutorial/reallybigindex.html).
  * Search within this page for a topic
  * Or, browse it to find things you want to learn more about


text:
### Overview
This layer consists of two widely used secure boot technologies: UEFI Secure
Boot and MOK (Machine Owner Key) Secure Boot.

- UEFI Secure Boot is the industry standard defined in the UEFI spec, allowing
the images loaded by UEFI firmware to be verified with the certificates
corresponding to the trusted keys.
- MOK Secure Boot is based on UEFI Secure Boot, adding the shim bootloader to
chainloader the next stage bootloader with the integrity check using the
shim-managed certificates corresponding to another set of trusted keys, which
may be different than the trusted keys used by UEFI Secure Boot.

This layer introduces the SELoader as the second-stage bootloader and eventually
chainliader to the third-stage bootloader "grub". With the extension provided
by SELoader, grub configuration files, kernel (even without EFI stub support)
and initrd can be authenticated. This capability is not available in the shim
bootloader.

Grub bootloader is also enhanced to support lockdown mode. In this mode, the
edit, rescue and command line are protected in order to prevent from
tampering the kernel command line or loading an unsigned boot component. Hence,
this lockdown protection can effectively defeat the attempts to disable the
kernel security mechanisms, e.g, globally disable SELinux or IMA. The
flexibility is also provided with the user authentication in grub. The user
authenticated by a password check can enter into edit and command line.

Therefore, using UEFI Secure Boot, shim, SELoader, and grub lockdown together,
the boot process is completely trustworthy.

A complete boot flow looks like as following:

- UEFI firmware boot manager (UEFI Secure Boot enabled) ->
  - shim (verified by a DB certificate) ->
    - SELoader (ditto) ->
      - grub (ditto) ->
        - grub.cfg (ditto)
        - kernel (ditto)
        - initramfs (ditto)

### Quick Start For The First Boot
- Deploy the rootfs

- Power up the system

- Enter to BIOS setup and remove the enrolled certificates
  * It is recommended to still turn on UEFI Secure Boot option if allowed.

- Exit BIOS setup

- Manually launch a reboot immediately via Ctrl + Alt + Del
  * Otherwise, a misleading error message about the verification failure
  will be displayed.

- Automatically boot to the boot option "Automatic Certificate Provision" in
  grub boot menu.

- (Optional) Enter to BIOS setup to turn on UEFI Secure Boot option and then
  exit BIOS setup

- Boot to the system with the protection provided by UEFI and MOK Secure Boot

### Key Management
Refer to meta-signing-key/README.md for the initial cognition about key
management.

Note that the sample key and user key are the concepts in the key signing
model according to the ownership and secrecy. In UEFI Secure Boot, a policy
object such as PK, KEK, DB and DBX is always mapped to a key useed by the
key signing model.

#### Sample Keys
This layer, by default, use **the sample keys** to sign and verify images for
the purpose of development and demonstration. **Please ensure you know what your
risk is to use the sample keys in your product, because they are completely
public.**

The sample keys used for UEFI Secure Boot are centrally placed under
meta-signing-key/files/uefi_sb_keys/.

- PK.crt
  The X509 certificate enrolled to UEFI firmware, used to update/delete PK/KEK.

- PK.key
  The private key corresponding to PK.crt, used to sign the EFI signature
  list for PK/KEK enrollment.

- KEK.crt
  The X509 certificate enrolled to UEFI firmware, used to update/delete
  DB/DBX.

- KEK.key
  The private key corresponding to KEK.crt, used to sign the EFI signature
  list for DB/DBX enrollment.

- DB.crt
  The X509 certificate enrolled to UEFI firmware, used to verify the images
  directly loaded by UEFI firmware.

- DB.key
  The private key corresponding to DB.crt, used to sign the images directly
  loaded by UEFI firmware.

- DBX
  This directory contains any number of X509 certificate enrolled to UEFI
  firmware, used to blacklist the revoked certificates. Note the revoked
  certificates must be PEM-formatted.

The sample keys used for MOK Secure Boot are centrally placed under
`meta-signing-key/files/mok_sb_keys/`.

- shim_cert.crt
  The X509 certificate embedded in shim, used to verify the images either
  directly or indirectly loaded by shim. Currently, this certificate is
  not used by default.

- shim_cert.key
  The private key corresponding to shim_cert.crt, used to sign the images
  either directly or indirectly loaded by shim. Currently, this certificate
  is not used by default.

- vendor_cert.crt
  Act as the same way as shim_cert.crt. In addition, vendor certificate
  is the switch to enable MOK Verify Protocol, which facilitates the
  verification for the SELoader and MOK Manager.

- vendor_cert.key
  The private key corresponding to vendor_cert.crt, acting as the same fuction
  as shim_cert.key.

- vendor_dbx
  This directory contains any number of X509 certificate embedded in shim,
  used to blacklist the revoked certificates.

#### User Keys
Refer to meta-signing-key/README.md for the details about how to generate/use
the keys owned by the end user.

#### Automatic Certificate Provision
The certificate provision is required to enable UEFI Secure Boot. By default,
the system may be already provisioned with default certificates enrolled during
the manufacture.

In order to use the bootloader and kernel signed by the sample or self-owned
key to boot up the system, this layer provides a process of automatic
certificate provison for the convenience. The detailed descriptions are
given below.

##### Remove the enrolled certificates in BIOS setup
The EFI/BOOT/LockDown.efi is used to run the automatic certificate provision.
However, LockDown.efi cannot be launched if UEFI Secure Boot is already
enabled. In addition, the enrolled certificates may be not the ones the user
hopes to use.

The provisioned certificates can be removed through BIOS setup. The detailed
steps may vary between the systems. Refer to the corresponding BIOS manual for
the instructions.

##### Launch the automatic certificate provision
The Lockdown.efi will automatically provision UEFI Secure Boot after removing
the enrolled certificates in BIOS setup. More specifically, the new PK, KEK, DB
and DBX (if any) will be enrolled and begin to take affect after a reboot.

The new PK, KEK, DB and DBX (if any) were built into LockDown.efi during the
build.

##### Turn on UEFI Secure Boot option
If UEFI Secure Boot option was turned off, the user has to enter to BIOS setup
again after the automatic certificate provision in order to manually turn on
this option.

If this option was not turned off when removing the enrolled certificates in
BIOS setup, this step is skippable.

##### Re-trigger automatic certificate provision
The boot option "Automatic Certificate Provision" is hidden in grub boot menu
for the first boot. If the user would like to clear the certificates
provisioned by the option "Automatic Certificate Provision" in BIOS setup, this
hidden boot option will be shown, allowing to re-trigger it if necessary.

### Signing
By default, the build system uses DB.key to sign shim, and uses vendor_cert.key
to sign SELoader, grub, grub configuration file, kernel and initramfs image
during the build.

### Verification

#### UEFI firmware verification
UEFI firmware will validate the integrity of shim bootloader with a certificate
in DB before launching it.

#### Bootloader verification
This layer employs 3-level bootloader for secure boot process. Each former
bootloader must check the integrity e.g, when the
SELoader loads grub, if both UEFI Secure Boot and MOK Secure Boot are already
enabled, the former bootloader uses a list of certificate to check the
integrity of the later bootloader.

- Blacklist check
  If the later bootloader is signed with a key corresponding to a certificate
  within any of a policy object below, the later bootloader is denied to
  launch immediately, without the necessity to go through the following
  processes.

  * Vendor DBX
  * DBX
  * MokListX (the blacklist of MOK certificate)

- Whitelist check
  If the later bootloader is signed with a key corresponding to a certificate
  within any of a policy object below, the later bootloader is granted to
  launch.

  * DB
  * MokList (the whitelist of MOK certificate)
  * Shim certificate (only for PE image)
  * Vendor certificate

If the later bootloader is not signed or signed by a key not corresponding to
any policy objects mentioned above, the later bootloader is denied to launch.

The benefit of showing this checklist allows the end user to use an
appropriater way to manage the key and boot up the system, even without the
ownership of a signing key, such as the DB key widely used on Microsoft
certificated hardware.

##### SELoader verification
The SELoader is designed to authenticate the non-PE files, such as grub.cfg,
kernel (without EFI stub support) and initramfs, which cannot be verified by
the MOK Verify Protocol registered by the shim loader.

In order to conveniently authenticate the PE file with gBS->LoadImage()
and gBS->StartImage(), the SELoader hooks EFI Security2 Architectural
Protocol and employs MOK Verify Protocol to verify the PE file. If only
UEFI Secure Boot is configured and enabled, the SELoader just simplily calls
gBS->LoadImage() and gBS->StartImage() to allow UEFI firmware to verify the
PE file.

The SELoader publishes MOK2 Verify Protocol which provides a flexible interface
to allow the bootloader to verify the file, file buffer or memory buffer
without knowing the file format. This design allows the non-PE files to be
verified by the same certificate used for authenticating PE files.

In order to establish the chain of trust, the SELoader is required to be
signed by a private key corresponding to a DB certificate, the shim
certificate, the vendor certificate or a MOK certificate mentioned above.
The specific key used is determined by the secure boot scheme you will use.

See more details about README in SELoader.

#### Grub configuration file verification
Grub is enhanced to have the capability of calling MOK2 Verify Protocol
registered by the SELoader to validate the integrity of grub configuration
file before parsing it.

This protection prevents from tampering the grub configuration file from
globally disabling certains kernel security mechanism such as SELinux and IMA
which are activated in kernel command line.

#### Kernel verification
When grub loads the kernel image with the command "linux", if both UEFI
Secure Boot and MOK Secure Boot are already enabled, grub will call the
MOK2 Verify Protocol installed by SELoader to validate the kernel image.

It is recommended to avoid using the command "chainloader" to load kernel
image. The build system also avoids signing the kernel with EFI-stub
bootloader.

By default, the kernel image is signed by vendor certificate and generate
the .p7b signature file.

#### Initramfs verification
When grub loads the kernel image with the command "initrd", if both UEFI
Secure Boot and MOK Secure Boot are already enabled, grub will call the
MOK2 Verify Protocol installed by SELoader to validate the initramfs image.

By default, the initramfs image is signed by vendor certificate and generate
the .p7b signature file.

- A boot component is not signed.
- A boot component is signed by a key which doesn't correspond to any
  certificate in whitelists such as DB and shim-managed certificates as
  mentioned above.
- A boot component is signed by a key which corresponds to a certificate in
  blacklist such as DBX and shim-managed certificates in blacklist as
  mentioned above.

Each boot component may have different verification failure phenomenon.
- If shim fails signature check, UEFI firmware boot manager will print an
  error message about the image authentication failure.
- If SELoader fails signature check, shim will print an error message about
  the security violation.
- If grub fails signature check, an image authentication failure message is
  printed and the system hangs.
- If a grub configuration file fails the signature check, an authentication
  failure message is printed and grub hangs.
- If kernel image fails signature check, grub returns back to the boot menu.
- If initrd fails signature check, grub returns back to the boot menu.

### MOK Secure Boot and the shim bootloader
MOK Secure Boot is based on UEFI Secure Boot, adding the shim bootloader to
chainloader the bootloader "SELoader" and eventually chainliader to the
bootloader "grub".

[ Quoting: https://github.com/rhboot/shim ]
shim is a trivial EFI application that, when run, attempts to open and
execute another application. It will initially attempt to do this via the
standard EFI LoadImage() and StartImage() calls. If these fail (because secure
boot is enabled and the binary is not signed with an appropriate key, for
instance) it will then validate the binary against a built-in certificate. If
this succeeds and if the binary or signing key are not blacklisted then shim
will relocate and execute the binary.

shim will also install a protocol which permits the second-stage bootloader
to perform similar binary validation. This protocol has a GUID as described
in the shim.h header file and provides a single entry point. On 64-bit systems
this entry point expects to be called with SysV ABI rather than MSABI, and
so calls to it should not be wrapped.
[ End of Quote ]

In most cases, the hardware coming out of the factory is already provisioned
with a default certificate used to verify the bootloader and issued by
Microsoft Corporation UEFI CA 2011. This kind of hardware is so-called
Microsoft certificated hardware.

Obviously, this requirement needs a bootloader loaded by BIOS must be signed
by Microsoft. Microsoft provides the signing service (not free), but only
accept shim bootloader for Linux world. Refer to [Microsoft's signing policy](http://blogs.msdn.com/b/windows_hardware_certification/archive/2013/12/03/microsoft-uefi-ca-signing-policy-updates.aspx).

It is allowed to remove all default certificates and use the self-owned keys to
provision UEFI firmware, but this is not practical for ODM/OEM devices during
the manufacture phrase. See the section "Out-of-box Experience".

For a good user experience, shim + SELoader + grub is an excellent combination
to handle Microsoft certificated hardware. With this model, SELoader and grub
are signed by a shim-managed certificate without being subject to the limit
from Microsoft's signing policy, and the manual provision is thus unnecessary.

#### mokutil and MOK Manager
mokutil is a tool to import or delete the machines owner keys stored in the
database of shim. mokutil creates the requests and MOK manager will be
automatically launched by shim as long as it detects the pending requests.
The physical present user will be prompted to run the operations corresponding
to the requests. Note the operation is required to be authenticated by MOK
management password set by mokutil.

Refer to mokutil man page for the detailed usages.

##### MOK Management Password
MOK management password is the authentication information to allow MOK manager
to grant the request regarding of MOK management. To set the password, run
mokutil with the option --password. In addition, there are 4 input methods to
provide the password. By default, mokutil prompts the user to input the
password and then wraps the password to sha256 password hash. For other 3
methods, refer to the uses of option --hash-file, --root-pw and --simple-hash.

##### Enroll the MOK certificate
Here is an example showing how to enroll a DER formatted X509 certificate to
the database of shim.
```
# mokutil --import <cert.cer>
```
where `<cert.cer>` is the MOK certificate corresponding to the private key used
to sign either grub or kernel.

To convert a PEM, for exmaple, the shim_cert.crt, to a DER formatted X509
certificate, type the command:
```
$ openssl x509 -in shim_cert.crt -inform PEM -out shim_cert.cer -outform DER
```

##### List the enrollment requests
The several enrollment requests can be submitted before system reboot. Run the
following command to check all enrollment requests.
```
# mokutil --list-new
```

##### Revoke the enrollment requests
Note the revocation operation will remove all enrollment requests.
```
# mokutil --revoke-import
```

##### Test the MOK certificate
If you cannot confirm whether a certificate has been enrolled or not, type the
following command for a check:
```
# mokutil --test-key <cert.cer>
```

##### Delete the MOK certificate
Removing an useless MOK certificate is also supported.
```
# mokutil --delete <cert.cer>
```
Refer to the options --list-delete and --revoke-delete to list and revoke the
MOKs.

##### Reset MOK certificates
This request will clear all enrolled MOK certificates.
```
# mokutil --reset
```

##### Disable/Enable MOK Secure Boot
MOK Secure Boot can be enabled or disabled regardless of the setting of UEFI
Secure Boot.
```
# mokutil --disable-validation  // disable MOK Secure Boot
# mokutil --enable-validation   // enable MOK Secure Boot
```

Note that MOK Secure Boot is based on UEFI Secure Boot. If UEFI Secure Boot
is disabled, MOK Secure Boot will be automatically inactive. Type the
following command to check the status of UEFI Secure Boot.
```
# mokutil --sb-state
```

##### Other options
Refer to the options --import-hash and --delete-hash to manage hash-based
signature. The options --pk, --kek, --db and --dbx are useful to check
the content of the policy objects used in UEFI Secure Boot.

##### Manage blacklist
All above mentioned are talking MOK which is acting as whitelist to
authenticate the verified image to launch. Actually, there is a contrary
policy object called MOKX, acting as blacklist to deny the untrusted
image to launch. Also, MOKX as blacklist is handled by shim prior to MOK
as whitelist.

For the management of blacklist, add the option --mokx with the following
options to change the operation target from MOK to the following options.

--list-enrolled
--test-key
--list-new
--list-delete
--import
--delete
--import-hash
--delete-hash
--reset
--revoke-import
--revoke-delete

##### Handle MOK Secure Boot failure with MOK Manager
If either grub or SELoader is not signed or signed with an unauthorized
certificate, the shim will prompt the end user a UI called MOK Manager to
guide the user to enroll the certificate or hash of the image.

The policy of the selection between digest and certificate for next step is
decided by whether the unauthorized grub or SELoader is signed or not.

If the grub or SELoader is not signed at all, you have to always select
the calculation of the digest based on the file. Note that once grub or
SELoader is updated and its digest is changed, you have to relaunch the MOK
Manager to enroll the new digests.

If the grub or SELoader is signed by an unauthorized certificate, enrolling the
signing certificate is the preferred way. Copy the certificate to the boot
drive and then select the certificate in MOK manager. Note that the
certificate for the selection must be **DER-formatted**.

If doing so, the unauthorized grub or SELoader will be verified successfully
after exiting MOK Manager.

### Grub Lockdown
In order to prevent from tampering the kernel command line or loading an
unsigned boot component, grub is locked if UEFI Secure Boot is enabled. In this
situation, the end user cannot enter into command or edit line via pressing 'c'
and 'e'.

If the user authentication is enabled, the access to command or edit line is
protected by a password. In this situation, grub is unlockable.

Rescue mode is always disabled as long as UEFI Secure Boot is enabled.

### Known Issues
- The 32-bit MOK Secure Boot is not validated. In other words, loading 32-bit
shim, MOK manager, grub and kernel is not supported.
- grub module is not supported by SELoader for the integrity check.

Patches
=======

Please submit any patches against the meta-efi-secure-boot layer to the
maintainer:

Maintainer: Jia Zhang<EMAIL_ADDRESS>
### Reference
[shim - implement MOK Verify Protocol](https://github.com/rhboot/shim)

[SELoader - implement MOK2 Verify Protocol](https://github.com/jiazhang0/SELoader)

[grub - Mok2Verify patch](https://github.com/jiazhang0/meta-secure-core/blob/master/meta-efi-secure-boot/recipes-bsp/grub/grub-efi/mok2verify-support-to-verify-non-PE-file-with-PKCS-7.patch)

[SecureCore - a reference implementation based on OpenEmbedded](https://github.com/jiazhang0/SecureCore)

gha_language: BitBake


text:
node-rtsp-stream
================

** NOTE **
This is a fork of the Node RTSP Stream library found at https://github.com/kyriesent/node-rtsp-stream. This fork is simply to modify the FFMPeg command arguments to improve video playback of a stream in the Google Chrome web browser.

Stream any RTSP stream and output to websocket for consumption by [jsmpeg](https://github.com/phoboslab/jsmpeg). HTML5 streaming video! (Requires ffmpeg)

Usage:

```
$ npm install mikesappshop-node-rtsp-stream
```

On server:
```
Stream = require('mikesappshop-node-rtsp-stream');
stream = new Stream({
    name: 'name',
    streamUrl: 'rtsp://<IP_ADDRESS>/vod/mp4:BigBuckBunny_115k.mov',
    wsPort: 9999
});

```

On client:
```
client = new Websocket('ws://localhost:9999');
player = new jsmpeg(client, {
    canvas: canvas // Canvas should be a canvas DOM element
});

```

For more information on how to use jsmpeg to stream video, visit https://github.com/phoboslab/jsmpeg

repository: mikesappshop/node-rtsp-stream

repo_name: mikesappshop/node-rtsp-stream


text:
# CST116SRS06
SSD

Class ID: Vulpix

SRS ID: CST116SRS06

Unresolved Issues:

Notes:

Partner Left: Taillow

Partner Right: Eevee

---

Purpose:

Learn to use use arrays.
Practice your previously learned skills in a group situation.

Instructions:

Name your project "SSD".

This is a project you will work on with a group of 3 (or 4) students.

If you have 4 students, you will need to arrange yourselves into a square. The person on your left and right are your immediate partners. Groups of 3 will already have a left and right partner.

Your assignment is to learn how to create code for others to use and how to use other people's code in your own project. Working with others is often a challenge especially when you haven't worked with them previously. If you know one of your partners from outside the class, you'll need to choose a different partner.

You will create a function that calculates the "Sample Standard Deviation" on an array of N ints where the value of N is 25 - strlen(your middle name). If you don't have a middle name, strlen will return 0.

You will need to create an array of random int values you will place into an array in code. DO NOT enter the values through std::cin.

You will give your function to your right partner and your data to your left partner.

Likewise, you will receive data from your right partner and a function from your left partner.

Your function should be placed in .cpp file by itself and include a .h (header) file with the function declaration.

You should now have 2 sets of data and 2 functions.

Run all 4 combinations in one program and test that the Sample Standard Deviation functions both produce the same results for the same data set. This means you will have 2 tests, one for each set of data.

You should compare your results with your partners. They should produce the same results. If not, work out why.

On your assignment be sure to indicate your left and right partner in this README.md file. This is important and failing to do so will not allow me to check your work possibly resulting in a zero grade.

Proper submission is extremely important, so be sure to look over the guidelines. You should confirm your submission is correct with the instructor if you have any doubts.

For help with formulas, here is a site that might help you:

https://www.mathsisfun.com/data/standard-deviation-formulas.html


text:
# BPGen

BPGen — **b**oiler**p**late **gen**erator. It helps to rid of writing routine code for each module.

## How does it work
BPGen operates with modules and templates. Modules and templates are just simple directory hierarchy. Each module has one or more templates. Each template has a configuration file and a template file. One template — one generated file. You can not generate a template itself. You **should** use a module for that.

Once you call `generate-module`, BPGen checks if all used parameters in templates are provided, then create a new file based on a template configuration file, a template file and themselves provided parameters. BPGen is looking for parameter names in the template file and replaces them with provided values. BPGen also applies it on `path_to_generated_file` setting in the template configuration file.

Example is [here](https://github.com/EhwaZoom/bpgen/tree/master/example).

## Installation
1. Clone this repository
2. Execute `pip install . --user` in the repository

## Requirements
Tested on Python 3.5+

repository: EhwaZoom/bpgen

repo_name: EhwaZoom/bpgen


text:
# SKRTMAPI has been consolidated into [SlackKit](https://www.github.com/pvzig/SlackKit)

A module for connecting to the [Slack Real Time Messaging API](https://api.slack.com/rtm).

## Installation

### CocoaPods

Add SKRTMAPI to your pod file:

```
use_frameworks!
pod 'SKRTMAPI'
```
and run

```
# Use CocoaPods version >= 1.4.0
pod install
```

### Carthage

Add SKRTMAPI to your Cartfile:

```
github "SlackKit/SKRTMAPI"
```
and run

```
carthage bootstrap
```

Drag the built `SKRTMAPI.framework` into your Xcode project.

### Swift Package Manager

Add SKRTMAPI to your Package.swift

```swift
import PackageDescription

let package = Package(
	dependencies: [
		.package(url: "https://github.com/pvzig/SKRTMAPI.git", .upToNextMinor(from: "4.1.0"))
	]
)
```

Run `swift build` on your application’s main directory.

To use the library in your project import it:

```swift
import SKRTMAPI
```

## Usage
Initialize an instance of `SKRTMAPI` with a Slack auth token:

```swift
let rtm = SKRTMAPI(token: "xoxb-SLACK_AUTH_TOKEN")
rtm.connect()
```

If your bot doesn't need any state information when you connect, pass `false` for the `withInfo` parameter:

```swift
let rtm = SKRTMAPI(token: "xoxb-SLACK_AUTH_TOKEN")
rtm.connect(withInfo: false)
```

Customize the connection with `RTMOptions`:

```swift
let options = RTMOptions(simpleLatest: false, noUnreads: false, mpimAware: true, pingInterval: 30, timeout: 300, reconnect: true)
let rtm = SKRTMAPI(token: "xoxb-SLACK_AUTH_TOKEN", options: options)
rtm.connect()
```

Provide your own web socket implementation by conforming to `RTMWebSocket`:

```swift
public protocol RTMWebSocket {
    init()
    var delegate: RTMDelegate? { get set }
    func connect(url: URL)
    func disconnect()
    func sendMessage(_ message: String) throws
}
```

```swift
let rtmWebSocket = YourRTMWebSocket()
let rtm = SKRTMAPI(token: "xoxb-SLACK_AUTH_TOKEN", rtm: rtmWebSocket)
rtm.connect()
```

repository: pvzig/SKRTMAPI

repo_name: pvzig/SKRTMAPI


text:
# Extending jQuery

Today I learnt how to extend jQuery to create your own jQuery methods such as below:

```javascript
$("#element").doSomethingCrazy(parameters, callback);
```

Such extension of jQuery can make the code more readable and easier to reason about. Let's look at a concrete example of how to achieve it:

```javascript
// Extend jQuery by using `extend` function
jQuery.fn.extend({
  generateRandomBg: function() {
    return this.each(function() { // iterate through each element in a selection since at this point `this` is an array of objects
      var randomColor = '#' + Math.floor(Math.random()*16777215).toString(16);
      return this.style.background = randomColor; // now `this` refers to individual DOM object
    });
  }
});

// Use the newly created $.generateRandomBg() method
$("html, body").on("click", function () {
  $(this).generateRandomBg();
});
```

The above code is fairly straightforward to understand. The basic principle is to use `jQuery.fn.extend` and provide it with any number of functions that will get attached to jQuery.

The only thing that caught me by suprise for a second but then made total sense is that `this` initially refers to an array of objects rather than an individual object. In order to manipulate individual object, you have to iterate over `this` where, consequantly the `this` inside the iteration will refer to an individual object. This is because one jQuery `click` event may be called on several DOM objects.

Anyhow, no wonder jQuery is so popular when it's so easy and pleasant to work with!

### [Demo](http://codepen.io/karolis/pen/YqNRLK/)

repository: karooolis/til

repo_name: karooolis/til


text:
### [CVE-2011-0107](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-0107)
![](https://img.shields.io/static/v1?label=Product&message=n%2Fa&color=blue)
![](https://img.shields.io/static/v1?label=Version&message=n%2Fa&color=blue)
![](https://img.shields.io/static/v1?label=Vulnerability&message=n%2Fa&color=brighgreen)

### Description

Untrusted search path vulnerability in Microsoft Office XP SP3, Office 2003 SP3, and Office 2007 SP2 allows local users to gain privileges via a Trojan horse DLL in the current working directory, as demonstrated by a directory that contains a .docx file, aka "Office Component Insecure Library Loading Vulnerability."

### POC

#### Reference
- https://docs.microsoft.com/en-us/security-updates/securitybulletins/2011/ms11-023

#### Github
No PoCs found on GitHub currently.

repository: trickest/cve

gha_language: HTML

repo_name: trickest/cve


text:
# Questions

This is the issue tracker for Ember Responsive but it's perfectly fine to ask
questions here. Just open up and ticket and inquire within!

# Issues

Think you've found a bug or have a new feature to suggest? Let us know!

## Reporting a Bug

1. Update to the most recent master release, if possible. Verify the bug exists
   on master.

2. Provide with a bug report that shows the problem.

3. If possible, submit a Pull Request with a failing test. Better yet, take
   a stab at fixing the bug yourself if you can!

The more information you provide, the easier it is for us to validate that
there is a bug and the faster we'll be able to take action.

# Pull Requests

We love pull requests. Here's a quick guide:

1. Fork the repo.

2. Run the tests. We only take pull requests with passing tests

3. Add tests for your change. We use both intregration and unit tests, depending
   on what you're writing you may have to write both style of tests.

4. Make the test pass.

5. Commit your changes. If your pull request fixes an issue specify it in the
   commit message.
   Here's an example: `git commit -m "Close #19 - Fix media listener for mobile"`

6. Push to your fork and submit a pull request. Please provide us with some
   explanation of why you made the changes you made. For new features make sure
   to explain a standard use case to us.

# Website / Documentation

The project page is available at https://freshbooks.github.io/ember-responsive/

Contributions to the documentation is just as welcome as project development!

1. Fork the repo.

2. Checkout the `gh-pages` branch

3. Make your changes

4. Commit and open a pull request against the `gh-pages` branch

*NOTE: Partially copied from https://raw.github.com/stefanpenner/ember-app-kit/master/CONTRIBUTING.md*

repository: freshbooks/ember-responsive

gha_language: JavaScript

repo_name: freshbooks/ember-responsive


text:
---
title: Call an Identity Provider API
description: How to call an Identity Provider API.
crews: crew-2
---

# Call an Identity Provider API

Once you successfully authenticate a user with an external Identity Provider (IdP), such as Facebook or GitHub, the IdP often includes an access token in the user profile it returns. You can then use this token to call the IdP's API.

::: note
  This doc assumes that you have already configured the connection with the IdP of your choice. If not, refer to Identity Providers Supported by Auth0, where you can find a list of the supported IdPs. Select the one you want for detailed steps on how to configure the Connection.
:::

## Required Steps

To get access to the user's IdP access token, you will need to:

1. Obtain an access token that allows you to call the [Auth0 Management API](/api/management/v2).
2. Call the Auth0 Management API's [Get Users by ID](/api/management/v2#!/Users/get_users_by_id) endpoint using the access token obtained in step one (the token must have the `read:user_idp_tokens` scope). This returns the user's profile, which contains the IdP access token.
3. Extract the IdP access token.

Once you've extracted the IdP's access token, you can use it to to call the IdP's API. Please refer to your IdP's documentation for specifics on how to do so.

### 1. Get a Token

You will need an access token to call the [Management API](/api/management/v2).

If this is the first time you are requesting a Management APIv2 Token, you'll need to create and configure a test Client that can be used to call the API.

1. Go to [Dashboard > APIs > Auth0 Management API > API Explorer](${manage_url}/#/apis/management/explorer).
2. Click __Create & Authorize a Test Client__.
3. Go to the *Scopes* tab to set the ones that can be assigned by the API.

Once you've created the Client, you now have an access token that can be used to interact with the Management API. It can be found on the *API Explorer* page. Click __Copy Token__ so that you can use it at a later point.

#### Automate the Token Request

You may want to automate the token request process instead of manually copying and pasting the token. If this is the case, click on the [Test tab](${manage_url}/#/apis/management/test) and use the provided snippet. It's a `POST` operation to the [https://${account.namespace}/oauth/token](/api/authentication#client-credentials) endpoint.

The token you receive has, by default, an expiration time of 24 hours (86400 seconds). To change this, update the __Token Expiration (Seconds)__ field and click __Update & Regenerate Token__.

::: note
  For details on the Management APIv2 token and the process to get one refer to The Auth0 Management APIv2 Token.
:::

::: panel-warning Security warning
It should be noted that these tokens __cannot be revoked__. We recommend issuing short-lived tokens to minimize the risk. For a production environment you can configure a simple CLI that will fetch a new token when the old one expires. You can find a sample implementation in Python [here](/api/management/v2/tokens#sample-implementation-python).
:::

### 2. Get the User Profile

Using the access token you obtained in step 1, call the [Get a User](/api/management/v2#!/Users/get_users_by_id) endpoint to get the user profile:

```har
{
    "method": "GET",
    "url": "https://${account.namespace}/api/v2/users/USER_ID",
    "httpVersion": "HTTP/1.1",
    "cookies": [],
    "headers": [{
        "name": "Authorization",
        "value": "Bearer YOUR_ACCESS_TOKEN"
    }]
}
```

Replace these values:
- `USER_ID`: The ID of the user for whom you want to call the IdP's API. You can find this at the [User Details](${manage_url}/#/users/).
- `YOUR_ACCESS_TOKEN`: The token you got from the previous step.

### 3. Extract the IdP Access Token

Within the user's `identities` array, there will be an `access_token` that you can extract and use to make calls to the IdP's API: `user.identities[0].access_token`.

In most cases, the user will only have one identity, but if you have used the [account linking feature](/link-accounts), there may be more.

In this sample response we can see that our user had only one identity: `google-oauth2`.

```json
{
  "email"<EMAIL_ADDRESS>  "email_verified": true,
  "name": "John Doe",
  "given_name": "John",
  "family_name": "Doe",
  "picture": "https://myavatar/photo.jpg",
  "gender": "male",
  "locale": "en",
  "updated_at": "2017-03-15T07:14:32.451Z",
  "user_id": "google-oauth2|111199914890750704174",
  "nickname": "john.doe",
  "identities": [
    {
      "provider": "google-oauth2",
      "access_token": "ya29.GlsPBCS6ahokDlgCYnVLnDKNE71HBXPEzNhAPoKJLAGKDSe1De3_xclahNcdZXoU-26hCpa8h6240TV86dtaEQ4ZWoeeZduHDq_yeu9QyQqUr--S9B2CR9YJrLTD",
      "expires_in": 3599,
      "user_id": "111199914890750704174",
      "connection": "google-oauth2",
      "isSocial": true
    }
  ],
  "created_at": "2017-03-15T07:13:41.134Z",
  "last_ip": "<IP_ADDRESS>",
  "last_login": "2017-03-15T07:14:32.451Z",
  "logins_count": 99
}
```

::: warning
  Security Warning! Make sure that you don't expose the IdP access token to your client-side application.
:::


text:
![](https://dl.dropboxusercontent.com/u/7817937/_github/aquamarine/aquamarine_logo.png)

Aquamarine
==========

Aquamarine iOS Model Framework

Built on

- AquaModel (inherits Mantle) - An improved model class. Non nil parameters & Better view-model binding support & Observable.　(`NSManagedObject+Serializable`, `NSManagedObject+Requestable`, `NSManagedObject+Validatable`, `NSManagedObject+Callbackable`)
- [Aquasync](https://github.com/AQAquamarine/Aquasync) - An effortless data synchronization framework.
- AquaCollection (inherits [oxen](https://github.com/jacksonh/oxen)) - A collection focused on convinience of handling models. (re-order, filtering, scope, serialization, observation...)

and works well with

- ReactiveCocoa
- CoreData

Features
---

- **Effortless API handling**
- **Effortless Synchronization**
- **Effortless View-Model binding**

Breaking down...

- Effortless data storing / querying.
- Model serialization / deserialization from JSON, plist or msgpack.
- Transparently handling of resource through network like ActiveResource.
- Model <=> Backend sychronization and comprehensive protocols.
- Model collections which works well with TableView / CollectionView.
- Model <=> View Binding mechanism or handling KVO transparently.

Code Example
---

```objc
Album *album = [Album createWithJSON:json];
```

```objc
[Album get:13 completion:^{
    ...
} error:nil];
```

```objc
AQMValidationResult *result = [album validate];
```

```objc
[Album sync];
```

```objc
[album bind:view];
```

```objc
[albums bindCollectionView:collectionView]; // Will bind insertion, deletion, swapment, reloadData of collection into collectionView.
```

```objc
[albums cellAt:indexPath]; // It will handle EVERYTHING behalf of you. Just call this on your CollectionView DataSource.
```

```objc
[albums filter:@"location == 'Hawaii'"];
```

Declarative Style
---

```objc
// Album.m

+ (NSDictionary *)validationRules {
    return @{
        @"title": @[[AQMValidator presence], [AQMValidator shorterThan:256]]
    };
}

+ (NSDictionary *)JSONKeyMap {
    return @{
        @"title": @"title",
        @"createdAt": @"created_at",
        @"updatedAt": @"updated_at"
    };
}

+ (NSArray *)beforeSave {
    return @[@selector(doSomePreparationForSave)];
}
```

And advanced options...

```objc
// @Optional
+ (NSString *)resourcePath {
    return @"/albums";
}

// @Optional
+ (NSDictionary *)requestMap {
    return @{
        AquamarineRequestShow: @"GET /:id",
        AquamarineRequestCreate: @"POST /",
        AquamarineRequestUpdate: @"PATCH /:id",
        AquamarineRequestDestroy: @"DELETE /:id"
    };
}
```

Status
---

Perfectly WIP.

Related Projects
---

- [Proton](https://github.com/bitswift/Proton) - Model framework for Cocoa and Cocoa Touch applications
- [Mantle](https://github.com/Mantle/Mantle) - Model framework for Cocoa and Cocoa Touch

LICENSE
---

The MIT License (MIT)

Copyright (c) 2014 kaiinui

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

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

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

repository: AQAquamarine/Aquamarine

repo_name: AQAquamarine/Aquamarine


text:
# Server Tutorial

In this set of tutorials, we will get you started with hosting your own Web Application.  We will cover topics including getting your server set up, to scaling your systems to meet business needs.

In order to complete these tutorials, you will need to create accounts with several hosting companies.  Most of these companies offer free or very inexpensive options.  However, you should be able to apply these tutorials to other hosting companies if you so choose.

repository: sjohnsonaz/server-tutorial

repo_name: sjohnsonaz/server-tutorial


text:
### Introduction

This repository contains example scripts that could be used to perform masking automated via a Windows bat file and Actifio.

The sequence of events for a workflow are:

1)  A LiveClone of the production DB is refreshed from the lastest snapshot
2)  This LiveClone is prep-mounted to a masking host where the production DB is prep-mounted as a database with a temporary name.
The workflow needs to ensure the prep-mounted DB has that name or the SQL script will fail.
3)  The workflow calls the bat file masking_update.bat as a post mount task (after the prepmount).
4)  Once the masking is complete, the prep-mount is unmounted and the liveclone is now in a masked state.
5)  The masked liveClone can now mounted to the target host by the workflow.

This means the workflow needs to be setup as follows:

* Workflow Type:  Liveclone
* Schedule Type:  On Demand
* Mount for Pre-Processing:  On
* Post-Script:  masking_update.bat   (or whatever the bat file is called)
* Create New Virtual Application:  On
* SQL Server Database Name:  Should match the DB name in the SQL script  (Note if DB is an instance, you will need to define a prefix)

On the next panel you can set it up any way you like,  if the database is called smalldb, then ideally use something like this:

* Source DB name:      smalldb
* Prepmount DB name:   premasking
* Final mount DB name: maskedsmalldb

### Validation

Compare the masked index ID between the source DB (i.e. smalldb) and the mounted masked copy (i.e. maskedsmalldb).

### Important details to be aware of

1)  The BAT file only runs when these are all set:   "%ACT_MULTI_OPNAME%" == "scrub-mount" if "%ACT_MULTI_END%" == "true" if "%ACT_PHASE%" == "post"

This ensures the script only runs after all parts of the prep-mount are complete including mounting of logs and starting of prepmounted Database.

### Manual test of bat file

You can run the bat file with a parameter of 'test' to do a manual set of masking.

### Default mask command in masking_update.bat

By default this script is shown running a SQL command with a SQL script to do simple masking.   This lets you test the whole process without masking software.

1)  The SQLCMD path in the BAT file needs to be fully stated and must exist.   On some versions of SQL Server the path might be different.
To find your sqlcmd.exe use the Windows 'where' command (its like the Unix 'which' command):

```
C:\Users\av>where sqlcmd.exe
C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\SQLCMD.EXE
```

2)  The SQLCMD has a -b to force a failure if the SQL fails.

repository: Actifio/WindowsMaskingScriptSupport

repo_name: Actifio/WindowsMaskingScriptSupport


text:
# Drone
A DIY drone project - Work In Progress.
Three guys trying to build a drone (quadcopter) from scratch :D

## Project
The brain of the drone is an Arduino Nano. We use a gyroscope and accelerometer to get the data necessary to control the drone. We have ha bluetooth module to communicate with the drone. Eventually we want to switch over to a RC-controller for extended range, but for testing and development purposes, the bluetooth module works fine and lets us communicate with the drone through a basic android app (made with MIT App Developer).
*NB:* We are working on this project now, so the project, and code, is not finished and the drone doesn't fly (yet :wink:). We are currently tuning the regulators to make the drone able to hover.

## The parts
We ordered most of the parts on ebay, but some parts were bought at a workshop at NTNU (University).
* Arduino Nano
* MPU-6050
* HC-05 Bluetooth Module
* Quadcopter Frame
* A2212 1000KV Outrunner Motorframe
* 30A Brushless ESC
* 1045 Propellers
* 45C 3S LIPO Battery
* Misc electronics

## The team
* Lars Breirem
* H�kon Vislie
* Eivind Dogger

repository: Vislie/Drone

repo_name: Vislie/Drone


text:
# Skid Keywords

Ruby has a few interesting old keywords that use the underscore, or 'skid', to convey meta information about the file.

Here they are in action:

```ruby
# test.rb
puts __ENCODING__
puts __FILE__
puts __LINE__
__END__
Because this is after 'end', it should not be executed
```

Running this file produces:

```
$ ruby test.rb
UTF-8
test.rb
3
```

Pretty cool!

repository: jwworth/til

repo_name: jwworth/til


text:
---
layout: page
title: R and Statistics at RSB
date: 2020-05-14T11:40:00+09:00
modified: 2020-05-14T11:40:00+09:00
excerpt: "Bio-statistics and R at RSB"
tags: [R, statistics, workshops, teaching]
image:
  feature: Rintro.jpg
  credit: Timothée Bonnet
  creditlink: http://timotheenivalis.github.io
---

* [Day 1-4: Basics of R coding](https://timotheenivalis.github.io/workshops/siteIntroR/)
* [Day 5, Statistical modelling part 1: Introduction and lm()](StatModel1.html)
* [Day 6, Statistical modelling part 2: Linear models, interpretation, prediction, additive effects, interactions](StatModel2.html)
* [Day 7, Statistical modelling part 3: Variance structure and introduction to random effects](StatModel3.html)
* [Day 8, Statistical modelling part 4: Random effects and mixed models in lme4](StatModel4.html)
* [Day 9, Statistical modelling part 5: GLMs and logistic regression](StatModel5GLM.html)
* [Day 10, Statistical modelling part 6: GLMs for count data](StatModel6GLM.html)
* [Day 11, R-Markdown](rmarkdown_notes.html)
* [Day 12, Making packages](package.html)


text:
# Recoil Kernel Tools

[![Build Status](http://img.shields.io/travis/recoilphp/kernel/master.svg?style=flat-square)](https://travis-ci.org/recoilphp/kernel)
[![Code Coverage](https://img.shields.io/codecov/c/github/recoilphp/kernel/master.svg?style=flat-square)](https://codecov.io/github/recoilphp/kernel)
[![Code Quality](https://img.shields.io/scrutinizer/g/recoilphp/kernel/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/recoilphp/kernel/)
[![Latest Version](http://img.shields.io/packagist/v/recoil/kernel.svg?style=flat-square&label=semver)](https://semver.org)

Reusable components for implementing [Recoil](https://github.com/recoilphp/recoil)
kernels.

    composer require recoil/kernel

This package provides a set of traits and classes used to develop coroutine
kernels that are compatible with the Recoil API.

repository: recoilphp/kernel

gha_language: PHP

repo_name: recoilphp/kernel


text:
---
title: Delete data
list_title: Delete data
description: >
  Delete data in the InfluxDB CLI and API.
menu:
  influxdb_2_0:
    name: Delete data
    parent: Write data
weight: 106
influxdb/v2.0/tags: [delete]
related:
  - /influxdb/v2.0/reference/syntax/delete-predicate/
  - /influxdb/v2.0/reference/cli/influx/delete/
---
<!--
## Delete data in the InfluxDB UI

Delete data from buckets you've created. You cannot delete data from system buckets.

### Delete data from buckets

1. Click **Load Data** in the navigation bar.

    {{< nav-icon "load data" >}}

2. Select **Buckets**.
3. Next to the bucket with data you want to delete, click **Delete Data by Filter**.
4. In the **Delete Data** window that appears:
  - Select a **Target Bucket** to delete data from.
  - Enter a **Time Range** to delete data from.
  - Click **+ Add Filter** to filter by tag key and value pair.
  - Select **I understand that this cannot be undone**.
5. Click **Confirm Delete** to delete the selected data.

### Delete data from the Data Explorer

1. Click the **Data Explorer** icon in the sidebar.

    {{< nav-icon "data-explorer" >}}

2. Click **Delete Data** in the top navigation bar.
3. In the **Delete Data** window that appears:
  - Select a **Target Bucket** to delete data from.
  - Enter a **Time Range** to delete data from.
  - Click **+ Add Filter** to filter by tag key-value pairs.
  - Select **I understand that this cannot be undone**.
4. Click **Confirm Delete** to delete the selected data.
!-->

Use the `influx` CLI or the InfluxDB API [`/delete`](/influxdb/v2.0/api/#/paths/~1delete/post) endpoint to delete data.

{{% note %}}
The `influx delete --predicate` flag is currently disabled and will be re-enabled in an upcoming release. Deleting data without a predicate deletes all data in the specified bucket with timestamps between the specified `start` and `stop` times.
{{% /note %}}

## Delete data using the influx CLI

1. Use the [`influx delete` command](/influxdb/v2.0/reference/cli/influx/delete/) to delete points from InfluxDB.
2. Specify your organization, bucket, and authentication token.
3. Define the time range to delete data from with the `--start` and `--stop` flags.

#### Example

```sh
influx delete -o my-org -b my-bucket -t $INFLUX_TOKEN \
 --start '1970-01-01T00:00:00.00Z' \
 --stop '2020-01-01T00:00:00.00Z' \
```

## Delete data using the API

1. Use the InfluxDB API `/delete` endpoint to delete points from InfluxDB.
2. Include your organization and bucket as query parameters in the request URL.
3. Use the `Authorization` header to provide your InfluxDB authentication token.
4. In your request payload, define the time range to delete data from with `start` and `stop`.

#### Example

```sh
curl --request POST http://localhost:8086/api/v2/delete/?org=myOrg&bucket=myBucket \
  --header 'Authorization: Token <YOURAUTHTOKEN>' \
  --header 'Content-Type: application/json' \
  --data '{
  "start": "1970-01-01T00:00:00.00Z",
  "stop": "2020-01-01T00:00:00.00Z"
  }'
```
   _For more information, see the [`/delete` API documentation](/influxdb/v2.0/api/#/paths/~1delete/post)._


text:
# AppDev-Training-Challenges-OpenStack
Question bank of 'problem based learning challenges' to train Application Developers in building OpenStack Cloud Apps.

Phase 1: This repository breaks down Openstack's "My First App Guide" and turns it into various "problem-sets".  These sets of problems (aka learning challenges) are intended for use alongside face-to-face demonstrations, presentations and training.

## How to use this bank of learning challenges

As a trainer who is helping application developers learn how to use OpenStack you don't want to bore your participants via 'death by powerpoint'.  Yes slides are essentiall, but the average human brain turns off after ~7 minutes of being talked at; accordingly, we recommend you do a bit of 'chalking & talking' (presenting and live coding), then have your participants work together to solve some fun learning challenges.  Here in this repository you'll find a bank of these challenges, so you can pick and choose from which to use when you design your applicationi developer training.

## How to contribute problems to this learning challenges bank

A good set of challenges are a kind of beautiful puzzle which will be a great value to your participants as they learn how to make cloud applications.  Like any code repository, your contributions are done through branching and submitting pull requests.

To contribute a new 'learning challenge' please submit a minimum of 3x learning challenges (as a single file) including:

1. Novice problem, e.g. a problem which 2-7 people can all easily solve as a group, which perhaps generates discussion.
2. Intermediate problem, e.g. a problem which will take a bit of time to solve, and which should stump the novices in the room.
3. Advanced problem, e.g. a problem which only a small percentrage of your trainees will be able to solve.  Keep an eye out for who solves they problems, recruit them to be helpers at future training.

While the minimum problem-set MUST have 3x challenges, additional challenges and or contextual information may be provided in the same file, such as:

 * Additional problems, i.e. Uber advanced extra bonus points problem: create auto monitorring and orchestration basedon regional location of cores/nodes.
 * Pictures of slides to remind the participants of what you orignally demonstrated, etc.
 * Links and references to what other problem-sets which are applicable.
 * Inline dode snippet instruction, FAQ and metaphors/analogy for how to remember the problem.
 * etc

Most importantly, remember that a well designed learning challenge is like a fun puzzle or riddle which if well worded and presented will be a joy for all to partipate in learning.

# Ok, now it's your turn...
1. Start by branching the following template problem-set file: https://github.com/DFFlanders/AppDev-Training-Challenges-OpenStack/blob/master/template-problem-set
2. Once you've created your own learning challenge, with a minimum of 3x problems then submit a pull request so we can add your problem-set to master bank of learning challenges for OpenStack application developer training!
3. We'll start tweeting and singing your praises on the mailing list so our community of trainers can start using your newly minted learning challenges in their training.


text:
---
Title: wradlib
Date: 2017-09-16
Category: Projects
Authors: openradar
Tags: project, devel
language: Python
---

# Wradlib

## Short Description

[wradlib](https://wradlib.org/) was one of the first open source software solutions to support all essential steps of the weather radar processing chain. Since 2011, wradlib has evolved to be a professional solution for interactive weather radar data analysis and operational processing, with a large international user community in academia, government agencies, and the private sector. The [user forum](https://groups.google.com/forum/?fromgroups#!forum/wradlib-users) with more than 170 active members from all around the world provides an agile platform for exchange and support.

## Homepage

<https://wradlib.org/>

## Sample Image

![wradlib sample image](../images/wradlib_sample.png)

## Code Repositories

### The wradlib package
<https://github.com/wradlib/wradlib>

### wradlib notebooks
<https://github.com/wradlib/wradlib-notebooks>

### Sample data
<https://github.com/wradlib/wradlib-data>

## Software Documentation

<http://wradlib.org/wradlib-docs>

## User group or forum page
<https://groups.google.com/forum/?fromgroups#!forum/wradlib-users>

## License model
MIT

## Year of first release
2011

## Main programming laguage(s)
Python

## Supported platforms
Linux, Mac, Windows

## Type of software
API/Library

## References
Heistermann, M., Jacobi, S., Pfaff, T. (2013): Technical Note: An open source library for processing weather radar data (wradlib). Hydrol. Earth Syst. Sci., 17, 863-871, [doi:10.5194/hess-17-863-2013](https://doi.org/10.5194/hess-17-863-2013).


text:
# Thousanday-Web
Photo sharing social web app for your pets and you.

Please test with real pets images, thanks!

[Live Site](https://thousanday.com)

Mobile App by React Native:

[Repo](https://github.com/byn9826/Thousanday-Mobile)

App architecture
--
1. Frontend Framework: React

2. Backend Framework: Phalcon for routing

3. Database: MySQL

4. DB query: PDO

5. Login System: Google SDK, Facebook SDK

Features:
--
1. Create Account, show all your pets

2. Add pets, every pet has their own page showing all their photos

3. Watch pet, follow any pet you love

4. Post moments, record your lovely moments with your pets

5. Leave comments, comment on any photo makes you laugh

6. Love moments, save moments in your personal list

Screen Shot
--
Digital Home for you

![user](https://raw.githubusercontent.com/byn9826/Thousand-Day/master/~legend/user.png)

Private page for your pet

![pet](https://raw.githubusercontent.com/byn9826/Thousand-Day/master/~legend/pet.png)

Test on your localhost
--
1. git clone this repo

2. npm install

3. Webpack --watch

4. Modify urls to https://thousanday.com/ ...

Other
--
[A list of reusable React UI components](https://github.com/byn9826/Thousanday-React)

Author
--
Baozier

License
--
BSD-3

Icons from glyphicons.com

repository: rorks/Thousanday-Web

repo_name: rorks/Thousanday-Web


text:
node-red-contrib-jsonrpc2
==============================

Node-RED node for JSON-RPC communication.

Install
-------
Run the following command in your Node-RED user directory - typically `~/.node-red`
        npm install node-red-contrib-mqttjsonrpc

Usage
-----

TBD

license: ISC


text:
This page describes an [experimental fuzzer bot](http://<IP_ADDRESS>/) for [SQLite](https://www.sqlite.org/).

The bot uses [libFuzzer](http://llvm.org/docs/LibFuzzer.html) and
[AddressSanitizer](http://clang.llvm.org/docs/AddressSanitizer.html) to find existing
bugs in SQLite and possible new regressions.
Currently, the [target function](./sqlite_fuzzer.c) is *very* simple, we'll be extending it in future.

The test corpus is synthesised from the existing sqlite tests.

gha_language: Shell


text:
description: Pantheon Create a Permissioned network
<!--- END of page meta data -->

# Creating a Permissioned Network

The following steps set up a permissioned network with node and account permissions. The network uses the
[Clique Proof of Authority consensus protocol](../Consensus-Protocols/Clique.md).

!!!important
    A permissioned Ethereum network as described here is not protected against all attack vectors.
    We recommend applying defense in depth to protect your infrastructure.

## Prerequisites

[Pantheon](../Installation/Install-Binaries.md)

[Curl (or similar web service client)](https://curl.haxx.se/download.html)

## Steps

The steps to create a permissoned network are displayed on the right.

### 1. Create Folders

Each node requires a data directory for the blockchain data. When the node is started, the [node key](../Configuring-Pantheon/Node-Keys.md)
is saved in this directory.

Create directories for your permissioned network, each of the three nodes, and a data directory for each node:

```bash
Permissioned-Network/
├── Node-1
│   ├── data
├── Node-2
│   ├── data
└── Node-3
    ├── data
```

### 2. Get Address of Node-1

In networks using Clique, the address of at least one initial signer must be included in the genesis file.
For this network, we will use Node-1 as the initial signer. This requires obtaining the address for Node-1.

To obtain the address for Node-1, in the `Node-1` directory, use the [`public-key export-address`](../Reference/Pantheon-CLI-Syntax.md#public-key)
subcommand to write the node address to the specified file (`nodeAddress1` in this example)

```bash tab="MacOS"
pantheon --data-path=data public-key export-address --to=data/nodeAddress1
```

```bash tab="Windows"
pantheon --data-path=data public-key export-address --to=data\nodeAddress1
```

### 3. Create Genesis File

The genesis file defines the genesis block of the blockchain (that is, the start of the blockchain).
The [Clique genesis file](../Consensus-Protocols/Clique.md#genesis-file) includes the address of Node-1 as the initial signer in the `extraData` field.

All nodes in a network must use the same genesis file.

Copy the following genesis definition to a file called `cliqueGenesis.json` and save it in the `Permissioned-Network` directory:

```json
{
  "config":{
    "chainId":1981,
    "constantinoplefixblock": 0,
    "clique":{
      "blockperiodseconds":15,
      "epochlength":30000
    }
  },
  "coinbase":"0x0000000000000000000000000000000000000000",
  "difficulty":"0x1",

"extraData":"0x0000000000000000000000000000000000000000000000000000000000000000<Node 1 Address>0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "gasLimit":"0xa00000",
  "mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000",
  "nonce":"0x0",
  "timestamp":"0x5c51a607",
  "alloc": {
      "fe3b557e8fb62b89f4916b721be55ceb828dbd73": {
        "privateKey": "8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63",
        "comment": "private key and this comment are ignored.  In a real chain, the private key should NOT be stored",
        "balance": "0xad78ebc5ac6200000"
      },
      "627306090abaB3A6e1400e9345bC60c78a8BEf57": {
        "privateKey": "c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3",
        "comment": "private key and this comment are ignored.  In a real chain, the private key should NOT be stored",
        "balance": "90000000000000000000000"
      },
      "f17f52151EbEF6C7334FAD080c5704D77216b732": {
        "privateKey": "ae6ae8e5ccbfb04590405997ee2d52d2b330726137b875053c36d94e974d162f",
        "comment": "private key and this comment are ignored.  In a real chain, the private key should NOT be stored",
        "balance": "90000000000000000000000"
      }
   },
  "number":"0x0",
  "gasUsed":"0x0",
  "parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000"
}
```

In `extraData`, replace `<Node 1 Address>` with the [address for Node-1](#3-get-address-for-node-1) excluding the 0x prefix.

!!! example

    ```json
    {
      ...
    "extraData":"0x0000000000000000000000000000000000000000000000000000000000000000b9b81ee349c3807e46bc71aa2632203c5b4620340000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
      ...
    }
    ```

!!! warning
    Do not use the accounts in the genesis file on MainNet or any public network except for testing.

    The private keys are displayed which means the accounts are not secure.

### 4. Create Permissions Configuration File

The permissions configuration file defines the nodes and accounts whitelists.

Copy the following permissions configuration to a file called `permissions_config.toml` and save a copy in the `Node-1/data`,
`Node-2/data`, and `Node-3/data` directories:

!!! example "permissions_config.toml"
    ```toml
    accounts-whitelist=["0xfe3b557e8fb62b89f4916b721be55ceb828dbd73", "0x627306090abaB3A6e1400e9345bC60c78a8BEf57"]

    nodes-whitelist=[]
    ```
The permissions configuration file includes the first two accounts from the genesis file.

Permissioned nodes are added using the JSON-RPC API after starting the nodes.

!!! note
    Permissions are specified at the node level. The [`permissions_config.toml`](../Permissions/Local-Permissioning.md#permissions-configuration-file)
    file must be saved in the data directory for each node.

    On-chain permissioning is under development. On-chain permissioning will use one on-chain
    nodes whitelist and accounts whitelist.

### 5. Start Node-1

Use the following command:

```bash tab="MacOS"
pantheon --data-path=data --genesis-file=../cliqueGenesis.json --permissions-nodes-config-file-enabled --permissions-accounts-config-file-enabled --rpc-http-enabled --rpc-http-api=ADMIN,ETH,NET,PERM,CLIQUE --host-whitelist="*" --rpc-http-cors-origins="*"
```

```bash tab="Windows"
pantheon --data-path=data --genesis-file=..\cliqueGenesis.json --permissions-nodes-config-file-enabled --permissions-accounts-config-file-enabled --rpc-http-enabled --rpc-http-api=ADMIN,ETH,NET,PERM,CLIQUE --host-whitelist="*" --rpc-http-cors-origins="*"
```

The command line specifies:

* Nodes and accounts permissions are enabled using the [`--permissions-nodes-config-file-enabled`](../Reference/Pantheon-CLI-Syntax.md#permissions-nodes-config-file-enabled)
and [`--permissions-accounts-config-file-enabled`](../Reference/Pantheon-CLI-Syntax.md#permissions-accounts-config-file-enabled) options
* JSON-RPC API is enabled using the [`--rpc-http-enabled`](../Reference/Pantheon-CLI-Syntax.md#rpc-http-enabled) option
* ADMIN,ETH,NET,PERM, and CLIQUE APIs are enabled using the [`--rpc-http-api`](../Reference/Pantheon-CLI-Syntax.md#rpc-http-api) option
* All hosts can access the HTTP JSON-RPC API using the [`--host-whitelist`](../Reference/Pantheon-CLI-Syntax.md#host-whitelist) option
* All domains can access the node using the HTTP JSON-RPC API using the [`--rpc-http-cors-origins`](../Reference/Pantheon-CLI-Syntax.md#rpc-http-cors-origins) option.

When the node starts, the [enode URL](../Configuring-Pantheon/Node-Keys.md#enode-url) is displayed.
The enode URL is required specify Node-1 as a peer and update the permissions configuration file in
the following steps.

![Node 1 Enode URL](../images/EnodeStartup.png)

### 6. Start Node-2

Start another terminal, change to the `Node-2` directory and start Node-2:

```bash tab="MacOS"
pantheon --data-path=data --genesis-file=../cliqueGenesis.json --permissions-nodes-config-file-enabled --permissions-accounts-config-file-enabled --rpc-http-enabled --rpc-http-api=ADMIN,ETH,NET,PERM,CLIQUE --host-whitelist="*" --rpc-http-cors-origins="*" --p2p-port=30304 --rpc-http-port=8546
```

```bash tab="Windows"
pantheon --data-path=data --genesis-file=..\cliqueGenesis.json --permissions-nodes-config-file-enabled --permissions-accounts-config-file-enabled --rpc-http-enabled --rpc-http-api=ADMIN,ETH,NET,PERM,CLIQUE --host-whitelist="*" --rpc-http-cors-origins="*" --p2p-port=30304 --rpc-http-port=8546
```

The command line specifies:

* Different port to Node-1 for P2P peer discovery using the [`--p2p-port`](../Reference/Pantheon-CLI-Syntax.md#p2p-port) option
* Different port to Node-1 for HTTP JSON-RPC using the [`--rpc-http-port`](../Reference/Pantheon-CLI-Syntax.md#rpc-http-port) option
* Data directory for Node-2 using the [`--data-path`](../Reference/Pantheon-CLI-Syntax.md#data-path) option
* Other options as for as for Node-1.

When the node starts, the [enode URL](../Configuring-Pantheon/Node-Keys.md#enode-url) is displayed.
The enode URL is required to update the permissions configuration file in the following steps.

### 7. Start Node-3

Start another terminal, change to the `Node-3` directory and start Node-3:

```bash tab="MacOS"
pantheon --data-path=data --genesis-file=../cliqueGenesis.json --permissions-nodes-config-file-enabled --permissions-accounts-config-file-enabled --rpc-http-enabled --rpc-http-api=ADMIN,ETH,NET,PERM,CLIQUE --host-whitelist="*" --rpc-http-cors-origins="*" --p2p-port=30305 --rpc-http-port=8547
```

```bash tab="Windows"
pantheon --data-path=data --genesis-file=..\cliqueGenesis.json --permissions-nodes-config-file-enabled --permissions-accounts-config-file-enabled --rpc-http-enabled --rpc-http-api=ADMIN,ETH,NET,PERM,CLIQUE --host-whitelist="*" --rpc-http-cors-origins="*" --p2p-port=30305 --rpc-http-port=8547
```

The command line specifies:

* Different port to Node-1 and Node-2 for P2P peer discovery using the [`--p2p-port`](../Reference/Pantheon-CLI-Syntax.md#p2p-port) option
* Different port to Node-1 and Node-2 for HTTP JSON-RPC using the [`--rpc-http-port`](../Reference/Pantheon-CLI-Syntax.md#rpc-http-port) option
* Data directory for Node-3 using the [`--data-path`](../Reference/Pantheon-CLI-Syntax.md#data-path) option
* Other options as for as for Node-1.

When the node starts, the [enode URL](../Configuring-Pantheon/Node-Keys.md#enode-url) is displayed.
The enode URL is required to update the permissions configuration file in the following steps.

### 8. Add Enode URLs for Nodes to Permissions Configuration File

In another terminal, use the [`perm_addNodesToWhitelist`](../Reference/Pantheon-API-Methods.md#perm_addnodestowhitelist)
JSON-RPC API method to add the nodes to the permissions configuration file for each node.

Replace `<EnodeNode1>`, `<EnodeNode2>`, and `<EnodeNode3>` with the enode URL displayed when starting each node.

Node-1:
```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"perm_addNodesToWhitelist","params":[["<EnodeNode1>","<EnodeNode2>","<EnodeNode3>"]], "id":1}' http://<IP_ADDRESS>:8545
```

Node-2:
```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"perm_addNodesToWhitelist","params":[["<EnodeNode1>","<EnodeNode2>","<EnodeNode3>"]], "id":1}' http://<IP_ADDRESS>:8546
```

Node 3:
```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"perm_addNodesToWhitelist","params":[["<EnodeNode1>","<EnodeNode2>","<EnodeNode3>"]], "id":1}' http://<IP_ADDRESS>:8547
```

!!! tip
    The cURL call is the same for each node except for the JSON-RPC endpoint.

### 9. Add Nodes as Peers

Use the [`admin_addPeer`](../Reference/Pantheon-API-Methods.md#admin_addpeer) JSON-RPC API method to add
Node-1 as a peer for Node-2 and Node-3.

Replace `<EnodeNode1>` with the enode URL displayed when starting Node-1.

Node 2:
```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"admin_addPeer","params":["<EnodeNode1>"],"id":1}' http://<IP_ADDRESS>:8546
```

Node 3:
```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"admin_addPeer","params":["<EnodeNode1>"],"id":1}' http://<IP_ADDRESS>:8547
```

!!! tip
    The cURL call is the same for both nodes except for the JSON-RPC endpoint.

Replace `<EnodeNode2>` with the enode URL displayed when starting Node-2.

Node 3:
```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"admin_addPeer","params":["<EnodeNode2>"],"id":1}' http://<IP_ADDRESS>:8547
```

### 10. Confirm Permissioned Network is Working

#### Check Peer Count

Use cURL to call the JSON-RPC API [`net_peerCount`](../Reference/Pantheon-API-Methods.md#net_peercount) method and confirm the nodes are functioning as peers:

```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":1}' localhost:8545
```

The result confirms Node-1 (the node running the JSON-RPC service) has two peers (Node-2 and Node-3):
```json
{
  "jsonrpc" : "2.0",
  "id" : 1,
  "result" : "0x2"
}
```

#### Send a Transaction from an Account in the Whitelist

Import the first account from the genesis file into MetaMask and send transactions as described in the [Private Network Quickstart Tutorial](Private-Network-Quickstart.md#creating-a-transaction-using-metamask):

!!! example "Account 1"
    * Address: `0xfe3b557e8fb62b89f4916b721be55ceb828dbd73`
    * Private key : `0x8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63`
    * Initial balance : `0xad78ebc5ac6200000`<PHONE_NUMBER>00000000000 in decimal)

!!! info
    Pantheon does not implement [private key management](../Using-Pantheon/Account-Management.md).

### Try Sending a Transaction from an Account Not in the Accounts Whitelist

Import the last account from the genesis file into MetaMask and try to send a transactions as described in the [Private Network Quickstart Tutorial](Private-Network-Quickstart.md#creating-a-transaction-using-metamask):

!!! example "Account 3"
    * Address: `0xf17f52151EbEF6C7334FAD080c5704D77216b732`
    * Private key : `0xae6ae8e5ccbfb04590405997ee2d52d2b330726137b875053c36d94e974d162f`
    * Initial balance : `0x90000000000000000000000`<PHONE_NUMBER>392105618523029504 in decimal)

### Start a Node Not on the Nodes Whitelist

In your `Permissioned-Network` directory, create a `Node-4` directory and `data` directory inside it.

Change to the `Node-4` directory and start Node-4 specifying the Node-1 enode URL as the bootnode:

```bash tab="MacOS"
pantheon --data-path=data --bootnodes="<EnodeNode1>" --genesis-file=../cliqueGenesis.json --rpc-http-enabled --rpc-http-api=ADMIN,ETH,NET,PERM,CLIQUE --host-whitelist="*" --rpc-http-cors-origins="*" --p2p-port=30306 --rpc-http-port=8548
```

```bash tab="Windows"
pantheon --data-path=data --bootnodes="<EnodeNode1>" --genesis-file=..\cliqueGenesis.json --rpc-http-enabled --rpc-http-api=ADMIN,ETH,NET,PERM,CLIQUE --host-whitelist="*" --rpc-http-cors-origins="*" --p2p-port=30306 --rpc-http-port=8548
```

Start another terminal, use cURL to call the JSON-RPC API [`net_peerCount`](../Reference/Pantheon-API-Methods.md#net_peercount) method:

```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":1}' localhost:8548
```

The result confirms Node-4 has no peers even though it specifies Node-1 as a bootnode:
```json
{
  "jsonrpc" : "2.0",
  "id" : 1,
  "result" : "0x0"
}
```

## Stop Nodes

When finished using the permissioned network, stop all nodes using ++ctrl+c++ in each terminal window.

!!!tip
    To restart the permissioned network in the future, start from [5. Start Node-1](#5-start-node-1).

repository: sushilbal/pantheon

repo_name: sushilbal/pantheon