text:
# Launching Filesystems on Fuchsia

Filesystems on Fuchsia are regular programs that run in userspace. They consume a block device and
a set of options, and produce an export directory with several protocols, first and foremost a
fuchsia.io.Directory representing the root of the filesystem at `/root`.

There are currently two ways to launch a filesystem. One way, the old way which is being
deprecated, is to launch the raw filesystem binary, and the other way, which filesystems are moving
to, is to launch as a component via the component framework. Both of these methods are supported by
fs_management libraries in C++ and Rust (the Rust implementation is pending - fxbug.dev/96036).

No matter how the filesystem is launched (the old way or the new way), all our platform filesystems
have the same structure to the export directory. The basic entries are -

```
/diagnostics
/fuchsia.fs.Admin
/root
```

`diagnostics` provides the inspect tree implementation, which has a bunch of statistics and
metrics. `fuchsia.fs.Admin` provides the ability to shut down a filesystem instance. `root` is the
root of the filesystem. Other platform filesystems may include additional entries. For example,
blobfs provides `/fuchsia.update.verify.BlobfsVerifier`.

## Launching filesystems with fs_management

Filesystems are launched using the `fs_management::Mount`, which takes a block device file
descriptor, an optional mount path, the disk format, options, and a launch callback. Mount returns
an RAII MountedFilesystem object with which you can Unmount and get access to the export directory.

The block device should be opened as read-write unless you configure the filesystem to be in
read-only mode. One option for block device paths to open is in `/dev/class/block`, which is an
enumerated list of all the block devices Fuchsia knows about (starting at `000` and counting up).
It's populated in the order that the drivers are bound, which is _not_ consistent across boots. The
other option is to use the topological path, which will depend on the drivers the storage uses (but
is otherwise consistent). Both of these can be found using `lsblk` on the command line. A couple of
examples -

```
/dev/sys/platform/00:00:2d/ramctl/ramdisk-0/block
/dev/sys/platform/pci/00:1f.2/ahci/sata0/block
```

If you are launching a filesystem on a ramdisk, you can use the ramdisk functions to get the
ramdisk path.

The `mount_path` is expected to be a non-existing path in your namespace. fs_management uses
fdio_namespace_bind to place the root of the filesystem at that path in your local namespace. Note:
This path is process local! Only your process sees the namespace, and a new one is created for
every process. See //docs/concepts/process/namespaces.md for more information.

The options struct, `fs_management::MountOptions`, contains a union of all possible filesystem
configuration. That is, not all filesystems support all the options. Make sure that the filesystem
you are launching supports the option you are using, or else it may fail to launch.

If the options provided don't include a `component_child_name`, then fs_management will launch it
using fdio_spawn_etc as a child process. This is the old way of launching filesystems. It's
supported by all of our platform filesystems. This approach uses the launch callback provided to
mount. In general, if you are mounting a filesystem, you should use `LaunchStdioAsync`, and if
you are using Fsck or Mkfs you should use `LaunchStdioSync`. See
//src/lib/storage/fs_management/cpp/launch.h for additional callback options.

If only the `component_child_name` is provided, then fs_management will assume the component is a
static child in the realm. It attempts to connect to it's exposed directory via
`fuchsia.component.Realm`. This approach doesn't use the launch callback provided to mount.

If both `component_child_name` and `component_collection_name` are provided, then fs_management
will assume the component is a dynamic child in the realm. It attempts to connect to it's exposed
directory via `fuchsia.component.Realm`, and if it fails because it can't find a component with the
given name, it attempts to launch a new instance, using a component url based on the disk format.

A shard is provided for cml files to include if they plan to launch filesystems as dynamic children
at `//src/lib/storage/fs_management/client.shard.cml`. The `component_collection_name` using this
shard is `fs-collection`.

Launching a filesystem using regular processes -

```cpp
fbl::unique_fd device_fd(open("/dev/class/block/001", O_RDWR));
ASSERT_TRUE(device_fd);
fs_management::MountOptions options;
auto fs = fs_management::Mount(std::move(device_fd), fs_management::kDiskFormatMinfs, options, fs_management::LaunchStdioAsync);
ASSERT_EQ(fs.status(), ZX_OK);
auto data = fs->DataRoot();
ASSERT_EQ(data.status(), ZX_OK);
auto binding = fs_management::NamespaceBinding::Create("/fs", std::move(*data));
ASSERT_EQ(binding.status(), ZX_OK);
// Now /fs points at the root of the filesystem.
```

Launching a filesystem using a component collection -

```cpp
fbl::unique_fd device_fd(open("/dev/class/block/001", O_RDWR));
ASSERT_TRUE(device_fd);
fs_management::MountOptions options {
  .component_child_name = "minfs",
  .component_collection_name = "fs-collection",
};
// LaunchStdioAsync doesn't matter here
auto fs = fs_management::Mount(std::move(device_fd), fs_management::kDiskFormatMinfs, options, fs_management::LaunchStdioAsync);
ASSERT_EQ(fs.status(), ZX_OK);
auto data = fs->DataRoot();
ASSERT_EQ(data.status(), ZX_OK);
auto binding = fs_management::NamespaceBinding::Create("/fs", std::move(*data));
ASSERT_EQ(binding.status(), ZX_OK);
// Now /fs points at the root of the filesystem.
```

## Launching a filesystem as a process

This section has a detailed description of how fs_management launches platform filesystem
processes. It's intended for filesystem developers - if you just want to mount a filesystem, in
code, see the previous section.

Platform filesystem processes take 2 startup handles and a handful of command line arguments. The
two startup handles are `PA_DIRECTORY_REQUEST` and `FS_HANDLE_BLOCK_DEVICE_ID`
(`PA_HND(PA_USER0,1)`), which are the server end of the export directory and the block device
handle, respectively.

The export directory should have the structure described at the beginning of this document.

The block device should be a handle to something that speaks `fuchsia.hardware.block.Block`. Most
block devices speak a handful of other protocols as well.

Filesystems can use protocols from their namespace, but they should fail gracefully if they are not
there. This is because many test environments don't construct consistent namespaces for the
filesystems they run. The most common production environment is fshost, which copies all it's
services to filesystems it launches, so using anything it uses in it's cml is probably fine.

## Launching a filesystem as a component

This section has a detailed description of how fs_management launches platform filesystem
components. It's intended for filesystem developers - if you just want to mount a filesystem, in
code, see the previous section.

There is currently one filesystem that supports being launched as a component, blobfs. The cml file
for blobfs is in //src/storage/bin/blobfs-component/meta/blobfs.cml.

When a filesystem component is launched, it starts in a partially configured state. They serve one
protocol - `fuchsia.fs.startup.Startup`. This is served from the path
`/<fs_component>/svc/fuchsia.fs.startup.Startup`. Filesystems need two things to run - a set of
options and a block device handle. This protocol provides methods for `Start`, as well as `Format`
and `Check`, which take the block device and a set of options as arguments.

`Start` returns once the filesystem is launched. Before this point, it's expected that filesystems
queue incoming open requests to be processed once `Start` is called. In blobfs, this is done by
selectively calling Serve on parts of the export directory at a time. If a `Start` call fails,
fs_management will attempt to destroy and restart the lifecycle component.

Filesystems that are launched as components are also expected to consume an extra startup handle,
PA_LIFECYCLE. This handle is the server end of a fuchsia.process.lifecycle.Lifecycle protocol,
which the component framework can use to send shutdown requests.

repository: gnoliyil/fuchsia

repo_name: gnoliyil/fuchsia


text:
---
template: post.html
title:    "Plasma Fraud Proof Challenge Workshop with Cryptokitties rewards"
date:     2018-08-15 10:50:00
image:    Berlin.jpg
author:
  name: "@oz1127"
  twitter: "@horizonaut"
  link: https://github.com/oz1127/
description: PARSEC Labs' Plasma Fraud Proof Challenge Workshop with Cryptokitties rewards
---

Hello, community!

After the successful DappCon workshop in Summer 2018, we have decided to extend our hands-on activities with developers and enthusiasts.

For realizing this goal, Johann worked with Hasan, community leader of LedgerZ.org blockchain developers network based in Berlin. Together they have conceptualized and defined a strategy.

As a start in the new series, we have designed the workshop "Plasma Fraud Proof Challenge" which handles Plasma by example, for scaling and merkle-proofing DApps, where true challengers gain some Cryptokitties. LedgerZ community helped with an organization of the space and logistics for this workshop on 8th August 2018.

The event was a success in many aspects. Here's a short summary of what we have done in the workshop.

At 6:30 PM we started with warm-up chats accompanied by pizza & beers. After some mingling with friends and newcomers, at 7 PM we have initiated the workshop with a micro-introduction from Amatus, our space sponsor, followed by a mini-presentation of LedgerZ community and it’s purpose, by Hasan.

Then Johann started the presentation of the concepts, to be followed by practice part. We have started with an introduction on Plasma, Plasma Classic and Plasma Cash. While explaining the basic concepts of merkle-trees and merkle-proofs, Johann has shown the basics of restricted authority, Plasma deposit, Plasma exit, data withholding and cryptoeconomic aggregate signatures. Then we have introduced fraud proofs and a quick guidance on how to get into the coding challenge and submit proofs. Around 8 PM we have started the hands-on challenge. At the end of the challenge, there were 2 winner teams submitting the proofs the fastest, one of which earned 2 Cryptokitties for re-iterating double-spending.

We had tons of fun, laughs, bringing good vibes into the community. People from different backgrounds were there, including core developers of blockchain protocols, scientists, hobby developers, a senior women asking questions about glass-fiber internet and what this is about all the time while eating pizza and drinking champagne.

At the end of the session, Johann has made a strong presence of PARSEC Labs and it’s goals, attracting people’s interest, there were a few very interested developers! We have gained a few developer members into our slack channel.

We have gained new insights, new connections and overall it was certainly a constructive and strong accomplishment with our first event with LedgerZ.

PARSEC Labs is excited to continue the series of physical and remote workshops to reach the talented members of its community globally!

If you are interested and/or want to contribute, join us on slack: http://join.parseclabs.org

license: MIT

repository: leapdao/parsec-website

branch_name: refs/heads/master

extension: md

gha_language: CSS

gha_license_id: MIT

license_type: permissive

repo_name: leapdao/parsec-website


text:
##Describe the strings in C#.
Strings are sequences of characters.Represented by the string data type in C# (System.String)

##What is typical for the string data type?
- String objects contain an immutable (read-only) sequence of character.Strings use Unicode to support multiple languages and alphabets
- Strings are stored in the dynamic memory (managed heap)
- String objects are like arrays of characters (char[]).Have fixed length (String.Length).
- Elements can be accessed directly by index

##Describe the most important methods of the String class
- string.IndexOf()
- string.Split()
- string.Compare()
- string.Remove()
- string.Replace()

url: https://raw.githubusercontent.com/marianamn/Telerik-Academy-Activities/f66d66ca42ee2787cdb8b68185e1cebd6b6c3e0f/Homeworks/03. CSharp-Advance/06. Strings and Text Processing/01.Strings in CSharp/StringsInCSharp.md

repository: marianamn/Telerik-Academy-Activities

gha_language: C#

repo_name: marianamn/Telerik-Academy-Activities


text:
# QuickDrawGAN

A GAN Trained on the Google Quick draw Dataset to create drawings of various items.

## Requirnments:

> Keras
> Tensorflow Backend
> Numpy


text:
---
layout: post
title: "Override a list property for Typesafe Config"
date: 2014-02-04 19:39
comments: true
categories: [config, scala, java]
---
Today I naively was trying to override a list property for a unit test with the following code
``` scala
System.setProperty("list.property", """[ "val1", "val2"]""")
```

The tested code is reading the list property using [typesafe config](https://github.com/typesafehub/config) library

``` scala
val listProperty = config.getListString.asScala.toSet
```

That was throwing
`com.typesafe.config.ConfigException$WrongType: system properties: list.property has type STRING rather than LIST`

so I've googled a [solution](https://github.com/typesafehub/config/issues/69) for overriding list properties from
command line, which is same for overriding in code

Here is how it looks now

``` scala
System.setProperty("list.property.0", "val1")
System.setProperty("list.property.1", "val2")
```

repository: jozic/daodecode-octopress-obsolete

extension: markdown

repo_name: jozic/daodecode-octopress-obsolete


text:
# flexYnth
## A flexible synthesizer development library.
### By Franco Caspe<EMAIL_ADDRESS>
**flexYnth** is a C++ library aimed for multi-plattform synthesizer software development.

The library is divided into two set of base classes called **Engine Scheme** and **Synthesizer Scheme** that once implemented yield a
**Synthesizer Engine** and a **Synthesis Architecture** respectively.

![](img/1.png)

<center> Example of a Synthesizer and Engine class scheme and some of its members and interaction. </center>

## Scope
This project is specially developed to ease and somewhat standardize the development of DIY synthesizer boxes based on DSP or
microcontrollers. The idea came while researching onto some nice electronic synthesizer projects out there in the net.
I realized that could be really benefical if there'd be a way to solve the hardware and software implementation separately.

## Features
This repo contains the Synthesizer Scheme and Engine Scheme.

branch **master**: Synthesizer Scheme and Engine Scheme virtual classes only - no implementation whatsoever.

## Check out some flexYnth implementation examples!

[bfreeOrgan2](https://github.com/fcaspe/bfreeOrgan2): A Tonewheel Organ Synthesizer

**SOON:** A BASIC MULTI-PLATTFORM MONO-SYNTH EXAMPLE!

## Usage Examples

- Provided we have a completed **Synthesizer Engine** developed and tested for a specific HW/OS plattform
(i.e.: Arduino box, Custom PCB, PC running Linux) we can implement any existing **Synthesis Architecture** on it.

![](img/2.png)

<center> Different Synthesis Architectures can connect to an unique Engine at compile time. </center>

- You may want to expand/simplify an existing Synthesizer Project capabilities, updating the controls, the motherboard, the DAC,
the CPU. In this case you should want to code a new **Synthesizer Engine** following the **Engine Scheme** provided with **flexYnth**.

![](img/3.png)

<center> HW can be upgraded just by developing a new Engine. (i.e. for polyphony expansion, a new PCB, more inputs, ...) </center>

- It's easy to develop a **Synthesis Architecture** with the **Synthesizer Scheme** provided with **flexYnth**.
You can take advantage of the existing **Linux Engine** for testing purposes.

![](img/4.png)

<center> ALSA/Linux Engine allows for out-of-board Architecture debugging. </center>

## License

Released under Apache V2.0 License.

repository: fcaspe/flexynth

repo_name: fcaspe/flexynth


text:
# Notes for examples of DMMs

**Dataflow matrix machines** are a generalization of recurrent neural networks.

Oct 19, 2016 experiment implements the scheme presented in the
Appendix D.2.2 of https://arxiv.org/abs/1610.00831

Oct 28, 2016 experiment implements a non-blocking asynchronous
input to a running DMM (inspired by various examples, including
in particular the program fragment described in
Section 3.1 of https://arxiv.org/abs/1606.09470).

Nov 4, 2016 experiment in progress...

repository: jsa-aerial/DMM

gha_language: Clojure

repo_name: jsa-aerial/DMM


text:
This project provides a custom LLDB command called `osstatus` that uses the awesome [OSStatus.com](osstatus.com) service to query what various iOS/macOS/tvOS/watchOS error codes mean.

### Usage
At its simplest, you can just pass in an error code. For example, to see what `-1009` really means:

```
(lldb) osstatus -1009
kCFURLErrorNotConnectedToInternet CFNetwork(CFNetworkErrors.h)
NSURLErrorNotConnectedToInternet  Foundation(NSURLError.h)
```

You can optionally pass a verbose flag `-v` to get more information (if available):

```
(lldb) osstatus -1009 -v
kCFURLErrorNotConnectedToInternet CFNetwork(CFNetworkErrors.h)
    The connection failed because the device is not connected to the
    internet.
NSURLErrorNotConnectedToInternet  Foundation(NSURLError.h)
    Returned when a network resource was requested, but an internet
    connection is not established and cannot be established
    automatically, either through a lack of connectivity, or by the
    user's choice not to make a network connection automatically.
```

### Installation
Download and save `osstatus.py` to your local machine (it doesn't really matter where you save it.)

Add the following to your `$HOME/.lldbinit` file (assuming you saved to your Desktop):

```
command script import ~/Desktop/osstatus.py
```

**Important: you will need to restart Xcode for the command to become available.**

### Notes
The command needs an active working internet connection in order to connect to the osstatus.com service. If your internet connection is slow, it may take several seconds for the command to return.

### Data Privacy
In an ideal world, I would love for the command to submit API requests directly from lldb to the osstatus.com API, however, due to a technical limitation in Apple's version of macOS Python (it unfortunately does not contain support for SSL SNI), it means connecting directly results in an SSL error every time.  There are a number of 3rd-party libraries (eg. requests) that solve this problem, however, there is no guarantee that users of this utility will have those libraries installed.

As a workaround, this utility connects to an AWS instance (that does not have SSL SNI enabled) that simply proxies the request directly to osstatus.com. Rest assured, I have no interested in capturing or logging the error codes that you lookup.

If you believe you can get `urllib2` working with SSL SNI, please feel free to [contact me](https://twitter.com/edwardaux). I'd love to be able to remove this intermediary service.

### License
This code is distributed under the terms and conditions of the MIT license.


text:
# Windsor Integration

By enabling `Windsor Container` integration, your controllers, filters and ViewComponents might request dependencies or configurations that can be satisfied by the container, thus leading your design to a loosely coupled state.

:warning: **Usage:** Once the integration is set you must register MVC components the same way as for ordinary container components components one could register:

* controllers
* viewcomponents (To look up a ViewComponent on the view you must use the key used to register the component on the container instead of the ViewComponent name)
* filters
* dynamic action providers

:bulb: **You can use any IoC container with MonoRail:** MonoRail is not in any way tied to Castle Windsor. Integration with Windsor comes out of the box, but MonoRail has no dependency on Windsor whatsoever, so you can freely use any other container of your choice.

## Benefits

Once the integration is set you can take advantage of all the benefits offered by an Inversion of Control container.

Suppose you have a controller that receives file uploads. Where should it store the files? Make it configurable.

On the controller:

```csharp
public class ImageGalleryController : Controller
{
	...

	public ImageGalleryController(String imageDirectory)
	{
		this.imageDirectory = imageDirectory;
	}

	...
}
```

Let's assume that this controller was registered on the container with the key `imagegallery.controller`. On the configuration section:

```xml
<castle>

  <components>

	<component id="imagegallery.controller">
	  <parameters>
		<imageDirectory>C:\mytempdir\safedir</imageDirectory>
	  </parameters>
	</component>

  <components>

</castle>
```

Your controller could assume a default directory and allow it to be overriden as well:

```csharp
public class ImageGalleryController : Controller
{
	private String imageDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

	public ImageGalleryController()
	{
	}

	public string ImageDirectory
	{
		get { return imageDirectory; }
		set { imageDirectory = value; }
	}

	...
}
```

The previous configuration for the component is still valid. But now it is optional as the controller can live without it.

## Implementation strategy

The implementation of the component resolution is following this pattern:

```csharp
if (kernel.HasComponent(componentType))
{
    return (T)container.Resolve(componentType);
}
else
{
    base.MethodName(...method call arguments...);
}
```

repository: qinfengzhu/MonoRail

repo_name: qinfengzhu/MonoRail


text:
# Roulette data collection app v0

# Installation

After checking out the repo, run `bundle install` to install dependencies.

To view app on your local host, run `shotgun` and head to the specified port.

## Contributing

This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.

## MIT License

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

gha_language: HTML


text:
# Battleship

# About
Battleship is written with python. This is a **console game** against computer. If you hit 4 target , you will win this game.

# Build
```
   git clone https://github.com/Cihatata/Battleship.git
   cd Battleship
   python Battleship.py

```

repository: Cihatata/Battleship

repo_name: Cihatata/Battleship


text:
- [About](#about)
  - [Kuzzle Prometheus Plugin](#kuzzle-prometheus-plugin)
  - [Kuzzle](#kuzzle)
  - [Compatibility matrix](#compatibility-matrix)
- [Installation](#installation)
- [Configuration](#configuration)
  - [Plugin](#plugin)
  - [Prometheus](#prometheus)
    - [With only one Kuzzle node](#with-only-one-kuzzle-node)
    - [With an authentified user](#with-an-authentified-user)
    - [With multiple Kuzzle nodes and using Docker Compose](#with-multiple-kuzzle-nodes-and-using-docker-compose)
    - [Using Kubernetes annotations](#using-kubernetes-annotations)
  - [Dashboards](#dashboards)
    - [Features](#features)
    - [Screenshots](#screenshots)
- [Local development](#local-development)
- [Migrations](#migrations)
  - [From version 3.x to 4.x](#from-version-3x-to-4x)
    - [Migration steps](#migration-steps)

# About

## Kuzzle Prometheus Plugin

This is the official Prometheus monitoring plugin for the free and open-source backend Kuzzle.
It provides you features such as:

* [Kuzzle cluster mode](https://github.com/kuzzleio/kuzzle-plugin-cluster) compatibility.
* Event based monitoring using [Kuzzle Events](https://docs.kuzzle.io/core/1/plugins/guides/events/intro/).
* System metrics (CPU, RAM, I/O...).

## Kuzzle

Kuzzle is an open-source backend that includes a scalable server, a multiprotocol API,
an administration console and a set of plugins that provide advanced functionalities like real-time pub/sub, blazing fast search and geofencing.

* :octocat: __[Github](https://github.com/kuzzleio/kuzzle)__
* :earth_africa: __[Website](https://kuzzle.io)__
* :books: __[Documentation](https://docs.kuzzle.io)__
* :email: __[Gitter](https://gitter.im/kuzzleio/kuzzle)__

## Compatibility matrix

| Kuzzle Version | Plugin Version |
| -------------- | -------------- |
| 1.10.x         | 1.x.x          |
| 2.x.x          | 2.x.x          |
| 3.x.x          | >= 2.11.x      |
| 4.x.x          | >= 2.16.9      |

# Installation

To install this plugin on your Kuzzle stack (for each of your Kuzzle nodes),
you will first need a Kuzzle Application like so. (see [Getting Started](/core/2/guides/getting-started))

```typescript
import { Backend } from 'kuzzle';

const app = new Backend('kuzzle');

app.start()
  .then(() => {
    app.log.info('Application started');
  })
  .catch(console.error);
```

Once you have it, you will need to:
- Import the Prometheus plugin,
- Create a new instance of the plugin
- And then use it in your application.

You will end up with something like this:

```typescript
import { Backend } from 'kuzzle';
import { PrometheusPlugin } from 'kuzzle-plugin-prometheus'; // Import the prometheus plugin

const app = new Backend('kuzzle');

const prometheusPlugin = new PrometheusPlugin(); // Create a new instance of the prometheus plugin

app.plugin.use(prometheusPlugin); // Add the plugin to your application

app.start()
  .then(() => {
    app.log.info('Application started');
  })
  .catch(console.error);
```

# Configuration

You can find sample configuration files for this plugin and the Prometheus scraping job in the `demo` folder.

## Plugin

This plugin is configurable using the `kuzzlerc` Kuzzle configuration file.

```json
 {
 "plugins": {
    "prometheus": {
      "default": {
        "enabled": true,
        "prefix": "",
        "eventLoopMonitoringPrecision": 10,
        "gcDurationBuckets": [0.001, 0.01, 0.1, 1, 2, 5]
      },
      "core": {
        "monitorRequestDuration": true,
        "prefix": "kuzzle_"
      },
      "labels": {
        "project": "mySuperProject",
        "environment": "development"
      }
    }
  }
}
```

* `default`: Default Node.js metrics retrieved by [the Prom Client library](https://github.com/siimon/prom-client/tree/master/lib/metrics)
  * `enabled`: Enable/Disable the default Node.js metrics (default: `true`)
  * `prefix`: String to use to prefix metrics name (default: an empty string to avoid conflicts when using official Grafana dashboards)
  * `eventLoopMonitoringPrecision`: Node.js Event Loop sampling rate in milliseconds. Must be greater than zero (default: `10`)
  * `gcDurationBuckets`: Custom Prometheus buckets for Node.js GC duration histogram in seconds (default: `[0.001, 0.01, 0.1, 1, 2, 5]`)
* `core`: Kuzzle Core metrics directly extract from the `server:metrics` API action or from plugin inner logic.
  * `monitorRequestDuration`: Enable/Disable request duration sampling (default: `true`)
  * `prefix`: String to use to prefix metrics name (default: `kuzzle_`)
* `labels`: Additional labels to apply on all the different metrics (default: `{}`)

## Prometheus

### With only one Kuzzle node

```yaml
global:
  scrape_interval:     10s # Set the scrape interval to every 10 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.

scrape_configs:
  - job_name: 'kuzzle'
    metrics_path: /_metrics
    params:
      format: ['prometheus']
    static_configs:
      - targets: ['kuzzle:7512'] # the address of an application that exposes metrics for prometheus
```

### With an authentified user
If you use an other user than `anonymous` to expose the `server:metrics` API action, you will need to create a Kuzzle API Key (see [API Keys](https://docs.kuzzle.io/core/2/guides/advanced/api-keys/)) and use it to authentify the Prometheus scaper:

```yaml
global:
  scrape_interval:     10s # Set the scrape interval to every 10 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.

scrape_configs:
  - job_name: 'kuzzle'
    metrics_path: /_metrics
    params:
      format: ['prometheus']
    authorization:
      type: 'Bearer'
      credentials: 'my-api-key'
    static_configs:
      - targets: ['kuzzle:7512'] # the address of an application that exposes metrics for prometheus
```

### With multiple Kuzzle nodes and using Docker Compose
If you use Docker Compose you'll need to provide the IP/Docker DNS name of each Kuzzle node as `targets`:

```yaml
global:
  scrape_interval:     10s # Set the scrape interval to every 10 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.

scrape_configs:
  - job_name: 'kuzzle'
    metrics_path: /_metrics
    params:
      format: ['prometheus']
    static_configs:
      - targets:
        - 'kuzzle-plugin-prometheus-kuzzle-1:7512'
        - 'kuzzle-plugin-prometheus-kuzzle-2:7512'
        - 'kuzzle-plugin-prometheus-kuzzle-3:7512'
```

### Using Kubernetes annotations

If your Prometheus inside a Kubernetes cluster, you must use the helper HTTP route `/_/metrics` since Prometheus `params` configuration is not supported.
Your Pods annotations should look like this:

```yaml
metadata:
  annotations:
    prometheus.io/scrape: "true"
    prometheus.io/path: /_/metrics
    prometheus.io/port: "7512"
spec:
...
```

## Dashboards

### Features

You could find two dashboards in the `config/grafana/dashboards` folder:
- `kuzzle.json`: a dashboard with all the metrics exposed by the `server:metrics` API action with a `nodeId` filter and including:
  - Active connections
  - Active Realtime subscriptions
  - Concurrent requests
  - Pending requests
  - Request per second
  - Request duration
  - Internal Errors

- `nodejs.json`: Node.js metrics dashboard with a `nodeId` filter and including:
  - Process CPU Usage
  - Process Memory Usage
  - Process Restarts
  - Event Loop Latency
  - Heap Usage

You can import them both using the Grafana API, Web UI or the provisionning system (see the `docker-compose.yml` file).

### Screenshots

Kuzzle dashboard

Node.js dashboard

# Local development

You can run a local development stack using Docker Compose

```
$ docker-compose up
```

This will start a demonstration stack composed with:
* A Kuzzle server proxified by a Traefik router
* A Prometheus container configured to scrap metrics.
* A Grafana container.

Once started, go to `http://localhost:3000` and log in with the default Grafana credentials:
* username: `admin`
* password: `admin`

Make several requests using Kuzzle's HTTP API or SDKs, or by using the Admin Console.

> NOTE: You can also increase the number of Kuzzle nodes to test a cluster configuration.
> Use the Docker Compose `--scale` option to increase the number of replicas:
> ```
> docker-compose up -d --scale kuzzle=<number-of-replicas>
> ```
> Notice that you need to update the `config/prometheus.yml` file to reflect the new number of nodes and restart the prometheus container using `docker restart <prometheus-container-id>`

# Migrations

## From version 3.x to 4.x

This new version 4.0.0 introduce numerous changes in the way metrics are collected and reported:
- The plugin now uses the `server:metrics` API action to retrieve metrics from Kuzzle Core. Calling the `server:metrics` API action with the `format` parameter set to `prometheus` will return metrics in the Prometheus format.
- The configuration of the plugin is now more flexible (see [Configuration](#configuration) section for more details):
  - More control on the default Node.js metrics (set the Event Loop sample precision to custom value or adapt the Garbage Collector Prometheus bucket rates to fit your usecase).
  - You can set different prefixes for Kuzzle Core metrics and Node.js metrics.
  - The `nodeIP`, `nodeMAC` and `nodeHost` labels have beem removed in favor of the `nodeId` label.
  - You can now disable the request recording job.
- Most of the metric names have been changed to be more consistent with Kuzzle Core metrics.

### Migration steps

    Allow the user used by Prometheus to access server:metrics API action

    Add the following rule to your user role to allow the user anonymous to access the server:metrics API action:

{
  "controllers": {
    // Your others controllers rules
    "server": {
      "actions": {
        "metrics": true,
        // ...
      }
    }
  }
}

    Update the plugin configuration

    Here is the new default configuration file:

 {
 "plugins": {
    "prometheus": {
      "default": {
        "enabled": true,
        "prefix": "",
        "eventLoopMonitoringPrecision": 10,
        "gcDurationBuckets": [0.001, 0.01, 0.1, 1, 2, 5]
      },
      "core": {
        "monitorRequestDuration": true,
        "prefix": "kuzzle_"
      }
    }
  }
}

    Update your dashboards

    If you have previously imported the example Grafana dashboard, you will have to update it to use the new metrics names or use the new ones located in config/grafana/dashboards.

repository: kuzzleio/kuzzle-plugin-prometheus

gha_language: TypeScript

repo_name: kuzzleio/kuzzle-plugin-prometheus


text:
# Strongly Connected Component

A directed graph is called **strongly connected** if there is a path
in each direction between each pair of vertices of the graph.
In a directed graph G that may not itself be strongly connected,
a pair of vertices `u` and `v` are said to be strongly connected
to each other if there is a path in each direction between them.

![Strongly Connected](https://upload.wikimedia.org/wikipedia/commons/5/5c/Scc.png)

Graph with strongly connected components marked

## References

- [Wikipedia](https://en.wikipedia.org/wiki/Strongly_connected_component)
- [YouTube](https://www.youtube.com/watch?v=RpgcYiky7uw&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8)

repository: zero-to-mastery/javascript-algorithms

gha_language: JavaScript

repo_name: zero-to-mastery/javascript-algorithms


text:
# ![Yabeda::HttpRequests](./yabeda-http_requests-logo.png)

Built-in metrics for external services HTTP calls! This gem is a Part of the [yabeda](https://github.com/yabeda-rb/yabeda) suite.

Read [introduction article on dev.to](https://dev.to/dsalahutdinov/monitoring-external-services-with-prometheus-and-grafana-5eh6).

## Metrics

Works as the Puma plugin and provides following metrics:
 - `http_request_total` - the number of external HTTP request attempts (by host, port, method)
 - `http_response_total` - the number of made external HTTP requeusts (by host, port, method, status)
 - `http_response_duration` - the histogram of response duration (by host, port, method, status)

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'yabeda-http_requests'
```

And then execute:

    $ bundle install

Or install it yourself as:

    $ gem install yabeda-http_requests

## Usage

After plugin the gem, you just have to set up metrics exporting with [yabeda-prometheus](https://github.com/yabeda-rb/yabeda-prometheus) gem.

The metrics page will look like this:

```
# TYPE http_requests_total_count counter
# HELP http_requests_total_count A counter of the total number of external HTTP requests.
http_request_total{host="twitter.com",port="443",method="GET",query="/dsalahutdinov1"} 149.0
http_request_total{host="dev.to",port="443",method="GET",query="/amplifr"} 145.0
...
```

To simple set up Grafana, try the [sample dashboard](https://github.com/yabeda-rb/yabeda-http_requests/blob/master/example/grafana/provisioning/dashboards/yabeda-http_requests.json).

## Sample application

Sample application aims to show how Ruby web-application, this gem and Prometheus/Grafana work togather.
Get into `example` directory and run docker compose:

```sh
$ cd example
$ docker-compose up
```

After docker image builds and all the services get up, you can browse application endpoints:
 - Ruby web-application runs on [http://localhost:9292/](http://localhost:9292/). Everytime you request page, it schedules random web-scrapping job into sidekiq.
 - Sidekiq exposes prometheus metrics on [http://localhost:9394/metrics](http://localhost:9394/metrics). This endpoint is scrapped by prometheus exporter every 5 seconds.
 - Grafana runs on [http://localhost:3000/](http://localhost:3000/). Use `admin/foobar` as login and password to get in. Grafana already has specific dashboard with data visualisation.

Follow the [yabeda-external-http-requests](http://localhost:3000/d/OGd-oEXWz/yabeda-external-http-requests?orgId=1&refresh=5s) dashboard in Grafana.
Finally, after a couple of minutes when data collected you will see the following:
![Monitor external HTTP calls with Grafana](docs/dashboard.png)

## Development with Docker

Get local development environment working and tests running is very easy with docker-compose:
```bash
docker-compose run app bundle
docker-compose run app bundle exec rspec
```

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/yabeda-rb/yabeda-http_requests.

### Releasing

1. Bump version number in `lib/yabeda/http_requests/version.rb`

   In case of pre-releases keep in mind [rubygems/rubygems#3086](https://github.com/rubygems/rubygems/issues/3086) and check version with command like `Gem::Version.new(Yabeda::VERSION).to_s`

2. Fill `CHANGELOG.md` with missing changes, add header with version and date.

3. Make a commit:

   ```sh
   git add lib/yabeda/http_requests/version.rb CHANGELOG.md
   version=$(ruby -r ./lib/yabeda/http_requests/version.rb -e "puts Gem::Version.new(Yabeda::HttpRequests::VERSION)")
   git commit --message="${version}: " --edit
   ```

4. Create annotated tag:

   ```sh
   git tag v${version} --annotate --message="${version}: " --edit --sign
   ```

5. Fill version name into subject line and (optionally) some description (list of changes will be taken from changelog and appended automatically)

6. Push it:

   ```sh
   git push --follow-tags
   ```

7. GitHub Actions will create a new release, build and push gem into RubyGems! You're done!

## License

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

gha_language: Ruby


text:
# Lithuania votes paves way for large spy swap with Russia

Published at: **2019-11-07T10:40:27+00:00**

Author: **EndPlay**

Original: [WFXT](https://www.boston25news.com/news/lithuania-votes-paves-way-for-large-spy-swap-with-russia/1005997113?utm_source=homestream&utm_medium=site_navigation&utm_campaign=homestream_click)

VILNIUS, Lithuania (AP) - Lithuanian lawmakers adopted a bill Thursday that is paving the way for a spy swap with neighboring Russia.
The exchange could include a Norwegian citizen serving a 14-year sentence for espionage in a Russian jail.
Lithuania's parliament voted 76-2 to give the country's president the right to pardon a convict involved in a spy swap deal.
Frode Berg, a 63-year-old retired Norwegian border inspector, was arrested in Moscow in December 2017 on espionage charges for collecting information about Russian nuclear submarines.
Prosecutors asserted that Berg was caught with documents he had received from an employee of a military facility who was shadowed by Russian intelligence.
Vilnius could hand over a man sentenced in 2017 by a Lithuanian court to 10 years in prison for spying for Russia's main intelligence agency. In return, two Lithuanians who both were sentenced to 12 years in 2016 for spying in Russia could be released.
It wasn't clear when or where a spy swap would take place.
The adopted bill must be signed by President Gitanas Nauseda who is currently visiting Italy. His office says he is expected to sign it Monday and a meeting of the panel which may pardon the Russian spy is scheduled for Wednesday.
Last month, an official Russian commission recommended a presidential pardon for Berg, saying the recommendation had been sent to President Vladimir Putin.

license: Unlicense

repository: dsadlollioygjmzvcxv/tdc-exported

repo_name: dsadlollioygjmzvcxv/tdc-exported


text:
# Mashed Potatoes

*Prep time: ~10 min*

*Cook time: 25 min*

### Ingredients

 - 1 cup water
 - 3 to 3 1/2 pounds (4 large) russet potatoes, peeled and sliced 1-inch thick
 - 4 cloves garlic, peeled (optional)
 - 3/4 cup whole milk
 - 3 tablespoons unsalted butter
 - 1 1/2 teaspoons kosher salt
 - 1/2 teaspoon freshly ground black pepper
 - Chopped fresh chives or parsley, for garnish (optional)

### Cooking

 - Place a steamer basket in the bottom of your electric pressure cooker and add 1 cup of water.
 - Add the sliced potatoes and peeled garlic cloves (if using) on top of the steamer basket.
 - Secure the lid on your pressure cooker and make sure the pressure release valve is set to its “sealing” position. Select the “Steam” or “Manual” setting and set the cooking time to 4 minutes at high pressure.
 - Quick release by moving the pressure release valve to its “venting” position.
 - Melt butter, warm cream: While the potatoes are cooking, melt the butter and warm the cream. You can heat them together in a pan on the stove or in the microwave.
 - Drain cooked potatoes, mash with butter, cream, milk: When the potatoes are done, drain the water and place the steaming hot potatoes into a large bowl. Pour the heated cream and melted butter over the potatoes.
 - Mash the potatoes with a potato masher. Then use a strong wooden spoon (a metal spoon might bend) to beat further.
 - Add milk and beat until the mashed potatoes are smooth. Don't over-beat the potatoes or the mashed potatoes will end up gluey.
 - Add salt and pepper to taste.

License
----

MIT

Original recipe seen [here](https://www.simplyrecipes.com/recipes/pressure_cooker_garlic_mashed_potatoes/).


text:
# ROS-laserdumper
Dump ROS LaserScan data into csv files.

# Usage

Run like so:

```
rosrun lb_laserdumper lb_laserdumper _file:=scan.csv _scan:=/scan
```

The two values shown above are actually the default values of these parameters.
A few notes:

- Scans are written out one scan per line.
- Laser-scans are **appended** to `scan.csv` if the file already exists.
- `_file` may contain unix-y things like `~/foo.csv`.

repository: aizzat/ROS-laserdumper

repo_name: aizzat/ROS-laserdumper


text:
# poset

experimental poset module

Poset is an abstraction that fits neatly over
trees, lists, and sets.

The goal for this module is to create a simple API
that can be used to mainpulate all of the above.

included so far, is `./fs.js` and `./object.js`
which adapt this module for operating on fs trees,
and js objects.

There are many other possibilities,
such as HTMLElements, git commits, and many others.

thanks to @jez0990 for introducing me to posets!

## Stability

Experimental: Expect the unexpected. Please provide feedback on api and your use-case.

## API

### Node.ancestors()

### Node.subposet (test) / filter

return a subposet of the poset that matches a property

example: tree of directories

``` js
poset(fs).filter(function (e) {return e.isDirectory()})
```

tree of objects

``` js
poset(obj).filter(function (e) {return e && 'object' === typeof e})
```

## traversals

``` js
//depth first
poset(fs).depthFirst(function (item) {...})

//width first
poset(fs).widthFirst(function (item) {...})

//leaves first
poset(fs).topological(function (item) {...})

//ancestors
poset(fs).ancestors(function (item) {...})

//bottom most ancestors
poset(fs).roots(function (item) {...})
```

## comparisons

``` js
item1.gt(item2)
item1.decendentOf(item2)
item1.ancestorOf(item2)
item1.concestor(item2)
```

## License

MIT

repository: dominictarr/poset

repo_name: dominictarr/poset


text:
Nelen & Schuurmans scripts
==========================

This repository contains example scripts supplied by Nelen & Schuurmans.
This repository aims to exchange and showcase scripts around [3Di hydrodynamic
modelling software](http://www.3diwatermanagement.com/).

The scripts are often Jupyter Notebooks which can be executed best within an
Python 3 environment set up within Anaconda. Most dependencies can be
installed using the Anaconda Navigator. If an dependency is not available
within Anaconda Navigator it can be installed using pip.

How to install a package in an Anaconda environment using pip?

1. Open *Anaconda Prompt*
2. Activate the correct environment: *activate <<environment_name>>*
3. Install the package: *pip install <<package_name>>*

repository: threedi/scripts-nens

repo_name: threedi/scripts-nens


text:
# Suricata Unix Socket

This section **does not** assume any knowledge about Suricata YAML configuration. Some references to it will be made. But student should be able to repeat all examples without touching the configuration file.

However, the student should be familiar with:
* Using Suricata with CLI flags (`-S`, `-l`, `-r`, `--af-packet=$IFACE`);
* Parsing offline PCAP files / simple traffic replay;
* Rule file, loading that rule file with `-S`;
* Exploring `eve.json` using `jq`;

## Background

* Restarting suricata is a no no. If you have a lot of rules, this will take a long time
* You would not want to miss anything, would you?

## Suricata can listen to a unix socket and accept commands from the user.

see:
* https://suricata.readthedocs.io/en/latest/unix-socket.html
* https://suricata.readthedocs.io/en/latest/rule-management/rule-reload.html
* https://home.regit.org/2012/09/a-new-unix-command-mode-in-suricata/
* https://github.com/inliniac/suricata/blob/89ba5816dc303d54741bdfd0a3896c7c1ce50d91/src/unix-manager.c#L922

Unix socket can be enabled in YAML config. Note that this should be enabled by default, so current section does not require user to set it up.

```
unix-command:
  enabled: auto
  #filename: custom.socket
```

## Using unix-socket mode

Suricata has many runmodes. Student should already be familiar with `pcap reader` and `af-packet`. However, former will exit as soon as PCAP read is done and latter requires higher privileges with traffic generation to live interface. Both would need to *heat up* the ruleset first. Which is not ideal if you want to process a lot of PCAPs, debug large rulesets, etc.

Solution is to launch suricata in unix socket mode.

```
suricata --unix-socket
suricatasc
```

Note that Suricata would create unix socket regardless of runmode. However, explicit unix socket mode has a few benefits. Many were already mentioned in last paragraph, but this runmode will also enable commands that are unavailable in other runmodes.

Most importantly, you will be able to feed PCAPs along with respective output folders directly to Suricata process running in userspace. Great for network forensics

```
suricatasc -c capture-mode
suricatasc -c "pcap-file $PCAP $LOG_DIR"
```

## Looping over values in bash

```
for pcap in `find /$PCAP_DIR -type f -name '*.pcap'` ; do
  suricatasc -c "pcap-file $pcap $LOG_DIR/$PCAP"
done
```

## Tasks

* Start suricata in unix-socket runmode
* Parse all MTA PCAPs!

repository: ccdcoe/CDMCS

gha_language: Jupyter Notebook

repo_name: ccdcoe/CDMCS


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

### Description

Red Hat Network (RHN) Satellite 5.3 and 5.4 exposes a dangerous, obsolete XML-RPC API, which allows remote authenticated users to access arbitrary files and cause a denial of service (failed yum operations) via vectors related to configuration and package group (comps.xml) files for channels.

### POC

#### Reference
- http://www.redhat.com/support/errata/RHSA-2011-0434.html

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

repository: trickest/cve

branch_name: refs/heads/main

repo_name: trickest/cve


text:
# packer-centos8-ami

Packer template for building a clean CentOS 8 AWS AMI
Example to run:
```shell script
$ AWS_PROFILE=test packer build template.json
...
==> Builds finished. The artifacts of successful builds are:
--> amazon-ebssurrogate: AMIs were created:
us-east-1: ami-072af3358a766076f
```

gha_language: Shell


text:
## Contribution Guidelines
Orb is an open-source project that accept all type of contributions.

To start contribute to Orb, please make a new [pull request](https://github.com/ezralazuardy/orb/pulls) to post your changes. You should describe your changes clearly with the following important points :

1. The purpose of your changes.
2. Why you need to do that (why should the project accept your changes).
3. Tag the issue if your pull request is intended to solve the problem.
4. Consider to use the [labels](https://github.com/ezralazuardy/orb/labels) based on your pull request.

repository: ezralazuardy/orb

gha_language: Kotlin

repo_name: ezralazuardy/orb


text:
# Bringing ML Models into Production Bootcamp
# Lesson 1: Intro

Watch the recording of this lesson [here](https://youtu.be/irwDv_wDyQc).

## Goal

The goal of this lesson is to learn more about:
- energy use case
- MLOps concept
- machine learning lifecycle building blocks
- machine learning model deployments scenarios
- steps to prepare model for deployment

Learning materials can be found [here](lesson1_slides.pdf).

---
## 1. Home assignment 1

**Goal**

Get local development setup ready for the hands-on part of the Bootcamp.

**Assignment**

1. Install [git](https://git-scm.com/downloads)
2. Install [docker](https://docs.docker.com/get-docker/)
3. Install [miniconda](https://docs.conda.io/en/latest/miniconda.html) (not needed if you have Anaconda installed)
4. Install [Visual Studio Code](https://code.visualstudio.com/) (further VSC)
5. [Configure terminal in VSC](https://code.visualstudio.com/docs/editor/integrated-terminal)
6. Install [Python extension for VSC](https://marketplace.visualstudio.com/items?itemName=ms-python.python)
7. Install [Docker extension for VSC](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker)
8. Install [Azure Machine Learning extension for VSC](https://marketplace.visualstudio.com/items?itemName=ms-toolsai.vscode-ai)
9. Install [Azure Storage Extension for VSC](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurestorage)
10. Install [Azure Functions Extension for VSC](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions)
11. Install [Azurite Extension for VSC](https://marketplace.visualstudio.com/items?itemName=Azurite.azurite)
12. [Create Azure account for free](https://azure.microsoft.com/free)
13. [Create Azure Pipelines account for free](https://azure.microsoft.com/en-us/services/devops/pipelines/)
14. [Create Power BI Desktop account for free](https://powerbi.microsoft.com/en-us/desktop/)
15. Install [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli)
16. Install [Azure Functions Core Tools](https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local?tabs=macos%2Ccsharp%2Cbash#install-the-azure-functions-core-tools)

---
## 2. Home assignment 2

**Goal**

Understand the peculiarities of working with time series data

**Assignment**
1. Refresh your time series knowledge with [this Pycon US 2021 tutorial](https://github.com/marysia/pycon-time-series)
2. Get familiar with [sktime documentation](https://www.sktime.org/en/latest/) and [sktime tutorial](https://github.com/sktime/sktime-tutorial-pydata-amsterdam-2020)

---
## 3. Reading materials (optional)

* [MLOps concept](https://ml-ops.org/)
* [How To Backtest Machine Learning Models for Time Series Forecasting](https://machinelearningmastery.com/backtest-machine-learning-models-time-series-forecasting/)
* [Advanced cross validation tips for time series](https://www.datapred.com/blog/advanced-cross-validation-tips)


text:
# How to Access form definitions in a compiled and built application

As you know, the build phase of an application generates a `.4Z` file in which the source code of methods and classes is removed. But the form definition is still present.

Some developments require loading the definition of a form to modify it on the fly before presenting it to the user.

* A commonly used solution is to create the form in the structure, then copy its definition to the resources folder. Don't forget to update it after each modification.
* Another method is to use the **ZIP Read archive** command to read/extract the file(s) from the `.4DZ` archive. But this way cannot be used if the [archive is protected](https://blog.4d.com/secure-your-apps-resources-with-a-new-algorithm/) with the buildApp key `UseStandardZipFormat` set to `False`.

## There is an easier way

The thing to know is that the **File** and **Folder** commands are able to operate on a `.4DZ` file if it is open in memory.
And this is necessarily the case since the application is loaded even if the `.4DZ` file is protected.

So the access path for the `Form1` definition is:

```4d
	$file:=File(“/SOURCES/Forms/Form1/form.4DForm”)
```

url: https://raw.githubusercontent.com/vdelachaux/tip-and-tricks/3ec89bb136e1bbd906087f970e2a45a3bdefae88/docs/Accessing form definitions in a compiled and built application.md

repository: vdelachaux/tip-and-tricks

repo_name: vdelachaux/tip-and-tricks


text:
---
layout: post
title: "Guide - Installing the GitHub client"
author: ekori
excerpt: "Getting started with using GitHub from the command line"
tags: [guide]
comments: true
---

This is a guide written specifically for interacting with the **XPMGla GitHub**. If you would like a general introduction, there are plenty of great guides out there for getting to grips with Git and GitHub. [^1]

#### Before you begin...

This guide assumes that you **already have a GitHub account**, but **don't have Git or the client installed on your machine**.

It also assumes that you have gone through at least [**part 1 of the GitHub web interface**]({{ site.url }}/guide-adding-a-post-1/) guides. So, before you continue, make sure that you have:

1.  Forked from the main [XPMGla repo](https://github.com/xpmgla/xpmgla.github.io);
3. And possibly made some changes and submitting a pull request.

If that's not the case, have a look at parts [1]({{ site.url }}/guide-adding-a-post-1/), [2]({{ site.url }}/guide-adding-a-post-2/), and [3]({{ site.url }}/guide-adding-a-post-3/) of the guide here.

## Step 1 - Installing Git

Git and GitHub are not one and the same. You'll be using both to interact with the XPMGla repo.

**Git** 'is a very popular and efficient open source Version Control System. It tracks content such as files and directories.'[^2] A good way to think about Git is as 'a series of snapshots (commits)' of any revisions you make to your files. You can examine these snapshots in the order they were created. You can make branches to experiment and come then return to earlier snapshots if you want.[^3]
{: .notice}

**GitHub** 'is a Git repository hosting service, but it adds many of its own features. While Git is a command line tool, GitHub provides a Web-based graphical interface. It also provides access control and several collaboration features, such as a wikis and basic task management tools for every project.'[^4]
{: .notice}

So, first you have to download and install Git.

#### Downloading Git

Start by going to the [Git website](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and following the instructions there.
---

Terminal, then

`$ git config --global user.name "YOUR NAME"`

`$ git config --global user.email "YOUR EMAIL ADDRESS"`

or

if you want to keep your email private:

`$ git config --global user.email<EMAIL_ADDRESS>
to check

`$ git config --global user.email`

should return

<EMAIL_ADDRESS>

## Step 2- Installing GitHub

Downloading GitHub is pretty straightforward. GitHub recently released [**GitHub Desktop**](https://desktop.github.com/), which is an all-in-one client that works on both Windows and OSX.

Following the link above should take you the right page for installing GitHub Desktop for your operating system.

**Shell**
{: .notice}

**Command Line**
{: .notice}

**`$`**
{: .notice}

## creating a local clone of your fork

1. On GitHub, navigate to your fork of the XPMGla repository.
2. Under your repository name, click  to copy the clone URL for the repository.
3. Open Terminal (for Mac and Linux users) or the command prompt (for Windows users).
4. Navigate to the folder you want to clone your repo into (cd)
* Type git clone, and then paste the URL you copied in Step 2.
* Press Enter. Your local clone will be created.

## Configure remote

1. navigate into the folder you just cloned
2. check the settings with `$ git remote -v`
3. you should see:
`origin  https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)`
`origin  https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)`
4. Go to the original XPMGla repo and copy the clone url
5. Type git remote add upstream, and then paste the URL you copied in Step 4 and press Enter. It will look like this:
`$ git remote add upstream https://github.com/octocat/Spoon-Knife.git`
6. To verify the new upstream repository you've specified for your fork, type git remote -v again. You should see the URL for your fork as origin, and the URL for the original repository as upstream.:
`$ git remote -v`
`origin    https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)`
`origin    https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)`
`upstream  https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (fetch)`
`upstream  https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (push)`

https://help.github.com/articles/syncing-a-fork/

---

![fork]({{ site.url }}/images/guide-images/fork.png)

To continue reading about adding a post to the XPMGla page, move on to **[Adding a post using the web client pt.2]({{ site.url }}/guide-adding-a-post-2/).**

---

[^1]:[Hello world](https://guides.github.com/activities/hello-world/) / [GitHub flow](https://guides.github.com/introduction/flow/) / [Using Git Cheatsheet](https://gist.github.com/hofmannsven/6814451) / [Atlassian's Git Tutorial](https://www.atlassian.com/git/tutorials)
[^2]:[SiteGround Git Tutorial](https://www.siteground.co.uk/tutorials/git/)
[^3]:[StackOverflow Q&A](http://stackoverflow.com/questions/11816424/understanding-the-basics-of-git-and-github)
[^4]:[Tech Crunch 'What Exactly is GitHub Anyway'](http://techcrunch.com/2012/07/14/what-exactly-is-github-anyway/)


text:
## CMPUT 301 PROJECT PLANNING DOCUMENT
### DIVISION OF WORK
#### PART 2
- UML diagrams - Xinjian, Zixuan
- User Interface Mockups - Melisse, Yuqing, Tao
- Storyboard Sequence: Yuqing
- Product Backlog - Xuechun
- Glossary And Information Sources - Xuechun, Melisse

#### PART 3
- Database methods, Participant Login/ Signup Screen and MainMenu Screen: Xuechun
  - Unit tests & UI tests: Xuechun

- Add/View/Edit MoodEvent Screen, MoodEvent History Screen, Map View Of MoodEvent History Screen : Melisse, Xinjian, Shelly
  - Add/Edit and MoodEvent History: Melisse, King
  - Map View Of MoodEvent History Screen: Shelly
  - Unit tests & UI tests: Melisse, King

- Add Friends & View Pending Friend Requests Screen: Tao, Zixuan
  - Unit tests & UI Tests: Zixuan
- Update Product Backlog, UML, and Storyboard and Interface: Xuechun, King, Shelly, Zixuan

path: /doc/Project Task Division.md

filename: Project Task Division.md

gha_language: Java


text:
Normal ActiveRecord callbacks will NOT be called when using activerecord-imports. This is because it is mass importing rows of data and doesn't necessarily have access to in-memory ActiveRecord objects.

If you do have a collection of in-memory ActiveRecord objects you can do something like this:

```
books.each do |book|
  book.run_callbacks(:save) { false }
  book.run_callbacks(:create) { false }
end
Book.import(books)
```

This will run before_create and before_save callbacks on each item. The `false` argument is needed to prevent after_save being run, which wouldn't make sense prior to bulk import.

license: Ruby

repository: dmagro/activerecord-import-wiki

repo_name: dmagro/activerecord-import-wiki


text:
#### Scripts
##### ExtractEmailTransformer
- Fixed the script's tags to include 'transformer' instead of 'Transformer'.
- Updated the Docker image to: *demisto/python3:<IP_ADDRESS>342*.

repository: demisto/content

gha_language: Python

repo_name: demisto/content


text:
# Instance_Allocator

Instance_Allocator is an optimized CPU instance allocator that can assigning servers for users based on their needs

## Installation
Please refer website link [Docs](https://satheeshkmr955.github.io/instance_allocator/)

## License
[MIT](https://choosealicense.com/licenses/mit/)


text:
# Nitro Component Resolver
[![npm version](https://badge.fury.io/js/%40namics%2Fnitro-component-resolver.svg)](https://badge.fury.io/js/%40namics%2Fnitro-component-resolver)
[![Build Status](https://travis-ci.org/namics/nitro-component-resolver.svg?branch=master)](https://travis-ci.org/namics/nitro-component-resolver)
[![Coverage Status](https://coveralls.io/repos/github/namics/nitro-component-resolver/badge.svg?branch=master)](https://coveralls.io/github/namics/nitro-component-resolver?branch=master)
[![Codestyle](https://img.shields.io/badge/codestyle-namics-green.svg)](https://github.com/namics/eslint-config-namics)

The nitro component resolver looks up all `pattern.json` (can be changed) files in the given nitro components directory
and provides fast and easy access to the files and their content during development and production.

## Installation

```bash
npm i --save-dev @namics/nitro-component-resolver
```

## Usage

```js
const ComponentResolver = require('@namics/nitro-component-resolver');
const resolver = new ComponentResolver({
    rootDirectory: '/example/path/components',
    // Invalidate cache on file changes (can be set to false for production mode)
    // Default: true
    watch: true,
    // Main template (please adjust if you use another template language)
    // Default: '*/*/*.hbs'
    mainTemplate: '*/*/*.hbs',
    // Meta json which contains the component details
    // used by getComponents()
    // Default: '*/*/pattern.json'
    patternExpression: '*/*/pattern.json',
    // Wether to cache the examples
    // Default and recommend value: true
    cacheExamples: true,
});

resolver.getComponentTypes()
    .then(function(componentTypes) {
        // Returns all existing nitro component types e.g. 'atoms', 'molecules'
        console.log(componentTypes);
    });

resolver.getComponents()
    .then(function(components) {
        // Returns all nitro components and their package.json content
        console.log(components);
    });

resolver.getComponents('atoms')
    .then(function(components) {
        // Returns the nitro components of type 'atoms' and their package.json content
        console.log(components);
    });

resolver.getComponentExamples('a/path/to/atoms/button')
    .then(function(examples) {
        console.log(examples);
    });

resolver.getComponentReadme('a/path/to/atoms/button')
    .then(function(readme) {
        console.log(readme);
    });
```

## Performance

The component resolver relies on [chokidar](https://github.com/paulmillr/chokidar).

Chokidar shares its internal file watcher so that only one io-watcher per file/folder is used even if multiple
chokidar instances exist.

## Caching

All resolved and parsed components are cached using the [hot-file-cache](https://github.com/jantimon/hot-file-cache/) module:

[![Concept flow uml](https://raw.githubusercontent.com/jantimon/hot-file-cache/master/flow.png)](https://github.com/jantimon/hot-file-cache/blob/master/flow.puml)


text:
# jeoconnor.github.io

[Yocto RaspberryPI3 with WIFI](yocto-rpi3-wifi.md)

[Network Boot on RaspBerry PI](raspberry-pi-network-boot.md)

[Yocto Package Server](yocto-package-server.md)

Would like to enable network booting with an NFS mounted root file system on the raspberry pi.
Found a promising example [here](https://www.blockdev.io/network-booting-a-raspberry-pi-3/)


text:
---
title: 'Remotely connecting to Rooted Android via ADB'
layout: post
published: true
permalink: rooted-android-remote-adb
tags: all, android, linux, ssh, adb
---

This post will just contain some quick snippets on how I connect to my rooted Android phone with ADB. This post assumes that your Android phone is already rooted.

## Install Termux, Termux:Boot:

First, install [F-Droid](https://f-droid.org).

Then, using F-Droid, install [Termux](https://f-droid.org/en/packages/com.termux/) and [Termux:Boot](https://f-droid.org/en/packages/com.termux.boot/).

Launch Termux and launch Termux:Boot.

## Configure Termux:

In Termux, install the `root-repo` and `tsu`:

```bash
pkg install root-repo && pkg install tsu
```

Test that you can elevate to `root`:

```bash
~ $ tsu -
:/data/data/com.termux/files/home # whoami
root
```

As the normal Termux user -- not `root` -- create `~/.termux/boot/`:

```bash
mkdir -p ~/.termux/boot
```

### Setup SSH:

With your preferred text editor, add the following to `~/.termux/boot/sshd`:

```bash
#!/data/data/com.termux/files/usr/bin/env bash

termux-wake-lock
sshd
```

Make it executable:

```bash
chmod +x ~/.termux/boot/sshd
```

The above `~/.termux/boot/sshd` script will run `sshd` on boot. You will either need to set a password for your user in Termux or set up an SSH key in the `~/.ssh/authorized_keys` file.

*Find the username of your Termux user with `whoami`*

Also, add the following to `$PREFIX/etc/ssh/sshd_config`:

```bash
Port 1024
```

This will make sure that the SSH service runs on port 1024 on your Android.

### Setup ADB:

Now add the following to `~/.termux/boot/adb`:

```bash
#!/data/data/com.termux/files/usr/bin/env bash

INTERFACE='tun0'

su -c "setprop service.adb.tcp.port 5555 && iptables -A INPUT -i ${INTERFACE} -p tcp --dport 5555 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT && stop adbd && start adbd"
```

Make sure to modify the `$INTERFACE` variable with whatever desired your desired interface is on your Android. You can list your interfaces with the `ip addr` command.

Make it executable:

```bash
chmod +x ~/.termux/boot/adb
```

The above script will run adb on TCP port 5555 of your Android. Since it is in the `~/.termux/boot` folder and you have Termux:Boot installed it will run on boot.

## Accessing ADB remotely from your workstation:

This next part assumes you're on a Unix-like machine with `adb` already installed.

### Setup your SSH config on your workstation:

I'd recommend adding something like the following to `~/.ssh/config` on your workstation:

```bash
Host kali-phone
    Host <IP_ADDRESS>
    User u0_a107
    Port 1024
```

Change the username and IP address based on your setup. Use `whoami` while in Termux to find the username.

Once you setup your config you can use `ssh kali-phone` to login to the phone.

### Connect to ADB via SSH:

Use the following command to forward ADB to your local machine using an SSH tunnel:

```bash
ssh -L 5555:<IP_ADDRESS>:5555 kali-phone
```

Then in a separate Terminal window connect with `adb`:

```bash
adb connect localhost:5555

adb shell
```

## Conclusion:

I documented this because I wanted to access ADB over my Wireguard setup, which would encrypt the ADB connection between my Mac and my Android -- both connected to the same Wireguard instance.

## Bonus:

Here are some BASH aliases I use for ADB:

```bash
alias kali-phone-adb-start="screen -dmS kali-phone-adb ssh -L 5555:<IP_ADDRESS>:5555 -qCN kali-phone && adb connect localhost:5555"

alias kali-phone-adb-stop="screen -X -S kali-phone-adb quit && adb disconnect"

alias kali-phone-screen-capture='adb shell "while true; do screenrecord --output-format=h264 -; done" | ffplay -framerate 60 -probesize 32 -sync video -'
```


text:
# Company Tracker         [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Table of Content:
1.[Description](#Description)

2.[Installation Instructions](#Installation-Instructions)

3.[Usage Information](#Usage-Information)

4.[License](#License)

5.[Questions](#Questions)

6.[Demo](#Demo)

## Description:
This app tracks dperatments, roles and employees in a companys' database that was built with mysql

## Installation Instructions:
run " run npm i" to install all dependecies which are:
* mysql
* inquirer
* console.table

## Usage Information:
* run "node index.js" to start the application
* a user can add or view a department, role or  an employee
* update an employees' role
![](./public/assets/images/image.png)

## License:
This application is covered under the [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT).

## Questions:
For inquires please contact :
* Github: [laithalwani](https://github.com/laithalwani)
*<EMAIL_ADDRESS>
## Demo

repository: LaithAlwani/company-tracker

repo_name: LaithAlwani/company-tracker


text:
# Build status of dev branch

* Linux [![Build Status](https://travis-ci.org/beyondgrep/ack2.png?branch=dev)](https://travis-ci.org/beyondgrep/ack2)
* Windows [![Build Status](https://ci.appveyor.com/api/projects/status/github/beyondgrep/ack2)](https://ci.appveyor.com/project/petdance/ack2)
* [CPAN Testers](http://cpantesters.org/distro/A/ack.html)

# ack 2

ack is a code-searching tool, similar to grep but optimized for
programmers searching large trees of source code.  It runs in pure
Perl, is highly portable, and runs on any platform that runs Perl.

ack is written and maintained by Andy Lester (andy@petdance.com).

* Project home page: https://beyondgrep.com/
* Code home page: https://github.com/beyondgrep/ack2
* Issue tracker: https://github.com/beyondgrep/ack2/issues
* Mailing list for announcements: https://groups.google.com/d/forum/ack-announcements
* Mailing list for users: https://groups.google.com/d/forum/ack-users
* Mailing list for developers: https://groups.google.com/d/forum/ack-dev

# Building

ack requires Perl 5.8.8 or higher.  Perl 5.8.8 was released January 2006.

    # Required
    perl Makefile.PL
    make
    make test
    sudo make install # for a system-wide installation (recommended)
    # - or -
    make ack-standalone
    cp ack-standalone ~/bin/ack2 # for a personal installation

# Development

[Developer's Guide](DEVELOPERS.md)

[Design Guide](DESIGN.md)

branch_name: refs/heads/dev

gha_language: Perl

gha_license_id: NOASSERTION


text:
[![Logo](https://raw.githubusercontent.com/ogycode/DesignPatterns/master/merch/logoStructuralPatterns.jpg)](https://github.com/ogycode/DesignPatterns/tree/master/src/StructuralPatterns)

# Structural Patterns
**Design Patterns: Elements of Reusable Object-Oriented Software**

## Sections:
 - [Adapter](https://github.com/ogycode/DesignPatterns/blob/master/src/StructuralPatterns/Adapter)
 - [Bridge](https://github.com/ogycode/DesignPatterns/blob/master/src/StructuralPatterns/Bridge)
 - [Composite](https://github.com/ogycode/DesignPatterns/blob/master/src/StructuralPatterns/Compisite)
 - [Decorator](https://github.com/ogycode/DesignPatterns/blob/master/src/StructuralPatterns/Decorator)
 - [Facade](https://github.com/ogycode/DesignPatterns/blob/master/src/StructuralPatterns/Facade)
 - [Flyweight](https://github.com/ogycode/DesignPatterns/blob/master/src/StructuralPatterns/Flyweight)
 - [Proxy](https://github.com/ogycode/DesignPatterns/blob/master/src/StructuralPatterns/Proxy)


text:
---
layout: post
title: "Analysis for trends and anomalies"
excerpt: "Analyze and visualize across multiple dimensions, automatically"
tags: [apple, mac, setup, RDP, cloud]
filename: "2107-08-30-analysis.md"
image:
  feature: https://cloud.githubusercontent.com/assets/300046/14583248/4b20c578-03d9-11e6-8f7a-c860b666bc73.jpg
  credit: Wall Street Journal
  creditlink: http://graphics.wsj.com/job-market-tracker/
comments: true
---
{{ page.excerpt }}

{% include _toc.html %}

This repository is a set of software to enable processing, alerting, and visualization of data collected from various sources.

This effort is necessary for data related especially to load/stress testing because current solutions provide visualization of only individuals metrics for individual runs, without understanding additional context.

The context needed span across many dimensions to identify:

   * Creeping increases in response times for the same metric over several versions of the application.

   ![viz-pt-creeping-650x285-34125](https://user-images.githubusercontent.com/300046/30036662-8fa637d2-9172-11e7-8286-6e0fa3332fe0.jpg)

   * Sudden change in memory per user (or other ratios) within a specific enviornment, when compared against the same metric across environments from dev to production.

   ![viz-pt-env-diff-650x270-79779](https://user-images.githubusercontent.com/300046/30036768-575287fe-9173-11e7-8b2c-12eb72ada985.jpg)

   * Differences integrating data gathered from difference sources (CA-APM GC metrics, LoadRunner Transactions Per Second).

   * Differences between similar data gathered from multiple tools (from multiple vendors), such as LoadRunner, Gatling, JMeter, Selenium, etc. so that they can be evaluated for consistency.

More importantly, a different approach is needed than what current vendors provide in terms of alert triggers:  Instead of requiring people to diligently pour through all the various graphs across runs in various enviornments for every release, this effort aims for people to receive alerts after intelligent software identify trends and anomalies after assimilating data from various runs and sources, around the clock.

### Trends and Anomalies

We want a way to use what I call "peak summary metrics", such as the amount of Memory or average response time during the "steady state period" between ramp-up and ramp-down:

   ![lr-response-time-sustained-500x208-57305](https://user-images.githubusercontent.com/300046/30041772-0d2266ae-91aa-11e7-9660-76808e9f945f.jpg)

   In the above example, when the Hits Per Second averaged 110 for the transaction at the top line (in purple), other metrics were, during the same "steady state period" period:

   * Memory averaged 3.2 GB
   * CPU averaged 65%
   * etc.

   What is different about these numbers is that each metric summarizes conditions over the entire run (not a single point in time).

Repeated over several runs, sets of summary numbers enables trends and anomalies to be identified in the association between various metrics (such as between memory used and Hits per Second, etc.).

When runs are repeated several times, several sets of metrics can be plotted together to yield scatterplots such as this:

   ![analysis-memtotal-650x357-44138](https://user-images.githubusercontent.com/300046/30069450-01e0d892-921e-11e7-9869-830f4fbf1587.jpg)

   The trend line calculated from various runs provide a formula of what to expect in the relationship between the two metrics.  Several other formulas (relationships) can be calculated from various combinations of measurements captured during runs.

The formula from the dotted line derived can be used to proactively identify anomalies.  During live runs the measurement system can refer to each formula to determine whether the system is functioning normally at point "p" (illustrated above), or is using more memory than expected at point "q".

### Ratios

Now instead of just total Memory used, we calculate a ratio of peak Memory per user for each run.
We then plot it against peak hits per second for the same run.

   ![analysis-memperuser-650x344-50875](https://user-images.githubusercontent.com/300046/30068759-f855f9e4-921b-11e7-8d33-c92eff759901.jpg)

We get a flat line because the metric factors in the cause of memory usage.

That's until we reach the maximum hits per second that can be handled, when swapping behavior occurs, causing more memory to be used.

Financial Analysts have long calculated various ratios to identify relationships among all companies, and then defining thresholds for alerts when applied to specific companies.

A ratio can be more useful that a static number because it involves a relationship between two metrics.
In the case of Memory per user, history often shows that it is relatively stable for a range of HPS (Hits Per Second) levels until the HPS goes beyond a threshold level.

If in production Memory per User spikes beyond the normal level, we know there is a problem.

Hopefully the real-time monitor (in NGINX, etc.) would understand the context of loads and automatically limit sending more than what each server can handle.

## Data Flow

Here is how data is processed:

   1. A performance test is run to emulate load on the application system of servers and networks.
   2. Monitoring software capture JVM dynamics such as Garbage Collection, memory and CPU used, etc.
   3. The run generatres a HTML file to summarize statistics. This is usually kept for historical review and comparison.
   4. A batch program parses HTML pages and writes the numbers from it into a database.
   5. A program analyses the accumulated data and identifies trends and anomalies (described below).
   6. Trends and anomalies in the most recent run beyond a threshold cause alerts to be issued.
   7. Visualizations of the trends and anomalies are generated along with alerts about thresholds being breached.

## Machine Learning

The innovation here is that:

   1) the system accumulates its data from past runs (by reading HTML files summarizing prior runs)

   2) the system tries various mechanisms to detect trends and anomalies by generating formulas and seeing how historical data fits. Different ratios are examined. For example, instead of Memory vs. HPS it can be CPU vs. HPS.

   3) The extent of "fit"

## Implementation

This requires skill with different technologies and thus cross-department coordination:

   * Performance testing
   * Extracts from utilities monitoring of JVM for GC and app statistics
   * Python to parse historical docs
   * Web Server (provisioning, logging, metrics, hardening, etc.)
   * Back-end Database (Big Data) schema design
   * Statistics (Data Science)
   * Visualization
   * Deep Learning to recognize

The bottom line here is for the performance testing effort to come up with a formula to hand production operations

The trouble with the current situation is that the APM software looks emphirically at what is happening but not make use of what has been discovered during performance testing.

### Python, Go, Java?

I chose Python To parse HTML, etc. on the Goolge cloud because of its popularity for Machine Learning.

http://docs.python-guide.org/en/latest/scenarios/scrape/
uses the Requests module instead of urllib2 built-in.

https://medium.freecodecamp.org/how-to-scrape-websites-with-python-and-beautifulsoup-5946935d93fe

https://www.sqlalchemy.org/
for SQL

### DSL?

Domain-Specific Language like Rapid7.

JetBrains MPS makes it

easier to work with DSLs and their
projection editor of AST trees.
This enables code to be edited as text, tables, diagrams, a form, or a combination of those.

First Date,

Second Date and

Getting started by tomasetti.me

1)
Projects
3)
Constraints


text:
# CTA Data Gatherer

To use:
```bash
$ dep ensure
```

To build:
```bash
$ go build -o app ./main/
```

To run:
```bash
$ PUBSUB_TOPIC_ID=<<PUB_SUB_TOPIC_ID>> GCLOUD_PROJECT_ID=<<GCLOUD_PROJECT_ID>> ./app
```

repository: zparnold/traffic-telemetry

repo_name: zparnold/traffic-telemetry


text:
# Blue Mood for Konsole

This is a port of [emacs's Blue Mood theme](https://emacsthemes.com/themes/blue-mood-theme.html) for KDE's terminal emulator, Konsole.

![Screenshot](https://raw.githubusercontent.com/blue-mood/blue-mood-everything/master/screenshots/konsole-screenshot.png)

## Installation

Copy the blue-mood.colorscheme file to `~/.local/share/konsole`.

## Activation

From Konsole, go the Settings toolbar item, and from there choose `Edit current profile`. Afterwards, go to the `Appearance` tab and choose the theme called `Blue Mood`.

repository: blue-mood/blue-mood-konsole

repo_name: blue-mood/blue-mood-konsole


text:
Title: Dynamically set volume of playing music

This is a simple example that uses the `<app:music_player>` and dynamically set the volume of playing music.

++example
<app:music_player on="l:set.volume then volume[10]">
</app:music_player>

<input type="button" value="Start" on="click then l:set.volume" />
--example

The volume action takes a single integer value from 0-100. The lower the volume the quieter the music.


text:
# Nativescript plugin for Adobe Marketing Cloud Solutions
[![npm version](https://badge.fury.io/js/nativescript-adobe-marketing-cloud.svg)](https://badge.fury.io/js/nativescript-adobe-marketing-cloud)

```
npm install nativescript-adobe-marketing-cloud --save
```

Based on:
- https://github.com/Adobe-Marketing-Cloud/mobile-services/releases/tag/v4.18.0-iOS
- https://github.com/Adobe-Marketing-Cloud/mobile-services/releases/tag/v4.17.2-Android

# Setting up the application for usage with this plugin.

## Set up lifecycle tracking

Listen to lifecycle events:

```ts
import * as application from "application";
import {AdobeAnalytics} from "nativescript-adobe-marketing-cloud";

application.on(application.launchEvent, function (args: application.ApplicationEventData) {
    if (args.android) {
        AdobeAnalytics.getInstance().setContext(application.android.context);
    } else if (args.ios !== undefined) {
        AdobeAnalytics.getInstance().collectLifecycleData(null);
    }
});

application.on(application.suspendEvent, function (args: application.ApplicationEventData) {
    if (args.android) {
        AdobeAnalytics.getInstance().pauseCollectingLifecycleData();
    }
});

application.on(application.resumeEvent, function (args: application.ApplicationEventData) {
    if (args.android) {
        AdobeAnalytics.getInstance().collectLifecycleData(application.android.foregroundActivity);
    }
});

if (application.android) {
    application.android.on(application.AndroidApplication.activityPausedEvent, function (args: application.AndroidActivityEventData) {
        AdobeAnalytics.getInstance().pauseCollectingLifecycleData();
    });

    application.android.on(application.AndroidApplication.activityResumedEvent, function (args: application.AndroidActivityEventData) {
        AdobeAnalytics.getInstance().collectLifecycleData(application.android.foregroundActivity);
    });
}

application.start({ moduleName: "main-page" });

```

## Setup ADBMobileConfig.json
Get the config file from the Adobe dashboard.

### iOS
place `ADBMobileConfig.json` file in `app\App_Resources\iOS`

### Android
place `adbmobileconfig.json` file in `app\App_Resources\Android\raw`

#### Note
Make sure that setContext is done before calling any of the tracking functions, otherwise the SDK behind the plugin will crash.

## Track states and actions

States and actions can be traced through method calls that match their native counterparts signature.

## Privacy options
See: https://marketing.adobe.com/resources/help/en_US/mobile/ios/privacy.html

Select a privacy option:

Send Data Until Opt-Out
```ts
AdobeAnalytics.getInstance().optIn();
```
Hold Data Until Opt-In
```ts
AdobeAnalytics.getInstance().optOut();
```

## Visitor Tracking Between an App and Mobile Web
See: https://marketing.adobe.com/resources/help/en_US/mobile/ios/hybrid_app.html
You can call:
```ts
AdobeAnalytics.getInstance().visitorAppendToURL(url);
```

This will return the url provided extended with the visitorId.

#### Development setup
For easier development and debugging purposes continue with the following steps:

1. Open a command prompt/terminal, navigate to `src` folder and run `npm run demo.ios` or `npm run demo.android` to run the demo.
2. Open another command prompt/terminal, navigate to `src` folder and run `npm run plugin.tscwatch` to watch for file changes in your plugin.

Now go and make a change to your plugin. It will be automatically applied to the demo project.

NOTE: If you need to use a native library in your plugin or do some changes in Info.plist/AndroidManifest.xml, these cannot be applied to the demo project only by npm link. In such scenario, you need to use `tns plugin add ../src` from the `demo` so that the native libraries and changes in the above-mentioned files are applied in the demo. Then you can link again the code of your plugin in the demo by using `npm run plugin.link` from the `src`.

### Linking to CocoaPod or Android Arsenal plugins

You will want to create these folders and files in the `src` folder in order to use native APIs:

```
platforms --
  ios --
    Podfile
  android --
    include.gradle
```

Doing so will open up those native apis to your plugin :)

Take a look at these existing plugins for how that can be done very simply:

* [nativescript-cardview](https://github.com/bradmartin/nativescript-cardview/tree/master/platforms)
* [nativescript-floatingactionbutton](https://github.com/bradmartin/nativescript-floatingactionbutton/tree/master/src/platforms)

### Clean plugin and demo files

Sometimes you may need to wipe away the `node_modules` and `demo/platforms` folders to reinstall them fresh.

* Run `npm run clean` to wipe those clean then you can can run `npm i` to install fresh dependencies.

Sometimes you just need to wipe out the demo's `platforms` directory only:

* Run `npm run demo.reset` to delete the demo's `platforms` directory only.

Sometimes you may need to ensure plugin files are updated in the demo:

* Run `npm run plugin.prepare` will do a fresh build of the plugin then remove itself from the demo and add it back for assurance.

### Unittesting
The plugin seed automatically adds Jasmine-based unittest support to your plugin.
Open `demo/app/tests/tests.js` and adjust its contents so the tests become meaningful in the context of your plugin and its features.

You can read more about this topic [here](https://docs.nativescript.org/tooling/testing).

Once you're ready to test your plugin's API go to `src` folder and execute one of these commands:

```
npm run test.ios
npm run test.android
```

### Publish to NPM

When you have everything ready to publish:

* Bump the version number in `src/package.json`
* Go to `publish` and execute `publish.sh` (run `chmod +x *.sh` if the file isn't executable)

If you just want to create a package, go to `publish` folder and execute `pack.sh`. The package will be created in `publish/package` folder.

**NOTE**: To run bash script on Windows you can install [GIT SCM](https://git-for-windows.github.io/) and use Git Bash.

### TravisCI

The plugin structure comes with a fully functional .travis.yml file that deploys the testing app on Android emulator and iOS simulator and as a subsequent step runs the tests from [UnitTesting section](#Unittesting). All you have to do, after cloning the repo and implementing your plugin and tests, is to sign up at [https://travis-ci.org/](https://travis-ci.org/). Then enable your plugin's repo on "https://travis-ci.org/profile/<your github user\>" and that's it. Next time a PR is opened or change is committed to a branch TravisCI will trigger a build testing the code.

To properly show current build status you will have to edit the badge at the start of the README.md file so it matches your repo, user and branch.

### Referring tns-core-modules in the Plugin
We recommend to use full imports of `tns-core-modules` due to [an issue in Angular CLI](https://github.com/angular/angular-cli/issues/5618#issuecomment-306479219). Read more detailed explanation in [this discussion](https://github.com/NativeScript/nativescript-plugin-seed/pull/32#discussion_r131147787).

Ultimately after the issue in Angular CLI is fixed this would not be a restriction, but till then the recommended approach is to import from `tns-core-modules` using full path. Here is an example:

**WRONG**

*tsconfig.json*
````
...

"paths": {
  "*": [
    "./node_modules/*",
    "./node_modules/tns-core-modules/*"
  ]
}
...
````

*yourplugin.common.ts*
````ts
import * as app from 'application';
````

**RIGHT**

*yourplugin.common.ts*
````ts
import * as app from 'tns-core-modules/application';
````