text:
# Vue Snippets

[![Downloads](https://badges.ml/vue-snippets/total.svg)](https://brackets-extension-badges.github.io#vue-snippets)
[![Downloads](https://badges.ml/vue-snippets/last-version.svg)](https://brackets-extension-badges.github.io#vue-snippets)
[![Downloads](https://badges.ml/vue-snippets/week.svg)](https://brackets-extension-badges.github.io#vue-snippets)
[![Downloads](https://badges.ml/vue-snippets/day.svg)](https://brackets-extension-badges.github.io#vue-snippets)
[![Version](https://badges.ml/vue-snippets/version.svg)](https://brackets-extension-badges.github.io#vue-snippets)

## Description

A collection of [VUE](https://vuejs.org/) snippets for [Brackets](http://brackets.io/) editor.

## Installation

#### Git Clone
1. Under main menu select **Help > Show Extensions Folder**
2. Git clone this repository inside the folder user.

#### Extension Manager
1. Under main menu select **File > Extension Manager...**
2. Search for "Vue snippets"
3. Click "Install"

## How to use
1. **Enable Vue Snippets**

   Under main menu select **Edit > Enable Vue Snippets** or
 open the Preferences File and add **"vue-snippets.enabled": true**.
2. Enter a snippet and hit the **`Space`** key.

## Snippets

### Vue

| Snippet | Purpose                    |
| ------- | -------------------------- |
| `vbase` | Single file component base |

### Template

| Snippet           | Purpose                             |
| ----------------- | ----------------------------------- |
| `vfor`            | v-for directive                     |
| `vmodel`          | Semantic v-model directive          |
| `vmodelNum`       | Semantic v-model number directive   |
| `von`             | v-on click handler with arguments   |
| `velProps`        | Component element with props        |
| `vsrc`            | Image src binding                   |
| `vstyle`          | Inline style binding                |
| `vstyleObj`       | Inline style binding with objects   |
| `vclass`          | Class binding                       |
| `vclassObj`       | Class binding with objects          |
| `vclassObjMult`   | Multiple conditional class bindings |
| `vanim`           | Transition component with JS hooks  |
| `vnuxtl`          | Nuxt Routing Link                   |

### Script

| Snippet          | Purpose                                                                  |
| ---------------- | ------------------------------------------------------------------------ |
| `vdata`          | Component data as a function                                             |
| `vmethod`        | Vue method                                                               |
| `vcomputed`      | Vue computed property                                                    |
| `vwatcher`       | Vue watcher with new and old value args                                  |
| `vprops`         | Props with type and default                                              |
| `vimport`        | Import one component into another                                        |
| `vcomponents`    | Import one component into another within the export statement            |
| `vimportExport`  | Import one component into another and use it within the export statement |
| `vfilter`        | Vue filter                                                               |
| `vmixin`         | Create a Vue Mixin                                                       |
| `vmixinUse`      | Bring a mixin into a component to use                                    |
| `vcDirect`       | Vue create a custom directive                                            |
| `vimportLib`     | Import a library                                                         |
| `vimportGsap`    | Import GreenSock with Timeline and Eases                                 |
| `vanimhookJS`    | Using the Transition component JS hooks in methods                       |
| `vcommit`        | Commit to Vuex store in methods for mutation                             |
| `vdispatch`      | Dispatch to Vuex store in methods for action                             |
| `vtest`          | A simple unit testing component                                          |
| `vinc`           | incrementer                                                              |
| `vdec`           | decrementer                                                              |

### Vuex

| Snippet         | Purpose                        |
| --------------- | ------------------------------ |
| `vstore`        | Base for Vuex store.js         |
| `vgetter`       | Vuex Getter                    |
| `vmutation`     | Vuex Mutation                  |
| `vaction`       | Vuex Action                    |
| `vstoreImport`  | Import vuex store into main.js |

### Nuxt Config

| Snippet | Purpose                                                 |
| ------- | ------------------------------------------------------- |
| `nfont` | link to include fonts in a nuxt project, in nuxt-config |
| `ncss`  | link to css assets such as normalize                    |

### Credits
---

- vue-vscode-snippets - Sarah Drasner - https://github.com/sdras/vue-vscode-snippets
- brackets-jade-snippets - George Raptis - https://github.com/georapbox/brackets-jade-snippets

Thank you all!!!


text:
---
title: "Data Pipeline With Lambda"
date: 2020-04-20T22:33:23Z
description: "Steps and notes to build a simple sentiment analysis data pipeline with AWS Lambda and SQS"
draft: false
hideToc: false
enableToc: true
enableTocContent: true
author: Xanthia
authorEmoji: 🐹
tags:
- cloud computing
- aws
- machine learning
- serverless
categories:
- Coding
---

## A simple data engineering pipeline with AWS Lambda and SQS

This is a course project and in this project I reproduced a simple serverless data engineering pipeline proposed by our professor. It looks something like this:

![pipeline](/images/serverless-pipeline.png)

First a producer lambda function will be invoked every minute, and it would access a DynamoDB table, grab the entries(which are a bunch of company names), and send them as messages into a SQS queue. Every time there're new messages coming into that SQS queue, a consumer lambda function would be invoked. The consumer would get the first line of the wikipedia result of each of the messages, and do a sentiment analysis with it via AWS Comprehend. I added some more NLP capability with the help of Comprehend and extracted the key phrases from the wiki contents. The results would then be put into a S3 bucket in csv files.

### General Steps

**Create Producer Lambda Function with Cloud9**

- Create a basic Cloud9 environment and connect
- On the right panel find `AWS Resources - Lambda - Create a new Lambda function`
- In the wizard choose `python3.6` as the runtime, leave the trigger as `none`, and remember to give it a role with `AdministratorAccess`
- Paste in the producer code. The lambda source code of this project can be found [here](https://github.com/xiaodi-nie/simple-awslambda-pipeline)
- Install 3rd party packages

    The good thing about lambda python environment is that it comes with a virtual environment. Just activate it and install the packages to the right folder.
    ```
    cd ~/environment/consumerLambda/consumerLambda
    source ../venv/bin/activate
    sudo /usr/bin/python3 -m pip install --upgrade pip #update pip3
    pip3 install python-json-logger --target ../
    ```
- Create the corresponding DynamoDB table and primary key

    In the code the table name is `company-names` and the primary key is `guid`. Remember to change these two in the source code accordingly.
- Create the corresponding SQS queue. Just leave everything default and remember to change the queue name in the source code
- Run the function locally(in Cloud9) and test if everything is doing ok
- Right click on your function name from the right panel and `Deploy` to the cloud
- Go to the Lambda service on the console
- Find the function we just deployed and add a trigger:

    Choose `CloudWatch Event`, create a new rule and use `rate(1 minute)` as the `Schedule expression`, enable trigger

**Create consumer Lambda function with Cloud9**

- Create a S3 bucket, leave everything default, and remember to change the bucket path in the consumer source code
- Repeat basically the same thing, change the queue name in the source code
- Of course install different 3rd party packages: `python-json-logger`, `wikipedia`, and `pandas`
- And a different trigger:

    This time choose `SQS`, select your queue name, and leave the batch size default(or not)

You can check the S3 bucket for results and CloudWatch for logs. The logging in the code is at the `info` level, you can also change it to `debug` for more detailed information logging.

license: MIT

repository: xiaodi-nie/my-hugo-site-with-cd

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: xiaodi-nie/my-hugo-site-with-cd


text:
# Tables

You can create tables by assembling a list of words and dividing them with hyphens - (for the first row), and then separating each column with a pipe.

For aesthetic purposes, you can also add extra pipes on the ends. Note that the dashes at the top don't need to match the length of the header text exactly.

You can also include inline Markdown such as links, bold, italics, or strikethrough.

Finally, by including colons : within the header row, you can define text to be left-aligned, right-aligned, or center-aligned.

branch_name: refs/heads/gh-pages

gha_language: JavaScript


text:
## Accessing IIT Kanpur Faculty Data - Using Web Scraping

The notebook consists the code for getting faculty data from IIT Kanpur website using web scraping in Python. It uses the following packages -

1. requests (2.23.0)
2. bs4 (0.0.1)
3. lxml (4.2.6)

The notebook uses requests.get(url) method to get the HTML content of the entered url in response. This response is pretified using soup.pretify() in lxml format. Using the
find_all method, we find out all the divs with class as jwts_content and then the text inside the p tag. This text is appended to a list and later on information is extracted
from the list using simple string slicing. The information contains the name of the faculty, email address, phone number and department. In the end, some corrections are made
to correct for missing data on the website (Eg. Environment Engineering and Management). All the extracted information is converted to a dataframe and then to a csv file.

The website was last accessed on 9 December 2020. To get the data, simply execute the notebook and download the output csv file.

repository: urvashiramdasani/PaperTags

branch_name: refs/heads/main

repo_name: urvashiramdasani/PaperTags


text:
# icecc-daemon

The iceccd daemon running in a Docker container. Learn more about icecream here: https://github.com/icecc/icecream

By running this on a remote computer, that computer will be enrolled into your icecream build infastructure as a worker node. This icecc daemon also needs to have a icecc scheduler running to distribute and manage the worker nodes including this one. You can start a scheduler using my other Docker image here: https://hub.docker.com/r/cbarraco/icecc-scheduler

# Running the Container
You can use this command to pull the container from Docker Hub and run it:
```bash
    docker run -it --net=host -d --restart=unless-stopped cbarraco/icecc-daemon
```
I've had the best luck using --net=host but you might be able to get it to work using a bridge network.

You can also pass in the scheduler address if the UDP broadcast feature isn't working using the USE_SCHEDULER environment variable:
```bash
    docker run -it --net=host -d --restart=unless-stopped -e USE_SCHEDULER=<ADDRESS OF SCHDULER> cbarraco/icecc-daemon
```

repository: cbarraco/icecc-daemon

gha_language: Dockerfile

repo_name: cbarraco/icecc-daemon


text:
Based on the work of [Andy Walden](https://github.com/andywalden).

## Features

    msiem config              Set and print your msiempy config.
    msiem alarms              Query alarms with alarms and events based regex filters.
                              Print, acknowledge, unacknowledge and delete alarms.
    msiem esm                 Show ESM version and misc informations regarding your ESM.
    msiem ds                  Add datasources from CSV or INI files, list, search, remove.
    msiem events              Query events with any simple filter.
    msiem api                 Quickly make API requests to any enpoints with any data.

## Installation
```bash
$ pip install msiem --upgrade
```

## Command Line Interface documentation

**Read the [documentation](https://mfesiem.github.io/docs/msiem/)** or use `msiem -h`.

repository: mfesiem/msiem

repo_name: mfesiem/msiem


text:
# Welcome!

This tutorial introduces the concept of a quantum gate and walks you through a list of the most common single-qubit gates.

You can run the tutorial online [here](https://mybinder.org/v2/gh/Microsoft/QuantumKatas/main?filepath=tutorials/SingleQubitGates/SingleQubitGates.ipynb).
Alternatively, you can install Jupyter and Q# on your machine, as described [here](https://docs.microsoft.com/quantum/install-guide#develop-with-jupyter-notebooks), and run the tutorial locally by navigating to this folder and starting the notebook from the command line using the following command:

    jupyter notebook SingleQubitGates.ipynb

gha_license_id: MIT


text:
# Fixing Unexpected character in prolog error

\| [Recipes by Topic](../../readme.md ) \| [Recipes by Author](../../author.md ) \| [Request Enhancement](https://github.com/SAP-samples/cloud-integration-flow/issues/new?assignees=&labels=Recipe%20Fix,enhancement&template=recipe-request.md&title=Improve%20Fixing-Unexpected-character-in-prolog-error ) \| [Report a bug](https://github.com/SAP-samples/cloud-integration-flow/issues/new?assignees=&labels=Recipe%20Fix,bug&template=bug_report.md&title=Issue%20with%20Fixing-Unexpected-character-in-prolog-error ) \| [Fix documentation](https://github.com/SAP-samples/cloud-integration-flow/issues/new?assignees=&labels=Recipe%20Fix,documentation&template=bug_report.md&title=Docu%20fix%20Fixing-Unexpected-character-in-prolog-error ) \|

![Meghna Shishodiya](https://github.com/author-profile.png?size=50 ) | [Meghna Shishodiya](https://github.com/author-profile ) |
----|----|

This recipe provides a hint on how to resolve the prolog error

## Recipe

**Problem:**

Prologue not proper: *"Fault: Could not generate the XML stream caused by:
com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1].", caused by "WstxUnexpectedCharException:Unexpected character in prolog; expected '<'*

**Solution:**

The above error occurs when a flow returns a plain text response or a malformed XML back to the sender who is expecting an XML. In case you added a message manually via the content modifier, make sure to add the full XML not just the text.

In case you are already sending an XML, check if it is well-formed. You may use standard tools to help point out the mistake.

Also check if the receiver is returning a non-XML or a malformed response.

url: https://raw.githubusercontent.com/SAP/apibusinesshub-integration-recipes/13ded1b134467b0156b0fe001c15abacb92f1e3a/Recipes/for/Fixing Unexpected character in prolog expected error/readme.md

repository: SAP/apibusinesshub-integration-recipes

gha_language: Java

repo_name: SAP/apibusinesshub-integration-recipes


text:
---
layout: default
title: Introduction
permalink: /
---

# [WMS Documentation](https://s2kmobile.github.io/wms/)

This is the site for S2k Mobile Warehouse Management System(WMS) documentations.

## Github Repo
[https://github.com/s2kmobile/wms](https://github.com/s2kmobile/wms)

## License
This theme of this site is forked from [https://github.com/pmarsceill/just-the-docs](https://github.com/pmarsceill/just-the-docs) which is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).


text:
---
summary: "Testing multi-threaded code is tricky, the test and the code under test most likely are run under different threads. Here, we will discuss how to
deal with the issue based on the book Growing Object-Oriented Software Guided by Tests"
tags: [java, concurrent, testing, tdd, asynchronous, multithreading]
date: 2022-03-15T08:18:16+07:00
title: "Testing Asycnhronous Code in Java"
categories: [Programming, Development]
series: []
keywords: [tdd, testing, testing asynchronous code, java, unit test]
socialsharing: true
draft: false
totop: true
---
Testing asynchronous code is tricky. In a typical case, we are mostly dealing with a single
threaded code which means the test and the program (or object) under test are run in the same thread.
However, in a concurrent setup, the test might be run in a different thread from part of the program
under test. This is problematic when the program using fire-and-forget asynchronous type of concurrency
where the program does not need to know what are the outcomes of its children processes.
The easiest workaround is to make the test _wait_ for the children processes finished using `Thread.sleep`. Still,
the aforementioned workaround may be unstable when run in different environment with different hardware
configuration, e.g., CI runner. In the local machine the test may pass but intermittently fails in CI.

In the [Growing Object Oriented Software Guided by Tests](http://www.growing-object-oriented-software.com/)
the authors write two dedicated chapters related to test and multi-threading code (chapter 27 and 28). Those
chapters are intriguing as I have an experience struggling to test a multi-threaded code. While it passes
all unit tests in the local machine but keep failing in the CI job.

In my opinion, there are two significant takeaways
from the chapters to handle such issue:
1. Separate the concurrency policy and the functionality
2. Asynchronous codes testing strategy

## Separate concurrency policy and functionality
In short, separation between concurrency policy and the functionality is achieved by making the `Executor` service
part of the injected dependencies. Let's say we have a program that sends an email to a list of recipients asynchronously,
we call it `NotificationHandler`. The class calls a `NotificationGateway#fire` to actually send the email.

```java
public interface NotificationGateway {
    void fire(String anyString);
}

public class NotificationHandler {
    private final NotificationGateway notification;
    private final Executor executor;

    public NotificationHandler(NotificationGateway notification, Executor executor) {
        this.notification = notification;
        this.executor = executor;
    }

    public void handleWithExecutor(List<String> recipients) {
        for (String recipient : recipients) {
            executor.execute(new Runnable() {
                @Override
                public void run() {
                    sendNotification(recipient);
                }
            });
        }
    }

    @SneakyThrows
    private void sendNotification(String emailAddress) {
        notification.fire(emailAddress);
    }
}
```

By making the `Executor` injected, we can actually wait for the pool to terminate before asserting the system under test.

```java
class FireAndForgetTest {
    private final List<String> sendToAddresses = Arrays.asList(
      // redacted
      );
    private NotificationGateway notification;
    private NotificationHandler handler;
    private ExecutorService executor;
    private NotificationTrace<String> trace;

    @BeforeEach
    void setup() {
        notification = mock(NotificationGateway.class);
        trace = new NotificationTrace<>();
        executor = Executors.newFixedThreadPool(5);
        handler = new NotificationHandler(notification, executor);
    }

    @Nested
    class UsingExecutor {
        @Test
        @SneakyThrows
        void givenAList_whenHandleWithExecutor_shouldCallNotificationGateway() {
            Logger log = Logger.builder().start(System.currentTimeMillis()).build();

            doAnswer(invocation -> {
                log.logExecution(Thread.currentThread(), "executes notification#fire");
                Thread.sleep(1000);
                return null;
            }).when(notification).fire(anyString());

            handler.handleWithExecutor(sendToAddresses);

            executor.shutdown();
            log.logExecution(Thread.currentThread(), "executor shutdown");

            executor.awaitTermination(10000, TimeUnit.MILLISECONDS);
            log.logExecution(Thread.currentThread(), "executor terminated");

            verify(notification, times(sendToAddresses.size())).fire(anyString());
        }
    }
}
```
Here, we stub the `fire` method to simulate a long running process with `Thread.sleep(1000)`. The `executor` needs to be shutdown
after the method under test has been called. Calling `executor.shutdown` initiates orderly shutdown and no new tasks will be accepted;
the already submitted tasks will still be executed. The `executor.awaitTermination` will block the thread until all the tasks are completed
after a shutdown request.

```
[thread main] executor shutdown after [14 ms] from initial execution time
[thread pool-1-thread-4] executes notification#fire after [18 ms] from initial execution time
[thread pool-1-thread-3] executes notification#fire after [18 ms] from initial execution time
[thread pool-1-thread-1] executes notification#fire after [18 ms] from initial execution time
[thread pool-1-thread-5] executes notification#fire after [18 ms] from initial execution time
[thread pool-1-thread-2] executes notification#fire after [18 ms] from initial execution time
[thread pool-1-thread-4] executes notification#fire after [1020 ms] from initial execution time
[thread pool-1-thread-3] executes notification#fire after [1021 ms] from initial execution time
[thread pool-1-thread-1] executes notification#fire after [1023 ms] from initial execution time
[thread pool-1-thread-2] executes notification#fire after [1023 ms] from initial execution time
[thread pool-1-thread-5] executes notification#fire after [1023 ms] from initial execution time
[thread main] executor terminated after [2028 ms] from initial execution time
```

We can see from the log above that the tasks' actual execution are after the shutdown request have been made while the actual termination
waits after all the tasks has been completed.

## Asycnronous code testing strategy
There are two strategy mentioned in the last chapter of the book namely _listening_ and _sampling_.
_Listening_ means that the test should able to listen events that a systems sends out when executing asynchronous tasks.
On the other hand, _sampling_ requires the test to sample observable state.

### Listening: Capturing Notifications
We will use the same `NotificationHandler` class to elaborate the detail of the _listening_ mechanism.
As the name suggest, we need an object that captures events sent by the observed system, called `NotificationTrace` (see
[here](https://github.com/npryce/goos-code-examples/blob/master/testing-asynchronous-systems/src/book/example/async/notifications/NotificationTrace.java)
for the original code). The class provides a method `append` that needs to be
called by the observed system. The append process is wrapped by a `synchronized` block to make sure that no race
condition occurred.
The interesting part actually in the assertion method `NotificationTrace#containsNotificationIn` where it blocks the thread and
evaluate whether the criteria is satisfied or timed-out. The actual criteria evaluation is delegated to the `NotificationListStream` class.
This part is different from the original code as what we want to assert is
different: we want to assert that all the emails are sent to the correct recipient list. Hence, if we want to
have another assertion, let's say the size of recipient list is equal to the size of the original recipient list,
we might have to write another method to express the assertion. Well, it might be an opportunity to refactor the
`NotificationTrace` class to have a general assertion method that can work with most criteria for further improvement.

```java
@Setter
@Getter
public class NotificationTrace<T> {
    private final Object tracelock = new Object();
    private final List<T> trace = new ArrayList<>();
    private long timeoutMs = 1000L;

    public void append(T message) {
        synchronized (tracelock) {
            trace.add(message);
            tracelock.notifyAll();
        }
    }

    public void containsNotificationIn(Matcher<Iterable<? extends T>> criteria) throws InterruptedException {
        Timeout timeout = new Timeout(timeoutMs);
        synchronized (tracelock) {
            NotificationListStream<T> stream = new NotificationListStream<>(trace, criteria);
            while (!stream.hasMatched()) {
                if (timeout.hasTimedOut()) {
                    throw new AssertionError(failureDescriptionFrom(criteria));
                }
                timeout.waitOn(tracelock);
            }
        }
    }

    private String failureDescriptionFrom(Matcher<? extends Object> criteria) {
        // redacted
    }
}

@RequiredArgsConstructor
public class NotificationListStream<T> {
    private final List<T> notifications;
    private final Matcher<Iterable<? extends T>> criteria;

    public boolean hasMatched() {
        return criteria.matches(notifications);
    }
}
```

The following snippet is the unit test code omitting instantiation of the `NotificationTrace<String> trace` object (commented for brevity). To simulate how the observed system sent out events, the method `fire` is stubbed and calls the `trace.append` method to notify the listener (the `trace` object)
```java
// the test
// private NotificationTrace<String> trace = new NotificationTrace<>();

@SneakyThrows
@Test
void givenAList_whenHandleWithExecutor_shouldCallNotificationGateway() {
    trace.setTimeoutMs(10000L);
    doAnswer(invocation -> {
        Thread.sleep(1000);
        trace.append(invocation.getArgument(0));
        return null;
    }).when(notification).fire(anyString());

    handler.handleWithExecutor(sendToAddresses);

    trace.containsNotificationIn(
        containsInAnyOrder(convertToArray(sendToAddresses)));
}
```
The obvious precondition is to have the system under test have the capability to send events, or we need to design it that way.
The system does not necessarily have dependency to the `NotificationTrace`, however, it should have
a dependency to an interface that send those events. Then, we can create an implementation of the interface that
calls `NotificationTrace` or simply mock it.

### Sampling: Polling for changes
When we do not have the option to make the system sends events or it is not make sense to do so, another way
to test asynchronous code is by observe the state of the system time to time until the expectation criteria
is matched or time out occurred. The test will actively polling the system to get its latest observed changes.
The book introduces two main constructs that allow us to sampling the state of a system under test: a `Poller`
and a `Probe`. A `Probe` is an interface to capture an observable state of a system under test and validate an assertion based
on the state. It provides two significant methods namely `sample` and `isSatisfied` for sampling the state and
validating an assertion respectively.

```java
@Getter
@Setter
@AllArgsConstructor
public class Poller {
    private long timeoutMillis;
    private long pollDelayMillis;

    public void check(Probe probe) throws InterruptedException {
        Timeout timeout = new Timeout(timeoutMillis);
        while (!probe.isSatisfied()) {
            if (timeout.hasTimedOut()) {
                throw new AssertionError(describeFailureOf(probe));
            }
            Thread.sleep(pollDelayMillis);
            probe.sample();
        }
    }

    private String describeFailureOf(Probe probe) {
        // redacted
    }

    public static void assertEventually(
        Probe probe,
        long timeoutMillis,
        long delayMillis)
    throws InterruptedException {
        new Poller(timeoutMillis, delayMillis).check(probe);;
    }
}

public interface Probe {
    boolean isSatisfied();
    void sample();
    void describeAcceptanceCriteriaTo(Description d);
    void describeFailureTo(Description d);
}

public class Timeout {
    private final long endTime;

    public Timeout(long duration) {
        this.endTime = System.currentTimeMillis() + duration;
    }

    public boolean hasTimedOut() {
        return timeRemaining() <= 0;
    }

    public void waitOn(Object lock) throws InterruptedException {
        long waitTime = timeRemaining();
        if (waitTime > 0) lock.wait(waitTime);
    }

    private long timeRemaining() {
        return endTime - System.currentTimeMillis();
    }
}
```

The method `check` in class `Poller` is waiting (using `while` loop) until the specified assertion criteria is
satisfied or a timeout is reached. The fundamental difference between the _listening_ method is that the _sampling_
method does not capture the system under test's state in real time, rather, in an a specified interval configured by
the `pollDelayMillis` variable. To actually assert using this mechanism, the `Poller` provides a static assertion method `assertEventually` that takes
a `probe`, `timeoutMillis` and `delayMillis` as its parameters then it simply instantiates a new `Poller` object and
calls the method `check` that initiates the sampling procedure.

```java
// the test method
@SneakyThrows
@Test
void givenAList_whenHandleWithExecutor_shouldCallNotificationGateway() {
    doAnswer(invocation -> {
        Thread.sleep(1000);
        return null;
    }).when(notification).fire(anyString());

    handler.handleWithExecutor(sendToAddresses);

    assertEventually(
        fireNotificationTo(notification, is(sendToAddresses.size())),
        10000L, 1000L);
}

// NotificationProbe
public class NotificationProbe {
    private static final int NOT_SET = -1;

    public static Probe fireNotificationTo(
        NotificationGateway notification, final Matcher<Integer> matcher) {
        return new Probe() {
            private int count = NOT_SET;

            @Override
            public boolean isSatisfied() {
               return count != NOT_SET && matcher.matches(count);
            }

            @Override
            public void sample() {
                ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
                verify(notification, atLeastOnce()).fire(captor.capture());
                count = captor.getAllValues().size();
            }

            @Override
            public void describeAcceptanceCriteriaTo(Description d) {
                d.appendText("notification")
                .appendText(" has been called ")
                .appendDescriptionOf(matcher);
            }

            @Override
            public void describeFailureTo(Description d) {
                d.appendText("call count was ").appendValue(count);
            }
        };
    }
}
```
In this sampling observation method, we need to define the `Probe` to capture significant states of a system
under test and to provide criteria matcher evaluation based on those states. In our case, the `Probe` definition
is built in a `static` helper method `notification` in class `NotificationProbe`.

At the end, the three discussed mechanisms are not mutually exclusive. One mechanism is not inherently superior to others.
We might ended using only one of them or combination out of the three depends on the situation and the objective of the system.

Please see this [github repository](https://github.com/npatmaja/concurrency-goos-excercise) for the complete implementation.

gha_language: HTML


text:
# Zygaenobia Weiser GENUS

#### Status
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Ent. Listy 14(3): 134 (1951)

#### Original name
Zygaenobia Weiser

### Remarks
null

repository: mdoering/backbone

repo_name: mdoering/backbone


text:
# Disputed Payment

The payment the cardholder disputed.

## Structure

`Disputed Payment`

## Fields

| Name | Type | Tags | Description |
|  --- | --- | --- | --- |
| `payment_id` | `str` | Optional | Square-generated unique ID of the payment being disputed.<br>**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `192` |

## Example (as JSON)

```json
{
  "payment_id": "payment_id0"
}
```

repository: square/square-python-sdk

gha_language: Python

gha_license_id: NOASSERTION

repo_name: square/square-python-sdk


text:
# Vonage APIs Quickstart Examples for PHP

<img src="https://developer.nexmo.com/assets/images/Vonage_Nexmo.svg" height="48px" alt="Nexmo is now known as Vonage" />

The purpose of the quickstart guide is to provide simple PHP examples focused on one goal. For example, sending an SMS, receiving an SMS via an incoming SMS webhook or making a Text to Speech call.

Quickstarts also available for [Java](https://github.com/nexmo/nexmo-java-code-snippets), [.NET](https://github.com/nexmo/nexmo-dotnet-code-snippets), [Node.js](https://github.com/nexmo/nexmo-node-code-snippets), [Python](https://github.com/nexmo/nexmo-python-code-snippets), and [Ruby](https://github.com/nexmo/nexmo-ruby-code-snippets)

## Setup

These code samples are meant to be used for [https://developer.nexmo.com/](https://developer.nexmo.com/), and are structured in such a way as to be used for internal testing. Developers are free to use these code snippets as a reference, but these may require changes to be worked into your specific application. We recommend checking out the [Vonage Developer Website](https://developer.nexmo.com/), which displays these code snippets in a more copy/paste fashion.

If you would like to run these examples yourself, you will need to do the following:

1. Run `composer install` in the root of the repository
2. Copy `.env-example` to `.env`
3. Edit `.env` with your Vonage credentials

From there, you can fill out the various environment variables as detailed by the individual code snippet. Some snippets may share common environment variables.

Larger or more complex snippets may include their own `composer.json` file and have additional requirements. Please check any READMEs inside of the larger examples for setup instructions.

## Configure with Your Vonage API Keys

To use this sample you will first need a [Vonage account](https://dashboard.nexmo.com/sign-up). Once you have your own API credentials, rename
the `.env-example` file to `.env` and set the values as required.

For some of the examples, you will need to [buy a number](https://dashboard.nexmo.com/buy-numbers).

## Request More Examples

Please [raise an issue](/../../issues/) to request an example that isn't present within the code snippets. Pull requests will be gratefully received.

## Licenses

- The sample code in this repo is licensed under [MIT](LICENSE.md)

repository: gthoffer/vonage-php-code-snippets

gha_language: PHP

repo_name: gthoffer/vonage-php-code-snippets


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

### Description

Integer overflow in the rsCStrExtendBuf function in runtime/stringbuf.c in the imfile module in rsyslog 4.x before 4.6.6, 5.x before 5.7.4, and 6.x before 6.1.4 allows local users to cause a denial of service (daemon hang) via a large file, which triggers a heap-based buffer overflow.

### POC

#### Reference
No PoCs from references.

#### Github
- https://github.com/ARPSyndicate/cvemon
- https://github.com/ehoffmann-cp/check_for_cve

repository: trickest/cve

repo_name: trickest/cve


text:
# Five Crowns RFID Score Card
## How to install and run
``` lunix
sudo git clone https://github.com/PizzaRules668/Five-Crowns-RFID-Score-Card.git
pip install mfrc522
```
Make sure you have spi setup.
https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md
``` lunix
cd Five-Crowns-RFID-Score-Card-master
python3 card_setup.py
python3 main.py
```


text:
# neoterm

 ```
 __   _ _______  _____  _______ _______  ______ _______
 | \  | |______ |     |    |    |______ |_____/ |  |  |
 |  \_| |______ |_____|    |    |______ |    \_ |  |  |
```

Use the same terminal for everything. The main reason for this plugin is to
reuse the terminal easily. All commands open a terminal if one does not already
exist. REPL commands open a terminal and the proper REPL if not already opened.

- Neovim/Vim terminal helper functions/commands.
- Wraps REPLs to receive current file, line or selection.
- Multiple terminal support:
  - ![many-terms](https://cloud.githubusercontent.com/assets/120483/8921869/fe459572-34b1-11e5-93c9-c3b6f3b44719.gif)

## Installation

### Vundle/Plug.vim/minpac/any other

You can install this plugin using any vim plugin manager by using the path on
GitHub for this repository:

```vim
[Plugin|Plug|...] 'kassio/neoterm'
```

See the your plugin manager documentation for more information.

### Manual

For installation without a package manager, you can clone this Git repository
into a bundle directory as with pathogen, and add the repository to your
runtime path yourself. First clone the repository:

```console
cd ~/.vim/bundle
git clone https://github.com/kassio/neoterm.git
```

Then, modify your `~/.vimrc` file to add this plugin to your runtime path:

```vim
set nocompatible
filetype off

let &runtimepath.=',~/.vim/bundle/neoterm'

filetype plugin on
```

You can add the following line to generate documentation tags automatically,
if you don't have something similar already, so you can use the `:help` command
to consult neoterm's online documentation:

```vim
silent! helptags ALL
```

### Windows

For Windows users, replace usage of the Unix `~/.vim` directory with
`%USERPROFILE%\_vim`, or another directory if you have configured
Vim differently. On Windows, your `~/.vimrc` file will be similarly
stored in `%USERPROFILE%\_vimrc`.

## test libs (removed on 05/Feb/2017)

*This feature was removed on 05/Feb/2017, please consider using vim-test with
`neoterm` strategy to replace this feature.*

- [Related issue](https://github.com/kassio/neoterm/issues/123).

## REPL

* `TREPLSendFile`: sends the current file to a REPL in a terminal.
* `TREPLSendLine`: sends the current line to a REPL in a terminal.
* `TREPLSendSelection`: sends the selection to a REPL in a terminal.
* `<Plug>(neoterm-repl-send)`: sends with text-objects or motions, or sends the
  selection to a REPL in a terminal.
* `<Plug>(neoterm-repl-send-line)`: sends the current line to a REPL in a
  terminal.

### Supported REPLs

* Clojure: `lein repl`
* Elixir: `iex` and `iex -S mix` (if `config/config.exs` exists)
* GNU Octave: `octave`
  * For Octave 4.0.0 and later, you can enable Qt widgets (dialogs, plots, etc.)
    using `g:neoterm_repl_octave_qt = 1`
* Haskell: `ghci`
* Idris: `idris`
* JavaScript: `node`
* Java: `java`
* Julia: `julia`
* LFE: `lfe`
* Lua with `lua` and `luap`.
* MATLAB: `matlab -nodesktop -nosplash`
* PARI/GP: `gp`
* PHP: `g:neoterm_repl_php` and `psysh` and `php`
* Python: `ipython` and `python`
* R / R Markdown: `R`
* Racket: `racket`
* Rails: `bundle exec rails console`
* Ruby: `pry` and `irb`
* Rust: `evcxr`
* SML: `rlwrap sml` or `sml`
* Scala: `sbt console`
* TCL: `tclsh`

### Troubleshooting

Most standard file extensions for the above REPLs are picked up by Neovim/Vim's
default filetype plugins. However, there are two exceptions:
* Julia `.jl` files, which are detected as `filetipe=lisp`
* Idris `.idr`, `.lidr` files which are not recognised as any filetype
* LFE `.lfe` files, which are not recognized as any filetype

To fix this, either install a suitable plugin for the language or add something like
the following to your `init.vim`:
```viml
au VimEnter,BufRead,BufNewFile *.jl set filetype=julia
au VimEnter,BufRead,BufNewFile *.idr set filetype=idris
au VimEnter,BufRead,BufNewFile *.lidr set filetype=lidris
au VimEnter,BufRead,BufNewFile *.lfe, set filetype=lfe
```

## Other useful commands

* `:T {command}`: Opens a terminal, or use an opened terminal, and runs the
                  given command within a terminal.
* `:Tmap {command}`: maps a the given command to `,tt`.

## Dynamic commands

* `:3T {command}`: Will send the command to `neoterm-3`.

## useful mappings:

I like to set some mappings to make me more productive.

```viml
" 3<leader>tl will clear neoterm-3.
nnoremap <leader>tl :<c-u>exec v:count.'Tclear'<cr>
```

## Contributing

Open a pull request to add REPLs and other features to this plugin. :smiley:

## Changelog

* 14/03/2020
  - Add support for [`jshell`](https://github.com/christo-auer/neoterm.git)(Java REPL).
* 14/02/2020
  - Add support for [`evcxr`](https://github.com/google/evcxr)(Rust REPL).
* 11/11/2019
  - Fix bug with `g:neoterm_fixedsize`. ([\#255](https://github.com/kassio/neoterm/issues/255))
* 07/11/2019
  - Remove `TermClose` neoterm destroy action. This is already called via
      `on_exit` callback. ([\#252](https://github.com/kassio/neoterm/issues/252))
  - Fix neoterm on vim. Vim doesn't accept marked shell.
      ([\#251](https://github.com/kassio/neoterm/issues/251))
  - Fix exception when trying to send a command to an inexistent neoterm buffer.
      ([\#254](https://github.com/kassio/neoterm/issues/254))
* 01/09/2019
  - Use a proper terminal marker for each OS. Unix-like uses `;#neoterm` and
    windows uses `&::neoterm`. (Same strategy used on
    [FZF](https://github.com/junegunn/fzf/commit/5097e563df9c066e307b7923283cf1609ede693e)) ([#246](https://github.com/kassio/neoterm/issues/246))
* 20/08/2019
  - Destroy managed neoterm buffer loaded from session
  - Refactor the neoterm target function, the function the retrieves the desired
    neoterm to act on, to its own autoload function set (neoterm#target#).
  - Only manage neoterm terminals with `TermOpen`. ([#243](https://github.com/kassio/neoterm/issues/243))
* 19/08/2019
  - Only use `TermOpen` when it' available. ([#243](https://github.com/kassio/neoterm/issues/243))
* 18/08/2019
  - Enable neoterm to manage any terminal buffer. The TermOpen event is being
    used to associate neovim terminal with neoterm.
  - Remove deprecated `g:neoterm_open_in_all_tabs` and fix
    `g:neoterm_term_per_tab` ([#237](https://github.com/kassio/neoterm/issues/237)).
  - Better message when trying to execute a command on an already closed
    neoterm. Instead of show the error stacktrace just shows the message:
    "neoterm-X not found (probably already closed)" ([#242](https://github.com/kassio/neoterm/issues/242))
* 21/06/2019
  - Fix bug with window resizing for non-default mods ([#239](https://github.com/kassio/neoterm/issues/239)).
* 07/06/2019
  - `g:neoterm_keep_term_open` keeps hidden terminals open even if they are
    closed without using `:Tclose`
* 11/03/2019
  - Make the `signcolumn=auto` in neoterm buffer.
* 29/01/2019
  - Improve `g:neoterm_open_in_all_tabs` documentation.
* 21/12/2018
  - Add `g:neoterm_term_per_tab`, a way to send the commands to the term
    associated to the vim tab.
  - fix `:Topen` without `g:neoterm_default_mod` wasn't re-opening neoterm
    buffer.
* 17/11/2018
  - add `:Tclear!`, this will clear the neoterm buffer scrollback (history)
* 12/11/2018
  - Use `chansend` instead of `jobsend`, which was deprecated.
* 12/11/2018
  - Fix `E119: Not enough arguments for function: <SNR>112_repl_result_handler`
* 09/11/2018
  - Yet another work with '%' expandability.
    - '%' will be expanded to the current file path, respect g:neoterm_use_relative_path;
    - '\%' will be expanded to '%', not the current file path, useful in Windows.
* 20/07/2018
  - `\%` Will not expand the `%`. (Escaping the `%`)
* 03/03/2018
  - **DEPRECATE g:neoterm_split_on_tnew** - `:Tnew` now accepts vim mods (`:help mods`).
  - Introduce `g:neoterm_tnew_mod` to set a default `:Tnew` mod (`:help mods`).
  - Revamp `:Topen`. Now `:[mods][N]Topen` accepts vim mods (`:h mods`) and a
    target, so if one wants to open the neoterm with id 2 in vertical, one can
    do `:vert 2Topen`.
  - Revamp `:Tclose`. Now `:[N]Tclose[!]` accepts a target, so one can close any
    neoterm by its id.
  - Fix a bug with `:[N]Ttoggle` and also make it accepts the neoterm id.
* 04/03/2018
  - Revamp `:[N]Ttoggle`, now it accepts vim mods (`:help mods`) when the toggle
    is opening the neoterm.
  - Revamp `:[N]T`, now it accepts the target, so one can send the command for
    any neoterm by id, like, to send commands to the neoterm 3, one can do
     `:3T ls`.
  - **DEPRECATE T[N], Topen[N], Tclose[N], Tclear[N], Tkill[N]** - The neoterm
    id was moved to the beginning of the command, so instead of `:T2`, for
    example, one must use `:2T`.
* 07/03/2018
  - Do not call `:bdelete!` if buffer does not exist `term#destroy` was calling
    `neoterm#close` which was causing a cyclic call to `:bdelete!
    <neoterm.buffer_id>`.
* 08/03/2018
  - Add vim's terminal support! 🎉🎉🎉
* 15/03/2018
  - Fix bug where `:[N]T` wasn't accepting quoted arguments, like:
    `:T echo "ls"`.
  - Make handlers/callbacks work in vim. Destroy instance when destroying a
    terminal.
* 18/03/2018
  - Deprecate `g:neoterm_tnew_mod` and `g:neoterm_position` in favor of
    `g:neoterm_default_mod`, which will be used for every new neoterm window.
  - Add the feature of the _last active_ neoterm. When sending a command or
    navigating among neoterms the last one will be marked as the last active and
    it'll be used by default in the next commands.

repository: christo-auer/neoterm

repo_name: christo-auer/neoterm


text:
# Neural Style Transfer

A PyTorch implementation of
[Gatys et al. 2016](https://www.cv-foundation.org/openaccess/content_cvpr_2016/papers/Gatys_Image_Style_Transfer_CVPR_2016_paper.pdf).

repository: iamlucaswolf/style-transfer-pytorch

repo_name: iamlucaswolf/style-transfer-pytorch


text:
---
layout: post
title: Python - Selenium - How to get the size of a WebElement
published: true
---

For get the size from a WebElement ( element from now ), you just need to access through the variable class `size` :

```
>> element.size
{'width': 100, 'height': 200}
>> element.size['width']
100
>> element.size['height']
200
```

`element.size` returns a dict with the `width` and the `height` of the element, this value is updated if there's any modification in the element.

Another way that I found is using javascript:

```
>> browser_driver.execute_script("""
   var clientRect = arguments[0].getBoundingClientRect();
   return {width: clientRect.width, height: clientRect.height};
   """, element)
{'width': 100, 'height': 200}
```

Also you can use `element.get_attribute('width')`, to get the html attribute (but this isn't reliable source)

```
>> element.get_attribute('width')
100
>> element.get_attribute('height')
200
```

Also you can get the value through css, but stay sharp, the value comes in the css type-value (an string with a px, %, auto , etc), so be careful if you want to use this way (not recommended):

```
>> element.value_of_css_property('width')
'100px'
>> element.value_of_css_property('height')
'200px'
```

In general, you can use the firsts two options, but the problem comes when Selenium (or the browser) doesn't compute the value (or is wrong), sometimes the value is lost in time and space and come with a value like `{'width': 0,'height': 0}`. In that escenario you can calculate distances with others elements, like asking for a father element size, etc, but this is for another post.


text:
# Ansible Service Broker Configuration Examples

## Production

The Production broker configuration is designed to be pointed at a trusted
container distribution registry.

```
registry:
  - name: rhcc
    url: http://rhcc.redhat.com/api
    user: USER
    pass: PASS
```

## Development

The Developer configuration is the primarily used by developers working on the
broker. Set the registry name to 'dev' and 'devbroker' field to 'true' to enable
developer settings.

```
registry:
  name: dev
```

```
broker:
  devbroker: true
```
## Registry Configuration

The Registry section will allow you to define the registries that the broker should look at
for APB's. All the registry config options are defined below

| field         | description                                                                                | Required |
|---------------|---------------------------------------------------------------------------------------------------------------------------------|----------|
| name          | The name of the registry. Used by the broker to identify APB's from this registry.                                              |     Y    |
| user          | The username for authenticating to the registry                                                                                |     N    |
| pass          | The password for authenticating to the registry                                                                                |     N    |
| org           | The namespace/organization that the image is contained in                                                                       |     N    |
| type          | The type of registry. The only adapters so far are mock, RHCC, and dockerhub.                                                   |     Y    |
| url           | The url that is used to retrieve image information. Used extensively for RHCC while the docker hub adapter uses hardcoded urls. |     N    |
| fail_on_error | Should this registry fail the bootstrap request if it fails. will stop the execution of other registries loading.               |     N    |
| white_list    | The list of regular expressions used to define which image names should be allowed through.                                     |     N    |
| black_list    | The list of regular expressions used to define which images names should neve be allowed through.                               |     N    |

For filter please look at the [filtering documentation](filtering_apbs.md).

### Mock Registry
Using a Mock registry is useful for reading local APB specs. Instead of going
out to a registry to search for image specs, use a list of local specs. Set the
name of the registry to 'mock' to use the Mock registry.

```
registry:
  - name: mock
    type: mock
```

### Dockerhub Registry
Using the dockerhub registry will allow you to load APB's from  a specific organization dockerhub. A good example is the examples [organization](https://hub.docker.com/u/ansibleplaybookbundle/).

```yaml
registry:
  - name: dockerhub
    type: dockerhub
    org: ansibleplaybookbundle
    user: user
    pass: password
```

### Red Hat Container Catalog (RHCC) Registry
Using the RHCC (Red Hat Container Catalog) registry will allow you to load APB's that are published to this type of [registry](https://access.redhat.com/containers).

```yaml
registry:
  - name: rhcc
    type: rhcc
    url: <rhcc url>
```

### Multiple Registries Example
You can use more then one registry to separate apbs into logical organizations and be able to manage them from the same broker. The main thing here is that the registries must have a unique non-empty name. If there is no unique name the service broker will fail to start with an error message alerting you to the problem.

```yaml
registry:
  - name: dockerhub
    type: dockerhub
    org: ansibleplaybookbundle
    user: user
    pass: password
  - name: rhcc
    type: rhcc
    url: <rhcc url>
```

## Broker Config
The broker config section will tell the broker what functionality should be enabled
and disabled. It will also tell the broker where to find files on disk that will
enable the full functionality.

*Note: with the absence of async bind, setting launch_apb_on_bind to true can cause the bind action to timeout and will span a retry. The broker will handle with with 409 Conflicts because it is the same bind request with different parameters.*

**field**|**description**|**default value**|**required**
:-----:|:-----:|:-----:|:-----:
dev_broker|Allow development routes to be accessible|false|N
launch_apb_on_bind|Allow bind be be no op|false|N
bootstrap_on_startup|Allow the broker attempt to bootstrap itself on start up. Will retrieve the APBs from configured registries|false|N
recovery|Allow the broker to attempt to recover itself by dealing with pending jobs noted in etcd|false|N
output_request|Allow the broker to output the requests to the log file as they come in for easier debugging|false|N
ssl_cert_key|Tells the broker where to find the tls key file. Can be ignored if using `--insecure` option but otherwise is required|""|N
ssl_cert|Tells the broker where to find the tls crt file. Can be ignored if using the `--insecure` option but otherwise is required|""|N
refresh_interval|The interval to query registries for new image specs|"600s"|N

repository: djzager/ansible-service-broker

gha_language: Go

repo_name: djzager/ansible-service-broker


text:
# Setting up Kubernetes Dashboard

These steps are used to setup access to the K8S Dashboard if you need it.

## Create the Dashboard Service Account and Cluster Role Binding

This is based on the steps here https://github.com/kubernetes/dashboard/wiki/Creating-sample-user

Set up the service account and cluster role binding for the admin account used for authenticating before accessing the Dashboard

```shell

kubectl create -f dashboard-admin.yaml
```

## Setting Up Default Namespace

To avoid having to specify the namespace each type we need to look up a resource, lets set the default namespace as "kube-system" in the configs

```shell

### This is the syntax

kubectl config set-context $(kubectl config current-context) --namespace=<insert-namespace-name-here>

kubectl config set-context $(kubectl config current-context) --namespace=kube-system
```

## Validate The Configuration Change

```shell
kubectl config view | grep namespace
```

## Let's verify if the service account was created

```shell
kubectl get secret | grep admin-user
```

## Retrieve the Access Token

Let's retrieve the access token, using the secret name retrieved from the previous step

```shell
kubectl describe secret admin-user-token-6mc8b
```

## Connect to the Dashboard

Use the token to log into the dashboard when prompted for a valid Bearer Token

Open a different console window and run the following command to bring up the proxy necessary for accessing the dashboard

```shell

kubectl proxy

```

http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#!/login

repository: izzymsft/kubernetes-monitoring

repo_name: izzymsft/kubernetes-monitoring


text:
# Word Count Frequency

Modify the *Word Count* project to show the user what words they use most frequently, and how often they’re used.

## Links

[Demo](https://meterrill.github.io/vanilla-js-academy-extra-credit/02-word-count-frequency/)

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


text:
## Readme File for Value Worker Creation
Most of the installation for the value worker is handled by the general augur installation script. As noted there, the only thing you *have* to do is make sure that the `Go` programming language is installed.

### Installing the value worker:
1. Install the go language following operating system specific instructions at : https://golang.org/doc/install
2. Install scc with `go get -u github.com/boyter/scc/`
3. set the `scc_bin` value in the value_worker block of `augur.config.json` to the location of the scc excecutable installed above. For example, `/home/sean/go/bin/scc`

#### Housekeeper Block for `augur.config.json`

```json
      {
    "delay": 100000,
    "given": ["git_url"],
    "model": "value",
    "repo_group_id": 0
      }
```

#### Worker Block for `augur.config.json`
```json
        "value_worker": {
            "port": 58611,
            "scc_bin": "/home/sean/go/bin/scc",
            "switch": 0,
            "workers": 1
        }
```

1. This is how I ran SCC against facade repositories on a server:
`/root/go/bin/scc /home/sean/facade/git-repos/15/github.com/microprofile/wpsite/ . >> https:--github.com-microprofile-wpsite.git.csv`
2. We want to wrap this in Python: https://github.com/boyter/scc as an Augur worker/plugin.
3. Key Steps:
    - Make the "worker" so it inserts into the database.
    - Identify what installation might look like.  I think it will need to be installed as kind of a "worker that calls an installed piece of software" and writes it to our database.
4. Augur now installs with `make install` ...
5. The process requires a .git repository ... and so the way I handled that was I identified the facade_worker repository directory and scanned it.
    - We have an API endpoint to get that information ... remind me where that is ...
    - Default to running it on all the repositories
6. repo_labor is the intended table ... and the intended design is to count the lines of code and complexity for each file in a repository and store it.
7. Then an API endpoint would return summarization type data, like
    - language
    - etc.
    - loc
    - complexity
    - ...
8. Not sure if this is easy, but I would like the worker to allow for a parameterized calculation of labor cost .. $/hr etc ... into labor/complexity
9. The repo_labor table might not cover everything ...
```sql
CREATE TABLE "augur_data"."repo_labor" (
  "repo_labor_id" int8 NOT NULL DEFAULT nextval('"augur_data".repo_labor_repo_labor_id_seq'::regclass),
  "repo_id" int8,
  "repo_clone_date" timestamp(0),
  "rl_analysis_date" timestamp(0),
  "programming_language" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "file_path" varchar(500) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "file_name" varchar(255) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "total_lines" int4,
  "code_lines" int4,
  "comment_lines" int4,
  "blank_lines" int4,
  "code_complexity" int4,
  "repo_url" varchar(500) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "tool_source" varchar(255) COLLATE "pg_catalog"."default",
  "tool_version" varchar(255) COLLATE "pg_catalog"."default",
  "data_source" varchar(255) COLLATE "pg_catalog"."default",
  "data_collection_date" timestamp(0)
)
;
ALTER TABLE "augur_data"."repo_labor" OWNER TO "augur";
COMMENT ON COLUMN "augur_data"."repo_labor"."repo_url" IS 'This is a convenience column to simplify analysis against external datasets';
COMMENT ON TABLE "augur_data"."repo_labor" IS 'repo_labor is a derivative of tables used to store scc code and complexity counting statistics that are inputs to labor analysis, which are components of CHAOSS value metric calculations. ';

-- ----------------------------
-- Primary Key structure for table repo_labor
-- ----------------------------
ALTER TABLE "augur_data"."repo_labor" ADD CONSTRAINT "repo_labor_pkey" PRIMARY KEY ("repo_labor_id");

-- ----------------------------
-- Foreign Keys structure for table repo_labor
-- ----------------------------
ALTER TABLE "augur_data"."repo_labor" ADD CONSTRAINT "fk_repo_labor_repo_1" FOREIGN KEY ("repo_id") REFERENCES "augur_data"."repo" ("repo_id") ON DELETE NO ACTION ON UPDATE NO ACTION;

```
10. There are many different parameters that can be used to run this scc program ... the one in the example is what I did to populate repo_labor .... but there may be other functions that are useful for summarizing labor cost.


text:
# Open Disclosure
A web app to track campaign finances for the California Primary Election (March 3, 2020), and the General Election (November 3, 2020. The goal of Open Disclosure is to help voters understand who/what Political Action Committees (PACs) are donating money to the candidates/measures. Are the donors from the same jurisdiction (city/county/state) as the candidate's intended office or outside of the jurisdiction? Are the donors individuals, or Political Action Committees (PACs)? What is the donor history of the PAC(s)? We are inspired by Open Oakland's Open Disclosure: https://www.opendisclosure.io

## Draft Stories
Minimal Viable Product (MVP) / Version 1:
The aim is to have a prototype website with simple visualizations up and running by December 31, 2019.

1. A user can see a list of election categories:
- President of the United States
- United States Representative in Congress
- California State Senator and Member of the State Assembly
3. The user can select one category
4. The use can select one candidate
4. The user will see a list of donors, from highest donation to lowest donation. Include information about the donor like their job and donation amount.
5. The user can see a list of where the donors are from: San Jose, Santa Clara County, California, Other States

Version 2:
The aim is to prettify the website and visualizations from January - February 2020, ideally by February 3, 2020, one month before the Primary Election on March 3, 2020.

1. General improvements to UX/UI of website
2. The user can also view a heat or bubble map of where the donors are from.

## California Election Information:
The Presidential Primary Election is on March 3, 2020 in the state of California. There will be elections for:
- President of the United States
- United States Representative in Congress
- California State Senator and Member of the State Assembly

After the primary, the general election will be on November 3, 2020.
[More information here](https://www.sos.ca.gov/elections/upcoming-elections/presidential-primary-election-march-3-2020/election-guide/)

## How to Run this Project
1. git clone https://github.com/codeforsanjose/open-disclosure.git
2. cd open-disclosure/

## How to Contribute
0 [Find an issue and assign yourself](https://github.com/codeforsanjose/open-disclosure/issues)
- Communicate with the team on Slack (channel: #open-disclosure).
- [Join our Slack](https://slackin-c4sj.herokuapp.com/) or [Log onto our Slack](https://codeforsanjose.slack.com/)
- Attend a Code for San Jose civic hack night meetup: https://www.meetup.com/code-for-san-jose/

Made with <3 by Code for San José

repository: ErikaVasNormandy/open-disclosure

repo_name: ErikaVasNormandy/open-disclosure


text:
---
title: Comparing and Merging Hyperdrives
---

Sometimes it's useful to copy files between hyperdrives. This may be particularly useful after [forking a hyperdrive](forking-hyperdrives.md) and making some changes.

To open the "Compare and Merge" interface, navigate to your hyperdrive, click on the Site Info button, go to the "Forks" submenu and click "Diff / Merge Original".

![](/img/menu-diff-merge.png)

This will open the compare interface.

![](/img/diff-merge-interface.png)

Choose the source drive on the top left and the target drive on the right using the dropdowns.

![](/img/diff-merge-select-source.png)

## Merging drives

Select the files you want to merge by clicking on the checkboxes in the left nav, and then click "Merge {n} Changes" to copy the files into the target.

You can review the differences by selecting individual files in the left nav.

![](/img/diff-merge-individual-file.png)

The "Merge" will copy the files into the target drive, overwriting the selected files only.

## Other users' drives

If you don't own the target drive, you'll see a screen like this:

![](/img/diff-merge-not-owner.png)

Send the URL to the drive owner. It will provide them with the same interface where they can review and merge the changes.

repository: frabrunelle/beaker

repo_name: frabrunelle/beaker


text:
# My Portfolio

Getting Started

Thank you for visiting my page! This is my Portfolio V2 where you will find my most recent work.

### Live Link
* [LiveLink](https://egitweb.github.io/PortfolioV2/) - You can view my portfolio clicking on this link.

Preview:

### Installing

To install this code, download the zip file, or use GitHub's guidelines to clone the repository.

## Built With
* [HTML] - Hypertext Markup Language
* [Bootstrap](https://getbootstrap.com/) - Bootstrap is a free and open-source CSS framework
* [CSS] - Cascading Style Sheets
* [FontAwesome](https://fontawesome.com/) - Icons

## Resources Used:
* [w3schools](https://www.w3schools.com/) - The World's Largest Web Developer Site
* [Bootstrap](https://getbootstrap.com/) - Bootstrap is a free and open-source CSS framework

## Authors

* *Eugenio Espinoza* - Initial work - [egitweb](https://github.com/egitweb)

## License

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


text:
[![jRuby Version](http://img.shields.io/badge/Ruby-2.2.2-blue.svg)](http://jruby.org/2015/07/09/jruby-9-0-0-0-rc2.html)
[![Gem Version](http://img.shields.io/gem/v/tdl-client-ruby.svg)](https://rubygems.org/search?query=tdl-client-ruby)
[![Codeship Status for julianghionoiu/tdl-client-ruby](https://img.shields.io/codeship/1072db10-0fc1-0133-f3de-1e6fe7bb1028.svg)](https://codeship.com/projects/91966)
[![Coverage Status](https://coveralls.io/repos/julianghionoiu/tdl-client-ruby/badge.svg?branch=master&service=github)](https://coveralls.io/github/julianghionoiu/tdl-client-ruby?branch=master)

# tdl-client-ruby

### Submodules

Project contains submodules as mentioned in the `.gitmodules` file:

- broker
- tdl/client-spec (gets cloned into features/spec)
- wiremock

Use the below command to update the submodules of the project:

```
git submodule update --init
```

### Getting started

Ruby client to connect to the central kata server.

### Installing

#### Install RBENV
```bash
brew install rbenv

# Then add this to bash_locations
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
```

#### Install ruby
```bash
rbenv install 3.2.2
rbenv local 3.2.2
ruby --version
```

#### Install bundler
```bash
gem install bundler
```

#### Install cucumber
```bash
gem install cucumber
```

#### Install all the gems in the project
```bash
bundle install
```

#### Manual

Stopping the wiremocks and broker services would be the same, using the `stop` command instead of the `start` command.

#### Automatic (via script)

Start and stop the wiremocks and broker services with the below:

```bash
./startExternalDependencies.sh
```

```bash
./stopExternalDependencies.sh
```

### Testing

All test require the ActiveMQ broker to be started.
The following commands are available for the broker.

```
java8
python3 ./broker/activemq-wrapper.py start
python3 wiremock/wiremock-wrapper.py start 41375
python3 wiremock/wiremock-wrapper.py start 8222
```

or

```bash
./startExternalDependencies.sh
```

Run tests with:
```
bundle exec rake features
```
To run a single scenario execute `cucumber path/to/file.feature:line_no`
Recommendation is to use the cucumber command instead of rake always outside of CI.

### Cleanup

Stop external dependencies
```
java8
python3 ./broker/activemq-wrapper.py stop
python3 wiremock/wiremock-wrapper.py stop 41375
python3 wiremock/wiremock-wrapper.py stop 8222
```

or

```bash
./stopExternalDependencies.sh
```

## To release

Check the version in:
```
lib/tdl/previous_version.rb
```

Build Gem
```
bundle exec rake build
```

Push to Rubygems
```
bundle exec rake release
```

Manually update the version in:
```
lib/tdl/previous_version.rb
```

repository: julianghionoiu/tdl-client-ruby

gha_language: Ruby

repo_name: julianghionoiu/tdl-client-ruby


text: Let's Encrypt is a free, automated, and open certificate authority (CA), run for the public's benefit. It is a service provided by the [Internet Security Research Group (ISRG)](https://www.abetterinternet.org/).

repository: bep/hugo

repo_name: bep/hugo


text:
# Extron Switcher

Plugin for Extron Switchers via IP.

Tested against:

- SW4/6/8

## Features

- Switcher crosspoints
- Get signal presence
- Get autoswitch mode
- Edit device name
- Toggle front panel lock
- AV mute
- Video mute
- Audio mute
- Sync mute

repository: pkrcel/q-sys-plugin-extron-switcher

repo_name: pkrcel/q-sys-plugin-extron-switcher


text:
# Assembly Logger policy ![alt text](https://api.travis-ci.org/ChrisPhillips-cminion/APIConnect-Policy-AssemblyLogger.svg?branch=master "status")

When you design and develop custom integration policies, you need to be alerted to any problems with your policies. By defining a custom logging policy to log the values of context variables, you can be quickly alerted to where policies might be malfunctioning so that you can correct any errors.

This tutorial describes a user-defined policy to assist with logging and error diagnosis in the API Connect assembly tool. In this policy, custom strings or context variables can be written directly to IBM® DataPower® logs at any point when running an API. By defining such policy, messages can be written at any priority level. And, when you combine API Connect with the capability of DataPower to selectively listen at different priorities, you get straightforward yet powerful logging and diagnosis when designing an API.

Read More - [Developer Works Link](https://www.ibm.com/developerworks/library/mw-1610-phillips-trs/index.html?ca=drs-)

## Build
To build this policy Run
```
sh build.sh . writeToDatapowerLog
```

This will generate the zip file in the out directory.

gha_language: XSLT


text:
# DBNostalgia Library for C#

Today practically everyone is working with ORMs. They come with a strong punch and immediate fast development if you know how to use them, but we usually have the issues with them.

DBNostalgia brings in another alternative. Say you want to work with your own stored procedures, but usually ORMs are very difficult to combine with them. Many times you are missing capabilities like execution plan caching and having an easier time performance tuning your database.  Maybe in your company you just can't have a project without stored procedures.

Using ADO.NET can be very cumbersome and there is a LOT to care for which should be unnecesary. While there are many ways to work with ADO.NET, DBNostalgia provides an opinionated open source idea on how to work against your database using your very own stored procedures. Want to use models? Not a problem. Do you just want to read a single value? Fine! You just want to run a god d***** procedure, then just do it.

I will be expanding the Examples section while I continue shipping new features and improvements. It is my first NuGet package so expect some breaking changes here and there. I will be documenting everything here.

## Understanding what DBNostalgia aims for

These are possible issues you face with ORMs today:

* SELECT statements tend to be non-ideal or under-perform
* LinQ statements (or any similar functional programming-similar practices on other languages) are a two edged sword, usually ending in bad performance for the most inexperienced engineers.
* And of course, being clouded with ORM options from the get-go, many young software engineers are not faced with the challenge of learning a sql language for the database they are using underneath.
* If you want to tune performance to the extreme, you will have a hard time doing that with an ORM. Each ORM has different limitations though.
* If you need to run truly dynamic queries, usually ORMs (tied to your models in classes) will not provide this capability.
* Usually ORMs are not tied to stored procedures, and if you want to make stored procedures work with them (say you do have support) it is usually a bit of a hassle to configure.
* You miss out execution plan caching.
* You depend on how the ORM handles your requests.
* Many times you need to hidrate data just to change one column or something very small.
* Working with collections within collections can be extra cumbersome and many times, always ineffective or inefficient.
* Why stored procedures? There are many things to consider as differences between stored procedures and queries. You can check that in a different section from this readme.

Don't get me wrong. ORMs are great in many ways and by no means you should abandon the idea if you are aligned to my way of doing things. ORMs can work very well, especially in fresh green pasture projects where you know what you need and what you want. Also, you can be completely independent of the database technology choice, and let the ORM handle the differences in sql scripting languages.

You must also consider that usually working against an ORM feels more like a framework than a library, as you will tie your design to your ORM choice. I am not a fan of EntityFramework for example, but I have to agree the name is exactly what it is. It is a framework, and you are marrying it. I can't imagine simple bridge or proxy patterns that would allow you to easily decouple your application from EntityFramework's implementation.

DBNostalgia intends to bring a different approach. It is not an ORM, it is not a framework, it is not model-based (but it works with models), and is stored procedure centered.

## Getting Started

### Prerequisites

* Currently working for .NET 4.6.1. I will be lowering this target gradually.
* No dependencies yet, but there is functionality here which I will move to independent NuGet packages.

## Connecting to the database and starting to work

It is pretty simple. Start by creating your unit of work object.

```
Func<IDbConnection> createDbClosure = () => new SqlConnection(aConnectionString);

var uow = new UnitOfWork(createDbClosure);

uow.NonQueryDirect("someSp");
```

Let's explain each part. UnitOfWork is expecting a closure that will produce a IDbConnection object. This means you need to provide how the IDbConnection is going to be built. This way, you have 100% control of how connections are used. What UnitOfWork will do with this is calling your procedure when it needs to open a connection.

Wish to always re-use the same connection?  Just send the closure that UnitOfWork needs to be able to point to your connection when the time comes.

After we created our object, uow.NonQueryDirect did the following:
* Used your closure to create a connection
* Connected to your database
* Ran the stored procedure "someSp" without any parameters.

This is the most simple scenario.

You can use UnitOfWork wherever you want. I generally recommend to have one unit of work per repository class, if you prefer to use that pattern.

If you wish to know what else you can do, take a look at the Examples section!

### Small note

UnitOfWork will have no problem working in scenarios like Web applications, but keep in mind you are telling UnitOfWork how to get the IDbConnection to use. Consider things like multi-threading and such just like you would in any other library.

Again, just remember that UnitOfWork uses a connection object, so using the same UnitOfWork in a multi-threaded scenario is not recommended. That is a pending feature, but UnitOfWork is not memory heavy nor using the same connection in multi-threading is within DBNostalgia scope right now. However I can envision that just being another class that inherits from IUnitOfWork but has a different behavior and management.

## Examples

For every example we will assume there is a this.UnitOfWork object alive. You can see how to create your unit of work from the Getting Started section.

Keep in mind that the ParametersBuilder class is it's own thing, and will eventually be moved to it's own nuget package. ParametersBuilder is a mix between a Builder and a Visitor pattern. It will allow you to quickly setup parameters for IDbCommand objects, and then visit them to hidrate the Parameters properly when needed.

### NonQueryDirect

NonQueryDirect is a method that will allow you to run stored procedures that produce no result.
Or perhaps they do, but you do not care.

First, let's simply run a stored procedure called "execution_noParams". As you can guess, this one has no parameters.

```
this.UnitOfWork.NonQueryDirect("execution_noParams");
```

By using NonQueryDirect, the connection was automatically opened without transaction. You will see how to run within a transaction later on in the Run() section.

Now let's run another stored procedure called "MyModel_delete" which receives an ID parameter.

```
var id = 100;
this.UnitOfWork.NonQueryDirect("MyModel_delete", ParametersBuilder.With("id", id));
```

Here we called "MyModel_delete" with parameter @id = 100.

### ScalarDirect

ScalarDirect is a method that will allow you to run a stored procedure and do what usually ExecuteScalar does. Read the value of the first row and first column (that is actually the real implementation). In other words, get a single value.

Let's run a stored procedure "scalar_noParams"

```
var result = this.UnitOfWork.ScalarDirect("scalar_noParams");
```

Here we have opened the connection, executed "scalar_noParams" and obtained the result. That result is on the "result" variable which is of type object. If you wish to read this as a particular type, you need to cast or convert as you prefer.

If you wish to use parameters, like in every example, we simply use ParametersBuilder.

```
var result = this.UnitOfWork.ScalarDirect("scalar_withParams",
    ParametersBuilder.With("stringParam", "string value")
    .And("intParam", 1000)
    .And("bitParam", true)
);
```

There is a library of my own I use called ObjectExtensions, which is not yet in NuGet. I will first add it to DBNostalgia and then move it to NuGet as a separate dependency eventually. These allow you to perform very fast transformations, for example we can change the above example to read like an integer.

```
var integerResult = this.UnitOfWork.ScalarDirect("scalar_noParams").AsInt();
```

That will stay optional anyway, so do not worry if you do not like this approach.

### GetOneDirect

GetOneDirect is a method that will run a stored procedure, open an IDataReader internally and allow you to read all the data from that first row. You can turn the data into a model, or just do whatever you want with it.

Let's run a stored procedure "MyModel_get" with an ID parameter. We will create an object of class MyModel during this execution.

```
var id = 22;

var model = this.UnitOfWork.GetOneDirect(
    "MyModel_get",
    (reader) => {
        return new MyModel
        {
            Property1 = reader.GetString("Property1"),
            Property2 = reader.GetInt32("Property2"),
            Property3 = reader.GetBool
        }
    },
    ParametersBuilder.With("id", id)
);
```

## Pending ideas/features

### Behavior changes

* Allow template method injection for you to control what happens on every action called.
* Extensibility through interfaces and composition for greater customization
* Should I be targetting 4.6.1? Figure out if there is a way to easily find what is the lesser version my code can support without changing any code.

### Structure changes

* Consider moving IDataReader extensions and ParametersBuilder to their own nuget packages and repos
* Provide more data types on IDataReaderExtensions
* Add a GetBytesNullable to IDataReaderExtensions

### Quality Changes

* Usage of ObjectExtensions for faster conversions.
* Move ObjectExtensions to its own nuget package.
* Additional Unit testing (classes EnumerableExtensions, IDataReaderExtensions, UnitOfWork)
* Should the Direct vs "NonDirect" (bad names) behaviors instead become different implementations/classes under the same interface? Making sure the user (developer) receives an easy-to-use library that is clear on what is its intent. This change might prove a bit difficult because of the interface we want to provide.

## Pending sections

* Advantages
* Disadvantages

# Changelogs

## Changelog 2018-09-18
* Such a bad luck! There was a nasty bug that rendered the whole library unusable. This happened because I kept pushing unit testing for another day. Bug is fixed.
* Added integration testing for the UnitOfWork class. I will be adding more testing the more I develop. These tests prove enough operations.
*

## Changelog 2018-09-17
* Added GetOne and GetOneDirect methods.
* Added NuGet configuration and icon
* Finally published to NuGet.org! Now it's time to make this worth the download.

## Changelog 2018-09-11

### Internal changes
* Moved project to GIT
* Made necessary refactoring to reduce code
* Migrated IDataReaderExtensions and ParametersBuilder to this project.
* Added XML comments to all public interfaces.


text:
# rubyfy-smalltalk
Modify the cuis smalltalk parser to accept `?` and `!` in the selectors the same way Ruby does

![example](https://i.imgur.com/9Qa8soU.png)

repository: gstn-caruso/rubyfy-smalltalk

repo_name: gstn-caruso/rubyfy-smalltalk


text:
# Notes on the design of a simple spatial sampling method (S3M) for assessing coverage of health and nutrition programmes in Liberia <img src="figures/s3m_neg.png" align="right" />

[![Build Status](https://travis-ci.org/validmeasures/liberiaS3M.svg?branch=master)](https://travis-ci.org/validmeasures/liberiaS3M)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/validmeasures/liberiaS3M?branch=master&svg=true)](https://ci.appveyor.com/project/validmeasures/liberiaS3M)
[![DOI](https://zenodo.org/badge/137984397.svg)](https://zenodo.org/badge/latestdoi/137984397)

The **Simple Spatial Survey Method (S3M)** was developed from the CSAS coverage survey method as a response to the widespread adoption of community management of acute malnutrition (CMAM) by ministries of health. Large-scale programs need a large-scale survey method and S3M was developed to meet that need.

**S3M** was designed to :

* Be simple enough for MoH, NGO, and UNO personnel without specialist statistical training to perform.

* Provide a general survey method. S3M can be used to survey and map:

    * Need for and coverage of selective-entry programs such as CMAM and TSFP as well as universal programs such as EPI, GMP, GFD (general ration), and “blanket” SFP over wide areas.

    * Levels of indicators such as those for IYCF, WASH, and period prevalence / cumulative prevalence of ARI, fever, and diarrhoea over wide areas.

This document concentrates on using S3M to assess the need for and coverage of:

* Treatment of SAM in children aged between 6 and 59 months;

* Vitamin A supplementation;

* Micronutrient powder supplementation;

* Ferrous sulfate-folic acid supplementation; and,

* Infant and young child feeding counselling.


text:
# CachedMechanize

is a small wrapper around [Mechanize](https://github.com/sparklemotion/mechanize) to enable caching for GET requests.

## Installation

Add this line to your application's Gemfile:

    gem 'cached_mechanize2'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install cached_mechanize2

## Usage

Right now there is only a file based caching backend. There might follow more in the future (redis, etc.).

To configure the backend use this syntax:

    CachedMechanize.configure do |config|
      config.cache_class = CachedMechanize::CacheBackends::FileCache
      config.cache_options = {
        :path => "/path/to/my/cached_files"
      }
    end

Now you can use this class like you would use Mechanize:

    agent = CachedMechanize.new
    doc = agent.get('http://www.imdb.com')

## Quick deviation from original code

The original author 'wukerplank' added some code to control cache time-out, but I dont need this and I discovered that the overloading and change of syntax from current version mechanize's 'get'  command seemed to cause errors in running, and the link click function stopped working, so i left the expire time in as a hard coded value and returned the 'get' method signature back to normal.

Here is what is now removed, and can be ignored (easy to fiddle with the code if you need this)

    By default all retrieved pages will be cached for one day (86400 seconds). To change this behaviour you can provide an `expires_after` option:

        doc = agent.get('http://www.imdb.com', expires_after: 42)

    Note that the syntax has changed! If you want to provide parameters, additional headers or a referer, you can do it like this:

        doc = agent.get('http://www.imdb.com', {
        referer: 'http://thatothersite.com',
        expires_after: 42
        })

## Troubleshooting

Im pretty new to making a GEM and it was not working on my mac when I downloaded it for testing, so instead I put the whole project folder as a sub-folder in my project folder and included the code like this:

    require './cached_mechanize2/lib/cached_mechanize'

Let me know if I did something wrong in the gem or if its just the way my Mac is configured!

I did this to create the gem:

    gem build cached_mechanize2.gemspec

    gem push cached_mechanize2-0.1.1.gem


text:
# Get searchresults from a Google Custom Search Engine

[![Build status](https://img.shields.io/travis/freekmurze/googlesearch.svg)](https://travis-ci.org/freekmurze/googlesearch)
[![Latest Version](https://img.shields.io/github/release/freekmurze/googlesearch.svg?style=flat-square)](https://github.com/freekmurze/googlesearch/releases)
[![SensioLabsInsight](https://img.shields.io/sensiolabs/i/9d5bf74c-2cc0-42bd-9800-5be2c2f034b7.svg)](https://insight.sensiolabs.com/projects/9d5bf74c-2cc0-42bd-9800-5be2c2f034b7)
[![Quality Score](https://img.shields.io/scrutinizer/g/freekmurze/googlesearch.svg?style=flat-square)](https://scrutinizer-ci.com/g/freekmurze/googlesearch)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
[![Total Downloads](https://img.shields.io/packagist/dt/spatie/googlesearch.svg?style=flat-square)](https://packagist.org/packages/spatie/googlesearch)

This package can fetch results from a Google Custom Search Engine. It returns an array with searchresults.
You'll need to know [how to set up a Google Custom Search Engine](https://support.google.com/customsearch/answer/2630963?hl=en).

## Installation

This package can be installed through Composer.

```bash

composer require spatie/googlesearch

```

When using Laravel there is a service provider that you can make use of.

```php

// Laravel 5: config/app.php

'providers' => [
    '...',
    'Spatie\GoogleSearch\GoogleSearchServiceProvider'
];
```

GoogleSearch also comes with a facade, which provides an easy way to call the the class.

```php

// Laravel 5: config/app.php

'aliases' => array(
	...
	'GoogleSearch' => 'Spatie\GoogleSearch\Facades\GoogleSearch',
)
```

You can publish the config file of the package using artisan

```bash
php artisan vendor:publish --provider="Spatie\GoogleSearch\Facades\GoogleSearch"
```

This command creates a file within your config directory in which you can specify the id of the Custom Search Engine you want to use.

## Usage

Here is a sample call to get search results:

```php
/*
  This function returns an array with keys

  "name"     // the name of the found page
  "url"      // the url of the found page
  "snippet"  // a little piece of text found on the page
*/

$searchResults = GoogleSearch::getResults('The meaning of life'); // is 42
```

When no results are found an empty array is returned.

repository: MatthiasDeWinter/googlesearch

repo_name: MatthiasDeWinter/googlesearch


text:
# #### Prerequisites
1. Ruby > 2.4.0
2. Jekyll and bundler gems

MacOS setup:
```
brew install ruby
export PATH=/usr/local/opt/ruby/bin:$PATH
gem install bundler jekyll
```
#### Build and Run
```
bundle install
bundle exec jekyll serve
```

gha_language: SCSS


text:
# DateSettings

Date settings for a FastStats system
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**use_iso8601_week_of_year** | **bool** | Whether the FastStats system uses ISO 8601 date and time format |
**business_year_start_dd** | **int** | If defined, the day of the month that the \"Business year\" starts on.  For example, the UK tax year  starts on the 6th April, so this property would have a value of 6. | [optional]
**business_year_start_mm** | **int** | If defined, the month of the ywear that the \"Business year\" starts on.  For example, the UK tax year  starts on the 6th April, so this property would have a value of 4. | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

repository: Apteco/apteco-api

repo_name: Apteco/apteco-api


text:
---
layout: project
permalink: projects/:title/
category: projects

meta:
  keywords: "Programming, Hardware"

project:
  title: "Cloudy"
  type: "Interactive"
  url: "https://www.openprocessing.org/sketch/811032"
  logo: "/assets/images/projects/cloudy/logo.png"
  tech: "Arduino, Adobe Illustrator, Adobe Photoshop, P5.js"
  year: "2019"

images:
  - image:
    url: "/assets/images/projects/cloudy/controller.png"
    alt: "Physical Controller"
  - image:
    url: "/assets/images/projects/cloudy/play.png"
    alt: "Openprocessing Play"
---

The purpose of this project was to reimagine game controllers in an intuitive way. The player interacts with an ultrasonic sensor to control Cloudy's position, the game features mouse & keyboard mode and 2 player.

Links

 Demo


text:
---
title: "The Miranda Requirements"
date: "2020-10-22T00:42:37.121Z"
description: "Flashcard question about the Miranda Requirements."
type: "flashcard"
question: "What are the Miranda requirements?"
---

Miranda required the warnings and other protective measures whenever there is "questioning initated by law enforcement officers after a person has been taken into custody or otherwise deprived of his freedom of action in a significant way." 384 U.S. at 443 (emphasis added).

- "the coercion inherent in custodial interrogation bulurs the line between voluntary and involuntary statements, and thus heightens the risk that an individual will not be 'accorded his privilege under the Fifth Amendment . . . not to be compelled to incriminate himself.'" Dickerson v. United States, 530 U.S. 428 (2000) (quoting Miranda v. Arizona, 384 U.S. 436, 439 (1966)).
- "The defendant may waive effectuation of these rights, provided the waiver is made voluntarily, knowingly and intelligently."

repository: tedrand/my-blog

repo_name: tedrand/my-blog


text:
---
layout: post
rel_link:  "9_3_16"
title:  "CMSSW_9_3_16"
date:   2019-09-11 08:02:59
categories: cmssw
relmajor: 9
relminor: 3
relsubminor: 16
---

# CMSSW_9_3_16
#### Changes since CMSSW_9_3_15_patch3:
[compare to previous](https://github.com/cms-sw/cmssw/compare/CMSSW_9_3_15_patch3...CMSSW_9_3_16)

1. [27902](http://github.com/cms-sw/cmssw/pull/27902){:target="_blank"}  from **@ohindrichs**: rebase of LHEJetFilter `generators`  created: 2019-08-30 08:08:52 merged: 2019-09-10 20:04:36

2. [27864](http://github.com/cms-sw/cmssw/pull/27864){:target="_blank"}  from **@danielwinterbottom**: backporting generator filter modifications to CMSSW_9_3_X `analysis`  `generators`  `simulation`  created: 2019-08-24 19:04:41 merged: 2019-09-10 20:03:24

#### CMSDIST Changes between Tags REL/CMSSW_9_3_15_patch3/slc6_amd64_gcc630 and REL/CMSSW_9_3_16/slc6_amd64_gcc630:
[compare to previous](https://github.com/cms-sw/cmsdist/compare/REL/CMSSW_9_3_15_patch3/slc6_amd64_gcc630...REL/CMSSW_9_3_16/slc6_amd64_gcc630)

1. [5049](http://github.com/cms-sw/cmsdist/pull/5049){:target="_blank"}  from **@mkirsano**: update lhapdfsets to 6.2.1a_1 created: 2019-06-19 16:40:28 merged: 2019-08-06 13:30:00

repository: cms-sw/ReleaseNotes

repo_name: cms-sw/ReleaseNotes


text:
[![build status](https://api.travis-ci.org/Locke/sbt-scalatest-coreasm.svg?branch=master)](https://travis-ci.org/Locke/sbt-scalatest-coreasm/)

# ScalatestCoreASMPlugin

## About

This SBT Plugin automatically generates ScalaTest files from CoreASM specifications.

## Usage

**This project isn't published yet! Currently you need to download, compile and install this repository on your own machine..**

Add `addSbtPlugin("de.athalis" % "sbt-scalatest-coreasm" % "0.1.0-SNAPSHOT")` to `project/plugins.sbt` to have this plugin available in sbt.

This plugin needs to be enabled on a desired project via `.enablePlugins(ScalatestCoreASMPlugin)`, usually in `build.sbt`. In a multi-project build that might look like this:

```scala
lazy val yourSubProject = (project in file("yourSubProject"))
  .enablePlugins(ScalatestCoreASMPlugin)
  .settings(
    // ...
  )
```

Create a folder named `coreasm` in the `test` folder of your project. In a multi-project build that would be `yourSubProject/src/test/coreasm`.

Place your CoreASM test files either directly in that folder, or create sub folders to group multiple test files together.

The ScalaTest source files are generated by the task `test-coreasm:generateCoreASMTests`, for example `sbt:root> yourSubProject/test-coreasm:generateCoreASMTests`.

This task is registered as sourceGenerator in the test build and therefore automatically called when tests are compiled. This means that you can just call the `test:compile` task, for example `sbt:root> yourSubProject/test:compile`.

Usually you could just execute the `test` task in sbt to a) generate the ScalaTest files b) compile them and c) execute them, for example it's sufficient to just execute `sbt:root> yourSubProject/test`.

## Settings

This Plugin uses customizable scoped settings:

* `sourceDirectory in TestCoreASM` sets the directory in which the CoreASM files are searched. Default: `src/coreasm`
* `sourceManaged in TestCoreASM` sets the directory where the generated ScalaTest files are stored. Default: `target/src_managed/test/coreasm`
* `includeFilter in TestCoreASM` sets which files are considered as CoreASM file. Default: `("*.casm" || "*.coreasm")`
* `excludeFilter in TestCoreASM` sets which files to ignore when searching for CoreASM files. Default: `HiddenFileFilter`
* `testCoreASMPackageName in TestCoreASM` sets the package name for the generated scalatest classes. Default: `de.athalis.sbt.testcoreasm.generated`

Note: this plugin sets `fork in Test := true` in your test scope, as the CoreASM Engine writes to System.out, which needs to be redirected in order to check the outputs of the execution.

## Examples

See the folder [sbt-test](scalatestCoreASM/src/sbt-test). It contains projects which are used for continuous testing.

The project [diningPhilosophers](scalatestCoreASM/src/sbt-test/scalatestCoreASM/diningPhilosophers) demonstrates that this plugin can be used in projects using scala 2.10, 2.11 and 2.12.

The project [customSettings](scalatestCoreASM/src/sbt-test/scalatestCoreASM/customSettings) demonstrates how to overwrite the settings of this plugin.

## How to write CoreASM test specifications

(Note: this section should be part of the CoreASM documentation)

A CoreASM test specification is a CoreASM specification annotated with required and refused outputs. They are written in comments and valid for the whole file

Additionally `maxsteps` can be set to limit the execution steps.

Example of a basic CoreASM test specification:

```CoreASM
CoreASM FooTest

use Standard

// @require "AAAA"
// @refuse "BBBB"
// @maxsteps 2

init Foo

rule Foo = {
  choose x in BOOLEAN do {
    if (x = true) then {
      print "AAAA"
    }
    else {
      print "BBBB"
    }
  }
}
```

## TODO

See [TODO](TODO.md).

repository: Locke/sbt-scalatest-coreasm

gha_language: Scala

repo_name: Locke/sbt-scalatest-coreasm