text:
# socket-controllers

![Build Status](https://github.com/typestack/socket-controllers/workflows/CI/badge.svg)
[![codecov](https://codecov.io/gh/typestack/socket-controllers/branch/develop/graph/badge.svg)](https://codecov.io/gh/typestack/socket-controllers)
[![npm version](https://badge.fury.io/js/socket-controllers.svg)](https://badge.fury.io/js/socket-controllers)

Use class-based controllers to handle websocket events. Helps to organize your code using websockets in classes.

## Installation

1. Install `socket-controllers`:

   ```
   npm install socket-controllers
   ```

2. Install `reflect-metadata` shim:

   ```
   npm install reflect-metadata
   ```

   and make sure to import it in a global place, like app.ts:

   ```typescript
   import 'reflect-metadata';
   ```

3. Install a DI container, for example `typedi`;

   ```
   npm install typedi
   ```

## Example of usage

1. Create a file `MessageController.ts`

   ```typescript
   import {
     OnConnect,
     SocketController,
     ConnectedSocket,
     OnDisconnect,
     MessageBody,
     OnMessage,
   } from 'socket-controllers';
   import {Service} from 'typedi'; // Only if you are using typedi

   @SocketController()
   @Service() // Only if you are using typedi
   export class MessageController {
     @OnConnect()
     connection(@ConnectedSocket() socket: any) {
       console.log('client connected');
     }

     @OnDisconnect()
     disconnect(@ConnectedSocket() socket: any) {
       console.log('client disconnected');
     }

     @OnMessage('save')
     save(@ConnectedSocket() socket: any, @MessageBody() message: any) {
       console.log('received message:', message);
       console.log('setting id to the message and sending it back to the client');
       message.id = 1;
       socket.emit('message_saved', message);
     }
   }
   ```

2. Create a file `app.ts`

   ```typescript
   import 'es6-shim'; // this shim is optional if you are using old version of node
   import 'reflect-metadata'; // this shim is required
   import { SocketControllers } from 'socket-controllers';
   import { MessageController } from './MessageController';
   import {Container} from 'typedi'; // Only if you are using typedi

   new SocketControllers({
     port: 3001,
     container: Container,
     controllers: [MessageController],
   });
   ```

3. Now you can send `save` websocket message using websocket-client.

## More usage examples

#### Run code on socket client connect / disconnect / disconnecting

Controller action marked with `@OnConnect()` decorator is called once new client connected.
Controller action marked with `@OnDisconnect()` decorator is called once client disconnected.
Controller action marked with `@OnDisconnecting()` decorator is called when the client is disconnecting, before the disconnect event.

```typescript
import { SocketController, OnConnect, OnDisconnect, OnDisconnecting } from 'socket-controllers';

@SocketController()
export class MessageController {
  @OnConnect()
  save() {
    console.log('client connected');
  }

  @OnDisconnect()
  save() {
    console.log('client disconnected');
  }

  @OnDisconnecting()
  save() {
    console.log('client is disconnecting');
  }
}
```

#### `@ConnectedSocket()` decorator

To get connected socket instance you need to use `@ConnectedSocket()` decorator.

```typescript
import { SocketController, OnMessage, ConnectedSocket } from 'socket-controllers';

@SocketController()
export class MessageController {
  @OnMessage('save')
  save(@ConnectedSocket() socket: any) {
    socket.emit('save_success');
  }
}
```

#### `@MessageBody()` decorator

To get received message body use `@MessageBody()` decorator:

```typescript
import { SocketController, OnMessage, MessageBody } from 'socket-controllers';

@SocketController()
export class MessageController {
  @OnMessage('save')
  save(@MessageBody() message: any) {
    console.log('received message: ', message);
  }
}
```

If you specify a class type to parameter that is decorated with `@MessageBody()`,
socket-controllers will use [class-transformer][1] to create instance of the given class type with the data received in the message.
To disable this behaviour you need to specify `{ transformOption: { transform: false ] }` in SocketControllerOptions when creating a server.

You can define an index to get multiple parameters from the socket event.

```typescript
import { SocketController, OnMessage, MessageBody } from 'socket-controllers';

@SocketController()
export class MessageController {
  @OnMessage('save')
  save(@MessageBody({index: 0}) param1: any, @MessageBody({index: 1}) param2: any) {
    console.log('received message: ', message1);
    console.log('received message: ', message2);
  }
}
```

#### `@MessageAck()` decorator

To get received message ack use `@MessageAck()` decorator:

```typescript
import { SocketController, OnMessage, MessageAck, MessageBody } from 'socket-controllers';

@SocketController()
export class MessageController {
  @OnMessage('save')
  save(@MessageBody() message: any, @MessageAck() ack: Function) {
    console.log('received message: ', message);
    ack('callback message');
  }
}
```

> note: ack must be the last parameter in `emit`, otherwise it will be `null`

#### `@SocketQueryParam()` decorator

To get received query parameter use `@SocketQueryParam()` decorator.

```typescript
import { SocketController, OnMessage, MessageBody } from 'socket-controllers';

@SocketController()
export class MessageController {
  @OnMessage('save')
  save(@SocketQueryParam('token') token: string) {
    console.log('authorization token from query parameter: ', token);
  }
}
```

#### Get socket client id using `@SocketId()` decorator

To get connected client id use `@SocketId()` decorator.

```typescript
import { SocketController, OnMessage, MessageBody } from 'socket-controllers';

@SocketController()
export class MessageController {
  @OnMessage('save')
  save(@SocketId() id: string) {}
}
```

#### Get access to using socket.io instance using `@SocketIO()` decorator

```typescript
import { SocketController, OnMessage, MessageBody } from 'socket-controllers';

@SocketController()
export class MessageController {
  @OnMessage('save')
  save(@SocketIO() io: any) {
    // now you can broadcast messages to specific rooms or namespaces using io instance
  }
}
```

#### Send message back to client after method execution

You can use `@EmitOnSuccess` decorator:

```typescript
import { SocketController, OnMessage, EmitOnSuccess } from 'socket-controllers';

@SocketController()
export class MessageController {
  @OnMessage('save')
  @EmitOnSuccess('save_successfully')
  save() {
    // after this controller executed "save_successfully" message will be emitted back to the client
  }
}
```

If you return something, it will be returned in the emitted message data:

```typescript
import { SocketController, OnMessage, EmitOnSuccess } from 'socket-controllers';

@SocketController()
export class MessageController {
  @OnMessage('save')
  @EmitOnSuccess('save_successfully')
  save() {
    // after this controller executed "save_successfully" message will be emitted back to the client with message object
    return {
      id: 1,
      text: 'new message',
    };
  }
}
```

You can also control what message will be emitted if there is error/exception during execution:

```typescript
import { SocketController, OnMessage, EmitOnSuccess, EmitOnFail } from 'socket-controllers';

@SocketController()
export class MessageController {
  @OnMessage('save')
  @EmitOnSuccess('save_successfully')
  @EmitOnFail('save_error_range', {errorType: RangeError})
  @EmitOnFail('save_error_type', {errorType: TypeError})
  @EmitOnFail('save_error')
  save() {
    if (1 === 1) {
      throw new Error('One is equal to one! Fatal error!');
    }
    return {
      id: 1,
      text: 'new message',
    };
  }
}
```

In this case `save_error` message will be sent to the client with `One is equal to one! Fatal error!` error message.
The order is important when defining multiple `@EmitOnFail()` decorators, the first matching errorType will be served

Sometimes you may want to not emit success/error message if returned result is null or undefined.
In such cases you can use `@SkipEmitOnEmptyResult()` decorator.

```typescript
import { SocketController, OnMessage, EmitOnSuccess, EmitOnFail, SkipEmitOnEmptyResult } from 'socket-controllers';

@SocketController()
export class MessageController {
  @OnMessage('get')
  @EmitOnSuccess('get_success')
  @SkipEmitOnEmptyResult()
  get(): Promise<Message[]> {
    return this.messageRepository.findAll();
  }
}
```

In this case if findAll will return undefined, `get_success` message will not be emitted.
If findAll will return array of messages, they will be emitted back to the client in the `get_success` message.
This example also demonstrates Promises support.
If promise returned by controller action, message will be emitted only after promise will be resolved.

#### Using exist server instead of creating a new one

If you need to create and configure socket.io server manually,
you can pass it to the `SocketControllers` constructor.
Here is example of creating socket.io server and configuring it with express:

```typescript
import 'reflect-metadata'; // this shim is required
import { SocketControllers } from 'socket-controllers';
import { Server } from 'socket.io';
import { Container } from 'typedi'; // Only if you are using typedi

const app = require('express')();
const server = require('http').Server(app);
const io = new Server(server);

server.listen(3001);

app.get('/', function (req: any, res: any) {
  res.send('hello express');
});

io.use((socket: any, next: Function) => {
  console.log('Custom middleware');
  next();
});
new SocketControllers({io, container: Container});
```

#### Load all controllers from the given directory

You can load all controllers in once from specific directories, by specifying array of directories via options in
`createSocketServer` or `useSocketServer`:

```typescript
import 'reflect-metadata'; // this shim is required
import { SocketControllers } from 'socket-controllers';
import { Container } from 'typedi'; // Only if you are using typedi

new SocketControllers({
  port: 3000,
  container: Container,
  controllers: [__dirname + '/controllers/*.js'],
}); // registers all given controllers
```

#### Using socket.io namespaces

To listen to messages only of the specific namespace you can mark a controller with namespace:

```typescript
@SocketController('/messages')
export class MessageController {
  // ...
}
```

Also you can use dynamic namespace, like `express router` patterns:

```typescript
@SocketController('/messages/:userId')
export class MessageController {
  // ...
}
```

## Using middlewares

Middlewares are the functions passed to the `socketIo.use` method.
Middlewares allows you to define a logic that will be executed each time client connected to the server.
To create your middlewares use `@Middleware` decorator:

```typescript
import { Middleware, MiddlewareInterface } from 'socket-controllers';

@Middleware()
export class CompressionMiddleware implements MiddlewareInterface {
  use(socket: any, next: (err?: any) => any) {
    console.log('do something, for example get authorization token and check authorization');
    next();
  }
}
```

You can limit middlewares to namespaces providing either a `string`, `RegExp` or `Array<string | RegExp>` to the `namespace` parameter:

```typescript
import { Middleware, MiddlewareInterface } from 'socket-controllers';

@Middleware({namespace: '/test'})
export class CompressionMiddleware implements MiddlewareInterface {
  use(socket: any, next: (err?: any) => any) {
    console.log('do something, for example get authorization token and check authorization');
    next();
  }
}
```

## Don't forget to load your controllers and middlewares

Controllers and middlewares should be loaded:

```typescript
import 'reflect-metadata';
import { SocketControllers } from 'socket-controllers';
import { MessageController } from './MessageController';
import { MyMiddleware } from './MyMiddleware'; // here we import it
import { Container } from 'typedi'; // Only if you are using typedi
const server = new SocketControllers({
  port: 3000,
  container: Container,
  controllers: [MessageController],
  middlewares: [MyMiddleware],
});
```

Also you can load them from directories. Also you can use glob patterns:

```typescript
import 'reflect-metadata';
import { SocketControllers } from 'socket-controllers';
import { Container } from 'typedi'; // Only if you are using typedi
const server = new SocketControllers({
   port: 3000,
   container: Container,
   controllers: [__dirname + '/controllers/**/*.js'],
   middlewares: [__dirname + '/middlewares/**/*.js'],
});
```

## Using DI container

`socket-controllers` supports a DI container out of the box. You can inject your services into your controllers and
middlewares. Container must be setup during application bootstrap.
Here is example how to integrate socket-controllers with [typedi](https://github.com/pleerock/typedi):

```typescript
import 'reflect-metadata';
import { SocketControllers } from 'socket-controllers';
import { Container } from 'typedi';

// create and run socket server
const server = new SocketControllers({
  port: 3000,
  container: Container,
  controllers: [__dirname + '/controllers/*.js'],
  middlewares: [__dirname + '/middlewares/*.js'],
});
```

That's it, now you can inject your services into your controllers:

```typescript
@Service()
@SocketController()
export class MessageController {
  constructor(private messageRepository: MessageRepository) {}

  // ... controller actions
}
```

> Note: TypeDI won't create instances for unknown classes since 0.9.0, you have to decorate your Class as a `Service()` as well.

### Scoped controllers

You can enable scoped controllers by providing a `scopedContainerGetter` function in SocketServerOptions. This function should return a new container that will be used to instantiate the controller and its dependencies.

You will get a new instance for each event in the controller.

The `scopedContainerGetter` function receives the `SocketEventContext`.

The `scopedContainerDisposer` function receives the container instance you created with `scopedContainerGetter` after the socket action is finished. Use this function to dispose the container if needed.

```typescript
import 'reflect-metadata';
import { SocketControllers, SocketEventContext } from 'socket-controllers';
import { Container, ContainerInstance, Token } from "typedi";

const myDiToken = new Token();

// create and run socket server
const server = new SocketControllers({
   port: 3000,
   container: Container,
   scopedContainerGetter: (args: SocketEventContext) => {
      const container = Container.of(YOUR_REQUEST_CONTEXT);
      container.set(myDiToken, 'MY_VALUE');
      return container;
   },
   scopedContainerDisposer: (container: ContainerInstance) => {
     container.dispose();
   },
   controllers: [__dirname + '/controllers/*.js'],
   middlewares: [__dirname + '/middlewares/*.js'],
});
```

## Interceptors

Interceptors allow you to wrap your event handlers in higher order functions.
With interceptors you can add logging or modify the incoming or outgoing data for event handlers.

```typescript
import {
   SocketController,
   OnMessage,
   EmitOnSuccess,
   EmitOnFail,
   SkipEmitOnEmptyResult,
   UseInterceptor,
   MessageBody
} from 'socket-controllers';

const interceptor: InterceptorInterface = {
   use: (ctx: SocketEventContext, next: () => any) => {
     ctx.messageArgs[0] = 'modified message from controller - ' + ctx.messageArgs[0];
     const resp = next();
     return 'modified response from controller - ' + resp; // modified response from controller - modified response from method - reponse
   },
};

@Service()
class Interceptor implements InterceptorInterface {
   async use(ctx: SocketEventContext, next: () => any) {
     ctx.messageArgs[0] = 'modified message from method - ' + ctx.messageArgs[0];
     const resp = await next();
     return 'modified response from method - ' + resp; // modified response from method - reponse
   }
}

@SocketController()
@UseInterceptor(interceptor)
export class MessageController {
   @OnMessage('get')
   @EmitOnSuccess('get_success')
   @SkipEmitOnEmptyResult()
   @UseInterceptor(Interceptor)
   get(@MessageBody() message: string): Promise<Message[]> {
     console.log(message); // modified message from controller - modified message from method - original message
     return 'response';
   }
}
```

Interceptors are executed in order of definition, starting with the controller interceptors.

## Decorators Reference

| Signature                              | Description                                                                                |
|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `@SocketController(namespace?: string\ | Regex)`                                                                                | Registers a class to be a socket controller that can listen to websocket events and respond to them.                                                                                |
| `@OnMessage(messageName: string)`      | Registers controller's action to be executed when socket receives message with given name.                                                                                |
| `@OnConnect()`                         | Registers controller's action to be executed when client connects to the socket.                                                                                |
| `@OnDisconnect()`                      | Registers controller's action to be executed when client disconnects from the socket.                                                                                |
| `@OnDisconnecting()`                   | Registers controller's action to be executed when client is disconnecting from the socket.                                                                                |
| `@ConnectedSocket()`                   | Injects connected client's socket object to the controller action.                                                                                |
| `@SocketIO()`                          | Injects socket.io object that initialized a connection.                                                                                |
| `@MessageBody()`                       | Injects received message body.                                                                                |
| `@SocketQueryParam(paramName: string)` | Injects query parameter from the received socket request.                                                                                |
| `@SocketId()`                          | Injects socket id from the received request.                                                                                |
| `@SocketRequest()`                     | Injects request object received by socket.                                                                                |
| `@SocketRooms()`                       | Injects rooms of the connected socket client.                                                                                |
| `@NspParams()`                         | Injects dynamic namespace params.                                                                                |
| `@NspParam(paramName: string)`         | Injects param from the dynamic namespace.                                                                                |
| `@Middleware()`                        | Registers a new middleware to be registered in the socket.io.                                                                                |
| `@EmitOnSuccess(messageName: string)`  | If this decorator is set then after controller action will emit message with the given name after action execution. It will emit message only if controller succeed without errors. If result is a Promise then it will wait until promise is resolved and emit a message. |
| `@EmitOnFail(messageName: string)`     | If this decorator is set then after controller action will emit message with the given name after action execution. It will emit message only if controller throw an exception. If result is a Promise then it will wait until promise throw an error and emit a message.  |
| `@SkipEmitOnEmptyResult()`             | Used in conjunction with @EmitOnSuccess and @EmitOnFail decorators. If result returned by controller action is null or undefined then messages will not be emitted by @EmitOnSuccess or @EmitOnFail decorators.                                                            |     |

## Samples

Take a look on samples in [./sample](https://github.com/pleerock/socket-controllers/tree/master/sample) for more examples
of usage.

## Related projects

- If you are interested to create controller-based express or koa server use [routing-controllers](https://github.com/pleerock/routing-controllers) module.
- If you need to use dependency injection in use [typedi](https://github.com/pleerock/typedi) module.

[1]: https://github.com/pleerock/class-transformer

repository: typestack/socket-controllers

branch_name: refs/heads/develop

repo_name: typestack/socket-controllers


text:
---
layout: default
---

# 1992-11-28 - FutureCulture FAQ

## Header Data

From<EMAIL_ADDRESS>(Yanek Martinson)

To<EMAIL_ADDRESS>Message Hash: 120241ed25ef6256f4a9c311a9972916e25cc5c19f5c40812cf8422e1f3d0f70

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1992-11-28 15:44:49 UTC

Raw Date: Sat, 28 Nov 92 07:44:49 PST

## Raw message

```
{% raw  %}From<EMAIL_ADDRESS>(Yanek Martinson)
Date: Sat, 28 Nov 92 07:44:49 PST
To<EMAIL_ADDRESS>Subject: FutureCulture FAQ
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

Does anyone have a copy?  Nyx seems to be down for the last couple
of days so I can't get it.

Don't send it to me, I don't want to have 150 copies of this fairly
large document pile up in my mailbox overnight, just let me know if
you have it, and I will request ONE of you to send it.

Thanks.

Yanek<EMAIL_ADDRESS>

{% endraw %}
```

## Thread

+ Return to [November 1992](/archive/1992/11)

+ Return to<EMAIL_ADDRESS>(Yanek Martinson)](/authors/yanek_at_novavax_nova_edu_yanek_martinson_)"

+ 1992-11-28 (Sat, 28 Nov 92 07:44:49 PST) - FutureCulture FAQ -<EMAIL_ADDRESS>(Yanek Martinson)_

license: MIT

branch_name: refs/heads/master

extension: md

gha_license_id: MIT

license_type: permissive


text:
---
layout: entry
title: "ORGANIZATION"
shortdef: "human groups established for a purpose"
---

References to human groups that have been established for a specific
purpose are annotated as `ORGANIZATION`.

<!-- details -->

Example:

~~~ ann
Google acquired YouTube.
T1 ORGANIZATION 0 6 Google
T2 ORGANIZATION 16 23 YouTube
~~~

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

(This is an example entry in the `entity` collection. You can find the
source of this document in the `_entity/` directory, file
`organization.md`. To add new entries like this, simply add new `.md`
files into the `_entity/` directory.)


text:
### csv_parser function

```python
osmi_helpers.data_gathering.csv_parser(df, mapping_csv)
```

Selects and renames columns according to a CSV file that defines the
    parsing rules.

    Arguments:
    ---------

        ``df``: DataFrame
            The Raw Dataframe we want to use import into OSM.

        ``mapping_csv``: String
            The path pointing to a CSV with the parsing rules. The CSV must
            have the following columns: `Original field`, `Description`,
            `OSM tagging`, `Comments`, otherwise the function will not work.
.

    Returns:
    --------

        ``df``: A clean dataframe, ready for importing to OSM.

----

gha_language: Jupyter Notebook


text:
This is an implementation of "Vectorization of Line Drawings via PolyVector Fields" by Mikhail Bessmeltsev and Justin Solomon, Massachusetts Institute of Technology, 2018.
Actual coding done by Mikhail Bessmeltsev, http://www-labs.iro.umontreal.ca/~bmpix/.

USAGE:
./polyvector(.exe) filename

OUTPUT:
Creates a filename.svg in the same folder.

## Requirements

(Other versions might also work, but these are the ones I used)
- QT 5.7 (for the version with GUI, see line 2 of main.cpp)
- OpenCV 2.4
- Boost 1.65.1
- Eigen 3.3.1

## Citation

When using the code in your research work, please cite the following paper:

    @article{Bessm2019,
    author = {Bessmeltsev, Mikhail and Solomon, Justin},
    title = {Vectorization of Line Drawings via Polyvector Fields},
    journal = {ACM Trans. Graph.},
    issue_date = {February 2019},
    volume = {38},
    number = {1},
    month = jan,
    year = {2019},
    pages = {9:1--9:12},
    articleno = {9},
    numpages = {12},
    publisher = {ACM},
    address = {New York, NY, USA},
    keywords = {Vectorization, frame field, line drawing, polyvector field},
    }

## Building

1. Create folder 'build' in the same folder as this README.
2. In cmd (windows) or sh/bash (linux/mac):
   > cd build
   > cmake ..
   > make

(If you are on Windows, the last instruction will depend on the compiler you're using, e.g. 'nmake' for Visual Studio)

## Parameters

1. All the tunable parameters are in Params.h
2. In a couple of places in the code there are seemingly random constants like 10 - those are implementation-dependent constants and have nothing to do with algorithm parameters. Proper engineering would fix those, but before that happens - please do not change.

## Notes

1. This is not the optimized version we tested for performance. The optimized version is available upon request.
2. There are a few minor changes from the paper description:
	- Section 5.2 has been reimplemented since the submission for robustness. This might have introduced minor (~2 pixel)-differences to some of the results, mostly making them better.
	- Instead of outputting a raw non-smooth vectorization with many segments, which takes a while to output, we use Douglas-Peucker algorithm and then Laplacian smoothing on the result. Douglas-Peucker does not change anything significant in the result, except for the density of the control points. Laplacian smoothing was not used for the paper results, instead we used, as we noted, Adobe Illustrator's 'Simplify' feature. Those two steps were added to immediately output a decent .svg if Illustrator is not available.
3. If you want to build a command-line tool without GUI, comment out this line in the beginning of main.cpp:
     >  #define WITH_GUI 1

## Known Issues

1. Output might contain 'nan's. Your importer/viewer should ignore those points.

repository: jianantian/PolyVectorization

repo_name: jianantian/PolyVectorization


text:
# yynn
A neural network framework in C++.

This framework comes from homework. By the time I finished the neural network using numpy as scipy in Python, I felt like implementing one neural network by myself. So there it is!.

This framework has features like:

- Slow

- Lame usage

- Bad runtime speed

But I am working on that! Give me a star and get updated!

---

# Usage

add all files in your workspace, and use the neural network by

```C++
#include 'nn.h'
```

You can create a neuralnetwork object by

```C++
vector<int> layer_info{1,2,1};
double learning_rate = 0.01
neuralnetwork::neuralnetwork nn(layer_info, learning_rate);
```

You can feed the data and train the model by
```C++
vector<vector<double> > X, Y; // Some data you get from elsewhere

nn.train(X, Y);
```

Then you can run the evaluation to get predictions

```C++
vector<vector<double> > x;

nn.evaluation(x);
```

Since it based on the homework, the evaluation part is only made for a regression function. You can rewrite the evaluation() to fit your own purpose. Here 's the result of the regression in lecture by using 100 unit of 1-hidden layer training for 200 epoch.

![Regression Sample](fig/eg.png)


text:
# Full installation (VsCode, Git and GitExtension)

```CMD
install.cmd
``````

**Note:**
this is basically for the first or fresh installation.

## create Default User Environment

```cmd
launch "PrepareEnviroment"
```

**Note:**
create or update PSConfig, VS Config and VS Snippset and install VS Code extensionss

## Description

simple help for the installation and configuration of VS Code and PowerShell for the current user.
The script can help you set up each machine in the same way.

## Keybindings

### Zeilen in Arrays umwandeln

convert single line list
Crtl-SHift-q-a

### SQL Extension wie PowerShell

* F5
* F8
same function as the SQL Managemnet Studio

eof


text:
This Jamf Pro Extension Attribute checks to see if Jamf Protect is installed and executable.

If Jamf Protect is installed:

`/Library/Application Support/JamfProtect/JamfProtect.app` will be present.

If Jamf Protect is not installed::

`/Library/Application Support/JamfProtect/JamfProtect.app` will not be found.

If Jamf Protect is installed, the following message is displayed:

`1`

Otherwise, the following result is returned:

`0`

See `Jamf_Pro_Extension_Attribute_Setup.png` for a screenshot of how the Extension Attribute should be configured.

![Jamf_Pro_Extension_Attribute_Setup.png](Jamf_Pro_Extension_Attribute_Setup.png)

branch_name: refs/heads/main

gha_language: Shell


text:
# Mint 🌱

> Functional HTTP client for Elixir with support for HTTP/1 and HTTP/2.

## Installation

To install Mint, add it to your `mix.exs` file. Unless you're using your own SSL certificate store, also add the [CAStore][castore] library to your dependencies.

```elixir
defp deps do
  [
    {:castore, "~> 0.1.0"},
    {:mint, "~> 0.1.0"}
  ]
end
```

Then, run `$ mix deps.get`.

## Usage

Mint is different from most Erlang and Elixir HTTP clients because it provides a process-less architecture. Instead, Mint is based on a functional and immutable data structure that represents an HTTP connection. This data structure wraps a TCP or SSL socket. This allows for more fine-tailored architectures where the developer is responsible for wrapping the connection struct, such as having one process handle multiple connections or having different kinds of processes handle connections.

Below is an example of a basic interaction with Mint. First, we start a connection through `Mint.HTTP.connect/3`:

```elixir
iex> {:ok, conn} = Mint.HTTP.connect(:http, "httpbin.org", 80)
```

This transparently chooses between HTTP/1 and HTTP/2. Requests are sent with:

```elixir
iex> {:ok, conn, request_ref} = Mint.HTTP.request(conn, "GET", "/", [], "")
```

The connection socket runs in [*active mode*](http://erlang.org/doc/man/inet.html#setopts-2), which means that the user of the library needs to handle [TCP messages](http://erlang.org/doc/man/gen_tcp.html#connect-4) and [SSL messages](http://erlang.org/doc/man/ssl.html#id66002):

```elixir
iex> flush()
{:tcp, #Port<0.8>,
 "HTTP/1.1 200 OK\r\n" <> _}
```

To handle such messages, Mint provides a `stream/2` function that turns messages into HTTP responses. Responses are streamed back to the user in parts through response parts `:status`, `:headers`, `:data`, and finally `:done`.

```elixir
iex> {:ok, conn} = Mint.HTTP.connect(:http, "httpbin.org", 80)
iex> {:ok, conn, request_ref} = Mint.HTTP.request(conn, "GET", "/", [], "")
iex> receive do
...>   message ->
...>     {:ok, conn, responses} = Mint.HTTP.stream(conn, message)
...>     IO.inspect responses
...> end
[
  {:status, #Reference<...>, 200},
  {:headers, #Reference<...>, [{"connection", "keep-alive"}, ...},
  {:data, #Reference<...>, "<!DOCTYPE html>..."},
  {:done, #Reference<...>}
]
```

The connection API is stateless, this means that you need to make sure to always save the returned `conn`:

```elixir
# Wrong
{:ok, _conn, ref} = Mint.HTTP.request(conn, "GET", "/foo", [], "")
{:ok, conn, ref} = Mint.HTTP.request(conn, "GET", "/bar", [], "")

# Correct
{:ok, conn, ref} = Mint.HTTP.request(conn, "GET", "/foo", [], "")
{:ok, conn, ref} = Mint.HTTP.request(conn, "GET", "/bar", [], "")
```

For more information, see [the documentation][documentation].

### SSL certificates

When using SSL, you can pass in your own CA certificate store or use one provided by Mint. Mint doesn't ship with the certificate store itself, but it has an optional dependency on [CAStore][castore], which provides an up-to-date certificate store. If you don't want to use your own certificate store, just add `:castore` to your dependencies.

```elixir
def deps do
  [
    {:castore, "~> 0.1.0"},
    {:mint, "~> 0.1.0"}
  ]
end
```

## Contributing

Mint has not yet reached an initial 0.1.0 release and the current goal is to reach a minimal first release. Because of this Mint is still in a lot of flux and we want to focus on changes only required for getting to 0.1.0. If you wish to contribute check out the [issue list](https://github.com/ericmj/mint/issues) and let us know what you want to work on so we can discuss it and reduce duplicate work.

## License

Copyright 2018 Eric Meadows-Jönsson and Andrea Leopardi

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

[castore]: https://github.com/ericmj/castore
[documentation]: https://hexdocs.pm/mint

repository: starbelly/mint

gha_language: Elixir

repo_name: starbelly/mint


text:
# VaccinePass

A (hybrid) mobile app for Syrian refugee parents to keep track of their childrens' vaccinations.

##The App Basics
The main users of this app will be refugee parents staying in camps, e.g. in Turkey or Lebanon.
The app will concentrate only on children aged 0-5.
The parent will download the app, enter names (or aliases) and ages of their children.
A list of potential vaccines will show up - the parent can tick the vaccines they are sure the child has been given, otherwise it will be assumed the child doesn't have them.
Main page will show tabs for each child, with details of vaccinations.
Another child can be added at any time.
Data is only stored locally on the phone.

##The Use of the App
Each participating NGO will have a series of barcdoes printed out in their office/clinic:
- A barcode for the NGO (specific to that camp?)
- A barcode for each relevant vaccine for under 5 year olds

When a parent comes in to vaccinate their child(ren), they can show the doctor the vaccines their child(ren) has/have been given.
When giving a vaccine, the doctor will scan the NGO barcode and the barcodes for the vaccines given.
The parent chooses which child these vaccines were for, and the details of the vaccine will be held for that child:
- Name of vaccine
- NGO who provided vaccine
- Date vaccine given

## Slack Channel
This is the Slack channel for those who would like to communicate and collaborate with team members via **Slack**.
Once you have joined the **Slack Team** [EmpowerHack_LDN] (http://slack.empowerhack.io), the channel for VaccinePass is `healthldn_vaccinepass`.

repository: empowerhack/VaccinePass

repo_name: empowerhack/VaccinePass


text:
# Kernels on fuzzy sets library

## Synopsis
This project contains implementations of kernels on fuzzy sets.
We will include examples of the use of those kernels in the following domains:
* similarity measure between fuzzy sets. A possible example will be to measure similarity across subjective opinions, beliefs/uncertanty represented by linguistic values, etc
* similarity between regions in image processing
* estimation of distances (metrics) between fuzzy sets
* fuzzy data analytics (statistics from fuzzy data using kernels)
* fuzzification of datasets
* computation of kernel gram matrices from fuzzy data
* data description of fuzzy data (minimum volume sets, density estimation, one-class classification, etc)
* predictive modeling (machine learning) of fuzzy data (classification, regression, ranking, etc)
* kriging on fuzzy data
* integration with scikit-learn

## References
**_Kernels on Fuzzy Sets: an Overview_**,
Guevara Jorge and Canu Stephane and Hirata Jr Roberto
Learning on Distributions, Functions, Graphs and Groups @ NIPS-2017

**_Cross product kernels on fuzzy sets for fuzzy set similarity_**,
2017 IEEE International Conference on Fuzzy Systems - FUZZ-IEEE 2017
Guevara, Jorge  and Canu, Stephane and Hirata Jr, Roberto

**_Positive Definite Kernel Functions on Fuzzy Sets_** ,
Guevara Jorge and Canu Stephane and Hirata Jr Roberto
2014 IEEE International Conference on Fuzzy Systems - FUZZ-IEEE

**_Kernel Functions in Takagi-Sugeno-Kang Fuzzy System with Nonsingleton Fuzzy Input_**,
Guevara Jorge and Canu Stephane and Hirata Jr Roberto
IEEE International Conference on Fuzzy Systems'' - FUZZ-IEEE 2013

**_Fuzzy Set Similarity using a Distance-Based Kernel on Fuzzy Sets._**
Guevara, Jorge and Canu, Stephane and Hirata Jr, Roberto.
Book Chapter, Handbook of Fuzzy Sets Comparison - Theory, Algorithms and Applications

---
## Prerequisites
* Numpy
* Scikit-Fuzzy
## Installation

## Motivation

## Contributors
Lucas Yau,
Jorge Guevara,
Roberto Hirata Jr

repository: jorjasso/fuzzy-kernel-machines

repo_name: jorjasso/fuzzy-kernel-machines


text:
# node-red-contrib-alexa-home

[![CI](https://github.com/mabunixda/node-red-contrib-alexa-home/actions/workflows/ci.yml/badge.svg)](https://github.com/mabunixda/node-red-contrib-alexa-home/actions/workflows/ci.yml)

[![Known Vulnerabilities](https://snyk.io/test/github/mabunixda/node-red-contrib-alexa-home/badge.svg)](https://snyk.io/test/github/mabunixda/node-red-contrib-alexa-home)

[npmjs package registry](https://www.npmjs.com/package/node-red-contrib-alexa-home)

The node just works wihtin your local network - no extra cloud stuff is required.

## Installation

Install directory from your Node-RED Settings Pallete

or

Install using npm

    $ npm install node-red-contrib-alexa-home

## Alexa Generation 3 devices

Alexa devices of generation #3 are not using the information used within the detection process.
They do rely that all communication is done on port 80! To estatlish this you got 2 different ways to go.

### ALEXA_PORT and running as root

You must define an environment variable **ALEXA_PORT** and set its value to 80. When running node-red as systemd unit as

`
Environment=ALEXA_PORT=80
`

To test the change you can also start node-red manually with following:

`
ALEXA_PORT=80 node-red start
`

### using iptables and port forwarding

You can leave everything as it is and just define port forwarding using iptables

`
sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 60000
`

Please consider that any changes to iptables are not presistent, after reboot you have to forward the port again, or use iptables-save as described [here](https://www.poftut.com/how-to-save-and-restore-iptables-rules-permanently-in-ubuntu-centos-fedora-debian-kali-mint/)

## Message Object Properties
the follow *msg* properties are generated within this node

**payload.on:** true|false

**payload.bri:** brightness 0-255

**payload.xy** Color XY object

**alexa_ip:** \<ip of alexa device interacting with node-red\>

With version 1.x now also the input is processed within the node and updates the data to alexa. Within the alexa app you are now able to get the current state of your nodes.

### Message input to the nodes

At the moment you can input as payload objects:
* [brightness](https://github.com/mabunixda/node-red-contrib-alexa-home/blob/master/alexa/alexa-home.js#L85)
* [color](https://github.com/mabunixda/node-red-contrib-alexa-home/blob/master/alexa/alexa-home.js#L79)
* [on/off](https://github.com/mabunixda/node-red-contrib-alexa-home/blob/master/alexa/alexa-home.js#L95)

Normal an input is not routed as output because this would possibly cause endless update loops. But if you want this and know what you are doing, you can set the [output param on the msg](https://github.com/mabunixda/node-red-contrib-alexa-home/blob/master/alexa/alexa-home.js#L133) to let the input passthrough.

repository: mabunixda/node-red-contrib-alexa-home

gha_language: JavaScript

repo_name: mabunixda/node-red-contrib-alexa-home


text:
# Fenwick Tree

The `FenwickTree` type is data structures which is used for handling increment and decrement to prefix-sums of an array efficiently.

Usage:

```julia
FenwickTree{T}(n) # Constructs a Fenwick Tree of length `n`
FenwickTree{T}(counts)  # Constructs a Fenwick Tree from an array of `counts`
inc!(ft, ind, val)  # Increases the value of the FenwickTree `ft` by `val` from the index `ind` upto the length of `ft`
dec!(ft, ind, val)  # Decreases the value of the FenwickTree `ft` by `val` from the index `ind` upto the length of `ft`
incdec!(ft, left, right, val)  # Increases the value of the FenwickTree `ft` by `val` from the indices from `left` and decreases it from the `right`
prefixsum(ft, ind)  # Return the cumulative sum from index 1 upto `ind` of the FenwickTree `ft`
```

Examples:

```julia
julia> f = FenwickTree{Int}(6)
julia> inc!(f, 2, 5)
julia> prefixsum(f, 1)
 0
julia> prefixsum(f, 3)
 5
```

gha_language: Julia


text:
Please make sure these boxes are checked before submitting your PR, thank you!

* [ ] Make sure you follow DiDi's [contributing guide](https://github.com/didi/cube-ui/blob/master/CONTRIBUTING.md).
* [ ] Make sure you are merging your commits to `dev` branch.
* [ ] Add some descriptions and refer relative issues for you PR.


text:
# Make
### @description Building the cardboard inchworm

### ~avatar avatar

Turn a piece of cardboard into an inchworm!

### ~

## Duration: ~45 minutes

## Materials
  * Cardboard
  * Scissors or cutters
  * glue gun or tape
  * 1 paper clip

## Step 1: cardboard

Cutout a cardboard rectangle. You can use the @boardname@ as a ruler to figure out the size.

![](/static/mb/projects/inchworm/chassis1.jpg)

## Step 2: center fold

Fold the cardboard in half over the short edge.

![](/static/mb/projects/inchworm/chassis2.jpg)

## Step 3: legs

Fold each end so they rest flat on the ground.

![](/static/mb/projects/inchworm/chassis3.jpg)

## Step 4: front teeth

Fold each corners on one end of the cardbard. This will be the front of the inchworm which is supposed to grip the ground.

![](/static/mb/projects/inchworm/chassis4.jpg)

## Step 5: back teeth

Using a scissor or a cutter (watch the fingers!), cut out various strips in the other edge. Fold one after the other.

![](/static/mb/projects/inchworm/chassis5.jpg)

## Step 6: mounting the board

Using tape or a glue gun, mount the @boardname@ on one side and the microservo on the cardobard.

![](/static/mb/projects/inchworm/chassis6.jpg)

## Step 7: mounting the servo

Attach the servo on the **edge** of the other cardboard side.

![](/static/mb/projects/inchworm/chassis7.jpg)

## Step 8: Cable clean up (optional)

Use tape to route the cables nicely on the inchworm.

![](/static/mb/projects/inchworm/chassis8.jpg)

## Step 9: attaching paper clip to servo

Unfold a paper clip and attach it to the servo arm.

![](/static/mb/projects/inchworm/clip2.jpg)

## Step 10: attaching paper clip to cardboard

Slide the folder paper clip into the cardboard, and use tape to secure it.
You might need to toy around with the size of the clip so that the servo rotation opens the inchworm sufficiently.

![](/static/mb/projects/inchworm/clip3.jpg)

## Step 11: it's ready!

Your inchworm is ready!

![](/static/mb/projects/inchworm/ready.jpg)

### ~button /projects/inchworm/code
NEXT: Code
### ~

repository: emwta/pxt-iBit

repo_name: emwta/pxt-iBit


text:
---
id: elastic-container-service-for-kubernetes
title: Elastic Container Service for Kubernetes
desc: ''
updated: '0'
created: '0'
stub: false
sources:
  - name: og-aws
    url: 'https://github.com/open-guides/og-aws'
    license: Creative Commons Attribution-ShareAlike 4.0 International License
  - name: Jerry Hargrove
    url: 'https://www.awsgeek.com/'
    license: Creative Commons Attribution-ShareAlike 4.0 International License
---
![](/assets/images/Amazon-EKS_en.jpg)
> Image from [@awsgeek](https://www.awsgeek.com/Amazon-EKS/)

# Elastic Container Service for Kubernetes

### EKS Basics
-	📒 [Homepage](https://aws.amazon.com/eks/) ∙ [User guide](http://docs.aws.amazon.com/eks/latest/userguide/what-is-eks.html) ∙ [FAQ](https://aws.amazon.com/eks/faq/) ∙ [Pricing](https://aws.amazon.com/eks/pricing/)
- EKS (Elastic Kubernetes Service) is a new service (launched June 2018) that provides managed Kubernetes Masters in a Highly Available pair to deploy K8s Services and Pods on top of EC2 based Kubernetes nodes.
- See the [Containers and AWS](#containers-and-aws) section for more context on containers.
- EKS is AWS's solution to hosting Kubernetes natively on AWS. It is not a replacement for ECS directly but is in response to the large market dominance of Kubernetes.
- EKS does not launch EC2 nodes and would have to be configured and setup either manually or via Cloudformation (or other automation solution)
- EKS management is done through a utility called kubectl, and with Kube configuration files. These files will need to be configured to speak with the K8s Master with a certificate and URL. The AWS CLI can autogenerate the configuration file that kubect requires for communicating with the cluster.[1](#user-content-eks-aws-cli-create-kubeconfig)
- EKS authentication is integrated with IAM roles/permissions. The AWS CLI has an integrated sub-command for generating authentication tokens.[2](#user-content-eks-aws-cli-get-token) This was formerly done via a custom plugin for kubectl called [aws-iam-authenticator](https://github.com/kubernetes-sigs/aws-iam-authenticator) (formerly heptio-authenticator-aws).
- EKS provides [Calico](https://docs.aws.amazon.com/eks/latest/userguide/calico.html) from Tigera for securing workloads within a cluster using Kubernetes network policy.

### EKS Tips
- Multiple clusters can be supported by using different kubeconfig files.
- AWS has a [Kubernetes Quickstart](https://aws.amazon.com/quickstart/architecture/heptio-kubernetes/) developed in collaboration with Heptio.

### EKS Alternatives and Lock-in
- [ECS](#ecs): Amazon's native Container Scheduled platform released in 2014.  If you don't utilise containers today and are looking to get started, ECS is an excellent product.
-	[Kubernetes](https://kubernetes.io): Extensive container platform. Available as a hosted solution on [Google Cloud](https://cloud.google.com/container-engine/), [AWS](https://aws.amazon.com/eks/), [Digital Ocean](https://www.digitalocean.com/products/kubernetes/) and [Azure](https://azure.microsoft.com/en-us/services/kubernetes-service/).
-	[Nomad](https://www.nomadproject.io/): Orchestrator/Scheduler, tightly integrated in the HashiCorp stack (Consul, Vault, etc).

### EKS Gotchas and Limitations
- Pods and Service configurations can rapidly consume IP addresses inside a VPC.  Proper care and maintenance should be applied to ensure IP exhaustion does not occur.
- There is currently no integrated monitoring in CloudWatch for EKS pods or services, you will need to deploy a monitoring system that supports Kubernetes such as Prometheus.
- Autoscaling based off CPU/Memory of a node is limited as you will not be aware of pending Services/Pods that cannot start. Using [cluster-autoscaler](https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler) can be useful for scaling based on Node resource usage and unschedulable Pods.
- [Prometheus](https://prometheus.io/) is a very popular monitoring solution for K8s, metrics and alerts can be used to send events to Lambda, SQS or other solutions to take autoscaling actions.

### Footnotes
**1**: https://docs.aws.amazon.com/eks/latest/userguide/create-kubeconfig.html

**2**: https://aws.amazon.com/about-aws/whats-new/2019/05/amazon-eks-simplifies-kubernetes-cluster-authentication/

repository: dendronhq/dendron-vault-aws

repo_name: dendronhq/dendron-vault-aws


text:
# Detect RNA editing and hyper-editing events from RNA-seq data (SRA ID or local fastq files)

Modified from https://github.com/hagitpt/Hyper-editing, described in: [A genome-wide map of hyper-edited RNA reveals numerous new sites](https://www.nature.com/articles/ncomms5726), Hagit T. Porath, Shai Carmi & Erez Y. Levanon, Nature Communications 5: 4726 (2014)

**Major changes:**

1. A wrapper script for more friendly usage

2. Allow analysis of SRA data set by using SRR file id

3. Genome browser visualization of the output, including editing efficiency (TODO)

## Installation

Required tools: bwa, samtools, bam2fastx

Optional: sra-tool (needed to fetch fastq files from SRA ID (-sra_id)

Download the source code:

```
git clone https://github.com/xuebingwu/hyper-editing.git
```

Add the folder to your default path in ~/.bashrc

```
PATH="$PATH:path_to_hyper_editing"
```

## Default genome/repeat files

To use default genome and repeat files, change line 28 and 29 in the main script hyper_editing

## Usage

```
Usage: hyper_editing [Options] -sra_id SRR***** | -fastq r1.fastq [-fastq2 r2.fastq]

Options:
    -sra_id <STR>   Use fastq-dump to fetch fastq files using SRA IDs (SRR***)
    -fastq <FILE>   Local input fastq file (read1/mate1 if paired-end)
    -fastq2 <FILE>  Local input fastq file, read2/mate2, only for paired-end data
    -genome <PATH>  Path/prefix of genome *.fa, such as path_to_folder/hg38
    -repeat <FILE>  Simple repeat file (default provided in the folder 'data')
    -output <STR>   Output folder name (will be under current folder)
    -gap <N>        Gap max size between the pairs (default=50000)
    -skip_bwa       Skip bwa mapping if output exists
    -phred64        Set PHRED score offset to 64 (default=33)

Required to run:
    bwa, bam2fastx, samtools, and fastq-dump if using -sra_id

Example:
hyper_editing -sra_id SRR948734
hyper_editing -fastq data/input.fq -genome /home/genomes/hg38
hyper_editing -fastq data/r1.fq -fastq2 data/r2.fq

```

repository: xuebingwu/hyper-editing

repo_name: xuebingwu/hyper-editing


text:
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to

## [0.7.0]
### Added
- Pay for others owner keys registration;
- Add Method create() in RemmePublicKeyStorage: creates signed by owner payload bytes to store in chain;
- Add Method store() in RemmePublicKeyStorage: stores payload bytes with signed keys by owner;
### Changed
- RemmeKeys.sign and RemmeKeys.verify now accepts bytes to sign;
- Renamed interface IPublicKeyStore to IPublicKeyCreate;
- New optional param "doOwnerPay" added to IPublicKeyCreate;

## [0.6.1]
### Added
- Store Keys to Chain with EntityHash Signature;
### Changed
- New optional params "signature" added to IPublicKeyStore;

## [0.6.0]
### Added
- Block, Transfer and AtomicSwap with swap id events.
Block event return block id and timestamp.
Transfer event take address as argument for subscribing and return two objects from (sender info) and to (receiver info).
AtomicSwap with swap id take identifier as argument and return swap info about this swap.
- Storing different types of key pair. ECDSA (secp256k1), EdDSA (ED25519) and RSA are available for store in REMChain at now.
- Provide filter by family name to getTransactions method in blockchainInfo instance.

### Changed
- Method store in publicKeyStorage at now accept keys object instead of public key and private key. This object is used for signing and getting address of key.
- Remove nodePort from networkConfig. Now in nodeAddress we except full address to node.

### Removed
- Dependencies from sawtooth-sdk and secp256k1-node. For secp256k1 we use elliptic-js now.

## [0.5.0-alfa]
### Added
- Class RemmeKeys that works with different types of keys. (RSA, EdDSA, ECDSA)

### Changed
- All methods that read or revoke keys at now work only with addresses.
- Add nodeConfig for getting node_public_key and storage_public_key.
Storage_public_key is used for creating storage_address for creating transaction for storing public keys.
Node_public_key is used as batcher_public_key for transactions
- Add settings new address for init, expire, close swap "remme.settings.genesis_owners".

## [0.4.0-0]
### Added
- Get info about public key in RemmePublicKeyStorage.
- Provide address to PublicKeyInfo that return from getInfo in RemmePublicKeyStorage.
- Get info about certificate in RemmeCertificate
- Method for creating certificate in RemmeCertificate
- Methods for sign and verify data in RemmeCertificate and CertificateTransactionResponse
- Two new addresses into AtomicSwap. In init swap and expire swap.

### Changed
- Models
  In remme-web-socket: Statuses -> BatchStatus, BatchStatuses -> BatchInfoDto
  In remme-atomic-swap: SwapInfoData -> SwapInfo
- Check in RemmePublicKeyStorage and certificate return boolean. So if given public key or certificate is in our chain and valid it returns true either false.
- Check and revoke functions in RemmePublicKeyStorage can work with public key address.
- getUserPublicKeys rename to getAccountPublicKeys into RemmePublicKeyStorage

## [0.3.4-b]
### Fixed
- Bug in account that blocks work without passed privateKeyHex in Remme.Client constructor

## [0.3.4-alfa]
### Added
- Verify method to RemmeAccount.
- Getters for privateKeyHex, publicKeyHex, address and familyName in RemmeAccount.
- Types for RemmeAccount public key and private key.
- sha512 function to remme-utils package.

### Changed
- Provided settings address for storing public key
- Check method in publicKeyStorage can use public key address
- Migrated from REST API to JSON-RPC. Created public method sendRequest.
- Provided several errors description and resolve in README file
- Provided state property for atomic-swap
- getAddressFromData -> generateAddress in remme-utils package.

### Fixed
- In getBlocks parameter start use another pattern /^\[a-f0-9]{16}$/, because validator use hex format fo block_num, so "10" is "a"

### Removed
- Batch class. Method check for batch status was migrated to blockchainInfo class. So batch.getStatus is now blockchainInfo.getBatchStatus.
- ValidatorMethods. Only RemmeMethods was left.
- In RemmeRest methods getRequest, postRequest, putRequest, deleteRequest. Since now we use sendRequest.

repository: Richardowsky/remme-client-js

branch_name: refs/heads/dev

repo_name: Richardowsky/remme-client-js


text:
---
id: de606fdc-2cce-4187-8d92-062577a23ab5
layout: post
title:  "How to change the title or y-axis of the chart?"
uri: how-to-change-the-title-or-y-axis-of-the-chart
tags: [dashboard]
date: 2018-09-10
---

1.  Go to single server view where you can see the box with the chart.
2.  Turn on the edit mode switch, which is on the bottom left of single server view. Now you can view settings of any box, drag boxes around, add new or remove current.
3.  To edit a specific chart, click the pencil icon on it. Dialog with settings appears.
4.  Scroll down to the “Optional settings” section and edit the title. You can use text together with any variables. Variables must be surrounded by pairs of curly braces like this: {{variable\_name}}. Variable will be replaced with the current value. On the bottom of the same view, you can see a cloud of chips with all variables. Click on anyone to copy and paste it in the title field.
5.  Click save on the bottom right.
6.  Close the settings dialog with the button on the top right of the dialog.
7.  Switch edit mode off.

<!--more-->

repository: liesislukas/trafikito-support

repo_name: liesislukas/trafikito-support


text:
# Queued Worker App in CakePHP 4.x

[![Latest Stable Version](https://poser.pugx.org/token27/queue-worker-environment/v/stable.svg)](https://packagist.org/packages/token27/queue-worker-environment)
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.2-8892BF.svg)](https://php.net/)
[![License](https://poser.pugx.org/token27/queue-worker-environment/license)](https://packagist.org/packages/token27/queue-worker-environment)
[![Total Downloads](https://poser.pugx.org/token27/queue-worker-environment/d/total)](https://packagist.org/packages/token27/queue-worker-environment)

The app is an simplifying the creation of worker scripts (development environment) for [CakePHP Queue Plugin](https://github.com/token27/cakephp-queue-plugin), in a easy way with docker.

## Background

This is a very simple and minimalistic worker tasker (or deferred-task) system for CakePHP.

If you need a very basic PHP internal queue tool, this is definitely an option.

## Installation and Usage

See [Documentation](docs).

## CakePHP Queue Plugin

See [Documentation](https://github.com/token27/cakephp-queue-plugin).

## Docker

See [Documentation](docs/DOCKER.md).


text:
# stop-info-backend

[Node.js](https://nodejs.org/) service which provides information of public transport stations.

## Routes

The following routes are currently available through the base route `/api/v1/` of the service:

| Route                                             |                                                                                |
| ------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| `GET stations/byName/:name`                       | Returns all stations matching the `name` path param                                          |
| `GET stations/byLatLng/:lat/:lng`                 | Returns all stations around the coordinate passed by `lat` and `lng` path params             |
| `GET departures/byOriginStation/:originStationId` | Returns all upcoming departures of a station which is passed by `originStationId` path param |
| `GET networks`                                    | Returns information of all available public transport networks                               |

**Note**: Queries are always made for a single public transport network, which has to be applied to requests for each of these routes (except the `GET networks` route) as HTTP header `x-network`. This header is mandatory and can have the following values:

- `Kvv` (Karlsruher Verkehrsverbund, Germany)
- `Vvs` (Verkehrs- und Tarifverbund Stuttgart, Germany)

## Local setup

To run the service locally ensure you have installed [Node.js](https://nodejs.org/) and install all dependencies by running `npm install`. After that you can decide how to run the service:

- `npm run start:dev`: basic usage without debugging support
- `npm run start:debug`: provides debugging support

## Production setup

Production setup is similar to local setup. Install production dependencies `npm install --production` and run the service by `npm start:prod`.

## E2E Tests

To verify functionality there are several end-to-end tests which can be executed `npm test`.

## License
[MIT](LICENSE)

gha_language: HTML


text:
# csv-to-influxdb

### Install

**Binaries**

See [the latest release](https://github.com/jpillora/csv-to-influxdb/releases/latest) or download it now with `curl https://i.jpillora.com/csv-to-influxdb | bash`

**Source**

``` sh
$ go get -v github.com/jpillora/csv-to-influxdb
```

### Usage

```
$ csv-to-influxdb --help

  Usage: csv-to-influxdb [options] <csv-file>

  <csv-file> must be a path a to valid CSV file with an initial header row

  Options:
  --server, -s             Server address (default http://localhost:8086)
  --database, -d           Database name (default test)
  --username, -u           User name
  --password, -p           Password
  --measurement, -m        Measurement name (default data)
  --batch-size, -b         Batch insert size (default 5000)
  --tag-columns, -t        Comma-separated list of columns to use as tags
                           instead of fields
  --timestamp-column, -ts  Header name of the column to use as the timestamp
                           (default timestamp)
  --timestamp-format, -tf  Timestamp format used to parse all timestamp
                           records (default 2006-01-02 15:04:05)
  --no-auto-create, -n     Disable automatic creation of database
  --attempts, -a           Maximum number of attempts to send data to
                           influxdb before failing
  --help, -h
  --version, -v

  Version:
    0.1.2

  Read more:
    github.com/jpillora/csv-to-influxdb

```

#### MIT License

Copyright © 2016<EMAIL_ADDRESS>
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.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

repository: abadyan-vonage/csv-to-influxdb

repo_name: abadyan-vonage/csv-to-influxdb


text:
# BME280 Micropython driver for the BME280 sensor

This is a driver for the Bosch BME280 temperature/pressure/humidity sensor,
for use with MicroPython on Pycom of ESP8266 boards. It is also compatible with
the BMP280 which provides the same interface but temperature + pressure only.

Two different variants of the library are supplied. bme20_int.py uses integer
arithmetic, bme280_float.py uses float arithmetic for the compensation  of the
raw values. The results are (almost) the identical, but the format of the
returned values differs.

## About the BME280

The Bosch BME280 Environmental Sensor is a combined temperature, pressure and
humidity sensor. It can communicate via I2C or SPI; this driver uses I2C.

See the datasheet at https://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BME280_DS002.pdf
for details.

## Class

bme= BME280(i2c=i2c, mode=BME280_OSAMPLE_8, address=BME280_I2CADDR)

mode is the setting for oversampling of the humidity value, address the i2c
address used.

## Properties

### values = BME280.values

The `values` property is a convenience function that provides a tuple of
human-readable string values to quickly check that the sensor is working.
In practice, the method to use is `read_compensated_data()` which returns
a `(temperature, pressure, humidity)`-tuple

### altitude = bmp.altitude
Altitude in m. The altitude is calculated based on the value given to
the property sealevel (see below). Obviously, this value does not have to be the
sealevel pressure, but any pressure you may select, for instance to measure
altitude difference in general.

### bmp.sealevel = sealevel
### sealevel = bmp.sealevel
Setting and getting the pressure for altitude calculation.
The default is 101325 Pa, but you can use your local
QNH in Pa, or set a local pressure to determine altitude difference.

### dew_point = bmp.dew_point
Returns the dew_point temperature (°C) calculated from the actual temperature and humidity.

## Methods

### values = read_compensated_data(result = None)

Values is an array of either integers (bme280_int.py) of floats (bme280_float.py),
holding the values of temperature, pressure and humidity.
The format differs for integers and floats:

#### Integer formats:
* `temperature`:  the temperature in hundredths of a degree Celsius. For example,
the value 2534  indicates a temperature of 25.34 degrees.
* `pressure`: the atmospheric pressure. This 32-bit value consists of 24 bits
indicating the integer value, and 8 bits indicating the fractional value. To get
a value in Pascals, divide the return value by 256. For example, a value of
24674867 indicates 96386.2Pa, or 963.862hPa.
* `humidity`: the relative humidity. This 32-bit value consists of 22 bits
indicating the integer value, and 10 bits indicating the fractional value.
To get a value in %RH, divide the return value by 1024. For example, a value of
47445 indicates 46.333%RH.

#### Float formats
* `temperature`:  the temperature in degree Celsius.
* `pressure`: the atmospheric pressure in Pascal.
* `humidity`: the relative humidity in percent.

If the parameter result is supplied as an array of the appropriate type, The
return values will in addition be stored in that array, and the array will be
returned.

### read_raw_data(result)
Store the raw sensor data into the array result, which must provide space for three
32 bit integers, as provided for instance by `array("i", [0, 0, 0])`. This
method is used internally.

### Example

Copy `bme280_float.py` onto the board. Then:

``` python
#
# this script assumes the default connection of the I2C bus
# On pycom devuces that is P9 = SDA, P10 = scl
#
import machine
import bme280_float as bme280

i2c = machine.I2C()
bme = bme280.BME280(i2c=i2c)

print(bme.values)
```


text:
![Imagination Technologies Limited logo](../images/img.png)

# Creator System Test Framework

## Running the Test Framework on real hardware

The Test Framework supports connecting to a hardware gateway device through XMLRPC, allowing it to launch helper processes
and start Awa bootstrap servers, gateway servers and gateway clients. It can also use a constrained device helper to talk
with a constrained device over a serial cable.

### Prerequisites

* Ubuntu 16.04 installation on a host machine (PC or VM).
* Gateway Device (Ci40 or equivalent) with a power supply and vanilla OpenWRT installed onto flash.
* Constrained device(s) (eg. 6LowPAN Clicker with Avrdude-compatible bootloader)
* FTDI TTL - 232R Terminal Cable (FTDI Part #: TTL - 232R - RPI)
* USB Male - A socket to microUSB plug adapter
* 1 microUSB cable (for serial connection between host PC and Ci40)
* 1 microUSB cable (per constrained device - USB hub may be required for more than one connection to the gateway device)

### Flashing creator onto the Gateway Device

Choose instructions from one of the methods below to flash creator onto your gateway device.

* Download a prebuilt creator OpenWRT image and install dependencies through OPKG (Currently unsupported)
* Manually build creator on the host machine and flash the gateway device using Sysupgrade. [Instructions](doc/hardware/manually_building_creator.md)

Make sure to record the IP address of the gateway device by typing:

    $ ifconfig

and taking the inet address of the active interface (eth0, or wlan0 if you have setup wireless networking)
. You can now unplug the serial cable from the host to the gateway device and connect to the gateway through SSH instead.

### Setting up the Test Framework

#### Create the Test Framework root directory

If you wish to run the test framework through Jenkins, run the following commands:

    $ sudo mkdir -p /opt/jenkins/workspace/<your_job_name>
    $ sudo chmod 777 /opt/jenkins/workspace/<your_job_name>
    $ sudo ln -s /opt/jenkins/workspace/<your_job_name> /mnt/qa

Otherwise run:

    $ sudo mkdir -p /mnt/qa
    $ sudo chown <your_username> /mnt/qa

Install an NFS server on the host machine that will host the Test Framework directory. This has a number of advantages:

* Logs will be saved to the host rather than the gateway device, ensuring that the gateway device does not run out of
  disk space.
* Logs are more easily accessible from the host device.
* We do not have to copy changes made to the test framework from the host to the gateway device.

#### System-Test dependencies

Install the following dependencies that are required by the system test framework on the host machine:
    $ sudo apt-get install jq

#### NFS server setup

    $ sudo apt-get install nfs-kernel-server
    $ sudo nano /etc/exports
    $ /mnt/qa     <IP_ADDRESS>(rw,sync,no_root_squash)  # replace the IP address with the address of the gateway device
    * can be replaced with one of the hostname formats
    $ sudo exportfs -a
    $ sudo systemctl start nfs-kernel-server.service

Clone the creator-system-test-framework repository into the directory you wish to be mounted by the gateway device.
If not using the default key name, follow the guide [here](http://stackoverflow.com/questions/4565700/specify-private-ssh-key-to-use-when-executing-shell-command-with-or-without-ruby/11251797#11251797)
to enable your private key.

    $ cd /mnt/qa
    $ git clone --recursive https://github.com/CreatorDev/creator-system-test-framework.git creator-system-test-framework
    $ cd creator-system-test-framework
    $ (cd lwm2m-contiki/contiki && git checkout avrdude-mikro-e-no-local-echo)
    $ pip install -r requirements.txt

On the Ci40, run the following command to mount the Test Framework directory on the host machine:

    $ mkdir -p /mnt/qa && mount -t nfs <your_host_ip>:/mnt/qa /mnt/qa -o nolock

### Configuring OpenWRT to run the Test Framework

Enter the following commands below to enter the test framework directory and set necessary network configuration.

    $ cd /mnt/qa/creator-system-test-framework
    $ (cd hardware && ash setup-openwrt 17)  # 17 is the WPAN channel ID, can be between 0-26.

Make sure to choose a WPAN channel that is not currently in use for the gateway device, otherwise you will receive the
following error:

`no context available for interface '2001:1418:0100::1'`

### Connecting and Flashing the Constrained Device

Follow one of the instructions below to flash the test app onto the constrained device.

* Flashing the constrained device using the gateway device using
  [Pickle](doc/hardware/flashing_constrained_device_from_gateway.md) (preferred).
* Flashing the constrained device using the [host machine](doc/hardware/flashing_constrained_device_from_host.md)
  (requires manually switching the serial cable connected to the constrained device between the host machine and
  gateway device).

### Starting the Test Helpers on the Gateway Device

Run the following commands on the gateway device from within the mounted creator-system-test-framework folder to start
the required helpers to run the test framework.

Make sure to replace **gateway_ip** with the ip of the gateway device.

    $ PYTHONPATH=.:$PYTHONPATH python helpers/bootstrap_server_test_helper.py --ip $gateway_ip --port 4442 --log xmlrpcserver_bootstrap_local.log
    $ PYTHONPATH=.:$PYTHONPATH python helpers/gateway_server_test_helper.py --ip $gateway_ip --port 4342 --log xmlrpcserver_gateway_server_local.log
    $ PYTHONPATH=.:$PYTHONPATH python helpers/gateway_client_test_helper.py --ip $gateway_ip  --port 4242 --log xmlrpcserver_gateway_client_local.log
    $ PYTHONPATH=.:$PYTHONPATH python helpers/constrained_client_test_helper.py --ip $gateway_ip --port 4142 --log xmlrpcserver_constrained_client_local.log

### Running the test framework manually from the host machine

#### Creating a test configuration

Copy configs/hardware.yml in your creator-system-test-framework directory and give it a unique name. In the proxies
section, modify each ip address to match **gateway_ip** above.

#### Launching the test runner

Replace configs/hardware.yml with the name of the configuration you created above. Before you run any tests, make sure
to restart the constrained device.

Run the following two test cases to ensure the hardware setup is working as expected:

    $ PYTHONPATH=.:$PYTHONPATH ./noserunner.py -svv --tc-file configs/hardware.yml tests/test_constrained_client.py:SerialTests
    $ PYTHONPATH=.:$PYTHONPATH ./noserunner.py -svv --tc-file configs/hardware.yml tests/test_constrained_client.py:ConnectionTests

If the serial tests do not complete successfully, try:

* Make sure the constrained device is turned on.
* Make sure the constrained device is attached to ttyUSB1, or update your configuration file to use ttyUSB1 to connect
  to the constrained device.
* Check the serial connection between the gateway and constrained device.
* Ensure the serial wires are correctly connected to GND, TX and RX.

If the connection tests do not complete successfully, try:

* Make sure you ran the setup_openwrt script.
* Make sure the lwm2m-client-contiki-test app uses the same WPAN channel as the gateway device. (Run iwpan list on the
  gateway, reboot the constrained device)
* Make sure the WPAN channel is not being used by another gateway device.
* Make sure no other constrained devices are running with the same WPAN channel and PAN ID.
* View gwbootstrapd.log and see if Bootstrap Server received any COAP messages from the constrained device.
* Make sure the gateway device can ping the following addresses:

        $ ping6 2001:1418:100::1  # see if it's own interface is responding
        $ ping6 2001:1418:200:ffff::<IP_ADDRESS>  # see if the gateway device can access the internet

If these tests complete successfully, you are ready to run the entire test framework.

    $ PYTHONPATH=.:$PYTHONPATH ./noserunner.py -svv --tc-file configs/hardware.yml

### Continuous Integration

* Add a new test plan in testlink
* Create a jenkins server
* Create a new slave on Jenkins
* Install jenkins on host PC (for the slave to connect to)
* Login as jenkins user and ssh into the ci40 to add the NUC's public key to the known_hosts list
* Create a Jenkins job for the tests that uses the slave we created, testlink plugin, test framework/awa repos etc.

### Future Improvements

* Add Jenkins configurations to source control.
* Allow the helpers to start on arbitrary ports and pass those ports to the test framework -
  firewall must be modified on gateway device.
* Use a base OpenWRT image and install dependencies via OPKG.


text:
#Flansible
### A super-simple rest api for Ansible

---

Flansible is a very simple rest api for executing Ansible ad-hoc-commands and playbooks. It it _not_ a replacement for [Ansible Tower](https://www.ansible.com/tower).

Flansible is written in [Flask](http://flask.pocoo.org/), and uses [celery](http://www.celeryproject.org/) for async task execution and optionally [flower](http://flower.readthedocs.io/en/latest/features.html) for real-time monitoring of celery.

#### Credits
Joerg Lehmann: Lots of feedback and help

#### Required python packages with tested versions (newer version should be fine):
```bash
ansible==<IP_ADDRESS>
celery==4.0.0
Flask==0.10.1
Flask-HTTPAuth==3.1.2
Flask-RESTful==0.3.5
flask-restful-swagger==0.19
flower==0.9.1
redis==2.10.5
```

#### Other things:
Celery requires a running datastore, either Redis or RabbitMQ - flansible does not configure this, and expects Redis or RabbitMQ to already be running and accessible.

#### Configuration
The config.ini file should be pretty self-explanatory. It's probably a good idea to remove lines 5-10 in app.py, as that's only a debug definition which probably won't make sense to you.

If you want to run the flask webserver on port 80 like I'm doing without running as root, you need to allow python to use priveliged ports:

`sudo setcap 'cap_net_bind_service=+ep' /usr/bin/python2.7`

### Setup
Setup tested on Ubuntu 14.04

from the Flansible/Flansible directory (where the .py files live), run the following (either using [screen](http://aperiodic.net/screen/start) or in separate terminals):

`celery worker -A flansible.celery --loglevel=info` (this starts the celery worker which will actually execute the things)

`python runserver.py` (this starts the actual webserver. You're free to replace the built-in flask server with something else)

OPTIONAL: `flower --broker=redis://localhost:6379/0` (this starts the flower web gui, which gives provides information for running tasks. Replace the value of `--broker` with your own connection string for the redis/rabbitmq data store). Flower will be available on `http://<hostname>:5555`.

### Usage: Vagrant
To test the solution with vagrant, you can run `vagrant up` from the root of the repo directory. I haven't set up the apache thingy yet, so you'll have to run the following inside vagrant (by using `vagrant ssh`) after the box comes online:

`cd /vagrant/Flansible`

`celery worker -A flansible.celery --loglevel=info` (use screen to run celery in a non-blocking way)

`python runserver.py` (use screen to run the app in a non-blocking way)

you can now interact with the flansible rest api using `http://localhost:3000/api`.

### Usage: General
Flansible comes with swagger documentation, which can be reached at
`http://<hostname>/api/spec.html`, with the json spec located at `http://<hostname>/api/spec`. This should be your first stop for getting to know the
expected json payload when interacting with the api.

### Usage: Role-based access
Flansible uses basic auth, with username/password configurable in the rbac.json file (default: admin/admin)

rbac.json allows linking usernames with a list of allowed inventories. The example provided shows how to configure a "devadmin" user
which doesn't have access to Ansible's default inventory:
```json
{
  "rbac": [
    {
      "user": "admin",
      "password": "admin",
      "inventories": [
        "username admin has implicit access to all inventories",
        "no need to specify anything here"
      ]

    },
    {
      "user": "devadmin",
      "password": "devpassword",
      "inventories": [
        "/some/folder/dev",
        "/home/thadministrator/hosts"
      ]

    }

  ]
}
```
Not that the username "admin" is special, and is not subject to inventory access checking.

The idea behind this rbac implementation is to allow separate credentials for executing tasks and playbooks
against dev/test environments without having access to make changes to production systems.

### Usage: Ad-hoc commands
Issue a POST to `http://<hostname>/api/ansiblecommand` with contenttype `Application/Json`.

The body should contain the following (for updated info, see the swagger spec mentioned above):
```json
{
   "host_pattern": "localhost",
    "module":  "find",
    "module_args":  {
        "paths":  "/tmp",
        "age":  "2d",
        "recurse" : true
    }
}
```
where
* module: The ansible module to execute
* host_filter: The host or host filter to execute on (defaults to "localhost" if omitted)
* extra_args: array of objects containing any extra vars

### Usage: Playbooks
Issue a POST to `http://<hostname>/api/ansibleplaybook` with contenttype `application/Json`.

This is an example of playbook execution:

```json
{
  "playbook_dir": "/home/thadministrator",
  "playbook": "test.yml",
  "become": true
}
```

Flansible will verify that the playbook dir/file exists before submitting the job for execution.

### Usage: Getting status
both ansibleplaybook and ansiblecommand will return a task_id value. That value can be used to check the
status and output of the job. This is done by issuing a GET to
`http://<hostname>/api/ansibletaskstatus/<task_id>` with contenttype `Application/Json`.

### Usage: Getting output
The output of the ansible command/playbook can be viewed live while the task is running, and afterwards.
Issue a GET cal to:
`http://<hostname>/api/ansibletaskoutput/<task_id>` with contenttype `Application/Json`.
The output from this call should resemble what you see in bash when executing Ansible interactively.

### how it looks
* Execute an Ansible command (`/api/ansiblecommand`). The returning task_id is used to check status:

![alt text](http://s33.postimg.org/eucfmo0un/2016_06_09_03_12_32_Postman.jpg "Execute the thing")

* Use the returned task_id to get the Ansible job output (`/api/ansibletaskoutput/<task-id>`):

![alt text](http://s33.postimg.org/7ir75l7wv/2016_06_09_03_13_04_Postman.jpg "Get output")

* Use Flower to check job statuses:

![alt text](http://s33.postimg.org/wnn9g4dov/2016_06_09_03_19_09_Celery_Flower.png "Get job status")

* Use Swagger to get a feel for the api (this is very much work in progress):

![alt text](http://s33.postimg.org/fq2hivpe7/2016_06_09_03_20_49_Swagger_UI.png "Swagger spec")

### how it works in docker
vagrant ssh
docker-compose  -f docker-compose.yml build
docker-compose  -f docker-compose.yml up -d
sudo docker exec -it vagrant_flansible_1 bash
ansible-playbook  /home/flansible/playbook/site-docker.yml

cd /home/flansible/Flansible; python runserver.py
cd /home/flansible/Flansible; C_FORCE_ROOT=1 celery worker -A flansible.celery --loglevel=info
flower --broker=redis://localhost:6379/0

repository: trondhindenes/flansible

gha_language: Python

repo_name: trondhindenes/flansible


text:
---
title: "Deforming a Mesh at Runtime Based on Collisions with Unity"
aliases: [/v/l_2uGpjBMl4/]
date: 2016-12-21
featured_image: https://i.ytimg.com/vi/l_2uGpjBMl4/mqdefault.jpg
tags: [ unity3d ]

---

{{% youtube id="l_2uGpjBMl4" %}}

Time to start working on deforming our dynamically generated mesh. We're going to be working on a physical simulation that deforms the mesh when things hit it. The advantage to this is that we will be able to modify our mesh as objects impact it causing them to make dents when they hit it or lines as they are dragged across it.

For reference we're going to be using the snow simulated in Tomb Raider which deforms as your feet drag through it. We aren't to the human interacting with it stage yet but that's what we're building towards. For now we're going to stay simple and basic. Either a mesh is deformed or not and each physics collision causes  the mesh to be deformed.

This will require modifications to our mesh being sent in realtime back to the Mesh to render. To do that we'll maintain two in memory array lists. One to store the original position so we can maintain the mesh data and track how much a vertex has changed and the second will be used to track the current vertices of the mesh - the manipulated vertices - which will be used for actually rendering our mesh.

The MeshDeformer code can be found on GitHub: https://gist.github.com/runewake2/a6ba641c9c9c51da62530d6176ee932e

The PhysicsDeformer code is available on GitHub and you can get it here: https://gist.github.com/runewake2/2256a3d77724e3606743d7f07f734280

repository: WorldOfZero/dotcom

gha_language: C#

repo_name: WorldOfZero/dotcom


text:
---
layout: post
title: Benchmarking a simple integer compression algorithm
---

In my [last post](https://vteromero.github.io/2018/10/06/simple-integer-list-compression.html), I described an integer compression algorithm (Simple, from now on) that can be easily implemented in just a few lines of code. I also wrote about its possible strengths and weaknesses, but just as an exercise of pure intuition. In this post, I am going to show you the results I have got by testing and benchmarking the algorithm.

I have written a quick [prototype](https://github.com/vteromero/playground/tree/master/simple-integer-list-compression) in Go to check and challenge my assumptions about the algorithm. It comprises of a library which implements it, some benchmarks to measure the compression and decompression **speed** and a command-line tool to test the **compression ratio**.

I chose Go for no particular reason, apart from the fact that I am familiar with the language and because it is quite easy to create tests and benchmarks with it.

Both the benchmarks and the command-line tool do not just run Simple in isolation, but comparing it against other existing compression techniques. In particular, both execute as well a general-purpose compression library ([Zlib](https://en.wikipedia.org/wiki/Zlib) through [compress/zlib](https://golang.org/pkg/compress/zlib/) package) and a couple of integer compression algorithms: [FastPFor](https://github.com/lemire/FastPFor) and [Bit Packing](https://lemire.me/blog/2012/03/06/how-fast-is-bit-packing/), which are included in [this](https://github.com/dataence/encoding) library. This two last methods are also expanded with [delta encoding](https://en.wikipedia.org/wiki/Delta_encoding). So the final list of compression algorithms is: Simple, Zlib, FastPFor, BP32, DeltaFastPFor and DeltaBP32.

Uniformly distributed random values has been employed as input for the compression algorithms. To generate them, I have used the [math/rand](https://golang.org/pkg/math/rand/) package, which provides plenty of functions that yield this type of random numbers (as it is explained [here](https://appliedgo.net/random/)). Once generated, the values were also sorted in ascending order, resulting in a sorted sequence of 32-bit random integers.

I have tried to feed the algorithms with the same exact data, but it has been impossible since I have had to deal with different types of input. For instance, Zlib works with `[]byte`, whereas the other integer compression methods expect either `[]int32` or `[]uint32`. So, I ended up having to make some transformations in order to get a set of inputs as similar as possible.

### Results

#### Environment

The following results have been got on a laptop Ubuntu Desktop 18.10 with a Core i7-6700HQ CPU @ 2.60GHz x 8. You might get different values on a different environment setup, but they should be similar in terms of comparing them to one another.

#### Compression and decompression speed

Here is the outcome for the benchmarks:

```
BenchmarkCompressSimple-8            	      10	 105658901 ns/op
BenchmarkCompressZlib-8              	       5	 335552325 ns/op
BenchmarkCompressBP32-8              	     100	  19725261 ns/op
BenchmarkCompressFastpfor-8          	      20	  77703391 ns/op
BenchmarkCompressDeltaBP32-8         	      50	  24439807 ns/op
BenchmarkCompressDeltaFastpfor-8     	      10	 119863099 ns/op
BenchmarkDecompressSimple-8          	      10	 104063865 ns/op
BenchmarkDecompressZlib-8            	       2	 729746805 ns/op
BenchmarkDecompressBP32-8            	     100	  13691662 ns/op
BenchmarkDecompressFastpfor-8        	     100	  14427686 ns/op
BenchmarkDecompressDeltaBP32-8       	     100	  14145599 ns/op
BenchmarkDecompressDeltaFastpfor-8   	      50	  27173598 ns/op
```

In the compression side, Simple is clearly slower than BP32, FastPFor and DeltaBP32. However, it is slightly faster than DeltaFastPFor and 3x faster than Zlib.

In terms of decompression speed, Simple is much worse than the other specialised integer compression methods. Nonetheless, compared to Zlib, it is 7x faster.

#### Compression ratio

As I mentioned earlier, I have created a small command-line tool, called `compare-compression-ratio`, as part of the prototype. Its purpose is to run the set of algorithms with different inputs of different sizes, and then to show the compression ratio for each case. It displays the results in the form of a table, so that it is quite easy to determine at a glance which methods get the best compression ratio.

Running the program for the list of sizes `10,100,1000,10000,100000,1000000` will give you the following output:

```
      integers     10    100   1000   10000   100000   1000000
         bytes   1.00   1.00   1.00    1.00     1.00      1.00
        simple   0.95   1.05   1.07    1.07     1.07      1.07
          zlib   0.75   0.96   1.00    1.01     1.08      1.17
          bp32   0.77   0.81   1.02    1.06     1.06      1.06
    delta bp32   0.83   1.01   1.32    1.57     1.87      2.32
      fastpfor   0.77   0.81   1.02    1.06     1.06      1.06
delta fastpfor   0.83   1.01   1.33    1.60     1.92      2.39
```

The first two lines are informative. One is telling the actual input size. The other is there to establish a baseline for comparison: the output of uncompressed data.

As you can see, the compression ratios for the Simple algorithm are somewhat better than BP32 and FastPFor. Yet far from the results of DeltaBP32, DeltaFastPFor and even Zlib, for almost all input sizes, except for the smallest ones.

### The case for small data

When I was carrying out the tests, I soon realised that there is a use case in which Simple outperforms the rest of methods: small data. Small data refers here to a short sequence of just a few values, something around 100 integers or fewer. At that scale, Simple is better in terms of compression ratio.

Let's run `compare-compression-ratio` with small data:

```
         integers      5     10     20     30     40     50     80    100    150
            bytes   1.00   1.00   1.00   1.00   1.00   1.00   1.00   1.00   1.00
           simple   0.83   0.95   1.00   1.02   1.02   1.05   1.06   1.05   1.05
             zlib   0.62   0.74   0.85   0.88   0.91   0.93   0.95   0.96   0.97
             bp32   0.62   0.77   0.77   0.79   0.78   0.81   0.82   0.81   0.99
       delta bp32   0.71   0.83   0.95   0.97   0.98   1.00   1.00   1.01   1.17
         fastpfor   0.62   0.77   0.77   0.79   0.78   0.81   0.82   0.81   0.96
   delta fastpfor   0.71   0.83   0.95   0.97   0.98   1.00   1.00   1.01   1.14
```

Since the compression ratio is around 1.0 and the overall gain is poor (just a few bytes at most), it is probably more useful to look at the plain output size instead. `compare-compression-ratio` lets you display the results in that way. This is how it looks like when running the program for the same sizes:

```
      integers    5   10    20    30    40    50    80   100   150
         bytes   20   40    80   120   160   200   320   400   600
        simple   24   42    80   118   157   191   303   381   569
          zlib   32   54    94   136   176   216   336   416   616
          bp32   32   52   104   152   204   248   388   492   604
    delta bp32   28   48    84   124   164   200   320   396   512
      fastpfor   32   52   104   152   204   248   388   492   628
delta fastpfor   28   48    84   124   164   200   320   396   528
```

With just a handful of values, Simple achieves some compression, i.e. the output size is less than the input size. For example, we save 2 bytes with 30 integers, 9 bytes with 50, 17 bytes with 80, and so on. For any of the other methods, you need to move to an input size of 100 integers to see a tiny gain.

However, if you look at the results of the first columns on the Simple row, you will still see output sizes greater than their input sizes. The good news here are that we can do better.

By default, `compare-compression-ratio` adds a 32-bit header to indicate the length of the compressed sequence. Those 32 bits seem excessive to me for such a short sequence. If we cut down the header to 8 bits, Simple can still compress a list of up to 255 values, which is more than enough for our definition of small data. Here is the resulting table when using a 8-bit header:

```
         integers    5   10    20    30    40    50    80   100   150
            bytes   20   40    80   120   160   200   320   400   600
           simple   21   39    77   115   154   188   300   378   566
             zlib   32   54    94   136   176   216   336   416   616
             bp32   32   52   104   152   204   248   388   492   604
       delta bp32   28   48    84   124   164   200   320   396   512
         fastpfor   32   52   104   152   204   248   388   492   628
   delta fastpfor   28   48    84   124   164   200   320   396   528
```

At some point between input sizes of 5 and 10, we start compressing. It is not bad at all.

### Conclusion

In general, Simple is slower than FastPFor, BP32 and their delta versions. This may be mainly because those algorithms are optimised to be fast and Simple is just a prototype. That doesn't mean that Simple will beat them eventually, but rather that there is still a lot of room for improvement.

With regards to the compression level, Simple mostly doesn't get close to the results obtained by Zlib, DeltaBP32 and DeltaFastPFor. The compression ratio flattens when reaching input sizes of around 1000. However, it gets amazing results for small data, as we have covered in the previous point.

I started writing this post (and the previous one) with the sole goal of exploring a pretty elementary technique. There was no expectations beyond some thoughts about how it would perform. Simple has turned out to be a great integer compression method, especially for small inputs. So overall, I am very satisfied with what I have found.


text:
# How to use this!

## 1. Start Up needed Instances
### Prepare Vars
Go to the `secret.auto.tfvars.dist` and set up the Variables as needed, then save it WITHOUT the `dist`

### Start machines
```
tf init
tf apply
---> check values, then accept with 'yes'
```
Go get a fast Coffee, this should not take more than 5 Minutes (most likely 2-3 Minutes depending on Machine Count)

From the Terraform Output save "Server DNS Name" and "Server IP"

now ssh one time to the "Main" Server so ssh is initialised with the host key Check things.

## 2. Start Main Server Containers
### Prepare Vars
From Step 1, get the Server IP and DNS Name.
Enter them to `secret.auto.tfvars` in `./containers` path.

Remember the Vars you need to login!
User is `root`

### Start Containers
```
tf init
tf apply
----> Check values as before, then yes to confim
```
Now get a Coffee gitlab will take it's time.

## 3. Setup Gitlab
### Read the README.md in Gitlab Folder

repository: corewire/terraform-training-infra

repo_name: corewire/terraform-training-infra


text:
# Plugins

Plugins allow to use an unified interface to collect metrics without worrying about the way metrics export performed.
If you want to use another DB to store metrics data, you can use appropriate export plugin just by changing one line of code.

## Avaliable Plugins

- [Graphite](./graphite/README.md)
- [Prometheus](./prometheus/README.md)
- [Json](./json/README.md)

## How To Write Your Custom Plugin?
Inside your main export function:

```lua
-- Invoke all callbacks registered via `metrics.register_callback(<callback-function>)`.
metrics.invoke_callbacks()

-- Loop over collectors
for _, c in pairs(metrics.collectors()) do
    ...

    -- Loop over instant observations in collector.
    for _, obs in pairs(c:collect()) do
        -- Export observation `obs`
        ...
    end

end
```


text:
# React-Punk-Client

## Created with Create-React-App

## Technologies Used:
    - Javascript / ECMAScript 6
    - React v16.7.0-alpha
    - Redux
    - Redux-Observable
    - Immutable.js

## Design Specific Technologies Used:
    - SASS

## Goals

### Our main goals were the following:
    - Design, build, and release a fully featured front end application using a public api
    - Improve our current skillsets and architecture decisions
    - Demonstrate ability to write scalable, and maintainable code using open source libraries

### Future goals for the project:

 - [ ] Design pages
   - [X] Landing page
   - [ ] Search page
   - [ ] Specific beer page
 - [ ] Add functionality to pages
   - [X] Landing page
   - [ ] Search page
   - [ ] Specific beer page
 - [X] Deploy application using free hosting

 MIT License 2018

repository: fgarcia-student/react-punk-client

repo_name: fgarcia-student/react-punk-client


text:
# react-hooks-pack

[![npm Version](https://img.shields.io/npm/v/react-hooks-pack.svg)](https://www.npmjs.com/package/react-hooks-pack)
[![License](https://img.shields.io/npm/l/react-hooks-pack.svg)](https://github.com/neketabrain/react-hooks-pack/blob/master/LICENSE)
[![Bundle size](https://badgen.net/bundlephobia/min/react-hooks-pack?label=size)](https://bundlephobia.com/result?p=react-hooks-pack)
[![Bundle size](https://badgen.net/bundlephobia/minzip/react-hooks-pack?label=gzip%20size)](https://bundlephobia.com/result?p=react-hooks-pack)
[![Build Status](https://travis-ci.com/neketabrain/react-hooks-pack.svg?branch=master)](https://travis-ci.com/neketabrain/react-hooks-pack)

Package of custom [React hooks](https://reactjs.org/docs/hooks-intro.html)

## Installation

```
npm install --save react-hooks-pack
```

or

```
yarn add react-hooks-pack
```

<br />

## Hooks

- [useDebounce](https://github.com/neketabrain/react-hooks-pack/blob/master/docs/useDebounce.md) - delay the calling of function
- [useDeferredValue](https://github.com/neketabrain/react-hooks-pack/blob/master/docs/useDeferredValue.md) - delay the changing of value
- [useForceUpdate](https://github.com/neketabrain/react-hooks-pack/blob/master/docs/useForceUpdate.md) - call force re-render
- [useForm](https://github.com/neketabrain/react-hooks-pack/blob/master/docs/useForm.md) - form helper
- [useWindowSize](https://github.com/neketabrain/react-hooks-pack/blob/master/docs/useWindowSize.md) - return width and height of window
- [useClickOutside](https://github.com/neketabrain/react-hooks-pack/blob/master/docs/useClickOutside.md) - detect clicks outside of a specified element

repository: neketabrain/react-hooks-pack

gha_language: TypeScript

repo_name: neketabrain/react-hooks-pack


text:
# PUFfRS

[![Build Status](https://travis-ci.org/johntfoster/PUFfRS.svg?branch=master)](https://travis-ci.org/johntfoster/PUFfRS) [![Coverage Status](https://coveralls.io/repos/github/johntfoster/PUFfRS/badge.svg?branch=master)](https://coveralls.io/github/johntfoster/PUFfRS?branch=master)

This is the **P**artition-of-**U**nity **F**ramework **f**or **R**eservoir **S**imulation project. It utilizes the Trilinos Project for increase computational efficiency and is currently in development.

## Requirements for PUFfRS

C++ Complier - version 5.4.0+
OpenMPI - version 1.10.2+
Trilinos - most recent version
Boost - please check Trilinos documentation
yaml-cpp - please check Trilinos documentation

## Build instructions

**Build Only Required Packages**
This will install essential parts of Trilinos, Boost, yaml-cpp, and PUFfRS:
```
cd puffrs_dir
mkdir build
cd build

sudo cmake -DBUILD_ALL_TPS=ON ..
sudo make
sudo make install
```

**Build Using Pre-existing Packages**
This will install only PUFfRS:

```
cd puffrs_dir
mkdir build
cd build

cmake -DTrilinos_DIR=/path/to/trilinos/installation/ ..
make
make install
```

repository: akhilpotla/PUFfRS

repo_name: akhilpotla/PUFfRS