text:
pop-debug
=========

[![Build Status](https://github.com/popphp/pop-debug/workflows/phpunit/badge.svg)](https://github.com/popphp/pop-debug/actions)
[![Coverage Status](http://cc.popphp.org/coverage.php?comp=pop-debug)](http://cc.popphp.org/pop-debug/)

OVERVIEW
--------
`pop-debug` is a simple debugging component that can be used to hooked into an application to track
certain aspects of the application's lifecycle.

`pop-debug` is a component of the [Pop PHP Framework](http://www.popphp.org/).

INSTALL
-------

Install `pop-debug` using Composer.

    composer require popphp/pop-debug

BASIC USAGE
-----------

The debugger supports a number of handlers that can record various events during an application's lifecycle.
The provided handlers are:

- **ExceptionHandler**
    + Capture exceptions thrown by the application
- **MemoryHandler**
    + Capture memory usage and peak memory usage
- **MessageHandler**
    + Capture generic messages at various points in the application's lifecycle
- **LogHandler**
    + Capture standard log messages at various points in the application's lifecycle
- **QueryHandler**
    + Capture database queries and their parameters and information
- **RequestHandler**
    + Capture information about the current request
- **TimeHandler**
    + Trigger a timer to time the current request or a part of the request.

Also, the debugger supports a few storage methods to storage the debug data after the request is complete:

- File
- Database
- Redis

### Setting up the debugger

```php
use Pop\Debug;

$debugger = new Debug\Debugger();
$debugger->addHandler(new Debug\Handler\MessageHandler());
$debugger->setStorage(new Debug\Storage\File('log'));

$debugger['message']->addMessage('Hey! Something happened!');

$debugger->save();
```

The above code will save the following output to the `log` folder in a plain text file:

```text
1504213206.00000	Hey! Something happened!
```

### Setting up multiple handlers

You can configure multiple handlers to capture different points of data within the application:

```php
use Pop\Debug;

$debugger = new Debug\Debugger();
$debugger->addHandler(new Debug\Handler\MessageHandler())
    ->addHandler(new Debug\Handler\ExceptionHandler())
    ->addHandler(new Debug\Handler\RequestHandler())
    ->addHandler(new Debug\Handler\MemoryHandler())
    ->addHandler(new Debug\Handler\TimeHandler());
$debugger->setStorage(new Debug\Storage\File('log'));

$debugger['message']->addMessage('Hey! Something happened!');
$debugger['exception']->addException(new \Exception('Whoops!'));
$debugger['memory']->updateMemoryUsage();
$debugger['memory']->updatePeakMemoryUsage();

$debugger->save();
```

In the above example, if the debugger is exposed as a service throughout the application,
then you can access it and call those methods above for the individual handlers to capture
the things you need to examine.

### Storage formats

The storage object allows you to store the debug data in the following formats:

- Plain text
- JSON
- Serialized PHP

```php
use Pop\Debug;

$debugger = new Debug\Debugger();
$debugger->addHandler(new Debug\Handler\MessageHandler());
$debugger->setStorage(new Debug\Storage\File('log', 'json'));
```

### Log handler

The log handler is a special handler that ties into the `pop-log` component. It allows you
to capture standard log messages. You can set up the log handler like this:

```php
use Pop\Debug;
use Pop\Log;

$logger = new Log\Logger(new Log\Writer\File('log/system.log'));
$debugger = new Debug\Debugger();
$debugger->addHandler(new Debug\Handler\LogHandler($logger));
$debugger->setStorage(new Debug\Storage\File('log'));

$debugger['log']->info("Here's some info about what just happened!");
sleep(1);
$debugger['log']->alert("Hey you! I must alert you to something!");

$debugger->save();
```

So with the logger object attached to the debugger, the debugger can record the log entries
that are sent to the logger as well.

### Query handler

The query handler is a special handler that ties into the `pop-db` component and the
profiler available with that component. It allows you to capture any database queries
and any information associated with them.

You can set up the query handler like this:

```php
use Pop\Debug;
use Pop\Db;

$db = Db\Db::mysqlConnect([
    'database' => 'popdb',
    'username' => 'popuser',
    'password' => '12pop34'
]);

$queryHandler = $db->listen('Pop\Debug\Handler\QueryHandler');

$debugger = new Debug\Debugger();
$debugger->addHandler($queryHandler);
$debugger->setStorage(new Debug\Storage\File('log'));

// Run DB queries...

$debugger->save();
```

So with the query handler attached to the database adapter object, any and all queries
that are executed will be recorded by the debugger's query handler.

repository: popphp/pop-debug

repo_name: popphp/pop-debug


text:
# Woorank HTML Email Builder Workflow

Inspired by the work of Lee Munroe <https://github.com/leemunroe/grunt-email-workflow>.

- docker-compose build
- docker-compose run --rm email
- docker-compose run --rm email s3upload

# Credits

Mailgun email templates (https://github.com/mailgun/transactional-email-templates)

license: MIT

repository: copycut/transactional-email-builder

branch_name: refs/heads/master

extension: md

gha_language: HTML

license_type: permissive

repo_name: copycut/transactional-email-builder


text:
# Pandas-in-python
Pandas stands for “Python Data Analysis Library”.Pandas is quite a game changer when it comes to analyzing data with Python and it is one of the most preferred and widely used tools in data munging/wrangling if not THE most used one.

Pandas is an open-source, BSD-licensed Python library providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language. Python with Pandas is used in a wide range of fields including academic and commercial domains including finance, economics, Statistics, analytics, etc.

## Pandas Operations :
### 1. Slicing The DataFrame
### 2. Changing the index
### 3. Data Conversion
### 4. Joining & Merging
### 5. Concatenation
### 6. Changing the Column headers
### 7. Data Munging :
### 8. Merging DataFrame
Convert a particular format of data into a different format( If you have a CSV file data,you can convert it to HTML or any other format    as well

#  Python For Statistics

### 1. Mean :
### 2. Median :
- High Median
- Low Median
### 3. Mode :
### 4. Variance :

repository: cavidparker/Pandas-in-python

repo_name: cavidparker/Pandas-in-python


text:
### Planyo ESB Connector
The Planyo connector allows you to access the Planyo REST API through the WSO2 ESB. Planyo is an online booking system for any kind of resources such as tennis courts, hotels, holiday apartments, appointments, events, etc.

###Build
mvn clean install

###How You Can Contribute
You can create a third party connector and publish in WSO2 Connector Store.
https://docs.wso2.com/display/ESBCONNECTORS/Creating+a+Third+Party+Connector+and+Publishing+in+WSO2+Connector+Store

gha_language: Java


text:
pyndri-flask
============

pyndri-flask is an example application that demonstrates how [pyndri](http://github.com/cvangysel/pyndri) can be used to serve an Indri index using [Flask](http://github.com/cvangysel/pyndri).

<img src="screenshot.png?raw=true" width="500px" alt="Screenshot of pyndri-flask showing the search box and retrieval model configuration." />

It can be used as the basis for a search engine or as a convenient way to navigate an index for Information Retrieval research.

Requirements
------------

pyndri-flask has the same requirements as [pyndri](http://github.com/cvangysel/pyndri) and it is advised to first follow the instructions to install pyndri before attempting to install pyndri-flask.

You will also need to install Flask:

	pip install Flask==0.12.2

Getting started
---------------

After installing Flask, pyndri-flask can be started as follows. First, change your current working directory to the repository root and then execute:

	INDEX_PATH=<PATH TO INDRI INDEX> \
	FLASK_APP=app flask run -h <IP_ADDRESS> -p 8888

This will start an instance of pyndri-flask that listens to port 8888 on all network interfaces configured on your machine. It will return results of the index referenced by `INDEX_PATH`.

Citation
--------

If you use pyndri to produce results for your scientific publication, please refer to our [ECIR 2017](https://arxiv.org/abs/1701.00749) paper.

	@inproceedings{VanGysel2017pyndri,
	  title={Pyndri: a Python Interface to the Indri Search Engine},
	  author={Van Gysel, Christophe and Kanoulas, Evangelos and de Rijke, Maarten},
	  booktitle={ECIR},
	  volume={2017},
	  year={2017},
	  organization={Springer}
	}

License
-------

pyndri-flask and pyndri are licensed under the [MIT license](LICENSE). Please note that [Indri](http://www.lemurproject.org/indri.php) is licensed separately. If you modify pyndri-flask in any way, please link back to this repository.

repository: cvangysel/pyndri-flask

repo_name: cvangysel/pyndri-flask


text:
Of a given field, a field containing it.

Write $ L/K $ to mean “L extends K”; we say that $ L $ is a finite
extension if its dimension as a vector space over $ K $ is finite. If it
is also separable, then in fact $ L=K( \alpha ) $ for some
$  \alpha  \in L $ (the theorem of the primitive element). The field
$ K $ may be referred to as the base field of $ L $ .


text:
# Lycoperdon globosum Bolton, 1790 SPECIES

#### Status
ACCEPTED

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

#### Published in
Hist. fung. Halifax (Huddersfield) 3: 118, pl. 118 (1790)

#### Original name
Lycoperdon globosum Bolton, 1790

### Remarks
null

repository: mdoering/backbone

repo_name: mdoering/backbone


text:
---
layout: post
theme: XiXiuTi
series:
  url: angular
  title: Angular
title: Reactive Forms
excerpt: ""
modified: 2018-03-26T18:00:00-00:00
categories: articles
tags: [Reactive, Observable, Angular, TypeScript, JavaScript]
image:
  vendor: twitter
  feature: /media/DYl7ulJX0AA2r2y.jpg:large
  credit: Nat Geo Photography
  creditlink: https://twitter.com/NatGeoPhotos/status/975446838034817024
comments: true
share: true
references:
  - id: 1
    title: "Angular guide - HttpClient"
    url: "https://angular.io/guide/http"

---

* TOC
{:toc}

> Angular reactive forms facilitate a **reactive style** of programming that favors explicit management of the data flowing between a non-UI **data model** (typically retrieved from a server) and a UI-oriented **form model** that retains the states and values of the HTML controls on screen. Reactive forms offer the ease of using reactive patterns, testing, and validation.
>
> The component must copy the hero values in the data model into the form model. There are two important implications:
* The developer must understand how the properties of the data model map to the properties of the form model.
* User changes flow from the DOM elements to the form model, not to the data model.
> The form controls never update the data model.

## Import Reactive Forms Module

Registering the reactive forms module

```typescript
import { ReactiveFormsModule } from '@angular/forms';

@NgModule({
  imports: [
    // other imports ...
    ReactiveFormsModule
  ],
})
export class AppModule { }
```

// TODO

https://netbasal.com/angular-reactive-forms-tips-and-tricks-bb0c85400b58

branch_name: refs/heads/gh-pages

gha_language: SCSS

gha_license_id: MIT


text:
**WORK IN PROGRESS**

3d-camera-core
==============
A common interface for 3D cameras.  This module is a caching layer for maintaining coordinate system transformations and computing camera properties from a set of generating matrices. This module is intended to be used as a common interface and should not be required directly.

### Notes on coordinates

By convention, we will define 4 different 3 dimensional projective homogeneous coordinate systems:

* **Data coordinates**: The coordinates used by models and 3D data
* **World coordinates**: A common coordinate system for all objects within the scene
* **Camera coordinates**: The coordinate system in the world where the camera is at the center
* **Clip coordinates**: The device clip coordinate system

These coordinates are related by a set of three homogeneous 4x4 matrices:

* **Model matrix**: Maps data coordinates to world coordinates
* **View matrix**: Maps world coordinates to camera coordinates
* **Projection matrix**: Maps view coordinates to device clip coordinates

The goal of this module is to maintain the relationships between these coordinate systems as matrices and to define a standard interface for renderable objects which need to consume camera information.  Implementors should take this module and hook up whatever methods they want to compute the model/view/projection matrices, while users can then treat the resulting camera interface as a black box handling the various coordinate system conversions.

# User side

For most users of this module, you only need to worry about the stuff in this section.

## User example

```javascript
//You should call some other module to create a camera controller
var myCamera = createCameraType()

//Once you have a camera, then you can access the coordinate conversions directly
var dataToClip = myCamera.data.toClip

//You can also access the origin of the camera in any coordinate system too
var eyePosition = myCamera.world.origin
```

## User API

The overall goal of this module is to keep track of conversions between a number of different coordinate systems.  Because multiplying and recalculating these conversions is expensive, this module caches this data for future use.  After a camera object has been created, no further memory allocations are performed.

### Coordinate system conversions

The most basic function of this module is to provide a convenient syntax for getting whatever camera transformations you need.

#### `coords.toClip`
A 4x4 matrix representing the conversion from `coords` into clip coordinates.

#### `coords.toCamera`
A 4x4 matrix representing the conversion from `coords` into camera coordinates.

#### `coords.toWorld`
A 4x4 matrix representing the conversion from `coords` into world coordinates

#### `coords.toData`
A 4x4 matrix representing the conversion from `coords` into data coordinates.

### Origin

#### `coords.origin`

The position of the camera in the coordinate system.

# For implementors

A camera implementation should provide one or more "controllers" for each of the model, view and projection matrices.  Each controller is an object with two methods; one which tests if the controller has changed and one which reads out the state of the matrix for the controller.

## Implementation example

```javascript
var createCamera = require('3d-camera-core')

//A simple implementation of a camera controller
function simpleController() {
  var data = [1,0,0,0,
              0,1,0,0,
              0,0,1,0,
              0,0,0,1]
  var isDirty = false
  return {
    dirty: function() {
      return isDirty
    },
    get: function(m) {
      isDirty = false
      for(var i=0; i<16; ++i) {
        m[i] = data[i]
      }
    },
    set: function(m) {
      isDirty = true
      for(var i=0; i<16; ++i) {
        data[i] = m[i]
      }
    }
  }
}

//Create a set of controllers for the camera object
var controllers = {
  model: simpleController(),
  view: simpleController(),
  projection: simpleController()
}

//Return camera
var camera = createCamera(controllers)
```

## Implementor API

### Constructor

#### `var camera = createCamera(controllers)`

This creates a new camera object with the given controllers.  `controllers` is an object with the following properties:

* `controllers.model` a controller for the model matrix
* `controllers.view` a controller for view matrix
* `controllers.projection` a controller for the projection matrix

**Returns** A new camera object

### Controller interface

Each controller is an object which provides two methods:

#### `controller.dirty()`
This method should test if the state of the controller has changed since the last time `controller.get()` was called.  If it has, then the matrix value will be recomputed.

**Returns** `true` if the camera matrix has changed, otherwise `false`

#### `controller.get(matrix)`
This retrieves the state of the controller's matrix.  The result should be written into `matrix`

### Methods

#### `camera.setController(matrix, controller)`

Replaces the controller on the camera for `matrix` with `controller`.

* `matrix` is the name of the matrix, which is either `model`, `view` or `projection`
* `controller` is the new controller for the matrix

# Legal

(c) 2015 Mikola Lysenko.  MIT License


text:
# gin-limit
Stay under the limit with this handy Gin middleware.

## Purpose
By default, [http.ListenAndServe](https://golang.org/pkg/net/http/#ListenAndServe) (which [gin.Run](https://github.com/gin-gonic/gin/blob/9e930b9bdd5a29bac38fb491ffac4e7ea84b825d/gin.go#L221) wraps) will serve an unbounded number of requests.  Limiting the number of simultaneous connections can sometimes greatly speed things up under load.  Inspired by [x/net/netutil.LimitListener](https://godoc.org/golang.org/x/net/netutil#LimitListener).

## Example
```go
package main

import (
  "github.com/aviddiviner/gin-limit"
  "github.com/gin-gonic/gin"
)

func main() {
  r := gin.Default()
  r.Use(limit.MaxAllowed(20))
  // ...
  r.Run(":8080")
}
```

## Lies, damned lies and statistics
Everyone loves synthetic benchmarks, so have some numbers from my 2015 Macbook (on a fast rendering page; single sqlite query, basic templates).

    % wrk -t12 -c400 -d20s http://localhost:4560/
    Running 20s test @ http://localhost:4560/
      12 threads and 400 connections
      Thread Stats   Avg      Stdev     Max   +/- Stdev
        Latency   848.63ms  525.39ms   1.64s    62.81%
        Req/Sec    45.43     61.85   360.00     90.50%
      8908 requests in 20.10s, 21.91MB read
      Socket errors: connect 0, read 219, write 0, timeout 0
    Requests/sec:    443.19
    Transfer/sec:      1.09MB

Now 10x faster with `limit.MaxAllowed(3)` (although that would be higher in the real world).  Hooray!

    % wrk -t12 -c400 -d20s http://localhost:4560/
    Running 20s test @ http://localhost:4560/
      12 threads and 400 connections
      Thread Stats   Avg      Stdev     Max   +/- Stdev
        Latency    94.40ms   32.65ms 656.72ms   86.44%
        Req/Sec   351.61     84.32   666.00     79.32%
      84181 requests in 20.09s, 207.05MB read
      Socket errors: connect 0, read 165, write 0, timeout 0
    Requests/sec:   4189.75
    Transfer/sec:     10.30MB

repository: letseeqiji/gorobbs

gha_language: Go

repo_name: letseeqiji/gorobbs


text:
---
title: o[wordpress] Profi.Filter Custom Fields & Taxonomies
author: PipisCrew
date: 2016-03-17
categories: [php]
toc: true
---

You will be able to create search filter for your WordPress blogposts with ease! Just use the taxonomies and custom field values, you have already in use to create amazingly detailed search filters.

**Fulltext Search** - You can implement a fulltext search, which searches exactly the content, you want. Decide yourself, if you want to extend the search to specific custom fields, the title, the content and so on.

Select Box, Checkboxes, Radioboxes - Use these features, to place form fields, by which your visitor can restrict the search to specific terms or meta data values.

[https://wordpress.org/plugins/filter-custom-fields-taxonomies-light/](https://wordpress.org/plugins/filter-custom-fields-taxonomies-light/)

[http://codecanyon.net/item/filter-custom-fields-taxonomies/6964843](http://codecanyon.net/item/filter-custom-fields-taxonomies/6964843)

origin - http://www.pipiscrew.com/?p=4455 wordpress-profi-filter-custom-fields-taxonomies


text:
# Population in Medellín : projections and demographics

Open Data from the Colombian government gives great insight about the evolution of population in the different Comunas of Medellín and a good idea of the demographics in these neighborhoods.

## Getting Started

The vizualisation is available at https://mwnmhn.github.io .

## Prerequisites

A recent internet browser that supports JavaScript to open the visualization.

```
Google Chrome, Mozilla Firefox, Opera, even Edge.
```

## Technologies Used

d3v5, javascript

### Screenshot :
![alt text](https://github.com/mwnmhn/mwnmhn.github.io/blob/master/index.png)

## Authors

* **Marwan Mehenni** - [Twitter](https://twitter.com/MarwanMhn) / [LinkedIn](https://www.linkedin.com/in/marwan-mehenni-230155153/)

## License

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

## Acknowledgments

* This project was developed for the Visual Analytics class at the University of Los Andes, Bogota D.C. , Colombia. September 2018


text:
#Reference genomes

##Can I have multiple reference genomes?

No.  However, you can add multiple assemblies to the asm directory.  Assemblies don't have the same error profile as reads and so you might expect some skew in the ultimate phylogeny.

##How do I choose a reference genome?

The best reference genome for an outbreak is something in-clade.  You might even need to assemble the genome from your own reads before starting.  An outgroup is not as related to your clade by definition and so it is probably not the best genome to use.  The next best quality is a closed genome, or a genome with a high N50.

#My custom input files

##How do I include an SFF file?

There currently is no way to use an SFF file directly.  These usually come from 454 or Ion Torrent and therefore have a different error profile than Illumina.  Therefore, you might observe some bias if you mix these chemistries.

* You can convert your SFF files to fastq using a variety of tools.  Some of these include `sffinfo` from the Newbler package, Flower, or sff2fastq.
* You can also manually map the reads yourself.  This could be a good option, but it could introduce some bias from the mapper software you use.  If you make the bam file yourself, place it into the `project/bam` directory and name it exactly the way that Lyve-SET would expect it.  In this way, you trick Lyve-SET into thinking that it already produced the bam file so that it will not recreate it and will include it in downstream analysis.
* You can also assemble the genome and include the assembly only.  See below on how to include an assembly.  This could potentially introduce an assembler bias.

##How do I include an assembly in the analysis?

Copy or symlink the assembly into the `project/asm` folder.  Lyve-SET uses the `samtools` program `wgsim` to simulate reads without introducing any errors.  These simulated reads will appear as `wgsim.fastq.gz` files in the reads directory.  Unfortunately, including assembly files in this way could introduce assembly-based errors.

High-quality-ness
=================

What are the different ways that SNPs in Lyve-SET have high confidence?
-----------------------------------------------------------------------
* **Detection of troublesome regions** such that they are not considered in hqSNP analysis.  Currently in v1.0, only phage genes are detected; however other databases could be added in the future, and also I am open to other suggestions.  Users can also specify a BED-formatted file to describe regions to mask.
* Only **unambiguous mapping** allowed
* Default **75% consensus** and **4x** coverage thresholds.  These options can be changed when you launch Lyve-SET.  Certain presets (found in `config/presets.conf`) can alter these thresholds.  For example, `--preset salmonella_enterica` invokes 20x/95%.  Additionally, each SNP must have at least two supporting reads in each direction.
* Mechanisms to **remove clustered SNPs** -- not on by default however.
* **Maximum likelihood** phylogeny reconstruction. Ascertainment bias is also considered through RAxML v8.

repository: fsislaben/lyve-SET

repo_name: fsislaben/lyve-SET


text:
# Filebeat

This chart bootstraps a Filebeat deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
This chart is based on the Filebeat docker image v6.2.4 and adds the following dependencies:

## Installing the Chart

To install the chart with the release name `my-release`:

```console
$ helm install stable/Filebeat --name my-release
```

The command deploys Filebeat on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation.

## Uninstalling the Chart

To uninstall/delete the `my-release` deployment:

```console
$ helm delete my-release
```

The command removes all the Kubernetes components associated with the chart and deletes the release.

gha_language: Smarty


text:
## Heatmap visualization of the German hospitals
![Hospitals Heatmap](/docs/images/EToxoetX0AEFL9Y.jpg)

## Timeline series of the CORONAVIRUS incidents
![Corona Timeline](/docs/images/ETugK8VWkAIpP49.jpg)

repository: gisfromscratch/corona-notebooks

repo_name: gisfromscratch/corona-notebooks


text:
In production modelix uses docker images running in a kubernetes cluster.
During development you can run the different components without docker/kubernetes.
You need a PostgreSQL database, the model server and the MPS plugin for the UI server.

## Running without kubernetes

- `./gradlew` in the root directory
- open the project in the folder "mps" with MPS 2020.1.1
- <http://localhost:33333/>

This allows you to edit the models stored locally in MPS.
Optionally, you can run the model server and connect your MPS to it:

- database
  - option 1: run the docker image
    - install docker: <https://docs.docker.com/get-docker/>
    - `./docker-build-db.sh`
    - `./docker-run-db.sh`
  - option 2: use your own PostgreSQL server
    - check the file [../db/initdb.sql](../db/initdb.sql) for the required schema
    - adjust the connection properties in [../model-server/src/main/resources/org/modelix/model/server/database.properties](../model-server/src/main/resources/org/modelix/model/server/database.properties)
- model server
  - `cd model-server`
  - `../gradlew run`
- connect MPS to the model server
  - open the "Cloud" view in the bottom left corner
  - In the context menu of the root node labeled "Cloud" choose "Add Repository"
  - type `http://localhost:28101/`
  - navigate to "default tree (default)" > "data [master]" > "ROOT #1" and choose "Add Module" from the context menu
  - add a model to that module using the context menu
  - choose "Bind to Transient Module" from the context menu of the module
  - you should now see that module and the new model in the "Cloud" section at the end in the "Project" view
  - open the "Model Properties" of the new model and add at least one language dependency
  - now you are able to add new root nodes to the model from the MPS "Project" view

## Running a local kubernetes cluster

- Option 1: Docker Desktop
    - Download and install [Docker Desktop](https://www.docker.com/products/docker-desktop)
    - Enable kubernetes in the preferences
    - Increase memory to 4-8 GB in Preferences > Resources
- Option 2: minikube
    - `minikube start --cpus=4 --memory=8GB --disk-size=40GB`
    - `eval $(minikube -p minikube docker-env)`
- `./kubernetes-modelsecret.sh`
- SSL certificate
    - `cd ssl`
    - `./generate.sh`
    - `./kubernetes-create-secret.sh`
    - `cd ..`
- Option 1: Use the latest published docker images
    - `./kubernetes-use-latest-tag.sh`
- Option 2: Build your own docker images
    - `./docker-build-all.sh`
- `./kubernetes-apply-local.sh`
- Wait ~2 minutes. You can check the status of the cluster using `kubectl get all` (or `minikube dashboard`)
- Docker Desktop: `./kubernetes-open-proxy.sh`, minikube: `minikube service proxy`
- connect MPS to the model server: same steps as described at "Running without kubernetes", but use the URL you see when you executed `./kubernetes-open-proxy.sh` / `minikube service proxy` and append "model/" (e.g. http://<IP_ADDRESS>:31894/model/)

## Running in the google cloud

- https://console.cloud.google.com/kubernetes/list?project=webmps
- Create cluster
    - Name: modelix
    - Zone: europe-west-3c
    - Pool
        - Number of nodes: 1
        - Machine type: n1-standard-2
- `gcloud container clusters get-credentials modelix`
- `./gradlew`
- `./docker-build-all.sh`
- `./docker-push-hub.sh`
- `kubectl create secret generic cloudsql-instance-credentials --from-file=./kubernetes/secrets/cloudsql.json`
- `./kubernetes-modelsecret.sh`
- SSL certificate (not supported yet)
    - `cd ssl`
    - `./generate.sh`
    - `./kubernetes-create-secret.sh`
- `./kubernetes-apply-gcloud.sh`
- `watch kubectl get all -o wide`
- `kubectl delete horizontalpodautoscaler.autoscaling/ui-autoscaler`
- Entities example
    - `cd samples/entities/`
    - `./docker-build.sh`
    - `./docker-push.sh`
    - `kubectl apply -f deployment.yaml -f service.yaml`

repository: gianricardo/modelix

repo_name: gianricardo/modelix


text:
# WeenieBot

![](https://github.com/Beefywhale/WeenieBot/blob/master/screenshots/WeenieBot_Banner_Discord.png "WeenieBot Banner")

Your every day Discord Bot! Included Features: quotes, quote adding/deleting, Cleverbot integration, Admin whitelist for certain Commands, Adding admins by a person's Discord ID, and more!

# Installing WeenieBot
# Easy Install:
click this link http://tiny.cc/weeniebot to add WeenieBot to a server instantly!
if you want to install the bot yourself and run it on your own computer look for Harder Install section!

# Harder Install:
  First off, run `python setup.py` to setup everything needed for WeenieBot to run. Create an application here: https://discordapp.com/developers/applications/me to make a bot, than make the bot a bot user
by following the steps here: https://discordapp.com/developers/docs/topics/oauth2#bot make sure you set your application to bot user, that is very important! Don't forget to add the bot to your server by copying your applications ClientID, than going to this link https://discordapp.com/oauth2/authorize?client_id=CLIENT_ID_GOES_HERE&scope=bot&permissions=0 and pasting your Client ID in place of `CLIENT_ID_GOES_HERE`.

For a more in-depth guide on Installing and seting up WeenieBot, go here: https://github.com/Beefywhale/WeenieBot/wiki/WeenieBot's-In-depth-setup

# Thats It!
now just run `python WeenieBot.py`
For more info on commands, use the !help command once the bot is up and running!
If you have any questions, or need help. Feel Free to ask!

Made by: Beefywhale @ https://github.com/Beefywhale
Special thanks to: Dragon5232/Armored-Dragon @https://github.com/Armored-Dragon

repository: Beefywhale/WeenieBot

repo_name: Beefywhale/WeenieBot


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

### Description

In QEMU 5.0.0 and earlier, megasas_lookup_frame in hw/scsi/megasas.c has an out-of-bounds read via a crafted reply_queue_head field from a guest OS user.

### POC

#### Reference
No PoCs from references.

#### Github
- https://github.com/Live-Hack-CVE/CVE-2020-13362

repository: trickest/cve

branch_name: refs/heads/main

repo_name: trickest/cve


text:
---
layout: post
title: Docker networking overview
date: '2016-02-16 23:00:00'
tags:
- containers
- sdn
- docker
permalink: /docker-networking-overview/
---

 **Introduction**

There are of course a lot of blog posts out there already regarding Docker networking, I don’t want to replicate that work but instead wanted to provide a clear overview of what is possible with Docker networking today by showing some examples of the different options.

In general the networking piece of Docker, and arguably Docker itself, is still quite young so things move fast and will likely change over time. A lot of progress has been made via the SocketPlane acquisition last year and it’s subsequent pluggable model, but more about that later.

Docker containers are ephemeral by design (pets vs cattle), this leads to several potential issues, not the least of which is not being able to keep your firewall configuration up to date because of difficult IP address management, it’s also hard to connect to services that might disappear at any moment, and no, using DNS as a stopgap is not a good solution (DNS as a SPOF, don’t go there). Of course there are several options and methods available to overcome these things.

**Single host Docker networking**

You basically have 4 options for single host Docker networking; Bridge mode, Host mode, Container mode, and No networking.

**Bridge mode (the default Docker networking mode)**

The Docker deamon creates “docker0” a virtual ethernet bridge that forwards packets between all interfaces attached to it. All containers on the host are attached to this internal bridge which assings one interface as the containers’ “eth0” interface and another interface in the host’s namespace (think VRF). The container get’s a private IP address assignment. To prevent ARP collisions on the local network, the Docker daemon generates a random MAC address from the allocated IP address. In the example below Docker assigns the private IP <IP_ADDRESS> to the container.

**Host mode**

In this mode the container shares the networking namespace of the host, directly exposing it to the outside world. This means you need to use port mapping to reach services inside the container, in Bridge mode, Docker can automatically assign ports and thus make them routable. In the example below the Docker host has the IP <IP_ADDRESS> and as you can see the container shares this IP address.

**Container mode**

This mode forces Docker to reuse the networking namespace of another container. This is used if you want to provide custom networking from said container, this is for example what Kubernetes uses to provide networking for multiple containers. In the example below the container to which we are going to connect the subsequent containers into has the IP <IP_ADDRESS> and as you can see the container being launched has the same IP address.

**No networking**

This mode does not configure networking, useful for containers that don’t require network access, but it can also be used to setup custom networking. This is the mode Nuage Networks leverages pre-Docker 1.9 (more info here). In the example below you can see that our new container did not get any IP address assigned.

By default Docker has inter-container communication enabled (–icc=true) meaning that containers on a host are free to communicate without restrictions which could be a security concern. Communication to the outside world is controlled via iptables and ip\_forwarding.

**Multi-host Docker networking**

In a real world scenario you will most likely end up using Docker containers across multiple hosts depending on the needs of you containerized application. So now you need to build container networks across these hosts to have you distributed application communicate internally, and externally.

As alluded to above in march of 2015 Docker, Inc. acquired the SDN startup SocketPlane, that has given rise to Libnetwork and the Container Network Model, meant to be the default multi-host networking setup going forward.

**Libnetwork**

Libnetwork provides a native Go implementation for connecting containers The goal of libnetwork is to deliver a robust Container Network Model that provides a consistent programming interface and the required network abstractions for applications.

One of the benefits of Libnetwork is that it uses a driver / plugin model to support many underlying network technologies while stil exposing a simple and consistent network model to the end-user (common API), Nuage Networks leverages this model by having a remote plugin.

Libnetwork also introduces the Container Network Model (CNM) to provide interoperation between networks and containers.

The CNM defines a network sandbox, and endpoint and a network. The Network Sandbox is an isolated environment where the Networking configuration for a Docker Container lives. The Endpoint is a network interface that can be used for communication over a specific network. Endpoints join exactly one network and multiple endpoints can exist within a single Network Sandbox. And the Network is a uniquely identifiable group of endpoints that are able to communicate with each other. You could create a “Frontend” and “Backend” network and they would be completely isolated.

extension: markdown


text:
I Don't Know How We Can See Each Other Through All This Blood

    he said in his most goth voice

This repo contains the source code used in [my project using a heartbeat sensor to modify my vision][post]. Check out the post more details on the experiment

## Sensor
This Python script collects heartbeat data from a [Pulse Sensor][pulse], sending heartbeat events over a websocket to the VR headset. It targets a Raspberry Pi that is using a MCP3008 analog to digital converter for the Pulse Sensor.

The code requires Python 3.5+, and the [RPi.GPIO](https://learn.adafruit.com/raspberry-pi-analog-to-digital-converters/mcp3008) and [webksockets](https://pypi.python.org/pypi/websockets) libraries.

To start it, simply run:

```bash
$ python3 sensor/all-this-blood.py eth0
```

The script arguments specify which network devices to serve the websocket on.

## Site
The website is designed to be run on an iPhone used with Google Cardboard. It takes the mjpeg stream from the camera and the heartbeat events, and uses WebGL to modify your vision in realtime.

The site uses webpack. To run it:

```bash
$ cd viewer
$ npm install

# Edit `src/config.js` to provide the expected ip address of the Raspberry pi
# and rebuild
$ webpack

# server up index.html somehow
$ http-server index.html
```

## Credits

* [Beartbeat ping sound](http://freesound.org/people/Benboncan/sounds/63832/)
* [adafruit mcp3008 Python code](http://threejs.org/docs/index.html#Manual/Introduction/Creating_a_scene)
* [Pulse sensor Arduino sample code](https://github.com/WorldFamousElectronics/PulseSensor_Amped_Arduino)
* [Three.js](http://threejs.org)

[pulse]: http://pulsesensor.com/

[post]: http://blog.mattbierner.com/all-this-blood

repository: mattbierner/all-this-blood

repo_name: mattbierner/all-this-blood


text:
# LMake
An extensible cross-platform build system inspired by CMake and written in Lua

- [LMake](#lmake)
- [Motivation](#motivation)
- [Overview](#overview)

```
require 'lmake'
myPlugin = native.sharedlib {
	input = file.glob('myPlugin/*.cpp'),
	language = 'cpp',
	compiler = switch(system.platform, {
		windows = native.compilers.winsdk,
		linux = native.compilers.llvm,
		osx = native.compilers.xcode
	},
	arch = multi { 'x86', 'x86_64' }
}
```

# Motivation
(aka: What's wrong with CMake?)

CMake is a great system, but it suffers from a number of issues stemming from its initial design
choices. Here's how LMake will attempt to solve them.

* LMake *is* a build system

While LMake could be used to generate build files for GNU make, MSBuild, or others, its primary use
case is to build project directly by specifying a compiler such as GCC, clang or MSVC. With the lack
of a specific 'confugration' step, the rules for accessing and modifying different target properties
can be simplified.

* LMake projects can seamlessly integrate with any language

Adding a target type for your favourite language is almost as simple as defining a target instance.
The LMake framework includes (TODO) built-in support for C/C++, C#, Lua, Python, and all the GCC
supported languages.

* LMake runs on Lua 5.3

Targets will usually be defined in a simple, declarative style, but LMake embraces that build
processes can be complicated and allows the use of any Lua construct or library. Think of LMake as a
framework on top of Lua rather than its own programming language.

* LMake puts deployment first

LMake targets know about all their runtime dependent files, making deployment on any platform a
cinch. Just call `target.deploy(myLibrary, "directory")` (TODO).

* LMake is truly platform-independent

All LMake needs is a filesystem, a shell, and a Lua binary. Any platform-specific functionality,
path operations mainly, is defined separately making future extensions straightforward. Support for
Linux, Mac OS X, and Windows is included.

* LMake projects define more than just build steps

A target can have any number of 'actions'. Need a special command sequence to start your project?
Just embed it in your target definition, and run `lmake run myTarget`. Test results from all targets
are combined together in a single XML output, to be used by your CI system of choice or
pretty-printed to the console (TODO).

# Overview

The basic LMake element is the 'target', which is nothing more than an object created by calling
`target` and passing in a table of definitions. These definitions consist of 'properties' and
'actions'. Actions are top-level functions called by the command interpreter like 'build' and
'test', whereas properties are general-purpose mutable or immutable variables, such as 'input',
'language' or 'linkage'.

repository: hamish-milne/lmake

repo_name: hamish-milne/lmake


text:
nodejs-nzbmatrix
================

[Node.js](http://nodejs.org/) module for the [NZBMatrix](https://nzbmatrix.com/) API.

# End of life

### NZBMatrix has ended their services.

This module remains available, but it will **NOT** work properly or get updates!

Refer to <http://nzbmatrix.com> for the story.

# Requirements

* NZBMatrix account with API key. ([here](https://nzbmatrix.com/account.php?action=api))
* Node.js :)

# Dependencies

None, the only module called is `https` which comes with Node.js.

# Installation & loading

## From NPM

```
npm install nzbmatrix
```
```js
var nzbmatrix = require('nzbmatrix')
```

## From Github

```
git clone https://github.com/fvdm/nodejs-nzbmatrix
```
```js
var nzbmatrix = require('/path/to/nodejs-nzbmatrix')
```

# Usage

```js
var nzbmatrix = require('nzbmatrix')
nzbmatrix.api.username = 'yourUsername'
nzbmatrix.api.key = 'yourAPIkey'

nzbmatrix.account( console.log )
```
```js
{ USERNAME: 'yourUsername',
  USERID: '987987',
  API_DAILY_RATE: '8',
  API_DAILY_DOWNLOAD: '0' }
```

# Methods

All methods take a `callback` function which will be called when results are ready.

## account
### ( callback )

```js
nzbmatrix.account( function( account ) {
	console.log( account.USERNAME +' : '+ account.API_DAILY_RATE +' API calls' )
})
```

## bookmarks
### ( action, nzbID, callback )

Add or remove a bookmark from your account.

* **action** - `add` or `remove`
* **nzbID** - the ID of the NZB post

```js
nzbmatrix.bookmarks( 'add', 123, console.log )
```

## search
### ( props, callback )

Search the database. This method always returns an array with objects.

**props:** ([docs](https://nzbmatrix.com/api-info.php))
```
search      : search term
catid       : if left blank all categories are searched, category ID used from site.
num         : if left blank a maximum of 5 results will display, 5 is the maximum number of results that can be produced.
age         : if left blank full site retention will be used. Age must be number of "days" eg 200
region      : if left blank results will not be limited 1 = PAL, 2 = NTSC, 3 = FREE
group       : if left blank all groups will be searched, format is full group name "alt.binaries.X"
larger      : minimum size in MB
smaller     : maximum size in MB
minhits     : minimum hits
maxhits     : maximum hits
maxage      : same as &age (above) here for matching site search vars only
englishonly : if '1' the search will only return ENGLISH and UNKNOWN matches
searchin    : (name, subject, weblink) if left blank or not used then search filed is "name"
```

**Example:**

```js
nzbmatrix.search(
	{
		search:	'ubuntu',
		catid:	20
	},
	function( results ) {
		for( var i in results ) {
			var item = results[i]
			console.log( item.NZBID +' - '+ item.NZBNAME )
		}
	}
)
```

## post
### ( nzbid, callback )

Get details about a NZB post.

```js
nzbmatrix.post( 123, console.log )
```

## download
### ( nzbID, [restoreSceneNames], callback )

Download NZB XML file.

```js
nzbmatrix.download( 123, function( xml ) {
	// ie. store on disk
})
```

## talk
### ( props )

Directly communicate with the API.

**props** is an object with the following properties:

```
path       : required - Method path, ie. search.php
fields     : optional - Method parameters, ie. {id: 123}
onSuccess  : optional - Callback function for results, only called on successful response
```

```js
nzbmatrix.talk({
	path:		'bookmarks.php',
	fields: {
		id:		123,
		action:	'add'
	},
	onSuccess:	function( res ) {
		console.log( res.RESULT || res.error )
	}
)
```

## limit

This **object** is only filled after at least one API call is made and contains the API-limits for your account.

```js
nzbmatrix.download( 123, function() {
	console.log( nzbmatrix.limit )
})
```

```js
{ api_rate_limit:           100,
  api_rate_limit_used:      17,
  api_rate_limit_left:      83,
  api_download_limit:       150,
  api_download_limit_used:  1,
  api_download_limit_left:  149 }
```

# Unlicense

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

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

For more information, please refer to <http://unlicense.org/>

license: Unlicense

repository: JnrnZEDb/nodejs-nzbmatrix

repo_name: JnrnZEDb/nodejs-nzbmatrix


text:
---
layout: post
title: "The anti-VSCO photographer"
date: 2014-11-03 16:12:14 +0100
comments: true
categories:
- Photography
- Digital Life
external-url: http://www.conormcclure.net/blog/2014/2/the-anti-vsco-photographer
---

Great piece by Connor McClure. It's from back in February but it's still pretty relevant today, particularly in light of [the last entry](/2014/11/03/first-impressions-of-the-leica-m-a/):

> Droppping $50, $90, $120 on the latest and greatest pack of presets won't make you a better photographer any more than buying dropping an extra grand for an extra f-stop will. If you're truly in pursuit of the "film look," for heaven's sake, shoot film! If you're truly limited by your post-processing capabilities, improve them!

> We, as a creative whole, need to get out of the mindset that we must have the latest and greatest tools to be good at our craft.

Yep.

repository: analogsenses/source

repo_name: analogsenses/source


text:
# Styling

## Forms
Always use the new [@wso2is/form](../../modules/form) module when developing forms.

Read the documentation [here](../FORMS.md).

### Sectioned Form

When styling the forms, avoid using any ad-hoc Headings, Dividers etc.
If you wish to write a form with sub-sections, use the [FormSection](../../modules/react-components/src/components/forms/form-section.tsx) component.
It will add a divider and a Heading with a constant emphasis level.

#### Usage

```tsx
<FormSection heading=“Permissions”>
    <Field.Input
        ariaLabel="scopes"
        inputType="text"
        name="scopes"
        …
    />
    <Field.Input
        ariaLabel="user data"
        inputType="text"
        name="userData"
        …
    />
<FormSection>
```

#### Output

![form-section](../assets/forms-section.png)

[react-conditional-rendering]: https://reactjs.org/docs/conditional-rendering.html

gha_language: TypeScript


text:
---
layout: page
tags: [ecosystem]
---

# Unicode

* [uutf](https://github.com/dbuenzli/uutf):
Streaming Unicode codec. This library is well maintained, and up to date with the latest Unicode standard.
* [Camomile](https://github.com/yoriyuki/Camomile):
An older Unicode support library. Covers only Unicode 3.2.


text:
---
layout: note
title: Machine Learning Terminology I have come accross in my travels
---

quadratic program 	 https://en.wikipedia.org/wiki/Quadratic_programming

loss term

objective function

regularization hyperparameter

centroid algorithm

perceptron

parabolic lifting map

paraboloid

support vector  machine (SVM)  hard margin and soft margin

hypersphere													https://en.wikipedia.org/wiki/Hypersphere

hyperplane: a subspace which is 1 dimension less than its ambient space. For example. for 3D space, a hyperplane is a 2D plane. For a 2D space, a hyperplane is a 1D line.

isosurface

quadric <- prof said conic

edge detection		https://en.wikipedia.org/wiki/Image_derivatives

direct sum of matrices		https://planetmath.org/directsumofmatrices

expected value			https://en.wikipedia.org/wiki/Expected_value

Precision matrix: The precision matrix, Ω, is simply defined to be the inverse of the covariance matrix:

Isotropic/Anisotropic: https://math.stackexchange.com/questions/1991961/gaussian-distribution-is-isotropic

LDA: Linear discriminant analysis
QDA: Quadratic discriminant analysis

Design Matrix:

Centering X:

Sample covariance matrix:

MLE: Maximum Likelihood Estimation


text:
# Installation of a new BIIGLE instance

This guide describes how to install BIIGLE on a new machine.

## Setup

This is an example setup of a machine that should run BIIGLE. It is based on a clean install of Ubuntu 20.04 with the user `ubuntu`.

1. Run `sudo apt update && sudo apt upgrade`.

2. [Install Docker](https://docs.docker.com/install/linux/docker-ce/ubuntu/#set-up-the-repository). If you are in a cloud environment, add the repository like this so it is not deleted when a new machine is booted:

        echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
            $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list

3. Run `sudo usermod -aG docker ubuntu` to add the ubuntu user to the docker group.

4. [Install Docker Compose](https://docs.docker.com/compose/install/#install-as-a-container) as a Docker container.

5. Log out of the machine and back in.

Now you can follow the installation instructions below to install BIIGLE on the machine.

## Installation

Perform these steps on the machine that should run BIIGLE.

1. Clone the [`biigle/biigle`](https://github.com/biigle/biigle) repository to the directory where BIIGLE should be installed (e.g. `/mnt/biigle` or `/var/biigle`).

1. Create a user for BIIGLE and find out the user and group ID:

        $ sudo useradd biigle -U
        $ id -u biigle
        <user_id>
        $ id -g biigle
        <group_id>

2. Change the owner of the `storage` directory:

        sudo chown -R biigle:biigle storage/

2. Move `.env.example` to `.env`.

3. Now set the configuration variables in `.env`:

    - `USER_ID` should be `<user_id>`.
    - `GROUP_ID` should be `<group_id>`.

2. Move `build/.env.example` to `build/.env`.

3. Now set the build configuration variables in `build/.env`:

    - `GITHUB_OAUTH_TOKEN` is an [OAuth token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/) of your GitHub account.
    - `APP_KEY` is the secret encryption key. Generate one with: `head -c 32 /dev/urandom | base64`. Then set `APP_KEY=base64:<your_key>`.
    - `APP_URL` is `https://<your_domain>`.
    - `ADMIN_EMAIL` is the email address of the administrator(s) of the application.

5. Put the SSL keychain (`fullchain.pem`) and private key (`privkey.pem`) to `certificate/`. See [here](http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_certificate) for a description of the required contents of the keychain file. For a local setup no SSL certificate may be required. Update the `web` service in [`docker-compose.yaml`](docker-compose.yaml) as described by the comments in this case.

6. Now build the Docker images for production: `cd build && ./build.sh`. You can build the images on a separate machine, too, and transfer them to the production machine using [`docker save`](https://docs.docker.com/engine/reference/commandline/save/) and [`docker load`](https://docs.docker.com/engine/reference/commandline/load/). `build.sh` also supports an optional argument to specify the version tag of the Docker images to build (e.g. `v2.8.0`). Default is `latest`.

7.

8. Apply the database migrations: `./artisan migrate`.

9. Create the first user: `./artisan user:new`.

repository: hamelmoon/biigle

repo_name: hamelmoon/biigle


text:
##Directories
* datasets - contains the datasets used in the notebooks
 * files beginning with loan are for linear and logistic regression notebooks
 * files in directory samsung are for random forests notebooks
 * files begiining with UN are for kMeans notebook
 * dierctory ucihar contains original files for the random forests dataset, and include metadata and explanations

* index.html - home page file

* license.txt - license file for content

* notebooks - notebooks and supporting files
 * files ending in .ipynb are IPython Notebooks - titles are self explanatory
 * files ending in .py are supporting python code for each algorithm - name of file maps to algorithm
   e.g. linreg.py is supporting code for linear regression notebooks
 * files in fig and images directories contain images

repository: dataarch/ODST

repo_name: dataarch/ODST


text:
---
layout: post
title: Lindsey Matysik-Johnson
---

Hello and welcome to my professional portfolio! My name is Lindsey Matysik-Johnson. I am a recent graduate of University of Wisconsin - Stout. I have a Bachelor's degree of Science in Management with an emphasis in Human Resource Management. I previously earned an Associate degree in Human Resources from Chippewa Valley Technical College in December 2015. I'm a hard-working, qualified individual with over ten years of customer service experience and four years of professional office experience. I'm passionate about education, technology, marketing, and training. Because I have a passion for technology, I utilized a technology called [Jekyll](https://jekyllrb.com/) to create this website.

Want to learn more information about me? My resume is a good start to quickly view my professional profile, education, work experience, and notable accomplishments.

[Professional Resume](Documents/Resume.pdf)

As you can tell from my resume, I have extensive experience in sales and customer service. Over the years, I have developed software skills including advanced proficiency in Microsoft Office products like Outlook, Word, and PowerPoint.

[Detailed Work Experience](Documents/Detailed_Work_Experience.pdf)

I am 30 years old, and I have many life experiences that have led to the position I am in currently today. I am a big believer in things happening for a reason.

[Life Timeline](Documents/Lifeline.pdf)

[Reflection](Documents/Lifeline_Reflection.pdf)

During my Management Seminar course at UW-Stout, which I took during the Spring 2019 semester, I had the opportunity to provide detailed answers about my work and what I do, how my colleagues go the extra mile in their work, a moment where I as recognized at work for saving the day, and how I stay upbeat and positive at work at all times.

[Career Questions](Documents/Career_Questions.pdf)

During the Management Seminar course, I had several colleagues in my department at Chippewa Valley Technical College answer questions about me as a colleague. Using their surveyed information, I had the chance to meet with my program director at UW-Stout and develop a scorecard of my strengths and opportunities for improvement.

[Balance Sheet](Documents/Balance_Sheet.pdf)

Earning my Bachelor's degree is the first step in an overall plan I have to become a valuable leader in higher education. My goal is to eventually obtain a leadership role, like a Director or Dean, within the Wisconsin Technical College System after teaching students in Business Management or Human Resources.

I truly believe in the transformative empowerment of higher education, and I identify strongly with the hands-on nature and affordability of the technical college system. Beginning my education at Chippewa Valley Technical College was the best decision I ever made in my life, and I valued my time at UW-Stout as well. I would like to be a leader and oversee College projects or plans that increase student success once I have the professional experience and education I need under my belt. My future aspirations and personal goals ensure I will eventually pursue a Master's degree or higher when the timing is right.

[Future State](Documents/Future_State.pdf)

I am happy to clarify any of the information shared on this website and my professional experience, goals, and aspirations. Feel free to contact me directly at<EMAIL_ADDRESS>if you have any questions or wish to discuss my professional background. Thank you for taking the time to learn more information about me!

Connect with me on [LinkedIn](https://www.linkedin.com/in/lindseyannmatysik) or follow me on [Twitter](https://twitter.com/WisconnyLindsey).


text:
# ABC Arbitrage quiz for NCrafts 2015-2018

## Three different quizzes in one app

This project is a small quiz application we let people play with on our ABC Arbitrage booth at the last four [NewCrafts conference editions](http://ncrafts.io/) in Paris.

You can choose from three different C# quizzes:

* A general performance quiz: _Which code is more likely to run faster?_ (2016 edition)
* A more specific one: _Which code doesn't allocate on the heap?_ (2015 edition)
* A performance quiz centered on new features in C# 7.2 and .Net Core 2.1 (2018 edition)

## Welcome screen
![Play screen](./Images/screenshot1.png "Play screen")

## Pick the good answer

![Play screen](./Images/screenshot2.png "Play screen")

## Get some help

![Help screen](./Images/screenshot3.png "Help screen")


text:
12 Configuring Pakyow

All configuration is defined in the Application class. If auto_reload is set to "true", the configuration will be reloaded on each request (perfect for development). Otherwise the configuration will be loaded once at runtime.

Configuration can be defined for the entire app:

config.app.log = true
config.app.default_environment = :development

Or for a single environment:

configure :development do
  app.dev_mode = true
end

12.1 Configuration Settings

Configuration settings are broken into three groups: app, presenter, and server.

### app.application_path
The path to the file where the application class is defined. This is set automatically and shouldn't be changed.

### app.auto_reload
Reloads the application class and all files in "src_dir" on every request.

Defaults to 'true'.

### app.default_action
The default action to call when routing to a controller.

Defaults to 'index'.

### app.default_environment
The default environment to run the application in.

Defaults to 'development'.

### app.dev_mode
Issues warnings instead of breaking certain things. Currently only used by pakyow-presenter to keep the application from breaking when binding an object to a view when the attribute isn't defined on the object being bound.

Defaults to 'true'.

### app.errors_in_browser
Displays any errors in the browser (useful for development).

Defaults to 'true'.

### app.ignore_routes
Keeps the backend from being used (useful when working with views).

Defaults to 'false'.

### app.log
Write logs to a log file, and to STDOUT.

Defaults to 'true'.

### app.log_dir
Where the logs live.

Defaults to '{root}/logs'.

### app.log_name
What the log file should be named.

Defaults to 'requests.log'.

### app.presenter
Sets the presenter to be used. This is set automatically when a presenter is included and shouldn't be changed.

### app.public_dir
The folder where static files live (CSS, Javascript, images, etc).

Defaults to '{root}/public'.

### app.static
If true, static files will be served up by Pakyow (from {public_dir}). For best performance,
set to false and let a web server handle this.

### app.root
The root directory of the application.

Defaults to where the application is started from.

### app.src_dir
Where the backend code lives.

Defaults to '{root}/app/lib'.

### presenter.default_root_view_name
The default root view to use.

Defaults to 'pakyow.html'.

### presenter.javascripts
Where the Javascript files live (used when adding/removing resources to a view).

Defaults to '{public_dir}/javascripts'.

### presenter.stylesheets
Where the CSS stylesheets live (used when adding/removing resources to a view).

Defaults to '{public_dir}/stylesheets'.

### presenter.view_caching
If views are cached, they are loaded only once at runtime. Otherwise they are loaded on every request, so changes are picked up (useful for development).

Defaults to 'false'.

### presenter.view_dir
Where the views live.

Defaults to '{root}/app/views'.

### server.host
What host to run the application on (only used when running the application with the built-in server).

Defaults to '<IP_ADDRESS>'.

### server.port
What port to run the application on (only used when running the application with the built-in server).

Defaults to '3000'.

### mailer.default_sender
The default value for the message sender. Can be overridden on a message by message basis through the
message object.

Defaults to 'Pakyow'.

### mailer.default_content_type
The default content type for the message.

Defaults to 'text/html; charset=UTF-8'.

### mailer.delivery_method
How the message will be delivered.

Defaults to ':sendmail'.

### mailer.delivery_options
Other options that go along with the delivery method.

Defaults to '{:enable_starttls_auto => false}'.

repository: tugboat/pakyow-web

path: /manual/12 Configuring Pakyow.markdown

filename: 12 Configuring Pakyow.markdown

repo_name: tugboat/pakyow-web


text:
# ![Cucumber Roll](http://files.softicons.com/download/object-icons/richs-misc-icons-by-rich-d/png/24/Cucumber%20Roll.png) Objective-C Cucumber Wire Protocol

It allows Cucumber to touch your application in _intimate places_. Goals
include and exclude:

* Implement the Cucumber wire protocol.

  This is the most direct way to connect Cucumber to non-Ruby environments.

* Not to link against the C++ standard library.

  Just pure Automatic Reference Counting (ARC) Objective-C based on Apple's
  Foundation framework.

Why the OC name-space prefix? OC stands for Objective-C. It emphasises the
underlying dependency as well as the multiplatform capability. OCCukes supports
Objective-C on all Apple platforms: iOS and OS X.

The project does _not_ include an expectation framework. It only runs
Objective-C coded step definitions. Your step definitions must assert
appropriate expectations, possibly by running _other_ step definitions. Since
you write your Cucumber step definitions in Objective-C, you can use any kind
of assertion framework, or even write your own. Exceptions thrown by the step
become Cucumber step failures. See
[OCExpectations](https://github.com/OCCukes/OCExpectations) for an expectations
library.

OCCukes and its companion OCExpectations sails as close to Cucumber and RSpec
shores as is possible. If you are familiar with Cucumber and RSpec, you should
find these projects refreshingly familiar; despite the differing implementation
languages. Interfaces and implementations mirror their Ruby counterparts.

To use OCCukes, you need Xcode 4.4 or above, Ruby as well as Apple's Command
Line Tools package. Install them on your Mac first. See
[Prerequisites](https://github.com/OCCukes/OCCukes/wiki/Prerequisites) for
details.

## Usage

OCCukes integrates with Xcode. You launch a Cucumber-based test suite as you would any other Xcode project test suite: just press Command+U. To set up the pre- and post-actions for your test target, just install Cucumber using RVM.

### Test scheme pre-action

Make this your pre-action for the Test scheme:

	PATH=$PATH:$HOME/.rvm/bin
	rvm 1.9.3 do cucumber "$SRCROOT/features" --format html --out "$OBJROOT/features.html"

This assumes you have already installed Cucumber in the Ruby 1.9.3 RVM; adjust according to your local environment and personal preferences.

### Test scheme post-action

Then make this your post-action:

	open "$OBJROOT/features.html"

### Wire protocol configuration

Add a wire configuration to your `features/step_definitions` folder, a YAML file with a `.wire` extension. Contents as follows.

	host: localhost
	port: 54321

	# The default three-second time-out might not help a debugging
	# effort. Instead, lengthen the timeouts for specific wire protocol
	# messages.
	timeout:
	  step_matches: 120

Host and port describe where to find the wire socket service. The Cucumber wire service accepts connections at port 54321 on _any_ interface. So you can connect to non-local hosts as well.

### Environment Support

Set up your `features/support/env.rb`; contents as follows. The Ruby code below defines a Cucumber `AfterConfiguration` block for daemonising the Cucumber process and waiting for the wire server to begin accepting socket connections. This block runs after Cucumber configuration. You can copy this code from [`features/support/env.rb`](https://github.com/OCCukes/OCCukes/blob/master/features/support/env.rb).

```ruby
require 'cucumber/wire_support/configuration'

begin
  require 'dnssd'
rescue LoadError
end

require 'timeout'

# Extends Cucumber's wire support configuration class.
#
# Replaces the #initialize, #host and #port methods. The new method
# implementations allow for DNS service discovery, or synchronisation
# when using explicit host address and port number.  The configuration
# will pick up the address and port number obtained via Bonjour or
# pick up the defaults instead. Hence, the wire configuration does not
# require a host or port value. If the host specifies a service type
# of the form "_service-type._tcp." then the replacement initialiser
# attempts a service discovery using DNS-SD.
module Cucumber
  module WireSupport
    class Configuration
      alias_method :original_initialize, :initialize
      alias_method :original_host, :host
      alias_method :original_port, :port

      # Cucumber supports multiple languages, even during the same
      # run. The wire language is just one of many.
      def initialize(wire_file)
        original_initialize(wire_file)
        if net_service_discovery?
          discover_net_service
        else
          sync
        end
      end

      def host
        @net_service_host || original_host || 'localhost'
      end

      def port
        @net_service_port || original_port || 54321
      end

      # Answers non-nil if the host configuration conforms to DNS
      # Service Discovery type expectations. Answers nil if not.
      def net_service_discovery?
        original_host =~ /_[-a-z0-9]+._[-a-z0-9]+./
      end

      # If Ruby can find the "dnssd" gem, try to resolve the host and
      # port dynamically using DNS-SD, DNS-based service discovery,
      # also known as Bonjour. If discovery succeeds, no need to probe
      # for the open socket. Instead, assume the open socket
      # exists. Otherwise why would the server publish the service?
      # Allow thirty seconds for service discovery to browse and
      # resolve the service, and then look up the address
      # information. The underlying Ruby socket implementation wants
      # an IP address, a string in dotted decimal.
      def discover_net_service
        begin
          Timeout::timeout(30) do
            DNSSD.browse!(original_host || '_occukes-runtime._tcp.') do |browse|
              DNSSD.resolve!(browse) do |resolve|
                DNSSD::Service.new.getaddrinfo(resolve.target) do |addr_info|
                  @net_service_host, @net_service_port = addr_info.address, resolve.port
                  STDERR.puts "Cucumber wire connecting to #{resolve.name}, address #{@net_service_host}, port #{@net_service_port}"
                  raise Timeout::Error
                end
              end
            end
          end
        rescue Timeout::Error
        end
      end

      # Wait for the wire socket to open. Try a connection once a
      # second for thirty seconds. Give Xcode thirty seconds to set up
      # the test host. This could involve launching the iOS
      # simulator. So it might take a little while at first. Continue
      # when the connection does not refuse. This adds a short
      # latency: the distance in time between the wire server
      # accepting connections and the socket probe finding a
      # non-refusal. The latency is always less than one second.
      #
      # No need to send an exit message. The wire server automatically
      # exits when all the connections close.
      def sync
        Timeout::timeout(30) do
          loop do
            begin
              TCPSocket.open(original_host, original_port).close
              break
            rescue Errno::ECONNREFUSED
              sleep 1
            end
          end
        end
      end
    end
  end
end

# Daemonise this Cucumber process. This assumes that Xcode launches
# Cucumber as a pre-action for the test scheme. If you use RVM, the
# pre-action script might look something like this:
#
#   PATH=$PATH:$HOME/.rvm/bin
#   rvm 1.9.3 do cucumber "$SRCROOT/features" --format html --out "$OBJROOT/features.html"
#
# Please be aware: from this point forward, the Cucumber process forks
# away from the parent process and becomes a background process. The
# parent process, Xcode, continues. However, the fork interferes if
# you want to debug the Cucumber client. Breakpoints will never break
# if set beyond the fork.
#
# Therefore, work out if the current process runs from Xcode or
# not. Only fork if it does. Avoid the fork if running
# independently. This helps when debugging. Use XCODE_VERSION_ACTUAL
# to determine if launching from Xcode. Xcode sets up that environment
# variable, assuming you provide build settings from your test
# target. For Xcode 4.4, the actual version equals 0440. Actual value
# does not matter; only presence matters.
Process.daemon(true, true) if ENV['XCODE_VERSION_ACTUAL']
```

### Add test case

Finally, integrate Cucumber tests with your standard unit test cases by adding a special `SenTestCase` sub-class.

Header file for test case, `CucumberTests.h`:
```objc
#import <SenTestingKit/SenTestingKit.h>

@interface CucumberTests : SenTestCase

@end
```

Source file for test case, `CucumberTests.m`:
```objc
#import "CucumberTests.h"

#import <OCCukes/OCCukes.h>

@implementation CucumberTests

- (void)setUp
{
	[OCCucumber given:@"^context$" step:^(NSArray *arguments) {
		// express the regular expression above with the code you wish you had
		[OCCucumber pending:@"TODO"];
	} file:__FILE__ line:__LINE__];

	[OCCucumber when:@"^event$" step:^(NSArray *arguments) {
		// express the regular expression above with the code you wish you had
		[OCCucumber pending:@"TODO"];
	} file:__FILE__ line:__LINE__];

	[OCCucumber then:@"^outcome$" step:^(NSArray *arguments) {
		// express the regular expression above with the code you wish you had
		[OCCucumber pending:@"TODO"];
	} file:__FILE__ line:__LINE__];

	[[OCCucumberRuntime sharedRuntime] setUp];
}

- (void)tearDown
{
	[[OCCucumberRuntime sharedRuntime] tearDown];
}

- (void)testCucumber
{
	[[OCCucumberRuntime sharedRuntime] run];
}

@end
```

Register your step definitions before executing the Objective-C Cucumber runtime by sending `-run`. As you see above, definitions manifest themselves in Objective-C as C blocks. These blocks assert the step's expectations, throwing an exception if any expectations fail. Steps therefore succeed when they encounter no exceptions.

The runtime accepts connections until all connections disappear. By default, it offers an initial 10-second connection window; giving up if Cucumber fails to connect for 10 seconds. The runtime also offers a 1-second disconnection window before shutting down the socket. This allows all connections to disappear temporarily. You can adjust these connect and disconnect timeouts if necessary.

Link your test target against the `OCCukes.framework` for OS X platforms; or against the `libOCCukes.a` static library for iOS test targets. For iOS targets, you also need `OTHER_LDFLAGS` equal to `-all_load`; the linker does not automatically load Objective-C categories when they appear in a static library but this flag forces it to.

## Advantages

Why use OCCukes?

### Test bundle injection

Takes advantage of Apple's test bundle injection mechanism. In other words, you do not need to link your target against some other library. Your target needs nothing extra. This obviates any need for maintaining multiple targets, one for the application proper, then another one for Cucumber testing. Xcode takes care of the injection of the wire protocol server along with all other tests and dependencies at testing time.

This prevents a proliferation of targets, making project maintenance easier. You do not need to have a Cucumber'ified target which duplicates your target proper but adds additional dependencies. Bundle injection handles all that for you. One application, one target.

### No additional Ruby

The OCCukes approach obviates any additional Ruby-side client gem needed for bridging work between Cucumber and iOS or OS X. Cucumber is the direct client end-point. It already contains the necessary equipment for talking to OCCukes. No need for another adapter. OCCukes talks _native_ Cucumber.

This also means that you do not need to build and maintain a skeletal structure within your features just for adapting and connecting to a remote test system. Cuts out the [cruft](http://foldoc.org/cruft).

### No private dependencies

The software only makes use of public APIs. This makes it far less brittle. Private frameworks can and do change without notice. Projects relying on them can easily become redundant especially as Apple's operating systems advance rapidly.

### Multiple subprojects

The OCCukes organisation publishes [various Cucumber-related subprojects](https://github.com/OCCukes/OCCukes/wiki/Repos). Although the OCCukes project lies at the core, complementary projects OCExpectations and a slew of iOS-specific spinoffs exist: UICukes, UIExpectations and UIAutomation. The structure helps to avoid an all-or-nothing mindset. Take whatever best suits your needs. The projects aim at various kinds of development projects: iOS application, Mac application, iOS library, or Mac framework.

OCCukes sub-projects prefixed by `OC` have Objective-C and Foundation framework dependencies. That means they work on iOS _and_ OS X platforms. They are cross-platform projects and incorporate iOS library targets as well as OS X framework targets.

Projects prefixed by `UI` have iOS UIKit dependencies. They aim at iOS projects only. Their Xcode projects contain a single iOS static library target. [UICukes](https://github.com/OCCukes/UICukes) acts as an umbrella project for iOS dependencies. It pulls in all other sub-projects needed for Cucumber on iOS. iOS developers will therefore normally clone out the UICukes submodule by itself. Doing so pulls in all other dependencies as sub-submodules.

## Troubleshooting

### Cucumber launches but invokes no steps

You press Cmd+U in Xcode to run your tests. There is a brief pause then you see the Cucumber output. Cucumber has executed and parsed the features and scenarios. Trouble is, Cucumber stops at the first scenario's first step. No steps execute. When you set a breakpoint within your step definitions, sure enough, they never run.

#### Solution

Make sure that you are not running a Cucumber instance in some other process. For example, you might be running it as part of an IDE for some other project, or some other components of the same project. Terminate the other Cucumbers and re-test.

## When and how to launch Cucumber?

Running Cucumber with Mac or iOS software requires two synchronised processes: a Cucumber client in Ruby, and an Objective-C wire server running within an application test bundle. The server needs to run first in order to open a wire server socket. The socket may be local or on another device. Actual iOS devices do not share the same local host. Hence the Cucumber client cannot assume `localhost`.

Wire server and client need to synchronise their execution. When Cucumber runs, it expects to connect to the wire server when it finds a wire configuration. Hence the Test scheme needs to launch the server beforehand. Best way to launch Cucumber from Xcode: use a pre-action within the Test scheme. Cucumber therefore needs to do three things at launch time:

1. fork itself into the background so that Xcode testing can proceed, that is, daemonise;
2. wait for the wire server to set itself up;
3. close down the wire server when Cucumber finishes running its features and invoking the remote-wire step definitions. This can happen automatically when it server sees no wire connection after a given period of time, say a second.

Step 2 raises issues when Cucumber tests actual iOS devices where the server does not open a port on `localhost`. Waiting for the wire server to initialise (step 2) requires that the Cucumber run-time environment establishes the wire server's address and port information. Without it, the Cucumber run will fail. The environment needs to wait an acceptable time for the server to appear on the prescribed port. Moreover, the client-side environment needs to attempt and reattempt to connect. The initial attempts will likely fail with a "refuse to connect" exception, simply because the server has not yet opened the socket. Steps 2 and 3 together imply a setting up and tearing down at the Cucumber client side.

## MIT Licensing

Copyright © 2012, The OCCukes Organisation. All rights reserved.

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

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

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

## Sponsors

- Levide Capital Limited, Blenheim, New Zealand

## Contributors

- Roy Ratcliffe, Pioneering Software, United Kingdom
- Bennett Smith, Focal Shift LLC, United States
- Terry Tucker, Focal Shift LLC, United States

repository: jar-son/OCCukes

repo_name: jar-son/OCCukes


text:
# Getting started:

### 1. Install from NuGET:

You can get the library via [NuGet](http://www.nuget.org) if you have the extension installed for Visual Studio or via the PowerShell package manager.  This control is published via NuGet at [SharpGIS.NmeaParser](https://nuget.org/packages/SharpGIS.NmeaParser).

            PM> Install-Package SharpGIS.NmeaParser

### 2. Create a new device:

```cs
 // Create one of the NMEA devices
 var device = new NmeaFileDevice("PathToNmeaLogFile.txt", 1000);
 // Listen to messages from the device:
 device.MessageReceived += device_NmeaMessageReceived;
 // Open the device and start receiving:
 device.OpenAsync();

 // Create event handler for receiving messages:
 private void device_NmeaMessageReceived(object sender, NmeaMessageReceivedEventArgs args)
 {
    // called when a message is received
    if(args.Message is NmeaParser.Messages.Rmc rmc)
    {
        Console.WriteLine($"Your current location is: {rmc.Latitude} , {rmc.Longitude}");
    }
 }
```
See the Platform specific device creation section in the menu for more specifics on device creation.

### 3. [Browse the API Reference](../api/index.md)

### 4. Explore the Object Model Diagrams
[.NET Standard OMD](../api/omd.html)

### 5. Explore the samples on GitHub:

 - [Desktop app](https://github.com/dotMorten/NmeaParser/tree/master/src/SampleApp.WinDesktop) (.NET Framework / .NET Core)
 - [Windows Universal app](https://github.com/dotMorten/NmeaParser/tree/master/src/SampleApp.UWP)
 - [Android app](https://github.com/dotMorten/NmeaParser/tree/master/src/SampleApp.Droid)

repository: Watch-Later/NmeaParser

repo_name: Watch-Later/NmeaParser


text:
ucasFL translating
4 Python libraries for building great command-line user interfaces
============================================================

### In the second installment of a two-part series on terminal applications with great command-line UIs, we explore Prompt Toolkit, Click, Pygments, and Fuzzy Finder.

![Getting started with 4 practical Python libraries: Prompt Toolkit, Click, Pygments, and Fuzzy Finder](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/library-libraries-search.png?itok=YE0Qk276 "Getting started with 4 practical Python libraries: Prompt Toolkit, Click, Pygments, and Fuzzy Finder")
>Image by : [Mennonite Church USA Archives][16]. Modified by Opensource.com. [CC BY-SA 4.0][17]

This is the second installment in my two-part series on terminal applications with great command-line UIs. In the [first article][18], I discussed features that make a command-line application a pure joy to use. In part two, I'll look at how to implement those features in Python with the help of a few libraries. By the end of this article, readers should have a good understanding of how to use [Prompt Toolkit][19], [Click][20] (Command Line Interface Creation Kit), [Pygments][21], and [Fuzzy Finder][22] to implement an easy-to-use [REPL][23].

I plan to achieve this in fewer than 20 lines of Python code. Let's begin.

Programming and development

*   [New Python content][1]

*   [Our latest JavaScript articles][2]

*   [Recent Perl posts][3]

*   [Red Hat Developers Blog][4]

### Python Prompt Toolkit

I like to think of this library as the Swiss Army knife of command-line apps—it acts as a replacement for **[readline][5]**, **[curses][6]**, and much more. Let's install the library and get started:

```
pip install prompt_toolkit
```

We'll start with a simple REPL. Typically a REPL will accept user input, do an operation, and print the results. For our example, we're going to build an "echo" REPL. It merely prints back what the user typed in:

### REPL

```
from prompt_toolkit import prompt

while 1:
    user_input = prompt('>')
    print(user_input)
```

That is all it takes to implement a REPL. It can read user input and print out what they have entered. The **prompt** function used in this code snippet is from the **prompt_toolkit** library; it is a replacement for the **readline** library.

### History

To enhance our REPL, we can add command history:

```
from prompt_toolkit import prompt
from prompt_toolkit.history import FileHistory

while 1:
    user_input = prompt('>',
                        history=FileHistory('history.txt'),
                       )
    print(user_input)
```

We've just added persistent history to our REPL. Now we can use the up/down arrow to navigate the history, and use the **Ctrl**+**R** to search the history. This satisfies the basic etiquette of a command line.

### Auto-suggestion

One of the discoverability tricks I covered in part one was the automatic suggestion of commands from the history. (We saw this feature pioneered in the **fish** shell.) Let's add that feature to our REPL:

```
from prompt_toolkit import prompt
from prompt_toolkit.history import FileHistory
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory

while 1:
    user_input = prompt('>',
                        history=FileHistory('history.txt'),
                        auto_suggest=AutoSuggestFromHistory(),
                       )
    print(user_input)
```

All we had to do was add a new argument to the **prompt()** API call. Now we have a REPL that has **fish**-style auto-suggestion from the history.

### Auto-completion

Now let's implement an enhancement of Tab-completion via auto-completion, which pops up possible suggestions as the user starts typing input.

How will our REPL know what to suggest? We supply a dictionary of possible items to suggest.

Let's say we're implementing a REPL for SQL. We can stock our auto-completion dictionary with SQL keywords. Let's see how to do that:

```
from prompt_toolkit import prompt
from prompt_toolkit.history import FileHistory
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
from prompt_toolkit.contrib.completers import WordCompleter

SQLCompleter = WordCompleter(['select', 'from', 'insert', 'update', 'delete', 'drop'],
                             ignore_case=True)

while 1:
    user_input = prompt('SQL>',
                        history=FileHistory('history.txt'),
                        auto_suggest=AutoSuggestFromHistory(),
                        completer=SQLCompleter,
                        )
    print(user_input)
```

Once again, we simply can use a built-in completion routine of prompt-toolkit called **WordCompleter**, which matches the user input with the dictionary of possible suggestions and offers up a list.

We now have a REPL that can do auto-completion, fish-style suggestions from history, and up/down traversal of history. All of that in less than 10 lines of actual code.

### Click

Click is a command-line creation toolkit that makes it easy to parse command-line options arguments and parameters for the program. This section does not talk about how to use Click as an arguments parser; instead, I'm going to look at some utilities that ship with Click.

Installing click is simple:

```
pip install click
```

### Pager

Pagers are Unix utilities that display long output one page at a time. Examples of pagers are **less**, **more**, **most**, etc. Displaying the output of a command via a pager is not just friendly design, but also the decent thing to do.

Let's take the previous example further. Instead of using the default **print()** statement, we can use **click.echo_via_pager()**. This will take care of sending the output to stdout via a pager. It is platform-agnostic, so it will work in Unix or Windows. **click.echo_via_pager()** will try to use decent defaults for the pager to be able to show color codes if necessary:

```
from prompt_toolkit import prompt
from prompt_toolkit.history import FileHistory
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
from prompt_toolkit.contrib.completers import WordCompleter
import click

SQLCompleter = WordCompleter(['select', 'from', 'insert', 'update', 'delete', 'drop'],
                             ignore_case=True)

while 1:
    user_input = prompt(u'SQL>',
                        history=FileHistory('history.txt'),
                        auto_suggest=AutoSuggestFromHistory(),
                        completer=SQLCompleter,
                        )
    click.echo_via_pager(user_input)
```

### Editor

One of the niceties mentioned in my previous article was falling back to an editor when the command gets too complicated. Once again **click** has an [easy API][24] to launch an editor and return the text entered in the editor back to the application:

```
import click
message = click.edit()
```

### Fuzzy Finder

Fuzzy Finder is a way for users to narrow down the suggestions with minimal typing. Once again, there is a library that implements Fuzzy Finder. Let's install the library:

```
pip install fuzzyfinder
```

The API for Fuzzy Finder is simple. You pass in the partial string and a list of possible choices, and Fuzzy Finder will return a new list that matches the partial string using the fuzzy algorithm ranked in order of relevance. For example:

```
>>> from fuzzyfinder import fuzzyfinder

>>> suggestions = fuzzyfinder('abc', ['abcd', 'defabca', 'aagbec', 'xyz', 'qux'])

>>> list(suggestions)
['abcd', 'defabca', 'aagbec']
```

Now that we have our **fuzzyfinder**, let's add it into our SQL REPL. The way we do this is to define a custom completer instead of the **WordCompleter** that comes with **prompt-toolkit**. For example:

```
from prompt_toolkit import prompt
from prompt_toolkit.history import FileHistory
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
from prompt_toolkit.completion import Completer, Completion
import click
from fuzzyfinder import fuzzyfinder

SQLKeywords = ['select', 'from', 'insert', 'update', 'delete', 'drop']

class SQLCompleter(Completer):
    def get_completions(self, document, complete_event):
        word_before_cursor = document.get_word_before_cursor(WORD=True)
        matches = fuzzyfinder(word_before_cursor, SQLKeywords)
        for m in matches:
            yield Completion(m, start_position=-len(word_before_cursor))

while 1:
    user_input = prompt(u'SQL>',
                        history=FileHistory('history.txt'),
                        auto_suggest=AutoSuggestFromHistory(),
                        completer=SQLCompleter(),
                        )
    click.echo_via_pager(user_input)
```

### Pygments

Now let's add syntax highlighting to the user input. We are building a SQL REPL, and having colorful SQL statements will be nice.

Pygments is a syntax highlighting library with built-in support for more than 300 languages. Adding syntax highlighting makes an application colorful, which helps users spot mistakes—such as typos, unmatched quotes, or brackets—in their SQL before executing it.

First install Pygments:

```
pip install pygments
```

Let's use Pygments to add color to our SQL REPL:

```
from prompt_toolkit import prompt
from prompt_toolkit.history import FileHistory
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
from prompt_toolkit.completion import Completer, Completion
import click
from fuzzyfinder import fuzzyfinder
from pygments.lexers.sql import SqlLexer

SQLKeywords = ['select', 'from', 'insert', 'update', 'delete', 'drop']

class SQLCompleter(Completer):
    def get_completions(self, document, complete_event):
        word_before_cursor = document.get_word_before_cursor(WORD=True)
        matches = fuzzyfinder(word_before_cursor, SQLKeywords)
        for m in matches:
            yield Completion(m, start_position=-len(word_before_cursor))

while 1:
    user_input = prompt(u'SQL>',
                        history=FileHistory('history.txt'),
                        auto_suggest=AutoSuggestFromHistory(),
                        completer=SQLCompleter(),
                        lexer=SqlLexer,
                        )
    click.echo_via_pager(user_input)
```

Prompt Toolkit works well with the Pygments library. We pick **SqlLexer** supplied by **Pygments** and pass it into the **prompt** API from **prompt-toolkit**. Now all user input is treated as SQL statements and colored appropriately.

### Conclusion

That concludes our journey through the creation of a powerful REPL that has all the features of a common shell, such as history, key bindings, and user-friendly features such as auto-completion, fuzzy finding, pager support, editor support, and syntax highlighting. We achieved all of that in fewer than 20 statements of Python.

Wasn't that easy? Now you have no excuses not to write a stellar command-line app. These resources might help:

*   [Click][7] (Command Line Interface Creation Kit)

*   [Fuzzy Finder][8]

*   [Prompt Toolkit][9]

*   See the [Prompt Toolkit tutorial tutorial][10] and [examples][11] in the prompt-toolkit repository.

*   [Pygments][12]

 _Learn more in Amjith Ramanujam's  [PyCon US 2017][13] talk, [Awesome Commandline Tools][14], May 20th in Portland, Oregon._

--------------------------------------------------------------------------------

作者简介：

Amjith Ramanujam - Amjith Ramanujam is the creator of pgcli and mycli. People think they're pretty cool and he doesn't disagree. He likes programming in Python, Javascript and C. He likes to write simple, understandable code, sometimes he even succeeds.

----------------------------

via: https://opensource.com/article/17/5/4-practical-python-libraries

作者：[ Amjith Ramanujam][a]
译者：[译者ID](https://github.com/译者ID)
校对：[校对者ID](https://github.com/校对者ID)

本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出

[a]:https://opensource.com/users/amjith
[1]:https://opensource.com/tags/python?src=programming_resource_menu
[2]:https://opensource.com/tags/javascript?src=programming_resource_menu
[3]:https://opensource.com/tags/perl?src=programming_resource_menu
[4]:https://developers.redhat.com/?intcmp=7016000000127cYAAQ&src=programming_resource_menu
[5]:https://docs.python.org/2/library/readline.html
[6]:https://docs.python.org/2/library/curses.html
[7]:http://click.pocoo.org/5/
[8]:https://pypi.python.org/pypi/fuzzyfinder
[9]:https://python-prompt-toolkit.readthedocs.io/en/latest/
[10]:https://github.com/jonathanslenders/python-prompt-toolkit/tree/master/examples/tutorial
[11]:https://github.com/jonathanslenders/python-prompt-toolkit/tree/master/examples/
[12]:http://pygments.org/
[13]:https://us.pycon.org/2017/
[14]:https://us.pycon.org/2017/schedule/presentation/518/
[15]:https://opensource.com/article/17/5/4-practical-python-libraries?rate=SEw4SQN1U2QSXM7aUHJZb2ZsPwyFylPIbgcVLgC_RBg
[16]:https://www.flickr.com/photos/mennonitechurchusa-archives/6987770030/in/photolist-bDu9zC-ovJ8gx-aecxqE-oeZerP-orVJHj-oubnD1-odmmg1-ouBNHR-otUoui-occFe4-ot7LTD-oundj9-odj4iX-9QSskz-ouaoMo-ous5V6-odJKBW-otnxbj-osXERb-iqdyJ8-ovgmPu-bDukCS-sdk9QB-5JQauY-fteJ53-ownm41-ov9Ynr-odxW52-rgqPBV-osyhxE-6QLRz9-i7ki3F-odbLQd-ownZP1-osDU6d-owrTXy-osLLXS-out7Dp-hNHsya-wPbFkS-od7yfD-ouA53c-otnzf9-ormX8L-ouTj6h-e8kAze-oya2zR-hn3B2i-aDNNqk-aDNNmR
[17]:https://creativecommons.org/licenses/by-sa/4.0/
[18]:https://opensource.com/article/17/4/4-terminal-apps
[19]:https://python-prompt-toolkit.readthedocs.io/en/latest/
[20]:http://click.pocoo.org/5/
[21]:http://pygments.org/
[22]:https://pypi.python.org/pypi/fuzzyfinder
[23]:https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop
[24]:http://click.pocoo.org/5/utils/#launching-editors
[25]:https://opensource.com/user/125521/feed
[26]:https://opensource.com/article/17/5/4-practical-python-libraries#comments
[27]:https://opensource.com/users/amjith

url: https://raw.githubusercontent.com/yirenzui8/TranslateProject/303a1cff4a5e16eb3b9d6e8243e36a6a0b374503/sources/tech/20170509 4 Python libraries for building great command-line user interfaces.md


text:
# GSM Huawei network card mode

In order to use the Huawei E3372 key in network card mode, it is necessary to change the operating mode of the key. By default, this is configured in Modem mode in order to be compatible with the SMS plugin.

# Deleting the default configuration

``sudo rm /etc/udev/rules.d/40-modemswitch.rules``

# Adding configuration

``sudo nano /etc/usb_modeswitch.conf``

then add this :

````
TargetVendor=0x12d1
TargetProductList=“14db,14dc”
HuaweiNewMode=1
NoDriverLoading=1
````

Then save by pressing Ctrl + x

# Reboot

``sudo reboot``

You can then check that the card is well recognized by doing an ifconfig, you should see a usbnet key appear.

repository: jeedom/documentations

repo_name: jeedom/documentations