text:
# sysutils

This repository contains code to perform system level utilities. Currently there are 2 programs available testlistener
and testnetwork.

## Installation

```
git clone https://github.com/ng5/sysutils && cd sysutils

# Use static link as preferred method for maximum portability
CGO_ENABLED=0 go install ./...
```

## testlistener

if you don't have any server applications yet, use this program to open 3 ports on host machine to allow you to test
connectivity. program will also generate traffic on multicast for testing purpose. Change ports as necessary.

```
testlistener -h
Usage of testlistener:
  -m string
    	multicast group & port (default "<IP_ADDRESS>:12003")
  -t string
    	tcp port (default "12001")
  -u string
    	udp port (default "12002")
```

```
~/go/bin/testlistener
2021/03/14 19:47:08 listening TCP: 12001
2021/03/14 19:47:08 listening UDP: 12002
2021/03/14 19:47:08 listening MULTICAST: <IP_ADDRESS>:12003
2021/03/14 19:47:08 generating MULTICAST: <IP_ADDRESS>:12003
2021/03/14 19:47:09 MULTICAST packet: recv 14 bytes from <IP_ADDRESS> to <IP_ADDRESS> on wlp3s0
2021/03/14 19:47:10 MULTICAST packet: recv 14 bytes from <IP_ADDRESS> to <IP_ADDRESS> on wlp3s0
2021/03/14 19:47:11 MULTICAST packet: recv 14 bytes from <IP_ADDRESS> to <IP_ADDRESS> on wlp3s0
2021/03/14 19:47:12 MULTICAST packet: recv 14 bytes from <IP_ADDRESS> to <IP_ADDRESS> on wlp3s0
```

## testnetwork

Instead of writing duplicate bash scripts/power shell and copying them on remote servers and then finally executing them
sequentially, this program (testnetwork) provides an alternative method. Add your networking rules in a csv file and
pass it to testnetwork. this is how it works:

1. zero dependencies on test machines.
2. rules will be sorted by hostname
3. ssh connection will be made only once per host.
4. rules.csv and testnetwork will be transferred to remote server under /tmp directory.

   i) alternatively with --overwrite=false, you can avoid uploading the program and execute them must faster.
5. supports for TCP, UDP and MULTICAST.
6. supports test for connection, writing and reading for TCP and UDP.
7. all tests are run concurrently using goroutines. After all network tests are I/O bound and require async
   execution.

   i) files will be transferred concurrently.

   ii) individual tests will be performed concurrently.

### Basic connectivity from local machine

```
~/go/bin/testnetwork --file rules.csv
Description  HostName             Source               Target               Protocol     Status
-------------------------------------------------------------------------------------------------------
ROW5         da09.ln.lan          localhost            google.com:80        TCP          OK
ROW6         da09.ln.lan          localhost            google.com:443       TCP          OK
ROW7         da09.ln.lan          localhost            <IP_ADDRESS>:53           UDP          OK
ROW8         da09.ln.lan          localhost            <IP_ADDRESS>:53           UDP          OK
```

### Testing from multiple machines

this is the most important part of this code. this program replicates itself to any number of source machines, runs
itself on source machine and reports the result back to your terminal. You have the option to disable overwrite flag to
run it faster. Disabling --overwrite will not copy executable on remote machine, this will save bandwidth and program
will execute faster.

### below command will transfer itself (testnetwork executable) and run rule file on remote machine.

files will be transferred to /tmp directory to avoid overwriting anything important on remote machines. with
--overwrite=false, files will not be transferred provides they have been transferred earlier. this will run tests much
faster.

```
testnetwork --file=rules.csv --remote=true --overwrite=false
running concurrent tests on da03.ln.lan
running concurrent tests on da01.ln.lan
running concurrent tests on da02.ln.lan
Description  HostName             Source               Target               Protocol     Status
-------------------------------------------------------------------------------------------------------
ROW1         da01.ln.lan          da01.ln.lan          google.com:80        TCP          OK
ROW2         da01.ln.lan          da01.ln.lan          google.com:443       TCP          OK
ROW3         da01.ln.lan          da01.ln.lan          <IP_ADDRESS>:53           UDP          WRITE OK / READ FAILED read udp <IP_ADDRESS>:49418-><IP_ADDRESS>:53: i/o timeout
ROW4         da01.ln.lan          da01.ln.lan          <IP_ADDRESS>:53           UDP          WRITE OK / READ FAILED read udp <IP_ADDRESS>:58774-><IP_ADDRESS>:53: i/o timeout
ROW5         da01.ln.lan          localhost            google.com:80        TCP          OK
ROW6         da01.ln.lan          localhost            google.com:443       TCP          OK
ROW7         da01.ln.lan          localhost            <IP_ADDRESS>:53           UDP          WRITE OK / READ FAILED read udp <IP_ADDRESS>:56054-><IP_ADDRESS>:53: i/o timeout
ROW8         da01.ln.lan          localhost            <IP_ADDRESS>:53           UDP          WRITE OK / READ FAILED read udp <IP_ADDRESS>:35074-><IP_ADDRESS>:53: i/o timeout
ROW9         da01.ln.lan          localhost            localhost:12001      TCP          FAILED: dial tcp <IP_ADDRESS>:12001: connect: connection refused
ROW10        da01.ln.lan          localhost            localhost:12002      UDP          WRITE OK / READ FAILED read udp <IP_ADDRESS>:35296-><IP_ADDRESS>:12002: read: connection refused
ROW11        da01.ln.lan          localhost            <IP_ADDRESS>:12003      MULTICAST    FAILED: read udp <IP_ADDRESS>:12003: raw-read udp <IP_ADDRESS>:12003: i/o timeout

Description  HostName             Source               Target               Protocol     Status
-------------------------------------------------------------------------------------------------------
ROW1         da03.ln.lan          da03.ln.lan          google.com:80        TCP          OK
ROW2         da03.ln.lan          da03.ln.lan          google.com:443       TCP          OK
ROW3         da03.ln.lan          da03.ln.lan          <IP_ADDRESS>:53           UDP          WRITE OK / READ FAILED read udp <IP_ADDRESS>:47128-><IP_ADDRESS>:53: i/o timeout
ROW4         da03.ln.lan          da03.ln.lan          <IP_ADDRESS>:53           UDP          WRITE OK / READ FAILED read udp <IP_ADDRESS>:50947-><IP_ADDRESS>:53: i/o timeout
ROW5         da03.ln.lan          localhost            google.com:80        TCP          OK
ROW6         da03.ln.lan          localhost            google.com:443       TCP          OK
ROW7         da03.ln.lan          localhost            <IP_ADDRESS>:53           UDP          WRITE OK / READ FAILED read udp <IP_ADDRESS>:36886-><IP_ADDRESS>:53: i/o timeout
ROW8         da03.ln.lan          localhost            <IP_ADDRESS>:53           UDP          WRITE OK / READ FAILED read udp <IP_ADDRESS>:33619-><IP_ADDRESS>:53: i/o timeout
ROW9         da03.ln.lan          localhost            localhost:12001      TCP          FAILED: dial tcp <IP_ADDRESS>:12001: connect: connection refused
ROW10        da03.ln.lan          localhost            localhost:12002      UDP          WRITE OK / READ FAILED read udp <IP_ADDRESS>:33028-><IP_ADDRESS>:12002: read: connection refused
ROW11        da03.ln.lan          localhost            <IP_ADDRESS>:12003      MULTICAST    FAILED: read udp <IP_ADDRESS>:12003: raw-read udp <IP_ADDRESS>:12003: i/o timeout

Description  HostName             Source               Target               Protocol     Status
-------------------------------------------------------------------------------------------------------
ROW1         da02.ln.lan          da02.ln.lan          google.com:80        TCP          OK
ROW2         da02.ln.lan          da02.ln.lan          google.com:443       TCP          OK
ROW3         da02.ln.lan          da02.ln.lan          <IP_ADDRESS>:53           UDP          WRITE OK / READ FAILED read udp <IP_ADDRESS>:42778-><IP_ADDRESS>:53: i/o timeout
ROW4         da02.ln.lan          da02.ln.lan          <IP_ADDRESS>:53           UDP          WRITE OK / READ FAILED read udp <IP_ADDRESS>:43709-><IP_ADDRESS>:53: i/o timeout
ROW5         da02.ln.lan          localhost            google.com:80        TCP          OK
ROW6         da02.ln.lan          localhost            google.com:443       TCP          OK
ROW7         da02.ln.lan          localhost            <IP_ADDRESS>:53           UDP          WRITE OK / READ FAILED read udp <IP_ADDRESS>:36879-><IP_ADDRESS>:53: i/o timeout
ROW8         da02.ln.lan          localhost            <IP_ADDRESS>:53           UDP          WRITE OK / READ FAILED read udp <IP_ADDRESS>:34168-><IP_ADDRESS>:53: i/o timeout
ROW9         da02.ln.lan          localhost            localhost:12001      TCP          FAILED: dial tcp <IP_ADDRESS>:12001: connect: connection refused
ROW10        da02.ln.lan          localhost            localhost:12002      UDP          WRITE OK / READ FAILED read udp <IP_ADDRESS>:47657-><IP_ADDRESS>:12002: read: connection refused
ROW11        da02.ln.lan          localhost            <IP_ADDRESS>:12003      MULTICAST    FAILED: read udp <IP_ADDRESS>:12003: raw-read udp <IP_ADDRESS>:12003: i/o timeout

```


text:
---
layout: default
---

# 1997-01-20 - Re: Slow Cypherpunk Day

## Header Data

From: Declan McCullagh<EMAIL_ADDRESS>To: Robert Hettinga<EMAIL_ADDRESS>Message Hash: d2000ddcc02b2c8b3b4c5dec98e41c363890cbd489b1a99a1af08a587522efb4

Message ID<EMAIL_ADDRESS>Reply To<EMAIL_ADDRESS>UTC Datetime: 1997-01-20 23:24:30 UTC

Raw Date: Mon, 20 Jan 1997 15:24:30 -0800 (PST)

## Raw message

```
{% raw  %}From: Declan McCullagh<EMAIL_ADDRESS>Date: Mon, 20 Jan 1997 15:24:30 -0800 (PST)
To: Robert Hettinga<EMAIL_ADDRESS>Subject: Re: Slow Cypherpunk Day
In-Reply-To<EMAIL_ADDRESS>Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

Interesting. I predict it won't be long before Sandy starts using Approved:
headers...

-Declan

Robert Hettinga wrote:

>At 12:04 pm -0500 1/20/97, Mike Duvos wrote:
>>Is<EMAIL_ADDRESS>where articles should be sent
>>to bypass the censors?
>
>Only until they figure out to set it to receive mail from Sandy only.
>(Don't forget to use the "Received" headers to avoid spoofing, Mr. G.)

-------------------------
The Netly News Network
http://netlynews.com/

{% endraw %}
```

## Thread

+ Return to [January 1997](/archive/1997/01)

+ Return to "[Declan McCullagh <declan@pathfinder.com>](/authors/declan_mccullagh_declan_at_pathfinder_com_)"
+ Return to<EMAIL_ADDRESS>(Igor Chudov @ home)](/authors/ichudov_at_algebra_com_igor_chudov__at__home_)"
+ Return to<EMAIL_ADDRESS>(Mike Duvos)](/authors/mpd_at_netcom_com_mike_duvos_)"
+ Return to "[Robert Hettinga <rah@shipwright.com>](/authors/robert_hettinga_rah_at_shipwright_com_)"

+ 1997-01-20 (Mon, 20 Jan 1997 09:04:25 -0800 (PST)) - [Slow Cypherpunk Day](/archive/1997/01/b015ff53b2f3bd07fa7140b5c955cba74a3769e8cb32e4518cb640e83fdf2747) -<EMAIL_ADDRESS>(Mike Duvos)_
  + 1997-01-20 (Mon, 20 Jan 1997 13:58:50 -0800 (PST)) - [Re: Slow Cypherpunk Day](/archive/1997/01/34a71d5c033d4bf8e210d730602638f9bf022dd2463399c28b104dce12498fba) - _Robert Hettinga<EMAIL_ADDRESS>  + 1997-01-20 (Mon, 20 Jan 1997 14:34:55 -0800 (PST)) - [Re: Slow Cypherpunk Day](/archive/1997/01/00eca5dc20883f192c75feff09ef5fda9d2ae6e8980465cbc390f68aff9f9e75) -<EMAIL_ADDRESS>(Igor Chudov @ home)_
  + 1997-01-20 (Mon, 20 Jan 1997 15:24:30 -0800 (PST)) - Re: Slow Cypherpunk Day - _Declan McCullagh<EMAIL_ADDRESS>

license: MIT

branch_name: refs/heads/master

extension: md

gha_license_id: MIT

license_type: permissive


text:
# Object life time

Object lifetime in stack is till the scope only, once we go out.

# Smart Pointers

When we allocate memory on heap then we have to manullay delete that, so smart pointers are the way to automate that process.

When we call new , we dont have to call delete.

1. unique pointer = this is a scope ppointer, when it goes out of scope it dets destroyed.
   We cant copy a unique pointer, it can be only unique;

```c++
 #include <iostream>

class Entity {
public:

    Entity()
    {
        std::cout<<"Created"<<std::endl;
    }
    ~Entity()
    {
        std::cout << "Destroyed" << std::endl;
    }
};

int main()
{
    {
        std::unique_ptr<Entity> entity(new Entity()); //one way to make unique pointer
        std::unique_ptr<Entity> entity2 = std::make_unique<Entity>(); //this is just to handle exception
    }
    std::cout << "Hello World!\n";
    return 0;
}
```

2. Shared pointer - when all shared pointer die then only the memory is freed;
   Shared pinter create another block of memory where it stores the reference count, i.e how many pointer is pointing to that location

```c++
#include <iostream>

class Entity {
public:

    Entity()
    {
        std::cout<<"Created"<<std::endl;
    }
    ~Entity()
    {
        std::cout << "Destroyed" << std::endl;
    }
};

int main()
{
    {
        std::shared_ptr<Entity> e0;
      {

        std::shared_ptr<Entity> sharedEntity = std::make_shared<Entity>();
        e0 = sharedEntity;
       }
      std::cout << "Leaving second scope" << std::endl;
    }

    return 0;
}
```

Here we can see that if we leave the inner scope the pointer dosent die but once we leave the outer scope the pointer dies as all the shared pointer has been deleted now;

3. weat pointer : it same as shared pointer , but once we define a shared pointer and then make weak pointer poin to that then the pointer count is not inceremented. The weak pointer is just kept as a normal.

```c++
#include <iostream>

class Entity {
public:

    Entity()
    {
        std::cout<<"Created"<<std::endl;
    }
    ~Entity()
    {
        std::cout << "Destroyed" << std::endl;
    }
};

int main()
{
    {
        std::weak_ptr<Entity> e0;
      {

        std::shared_ptr<Entity> sharedEntity = std::make_shared<Entity>();
        e0 = sharedEntity;
       }
      std::cout << "Leaving second scope" << std::endl;
    }

    return 0;
}
```

here the pointer is destroyed once we exit the first scope only;

We should always use smart pointers as they automate our memory management;

Shared pointer gets overhead with the count thing but it should be use whenever we can use.

repository: Arslan-Z/cplusplusCHERNO

repo_name: Arslan-Z/cplusplusCHERNO


text:
# Cloneable.js

Make specific HTMLElement cloneable via user interface e.g. `<button>` element, or clone programmatically via JavaScript API.

# TODO:

# Improvements:

- [ ] Change option name from `maxCloneable` to just `max`
- ~~[x] Remove button disability mechanism. If one prefers to disable button when number of cloned elements reach its maximum number allowed, use `uncloneable` event to disable it manually.~~
- [ ] Try changing from using `class` to `function` to decrease bundle size.
- [ ] Allow user to set default classname of the created elements e.g. `.tray`, `.controllers`, `.clone-btn`, or `.remove-btn`.

# Installation

## NPM

```shell
npm i @nawawishkid/cloneable
```

## CDN

On npm: [https://cdn.jsdelivr.net/npm/@nawawishkid/cloneable@latest/dist/cloneable.min.js](https://cdn.jsdelivr.net/npm/<EMAIL_ADDRESS>
On GitHub: [https://cdn.jsdelivr.net/gh/nawawishkid/cloneable.js<EMAIL_ADDRESS>
# NPM Scripts

- `build` -- Build (bundle) this library.
- `test` -- Run test suite.

# Quick start

In your `index.html`:

```html
<div id="cloneable-container"><p>Clone me!</p></div>

<script src="src/index.js"></script>
```

In your `src/index.js`:

```javascript
// For NPM only
// import Cloneable from<EMAIL_ADDRESS>
const container = document.getElementById("cloneable-container");
const cloneable = new Cloneable(container);

cloneable.init();
```

Now the `#cloneable-container` will be like:

```html
<div id="cloneable-container">
  <div class="tray">
    <p>Clone me!</p>
    <div class="cloned" data-cloned-id="1">
      <p>Clone me!</p>
      <button class="remove-btn">Remove</button>
    </div>
  </div>
  <div class="controllers"><button class="clone-btn">Clone</button></div>
</div>
```

Now, you can click `.clone-btn` button to clone `<p>Clone me!</p>` or clicking `.remove-btn` button to remove cloned element.

# API

## Types

### `CloneableEvents`

Object of events that `Cloneable` accepts.

| name                | type         | default          | isRequired | explanation                                                                 |
| ------------------- | ------------ | ---------------- | ---------- | --------------------------------------------------------------------------- |
| `load`              | `function[]` | `[]` Empty array | `false`    | Array of event listeners (callback function) for `load` event               |
| `beforeStateChange` | `function[]` | `[]` Empty array | `false`    | Array of event listeners (callback functions) for `beforeStateChange` event |
| `afterStateChange`  | `function[]` | `[]` Empty array | `false`    | Array of event listeners (callback functions) for `afterStateChange` event  |
| `uncloneable`       | `function[]` | `[]` Empty array | `false`    | Array of event listeners (callback functions) for `uncloneable` event       |

### `CloneableOptions`

Object of options for `Cloneable` instance.

| name           | type              | default           | isRequired | explanation                                                                       |
| -------------- | ----------------- | ----------------- | ---------- | --------------------------------------------------------------------------------- |
| `maxCloneable` | `number`          | `Infinity`        | `false`    | Maximum number of cloned element                                                  |
| `isAppend`     | `bool`            | `true`            | `false`    | Whether the cloned element will be append or prepend to the source element        |
| `cloneButton`  | `HTMLElement`     | `null`            | `false`    | `HTMLElement` to be used as clone button                                          |
| `removeButton` | `HTMLElement`     | `null`            | `false`    | `HTMLElement` to be cloned and then used as remove button for each cloned element |
| `middlewares`  | `function[]`      | `[]` Empty array  | `false`    | Array of callback functions to be called with cloned element as an argument       |
| `events`       | `CloneableEvents` | `{}` Empty object | `false`    | `CloneableEvents` object                                                          |

---

## Instantiation

### `Cloneable(HTMLElement container, CloneableOptions options = {})`

Instantiate cloneable object.

#### Parameters

| name        | type               | default           | isRequired | explanation                                                    |
| ----------- | ------------------ | ----------------- | ---------- | -------------------------------------------------------------- |
| `container` | `HTMLElement`      | `undefined`       | `true`     | Any `HTMLElement` that its `firstElementChild` will be cloned. |
| `options`   | `CloneableOptions` | `{}` Empty object | `false`    | `CloneableOptions` object                                      |

#### Example

```javascript
const options = {
  maxCloneable: 10,
  isAppend: false,
  cloneButton: document.querySelector(".my-clone-button"),
  removeButton: document.querySelector(".my-remove-button")
};
const container = document.getElementById("cloneable-container");
const cloneable = new Cloneable(container, options);
```

---

## Properties

| key           | type               | explanation                                                                               |
| ------------- | ------------------ | ----------------------------------------------------------------------------------------- |
| `container`   | `HTMLElement`      | Container element.                                                                        |
| `middlewares` | `array`            | Array of registered middlewares.                                                          |
| `cloneButton` | `HTMLElement`      | Clone button element. An element, e.g. HTMLButtonElement, for triggering element cloning. |
| `options`     | `CloneableOptions` | `CloneableOptions` object of current `Cloneable` instance.                                |
| `events`      | `CloneableEvents`  | `CloneableEvents` object of current `Cloneable` instance.                                 |

---

## Methods

### `Cloneable.init()`

Initialize manipulation of given container element.

> **Note:** You can't clone element without calling this method first.

This method will:

1. Create `.tray` element.
2. Move `firstElementChild` of the given container (the source element to be cloned) to the `.tray` element.
3. Create `.controllers` element.
4. Get/create `.clone-btn` button then append to the `.controllers` element.
5. Append the `.tray` and `.controllers` elements to the given container.

#### Return

`this`

#### Example

```javascript
// Nothing in document changes at this point
const cloneable = new Cloneable(container);

// DOM manipulated! Ready to clone element.
cloneable.init();
```

---

### `Cloneable.clone()`

Clone the element programmatically.

Clone the element, wrap it with wrapper element, then inject them into the given container element. The wrapper element has been assigned `data-cloned-id` attribute so that it can be refered to later e.g. used by `Cloneable.removeClonedElement()` method.

#### Return

`this`

---

### `Cloneable.removeClonedElement(Number id)`

Remove the cloned element programmatically.

Remove cloned element with specified ID. Cloned element ID is a sequential number of cloning order. The first cloned element's ID is 1, the second is 2, and so on.

This method will find element using `Cloneable.tray.querySelector('[data-cloned-id="${id}"]')` then remove it.

#### Parameters

| name | type     | default     | isRequired | explanation                        |
| ---- | -------- | ----------- | ---------- | ---------------------------------- |
| `id` | `number` | `undefined` | `true`     | ID of cloned element to be removed |

#### Return

`this`

#### Example

```javascript
const cloneable = new Cloneable(container);

// Clone element 2 times. Now, we have 2 cloned elements.
cloneable
  .init()
  .clone()
  .clone();

// Remove first cloned element. Now, there is only 1 cloned element.
cloneable.removeClonedElement(1);
```

---

### `Cloneable.middleware(...callbacks)`

Register middleware function to be called with cloned element as an argument. Use to alter the cloned element.
This method accepts argument list.

#### Parameters

| name       | type       | default     | isRequired | explanation                                                                                |
| ---------- | ---------- | ----------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `callback` | `function` | `undefined` | `true`     | Middleware function which accepts the cloned element as the first argument and cloned element's index or ID as a second argument |

#### Return

`this`

#### Example

Change `textContent` of the cloned element.

```javascript
const cloneable = new Cloneable(container);

cloneable
  .middleware((cloned, index) => {
    cloned.textContent = `Cloned #${index}`;

    return cloned;
  })
  .init();
```

---

### `Cloneable.on(String eventName, ...eventListener)`

Add event listener to the `Cloneable` object. Similar to Node.js `EventEmitter` class.

This method accepts argument list.

#### Parameters

| name            | type       | default     | isRequired | explanation                                                     |
| --------------- | ---------- | ----------- | ---------- | --------------------------------------------------------------- |
| `eventName`     | `string`   | `undefined` | `true`     | Event name. See available event at `CloneableEvents`.           |
| `eventListener` | `function` | `undefined` | `true`     | Event listener callback function to be called on event occurred |

#### Return

`this`

#### Example

```javascript
const cloneable = new Cloneable(container);

cloneable.on("beforeStateChange", () => {
  console.log("State is gonna change!");
});

cloneable.init();
```

---

### `Cloneable.isCloneable()`

Check if it's still cloneable.

#### Return

| type   | value   | when                                                                       |
| ------ | ------- | -------------------------------------------------------------------------- |
| `bool` | `true`  | Number of cloned elements is less than `maxCloneable` value                |
| `bool` | `false` | Number of cloned elements is greater than or equal to `maxCloneable` value |

#### Example

```javascript
const cloneable = new Cloneable(container, { maxCloneable: 2 });

cloneable.init();
cloneable.clone().isCloneable(); // -> true
cloneable.clone().isCloneable(); // -> false
```

---


text:
# flux2-kustomize-gitops-demo

GitOps demo with Flux2 and Kustomize

## Dependencies

Install gnupg and SOPS.

## Bootstrap staging cluster

The bootstrap process has some manual steps:

* install `istioctl` binary
* install Istio Operator (using `istioctl` binary)
* install `flux` binary
* bootstrap Flux

After the manual steps the cluster uses GitOps.

### Install `istioctl` binary

check [this](https://istio.io/latest/docs/ops/diagnostic-tools/istioctl/) for more info.

```bash
curl -sL https://istio.io/downloadIstioctl | sh -
sudo cp .istioctl/bin/istioctl /usr/local/bin
```

### Install Istio Operator

check [this](https://istio.io/latest/docs/setup/install/operator/) for more info.

```bash
istioctl operator init
```

### Install `flux` binary

```bash
curl -s https://toolkit.fluxcd.io/install.sh | sudo bash
```

### `flux` bootstrap

```bash
export GITHUB_TOKEN=<your token>
export GITHUB_USER=<your username>
export GITHUB_REPO=<your repository>
```

pre-flight check

```bash
flux check --pre
```

**NOTE:** If you have any previously created secret for `sops` you should apply it now.

bootstrap cluster

```bash
flux bootstrap github \
    --owner=${GITHUB_USER} \
    --repository=${GITHUB_REPO} \
    --branch=main \
    --personal \
    --path=clusters/staging
```

watch Helm releases installation

```bash
watch flux get helmreleases --all-namespaces
```

watch flux reconciliation

```bash
watch flux get kustomizations
```

### Mozilla SOPS

Check [this](https://toolkit.fluxcd.io/guides/mozilla-sops/) to create the GPG key and the `sops-gpg` secret.

After creating you can encrypt secrets, on the `sops-secrets` folder using the pub key.

## Observability and Istio Mesh

For now the observability namespace is outside Istio Mesh since there are some
issues like:

* alermanager service monitor not showing
* thanos querier without stores
* prometheus operator jobs don't complete because sidecar doesn't exit [(check here)](https://medium.com/redbox-techblog/handling-istio-sidecars-in-kubernetes-jobs-c392661c4af7)

To put everything on the mesh uncomment the lines from:

* observability/staging/namespace.yaml
* observability/staging/kube-prometheus-stack-values.yaml

More info [here](https://istio.io/latest/docs/ops/integrations/prometheus/)

### Workarounds

Patch AdmissionWebhooks for Prometheus Operator are Job:, and since Jobs don't
finish because of istio-proxy we can add the following annotations:

```yaml
  values:
    prometheusOperator:
      admissionWebhooks:
        patch:
          podAnnotations:
            sidecar.istio.io/inject: "false"
```

To get Thanos Query DNS Stores working we need to add listenLocal on Prometheus:

```yaml
  values:
    prometheus:
      prometheusSpec:
        listenLocal: true
        thanos:
          baseImage: quay.io/thanos/thanos
          version: v0.19.0
          listenLocal: true
```

To scrape alertmanager add listenLocal:

```yaml
  values:
    alertmanager:
      alertmanagerSpec:
        listenLocal: true
```

you can use mTLS:

```yaml
  values:
    alertmanager:
      serviceMonitor:
        scheme: "https"
        tlsConfig:
          caFile: /etc/prom-certs/root-cert.pem
          certFile: /etc/prom-certs/cert-chain.pem
          keyFile: /etc/prom-certs/key.pem
          insecureSkipVerify: true
```

## Create AlertManager Config Secret

To create AlertManager configuration secret create a YAML file (`/tmp/alertmanager.yaml`) with the contents:

```yaml
alertmanager:
  config:
    global:
      slack_api_url: '<slack_webhook_url>'
      resolve_timeout: 5m
    route:
      group_by: ['job']
      group_wait: 30s
      group_interval: 5m
      repeat_interval: 12h
      receiver: 'slack'
      routes:
      - match:
          alertname: Watchdog
        receiver: 'null'
    receivers:
    - name: 'null'
    - name: 'slack'
      slack_configs:
      - channel: '#notifications'
        send_resolved: true
    templates:
    - '/etc/alertmanager/config/*.tmpl'
```

**Note:** Replace <slack_webhook_url> with the Slack URL

then create the secret (on the `sops-secrets` folder):

```bash
kubectl -n observability create secret generic alertmanager \
  --from-file=values.yaml=/tmp/alertmanager.yaml \
  --dry-run=client -o yaml > alertmanager.yaml
```

and finally encrypt the secret:

```bash
sops --encrypt --in-place alertmanager.yaml
```

## Connecting to Virtual Services

To check the External IP for the Istio Ingress Gateway use:

```bash
kubectl get svc istio-ingressgateway -n istio-system
```

After checking the IP you need to add some entries on your hosts file.

Example using IP <IP_ADDRESS> (from the MetalLB Production pool):

```bash
<IP_ADDRESS> prometheus.demo.lab
<IP_ADDRESS> thanos.demo.lab
<IP_ADDRESS> grafana.demo.lab
<IP_ADDRESS> alertmanager.demo.lab
<IP_ADDRESS> tracing.demo.lab
<IP_ADDRESS> bookinfo.demo.lab
```

You can now connect to the Web interface using those addresses.

**NOTE:** Since the TLS certificates are self-signed your browser will complaint.

## References

* [Mozilla SOPS](https://toolkit.fluxcd.io/guides/mozilla-sops/#gitops-workflow)
* [Istio Operator](https://istio.io/latest/docs/setup/install/operator/)
* [Flux GitOps Toolkit](https://toolkit.fluxcd.io/)
* [Istio / Prometheus](https://istio.io/latest/docs/ops/integrations/prometheus/)
* [Envoy Access Logs](https://istio.io/latest/docs/tasks/observability/logs/access-log/)
* [Prometheus Community charts](https://github.com/prometheus-community/helm-charts)
* [Grafana Community charts](https://github.com/grafana/helm-charts)
* [Bitnami charts](https://github.com/bitnami/charts)

branch_name: refs/heads/main


text:
# Updating CoreCLR Tests Zip

The set of CoreCLR tests run as part of CoreRT's CI and available via `tests\runtest.cmd /coreclr` download are downloaded as a zip file from the CoreCLR build. We use a specific build number to ensure we're running against a set of tests known to be compatible with CoreRT. Rolling forward to a new set of tests involves these steps:

1. Find a known good tests.zip from the CoreCLR build
   1. Go to https://github.com/dotnet/runtime/pulls and open the most-recently passing PR (it should have a green check mark next to it)
   2. In the CI checks, open the details for `Windows_NT x64 Debug Build and Test`
   3. Navigate through `Build Artifacts` -> `bin` -> `tests`
   4. Copy the URL to `tests.zip` (**TODO: Zip archive no longer built, has to be retooled at https://github.com/dotnet/runtime side**)
2. Retain the CI build so Jenkins doesn't delete `tests.zip`
   1. In the PR job page (where you clicked `Build Artifacts` earlier) ensure you're logged in to Jenkins
   2. Click the `Keep this build forever` button at the top-right
3. Paste the `tests.zip` URL into `CoreCLRTestsURL.txt`
4. Check your work by building and then running `tests\runtest.cmd /coreclr`

repository: MichalStrehovsky/corert

gha_language: C#

gha_license_id: NOASSERTION

repo_name: MichalStrehovsky/corert


text:
### Summary

Gets the Octopus Server thumbprint. Admin access in the Octopus instance will be needed for this to work
### Syntax
``` powershell

```

### Examples

**EXAMPLE 1**

Gets the thumbprint of the Octopus Server

``` powershell
 Get-OctopusServerThumbprint
```

repository: mhenderson-so/OctoPosh

repo_name: mhenderson-so/OctoPosh


text:
# Medical_Localization_RL
Prostate lesion localization with Reinforcement Learning on Medical Images (HKU IRIS group)

This is a work in progress research work focusing on localization of structures like lesions and lung capacities on MRI and X-ray images (The code is currently not up-to-date, latest code will be provided once results become published)

# Illustration with Prostate-X dataset
![prostate_ex_1](ProstateX_0012_infer.gif) ![prostate_ex_2](ProstateX_0177_infer.gif)

gha_language: Python


text:
---
uid: crmscript_ref_NSOutgoingMessage_GetTo
title: String GetTo()
intellisense: NSOutgoingMessage.GetTo
keywords: NSOutgoingMessage, GetTo
so.topic: reference
---

# String GetTo()

Address of the recipient. This can be in the form of phone number or email.

**Returns:** String

```crmscript
NSOutgoingMessage thing;
String to  = thing.GetTo();
```

repository: stianol/crmscript

repo_name: stianol/crmscript


text:
# Mini-Game Solvers

I often play games, when I have some free time. These games are often simple, but as a programmer, I often start thinking about it in terms of rules and how to solve it all. It's inspiration and need to relax a bit differently, that drives me to write these solvers.
I will try to use only C++11, so they should be compilable under different OS, but I use linux and g++, so you probably need to create a new project from source under Windows (Visual Studio).

## Sudoku

Simple solver for sudoku game. If I get back to it again, I'll try different method and maybe compare them in terms of speed.
Method: Backtracking

## BlockSolver - WIP

Solver for a game, where goal is to fit a set of blocks into a space. Game space is in format of uniform integer grid.
Method: Backtracking/Space Search

Program is a bit older, I'm not entirely sure about the input file or intended usage.

repository: Enzirr/MinigameSolvers

repo_name: Enzirr/MinigameSolvers


text:
# NiT Board Meeting 6/11/2020

### Agenda

### Attendance

* Adam
* Nick
* Coty

### Action Items from Previous Meeting

* Adam
    * Continue working with OKCU to get the account setup
    * ~~Modifying alert email for nativesintech.org so that it uses a different domain in case of DNS issues~~
        * Netlify has Adam’s backup
    * Work with Erin on setting up a password manager
* Erin
    * ~~Update by-laws so that submitter is an implicit approver~~
    * Think out a spec for how the process should work, specifically for the case where there’s disagreement.
    * Review bylaws and propose a method for making our initial changes including where we can keep our minutes :)
* Coty
    * ~~Create a template for the meeting notes to use until we develop a process for them~~
    * For virtual hangout, look into creating a group (email alias) and having people sign up. After that, create an invite with Google Meet.
        * I didn’t get to this. Moving to next meeting.
* Nick
    * ~~Find a date for sessionize crash course~~
        * ~~https://zvite.co/i/yJ3KrBf9~~
    * Buy domain for bynatives.io
        * Asked if this is the TLD we want to use
    * Push nativeownedbusiness UI  to netlify

### Updates

* Adam
    * I talked with Ben Trevino with Code for America and we are looking to do a partnership with them at some point. We will continue to talk about what we need to do going forward
    * I am going to look and see where we can get funding so we can hire an executive director, will look for a grant writer to start doing all this. We need to start a doc with what we’re expecting of them so that we can all contribute and then find someone to fit the need.
    * I have played around with updating the NiT website, fixed up the awesome 2.0 page but still need to add more pages such as donation page, conference home page, and conference by year page. It’s nearly done but just needs some more polish
    * Added the NiT blog which is hosted on Ghost CMS (Thanks to Nick)
    * Trying to get a medallion
    * We made a statement on BLM, could also make an announcement on the website as well
    * Tested out sessionize
* Nick
    * Give sessionize crash course
    * Buy domain for bynatives.io !
    * Push nativeownedbusiness UI  to netlify
* Coty
    * We’ve decided to use Markdown and submit minutes to be accepted via PRs, so will start doing that. We will use a Google Doc for collaborative editing during the meeting and then convert to markdown and submit.
    * Looking for a Native person to do some website maintenance/facelift work on trianglenative.org. We have a grant to pay someone, so looking for interested parties to submit. I was supposed to be working on it, but it’s been difficult to get feedback, etc. and there’s no pressure from them nor am I getting paid for it so it’s taking a back seat.

### Meetings Notes

### Action Items

* Adam
    * Continue working with OKCCU to get the account setup
    * Continue to push forward NiT 2.0
    * Look for a grant writer
    * Propose themes for next NiT Conf
    * Review Erin’s RRO [proposal](https://github.com/nativesintech/nonprofit-governance/pull/4)
* Nick
    * Review Erin’s RRO [proposal](https://github.com/nativesintech/nonprofit-governance/pull/4)
* Coty
    * Think about and come up with some ideas for adding nonprofit organizational information to the website
    * For virtual hangout, look into creating a group (email alias) and having people sign up. Then after that, create an invite with Google Meet.
    * Review Erin’s RRO [proposal](https://github.com/nativesintech/nonprofit-governance/pull/4)

repository: nativesintech/nonprofit-governance

repo_name: nativesintech/nonprofit-governance


text:
## rework-parent [![Build Status](https://travis-ci.org/fgnass/rework-parent.png)](https://travis-ci.org/fgnass/rework-parent)

[Rework](https://github.com/visionmedia/rework) plugin that adds support for
a SASS-like parent selector. Since in plain CSS rules can't be nested, the `&`
simply refers to the previous selector:

### Example

```css
.foo {
  color: black;
}
&:hover {
  color: blue;
}
&:visited {
  color: pink;
}
```

Yields:

```css
.foo {
  color: black;
}
.foo:hover {
  color: blue;
}
.foo:visited {
  color: pink;
}
```

Both `:hover` and `:visited` refer to the `.foo` selector because it doesn't
contain any ampersand. Sometimes this is not what you want. If you want to
reference a preceding selector that itself contains _n_ ampersands you can
use _n+1_ `&` chars to refer to it:

```css
.red {
  color: red;
}
&.bold {
  font-weight: bold;
}
&&:hover {
  color: blue;
}
.disabled & {
  background: silver;
}
```

This yields:

```css
.red {
  color: red;
}
.red.bold {
  font-weight: bold;
}
.red.bold:hover {
  color: blue;
}
.disabled .red {
  background: silver;
}
```

### Usage

```js
  var rework = require('rework');
  var parent = require('rework-parent');

  rework(css).use(parent);
```

### The MIT License (MIT)

Copyright (c) 2013 Felix Gnass

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: fgnass/rework-parent

repo_name: fgnass/rework-parent


text:
---
layout: post
title: The First Version of Terminus in Java
categories: projects terminus
project_id: terminus
project_title: Terminus
---

A first attempt was made in Java. It was pretty decent for a final project for a non-coding class. And it had sweet graphics.

<!-- more -->

#### Before you code: design!

The name of your game can make or break your success. Fortunately, **Terminus** sounds both sufficiently cool and sufficiently related to the word "terminal" that our job in that respect was done. The medium was also a no-brainer: the ideal metaphor is no metaphor at all. For us, because we were teaching terminal commands, it made the most sense for Terminus to be a computer game.

Before starting full-force on the development of the game, factors like the audience, basic mechanics, plot lines, and outstanding features need to be fleshed out to avoid unpleasantness later on.

#### Know the problem

We identified a few main barriers to learning terminal commands that we tried to overcome with game design and aesthetic choices:

* {: .detail-text} The terminal is ugly
* {: .detail-text} Documentation is convoluted, hard to find, and sparse
* {: .detail-text} The terminal is unforgiveable - if you mess up there is no "CTRL-Z"
* {: .detail-text} The immediate benefit of learning terminal commands is not obvious
{: .detail-list}

The choices in mechanics and aesthetics attempt to battle (and in some cases mockingly mimic) these barriers.

#### Know the Audience

Our target audience was high school and early college students. These were people who have use for knowing terminal commands, or are likely to be deciding whether they "get" or "don't get" computers. We wanted to capture and engage the population that would benefit from learning the terminal - either to advance their chosen academic track or to move them towards a technical education.

On one hand, this audience was an easy one, since we knew them well: we were in the same age group. On the other hand, this audience is a fickle one, hard to please and easily distracted. And yet another problem was that we did not exactly fall within our target audience, since most of us were already familiar with using the terminal. We anticipated problems later on for testing, but went ahead with the design process.

#### Game design: mechanics and play

A text-based adventure could only be successful if the gameplay, plot, and activities are engaging enough for the user.

We settled on a basic gameplay that drew analogies between terminal concepts and fantastical experiences:

| **computer** | **abstraction** |
|--:|:--|
| file system | a series of rooms|
| terminal commands | spells|
| the cursor | your position|

And instead of commands like "go north", we used parallels from the computing world to explain the new "spells":

| **command** | **abstraction** |
|--:|:--|
| cd | "**c**hange **d**irection" |
| ls | "**l**ook at your **s**urroundings" |
| grep | a cute sidekick elf |

A huge benefit of the game being themed around magic is that any discrepancies with reality are merely brushed into the voodoo pile. The abstraction of a "spell" alludes to an underlying respect for the systems that you deal with when interacting with the terminal - it sets up the learner to expect to not understand everything at face value.

The game starts immediately with role play: you are a wizard in training, learning the spells of the great masters. You are told you are on a quest to find the `sudo` password, needing to enlist the help of `grep` your elf friend. As you interact with the environment, move through the world, and reach the end of the first level, you are given a series of tasks that force practice of basic commands like `cd`, `ls`, `less`, and `mv`. We identified these four commands has the most important to teach initially, based on merely our own experience. At first our design of the world, challenges, and tasks included practice of an ambitious set of commands, but time constraints forced us to pick a few to focus on. When moving forward, more thought and data gathering needs to be placed on which commands to introduce in order.

The environment itself was designed to be completely safe - you cannot execute arbitrary commands, and there is no possibility in harming the game itself with any mistakes. Unlike a real terminal, Terminus will forgive the user for their mistakes.

#### Game design: aesthetic

Lastly, we decided that the game would benefit from pictures that added to the allure of the game. Retro-pixel-art graphics would add to the gamification, bringing in silly pictures to reward the user when they typed correct commands.

![Screenshot of the opening page of Terminus, the first Java version](/imgs/terminus_java1.png){: .terminus-java1}

The aesthetic was clean and simple: terminal on the left, rewarding picture on the right.

#### Java is the chosen one

I was nearing the end of my sophomore year at MIT when the Terminus project started. At that point, I was not yet a declared computer science major. I had taken 6.01, MIT's introductory computer science class taught in very basic python, but the language I was most familiar with was Java. I had taken it in high school just 2-3 years before, and was taking 6.005, MIT's software development class taught in Java, that semester.

11.127 was not a computer science class (by all MIT standards it was "a humanities class") and therefore deserved the best ratio of excellence to effort. Out of our group of five, it was decided that Shawn and I were going to be the main coders. Because I was less experienced, we chose Java (my then-comfort language) as our language of choice - it would be easiest to code with the least amount of effort.

Absolutely no thought was given to the distribution of the game: we were going for pure ease of finishing. That's how our first version of Terminus ended up as a Java program.

Back in the day before Github became cool, our code repository was hosted on MIT servers as a password-protected SVN repository. I have since uploaded the (decompiled Java) code to Github, but have lost all SVN commits and tags because of coding inexperience.

#### Graphics

Emma was excited about trying graphic design, so she took on the role of lead designer, making all the retro-90s-pixel-graphics for the first Java version of Terminus.

#### Lessons learned

The main takeaway from this design process was that no aspect of the design can be overlooked. We brainstormed and designed the gameplay and aesthetic, but neglected to think about the use case of a deployed version of the game: as a Java app, there is a high barrier to using the game in the first place. We should have approached building this game as a web application from the start. The technical challenges of building the application in Java (and with a time crunch of a final project deadline) were the challenges of novice coders building a system - version control, namespace variables, adequate commenting, and code system design were all issues we ran into that could have been improved for the next time.

Moving forward, don't make Java apps if you want to have your products delivered, and make sure to use git rather than SVN.

In conclusion, the first version of Terminus as a Java application made a beautiful final project for 11.127/CMS.590.


text:
# Probability and Statistics Simulations in R

This repo contains a few random problems from the "Introduction to Probability" text by Joseph Blitzstein. These are meant purely as practice problems.

I strongly discourage looking at the solution unless you have solved the problem yourself. Looking at the solution *will* spoil the problem for you!

repository: havanagrawal/r-simulations

repo_name: havanagrawal/r-simulations


text:
# Acacia Platform

The Acacia platform was built for a non-profit to help other non-profits and missionaries receive donations with ease.

This platform has an admin section and a user section. The admin section can manage the users, manually submit checks for users, accept or deny applicants, edit and create new users.

Users can login and see their donations and edit their own profile like uploading their images and writing a short bio.

## Setup Directions
There are a few things you'll need to setup before getting the site running. The platform uses Stripe, AWS, and Campaign Monitor.

### Stripe

You will need to setup a Stripe account and enable Connect. You'll need to set your Stripe Keys in your .env file:

STRIPE_SECRET=sk_test_
STRIPE_PUBLISHABLE=pk_test_

### Campaign Monitor

Campaign Monitor is a service that sends your emails for you but gives you the ability to design your emails without having to code them. There are several types of emails you'll need to setup.

The follow will need to be created:

* Donation receipts
* Contact form
* Application form
* For the information request at the footer
* Password Resets

Some of these are optional, like the information requests. If you wanted to use Laravel's built in system to send out emails than you can disregard this section and create your own.

The .env file will need these settings:

CAMPAIGN_MONITOR_API_KEY=
CAMPAIGN_MONITOR_CLIENT_ID=

### AWS

AWS will host all your images. This of course is optional.

S3_KEY=
S3_SECRET=
S3_LOCATION=

#### License

The Acacia Platform open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

#### Contributions

I don't have much direction on this but this is available to anyone who's willing to step in and put work into it.

There are a couple of ideas I had. If you wanted to include the stripe fees in the donation that would offset the fees for the missionary giving them more money.

Another idea is to send a monthly email to the missionary with their total donations for the month.

##### Side Note

I have created a supporters section. It's a separate repo. It gives the supporter the ability to log in and see their donations for the year and download a report for their tax filings. If you're interested let me know.

#### Issues

One issue I've seen is that some supporters when donating an exact amount using pennies (like $50.54) it gives and error. Never troubleshooted it but it comes up from time to time.

repository: samueljohnw/acacia

repo_name: samueljohnw/acacia


text:
# TorchObjectDetectionSegmenter

**TorchObjectDetectionSegmenter** is a class that supports object detection and bounding box extraction using PyTorch with Faster R-CNN and Mask R-CNN models.

## Usage

```python
from jina import Flow, Document

f = Flow().add(uses='jinahub+docker://TorchObjectDetectionSegmenter')

with f:
    resp = f.post(on='foo', inputs=Document(), return_results=True)
	print(f'{resp}')
```

### Inputs

`Document` whose `blob` stores the image to be detected with values between 0-1 and has color channel at the last axis.

### Returns

`Document` with `chunks` that contain the original image in `blob`, bounding box coordinates of objects detected in `location`, and image label key value pair in `tags`.

## Reference
- [Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks](https://arxiv.org/abs/1506.01497)
- [Mask R-CNN](https://arxiv.org/abs/1703.06870)
- [TORCHVISION OBJECT DETECTION FINETUNING TUTORIAL](https://pytorch.org/tutorials/intermediate/torchvision_tutorial.html)


text:
# CafePitch
[![Build Status](https://travis-ci.org/joe-re/cafe-pitch.svg?branch=master)](https://travis-ci.org/joe-re/cafe-pitch)

<img height="300" alt="cafe-pitch-logo" src="https://cloud.githubusercontent.com/assets/4954534/15095077/8e43e32e-14f2-11e6-98b4-6124b0e4561d.png"/>

Markdown-driven presentation tool built on Electron.

![](https://cloud.githubusercontent.com/assets/4954534/24092260/87112200-0d90-11e7-8642-e133d5dcffd6.gif)

# Download
You can get executable binary in below link.
- https://github.com/joe-re/cafe-pitch/releases

You can also install it by npm.

```
$ npm install -g cafe-pitch
$ cafepitch
```

# Support
- Live preview
- Presentation mode
- Export PDF
- Emoji notation(ex :tada: :bow: etc..)

# Development

## setup
```
$ npm install
$ npm setup
```

## coding
```
$ npm run build # only build.
$ npm run watch # watch filechanges and run auto build.
$ npm start     # run electron.
```

## testing
```
$ npm run test            # run unit test and e2e test.
$ npm run test:unit       # only run unit test.
$ npm run test:e2e        # only run e2e test.

```

# License

MIT © [joe-re](https://github.com/joe-re)

repository: joe-re/cafe-pitch

gha_language: TypeScript

repo_name: joe-re/cafe-pitch


text:
# WooCommerce integration

You can check out the following video, or head over to [the WooCommerce plugin repository](https://github.com/btcpayserver/woocommerce-plugin).

[![WooCommerce](https://img.youtube.com/vi/tTH3nLoyTcw/mqdefault.jpg)](https://www.youtube.com/watch?v=tTH3nLoyTcw "BTCPay - WooCommerce")

repository: yashbhutwala/btcpayserver-doc

repo_name: yashbhutwala/btcpayserver-doc


text:
# D3 Scatter Plots

I wanted to play around with scatter plots in d3.  So here it is!

![](demo/d3_scatter_plots_demo.gif)

## How to run it

* Clone the repository
* `cd` into that folder
* Start a little server (e.g., `python -m SimpleHTTPServer 8000`)
* Direct your favorite web browser to http://localhost:8000

Have fun watching points zoom around!


text:
# Twitter-Analyser
1.Run the twitter.R script using your keys and secrets first
2.Load the shiny library
3.If you dont have sentiment package you can download it by running the following command
#install_url('http://cran.r-project.org/src/contrib/Archive/sentiment/sentiment_0.2.tar.gz')
4.Make sure to have devtools and installr loaded before installing sentiment
5.run  runApp() on your R console
6.Now You are all set to analyse the sentiment for various topic on twitter

repository: Kcpanda/Twitter-Analyser

repo_name: Kcpanda/Twitter-Analyser


text:
# gideros-examples

Gideros Mobile is free and open sourced and provides the cross-platform technology to create amazing games. In a couple of hours, you’ll find yourself building and running your next great game.

**Visit:** The [Gideros website][gideros] and follow on [Twitter][twitter] (#giderosmobile)

**Learn:** [API Docs][learn] and [Support Forum][forum]

**Be awesome:** [Support][support] the future of Gideros

## License

Gideros is released under the [MIT License](http://opensource.org/licenses/MIT).

Please note that this license does **NOT** cover the graphics or audio files that you will find located in this repository. None of them are to be used in commercial games.

[gideros]: http://giderosmobile.com
[twitter]: https://twitter.com/GiderosMobile
[learn]: https://wiki.giderosmobile.com/index.php/Welcome!
[forum]: http://forum.giderosmobile.com/
[repository]: https://github.com/gideros/gideros
[issues]: https://github.com/gideros/gideros/issues
[support]: http://giderosmobile.com/donate&download

repository: plicatibu/gideros-examples

repo_name: plicatibu/gideros-examples


text:
# E08b-Adding-Tiles

This program allows users to play a game of breakout with rows of colored blocks. The user controls a paddle from left to right that follows their mouse movements while a ball bounces off the walls and paddle, destroying the blocks that it hits.


text:
---
title: "MTU on Nexus switches, CDP and vCenter"
author: 'www.ifconfig.it/hugo'
date: '2014-04-09'
slug: mtu-on-nexus-switches-cdp-and-
link: https://www.ifconfig.it/hugo/post/2014-04-09-nxmtucdp/
categories:
- bloglink
tags:
  - ifconfigithugo
---

Some time ago I've installed the new core switches for a customer: a couple of Nexus 7000, a couple of 5000 and twelve Nexus 2232TM, Virtual port channels, VLANs, Radius auth and so on.. all the usual configs a good network engineer does. Since the Nexus 5000 are connected to an iSCSI storage I've configured Jumbo frames[... <i class="fas fa-external-link-alt"></i>](https://www.ifconfig.it/hugo/post/2014-04-09-nxmtucdp/)

repository: mkearney/data-scribers

repo_name: mkearney/data-scribers


text:
# Address-Picker

Google map address picker and autocomplete for address item plugin used to easily select address.

**A Item plugin for Oracle Application Express**

This plugin allows you to select address or search address using autocomplete functionality from Google Map.

![Preview.gif](https://raw.githubusercontent.com/apex-plugins/Address-Picker/master/Source/Preview.gif)

## DEMO ##

[https://apps.zerointegration.com/demo/f?p=apexplugins:addresspicker](https://apps.zerointegration.com/demo/f?p=apexplugins:addresspicker)

## PRE-REQUISITES ##

* You need a [Google Maps API Key](https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key)

## INSTALLATION ##

1. Download the [latest release](https://github.com/apex-plugins/Address-Picker/releases/latest)
2. Install the plugin to your application - **item_type_plugin_com_zerointegration_addresspicker.sql**
3. Supply your **Google API Key** (Component Settings)
4. Add a item to the page region and specify parameters in settings.

For more info, refer to the [WIKI](https://github.com/apex-plugins/Address-Picker/wiki).

repository: apex-plugins/Address-Picker

repo_name: apex-plugins/Address-Picker


text:
# nicer

[![npm version](https://badge.fury.io/js/nicer.svg)](https://npmjs.org/package/nicer)

`nicer` is An Http _Multipart/Form-Data_ Request Body Parser. It can receive form data fields and files headers and stream their data.

```sh
yarn add nicer
```

Benchmark

|  Library   |     1      |     2      |     3      |
| ---------- | ---------- | ---------- | ---------- |
| dicer      | 137.21mb/s | 100.65mb/s | 165.95mb/s |
| multiparty | 25.78mb/s  | 29.48mb/s  | 29.60mb/s  |
| nicer      | 106.55mb/s | 112.46mb/s | 134.24mb/s |
| nicerc     | 114.42mb/s | 115.04mb/s | 116.57mb/s |

Stable Benchmark (18 Jul)

|  Library   |     Max Speed     |
| ---------- | --------- |
| (1) dicer      | 92.93mb/s |
| (2) nicerc     | 79.95mb/s |
|     nicer      | 72.23mb/s |
| (3) multiparty | 28.79mb/s |

Nicer is comparable to the faster streaming parser, Dicer since the real-world data (uploading 2 fields, 2 text files and 50 photos) is processed at speeds that are close to max 90mb/s. In the benchmark, nicer is the source code of this package, whereas nicerc is the compiled JavaScript optimised Closure Compiler, which probably increases the speed by 5-10%.

## Table Of Contents

* [Stable Benchmark](#stable-benchmark)
- [Table Of Contents](#table-of-contents)
- [API](#api)
- [`constructor(boundary: string): Nicer`](#constructorboundary-string-nicer)
  * [`Nicer`](#type-nicer)
  * [`Part`](#type-part)
- [Errors](#errors)
  * [Extra Buffer](#extra-buffer)
- [Debug](#debug)
- [Copyright](#copyright)

## API

The package is available by importing its default constructor function:

```js
import Nicer from 'nicer'
```

## `constructor(`
  `boundary: string,`
`): Nicer`

Creates a transform that emits objects with a header buffer and the body stream. The body stream is a pass-through so all data must be written as it comes, the request doesn't pause for data to be consumed. The header is a buffer which can be parsed more and/or decrypted, but it does not stream. The assumption is the headers are short therefore a header buffer is accumulated until `\r\n` is found. Just make sure to run behind _NginX_ then it should be alright.

__`Nicer`__: A stream that emits objects with a header buffer and the body PassThrough stream.

|     Name      |      Type       |          Description           |
| ------------- | --------------- | ------------------------------ |
| __boundary*__ | string | The mandatory field separator. |

```js
import { Transform } from 'stream'
import Nicer from 'nicer'

const detected = []

await http.startPlain((req, res) => {
  const boundary = getBoundary(req, res)
  console.log('Boundary detected: %s', boundary)
  req.pipe(new Nicer({ boundary })).pipe(new Transform({
    objectMode: true,
    transform(obj, enc, next) {
      const { header: HEADER, stream: STREAM } = obj

      // to print in sync have to wait for all data
      // since STREAM is a pass-through
      let d = []
      detected.push(['%s\n====\n', HEADER, d])

      STREAM.on('data', (data) => {
        d.push(data)
      })
      next()
    },
    final() {
      res.statusCode = 200
      res.end(JSON.stringify(detected))
    },
  }))
})
```

A new instance of Nicer can be piped into by an http.IncomingMessage stream in the Node.JS server. Then a transform stream must be created to listen for the data emitted by Nicer in object mode.

__`Part`__: A part that gets emitted by _Nicer_.

|    Name     |             Type             |          Description           |
| ----------- | ---------------------------- | ------------------------------ |
| __stream*__ | !stream.PassThrough | The mandatory field separator. |
| __header*__ | !Buffer             | The header found before data.  |

```
Boundary detected: u2KxIV5yF1y+xUspOQCCZopaVgeV6Jxihv35XQJmuTx8X3sh

Content-Disposition: form-data; name="key"
====
 [ 'value' ]

Content-Disposition: form-data; name="alan"
====
 [ 'watts' ]

Content-Disposition: form-data; name="file"; filename="test/fixture/test.txt"
Content-Type: application/octet-stream
====
 [ 'a test file\n' ]
```

The data received by the 'transform' method, contains the { header, stream } properties. The data from the stream must be accumulated.

## Errors

The errors are spawned when the buffer remaining the stream after the `final` event, and processed to extract the rest of the fields, still contains symbols different from -- (`[45,45]`).

Extra Buffer (Source)

```http
-------example
Content-Disposition: form-data; name="key"

data
-------exampleWAT
```

The data remaining after the last boundary detected after the final method is called does not have any meaning and is discarded. This is not the case with parts that arrived before the stream was closed, i.e., the file limit is not implemented.

```fs
Boundary detected: -----example
[!] Error Unexpected end of request body, wanted to see "--" but saw WA.
    Detected Data:

Content-Disposition: form-data; name="key"
====
 [ 'data' ]
```

The parser will always check for the closing -- and emit an error in the end, however the headers and data streams emitted by it, would have been all closed, i.e., the data can still be used.

## Debug

The software can write debug information, when the `DEBUG=nicer` env variable is set.

Debug (Source)

```js
import { Writable } from 'stream'
import Nicer from '../src'

const detected = []

await http.startPlain((req, res) => {
  const boundary = getBoundary(req, res)
  console.log('Boundary detected: %s', boundary)
  const nicer = new Nicer({ boundary })
  const bt = new BufferTransform(50)

  req.pipe(bt).pipe(nicer).pipe(new Writable({
    objectMode: true,
    write(obj, enc, next) {
      const { header: HEADER, stream: STREAM } = obj
      next()
    },
    final() {
      res.statusCode = 200
      res.end(JSON.stringify(detected))
    },
  }))
})
```

The transform method appends data to the left-over buffer (which can usually be small enough to accommodate [--boundary.length-1] symbols) and consumes data. The data is consumed by first trying to find the boundary in the new buffer. If this is possible, then depending on the state of the parser, the data found before the separator is either flushed in an existing data stream, or appended to the existing header, which can then lead to body-flushing.

```sh
nicer 🔍  Staring boundary --u2KxIV5yF1y+x... scan +0ms
  nicer 🔎  Finished boundary scan, buffer of length 50B left, separators found: 0 +2ms
  nicer one consume safe consumed 0B and left 50B +1ms
  nicer <concat-transform> +1ms
  nicer <concat-transform> 100B +0ms
  nicer 🔍  Staring boundary --u2KxIV5yF1y+x... scan +0ms
  nicer   ⭐  Found starting boundary at index 2 +0ms
  nicer 🔎  Finished boundary scan, buffer of length 48B left, separators found: 1 +0ms
  nicer one consume safe consumed 52B and left 48B +1ms
  nicer <concat-transform> +0ms
  nicer <concat-transform> 98B +0ms
  nicer 🔍  Staring boundary --u2KxIV5yF1y+x... scan +0ms
  nicer 🔎  Finished boundary scan, buffer of length 98B left, separators found: 0 +0ms
  nicer one consume safe consumed 46B and left 52B +0ms
  nicer <concat-transform> +0ms
  nicer <concat-transform> 102B +0ms
  nicer 🔍  Staring boundary --u2KxIV5yF1y+x... scan +0ms
  nicer   🔛  Found boundary, data size 7B +0ms
  nicer   🗒  Found header and data of size <53B> +1ms
  nicer      Content-Disposition: form-data; name="key" +0ms
  nicer      value +0ms
  nicer 🔎  Finished boundary scan, buffer of length 43B left, separators found: 1 +2ms
  nicer one consume safe consumed 59B and left 43B +0ms
  nicer <concat-transform> +0ms
  nicer <concat-transform> 93B +0ms
  nicer 🔍  Staring boundary --u2KxIV5yF1y+x... scan +0ms
  nicer 🔎  Finished boundary scan, buffer of length 93B left, separators found: 0 +0ms
  nicer one consume safe consumed 41B and left 52B +0ms
  nicer <concat-transform> +1ms
  nicer <concat-transform> 102B +0ms
  nicer 🔍  Staring boundary --u2KxIV5yF1y+x... scan +0ms
  nicer   🔛  Found boundary, data size 13B +0ms
  nicer   🗒  Found header and data of size <54B> +0ms
  nicer      Content-Disposition: form-data; name="alan" +0ms
  nicer      watts +0ms
  nicer 🔎  Finished boundary scan, buffer of length 37B left, separators found: 1 +0ms
  nicer one consume safe consumed 65B and left 37B +1ms
  nicer <concat-transform> +0ms
  nicer <concat-transform> 87B +0ms
  nicer 🔍  Staring boundary --u2KxIV5yF1y+x... scan +0ms
  nicer 🔎  Finished boundary scan, buffer of length 87B left, separators found: 0 +0ms
  nicer one consume safe consumed 35B and left 52B +0ms
  nicer <concat-transform> +0ms
  nicer <concat-transform> 102B +0ms
  nicer 🔍  Staring boundary --u2KxIV5yF1y+x... scan +11ms
  nicer 🔎  Finished boundary scan, buffer of length 102B left, separators found: 0 +0ms
  nicer       <concat-header> +0ms
  nicer       <concat-header> 85B +1ms
  nicer one consume safe consumed 50B and left 52B +0ms
  nicer <concat-transform> +0ms
  nicer <concat-transform> 102B +0ms
  nicer 🔍  Staring boundary --u2KxIV5yF1y+x... scan +1ms
  nicer   🔛  Found boundary, data size 50B +0ms
  nicer   🗒  Found header and data of size <135B> +0ms
  nicer      Content-Disposition: form-data; name="file"; filename="test/fixture/test.txt" +0ms
  nicer      Content-Type: ap... +0ms
  nicer 🔎  Finished boundary scan, buffer of length 0B left, separators found: 1 +1ms
  nicer one consume safe consumed 102B and left 0B +0ms
  nicer 🔍  Staring boundary --u2KxIV5yF1y+x... scan +0ms
  nicer 🔎  Finished boundary scan, buffer of length 4B left, separators found: 0 +0ms
  nicer one consume safe consumed 0B and left 4B +0ms
  nicer 🔍  Staring boundary --u2KxIV5yF1y+x... scan +2ms
  nicer 🔎  Finished boundary scan, buffer of length 4B left, separators found: 0 +1ms
  nicer one consume safe consumed 0B and left 4B +0ms
```

After knowing what's left after the last found boundary, the Nicer parser takes only the safe amount of data to consume more which equals to the length of the boundary (including prior --), otherwise there might be a partial boundary leaking into the data stream. The remainder is saved as the new buffer, to which the following chunk in the transform method will be appended, and so on.

## Copyright

(c) [Idio][1] 2019

[1]: https://idio.cc

repository: idiocc/nicer

repo_name: idiocc/nicer


text:
---
layout: post
title:      "Sliding Window Pattern"
date:       2020-07-04 15:50:09 +0000
permalink:  sliding_window_pattern
---

I’ve been learning about Problem Solving Patterns while going through Colt Steele’s JavaScript Algorithm and Data Structures class. These patterns make it easier to solve difficult coding problems by using the steps they lay out. One of the patterns that can be used often is the Sliding Window Pattern.

The Sliding Window Pattern is good to use when you have a set of data, like an array, and need to find a subset that is continuous. When you use the Sliding Window Pattern, you create a window, which can either be an array position or number from one position to another. Depending on a certain condition, you can then increase, decrease, or slide the window to create a new window.

An example of a problem that’s a good candidate for this pattern is a function called maxSubarraySum(). maxSubarraySum() accepts an array of integers and a number called n. The function has to calculate the sum of each set of n numbers to check to see which set has the highest sum.

We can compare 2 different ways to solve this problem. First we can use a typical basic solution of using nested loops to iterate through the array to add each group of numbers in the array, put the sum in a temp variable and then check to see if the temp variable is larger than the max that has been found so far. If so, make the max equal to temp. This ends up being a lot of calculations to find the answer.

```
function maxSubarraySum(array, num) {
  if (num > array.length) {
    return null;
  }
  let max = -Infinity;
  for (let i = 0; i < array.length - num + 1; i ++) {
    temp = 0;
    for (let j = 0; j < num; j++) {
      temp += arr[i + j];
    }
    if ( temp > max ) {
      max = temp;
    }
  }
  return max;
}

maxSubarraySum([2,6,9,2,1,8,5,6,3], 3)

Time Complexity-  0(N^2)
```

Our other option is to use the Sliding Window  Pattern. In this example we set up maxSum and tempSum and set to zero. We then set up a for loop and add the first set of numbers and store it in maxSum & tempSum. Then, instead of adding the next 3 numbers together, we take our previous sum in temp sum and subtract the number in the lowest index and add in the number in the next index. This way we don't have to do a nested loop.

```
function maxSubarraySum(array, num) {
  let maxSum = 0;
  let tempSum = 0;

  if (array.length < num) return null;
  for (let i = 0; i < num; i++) {
    maxSum += array[i]
  }
  tempSum = maxSum;
    for (let i = num; i < array.length; i++) {
    tempSum = tempSum - array[i - num] + array[i];
    maxSum = Math.max(maxSum, tempSum);
  }
  return maxSum;
}

maxSubarraySum([2,6,9,2,1,8,5,6,3], 3)

Time Complexity- 0(N)
```

Both of these options will return 19, but the Sliding Window Pattern is much more efficient doing it. This makes a big difference if you’re working with large arrays or other data types.

extension: markdown


text:
# Symfony development docker images

Leverage the power of docker to make development initialization easy. The goal
is to have the members of your team ready to code in three steps:

1. Installing Docker
2. Installing Docker Compose
3. Cloning this repo
4. Create a symlink to the repo in their clone of the application.
5. Running `docker-compose up`

Step 1 through 3 will only be needed once in the life of their machine. Step 3.
and 4. can become optional if you have an image registry. This would leave
only… step 5. That's right, just one command.

For the moment there is :

- an nginx image
- a php image
- a postgres image
- a memcached image
- a mailcatcher image
- an elasticsearch image

All images are based on the same docker image : `ubuntu:trusty`.

## Setup inside a Symfony2 application

The project contains a sample Symfony2 application. You can do the same thing
in your app.

1. Create a docker directory, in order to have a clean separation from the rest
of the project.
2. Create a `Dockerfile`. It will contain the definition for
the data container of your application. It should consist only of `VOLUME`
statements, defining which files and directories will be shared with the containers.
Make sure to only use `VOLUMES` corresponding to containers you will be using.
3. Create any configuration file needed by the containers you intend to use.
Configuration files could be part of the image rather than mounted on it, that is
true, but having them as part of your application is great, because it makes explicit
what will be needed when deploying the application.
4. Create a symlink to the clone of this project, it will be used to tell
`docker-compose` where to look for images. It should not be under version control.
5. Create a `docker-compose.yml` file and map the volume with paths on your host.

## The containers

### The nginx container

By default, defines a monitoring.dev virtualhost. Try it, it displays nginx and
php-fpm status pages.

### The php container

It comes with XDebug remote debugging ready to use!
XDebug will try to reach your DBGP client on `<IP_ADDRESS>:9000`, please ensure
that your client is not only listening on `localhost`.
You will also need to configure remote path mappings in your debugging client
so that the remote `/srv` folder is mapped to where your application is on your
system.

If you are using vim with [vdebug](https://github.com/joonty/vdebug), the
configuration will look like this:

```viml
let g:vdebug_options= {
\    "server": '<IP_ADDRESS>',
\    "path_maps": {"/srv": "/home/username/path/to/code"}
\}
```

The recommended way to login to this container is to exec the login command on
it, like this:

```shell
docker exec --interactive --tty samplesymfonyapp_appserver_1 /bin/login -p -f $(whoami)
```

The `-p` flag tells login to preserve the environment, which contains
`SSH_AUTH_SOCK`, used when authenticating against remove service that provide
composer packages. The `-f` flag will allow us to bypass authentication.

### The mailcatcher container

Exposes an administration interface on port 80, and an SMTP service listening
on port 25.

## DNS

### Prerequisites

To use the DNS functionality, you have to run 'bin/docker-init' with root privileges

```
sudo bin/docker-init
```

### Configuration

In your docker-compose.yml file you can set `DNSDOCK_NAME` and `DNSDOCK_IMAGE`
for each image that you want to subscribe in DNS. Additionaly, you can set the
`DNSDOCK_ALIAS` to completely bypass the basic naming scheme

```
webserver:
    build: ./docker/docker-images/nginx
    ports:
        - '80'
    environment:
        - DNSDOCK_IMAGE=web
        - DNSDOCK_NAME=my_project
        - DNSDOCK_ALIAS=my_app.dev
```

With that configuration you can access to your image with `my_project.web.docker`
*and* `my_app.dev`

No need to add any host in your hosts file.

repository: jngermon/dockerony

repo_name: jngermon/dockerony


text:
# Electron File Metadata Viewer

File metadata viewer made with Electron.

This is for an [Electron tutorial on CodeBurst.io](https://codeburst.io/build-a-file-metadata-app-in-electron-a0fe8d32410e)

## Setup

1. Clone or download the repository.

2. Run `npm install`

3. Run `npm start`

repository: CodeDraken/electron-file-metadata

gha_language: JavaScript

repo_name: CodeDraken/electron-file-metadata


text:
# OpenJS Foundation Cross Project Council Meeting 2020-07-14

## Links

* **Recording**: https://www.youtube.com/watch?v=qVosg5hAx3Y
* **GitHub Issue**: https://github.com/openjs-foundation/cross-project-council/issues/589

## Present

* Michael Dawson (@mhdawson)
* Christian Bromann (@christian-bromann)
* Matteo Collina (@mcollina)
* Divy Tolia (@designmoreweb)
* Robin Ginn (@rginn)
* Joe Sepi (@joesepi)
* Mike Samuel (@mikesamuel)
* Tierney Cyren (@bnb)
* Sara Chipps (@SaraJo)
* Jory Burson (@jorydotcom)
* Brain Warner (@brianwaner)
* Kris Borchers (@kborchers)
* Jordan Harband (@ljharb)

## Agenda

### Announcements

* Jory
  * summit retrospective immediately following this meeting
  * Standards WG meeting at 2 PM EST
  * Next week is marketing meeting on Tuesday

* Joe
  * Open office hours this week, nothing specific planned, so if you have something to share….

* Jory
  * Next AMA is going to be with ESLint team, still figuring out time
  * If any other group/project wants to do one, just let Jory/Rachel know

*

### Board Meeting Updates

*Extracted from **cross-project-council-agenda** labeled issues and pull requests from the **openjs-foundation org** prior to the meeting.

* Michael, FYI - update to bylaws around director representation rules. Michael to open FYI
    issue in CPC repo.

### openjs-foundation/cross-project-council

* Board seat definitions and process [#587](https://github.com/openjs-foundation/cross-project-council/pull/587)
  * Good discussion, Joe has some updates
  * Key discussion was around whether it should be voting or all members who
    vote.

* Updating the CLA to the Apache-style ICLA and CCLA [#583](https://github.com/openjs-foundation/cross-project-council/issues/583)
  * no update, was in newsletter but Jory will send out email as FYI to make sure
    projects are aware.

* added membership program [#574](https://github.com/openjs-foundation/cross-project-council/pull/574)
  * Big open questions
    * newsletter for “supporters” only
    * anything we can offer the supporters in terms of direct line
  * Income from supporter problem where should it go? Specifically to benefits for
    supporters?  Suggest we wait to see how it goes before deciding that.

* Incubation process clarifications [#567](https://github.com/openjs-foundation/cross-project-council/issues/567)

* Move security reporting proposal to stage 2 [#566](https://github.com/openjs-foundation/cross-project-council/pull/566)
  * Should be ready to move forward, Michael will double check and land if
    appropriate.

* doc: move Collaboration network to stage 2 [#557](https://github.com/openjs-foundation/cross-project-council/pull/557)

* WIP doc: Governance changes for Collaboration Network [#547](https://github.com/openjs-foundation/cross-project-council/pull/547)

* 2nd Director seat- post July 2020 [#438](https://github.com/openjs-foundation/cross-project-council/issues/438)
* Add Foundation-wide copyright guidance [#414](https://github.com/openjs-foundation/cross-project-council/pull/414)

* Responsible security disclosures [#326](https://github.com/openjs-foundation/cross-project-council/issues/326)
  * Will wait for the end of this week for feedback and then move forward.

## Q&A, Other

## Upcoming Meetings

* **Calendar**: https://calendar.openjsf.org

Click `+GoogleCalendar` at the bottom right to add to your own Google calendar.

repository: openjs-foundation/cross-project-council

repo_name: openjs-foundation/cross-project-council


text:
<Question>

  <template slot='question'>

  ## What is *Specificity* and how is it determined?

  </template>

  <template slot='categories'>

  <Category slug='css'/>
  <Category slug='nocomputer'/>
  <Category slug='nowhiteboard'/>

  </template>

  <template slot='difficulty'>

  <Difficulty rating='medium' />

  </template>

  <template slot='answer'>

  *Specificity* is how a browser decides which CSS property values are the relevant and are applied to an element.

  *Specificity* is determined by the number of each selector type in the matching selector. When multiple declarations have equal specificity, the last declaration found in the CSS is applied to the element.

  </template>

  <template slot='reference'>

  [Mozilla Developer Network: Specificity](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity)

  </template>

</Question>


text:
# smula
Minimal framework for Markdown powered websites

Requirements

* Parsedown
* Twig

Written in PHP

Easily extendable with new controllers, just run `smula make:controller NameController` to generate a NameController.

# Routing
You can add routes to the file /app/routes.php.

Example routes

```php
// Manually passing data to the view
Route::get('/', function() {
    $files = Posts::allTidy();
    return View::render('home', ['CONTENT' => '_Smula_', 'FILES' => $files]);
});

// Passing a post to the view
Route::get('/p/{post}', function($data) {
    $post = Posts::get($data);
    return View::render('post', $post);
});

// A pages route
Route::get('/about', function() {
    $page = Pages::get('about');
    return View::render('page', $page);
});
```

# Posts
Posts can be put in the /posts folder. The naming convention is YYYYMMDD-name-of-your-post.md. These will be automatically be picked up by the post controller and displayed new -> old order.

Example filename: `20170225-example-post.md`

Example post:

```
title:Example

content:
##This is an example

With some text, followed by a code block

```php
public function andCode()
{
    return success;
}
`` // should be one more ` here
And here is a gist included in the post

gist:461cc93eb75bfb123235
```

# Pages
Specific pages can be put in the /pages folder. For example an `about` page can be useful here.

repository: iszla/smula

repo_name: iszla/smula


text:
@function can-stache-converters.index-to-selected index-to-selected
@parent can-stache-converters.converters
@description A [can-stache.registerConverter converter] that binds to a `<select>` value in order to two-way bind a selected item from a list to the selected item's index as a viewModel property.

@signature `index-to-selected(item, list)`

When the getter is called, returns the index of the passed in item (which should be a [can-compute] from the provided list.

When the setter is called, takes the selected index value and finds the item from the list with that index and passes that to set the compute’s value.

```handlebars
<select value:bind="index-to-selected(person, people)">

	{{#each people}}

		<option value="{{scope.index}}">{{name}}</option>

	{{/each}}

</select>
```

@param {can-compute} item A compute whose item is in the list.
@param {can-define/list/list|can-list|Array} list A list used to find the `item`.
@return {can-compute} A compute that will be two-way bound to the select’s value.

@body

## Use

This will most often be used in conjunction with a `<select>` element and a bunch of options.

The provided `item` **must** be a [can-compute] so that its value can be set when the user selects own of the dropdown options.

You **must** use the indexes from the list as your `<option>` values. This is how it looks up items in the list both in the getter and the setter.

@demo demos/can-stache-converters/index-to-selected.html

repository: canjs/can-stache-converters

repo_name: canjs/can-stache-converters


text:
# Dev - Wireshark

## About

**Wireshark** is the well known network protocol analyzer. [Visual C++ Redistributable Packages for Visual Studio 2013](https://www.microsoft.com/en-us/download/details.aspx?id=40784) is required to capture and list network devices.

* https://www.wireshark.org/

## Capture

### Via WindowsSpyBlocker

WindowsSpyBlocker can be used to capture traffic on your network interface.

A lite version of Wireshark is used through the WindowsSpyBlocker executable (see [wireshark.go](https://github.com/crazy-max/WindowsSpyBlocker/blob/master/app/cmds/dev/wireshark/wireshark.go#L63-L75) for more info).

Before executing the script, do not forget to edit the `app.conf` file.

* **wireshark**
  * **capture**
    * **interface**: idx of interface used by Wireshark
    * **filter**: packet filter in libpcap filter syntax

The idx of the interface can be found be launching `WindowsSpyBlocker.exe` and select `Dev > Wireshark > Print list of network interfaces` :

![](../../.res/dev/wireshark/wireshark-interfaces-20170518.png)

Then go to `Dev > Wireshark > Capture` to capture packets :

![](../../.res/dev/wireshark/wireshark-capture-20170518.png)

### Via Wireshark GUI

To capture / log traffic with this application, you will have to select the correct adapter and enter a filter :

![](../../.res/dev/wireshark/wireshark-welcome-20160529.png)
> Filter: `not arp and port not 53 and not icmp and not icmp6 and not broadcast`

> Adapter: Ethernet

Then click on your adapter to start the capture. When the capture is done, do not forget to save your capture as **pcapng** format.

### Via command line

```
@ECHO OFF

"C:\Program Files\Wireshark\dumpcap.exe" -i 1 -f "not arp and port not 53 and not icmp and not icmp6 and not broadcast" -w "C:\tmp\cap.pcapng"
```
> Where `-i 1` is the number of your adapter (here Ethernet)

## Parsing

WindowsSpyBlocker can be used to parse events and generate CSV files.

A lite version of Wireshark to parse events is used through the WindowsSpyBlocker executable (see [wireshark.go](https://github.com/crazy-max/WindowsSpyBlocker/blob/master/app/cmds/dev/wireshark/wireshark.go#L63-L75) for more info).

Before executing the script, do not forget to edit the `app.conf` file.

* **wireshark**
  * **pcapngPath**: Path to your capture file pcapng.
* **exclude**
  * **ips**: exclude IPs addresses from parsing. Ranges are allowed and in most cases you have to exclude your local network.
  * **hosts**: exclude domains from parsing. Wildcard are allowed and in most cases you have to exclude your local network.
  * **orgs**: exclude by whois organization from parsing. Wildcard are allowed and in most cases you have to exclude your ISP.

Then launch `WindowsSpyBlocker.exe` and select `Dev > Wireshark > Extract log` :

![](../../.res/dev/wireshark/wireshark-parsing-20170515.png)

CSV file will be generated in `logs/` folder :

* `wireshark-hosts-count.csv`

repository: atarist/WindowsSpyBlocker

repo_name: atarist/WindowsSpyBlocker


text:
---
id: accessing-deployed-vms
title: Accessing Deployed VMs
sidebar_label: Accessing Deployed VMs
---

You have the ability to deploy virtual machines attached to particular rooms and tasks. These machines can only be accessed using a VPN connection. In this case, users need to download an OpenVPN configuration file from here. Once a user deploys a machine they will be given a internal IP address which they will be able to communicate with using the OpenVPN connection.

**Our OpenVPN configuration will only route users traffic if they're trying to access one of the machines on our network, all other traffic is routed through their own connection**.

To reiterate, when a user is connected through our OpenVPN connection only traffic for 10.*.*.* networks are routed through the VPN.

It's important to note that you can't just open the IP address in a browser. That would only work if there's a webserver running on port 80. Read the material carefully, you may be provided SSH creds for some walkthrough rooms. Most of the time, gaining access is part of the challenge.

A very limited number of rooms have in browser remote accesss. These are the exceptions, not the rule. Do not expect this behaviour by default.

path: /docs/rooms/Accessing Deployed VMs.md

filename: Accessing Deployed VMs.md


text:
# Big Query Utils

## About

Big query utils is a repo. to add some google functions, app engine, crons jobs, etc... to help improve datasheet performance, execution or table filters/re-creation.

## Table of Contents

1. [Create non-duplicated tables project](https://github.com/mundodehads/bigquery-utils/tree/master/non-duplicated-tables)

repository: mundodehads/node-study

repo_name: mundodehads/node-study


text:
# Table class
Table is a class for managing PHP bi-dimensional arrays like:

```
[
    ['product' => 'Desk', 'price' => 200, 'active' => true],
    ['product' => 'Chair', 'price' => 100, 'active' => true],
    ['product' => 'Door', 'price' => 300, 'active' => false],
    ['product' => 'Bookcase', 'price' => 150, 'active' => true],
    ['product' => 'Door', 'price' => 100, 'active' => true],
]
```

## Description

Table class allows you to filter, select some fields, create calculated fields.

## Create a Table

```php
use HiFolks\DataType\Table;

$dataTable = [
['product' => 'Desk', 'price' => 200, 'active' => true],
['product' => 'Chair', 'price' => 100, 'active' => true],
['product' => 'Door', 'price' => 300, 'active' => false],
['product' => 'Bookcase', 'price' => 150, 'active' => true],
['product' => 'Door', 'price' => 100, 'active' => true],
];

$table = Table::make($dataTable);
```

## Select some data

Return a new Table instance with the selected attributes.
IN this case only *product* and *price* are returned.

```php
use HiFolks\DataType\Table;

$dataTable = [
['product' => 'Desk', 'price' => 200, 'active' => true],
['product' => 'Chair', 'price' => 100, 'active' => true]
];

$table = Table::make($dataTable)->select(['product', 'price']);

/*
array (
  0 =>
  array (
    'product' => 'Desk',
    'price' => 200,
  ),
  1 =>
  array (
    'product' => 'Chair',
    'price' => 100,
  )
)
 */
```

With *except()* method are returned all the attributes except the columns listed as parameter

```php
use HiFolks\DataType\Table;

$dataTable = [
['product' => 'Desk', 'price' => 200, 'active' => true],
['product' => 'Chair', 'price' => 100, 'active' => true]
];

$table = Table::make($dataTable)->except(['active']);

/*
array (
  0 =>
  array (
    'product' => 'Desk',
    'price' => 200,
  ),
  1 =>
  array (
    'product' => 'Chair',
    'price' => 100,
  )
)
 */
```
## Filter data
You can filter data with *where()* method.
You can specify:
- $field: the field name to filter (for example price);
- $operator: the operator "==", "===", ">", ">=", "<", "<=", "!==", "!=";
- the value

```php
use HiFolks\DataType\Classes\Operation;
use HiFolks\DataType\Table;

$table = Table::make([
    ['product' => 'Desk', 'price' => 200, 'active' => true],
    ['product' => 'Chair', 'price' => 100, 'active' => true],
    ['product' => 'Door', 'price' => 300, 'active' => false],
    ['product' => 'Bookcase', 'price' => 150, 'active' => true],
    ['product' => 'Door', 'price' => 100, 'active' => true],
]);
var_export($table
    ->select(['product' , 'price'])
    ->where('price', '>', 100)
    ->arr());

/*
array (
  0 => array (
    'product' => 'Desk',
    'price' => 200,
  ),
  2 => array (
    'product' => 'Door',
    'price' => 300,
  ),
  3 => array (
    'product' => 'Bookcase',
    'price' => 150,
  ),
)*/
```

## Order By a column
For example if you want to order the price for each product you can use *orderBy()* method.

```php
use HiFolks\DataType\Table;
use HiFolks\DataType\Classes\Operation;

$table = Table::make([
    ['product' => 'Desk', 'price' => 200, 'active' => true],
    ['product' => 'Chair', 'price' => 100, 'active' => true],
    ['product' => 'Door', 'price' => 300, 'active' => false],
    ['product' => 'Bookcase', 'price' => 150, 'active' => true],
    ['product' => 'Door', 'price' => 100, 'active' => true],
]);
var_export(
    $table->orderBy('price')
);
/*
[
    ['product' => 'Door', 'price' => 300, 'active' => false],
    ['product' => 'Desk', 'price' => 200, 'active' => true],
    ['product' => 'Bookcase', 'price' => 150, 'active' => true],
    ['product' => 'Chair', 'price' => 100, 'active' => true],
    ['product' => 'Door', 'price' => 100, 'active' => true],
]
*/
```

By default, the order is desc. If you want to order in descending order you can use *orderBy($field, $order)* method.

```php
use HiFolks\DataType\Table;
use HiFolks\DataType\Classes\Operation;

$table = Table::make([
    ['product' => 'Desk', 'price' => 200, 'active' => true],
    ['product' => 'Chair', 'price' => 100, 'active' => true],
    ['product' => 'Door', 'price' => 300, 'active' => false],
    ['product' => 'Bookcase', 'price' => 150, 'active' => true],
    ['product' => 'Door', 'price' => 100, 'active' => true],
]);
var_export(
    $table->orderBy('price', 'asc')
);
/*
[
    ['product' => 'Door', 'price' => 100, 'active' => true],
    ['product' => 'Chair', 'price' => 100, 'active' => true],
    ['product' => 'Bookcase', 'price' => 150, 'active' => true],
    ['product' => 'Desk', 'price' => 200, 'active' => true],
    ['product' => 'Door', 'price' => 300, 'active' => false],
]
*/
```

Both orders can be inforced by using `asc` and `desc`

## Group By a column
For example if you want to group the products by their `product` value you can use *groupBy()* method.

```php
use HiFolks\DataType\Table;
use HiFolks\DataType\Classes\Operation;

$table = Table::make([
    ['product' => 'Desk', 'price' => 200, 'active' => true],
    ['product' => 'Chair', 'price' => 100, 'active' => true],
    ['product' => 'Door', 'price' => 300, 'active' => false],
    ['product' => 'Bookcase', 'price' => 150, 'active' => true],
    ['product' => 'Door', 'price' => 100, 'active' => true],
]);
var_export(
    $table->groupBy('product');
);
/*
[
    ['product' => 'Door', 'price' => 100, 'active' => true],
    ['product' => 'Chair', 'price' => 100, 'active' => true],
    ['product' => 'Bookcase', 'price' => 150, 'active' => true],
    ['product' => 'Desk', 'price' => 200, 'active' => true]
]
*/
```

The `groupBy` method will always keep the first one that it finds, so if you want to keep only the product
that costs the most you'll have to use the `orderBy` method before the `groupBy` method.

## Transform a column with a custom function
For example if you want to transform all values in a column within the table you can use *transform()* method.

```php
use HiFolks\DataType\Table;
use HiFolks\DataType\Classes\Operation;

$table = Table::make([
    ['product' => 'Desk', 'price' => 200, 'active' => true],
    ['product' => 'Chair', 'price' => 100, 'active' => true],
    ['product' => 'Door', 'price' => 300, 'active' => false],
    ['product' => 'Bookcase', 'price' => 150, 'active' => true],
    ['product' => 'Door', 'price' => 100, 'active' => true],
]);
var_export(
    $table->transform('price', function ($value) {
        return $value * 100;
    })
);
/*
[
    ['product' => 'Door', 'price' => 10000, 'active' => true],
    ['product' => 'Chair', 'price' => 10000, 'active' => true],
    ['product' => 'Bookcase', 'price' => 15000, 'active' => true],
    ['product' => 'Desk', 'price' => 20000, 'active' => true]
]
*/
```

This can be used if you wanted to turn the price from dollars into cent i.e 200 to 20000

repository: Hi-Folks/array

gha_language: PHP

repo_name: Hi-Folks/array


text:
---
layout: page
title: About the Sheffield Bioinformatics Core Facility
excerpt: "How to work with the SBC..."
---

## When to approach the Core

If you are planning an experiment for which you would like SBC analysis support, the best time to approach the Core would be when you are collecting / preparing samples and prior to any data being generated. This is to ensure that good experimental design procedures are observed and that the experiment is sufficiently powered to answer your biological question of interest and any potential confounding factors have been addressed.

To quote R.A. Fisher

> To consult the statistician after an experiment is finished is often merely to ask him to conduct a post mortem examination. He can perhaps say what the experiment died of.

## What to Expect

An initial meeting, which is free of charge will then be scheduled to discuss your requirements and how the SBC can assist. The meeting will involve yourself, the SBC director, one of the analysis team, and ideally a representative of the facility you intend to use to generate your data. As a result of this initial meeting, the Core will determine whether the proposed project fits within their remit, or recommend referral to other local expertise; such as the faculty members that constitute the [Bioinformatics Network](https://bioinformatics.group.shef.ac.uk/), or the [Research Software Engineering group](https://rse.shef.ac.uk/).

After the initial consultation you will receive a *Memorandum of Understanding* (MOU) which will require your signature of the project P.I. before the Core’s work on the project can commence. This document clarifies your relationship with the Core for the duration of the project. The most appropriate analyst to execute the project will be selected and this analyst will be your point of contact throughout the analysis cycle.

### Project management

We will also provide you with an time estimate and corresponding [cost](../policies) that can be used for grant-writing purposes. A start date for the project will also be agreed. The SBC will use project management software (currently [Basecamp](https://basecamp.com/)) to track progress on your project and keep you updated.

### Best Practices

We employ established techniques in reproducible research and version control, and our analysis scripts can be made available to you on request or at the point of submission to a journal.

gha_language: HTML


text:
These are the 64 bits bindings for GDAL 2.1.1. The file **gdal.tar.gz** is a compressed archive containing all the library files.

Refer to the file compilationNotes.txt for info on how these binaries were compiled.