text:
+++
title = "Getting started"
description = "Watermill up and running"
weight = -9999
draft = false
toc = true
bref = "Watermill up and running"
type = "docs"
+++

### What is Watermill?

Watermill is a Golang library for working efficiently with message streams. It is intended for building event-driven
applications. It can be used for event sourcing, RPC over messages, sagas, and whatever else comes to your mind.
You can use conventional pub/sub implementations like Kafka or RabbitMQ, but also HTTP or MySQL binlog, if that fits your use case.

It comes with a set of Pub/Sub implementations and can be easily extended by your own.

Watermill also ships with standard middlewares like instrumentation, poison queue, throttling, correlation,
and other tools used by every message-driven application.

### Why use Watermill?

With more projects adopting the microservices pattern over recent years, we realized that synchronous communication
is not always the right choice. Asynchronous methods started to grow as a new standard way to communicate.

But while there's a lot of existing tooling for synchronous integration patterns (e.g. HTTP), correctly setting up
a message-oriented project can be a challenge. There's a lot of different message queues and streaming systems,
each with different features and client library API.

Watermill aims to be the standard messaging library for Go, hiding all that complexity behind an API that is easy to
understand. It provides all you might need for building an application based on events or other asynchronous patterns.
After looking at the examples, you should be able to quickly integrate Watermill with your project.

### Install

```bash
go get -u github.com/ThreeDotsLabs/watermill
```

### One Minute Background

The basic idea behind event-driven applications stays always the same: listen for incoming messages and react to them.
Watermill supports this behavior for multiple [publishers and subscribers]({{< ref "/pubsubs" >}}).

The core part of Watermill is the [*Message*]({{< ref "/docs/message" >}}). It is as important as `http.Request`
is for the `http` package. Most Watermill features use this struct in some way.

Even though PubSub libraries come with complex features, for Watermill it's enough to implement two interfaces to start
working with them: the `Publisher` and `Subscriber`.

```go
type Publisher interface {
	Publish(topic string, messages ...*Message) error
	Close() error
}

type Subscriber interface {
	Subscribe(ctx context.Context, topic string) (<-chan *Message, error)
	Close() error
}
```

### Subscribing for Messages

Let's start with subscribing. `Subscribe` expects a topic name and returns a channel of incoming messages.
What _topic_ exactly means depends on the PubSub implementation.

```go
messages, err := subscriber.Subscribe(ctx, "example.topic")
if err != nil {
	panic(err)
}

for msg := range messages {
	fmt.Printf("received message: %s, payload: %s\n", msg.UUID, string(msg.Payload))
	msg.Ack()
}
```

See detailed examples below for supported PubSubs.

{{< tabs id="subscribing" tabs="go-channel,kafka,nats-streaming,gcloud,amqp,sql" labels="Go Channel,Kafka,NATS Streaming,Google Cloud Pub/Sub,RabbitMQ (AMQP),SQL" >}}

{{% tabs-tab id="go-channel"%}}
{{% load-snippet-partial file="src-link/_examples/pubsubs/go-channel/main.go" first_line_contains="package main" last_line_contains="process(messages)" %}}
{{% load-snippet-partial file="src-link/_examples/pubsubs/go-channel/main.go" first_line_contains="func process" %}}
{{% /tabs-tab %}}

{{% tabs-tab id="kafka" %}}

{{< collapse id="installing_rdkafka" >}}

{{< collapse-toggle box_id="docker" >}}
Running in Docker
{{% /collapse-toggle %}}
{{% collapse-box id="docker" %}}
The easiest way to run Watermill locally with Kafka is using Docker.

{{% load-snippet file="src-link/_examples/pubsubs/kafka/docker-compose.yml" type="yaml" %}}

The source should go to `main.go`.

To run, execute `docker-compose up` command.

A more detailed explanation of how it is working (and how to add live code reload) can be found in [*Go Docker dev environment* article](https://threedots.tech/post/go-docker-dev-environment-with-go-modules-and-live-code-reloading/).

{{% /collapse-box %}}
{{< /collapse >}}

{{% load-snippet-partial file="src-link/_examples/pubsubs/kafka/main.go" first_line_contains="package main" last_line_contains="process(messages)" %}}
{{% load-snippet-partial file="src-link/_examples/pubsubs/kafka/main.go" first_line_contains="func process" %}}
{{% /tabs-tab %}}

{{% tabs-tab id="nats-streaming"%}}

{{< collapse id="running_nats" >}}

{{< collapse-toggle box_id="nats-streaming-docker" >}}
Running in Docker
{{% /collapse-toggle %}}
{{% collapse-box id="nats-streaming-docker" %}}
The easiest way to run Watermill locally with NATS is using Docker.

{{% load-snippet file="src-link/_examples/pubsubs/nats-streaming/docker-compose.yml" type="yaml" %}}

The source should go to `main.go`.

To run execute `docker-compose up` command.

A more detailed explanation of how it is working (and how to add live code reload) can be found in [*Go Docker dev environment* article](https://threedots.tech/post/go-docker-dev-environment-with-go-modules-and-live-code-reloading/).
{{% /collapse-box %}}
{{< /collapse >}}

{{% load-snippet-partial file="src-link/_examples/pubsubs/nats-streaming/main.go" first_line_contains="package main" last_line_contains="process(messages)" %}}
{{% load-snippet-partial file="src-link/_examples/pubsubs/nats-streaming/main.go" first_line_contains="func process" %}}
{{% /tabs-tab %}}

{{% tabs-tab id="gcloud"%}}

{{< collapse id="running_gcloud" >}}

{{< collapse-toggle box_id="gcloud-streaming-docker" >}}
Running in Docker
{{% /collapse-toggle %}}
{{% collapse-box id="gcloud-streaming-docker" %}}
You can run Google Cloud Pub/Sub emulator locally for development.

{{% load-snippet file="src-link/_examples/pubsubs/googlecloud/docker-compose.yml" type="yaml" %}}

The source should go to `main.go`.

To run, execute `docker-compose up`.

A more detailed explanation of how it is working (and how to add live code reload) can be found in [*Go Docker dev environment* article](https://threedots.tech/post/go-docker-dev-environment-with-go-modules-and-live-code-reloading/).
{{% /collapse-box %}}
{{< /collapse >}}

{{% load-snippet-partial file="src-link/_examples/pubsubs/googlecloud/main.go" first_line_contains="package main" last_line_contains="process(messages)" %}}
{{% load-snippet-partial file="src-link/_examples/pubsubs/googlecloud/main.go" first_line_contains="func process" %}}
{{% /tabs-tab %}}

{{% tabs-tab id="amqp"%}}

{{< collapse id="running_amqp" >}}

{{< collapse-toggle box_id="amqp-docker" >}}
Running in Docker
{{% /collapse-toggle %}}
{{% collapse-box id="amqp-docker" %}}
{{% load-snippet file="src-link/_examples/pubsubs/amqp/docker-compose.yml" type="yaml" %}}

The source should go to `main.go`.

To run, execute `docker-compose up`.

A more detailed explanation of how it is working (and how to add live code reload) can be found in [*Go Docker dev environment* article](https://threedots.tech/post/go-docker-dev-environment-with-go-modules-and-live-code-reloading/).
{{% /collapse-box %}}
{{< /collapse >}}

{{% load-snippet-partial file="src-link/_examples/pubsubs/amqp/main.go" first_line_contains="package main" last_line_contains="process(messages)" %}}
{{% load-snippet-partial file="src-link/_examples/pubsubs/amqp/main.go" first_line_contains="func process" %}}
{{% /tabs-tab %}}

{{% tabs-tab id="sql"%}}

{{< collapse id="running_sql" >}}

{{< collapse-toggle box_id="sql-docker" >}}
Running in Docker
{{% /collapse-toggle %}}
{{% collapse-box id="sql-docker" %}}
{{% load-snippet file="src-link/_examples/pubsubs/sql/docker-compose.yml" type="yaml" %}}

The source should go to `main.go`.

To run, execute `docker-compose up`.

A more detailed explanation of how it is working (and how to add live code reload) can be found in [*Go Docker dev environment* article](https://threedots.tech/post/go-docker-dev-environment-with-go-modules-and-live-code-reloading/).
{{% /collapse-box %}}
{{< /collapse >}}

{{% load-snippet-partial file="src-link/_examples/pubsubs/sql/main.go" first_line_contains="package main" last_line_contains="process(messages)" %}}
{{% load-snippet-partial file="src-link/_examples/pubsubs/sql/main.go" first_line_contains="func process" %}}
{{% /tabs-tab %}}

{{< /tabs >}}

### Creating Messages

Watermill doesn't enforce any message format. `NewMessage` expects a slice of bytes as the payload. You can use
strings, JSON, protobuf, Avro, gob, or anything else that serializes to `[]byte`.

The message UUID is optional, but recommended, as it helps with debugging.

```go
msg := message.NewMessage(watermill.NewUUID(), []byte("Hello, world!"))
```

### Publishing Messages

`Publish` expects a topic and one or more `Message`s to be published.

```go
err := publisher.Publish("example.topic", msg)
if err != nil {
    panic(err)
}
```

{{< tabs id="publishing" tabs="go-channel,kafka,nats-streaming,gcloud,amqp,sql" labels="Go Channel,Kafka,NATS Streaming,Google Cloud Pub/Sub,RabbitMQ (AMQP),SQL" >}}

{{% tabs-tab id="go-channel"%}}
{{% load-snippet-partial file="src-link/_examples/pubsubs/go-channel/main.go" first_line_contains="go process(messages)" last_line_contains="publisher.Publish" padding_after="4" %}}
{{% /tabs-tab %}}

{{% tabs-tab id="kafka" %}}
{{% load-snippet-partial file="src-link/_examples/pubsubs/kafka/main.go" first_line_contains="go process(messages)" last_line_contains="publisher.Publish" padding_after="4" %}}
{{% /tabs-tab %}}

{{% tabs-tab id="nats-streaming" %}}
{{% load-snippet-partial file="src-link/_examples/pubsubs/nats-streaming/main.go" first_line_contains="go process(messages)" last_line_contains="publisher.Publish" padding_after="4" %}}
{{% /tabs-tab %}}

{{% tabs-tab id="gcloud" %}}
{{% load-snippet-partial file="src-link/_examples/pubsubs/googlecloud/main.go" first_line_contains="go process(messages)" last_line_contains="publisher.Publish" padding_after="4" %}}
{{% /tabs-tab %}}

{{% tabs-tab id="amqp" %}}
{{% load-snippet-partial file="src-link/_examples/pubsubs/amqp/main.go" first_line_contains="go process(messages)" last_line_contains="publisher.Publish" padding_after="4" %}}
{{% /tabs-tab %}}

{{% tabs-tab id="sql" %}}
{{% load-snippet-partial file="src-link/_examples/pubsubs/sql/main.go" first_line_contains="go process(messages)" last_line_contains="publisher.Publish" padding_after="4" %}}
{{% /tabs-tab %}}

{{< /tabs >}}

### Using *Message Router*

[*Publishers and subscribers*]({{< ref "/docs/pub-sub" >}}) are rather low-level parts of Watermill.
In most cases, you'd usually want to use a high-level interface and features like [correlation, metrics, poison queue, retrying, throttling, etc.]({{< ref "/docs/messages-router#middleware" >}}).

You might want to send an Ack only if the message was processed successfully.
In other cases, you'll Ack immediately and then worry about processing.
Sometimes, you want to perform some action based on the incoming message, and publish another message in response.

To handle these requirements, there is a component named [*Router*]({{< ref "/docs/messages-router" >}}).

### Example application of *Message Router*
The flow of the example application looks like this:

1. A message is produced on topic `incoming_messages_topic` every second.
2. `struct_handler` handler listens on `incoming_messages_topic`. When a message is received, the UUID is printed and a new message is produced on `outgoing_messages_topic`.
3. `print_incoming_messages` handler listens on `incoming_messages_topic` and prints the messages' UUID, payload and metadata.
4. `print_outgoing_messages` handler listens on `outgoing_messages_topic` and prints the messages' UUID, payload and metadata. Correlation ID should be the same as in the message on `incoming_messages_topic`.

#### Router configuration

Start with configuring the router, adding plugins and middlewares.
Then set up handlers that the router will use. Each handler will independently handle messages.

{{% render-md %}}
{{% load-snippet-partial file="src-link/_examples/basic/3-router/main.go" first_line_contains="package" last_line_contains="router.Run(ctx)" padding_after="4" %}}
{{% /render-md %}}

#### Incoming messages

The `struct_handler` consumes messages from `incoming_messages_topic`, so we are simulating incoming traffic by calling `publishMessages()` in the background.
Notice that we've added the `SetCorrelationID` middleware. A Correlation ID will be added to all messages produced by the router (it will be stored in metadata).

{{% render-md %}}
{{% load-snippet-partial file="src-link/_examples/basic/3-router/main.go" first_line_contains="func publishMessages" last_line_contains="time.Sleep(time.Second)" padding_after="2" %}}
{{% /render-md %}}

#### Handlers

You may have noticed that there are two types of *handler functions*:

1. function `func(msg *message.Message) ([]*message.Message, error)`
2. method `func (c structHandler) Handler(msg *message.Message) ([]*message.Message, error)`

If your handler is a function without any dependencies, it's fine to use the first one.
The second option is useful when your handler requires some dependencies like database handle, a logger, etc.

{{% render-md %}}
{{% load-snippet-partial file="src-link/_examples/basic/3-router/main.go" first_line_contains="func printMessages" last_line_contains="return message.Messages{msg}, nil" padding_after="3" %}}
{{% /render-md %}}

#### Done!

You can run this example by `go run main.go`.

You've just created your first application with Watermill. You can find the full source in [/_examples/basic/3-router/main.go](https://github.com/ThreeDotsLabs/watermill/blob/master/_examples/basic/3-router/main.go).

### Logging

To see Watermill's logs, you have to pass any logger that implements the [LoggerAdapter](https://github.com/ThreeDotsLabs/watermill/blob/master/log.go).
For experimental development, you can use `NewStdLogger`.

### Testing

Watermill provides [a set of test scenarios](https://github.com/ThreeDotsLabs/watermill/blob/master/pubsub/tests/test_pubsub.go)
that any Pub/Sub implementation can use. Each test suite needs to declare what features it supports and how to construct a new Pub/Sub.
These scenarios check both basic usage and more uncommon use cases. Stress tests are also included.

### Deployment

Watermill is not a framework. We don't enforce any type of deployment and it's totally up to you.

### What's next?

For more detailed documentation check [documentation topics]({{< ref "/docs" >}}).

#### Examples

Check out the [examples](https://github.com/ThreeDotsLabs/watermill/tree/master/_examples) that will show you how to start using Watermill.

The recommended entry point is [Your first Watermill application](https://github.com/ThreeDotsLabs/watermill/tree/master/_examples/basic/1-your-first-app).
It contains the entire environment in `docker-compose.yml`, including Golang and Kafka, which you can run with one command.

After that, you can see the [Realtime feed](https://github.com/ThreeDotsLabs/watermill/tree/master/_examples/basic/2-realtime-feed) example.
It uses more middlewares and contains two handlers. There is also a separate application for publishing messages.

For a different subscriber implementation, namely **HTTP**, refer to the [receiving-webhooks](https://github.com/ThreeDotsLabs/watermill/tree/master/_examples/real-world-examples/receiving-webhooks) example. It is a very simple application that saves webhooks to Kafka.

Full list of examples can be found in the project's [README](https://github.com/ThreeDotsLabs/watermill#examples).

#### Support

If anything is not clear, feel free to use any of our [support channels]({{< ref "/support" >}}), we will be glad to help.

repository: ThreeDotsLabs/watermill

gha_language: Go

repo_name: ThreeDotsLabs/watermill


text:
`django-postgres-extra` provides the `psqlextra.manager.PostgresManager` which exposes a lot of functionality. Your model must use this manager in order to use most of this package's functionality.

There are four ways to do this:

* **Inherit your model from `psqlextra.models.PostgresModel`:**

```python
from psqlextra.models import PostgresModel

class MyModel(PostgresModel):
    myfield = models.CharField(max_length=255)
```

* **Override default manager with `psqlextra.manager.PostgresManager`:**

```python
from django.db import models
from psqlextra.manager import PostgresManager

class MyModel(models.Model):
    # override default django manager
    objects = PostgresManager()

    myfield = models.CharField(max_length=255)
```

* **Provide `psqlextra.manager.PostgresManager` as a custom manager:**

```python
from django.db import models
from psqlextra.manager import PostgresManager

class MyModel(models.Model):
    # custom mananger name
    beer = PostgresManager()

    myfield = models.CharField(max_length=255)

# use like this:
MyModel.beer.upsert(..)

# not like this:
MyModel.objects.upsert(..) # error!
```

* **Use the `psqlextra.util.postgres_manager` on the fly:**

    This allows the manager to be used **anywhere** on **any** model, but only within the context. This is especially useful if you want to do upserts into Django's `ManyToManyField`'s generated `through` table:

```python
from django.db import models
from psqlextra.util import postgres_manager

class MyModel(models.Model):
    myself = models.ManyToManyField('self')

# within the context, you can access psqlextra features
with postgres_manager(MyModel.myself.through) as manager:
    manager.upsert(...)
```

license: MIT

repository: thomasmatecki/django-postgres-extra

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: thomasmatecki/django-postgres-extra


text:
# Xaya Game Library

`libxayagame` is a C++ library that makes it easy to implement games on the
[Xaya platform](https://xaya.io/).  It takes care of the interaction with
the Xaya Core daemon, so that game developers only have to implement the
rules of their game.

[`mover`](mover/README.md) is a simple game using this library, where players
can move around an infinite plane.  It is fully functional, although mainly
meant as example and/or basis for more complex games.

Similarly, [`nonfungible`](nonfungible/README.md) is a simple implementation
of non-fungible assets on the Xaya platform.  It is useful as another example
(of using the
[SQLite integration](https://github.com/xaya/libxayagame/blob/master/xayagame/sqlitegame.hpp)),
for testing [Democrit](https://github.com/xaya/democrit) but also as an actual
application on Xaya for issuing and trading fungible and non-fungible tokens.

This repository also contains a framework for [**game
channels**](https://www.ledgerjournal.org/ojs/index.php/ledger/article/view/15)
as well as [Xayaships](ships/README.md), which is an example game for
channels.

## Building

To build `libxayagame` and the example mover game, use the standard routine
for building autotools-based software:

```autogen.sh && ./configure && make```

After a successful build, you can optionally run `make check` and/or
`make install` to run tests and install the library and `moverd` on
your system, respectively.

### Prerequisites

`libxayagame` has a couple of dependencies which need to be installed
for the configuration and/or build to be successful:

- [`libjsoncpp`](https://github.com/open-source-parsers/jsoncpp):
  The Debian package `libjsoncpp-dev` can be used.
- [`jsonrpccpp`](https://github.com/cinemast/libjson-rpc-cpp/):
  For Debian, the packages `libjsonrpccpp-dev` and `libjsonrpccpp-tools`
  are not fresh enough.  They need to be built from source;
  in particular, it must be a version that includes the commit
  [`4f24acaf4c6737cd07d40a02edad0a56147e0713`](https://github.com/cinemast/libjson-rpc-cpp/commit/4f24acaf4c6737cd07d40a02edad0a56147e0713).
- [`ZeroMQ`](https://zeromq.org/) with
  [C++ bindings](https://github.com/zeromq/cppzmq):
  Core ZeroMQ is available in the Debian package `libzmq3-dev`.  The C++
  bindings need to be installed from the source repository, as the version
  in the Debian package (at least for Debain 10 "Buster") is too old.
- [`zlib`](https://zlib.net):
  Available in Debian as `zlib1g-dev`.
- [SQLite3](https://www.sqlite.org/) with the
  [session extension](https://www.sqlite.org/sessionintro.html).
  In Debian, the `libsqlite3-dev` package can be installed.
  Alternatively, build from source and configure with `--enable-session`.
- [LMDB](https://symas.com/lmdb):  Available for Debian in the
  `liblmdb-dev` package.
- [`glog`](https://github.com/google/glog):
  Available for Debian as `libgoogle-glog-dev`.
- [`gflags`](https://github.com/gflags/gflags):
  The package (`libgflags-dev`) included with Debian can be used.
- [Protocol buffers](https://developers.google.com/protocol-buffers/)
  are used both in C++ and Python.  On Debian, the packages
  `libprotobuf-dev`, `protobuf-compiler` and `python-protobuf` can be used.
- [`eth-utils`](https://github.com/xaya/eth-utils), which itself depends on
  [`libsecp256k1`](https://github.com/bitcoin-core/secp256k1).
  The latter is available on Debian as `libsecp256k1-dev`.

For the unit tests, also the
[Google test framework](https://github.com/google/googletest) is needed.
The package included with Debian 10 "Buster" is not fresh enough,
it should be built and installed from source instead.

For running the integration tests based on Python, install Python3 and
the [jsonrpclib](https://github.com/tcalmant/jsonrpclib/) library.  On Debian,
this is `python3-jsonrpclib-pelix`.

### Docker Image

We also provide a
[Dockerfile](https://github.com/xaya/libxayagame/blob/master/Dockerfile),
which can be used to build an image based on Debian that has all dependencies
and libxayagame itself prebuilt and installed.  (Hint:  The file can also
just serve as documentation for how to get all dependencies and build
libxayagame yourself on a Debian system.)

[Builds of this
image](https://hub.docker.com/repository/docker/xaya/libxayagame)
are also published on Docker Hub.

repository: xaya/libxayagame

gha_license_id: MIT

repo_name: xaya/libxayagame


text:
Chameleon
=========

**documentation at: [readTheDocs](http://readthedocs.org/docs/django-chameleon/)**

Description
-----------

Django Chameleon is a dinamic theme (template) changer  for the Django projects.

Dependencies
------------
* Django >= 1.2 [if we use the loader method]
* Django >= 1.3 [if we use the `TemplateResponse` method]
* Python >= 2.4 (I think, I use 2.6)
* Session middleware (I think that is necessary to save the satatus of the theme)
* RequestContext [OPTIONAL] but recommended

How it works
------------

Chameleon gets the theme from the POST or GET request, then inserts in the session and the request context. You can set and get the theme in the cookie with some methods that are in `chameleon.utils`

Chameleon supports the theme change in two ways. With a loader or using the new [`TemplateResponse`](https://docs.djangoproject.com/en/1.3/ref/template-response/) instead of `HttpResponse` (`render_to_response`...)
this has been added in **Django 1.3**. For example a view that uses this new feature
(doesn't change the previous functionality) only manages the response in a different way that the middleware can interact
with the response before rendering. This is an example

    #from django.shortcuts import render_to_response
    #from django.template import RequestContext
    from django.template.response import TemplateResponse
    from forms import ColorForm

    def index(request):

        #return render_to_response('index.html', context_instance=RequestContext(request))
        return TemplateResponse(request, 'index.html', {'form': ColorForm()})

In my opinion I recomend using `TemplateResponse` to not mess with the default Django loaders, or any other custom loaders.

###Settings template structure###

**THE THEMES (TEMPLATES) NEED TO HAVE THE SAME STRUCTURE AS IN THE DEFAULT THEME.**

For example we have a basic structure inside `templates` (the root where django will search for the templates).
In the root there are `base.html` and `index.html`. `index.html` extends from `base.html` and in the views the template to render is `index.html`.
So we add other themes, **red**, **blue**, **green** and **black**. These themes the only requeriment that need is to have is `index.html` because is the one that
is rendered from the view. If all the themes want to extend from the same base.html they could. Also they could extend from an individual base.html but
this has to be put in the template, for example in the blue one the extend from `/templates/blue/base.html` is: `{% extends 'blue/base.html' %}`

As we can see all the templates have the same structure. default is in `templates`, blue and red are in `templates/xxxx`, and green and black are  `templates/themes/xxxx` **but always the same structure of templates**

    Templates
    │
    ├── base.html
    ├── index.html
    ├── red
    │   ├── [base.html]
    │   └── index.html
    │
    ├── blue
    │   ├── [base.html]
    │   └── index.html
    │
    └── themes
        ├── black
        │   ├── [base.html]
        │   └── index.html
        │
        └── green
            ├── [base.html]
            └── index.html

###Settings variables###

There are some vars that can be set in `settings.py`. `TEMPLATE_CONTEXT_PROCESSOR` and `CHAMELEON_SITE_THEMES` are neccesary, the others are optional. For example:

    from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS

    TEMPLATE_CONTEXT_PROCESSORS += ('chameleon.context_processors.theme',)

    # Django settings for chameleonTest project.

    # [OPTIONAL] If you want to manage the theme change looking in your templates  manually
    # with the request context var. Put down this flag
    #CHAMELEON_AUTOMATED = True

    # [OPTIONAL] If you want to name the form var in a different name
    #CHAMELEON_FORM_KEY = ''

    # [OPTIONAL] If you want to name the default theme different to 'default'
    #CHAMELEON_DEFAULT_THEME = ''

    # [OPTIONAL] If you want to change the var name in the context, set this
    #CHAMELEON_CONTEXT_KEY = ''

    # [OPTIONAL] If you want to change the var name in the cookie set this
    #CHAMELEON_COOKIE_KEY = ''

    # The themes and their paths(the path where the structure starts).
    # The structure of the theme has to be the same as the default one.
    # If a empty then the name of the theme will be the folder to search in
    CHAMELEON_SITE_THEMES = {
        'green':'themes/green',
        'black':'themes/black',
        'blue': 'blue',
        'red':'',
    }

###Add chameleon to installed apps###
In settings add chameleon to `INSTALLED_APPS`, for example:

    INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'chameleon',

###Add middleware###
Add both middlewares to `MIDDLEWARE_CLASSES` (the second one is only for the TemplateResponse method, but if loader is activated in `TEMPLATE_LOADERS` the SetResponseTemplate middleware disables automatically)

    'chameleon.middleware.DetectTheme',
    'chameleon.middleware.SetResponseTemplate',

###Select method. `loader` or `TemplateResponse`###

We have to select the method between Loader and TemplateResponse(Recommended)

####Loader####

Add our loader to settings (**the first one**) for example:

    TEMPLATE_LOADERS = (
        'chameleon.loader.Loader',
        'django.template.loaders.filesystem.Loader',
        'django.template.loaders.app_directories.Loader',

####TemplateResponse####

* We **don't** have to add the loader to `TEMPLATE_LOADERS`
* All the views have to call the template with TemplateResponse (or SimpleTemplateResponse)

###Other###

If you want that the default option of the form (theme choice) renders the theme that currently is activated you have to use `chameleon.utils` methods like is in the example(`views.py`). The example shows how to use the app with a basic example

Current status
--------------

* Initial state
* Basic functionality
* No installer
* Not many tests
* Many bugs :D

License
-------

3 clause/New BSD license: [opensource](http://www.opensource.org/licenses/BSD-3-Clause), [wikipedia](http://en.wikipedia.org/wiki/BSD_licenses)

Thanks
------
Thanks to [django-mobile](https://github.com/gregmuellegger/django-mobile) for the inspiration and code learning :)

repository: cheldernunes/django-chameleon

repo_name: cheldernunes/django-chameleon


text:
[简体中文](https://github.com/welkin-qing/Node-mongoDB) | English

<div align="center">

![](https://github.com/welkin-qing/Node-mongoDB/blob/master/img/logo.png)

A multi-person blog based on MongoDB database and node+express

一个基于MongoDB数据库，使用 node+express 开发的多人博客

![](https://github.com/welkin-qing/Node-mongoDB/blob/master/img/release-1.0-darkcyan.svg)
![](https://github.com/welkin-qing/Node-mongoDB/blob/master/img/build-passing-brightgreen.svg)
![](https://github.com/welkin-qing/Node-mongoDB/blob/master/img/dependencies-up%20to%20date-brightgreen.svg)
![](https://github.com/welkin-qing/Node-mongoDB/blob/master/img/license-MIT-darkcyan.svg)

</div>

-----

# Installation and use
### 1. The first step is to install MongoDB database locally
1. Install package
```js
npm init -y
npm install --save mongoose
```
2. Connect to the database
```js
mongoose.connect(‘mongodb://localhost/test’)
```
3. Design data tables
```js
var userSchema = new Schema({
  username: {
    type: String,
    required: true // There must be
  },
  password: {
    type: String,
    required: true
  },
  email: {
    type: String
  }
})
```
4. Start the database (open another terminal)
```js
mongod
```
###### The source code
```js
var mongoose = require('mongoose')

var Schema = mongoose.Schema
//Connect to the database
mongoose.connect('mongodb://localhost/test')

var userSchema = new Schema({
  username: {
    type: String,
    required: true // There must be
  },
  password: {
    type: String,
    required: true
  },
  email: {
    type: String
  }
})

var User = mongoose.model('User', userSchema)

```
[Mongodb database installation and use tutorial](https://blog.csdn.net/Welkin_qing/article/details/83420214)

### 2.Install the project locally
```js
git clone https://github.com/welkin-qing/Node-mongoDB
cd Node-mongoDB
npm install
node app.js
```
-----

## The basic configuration

#### Use the art-template template engine

- app is the project entry file, while router is the routing file

- User.js is the user user table

#### Login and registration
- use Html5 for form validation
- verify that the mailbox or nickname exists during registration. If so, prompt that the mailbox or nickname has been registered
- when logging in, look up the password in the data table. If it is correct, log in successfully and use md5 encryption twice. If it fails, the prompt will appear
- after successful login, it will jump to the personal homepage

#### Change the password
1. Determine whether the new passwords are the same twice, and prompt the user if they are different
2. The basic information setting page will be entered only after successful login, so the original password will be searched according to the mailbox, and the original password will be matched
3. If the password is changed successfully, it will jump to the login page for re-login

#### Get avatars
1. Use the iframe tag to inline a page in your personal Settings, and the avatarForm page to add pictures
2. After routing, switch to the cut page and use gm to cut the picture. When cutting, use the template engine to get the size of the picture
3. Upload the cropped picture to your own head position

![Choose picture](https://github.com/welkin-qing/Node-mongoDB/blob/master/img/choose.png)

![Cut out pictures](https://github.com/welkin-qing/Node-mongoDB/blob/master/img/cut.png)

#### Personal information modification
1. Modify the information according to the registered account
2. Return to the personal homepage after the information modification is completed
3. You need to log in again for viewing

#### Published an article
1. Design the article table structure
2. Click "initiate" to enter the new page, and then save the data into the article table
3. Complete the jump to the home page
4. Complete the rendering of the current article using the showdown plugin（Similar to the github readme format）
    - Deal with the structure of the title and article sections
    - Manage the timing of your posts

#### Realize the browsing of the article
- user
    * After the user publishes the article, redirects to the homepage to be able to browse own publication article
- tourists
    * Visitors can browse any article by clicking on the article without logging in

#### Time operation
The zeroing operations before hours, minutes and seconds were processed

#### Unsubscribe
The logout of the account is achieved and the account information is cleared from the database

###### Part of the code is as follows:
```js
if(req.session.user){
    User.find({
      email: req.session.user.email
    }, function(err, user){
      if(err){
        return next(err)
      }else{
        //console.log(user)
        User.deleteMany({ email: req.session.user.email }, function(err, user){
          if(err){
            return next(err)
          }
          req.session.user = null
          res.status(200).json({
            err_code: 0,
            message: 'OK'
          })
        })
      }
    })
  }else{
    res.render('login.html')
  }
```
##### Upload code
1. git add .
2.

repository: welkin-qing/Node-mongoDB

repo_name: welkin-qing/Node-mongoDB


text:
#Tutorials Section
This is to be done at a later time.

Topics:
- Intro
- [Getting Around Visual Studio](
  - Shortcuts
  - Packaging Your Solutions (Via Archives)
  - Common Pitfalls When Creating Solutions
  - Understanding the Output Log
- Syntax:
  - Commenting
  - Naming Schemes
  - Common Pitfalls When Typing in C++
- Typing Help

... More topics to be created later.
# Intro
This page is for general tips and tricks when working with Visual Studio C++ and overall. If you would like to contribute
to this page, talk with Joe (the SI instructor) so he may add to the page.

# Getting Around Visual Studio
## Shortcuts
## Packaging Your Solutions (Via Archives)
## Common Pitfalls When Creating Solutions
## Understanding the Output Log
# Syntax (and General Programming):
## Commenting
## Naming Schemes
## Common Pitfalls When Typing in C++
# Typing Help
To help practice typing, try out the following sites:

[Typing Test](http://10fastfingers.com/typing-test/english)

You can also try timing yourself when typing C++ syntax in Visual Studio. For instance, see if you can quickly type a "Hello
World" program.


text:
---
layout: post
title:  "Our first platformer"
author: gieoon
categories: Juunoco Studio release
featured: true
tags: Marketing Frank one tap mobile
image: https://juunoco.github.io/blog/assets/images/030918/frank_logo.png
cache: false
hidden: true
---

### There's one control

You control Frank, a simple happy frog who has one goal in life, to jump to the next platform.

When you tap, Frank jumps.
When you hold and tap, Frank jumps further.

Make Frank get as far as possible.

### Difficulty and progression

At first the game was supposed to progress by zooming out, and the jumps become furhter and further, so the hold mechanism would be more sensitive. However, as things progressed, I felt like that was too complex, so we simplified it down much further to make the platforms become narrower over time.

### Is it fun?

You tell me.

> Cheers, gieoon

repository: juunoco/blog

branch_name: HEAD

repo_name: juunoco/blog


text:
# Docker / Get started / About #

## Prerequisites ##

While we’ll define concepts along the way, it is good for you to understand [what Docker is](../what-docker/README.md) and [why you would use Docker](../use-cases/README.md) before we begin.

TODO

## Setup ##

Before we get started, make sure your system has [the latest version of Docker installed](../engine/installation/README.md).

Note: version 1.13 or higher is required.

You should be able to run `docker run hello-world` and see a response like this:

    Unable to find image 'hello-world:latest' locally
    latest: Pulling from library/hello-world
    ca4f61b1923c: Pull complete
    Digest: sha256:be0cd392e45be79ffeffa6b05338b98ebb16c87b255f48e297ec7f98e123905c
    Status: Downloaded newer image for hello-world:latest

    Hello from Docker!
    This message shows that your installation appears to be working correctly.

    To generate this message, Docker took the following steps:
     1. The Docker client contacted the Docker daemon.
     2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
        (amd64)
     3. The Docker daemon created a new container from that image which runs the
        executable that produces the output you are currently reading.
     4. The Docker daemon streamed that output to the Docker client, which sent it
        to your terminal.

    To try something more ambitious, you can run an Ubuntu container with:
     $ docker run -it ubuntu bash

    Share images, automate workflows, and more with a free Docker ID:
     https://cloud.docker.com/

    For more examples and ideas, visit:
     https://docs.docker.com/engine/userguide/

## TODO ##

TODO

## Useful links ##

[Docker documentation page](https://docs.docker.com/get-started/)

| Navigation               |
| ------------------------ |
| [Level up](../README.md) |

repository: marbug/docker

repo_name: marbug/docker


text:
# How to set up and start the Pylvax Django project

## 1. Fork the project on GitHub

![](http://i.imgur.com/DLi2Nmb.png?1)

After this, you'll see a copy of this project on **your GitHub account**.

## 2. Download and set up the GitKraken Git client

Download from [gitkraken.com](https://www.gitkraken.com/).

## 3. Clone your repository

Open GitKraken, set up your GitHub login and clone **your** repository.

## 4. Setup virtualenv

- `cd` to the root of this project with a terminal (the folder which has README.md in it).
- run `virtualenv venv`

## 5. Activate virtualenv

OS X / Linux:
`. venv/bin/activate`

Windows:
`venv\script\activate`

If success, prompt should start with: `(venv)`

## 6. Install Django and dependencies

`pip install -r requirements/local.txt`

## 7. Run Django

`cd project`

OS X / Linux:
`./manage.py runserver`

Windows:
`python manage.py runserver`

# Practice

Go to [Issues](https://github.com/Pylvax/django/issues) and do the ones starting with numbers.


text:
# Quickstart

This guide shows how to install and run Metarank on a single machine using Docker. We will run the service, feed it with
sample data and issue queries.

## Prerequisites

* Docker: [Docker Desktop for Mac/Windows](https://docs.docker.com/engine/install/), or Docker for Linux
* Operating system: Linux, macOS, or Windows 10+
* Architecture: x86_64. For M1, see [Apple M1 support](../installation.md#installing-on-macos)
* Memory: 2Gb dedicated to Docker

This guide is tested with Docker for linux v20.10.16, and [metarank/metarank:0.5.1](https://hub.docker.com/r/metarank/metarank/tags) docker image.

## Getting the dataset

For the quickstart, we will use an open [RankLens](https://github.com/metarank/ranklens) dataset and personalize
a set of pre-computed movie recommendations based on visitor activity.
The dataset is used to build a [Metarank Demo](https://demo.metarank.ai/) website and includes the following event types:

Movie metadata: genres, actors, tags, votes.

```json
{
  "id": "b4951b85-a87f-4fdc-b2af-9ff06783def4",
  "item": "3114",
  "timestamp": "1636907100000",
  "fields": [
    {"name": "title", "value": "Toy Story 2"},
    {"name": "popularity", "value": 112.767},
    {"name": "vote_avg", "value": 7.6},
    {"name": "vote_cnt", "value": 11025.0},
    {"name": "budget", "value": 9.0E+7},
    {"name": "runtime", "value": 92.0},
    {"name": "release_date", "value": 9.412416E+8},
    {"name": "genres", "value": ["animation", "comedy", "family"]},
    {"name": "tags", "value": ["pixar", "disney", "animation", "sequel"]},
    {"name": "actors", "value": ["tom hanks", "joan cusack", "frank welker"]},
    {"name": "director", "value": "john lasseter"},
    {"name": "writer", "value": "andrew stanton"}
  ],
  "event": "item"
}
```

Visitor impressions: what was displayed to a visitor

```json
{
  "event": "ranking",
  "id": "id1",
  "items": [
    {"id":"72998"},  {"id":"67197"},  {"id":"77561"},  {"id":"68358"},
    {"id":"72378"},  {"id":"85131"},  {"id":"94864"},  {"id":"68791"},
    {"id":"109487"}, {"id":"59315"},  {"id":"120466"}, {"id":"90405"},
    {"id":"117529"}, {"id":"130490"}, {"id":"92420"},  {"id":"122882"},
    {"id":"113345"}, {"id":"2571"},   {"id":"122900"}, {"id":"88744"},
    {"id":"95875"},  {"id":"60069"},  {"id":"2021"},   {"id":"135567"},
    {"id":"122902"}, {"id":"104243"}, {"id":"112852"}, {"id":"102880"},
    {"id":"96610"},  {"id":"741"},    {"id":"166528"}, {"id":"164179"},
    {"id":"71057"},  {"id":"3527"},   {"id":"6365"},   {"id":"6934"},
    {"id":"114935"}, {"id":"8810"},   {"id":"173291"}, {"id":"1580"},
    {"id":"1917"},   {"id":"135569"}, {"id":"106920"}, {"id":"1240"},
    {"id":"85056"},  {"id":"780"},    {"id":"1527"},   {"id":"5459"},
    {"id":"8644"},   {"id":"60684"},  {"id":"7254"},   {"id":"44191"},
    {"id":"97752"},  {"id":"2628"},   {"id":"541"},    {"id":"106002"},
    {"id":"2012"},   {"id":"79357"},  {"id":"6283"},   {"id":"113741"},
    {"id":"27660"},  {"id":"34048"},  {"id":"1882"},   {"id":"1748"},
    {"id":"34319"},  {"id":"1097"},   {"id":"115713"}, {"id":"2916"}
  ],
  "user": "alice",
  "session": "alice1",
  "timestamp":<PHONE_NUMBER>008
}
```

Visitor interactions: which movies the visitor liked after observing the ranking.

```json
{
  "id": "580a09e9-a002-4d59-a527-a556a38aa04f",
  "item": "4002",
  "timestamp": "1636993839000",
  "ranking": "84074af6-25fb-4791-81da-2f622871b194",
  "user": "90df34e521cc3d53af5f42f5c16ecb60",
  "session": "90df34e521cc3d53af5f42f5c16ecb60",
  "type": "click",
  "fields": [],
  "event": "interaction"
}
```

For this quickstart, you need two files from the dataset:
1. [config.yml](https://raw.githubusercontent.com/metarank/metarank/master/src/test/resources/ranklens/config.yml) - metarank
configuration file used in the [demo.metarank.ai](https://demo.metarank.ai), describing how to map visitor events to ML features.
For your own dataset, you don't always need to write this file from scratch, Metarank can automatically try to deduce
most typical feature mappings based on your dataset. See [Autofeature](../howto/autofeature.md) for details.
2. [events.jsonl.gz](https://github.com/metarank/metarank/blob/master/src/test/resources/ranklens/events/events.jsonl.gz) -
a dump of historical visitor interactions used for ML training.

```bash
curl -o config.yml https://raw.githubusercontent.com/metarank/metarank/master/src/test/resources/ranklens/config.yml
```

```bash
curl -o events.jsonl.gz https://media.githubusercontent.com/media/metarank/metarank/master/src/test/resources/ranklens/events/events.jsonl.gz
```
```bash
ls -l

total 172
drwxr-xr-x  2 user user   4096 Aug 23 14:24 .
drwxr-xr-x 81 user user  16384 Aug 23 14:24 ..
-rw-r--r--  1 user user   2542 Aug 23 14:24 config.yml
-rw-r--r--  1 user user 150264 Aug 23 14:24 events.jsonl.gz

```

## Running Metarank in Docker

```bash
docker run -i -t -p 8080:8080 -v $(pwd):/opt/metarank metarank/metarank:latest standalone --config /opt/metarank/config.yml --data /opt/metarank/events.jsonl.gz
```

This command will:
* run the dataset import process from the current directory,
* train the [ML model for ranking](../configuration/supported-ranking-models.md),
* start the [API](../api.md) on port 8080.

![import and training process](img/training.gif)

## First query

We're going to send a set of initial candidates for reranking into Metarank's REST API `/rank` endpoint for an
`xgboost` model defined in config.yml. Let's take top-100 popular movies tagged as Sci-Fi, and ask Metarank to reorder
them to maximize CTR:

```bash
curl http://localhost:8080/rank/xgboost -d '{
    "event": "ranking",
    "id": "id1",
    "items": [
        {"id":"72998"}, {"id":"67197"}, {"id":"77561"}, {"id":"68358"}, {"id":"79132"}, {"id":"103228"},
        {"id":"72378"}, {"id":"85131"}, {"id":"94864"}, {"id":"68791"}, {"id":"93363"}, {"id":"112623"},
        {"id":"109487"}, {"id":"59315"}, {"id":"120466"}, {"id":"90405"}, {"id":"122918"}, {"id":"70286"},
        {"id":"117529"}, {"id":"130490"}, {"id":"92420"}, {"id":"122882"}, {"id":"87306"}, {"id":"82461"},
        {"id":"113345"}, {"id":"2571"}, {"id":"122900"}, {"id":"88744"}, {"id":"111360"}, {"id":"134130"},
        {"id":"95875"}, {"id":"60069"}, {"id":"2021"}, {"id":"135567"}, {"id":"103253"}, {"id":"111759"},
        {"id":"122902"}, {"id":"104243"}, {"id":"112852"}, {"id":"102880"}, {"id":"56174"}, {"id":"107406"},
        {"id":"96610"}, {"id":"741"}, {"id":"166528"}, {"id":"164179"}, {"id":"187595"}, {"id":"589"},
        {"id":"71057"}, {"id":"3527"}, {"id":"6365"}, {"id":"6934"}, {"id":"1270"}, {"id":"6502"},
        {"id":"114935"}, {"id":"8810"}, {"id":"173291"}, {"id":"1580"}, {"id":"182715"}, {"id":"166635"},
        {"id":"1917"}, {"id":"135569"}, {"id":"106920"}, {"id":"1240"}, {"id":"5502"}, {"id":"316"},
        {"id":"85056"}, {"id":"780"}, {"id":"1527"}, {"id":"5459"}, {"id":"94018"}, {"id":"33493"},
        {"id":"8644"}, {"id":"60684"}, {"id":"7254"}, {"id":"44191"}, {"id":"101864"}, {"id":"132046"},
        {"id":"97752"}, {"id":"2628"}, {"id":"541"}, {"id":"106002"}, {"id":"1200"}, {"id":"5378"},
        {"id":"2012"}, {"id":"79357"}, {"id":"6283"}, {"id":"113741"}, {"id":"90345"}, {"id":"2011"},
        {"id":"27660"}, {"id":"34048"}, {"id":"1882"}, {"id":"1748"}, {"id":"2985"}, {"id":"104841"},
        {"id":"34319"}, {"id":"1097"}, {"id":"115713"}, {"id":"2916"}
    ],
    "user": "alice",
    "session": "alice1",
    "timestamp":<PHONE_NUMBER>711
}'
```

The API will respond with a list of 100 re-ranked movie ids:
```json5
{
  "items": [
    {"item": "72998",  "score": 2.0272045135498047},
    {"item": "589",    "score": 1.838820457458496},
    {"item": "134130", "score": 1.7281458377838135},
    {"item": "5459",   "score": 1.7237709760665894},
    {"item": "1917",   "score": 1.7038706541061401},
    {"item": "2571",   "score": 1.6998087167739868},
    {"item": "1527",   "score": 1.6812316179275513},
    {"item": "97752",  "score": 1.6692591905593872},
    {"item": "1270",   "score": 1.648807406425476},
    {"item": "1580",   "score": 1.5384368896484375},
    {"item": "109487", "score": 1.5244081020355225},
    {"item": "79132",  "score": 1.4934355020523071},
    // other 88 items are skipped
  ]
}
```

Which looks like a diverse set of sci-fi movies with some generic non-personalized ranking, as we haven't sent any
interaction events yet.

![sci-fi movies](img/ranking1.jpg)

## Sending visitor feedback

Metarank expects to receive impression events (what was displayed to the visitor) and interaction events (what the visitor
did after seeing the listing).

Impression event contains only the items that were displayed to the user, so if your response is paginated, impression event will indicate
only items from the current page.

In our case, the impression event is a set of top 12 movies from the previous `/rank` request,
starting with `Terminator 2` and ending with `MIIB`:
```bash
curl http://localhost:8080/feedback -d '{
    "event": "ranking",
    "id": "id1",
    "items": [
        {"id":"72998"}, {"id":"589"}, {"id":"134130"}, {"id":"5459"},
        {"id":"1917"}, {"id":"2571"}, {"id":"1527"}, {"id":"97752"},
        {"id":"1270"}, {"id":"1580"}, {"id":"109487"}, {"id":"79132"}
    ],
    "user": "alice",
    "session": "alice1",
    "timestamp":<PHONE_NUMBER>711
}'
```

Now let's send a click on `Men in Black` with id=1580:
```bash
curl http://localhost:8080/feedback -d '{
    "event": "interaction",
    "type": "click",
    "id": "id2",
    "ranking": "id1",
    "item": "1580",
    "user": "alice",
    "session": "alice1",
    "timestamp":<PHONE_NUMBER>711
}'
```

## Getting personalized ranking

Now, we are ready to get some personalized!

Let's send the same first ranking request with top-100 sci-fi movies we did before, and see how response will change
after providing some visitor feedback:
```bash
curl http://localhost:8080/rank/xgboost -d '{
    "event": "ranking",
    "id": "id1",
    "items": [
        {"id":"72998"}, {"id":"67197"}, {"id":"77561"}, {"id":"68358"}, {"id":"79132"}, {"id":"103228"},
        {"id":"72378"}, {"id":"85131"}, {"id":"94864"}, {"id":"68791"}, {"id":"93363"}, {"id":"112623"},
        {"id":"109487"}, {"id":"59315"}, {"id":"120466"}, {"id":"90405"}, {"id":"122918"}, {"id":"70286"},
        {"id":"117529"}, {"id":"130490"}, {"id":"92420"}, {"id":"122882"}, {"id":"87306"}, {"id":"82461"},
        {"id":"113345"}, {"id":"2571"}, {"id":"122900"}, {"id":"88744"}, {"id":"111360"}, {"id":"134130"},
        {"id":"95875"}, {"id":"60069"}, {"id":"2021"}, {"id":"135567"}, {"id":"103253"}, {"id":"111759"},
        {"id":"122902"}, {"id":"104243"}, {"id":"112852"}, {"id":"102880"}, {"id":"56174"}, {"id":"107406"},
        {"id":"96610"}, {"id":"741"}, {"id":"166528"}, {"id":"164179"}, {"id":"187595"}, {"id":"589"},
        {"id":"71057"}, {"id":"3527"}, {"id":"6365"}, {"id":"6934"}, {"id":"1270"}, {"id":"6502"},
        {"id":"114935"}, {"id":"8810"}, {"id":"173291"}, {"id":"1580"}, {"id":"182715"}, {"id":"166635"},
        {"id":"1917"}, {"id":"135569"}, {"id":"106920"}, {"id":"1240"}, {"id":"5502"}, {"id":"316"},
        {"id":"85056"}, {"id":"780"}, {"id":"1527"}, {"id":"5459"}, {"id":"94018"}, {"id":"33493"},
        {"id":"8644"}, {"id":"60684"}, {"id":"7254"}, {"id":"44191"}, {"id":"101864"}, {"id":"132046"},
        {"id":"97752"}, {"id":"2628"}, {"id":"541"}, {"id":"106002"}, {"id":"1200"}, {"id":"5378"},
        {"id":"2012"}, {"id":"79357"}, {"id":"6283"}, {"id":"113741"}, {"id":"90345"}, {"id":"2011"},
        {"id":"27660"}, {"id":"34048"}, {"id":"1882"}, {"id":"1748"}, {"id":"2985"}, {"id":"104841"},
        {"id":"34319"}, {"id":"1097"}, {"id":"115713"}, {"id":"2916"}
    ],
    "user": "alice",
    "session": "alice1",
    "timestamp":<PHONE_NUMBER>711
}'
```

As you can see, the response is quite different from the first attempt:
```json5
{
  "items": [
    {"item": "1580",   "score": 3.345952033996582},
    {"item": "5459",   "score": 2.873959541320801},
    {"item": "8644",   "score": 2.500633478164673},
    {"item": "56174",  "score": 2.2979140281677246},
    {"item": "2571",   "score": 2.0133864879608154},
    {"item": "1270",   "score": 1.807900071144104},
    {"item": "109487", "score": 1.7143194675445557},
    {"item": "589",    "score": 1.706472396850586},
    {"item": "780",    "score": 1.7030035257339478},
    {"item": "1527",   "score": 1.6445566415786743},
    {"item": "60069",  "score": 1.6372750997543335},
    {"item": "1917",   "score": 1.6299139261245728}
    // other 88 items skipped
  ]
}
```
![reranked](img/ranking2.jpg)

Ranking was adjusted to a taste of the visitor, we can see that:
* `Men in Black 2` went to the top, as it has similar tags and actors.
* other space movies also went up (like `Armageddon`), as they're also space-related.
* both parts of `Back to the Future` went significantly down, as not related to past visitor's clicks.

## What's next?

* play with the contents of [config.yml](../configuration/overview.md), enabling and disabling different features and see
how ranking changes depending on used features.
* generate your own set of [input events](../event-schema.md), describing your use case.

repository: metarank/metarank

gha_language: Scala

repo_name: metarank/metarank


text:
---
hrs_structure:
  division: '1'
  volume: '6'
  title: '19'
  chapter: '329'
  section: 329-104
type: hrs_section
tags:
  - Government
menu:
  hrs:
    identifier: HRS_0329-0104
    parent: HRS0329
    name: 329-104 Confidentiality of information; disclosure of information
weight: 43335
title: Confidentiality of information; disclosure of information
full_title: 329-104 Confidentiality of information; disclosure of information
---
**§329-104 Confidentiality of information; disclosure of information.** (a) The information collected under this part shall not be available to the public or used for any commercial purpose. Ownership of all data collected shall reside with the State.

(b) Responsibility for limiting access to information in the system is vested in the administrator. Access to the information collected at the central repository pursuant to this part shall be confidential, and access to the information shall be limited to personnel of the designated state agency.

(c) This section shall not prevent the disclosure, at the discretion of the administrator, of investigative information to:

(1) Law enforcement officers, investigative agents of federal, state, or county law enforcement or regulatory agencies, United States attorneys, county prosecuting attorneys, or the attorney general; provided that the administrator has reasonable grounds to believe that the disclosure of any information collected under this part is in furtherance of an ongoing criminal or regulatory investigation or prosecution;

(2) Registrants authorized under chapters 448, 453, and 463E who are registered to administer, prescribe, or dispense controlled substances and their practitioner delegate; provided that the information disclosed relates only to the registrant's own patient;

(3) Pharmacists or pharmacist delegates, employed by a pharmacy registered under section 329-32, who request prescription information about a customer relating to a violation or possible violation of this chapter;

(4) Other state-authorized governmental prescription-monitoring programs;

(5) The chief medical examiner or licensed physician designee who requests information and certifies the request is for the purpose of investigating the death of an individual;

(6) Qualified personnel for the purpose of bona fide research or education; provided that data elements that would reasonably identify a specific recipient, prescriber, or dispenser shall be deleted or redacted from the information prior to disclosure; provided further that release of the information may be made only pursuant to a written agreement between qualified personnel and the administrator in order to ensure compliance with this subsection; and

(7) Other entities or individuals authorized by the administrator to assist the program with projects that enhance the electronic prescription accountability system.

Information disclosed to a registrant, pharmacist, or authorized government agency under this section shall be transmitted by a secure means determined by the designated agency.

(d) No person shall knowingly disclose or attempt to disclose, or use or attempt to use, information in the system in violation of this section. Any person who violates this section is guilty of a class C felony.

(e) The designated state agency shall purge or cause to be purged from the central repository system, no later than five years after the date a patient's prescription data are made available to the designated state agency, the identification number of the patient, unless the information is part of an active investigation. [L 1996, c 268, pt of §2; am L 1999, c 145, §1; am L 2001, c 162, §1; am L 2006, c 69, §6; am L 2009, c 11, §42; am L 2010, c 123, §8; am L 2016, c 218, §17]

repository: SamMade/BlueAndKrabby

repo_name: SamMade/BlueAndKrabby


text:
---
layout: page
title: Hire Me
subtitle: So... You wanna work with me, huh?!
permalink: /hire-me/
---

Well, let me just take this opportunity to congratulate you on perhaps, the best decision you've ever made.

I jest... I jest.

In all seriousness, I'm beyond humbled, and downright honoured that you're considering working with me.

So, if you are deeply passionate about what you do, are committed to producing an excellent product, and really care about your customers & the experience you deliver to your users, then I'd love to help you.

Ways I can help

Ultimately, I'm here to help you make sense of the constantly evolving digital landscape. Whether we work on formulating a digital strategy for your business, or you simply want me to build you a straight up website, my goal is to make sure you delight your customers whilst ensuring we hit your business goals.

Here's a few ways I've helped clients in the past, and how I could help you:

Design & Dev

Custom WordPress themes

Landing pages & microsites

HTML Emails

Wireframes & Functional Protoypes

Consulting

CRO & AB Testing

Front-end perfomance

Usability & Accessibility

Digital Strategy

Training

Analytics (GA & GTM)

Email Marketing

Front-end workflows & automation (Git, Gulp, SASS)

Still here? Well, take the next step and Email Me with some details about what you've got in mind. I look forward to hearing from you :)


text:
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fasyncy%2Fplatform-engine.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fasyncy%2Fplatform-engine?ref=badge_shield)

# Storyscript Cloud Runtime

The Storyscript runtime powering the Storyscript Cloud and executing stories.

## Installing

See https://github.com/storyscript/stack-compose to install in production.

```
$ python setup.py install
```

## Testing

1. Compile assets required for the engine
2. Set the ASSET_DIR environment variable to this dir
3. Start the engine

```
$ asyncy-server start
```

## Configuration options

The engine loads its configuration options from the environment. Defaults are
provided:

```
$ export logger_name=storyscript
$ export logger_level=debug
```

## License

[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fasyncy%2Fplatform-engine.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fasyncy%2Fplatform-engine?ref=badge_large)


text:
# undepend

undepend removes dependencies by brute force by removing likely candidates and checking that everything compiles after removal.

The results are a list of crates that can be removed in a file called `unused.sh`.
`chmod +x ./unused.sh` and run it to remove all the unused deps and see if the result works for you.

Alternatively you can `cat ./unused.sh` in a vscode terminal
and use the Cargo.toml hyperlinks to manually check that those crates ought to be removed.

## Installation:

(needs git)

Install undepend and prerequisites:

```sh
cargo install ripgrep cargo-edit undepend
```

## Usage:

Change your current dir to the dir of a freshly checked out git clone and run:

```sh
undepend
```

The tool will iterate over the workspace's dependencies,
removing them individually and establishing if everything still compiles.

** The tool will abort if the checkout is not clean at the start. **

A recorded list of dependencies are written to `unused.sh`

## How undepend works:

cargo metadata is used to understand which crates are in the workspace.

For each crate we run:

  * `cargo rm a_crate_dep` (from cargo-edit)
  * `cargo check --all-targets`
  * `cargo build --all-targets --release`
  * `cargo test --doc --release non_existent_test_name`
  * If we get to here without errors then possibly the dep is not needed.
  * `git reset --hard` (to get back to a clean state)

## Performance:

As an optimisation undepend skips dependencies that are clearly used in the source.
As such, the runtime of undepend is not too bad. (Before that optimisation it could
easily take overnight for some projects. Now I've not seen anything take longer than 30 mins for big
 projects on a 32 core box.)

## Gotchas:

If a dependency is non-optional, is only used for one target platform and isn't directly used we may still try and remove it.

At the moment `cargo check --all-targets` doesn't compile doc tests so
we try and run `cargo test non_existent_test_name` - this I think forces the compile to happen.

(Tracking issues/PR for fixing this:
https://github.com/rust-lang/cargo/issues/6424
https://github.com/rust-lang/cargo/pull/8859
)

If the dependency is optional no attempt is made to removing it.

## Skipping:

TODO: We try and respect cargo-udeps ignore format:

`[package.metadata.cargo-udeps.ignore]`

(See [Cargo.toml](Cargo.toml) for an example)

## Trophy Case:

Please reference this issue to add to the trophy case:

https://github.com/gilescope/undepend/issues/1

## Prior Art:

### udeps:

udeps takes a less brute-force approach of look at the incremental compile information in the target
dir to base its decisions on and thus is better for regular CI use.

https://crates.io/crates/cargo-udeps

(Also compared to udeps this crate has only pure rust dependencies.)

## Changelog:

   * 0.1.1 Check debug + release mode and doc tests. Checking build dependencies also.
   * 0.1.0 Initial release

repository: gilescope/undepend

branch_name: refs/heads/main

repo_name: gilescope/undepend


text:
You can use the SOEF in the agent framework by using the SOEF connection as a package in your agent project.

Note

Please consult the relevant guide for details.

repository: fetchai/docs

gha_language: Makefile

repo_name: fetchai/docs


text:
a simple Android Broadcast Receiver tutorial

in this tutorial, I made a simple App to demonstrate how an Activity and a Service send and receive Broadcast from each other.

repository: eneim/android-training-tutorial

repo_name: eneim/android-training-tutorial


text:
#The raising of them that are fallen A discourse very profitable and beneficial to all faithfull Christians dialoguewise, betwixt a knight and a gentleman· Set foorth for the benefit and good of all such people as are afflicted eyther in minde or conscience. Written by Thomas Sauile Gent? [sic]#

##Savile, Thomas, fl. 1595-1613.##
The raising of them that are fallen A discourse very profitable and beneficial to all faithfull Christians dialoguewise, betwixt a knight and a gentleman· Set foorth for the benefit and good of all such people as are afflicted eyther in minde or conscience. Written by Thomas Sauile Gent? [sic]
Savile, Thomas, fl. 1595-1613.

##General Summary##

**Links**

[TCP catalogue](http://www.ota.ox.ac.uk/tcp/)  •
[HTML](http://tei.it.ox.ac.uk/tcp/Texts-HTML/free/B15/B15648.html)  •
[EPUB](http://tei.it.ox.ac.uk/tcp/Texts-EPUB/free/B15/B15648.epub) •
[Page images (Historical Texts)](https://historicaltexts.jisc.ac.uk/eebo-99852002e)

**Availability**

This keyboarded and encoded edition of the work described above is co-owned by the
    institutions providing financial support to the Early English Books Online Text Creation
    Partnership. This text is available for reuse, according to the terms of  Creative Commons 0 1.0 Universal
    licence. The text can be copied, modified, distributed and performed, even for commercial
    purposes, all without asking permission.

**Major revisions**

1. __2014-02 __ __Apex CoVantage__ *Keyed and coded from ProQuest page images *
1. __2014-04 __ __Olivia Bottum __ *Sampled and proofread *
1. __2014-04 __ __Olivia Bottum__ *Text and markup reviewed and edited *
1. __2015-03 __ __pfs__ *Batch review (QC) and XML conversion *
1. __2021-05 __ __lb__ *TEI P5 conversion *

##Content Summary##

#####Front#####
THE RAISING OF them that are fallen.A Discourse very profitable and beneficial to all faithfull Chri
1. The Contents.

1. TO THE RIGHT VERtuous renowned, and for angel like rule ouer their owne passible tender affections in lawfull delights, more especially respected Ladies: The La: Katherine Countesse of Huntingdon, and the La: Margaret Countesse of Cumberland, and vnto Sr. Francis Hastinges, and Sr: Tho: Smith, honorable christians & Knights. Tho: Sauile wisheth a continuall practise of their knowledge in the misterie of reconciliation, vntill they be compacted into the Mrs. building, and Really vnited vnto Christ, that finally they may be where he is, and haue their ioy full:

1. To the Christian Reader.

#####Body#####

1. The Raysing of, them that are fallen

#####Back#####

1. ❧ The Authors peraswasion from proofe laying the totall some of the Booke.

**Types of content**

  * There are 51 **verse** lines!
  * Oh, Mr. Jourdain, there is **prose** in there!

There are 114 **omitted** fragments!
 @__reason__ (114) : illegible (114)  •  @__resp__ (114) : #keyers (114)  •  @__extent__ (114) : 1 letter (95), 1 span (2), 2 letters (14), 1 word (3)

**Character listing**

|Text|string(s)|codepoint(s)|
|---|---|---|
|Latin-1 Supplement|·é|183 233|
|Latin Extended-A|ōēāū|333 275 257 363|
|General Punctuation|•…|8226 8230|
|Superscripts             and Subscripts|⁴|8308|
|Geometric Shapes|◊▪|9674 9642|
|Dingbats|❧|10087|
|CJKSymbolsandPunctuation|〈〉|12296 12297|

##Tag Usage Summary##

###Header Tag Usage###

|No|element name|occ|attributes|
|---|---|---|---|
|1.|__author__|2||
|2.|__availability__|1||
|3.|__biblFull__|1||
|4.|__change__|5||
|5.|__date__|7| @__when__ (1) : 2016-02 (1)|
|6.|__editorialDecl__|1||
|7.|__encodingDesc__|1||
|8.|__extent__|2||
|9.|__fileDesc__|1||
|10.|__idno__|6| @__type__ (6) : DLPS (1), EEBO-CITATION (1), VID (1), EEBO-PROQUEST (1), STC (2)|
|11.|__keywords__|1| @__scheme__ (1) : http://authorities.loc.gov/ (1)|
|12.|__label__|5||
|13.|__langUsage__|1||
|14.|__language__|1| @__ident__ (1) : eng (1)|
|15.|__listPrefixDef__|1||
|16.|__note__|8||
|17.|__notesStmt__|2||
|18.|__p__|11||
|19.|__prefixDef__|2| @__ident__ (2) : tcp (1), char (1)  •  @__matchPattern__ (2) : ([0-9\-]+):([0-9IVX]+) (1), (.+) (1)  •  @__replacementPattern__ (2) : http://eebo.chadwyck.com/downloadtiff?vid=$1&page=$2 (1), https://raw.githubusercontent.com/textcreationpartnership/Texts/master/tcpchars.xml#$1 (1)|
|20.|__profileDesc__|1||
|21.|__projectDesc__|1||
|22.|__pubPlace__|2||
|23.|__publicationStmt__|2||
|24.|__publisher__|2||
|25.|__ref__|4| @__target__ (4) : https://creativecommons.org/publicdomain/zero/1.0/ (1), http://www.textcreationpartnership.org/docs/. (1), https://textcreationpartnership.org/faq/#faq05 (1), https://github.com/textcreationpartnership (1)|
|26.|__relatedItem__|1| @__type__ (1) : facs (1)  •  @__target__ (1) : https://data.historicaltexts.jisc.ac.uk/view?pubId=eebo-99852002e (1)|
|27.|__revisionDesc__|1||
|28.|__seriesStmt__|1||
|29.|__sourceDesc__|1||
|30.|__term__|1| @__type__ (1) : topical_term (1)|
|31.|__textClass__|1||
|32.|__title__|3||
|33.|__titleStmt__|2||

###Text Tag Usage###

|No|element name|occ|attributes|
|---|---|---|---|
|1.|__back__|1||
|2.|__bibl__|2||
|3.|__body__|1||
|4.|__closer__|2||
|5.|__desc__|114||
|6.|__div__|6| @__type__ (6) : title_page (1), table_of_contents (1), dedication (1), to_the_reader (1), text (1), poem (1)|
|7.|__figure__|1||
|8.|__front__|1||
|9.|__g__|372| @__ref__ (372) : char:EOLhyphen (367), char:EOLunhyphen (5)|
|10.|__gap__|114| @__reason__ (114) : illegible (114)  •  @__resp__ (114) : #keyers (114)  •  @__extent__ (114) : 1 letter (95), 1 span (2), 2 letters (14), 1 word (3)|
|11.|__head__|5||
|12.|__hi__|354||
|13.|__item__|9||
|14.|__l__|51||
|15.|__lg__|13||
|16.|__list__|3||
|17.|__note__|75| @__place__ (75) : margin (75)|
|18.|__p__|25||
|19.|__pb__|61| @__facs__ (61) : tcp:177877:1 (1), tcp:177877:2 (2), tcp:177877:3 (2), tcp:177877:4 (2), tcp:177877:5 (2), tcp:177877:6 (2), tcp:177877:7 (2), tcp:177877:8 (2), tcp:177877:9 (2), tcp:177877:10 (2), tcp:177877:11 (2), tcp:177877:12 (2), tcp:177877:13 (2), tcp:177877:14 (2), tcp:177877:15 (2), tcp:177877:16 (2), tcp:177877:17 (2), tcp:177877:18 (2), tcp:177877:19 (2), tcp:177877:20 (2), tcp:177877:21 (2), tcp:177877:22 (2), tcp:177877:23 (2), tcp:177877:24 (2), tcp:177877:25 (2), tcp:177877:26 (2), tcp:177877:27 (2), tcp:177877:28 (2), tcp:177877:29 (2), tcp:177877:30 (2), tcp:177877:31 (2)|
|20.|__q__|2||
|21.|__seg__|34| @__rend__ (34) : decorInit (3), sup (31)|
|22.|__signed__|2||
|23.|__trailer__|2||


text:
Phantom is a lightweight, simple (but not minimalistic) native markdown editor for Windows written in C# and WPF.

Why?
======
Markdown editors for Windows desktop aren't great.
I confidently say this because of the latest "make everything in a web browser!" phase of software, most MD editors are slow and look terribly and perform even more terribly.

Downloads
======
I currently officially host Phantom on my own website.  You can download it [here](https://vaporsoft.net/phantom/)

![](https://vaporsoft.net/content/images/2016/07/ue3ZyFM.png)

Objectives
======
- [x] Multiple file editing
- [x] Markdown Formatting tools
- [ ] Greater Export / Import functionality
- [ ] Better update settings
- [ ] Much more TBD

Contributing
=====

Please feel welcome to file issues and make changes.

License
=====
BSD 3-Clause

repository: LuisSanchez-Dev/Phantom

repo_name: LuisSanchez-Dev/Phantom


text:
# Optional Service Environment Variables

## Table of Contents

<!-- toc -->
- [Summary](#summary)
- [Motivation](#motivation)
  - [Goals](#goals)
  - [Non-Goals](#non-goals)
- [Proposal](#proposal)
  - [User Stories](#user-stories)
  - [Implementation Details/Notes/Constraints](#implementation-detailsnotesconstraints)
  - [Risks and Mitigations](#risks-and-mitigations)
- [Graduation Criteria](#graduation-criteria)
- [Implementation History](#implementation-history)
<!-- /toc -->

## Summary

This enhancement allows application developers to choose whether their Pods will receive [environment variables](https://kubernetes.io/docs/concepts/services-networking/service/#environment-variables) from services in their namespace. They can choose to disable them via the new `enableServiceLinks` field in `PodSpec`. The current behaviour will continue to be the default behaviour, but the developer may choose to disable these environment variables for certain workloads for reasons such as incompatibilities with other expected environment variables or scalability issues.

## Motivation

Today, a list of all services that were running when a pod's containers are created is automatically injected to those containers as environment variables matching the syntax of Docker links. There is no way to disable this.

Docker links have long been considered as a [deprecated legacy feature](https://docs.docker.com/engine/userguide/networking/default_network/dockerlinks/) of Docker since the introduction of networks and DNS. Likewise, in Kubernetes, DNS is to be preferred over service links.

Possible issues with injected service links are:

* Accidental coupling.
* Incompatibilities with container images that no longer utilize service links and explicitly fail at startup time if certain service links are defined.
* Performance penalty in starting up pods [for namespaces with many services](https://github.com/kubernetes/kubernetes/issues/1768#issuecomment-330778184)

### Goals

* Allow users to choose whether to inject service environment variables in their Pods.
* Do this in a backwards-compatible, non-breaking way. Default to the current behaviour.

### Non-Goals

N/A

## Proposal

### User Stories

* As an application developer, I want to be able to disable service link injection since the injected environment variables interfere with a Docker image that I am trying to run on Kubernetes.
* As an application developer, I want to be able to disable service link injection since I don't need it and it takes increasingly longer time to start pods as services are added to the namespace.
* As an application developer, I want to be able to disable service link injection since pods can fail to start if the environment variable list becomes too long. This can happen when there are >5,000 services in the same namespace.

### Implementation Details/Notes/Constraints

`PodSpec` is extended with an additional field, `enableServiceLinks`. The field should be a pointer to a boolean and default to true if nil.

In `kubelet_pods.go`, the value of that field is passed along to the function `getServiceEnvVarMap` where it is used to decide which services will be propogated into environment variables. In case `enableServiceLinks` is false then only the `kubernetes` service in the `kl.masterServiceNamespace` should be injected. The latter is needed in order to preserve Kubernetes variables such as `KUBERNETES_SERVICE_HOST` since a lot of code depends on it.

### Risks and Mitigations

The current behaviour is being kept as the default as much existing code and documentation depends on these environment variables.

## Graduation Criteria

N/A

## Implementation History

- 2017-10-21: First draft of original proposal [PR](https://github.com/kubernetes/community/pull/1249)
- 2018-02-22: First draft of implementation [PR](https://github.com/kubernetes/kubernetes/pull/60206)
- 2018-08-31: General consensus of implementation plan
- 2018-09-17: First draft of new implementation [PR](https://github.com/kubernetes/kubernetes/pull/68754)
- 2018-09-24: Implementation merged into master
- 2018-09-25: Converting proposal into this KEP

repository: kubernetes/enhancements

repo_name: kubernetes/enhancements


text:
# study-timer

A timer webapp to help you study.

## Prerequisites

You will need [Leiningen][1] 2.0 or above installed.

[1]: https://github.com/technomancy/leiningen

## Running

To start a web server for the application, run:

    lein run

## Online Version
[https://study-at.thesoup.store/](https://study-at.thesoup.store/)

## Picture
### Login
![Image of Login](./images/login.png)
### App
![Image of App](./images/app.png)

## TODO:
See [TODO.md](TODO.md)

repository: Akeboshiwind/study-timer

repo_name: Akeboshiwind/study-timer


text:
# HA-FanSpeedControl
A python script for Home Assistant that control fan speed with [Fan Template](https://www.home-assistant.io/integrations/fan.template/) and [Broadlink](https://www.home-assistant.io/integrations/broadlink/).

# How it work
The script automatically call broadlink service when you set fan speed.

## Example
if your fan speed range is 1~12.

example1: call `increase` fan 4 times when you set fan speed from 1 to 5.

example2: call `decrease` fan 3 times when you set fan speed from 5 to 2.

example3: call `decrease` fan 2 times when you set fan speed from 2 to 12.

# Installation
Copy the Python script in to your /config/python_scripts directory or install via HACS.

# Script arguments
|key|required|type|description|
|-|-|-|-|
|fan_speed|true|string|speed from fan template|
|fan_speed_entity_id|true|string||
|fan_entity_id|true|string||
|service_domain|true|string||
|service|true|string||
|service_data_increase|true|object||
|service_data_decrease|true|object||

# Config Example
config on fan `set_speed`
## Broadlink switch
```yaml
set_speed:
  - service: python_script.fan_speed_control
    data_template:
      fan_speed: "{{ speed }}"
      fan_speed_entity_id: 'input_text.status_fan_speed'
      fan_entity_id: 'fan.bedroom_fan'
      service_domain: 'broadlink'
      service: 'send'
      service_data_increase:
        host: <IP_ADDRESS>
        packet: !secret broadlink_ir_fan_increase
      service_data_decrease:
        host: <IP_ADDRESS>
        packet: !secret broadlink_ir_fan_decrease
```

## Remote service
```yaml
set_speed:
  - service: python_script.fan_speed_control
    data_template:
      fan_speed: "{{ speed }}"
      fan_speed_entity_id: 'input_text.status_fan_speed'
      fan_entity_id: 'fan.bedroom_fan'
      service_domain: 'remote'
      service: 'send_command'
      service_data_increase:
        entity_id: remote.broadlink
        device: fan
        command: increase
      service_data_decrease:
        entity_id: remote.broadlink
        device: fan
        command: decrease
```

## Template Fan config
```yaml
input_boolean:
  status_fan_power:
    name: 'Fan Power'

input_text:
  status_fan_speed:
    name: 'Fan Speed'

input_select:
  fan_osc:
    name: 'Fan osc'
    options:
      - 'True'
      - 'False'
fan:
  - platform: template
    fans:
      bedroom_fan:
        friendly_name: "myFan"
        value_template: "{{ states('input_boolean.status_fan_power') }}"
        speed_template: "{{ states('input_text.status_fan_speed') }}"
        oscillating_template: "{{ states('input_select.fan_osc') }}"
        turn_on:
          - condition: state
            entity_id: input_boolean.status_fan_power
            state: 'off'
          - service: broadlink.send
            data:
              host: <IP_ADDRESS>
              packet: your_fan_power_toggle_code
          - service: input_boolean.turn_on
            entity_id: input_boolean.status_fan_power
        turn_off:
          - condition: state
            entity_id: input_boolean.status_fan_power
            state: 'on'
          - service: broadlink.send
            data:
              host: <IP_ADDRESS>
              packet: your_fan_power_toggle_code
          - service: input_boolean.turn_off
            entity_id: input_boolean.status_fan_power
        set_speed:
          - service: python_script.fan_speed_control
            data_template:
              service_domain: 'remote'
              service: 'send_command'
              service_data_increase:
                entity_id: remote.broadlink
                device: fan
                command: increase
              service_data_decrease:
                entity_id: remote.broadlink
                device: fan
                command: decrease
        set_oscillating:
          - condition: state
            entity_id: input_boolean.status_fan_power
            state: 'on'
          - service: broadlink.send
            data:
              host: <IP_ADDRESS>
              packet: your_fan_osc_toggle_code
          - service: input_select.select_next
            entity_id: input_select.fan_osc
        speeds: ['off', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12']
```

# Debug
add logger to your `configuration.yaml`
```yaml
logger:
  default: warn
  logs:
    homeassistant.components.python_script.fan_speed_control.py: debug
```

# Screenshot
![image](https://github.com/iml885203/HA-FanSpeedControl/blob/master/Screenshot/fan.png?raw=true)

## custom ui
![image](https://github.com/iml885203/HA-FanSpeedControl/blob/master/Screenshot/fanui.png?raw=true)


text:
---
type: "journal"
title: "Foggy Morning"
date: 2022-10-24T22:26:09-05:00
draft: false
thumbnail: "https://res.cloudinary.com/dpmsynxig/image/upload/c_scale,f_auto,q_auto:good,w_740/v1672629921/2022%20Posts/2022-10-24_foggy-morning/2022-10-25_hp5-02-17-positive.jpg"
image: "https://res.cloudinary.com/dpmsynxig/image/upload/f_auto,q_auto:good/v1672629921/2022%20Posts/2022-10-24_foggy-morning/2022-10-25_hp5-02-17-positive.jpg"
alt: "foggy tree line reflected in a pond"
caption: "35mm Summicron ASPH / Ilford HP5 at 1600"
tags:
- leica
- hp5
---

Never waste a foggy morning. They're kind of rare here.

{{< figure src="https://res.cloudinary.com/dpmsynxig/image/upload/f_auto,q_auto:good/v1672629920/2022%20Posts/2022-10-24_foggy-morning/2022-10-25_hp5-02-14-positive.jpg" alt="foggy view of two trees near the edge of a pond. there are two benches between the trees" caption="35mm Summicron ASPH / Ilford HP5 @ 1600" >}}

There was a crane hanging out and snacking in the swampy area of McAlpine park. I just sat and photographed him for a while. By the time I was done with the roll, the fog was mostly gone.

{{< figure src="https://res.cloudinary.com/dpmsynxig/image/upload/f_auto,q_auto:good/v1672629909/2022%20Posts/2022-10-24_foggy-morning/2022-10-25_hp5-02-31-positive.jpg" alt="a crane bird sitting in a swampy body of water viewed through wirey tree limbs" caption="35mm Summicron ASPH / Ilford HP5 @ 1600" >}}

Was a nice way to spend the morning before work.

repository: jason-white/personal-site

gha_language: HTML

repo_name: jason-white/personal-site


text:
# Getting Started

## Requirements

To contribute to this plugin, you need the following tools installed on your computer:

- [PHP](https://www.php.net/) - version 7.2 or higher, preferably installed via [Homebrew](https://brew.sh/)
- [Composer](https://getcomposer.org/) (PHP package manager) - to install PHP dependencies.
- [Node.js](https://nodejs.org/en/) (current LTS) - to install JavaScript dependencies.
- [WordPress](https://wordpress.org/download/) - to run the actual plugin.
- [Docker Desktop](https://www.docker.com/products/docker-desktop) and [Docker Compose](https://docs.docker.com/compose/install/) - for using the local environment

You should be running a Node version matching the [current active LTS release](https://github.com/nodejs/Release#release-schedule) or newer for this plugin to work correctly. You can check your Node.js version by typing node -v in the Terminal prompt.

If you have an incompatible version of Node in your development environment, you can use [nvm](https://github.com/creationix/nvm) to change node versions on the command line:

```bash
nvm install
```

## Local Environment

Since you need a WordPress environment to run the plugin in, the quickest way to get up and running is to use the provided Docker setup.

The following command will automatically verify whether Docker, Composer and Node.js are configured properly and start the local WordPress instance. You may need to run this script multiple times if prompted.

```bash
npm run env:start
```

The WordPress installation should be available at `http://localhost:8899` (**Username**: `admin`, **Password**: `password`).

To later turn off the local environment, you can run:

```bash
npm run env:stop
```

To bring it back later, run the previous command:

```bash
npm run env:start
```

Also, if you need to reset the local environment's database, you can run:

```bash
npm run env:reset-site
```

### Custom Environment

Alternatively, you can use your own local WordPress environment (e.g. using [Local by Flywheel](https://localbyflywheel.com/)) and clone this repository right into your `wp-content/plugins` directory.

```bash
cd wp-content/plugins && git clone git@github.com:google/web-stories-wp.git web-stories
```

**Note:** If you plan on using Local by Flywheel, it is recommended to use [version 3.x](https://localbyflywheel.com/community/t/no-way-to-install-addons-on-local-beta/14756/4) with the Volumes Manager add-on to map your local repository checkout to the plugins folder within the container.

## Development

First of all, you need to make sure that all PHP and JavaScript dependencies are installed:

```bash
composer install
npm install
```

Whether you use the pre-existing local environment or a custom one, any PHP code changes will be directly visible during development.

However, for JavaScript this involves a build process. To watch for any JavaScript file changes and re-build it when needed, you can run the following command:

```bash
npm run dev
```

This way you will get a development build of the JavaScript, which makes debugging easier.

To get a production build, run:

```bash
npm run build:js
```

### Testing

#### PHP Unit Tests

This project uses the [PHPUnit](https://phpunit.de/) testing framework to write unit and integration tests for the PHP part.

To run the full test suite, you can use the following command:

```bash
npm run test:php
```

You can also just run test for a specific function or class by using something like this:

```bash
npm run test:php -- --filter=Story_Post_Type
```

See `npm run test:php:help` to see all the possible options.

#### JavaScript Unit Tests

[Jest](https://jestjs.io/) is used as the JavaScript unit testing framework.

To run the full test suite, you can use the following command:

```bash
npm run test:js
```

You can also watch for any file changes and only run tests that failed or have been modified:

```bash
npm run test:js:watch
```

See `npm run test:js:help` to get a list of additional options that can be passed to the test runner.

#### End-to-End Tests

This project leverages the local Docker-based environment to facilitate end-to-end (e2e) testing using Puppeteer.

To run the full test suite, you can use the following command:

```bash
npm run test:e2e
```

You can also watch for any file changes and only run tests that failed or have been modified:

```bash
npm run test:e2e:watch
```

Not using the built-in local environment? You can also pass any other URL to run the tests against. Example:

```bash
npm run test:e2e -- --wordpress-base-url=https://my-amp-dev-site.local
```

For debugging purposes, you can also run the E2E tests in non-headless mode:

```bash
npm run test:e2e:interactive
```

Note that this will also slow down all interactions during tests by 80ms. You can control these values individually too:

```bash
PUPPETEER_HEADLESS=false npm run test:e2e # Interactive mode, normal speed.
PUPPETEER_SLOWMO=200 npm run test:e2e # Headless mode, slowed down by 200ms.
```

Sometimes one might want to test additional scenarios that aren't possible in a WordPress installation out of the box. That's why the test setup allows for for adding some utility plugins that can be activated during E2E tests.

These plugins can be added to `tests/e2e/plugins` and then activated via the WordPress admin.

#### Storybook

The latest version of the project's [storybook](https://storybook.js.org/) can be found at [https://google.github.io/web-stories-wp/](https://google.github.io/web-stories-wp/).

To run it locally, use the following command:

```bash
npm run storybook
```

#### Testing Environment

The latest version of the plugin is up and running on [https://stories-new-wordpress-amp.pantheonsite.io/](https://stories-new-wordpress-amp.pantheonsite.io/) and ready for maintainers to test.

## Maintenance

### Creating a plugin build

To create a build of the plugin for installing in WordPress as a ZIP package, run:

```bash
npm run build
```

### Update list of Google Fonts

The project bundles an up-to-date list of available fonts from Google Fonts that can be used in the editor. Every once in a while, this list needs to be updated.

**Note:** this is done automatically using GitHub Actions, so there is rarely ever a need to do this manually.

A [Google Fonts API key](https://developers.google.com/fonts/docs/developer_api) is required to update the list of Google Fonts that is included in the plugin. Details of how to get an API key can be found on in the [Google fonts docs](https://developers.google.com/fonts/docs/developer_api).

Once obtained, follow these steps to configure the project appropriately:

```bash
GOOGLE_FONTS_API_KEY=your-api-key npm run download-fonts
```

The fonts will then be downloaded to `includes/data/fonts.json`.


text:
**Create project**

Via Composer Create-Project

````
composer create-project --prefer-dist laravel/laravel projectName
````

**Web Server Configuration**

**Pretty URLs**

`Apache`

Laravel includes a `public/.htaccess` file that is used to provide URLs without the index.php front controller in the path. Before serving Laravel with Apache, be sure to enable the mod_rewrite module so the .htaccess file will be honored by the server.

If the `.htaccess` file that ships with Laravel does not work with your Apache installation, try this alternative:

````
Options +FollowSymLinks -Indexes
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
````

`Nginx`

If you are using Nginx, the following directive in your site configuration will direct all requests to the index.php front controller:

````
location / {
    try_files $uri $uri/ /index.php?$query_string;
}
````

**Create Thread**

````
php artisan make:model Thread -mr
````

Create model with resource and controller

Change `.env` file connection to database.

**Create DB**

Call command

````
php artisan migrate
````

**Create model Reply**

````
php artisan make:model Reply -mc
````

**Create Tests**

````
php artisan make:test ThreadsTest
````

repository: kriptograf/laravel-forum

repo_name: kriptograf/laravel-forum


text:
# next-movies

This is a Movies App built using Next.js and [The Movie Database (TMDB)](https://www.themoviedb.org/) API.

## Demo

A [live deployment](https://movies.zaps.dev) of this app is available to try it out.

## Contributing

Contributions are always welcome!

For large changes, please file an issue to discuss your proposed changes with us before working on a PR :)

## Installation

Clone and install the dependencies for `next-movies` locally:

```bash
  git clone https://github.com/tastejs/next-movies.git
  cd next-movies
  npm install
```

## Quick setup

1. Take a copy of .env.local.example and re-name to .env.local
2. Get your TMDb API key
3. Get your TMDB API read access token
4. Enter the details into the .env.local file

## Running locally

* `npm run dev`: dev build
* `npm run build`: production build
* `npm run static-build`: production static build
* `npm run start`: start the project
* `npm run vercel-deploy`: deploy to vercel
* `npm run netlify-deploy`: deploy to netlify
* `npm run analyze`: bundle analysis
* (`analyze:server` and `analyze:browser` are available too)

## Tech Stack

Built with:

* Next.js
* Redux and Redux Thunk
* react-glider
* react-lazyload
* react-modal-video
* react-scroll
* react-select-search
* redaxios
* use-dark-mode
* @artsy/fresnel
* @loadable/component

## Authors

- [@anton-karlovskiy](https://github.com/anton-karlovskiy)
- [@addyosmani](https://github.com/addyosmani)

Based on the original `create-react-app` foundation by [@fidalgodev](https://github.com/fidalgodev/movie-library-react).

## License

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

repository: rasyidrafi/next-movies

repo_name: rasyidrafi/next-movies


text:
---
layout: post
title: Miami, Florida - PRELIM INFO FROM FAA OPS MIAMI FL UAS INCIDENT 1740E OPA LOCKA ATCT ADVISED CESSNA
categories: florida miami
latitude: 25.7616798
longitude: -80.1917902
city: Miami
state: Florida
date: 2015-01-29T12:40:00.000Z
timeZoneName: Eastern Standard Time
---

PRELIM INFO FROM FAA OPS: MIAMI, FL/UAS INCIDENT/1740E/OPA-LOCKA ATCT ADVISED CESSNA C172 CONDUCTING RIGHT CLOSED TRAFFIC ON RUNWAY 9R REPORTED A UAS BETWEEN 50 - 200 FEET NEAR MID-FIELD POINT OF THE DOWNWIND. MIAMI DADE AVIATION UNIT WAS NOTIFIED AND QUESTIONED THE OPERATOR OF THE UAV.

MOR Alert for OPF

Number: OPF-M-2015/01/29-0001

Type: Public inquiry or concern (including all pilot reported NMACs)

Date/Time: Jan 29, 2015 - 2240Z

A/C: C172

Summary:  C172 conducting right closed traffic on Runway 9R, reported a UAV operating 50-200 ft AGL around the mid-field point of the downwind. The Miami Dade Police Aviation Unit, which is located on the airport, was contacted via landline and was given this information. They (Police) lifted off with their helicopter and landed at the location where the UAV was flying. The Metro Police pilot indicated he talked with the UAV flyer and wrote down his personal information. Metro Police will call the tower after he returns to base.