text:
# Faasm [![Tests](https://github.com/lsds/Faasm/workflows/Tests/badge.svg?branch=master)](https://github.com/lsds/Faasm/actions)  [![License](https://img.shields.io/github/license/lsds/Faasm.svg)](https://github.com/lsds/Faasm/blob/master/LICENSE.md)  [![Release](https://img.shields.io/github/release/lsds/Faasm.svg)](https://github.com/lsds/Faasm/releases/)  [![Contributors](https://img.shields.io/github/contributors/lsds/Faasm.svg)](https://github.com/lsds/Faasm/graphs/contributors/)

Faasm is a high-performance stateful serverless runtime. The goal of the project is enabling fast, efficient serverless big data.

Faasm provides multi-tenant isolation, but also lets functions share regions of memory. These shared memory regions give low-latency concurrent access to data, supporting high-performance distributed serverless applications.

By running WebAssembly, Faasm combines software fault isolation with standard OS tooling to provide security and resource isolation guarantees at low cost. Functions run side-by-side as threads of a single runtime process, with low overheads and fast boot times. The underlying WebAssembly execution and code generation is handled by [WAVM](https://github.com/WAVM/WAVM), an excellent server-side WebAssembly VM.

Faasm supports C/C++ natively and extends support to dynamic languages such as Python by compiling the language runtime itself to WebAssembly. The Python support is based heavily on the work of the [Pyodide](https://github.com/iodide-project/pyodide) project, with custom C-extensions and decorators in [Pyfaasm](https://github.com/Shillaker/pyfaasm).

Faasm uses a custom host interface to give functions access to state and interact with the runtime. Larger applications can be constructed by composing multiple functions together dynamically in chains. The Faasm scheduler ensures these functions execute close to their required data, reducing unnecessary duplication and overhead.

Faasm is a runtime, intended for integration into other serverless platforms. The primary integration is with [Knative](https://knative.dev/).

# Quick start

You can start a simple Faasm runtime using the `docker-compose.yml` file in the root of the project. This creates a couple of worker instances as well as an upload endpoint for receiving functions and state. There is also a Redis container used for communication between the workers.

You can start it by running:

```bash
# Single worker
docker-compose up

# Three workers
docker-compose up --scale worker=3
```

Note that the first time you run the local set-up it will generate some machine code specific to your host. This is
stored in the `machine-code` directory in the root of the project and reused on subsequent runs.

## Compiling a C++ function

C++ functions are built with CMake and held in the `func` directory. `demo/hello.cpp` is a simple hello world function.

The Faasm toolchain is packaged in the `faasm/toolchain` container and can be run with the `bin/toolchain.sh` script, i.e.:

```bash
./bin/toolchain.sh
```

This container has all the tooling ready to use. To compile and upload the `hello` function you an run:

```bash
inv compile demo hello
inv upload demo hello
```

You can invoke the function as follows:

```bash
inv invoke demo hello
```

You should then see the response `Hello faasm!`.

## Running a Python function

An example Python function is found at `func/python/hello.py`. This can be uploaded with:

```bash
inv upload --py python hello
```

And invoke with:

```bash
inv invoke --py python hello
```

This should give a message and the version of Python being run.

# Writing functions

Faasm aims to be uninvasive, allowing code to run natively _and_ in a serverless context. This is important for local development and testing as well as porting existing applications.

## C++

In C++ functions make use of the Faasm macros. These macros mean the code can be compiled with a standard toolchain and run natively, but when compiled with the Faasm toolchain, will run in a serverless context.

```c++
#include "faasm/faasm.h"

FAASM_MAIN_FUNC() {
    // Do something

    return 0;
}
```

Some example functions can be found in the `func/demo` directory.

## C++ API

Faasm allows users functions to interact with the underlying system to accomplish a number of things e.g. accessing input and output, interacting with distributed state, and invoking other functions.

Some of the methods include:

- `faasmGetInput()` - allows functions to retrieve their input data
- `faasmSetOutput()` - this allows functions to return output data to the caller
- `faasmChainFunction()` - this allows one function to invoke others
- `faasmAwaitCall()` - waits for a chained function invocation to finish
- `faasmReadState()` and `writeState()` - allows functions to read/ write key/value state
- `faasmReadStateOffset()` and `faasmWriteStateOffset()` - allows functions to read/ write at specific points in existing state (e.g. updating a subsection of an array)

## Python API

Python functions interact with the Faasm API via [pyfaasm](https://github.com/Shillaker/pyfaasm), a module with a C-extension providing the relevant bindings to the C++ API.

## Chaining

"Chaining" is when one function makes a call to another function (which must be owned by the same user). There are two supported methods of chaining, one for invoking totally separate Faasm functions, the other for automatically parallelising functions in the same piece of code (useful for porting legacy applications).

### Chaining a function

Multiple functions can be defined in the same file, invoke each other and await results. For example:

```c++
#include "faasm/faasm.h"
#include <vector>

// Define some function to be chained
FAASM_FUNC(funcOne, 1) {
    return 0;
}

// Define another function to be chained
FAASM_FUNC(funcTwo, 2) {
    return 0;
}

// Define the main function
FAASM_MAIN_FUNC() {
    // Chain calls to the other functions
    int callOneId = faasmChainThis(1);
    int callTwoId = faasmChainThis(2);

    // Await results
    faasmAwaitCall(callOneId);
    faasmAwaitCall(callTwoId);

    return 0;
}
```

In Python this looks like:

```python
from pyfaasm.code import await_call, chain_this, faasm_func, faasm_main

@faasm_func(1)
def func_one():
    pass

@faasm_func(2)
def func_two():
    pass

@faasm_main
def main_func():
    call_one = chain_this(1)
    call_two = chain_this(2)

    await_call(call_one)
    await_call(call_two)
```

Chaining can also be done across functions defined separately, e.g. in C++:

```c++
#include "faasm/faasm.h"

FAASM_MAIN_FUNC() {
    // Chain a call to my other function named "other-func"
    int callId = faasmChainFunction("other-func");
    faasmAwaitCall(callId);

    return 0;
}
```

## State

All of a users' functions have access to shared state. This state is implemented as a simple key-value store and accessed by the functions `faasmReadState` and `faasmWriteState`. Values read and written to this state must be byte arrays.

State can be dealt with in a read-only or lock-free manner (and shared in regions of shared memory with colocated functions), or via synchronous distributed locks.

A function accessing state will look something like:

```c++
#include "faasm/faasm.h"

FAASM_MAIN_FUNC() {
    const char *key = "my_state_key";

    // Read the state into a buffer
    long stateSize = 123;
    uint8_t *myState = new uint8_t[stateSize];
    faasmReadState(key, newState, stateSize);

    // Do something useful, modify state

    // Write the updated state
    faasmWriteState(key, myState, stateSize);

    return 0;
}
```

### Offset state

Faasm also exposes the `faasmReadStateOffset` and `faasmWriteStateOffset` functions, which allow reading and writing subsections of byte arrays stored against keys in the key-value store.

For example, if I have an array of 100 bytes stored in memory, I can read bytes 15-20, then update them separately.

This can be useful for implementing distributed iterative algorithms.

### Uploading state

If you need to prepopulate state for your functions you can use the state upload endpoint. This can be called with:

```bash
# Format /s/<username>/<key>
curl http://localhost:8002/s/user123/my_key -X PUT -d "your data"
```

This state can then be accessed in your functions using the specified key. For larger state, you can also upload a file:

```bash
curl http://localhost:8002/s/user123/my_key -X PUT -T /tmp/my_state_file
```

Where `/tmp/my_state_file` contains binary data you wish to be inserted at your specified key.

## Proto-functions

Proto-functions are a way to reduce the initialisation time of functions. They are a chunk of code that executes once and is then used to spawn all subsequent function invocations. The complete state of the function after proto-function execution is duplicated for all subsequent function invocations.

The proto-function should be idempotent as it may be run more than once.

Proto-function code is marked up with the `FAASM_ZYGOTE` macro:

```c++
#include "faasm/faasm.h"

int myGlobal;

FAASM_ZYGOTE() {
    // Run once
    myGlobal = 5;

    return 0;
}

FAASM_MAIN_FUNC() {
    // Context available to all subsequent function calls
    printf("My global = %i\n", myGlobal);

    return 0;
}
```

# Scheduling and Work Sharing

Faasm workers schedule tasks via a standard work-sharing approach. This means function calls are distributed randomly, and workers will hand them off to another worker if that worker is better suited to execute it. This means functions will always be run by the same worker (hence able to share local in-memory state), provided resources are available.

In auto-scaling environments such as KNative, the workers will auto-scale to meet demand.

# Integrations

Faasm's recommended integration is with [KNative](https://cloud.google.com/knative/), although it also works with AWS Lambda and IBM Cloud Functions. For more information consult the `docs` folder.


text:
---
layout: post
title: Who is using Python?
order: 4
author: kpvarma
excerpt: "Know who uses python. A collection of internet companies primarily uses Python gathered from various blogs and articles."
tags: [introduction, chapter-1]
comments: true
share: true
---

Instagr.am is built on Python (django)
Synopsi.tv  is built on Python (django)
SimpleGeo.com uses Python
Rdio.com is built on Python (django)
Disqus.com  is built on Python (django)

Internet Companies primarily uses Python for development:

* Apture
* ChoiceVendor (company)
* Digg
* Disqus
* Dropbox
* Eventbrite (startup)
* FriendFeed
* Hunch (startup)
* Humble Paper
* 6waves Lolapps
* Lanyrd
* Mixpanel
* Mochi Media
* Mozilla
* Nextdoor
* Quora
* Path (social network)
* Pinterest
* Raptr
* Reddit (website)
* Slide (company)
* SlideShare
* SurveyMonkey
* uberVU
* Venmo
* Votizen
* Yelp (product)
* YouTube
* drchrono

Python is the primary language for Mozilla websites now. Mozilla is moving 2 of its largest sites (addons.mozilla.org and support.mozilla.com) to Python from PHP.

Votizen is built almost entirely with Python.

Prezi (prezi.com) also uses Python as a primary language (website and backend services).

HubSpot uses a lot of Python.

Apache Hue (a web application for interacting with Apache Hadoop) by Cloudera is developed using Python(Django framework)

Pinterest.com is built on Python (django)

Source : [Quora - Internet Companies using Python](http://www.quora.com/Which-Internet-companies-use-Python)

## References

* [Organizations Using Python](https://wiki.python.org/moin/OrganizationsUsingPython)
* [Python Success Stories](https://www.python.org/about/success/)
* [Quora - Internet Companies using Python](http://www.quora.com/Which-Internet-companies-use-Python)

---

* [NEXT >> Install Python](../chapter-02-installation/01-install-python.md)
* [BACK >> Python Philosophy - The Zen of Python
](03-the-philosophy-of-python.md)

license: MIT

repository: VarmaLabs/dive-into-python

branch_name: refs/heads/master

extension: md

gha_language: HTML

gha_license_id: MIT

license_type: permissive

repo_name: VarmaLabs/dive-into-python


text:
0.5.0
-----
* 'in' distinguishes between absence of value (empty list returned) and nil value (nil returned)

0.4.0
-----
* Support ClojureScript.
* Upgrade to Clojure 1.7 to use reader conditionals in the tests.

0.3.1
-----
* `xth` accepts a default value if the index is out of bounds.

0.3.0
-----

* Removed `delete` on map entry lenses.
* `in` does nothing if the path does not exist (unlike `update-in`).
* Added `indexed` and `conditionally` lenses.
* `view-single` throws an error if there are no foci.

0.2.0
-----

* `view` renamed to `view-single`, and `view-all` renamed to `view`.
* Confined deletion to entries in a map, as it's dangerous for sets and seqs.

0.1.0
-----

* First version.

repository: ctford/traversy

gha_language: Clojure

gha_license_id: NOASSERTION

repo_name: ctford/traversy


text:
# Code Style for Contributors

* Use camelCase for functions and PascalCase for types.
* Do not use tabs, indent code with 4 spaces.
* If possible, a line of code should be at most 80 characters long.
* Put a space between foreach, if, while etc. and the opening parenthesis.
* Prefer to not include an empty set of parentheses in cases where there are only template parameters.

```d
auto good = foo.map!predicate;
auto bad = foo.map!predicate();
```

* Add spaces around operators.
```d
while (good && correct)
	perfect[1 .. $] = excellent[1 .. $];

while (bad&&wrong)
	poor[1..$] = inferior[1..$];
```

* Do not use braces for single-line statements.
```d
while (true)
	good();

while (true)
{
	wrong();
}
```

* Do not leave white-spaces at the end of line.
* Do not put extra newlines at the end of file.
* Use type inference, if possible.
* Prefer to use UFCS for algorithm functions.
* Do not use UFCS for `std.format.format`.
* Prefer `foreach` over plain old `for`:

```d
for (size_t bad = 0; bad < length; ++bad)
{
	...
}

foreach (good; 0 .. length)
{
	...
}
```

* Prefer using algorithms over `foreach`.
* Do not put spaces between `cast` and the opening parenthesis (`cast(Good)`).
* Do not put a newline between the documentation and the symbol it's attached to.
* For single-line ddocs use `///`.
* For multi-line ddocs use
```d
/**
 *
 */
```

repository: jacob-carlborg/dstep

gha_language: C

repo_name: jacob-carlborg/dstep


text:
# Interaction Sequences

## Start up Sequence

The sequence is as follows : launch Pong game Application-->
Pong-Game-Menu -->Select-Player-and-enter-name -->
Select-Background-and-Ball-color -->Start-Game-Round -->
Collision-Checker -->Score-count-increment -->Declare-Winner
-->Exit-game

## Movement Initiation

If penalty point reaches to three then compare score of both
players. Declare player with highest score as winner.
After winner declaration player again reaches Menu tab,
either player can start new game or Exit game.

## One score

If collision occurs then Collision-Checker module calls
Score-count-increment module to update score and penalty
points of players.

repository: Engin-Boot/pong-stage-PallaviZoting

repo_name: Engin-Boot/pong-stage-PallaviZoting


text:
# Kind Provider

The Kind provider is used to interact with [Kubernetes IN Docker
(kind)](https://github.com/kubernetes-sigs/kind) to provision local
[Kubernetes](https://kubernetes.io) clusters.

> **Note**
>
> For the `runtimeConfig` field there's special behaviour for options containing a `/` character. Since this is not allowed in HCL you can just use `_` which is internally replaced with a `/` for generating the kind config. E.g. for the option `api/alpha` you'd name the field `api_alpha` and it will set it to `api/alpha` when creating the corresponding kind config.

## Example Usage

```hcl
# Configure the Kind Provider
provider "kind" {}

# Create a cluster
resource "kind_cluster" "default" {
    name = "test-cluster"
}
```

repository: tehcyx/terraform-provider-kind

gha_language: Go

repo_name: tehcyx/terraform-provider-kind


text:
# Pulumi playground

Samples for using Pulumi with different cloud providers.

## Setup

```bash
brew install pulumi
```

### Setup a cloud provider SDK and CLI

Install Node.js and AWS CLI.

Get an AWS account.

```bash
àws configure
```

### Configure Pulumi for different AWS profiles

```bash
pulumi config set aws:profile <profilename>
```

## Create a project

```bash
mkdir quickstart && cd quickstart
pulumi new aws-typescript
```

## Deploy resources

```bash
pulumi up
```

Review resources in AWS and on the Pulumi app page:

```bash
https://app.pulumi.com/<your_account_name>/quickstart/<stackname|dev>/updates/1
```

## Destroy resources

```bash
pulumi destroy
```

The AWS resource now should be deleted.

## Pulumi documentation

- [Install Pulumis](https://www.pulumi.com/docs/get-started/install/)

repository: jforge/iac-samples

gha_language: TypeScript

repo_name: jforge/iac-samples


text:
# Module core
Core Xml wrapper that provides xmlpull parsing functionality. This module
is designed to wrap the actually present xml functionality in the platform.
As such it is currently limited to JVM, Android and JS(browser) platforms.

# Package nl.adaptivity.js.util
Package with various extension functions to make working with DOM nodes
easier.

# Package nl.adaptivity.xmlutil
Core package for a wrapper that provides XML pull parsing access. Note
that the implementations may do some adjustments beyond what is provided
by the underlying implementation to improve compatibility across platforms.
The access point to the package/module is (XmlStreaming)[nl.adaptivity.xml.XmlStreaming].

# Package nl.adaptivity.xmlutil.util
Package with various utility types that are generally allow for a more
convenient way of using the library.

repository: pdvrieze/xmlutil

gha_language: Kotlin

repo_name: pdvrieze/xmlutil


text:
---
title: "Genetic programming in space"
author: matt_gregory
comments: yes
date: '2016-11-14'
modified: 2016-11-15
layout: post
excerpt: "A supervised learning method motivated by an analogy to biological evolution"
published: true
status: processed
tags:
- Regression
- Symbolic Regression
- R
- Feature Selection
categories: Rstats
output: html_document
---

Genetic Programming (GP) is a collection of techniques from evolutionary computing (EC) for the automatic generation of computer programs that perform a user-defined task.
Starting with a high-level problem definition, GP creates a population of random programs that are progressively refined through variation and selection until a satisfactory solution is found.
A lack of foresight does not prevent this blind watchmaker from arriving at a sensible design solution for modelling the data as demonstrated in this post.

My attention was first drawn to this approach through the [MarIO video](https://twitter.com/mammykins_/status/727623873777274880), where a program evolves through selection to get better and better at playing a computer game.
A great advantage of GP is that the user need not specify (or know) much about the form of the eventual solution before starting.

I studied Zoology to doctorate level and thus spotted parallels between some of these processes and thinking tools and models for natural selection and evolution.
This is all inherently interesting, warranting a blog post.

There are several packages that provide genetic programming tools for R, we will investigate a few of these packages and look at the scenarios in which they are useful compared to more typical machine learning methods.
Basically, GP is an evolutionary search heuristic for arbitrary symbolic expressions, i.e. mathematical or logical formulas.

{% highlight r %}
library(tidyverse)
library(ggthemes)
library(rgp)

# vignette("rgp_introduction")
{% endhighlight %}

## Modelling the orbit of a celestial body

I've picked a topic I don't know too much about so that the GP approach can help me with this lack of expert domain knowledge.
This scenario is receiving alot of interest as there are a shortage of data scientists; it would be nice if feature extraction based on expert knowledge did not limit the training and accuracy of our models.
([data smashing](http://www.creativemachineslab.com/data-smashing.html) is a concept that is relevant here; or consider the [Higgs-Boson problem](https://www.kaggle.com/c/higgs-boson)).
We investigate a problem tackled by Kepler in the 17th century (note: that's why Pluto is included).
We investigate the relationship between the planets' distance from the Sun and their orbital periods ([see here](https://ww2.coastal.edu/kingw/statistics/R-tutorials/simplenonlinear.html) for an alternative take on this problem).

{% highlight r %}
planets <- read.table(header = TRUE, text = "
planet    dist   period
Mercury   57.9    87.98
Venus    108.2   224.70
Earth    149.6   365.26
Mars     228.0   686.98
Ceres    413.8  1680.50
Jupiter  778.3  4332.00
Saturn  1427.0 10761.00
Uranus  2869.0 30685.00
Neptune 4498.0 60191.00
Pluto   5900.0 90742.00
")
{% endhighlight %}

With the data defined we can now set about looking for a relationship by dedicating some computing time. Prior to analysis we must convert everything to units of earth orbits, as the Earth is a relative centre of the universe.
Thus, the units of distance will become astronomical units (AUs), and the units of period will become Earth years.

{% highlight r %}
planets <- dplyr::mutate(
  planets, dist_au = dist / 149.6,
  years = period / 365.26
) %>%
  tibble::as_tibble()
{% endhighlight %}

As the planets move further from the Sun their orbit period seems to increase exponentially.
However, I'm not really sure if they are circular or elliptical or in-between, so wouldn't like to guess.
We can look at the data to confirm this suspicion.

{% highlight r %}
dplyr::glimpse(planets)
{% endhighlight %}

{% highlight text %}
## Observations: 10
## Variables: 5
## $ planet  <fctr> Mercury, Venus, Earth, Mars, Ceres, Jupiter, Saturn, ...
## $ dist    <dbl> 57.9, 108.2, 149.6, 228.0, 413.8, 778.3, 1427.0, 2869....
## $ period  <dbl> 87.98, 224.70, 365.26, 686.98, 1680.50, 4332.00, 10761...
## $ dist_au <dbl> 0.3870321, 0.7232620, 1.0000000, 1.5240642, 2.7660428,...
## $ years   <dbl> 0.2408695, 0.6151782, 1.0000000, 1.8807972, 4.6008323,...
{% endhighlight %}

Or plot it.

{% highlight r %}
#devtools::install_github("UKGov-Data-Science/govstyle")
library(govstyle)

ggplot(planets, aes(years, dist_au)) +
  geom_point(color = "grey") +
  geom_text(aes(label = planet, color = "yellow")) +
  xlab("Orbital period (years)") +
  ylab("Distance from the Sun (AU)") +
  theme_gov()
{% endhighlight %}

![plot of chunk 2016-11-14_fancy_scatter](/figures/2016-11-14_fancy_scatter-1.svg)

## Regression Run

This tutorial shows how to use the `symbolicRegression` function to solve symbolic modelling and regression tasks with minimal configuration work.
The theme of this tutorial is the discovery of a mathematical formula describing the behaviour of a physical system based on measurement
data, i.e. symbolic regression.

### Symbolic regression

[Symbolic regression](https://en.wikipedia.org/wiki/Symbolic_regression) is a type of regression analysis that searches the space of mathematical expressions to find the model that best fits a given dataset, both in terms of accuracy and simplicity.
No particular model is provided as a starting point to the algorithm. Instead, initial expressions are formed by randomly combining mathematical building blocks such as mathematical operators, analytic functions, constants, and state variables.
New equations are then formed by recombining previous equations, using genetic programming.

We are ready to start a symbolic regression run. We choose a time budget of one minute:

{% highlight r %}
set.seed(255)

model_set1 <- rgp::symbolicRegression(
  dist_au ~ years,
  data = planets,
  stopCondition = makeTimeStopCondition(1 * 60)
)
{% endhighlight %}

## Result Analysis

Selection and plotting of the model with best fitness can be performed as follows:

{% highlight r %}
best_model1 <- model_set1$population[[which.min(model_set1$fitnessValues)]]

hyp_orbit_years <- 1:250

plot(
  x = hyp_orbit_years,
  y = best_model1(hyp_orbit_years),  #  we predict distance on 250 hypothetical planets
  type = "l", lty = 1,
  xlab = "Orbital period (years)",
  ylab = "Distance from the Sun (AU)",
  ylim = c(0, 40), xlim = c(0, 250)
)

points(x = planets$years, y = planets$dist_au, col = "red")
{% endhighlight %}

![plot of chunk 2016-11-14_m1_scatter](/figures/2016-11-14_m1_scatter-1.svg)

Hmm, not too bad, let's give it a bit more time!
Most of the data we're training on is near the lower end of the scale thus we might expect our best fit line to wiggle towards those points given more time perhaps at the expense of the accuracy of distance from the Sun prediction at the regions of space with lower celestial object density (the Gas Giants hoover everything up?).

{% highlight r %}
model_set2 <- rgp::symbolicRegression(
  dist_au ~ years,
  data = planets,
  stopCondition = makeTimeStopCondition(3 * 60)
)

best_model2 <- model_set2$population[[which.min(model_set2$fitnessValues)]]

plot(
  x = hyp_orbit_years,
  y = best_model2(hyp_orbit_years),
  xlab = "Orbital period (years)",
  ylab = "Distance from the Sun (AU)",
  type = "l", lty = 1,
  ylim = c(0, 40), xlim = c(0, 250)
)

points(x = planets$years, y = planets$dist_au, col = "red")
{% endhighlight %}

![plot of chunk 2016-11-14_m2_scatter](/figures/2016-11-14_m2_scatter-1.svg)

When sat twiddling your thumbs waiting for this to compute, consider Kepler who said, regarding the lengthy arguments within his epic tome sparking the Enlightenment:

> If thou art bored with this wearisome method of calculation, take pity on me, who had to go through with at least seventy repetitions of it, at a very great loss of time.

Not much better? Is it the lack of data or do we need to tune our parameters?

## Sequential Parameter Optimization for Genetic Programming

Finding good algorithm parameter settings for Genetic Programming applications is a complex task.
Sequential parameter optimization (SPO) provides a framework for applying modern statistical methods to solve this task.
Fortunately a package exists to help us!
We provide the same starting conditions for our original experiment to allow comparison.

{% highlight r %}
library(SPOT)

set.seed(255)
result1 <- symbolicRegression(
  dist_au ~ years,
  data = planets,
  stopCondition = makeTimeStopCondition(1 * 60)
)

bestFitness <- min(sapply(result1$population, result1$fitnessFunction))
fit_fun <- result1$population[[which.min(result1$fitnessValues)]]

plot(
  x = hyp_orbit_years,
  y = fit_fun(hyp_orbit_years),
  type = "l", lty = 1,
  xlab = "Orbital period (years)",
  ylab = "Distance from the Sun (AU)",
  ylim = c(0, 40), xlim = c(0, 250)
)

points(x = planets$years, y = planets$dist_au, col = "red")
{% endhighlight %}

![plot of chunk 2016-11-14_m3_scatter](/figures/2016-11-14_m3_scatter-1.svg)

We don't even have to specify anything, we just load the package and it does it for us.
I ran all this code for comparison several times by adjusting the `set.seed` at the start of this post.
You'll notice that by adjusting this your get different solutions or best fitted models.
This can be considered analagous to a phenomenon in Evolutionary Biology.

The great evolutionist Stephen Jay Gould often employed the metaphor "replaying life's tape" to emphasize the preeminent role of contingency in the evolutionary process.
In Gould's view, the outcome of this [Gedanken experiment](https://en.wikipedia.org/wiki/Thought_experiment) would have been dramatically different from the actually observed course of events because evolution is essentially a stochastic phenomenon whereby trajectories that start infinitely close to each other soon diverge because the divergence is exponential.
The actual evolutionary trajectory is fundamentally unpredictable because the selection of the fittest could occur along a great number of forking paths.
Here a different seed provides a different starting point.

But does it provide anymore information?
Do we get an understanding of the relationship that Kepler was after?

In this simple example we see that we have produced identical solutions given the same starting position even with the `SPOT` package loaded which automatically tunes our parameters for us. Perhaps with a different example we would have seen greater impact.

{% highlight r %}
best_model1
{% endhighlight %}

{% highlight text %}
## function (years)
## sqrt(years)
## <environment: 0x1384bee8>
{% endhighlight %}

{% highlight r %}
# using SPOT
fit_fun
{% endhighlight %}

{% highlight text %}
## function (years)
## sqrt(years)
## <environment: 0x1384bee8>
{% endhighlight %}

We have a function that takes five times the square root of the input.
So the distance from the Sun is sort-of proportional to five times the square root of the orbit in years of the celestial body of interest.
We can compare this to the modern solution and other historical approximations of the truth [here](https://en.wikipedia.org/wiki/Kepler%27s_laws_of_planetary_motion).
This demonstrates how GP could be useful for feature selection despite it being quite slow, as it can help non experts in determining sensible relationships or transformations (other options exist e.g. Box-Cox transformation).
This functionality is provided in the `caret` package. `caret::gafs` conducts a supervised binary search of the predictor space using a genetic algorithm.

Altogether a good reminder that:

> nanos gigantum humeris insidentes

## The "third law"

Kepler discovered his "third law" a decade after the publication of the [Astronomia nova](https://en.wikipedia.org/wiki/Astronomia_nova) as a result of his investigations in the 1619 [Harmonices Mundi](https://en.wikipedia.org/wiki/Harmonices_Mundi).
He found that the ratio of the cube of the length of the semi-major axis of each planet's orbit, to the square of time of its orbital period, is the same for all planets.

{% highlight r %}
planets <- planets %>%
  mutate(
    third_law = (dist_au^3) / (years^2)
  )

round(planets$third_law, digits = 3)
{% endhighlight %}

{% highlight text %}
##  [1] 0.999 1.000 1.000 1.001 1.000 1.001 1.000 0.999 1.001 0.994
{% endhighlight %}

We rearrange the formula and create a function using Kepler's knowledge.

{% highlight r %}
kepler <- function(years) {
  (years)^(2/3)
}

plot(
  x = hyp_orbit_years,
  y = kepler(hyp_orbit_years),
  type = "l", lty = 1,
  xlab = "Orbital period (years)",
  ylab = "Distance from the Sun (AU)",
  ylim = c(0, 40), xlim = c(0, 250)
)

points(x = planets$years, y = planets$dist_au, col = "red")
{% endhighlight %}

![plot of chunk 2016-11-14_kepler_scatter](/figures/2016-11-14_kepler_scatter-1.svg)

This is an improvement, demonstrating the value of expert domain knowledge provided by careful observation and experimentation to inform model building.
Kepler built upon Copernicus' heliocentric theory by explaining how the planets' speeds varied using elliptical orbits.
A consequence of this was the third law.

> The square of the orbital period of a planet is directly proportional to the cube of the semi-major axis of its orbit. This captures the relationship between the distance of planets from the Sun, and their orbital periods.

{% highlight r %}
sessionInfo()
{% endhighlight %}

{% highlight text %}
## R version 3.3.2 (2016-10-31)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 16.04.1 LTS
##
## locale:
##  [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C
##  [3] LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8
##  [5] LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8
##  [7] LC_PAPER=en_GB.UTF-8       LC_NAME=C
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
##
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base
##
## other attached packages:
##  [1] SPOT_1.1.0      govstyle_0.1.0  rgp_0.4-1       ggthemes_3.2.0
##  [5] readr_1.0.0     tidyverse_1.0.0 tidyr_0.6.0     ggplot2_2.1.0
##  [9] dplyr_0.5.0     magrittr_1.5    tibble_1.2      purrr_0.2.2
## [13] rmd2md_0.1.2
##
## loaded via a namespace (and not attached):
##  [1] Rcpp_0.12.7         emoa_0.5-0          formatR_1.4
##  [4] git2r_0.15.0        plyr_1.8.4          class_7.3-14
##  [7] tools_3.3.2         rpart_4.1-10        digest_0.6.10
## [10] evaluate_0.9        memoise_1.0.0       gtable_0.2.0
## [13] DBI_0.5-1           curl_2.2            withr_1.0.2
## [16] stringr_1.1.0       httr_1.2.1          knitr_1.14
## [19] devtools_1.12.0     grid_3.3.2          R6_2.2.0
## [22] rsm_2.7-4           mco_1.0-15.1        scales_0.4.0
## [25] codetools_0.2-15    MASS_7.3-45         randomForest_4.6-12
## [28] assertthat_0.1      checkpoint_0.3.16   colorspace_1.2-7
## [31] labeling_0.3        stringi_1.1.2       lazyeval_0.2.0
## [34] munsell_0.4.3       AlgDesign_1.1-7.3
{% endhighlight %}

gha_language: JavaScript


text:
## Backend setup

In order to run the tests correctly, an instance of the server must be reachable. You can use an existing instance or create a new one via docker (recommended).

### 1. oC10

Script `populate_oC10_server.sh` will create some users that are defined in the feature files (`Alice`, `Bob`, `Charles`) as well as a group called `test`.

Script requires three parameters

- `host`: hostname or IP where the server runs.
- `port`: port where server is listening.
- `version`: ownCloud version to create the container. Use [one of the available tags](https://hub.docker.com/r/owncloud/server/tags).

For example:

```
./populate_oC10_server.sh <IP_ADDRESS> 8500 10.12.1
```

```
./populate_oC10_server.sh myserver.com 12000 latest
```

### 2. oCIS

Edit the file `docker-compose.yml`:

- `image`: oCIS version to create container. Use [one of the available tags](https://hub.docker.com/r/owncloud/ocis/tags).
- `OCIS_URL`: set the URL where the server will listen.

Variable `PROXY_ENABLE_BASIC_AUTH` must be `true`. Otherwise, authentication will not be posible through test execution, and all tests will fail.

Port `9200` must not be already allocated.

The following docker command will create a container with the oCIS instance. It must be executed in the current folder:

```
docker-compose -f docker-compose.yml up
```

Script `populate_oCIS_server.sh` will create some users that are defined in the feature files (`Alice`, `Bob`, `Charles`) as well as a group called `test`.

Server URL is a mandatory parameter for the script:

For example:

```
./populate_oCIS_server.sh https://<IP_ADDRESS>:9200
```

```
./populate_oCIS_server.sh https://myserver.com:9200
```

That script is not completed yet, and some actions require manual intervention in admin dashboard to complete the correct setup to execute the test:

- Set user `Alice` as admin
- Add user `Bob` to `test` group

repository: owncloud/android-scenario-testing

gha_language: Java

repo_name: owncloud/android-scenario-testing


text:
---
title: another toc solution for blogdown fixing the pure Chinese issue
author: Heaven Zone
date: '2018-01-11'
slug: another-toc-solution-for-blogdown-fixing-the-pure-Chinese-issue
categories:
  - R
tags:
  - R
  - blogdown
simpletoc: true
---

## origination

after taking a little bit of effort to read these two articles in ENGLISH from yihui's blog: [1st](https://yihui.name/en/2017/12/blogdown-book/), [2nd](https://yihui.name/en/2017/09/pull-requests-as-a-teaching-tool/), I decided to make a pull request to give some feedbacks to Yihui.

As a amateur and beginneR, thanks for Yihui's GREAT present BLOGDOWN.

@yihui, I love reading your articles, especially the Chinese articles, like: [16 小时骑行——我的天津绝望之旅](https://yihui.name/cn/2005/08/ride-to-tianjin-in-16-hours/). Yihui's words are always sharp. I feel some sad that it has been a very very long time since you last updated your blog for Chinese articles as a literary youth.

## feture

1. Originally intended for fixing the issue that not generating the links for pure Chinese headlines
1. Toc with fixed position floating right
1. Automatically generate the sections numbers

## usage

just add `simpletoc: true` into the block `---`.

### like this:

```
title: another toc solution for blogdown fixing the pure Chinese issue
author: Heaven Zone
date: '2018-01-11'
slug: another-toc-solution-for-blogdown-fixing-the-pure-Chinese-issue
categories:
  - R
tags:
  - R
  - blogdown
simpletoc: true
```

### what i did for this pull requrest?

1. add one partial file `simpletoc.html`
1. add one js file `simpletoc.js`
1. modified single.html appending three rows of codes
1. add one post for example using custom param `simpletoc: true` for generating the toc

#### H4 Test Section

Test

## H2 Test Section

repository: heavenzone/hugo-xmin

repo_name: heavenzone/hugo-xmin


text:
## Training Script

At the client side, the client ID (a.k.a rank) starts from 1.
Please also modify config/fedml_config.yaml, changing the `worker_num` the as the number of clients you plan to run.

If you want to use your customized MQTT or theta edge store server as training backends, you should uncomment and set the following lines.
#customized_training_mqtt_config: {'BROKER_HOST': 'your mqtt server address or domain name', 'MQTT_PWD': 'your mqtt password', 'BROKER_PORT': 1883, 'MQTT_KEEPALIVE': 180, 'MQTT_USER': 'your mqtt user'}
#customized_training_thetastore_config: {'store_home_dir': '~/edge-store-playground', 'upload_uri': 'http://localhost:19888/rpc', 'download_uri': 'http://localhost:19888/rpc'}

Use Theta EdgeStore as federated learning distributed storage for reading and writing models.
You should setup theta edgestore based on https://docs.thetatoken.org/docs/theta-edge-store-setup and set config parameters:
store_home_dir, upload_uri, download_uri.
If you want to use secret key to encrypt models, you should set secret key by calling Context().add("ipfs_secret_key", "your secret key")

At the server side, run the following script:
```
bash run_server.sh your_run_id
```

For client 1, run the following script:
```
bash run_client.sh 1 your_run_id
```
For client 2, run the following script:
```
bash run_client.sh 2 your_run_id
```
Note: please run the server first.

## A Better User-experience with FedML MLOps (open.fedml.ai)
To reduce the difficulty and complexity of these CLI commands. We recommend you to use our MLOps (open.fedml.ai).
FedML MLOps provides:
- Install Client Agent and Login
- Inviting Collaborators and group management
- Project Management
- Experiment Tracking (visualizing training results)
- monitoring device status
- visualizing system performance (including profiling flow chart)
- distributed logging
- model serving

repository: FedML-AI/FedML

gha_language: Python

repo_name: FedML-AI/FedML


text:
---
title: "Using Netlify Functions with Gatsby Cloud"
date: 2020-03-25
author: "Josh Comeau"
excerpt: "An article detailing how to use Netlify Functions and Gatsby Cloud together, to tremendous effect!"
tags: ["netlify", "serverless", "lambda", "gatsby cloud"]
canonicalLink: https://joshwcomeau.com/gatsby/netlify-functions-and-gatsby-cloud/
---

import netlifyFunctions from "./gatsby-cloud.png"

Every now and then, Gatsby developers find themselves needing a sprinkle of back-end code. We don't necessarily need a whole server, and we certainly don't want to have to deal with things like load balancing and scaling. We just need some code to run not-in-the-browser.

Case in point: when I was rebuilding my [personal blog](https://joshwcomeau.com/), I wanted to track and display the number of likes each article gets, as well as the number of hits (for a retro-style hit counter).

For these kinds of situations, _serverless functions_ are perfect. They let us write small bits of Node.js code without worrying about where that code will run.

My personal blog is built and deployed with [Gatsby Cloud](https://www.gatsbyjs.com/cloud), a CI service for Gatsby sites, and it's hosted by [Netlify](https://www.netlify.com/). I'm a very happy Netlify customer, and [Netlify Functions](https://www.netlify.com/products/functions/) seemed like the perfect service for my needs!

Getting Gatsby Cloud and Netlify Functions to cooperate took a bit of tinkering, but happily it can be done! The solution I discovered feels robust and reliable, and my blog has been powered by these two services for several weeks now, without any issues.

Today we'll look at how to use Netlify Functions for your Gatsby Cloud site.

## What are Netlify Functions?

 It's a service that sits in front of AWS Lambda, and brushes away some of the thorns of working directly with Amazon Web Services.

It allows you to write code like this, used by my blog to track hits:

```js
const faunadb = require("faunadb")

exports.handler = async (event, context, callback) => {
  // Connect to the database
  const q = faunadb.query
  const client = new faunadb.Client({
    secret: process.env.FAUNADB_SECRET,
  })

  // Get the provided slug, and use it to look up
  // the corresponding document.
  const { slug } = JSON.parse(event.body)
  const document = await client.query(
    q.Get(q.Match(q.Index("hits_by_slug"), slug))
  )

  // Increment the number of hits by 1
  await client.query(
    q.Update(document.ref, {
      data: { hits: document.data.hits + 1 },
    })
  )

  return {
    statusCode: 200,
    body: JSON.stringify({
      success: true,
    }),
  }
}
```

When using Netlify for CI _and_ deployments, you can pop this code in a `/functions` directory and the functions will get built and shipped whenever you push to GitHub. No manual steps needed 💯.

Learn more about Netlify Functions in [their documentation](https://docs.netlify.com/functions/overview/).

## What is Gatsby Cloud?

Gatsby Cloud is a service provided by Gatsby Inc. to manage deployments of Gatsby apps.

Critically, Gatsby Cloud is _not_ an alternative to Netlify—we still use CDN providers like Netlify or Amazon S3 to host your projects. Rather, Gatsby Cloud is a CI service that builds your site and distributes it for you.

<img
  src={netlifyFunctions}
  alt="Screenshot of Gatsby Cloud, showing a successful recent deploy."
/>

There are lots of reasons to use Gatsby Cloud, but perhaps the most compelling reason for most developers is speed. We're building specialized infrastructure which allows us to build large Gatsby sites in record time.

## With our powers combined…

The trouble is that when using Gatsby Cloud, we aren't doing any building on Netlify; we build the site ahead of time, and upload the files to Netlify. This deprives Netlify of the opportunity to package and ship our functions!

Happily, we can work around this. We'll dive into how this all works, but for eager beavers, here's the code we need to add to `gatsby-node.js`.

```js
const path = require("path")
const fs = require("fs")

const { zipFunctions } = require("@netlify/zip-it-and-ship-it")

exports.onPostBuild = () => {
  const srcLocation = path.join(__dirname, `./functions`)
  const outputLocation = path.join(__dirname, `./public/functions`)

  if (!fs.existsSync(outputLocation)) {
    fs.mkdirSync(outputLocation)
  }

  return zipFunctions(srcLocation, outputLocation)
}
```

### Gatsby build hooks

In my opinion, one of the coolest things about Gatsby.js is that you can "hook in" to any of its build steps, like a lifecycle method.

`onPostBuild` runs right after the build completes. We can use it to prepare and copy the functions over to the right place, before it's handed off to Netlify.

Learn more about Gatsby build hooks in [our documentation](/docs/node-apis/).

### Zip It and Ship It

Remember when I mentioned that Netlify brushes away the thorns of working with AWS Lambda? One of those thorns is the quirk that every function needs to be its own packaged project.

Let's say we have two functions, `track-hit.js` and `like-content.js`. And let's assume that they both use `faunadb`, a Node module. We need to produce two `.zip` files, with the following contents:

```text
.
└── functions
    ├── track-hit.zip
    │   ├── track-hit.js
    │   └── node_modules
    │       ├── faunadb
    │       │   ├── index.js
    │       │   └── (all the other stuff in this module)
    │       ├── some-faunadb-dependency
    │       └── some-other-faunadb-dependency
    └── like-content.zip
        ├── like-content.js
        └── node_modules
            ├── faunadb
            │   ├── index.js
            │   └── (all the other stuff in this module)
            ├── some-faunadb-dependency
            └── some-other-faunadb-dependency
```

Because the folks at Netlify are wonderful wizards, they extracted the module that prepares functions and published it on npm as `@netlify/zip-it-and-ship-it`. This means we can leverage this critical part of Netlify's build process even though we aren't building on Netlify.

### Cold and warm builds

When we ship our built project over to Netlify, it's going to look for functions in a very specific place: `/public/functions`. We need to have our built, prepared functions hanging out in that directory. Before we can build and prep the functions with `zip-it-and-ship-it`, we need to create the directory first!

This bit of code checks to see if the directory exists, and creates it if necessary:

```js
if (!fs.existsSync(outputLocation)) {
  fs.mkdirSync(outputLocation)
}
```

Why might the directory already exist? Gatsby Cloud maintains a cache, to speed up subsequent builds. A "cold build" will start from scratch, while a "warm build" will reuse what it can. We need to ensure our build succeeds regardless of whether or not the directory has been cached.

> Node purists are probably aghast in horror at the fact that I'm using `existsSync` and `mkdirSync` instead of their default async versions. Because this is a build step, and not an active server, I couldn't see any compelling issue with doing it this way, and it makes the code a little simpler!

## In conclusion

With a little bit of Node.js configuration, we're able to do some post-processing after the build, packaging up our functions and moving them to the spot Netlify expects to find them. When we push code to GitHub, Gatsby Cloud will run a new build, and then upload the resulting files to Netlify.

If you already have a Gatsby Cloud site, and you're considering using serverless functions, I can say unequivocally that Netlify makes the experience seamless and painless, and their generous pricing model means that you can experiment with them for free.

If you already use Netlify Functions and are considering moving your Gatsby site to Gatsby Cloud, we hope you'll give us a shot! One of our main focuses on the Gatsby Cloud team is to reduce the build time for complex / large sites. If you've been watching build times climb, we're doing our best to speed things up. ⚡


text:
---
layout: page
title: VinAudit.com for Windows
permalink: /vinaudit/
---

Buying a used car? Get peace of mind with the VinAudit.com VIN scanner for Windows! Scan your VIN for an instant VIN check, and purchase a full NMVTIS vehicle history report from [www.vinaudit.com](www.vinaudit.com/).

VinAudit.com for Windows can be found on the [Windows Store](https://www.microsoft.com/store/apps/9WZDNCRFJW84).

# Support
For questions and problems, email [support@13thsymphony.com](mailto:support@13thsymphony.com).

# Privacy Policy
VinAudit.com for Windows does not collect, store or transmit any personal information except that which is necessary to provide information about the provided VIN (Vehicle Identification Number) from the [VinAudit website](www.vinaudit.com).

gha_language: Ruby


text:
### [CVE-2022-38178](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-38178)
![](https://img.shields.io/static/v1?label=Product&message=BIND9&color=blue)
![](https://img.shields.io/static/v1?label=Version&message=Open%20Source%20Branch%<IP_ADDRESS>%20through%20versions%20up%20to%20and%20including%209.9.13%20&color=brighgreen)
![](https://img.shields.io/static/v1?label=Vulnerability&message=In%20BIND%209.9.12%20-%3E%209.9.13%2C%209.10.7%20-%3E%209.10.8%2C%209.11.3%20-%3E%209.16.32%2C%209.18.0%20-%3E%209.18.6%2C%20versions%209.11.4-S1%20-%3E%209.11.37-S1%2C%209.16.8-S1%20-%3E%209.16.32-S1%20of%20the%20BIND%20Supported%20Preview%20Edition%2C%20and%20versions%209.19.0%20-%3E%209.19.4%20of%20the%20BIND%209.19%20development%20branch%2C%20the%20DNSSEC%20verification%20code%20for%20the%20EdDSA%20algorithm%20leaks%20memory%20when%20there%20is%20a%20signature%20length%20mismatch.&color=brighgreen)

### Description

By spoofing the target resolver with responses that have a malformed EdDSA signature, an attacker can trigger a small memory leak. It is possible to gradually erode available memory to the point where named crashes for lack of resources.

### POC

#### Reference
No PoCs from references.

#### Github
- https://github.com/ARPSyndicate/cvemon

repository: trickest/cve

branch_name: refs/heads/main

repo_name: trickest/cve


text:
# Docker Minimal Debian PHP
Minimal setup on Debian with Nginx, PHP7, Composer and some other dependencies

Docker Hub : https://hub.docker.com/r/n4zim/minimal-debian-php/

:warning: If you want to use this repo, you need to finish the setup :

1. Copy your own nginx config file : ```ADD site.conf /etc/nginx/conf.d/```
2. You can also set a PHP.ini : ```ADD php.ini /etc/php/7.0/fpm/php.ini```
3. Copy your app code ```COPY . /var/www/```
4. Run Composer : ```RUN cd /var/www && composer install --no-interaction```
5. ... and anything needed by your app...

After that, launch everything or use supervisor which is included

repository: masked-petunia/docker-images

gha_language: PHP

repo_name: masked-petunia/docker-images


text:
# **Tango? Sorry, I don't dance**
So if you thought DevFest Florida was holding a dance competition you're out of luck. Although maybe next year? No we're talking about
Tango, which was formerly Project Tango. Tango is a computer vision platform that lets certain Android phones and tablets understand their
position relative to its surroundings without using GPS. This allows you to build some advanced augmented reality apps. You may have seen
some of the apps at your local I/O Extended event. Like the dinosaurs on stage OR the Wayfair unboxing of furniture in your house to check
out what that piece would look like in your own home. Check out a brief demo below of just one of the things you can do with Tango.

# **What's this about a Tango Hackathon?**

DevFest Florida 2016 is running a Tango Hackathon. Attendees of DevFest Florida are invited to compete! We'll post the rules and prizes
for the hackathon soon. We're going to have some Tango devices on hand for participants to test their apps out on. With the success of
Pokemon Go, one of the most popular augmented reality apps on the market today, you should definitely be checking out Tango. Come out and
learn how to incorporate its features into your existing apps or build the next big disruptive app!

As DevFest Florida is a single day event we are encouraging folks to get familiar with the APIs and even start building your apps or
getting the artwork and design done before the event. In fact if you want to show up with a finished app that's ready but not yet in the
Play Store that's fine too. At the end of the day you'll get the chance to showcase your app to the audience. Even if you don't win, you'll
reach a bunch of possible customers! We'll write up a blog post and share your app on our social media channels... FREE PUBLICITY!!!

+ Participants will have to sign up. There will be a form coming out with the official rules.
+ You can pair up into teams of no more than four.
+ Your app can be written with any of the Tango APIs that you choose (e.g. Java, Unity, etc.)
+ Apps will be judged on their creativity and their ability to be uploaded to the Google Play store.

# **I'm interested, now what?**
Head over to our home page and sign up for the newsletter or follow us on Facebook and Twitter to get updates on the Tango Hackathon at
DevFest Florida 2016. That way you'll be the first to know how to sign up and take home the prize.

# **More cool Tango info**
Check out Johnny Lee's update on Tango from Google I/O 2016:

repository: DevFestFlorida/DevFestFloridaSite

extension: markdown

repo_name: DevFestFlorida/DevFestFloridaSite


text:
---
name: "✨ Feature request"
about: "Suggest a feature or improvement"
labels: enhancement

---

### Description

A clear description of the feature/improvement is and what **motivates** it.

### Implementation

A clear description of how you would like the feature to be implemented. If possible, provide reference examples (e.g. repository, issue, paper, ...).

### Alternatives

A clear description of any alternative solutions you've considered.

repository: francois-rozet/piqa

repo_name: francois-rozet/piqa


text:
---
layout: lesson
title: "1.4 - Energy of motion"
---

Students will construct a roller coaster and measure & compare the KE and PE at four different points, the beginning, the lowest point, some middle point, and the end.

Standards: [3.2](/edu-standards/3.2), [3.3](/edu-standards/3.3)

Vocabulary: energy (E), kinetic energy (KE), potential energy (PE)

Equations:

  * KE = $$\frac{1}{2} mv^2$$, (one half) x (mass) x (velocity squared)
  * PE = $$mgh$$, (mass) x (gravity) x (height)

## Assessment

## Outline

### Activity 1
Students will play 3 different games to learn the differences between the three different words.
  * Snake to illustrate constant speed
  *

#### Resources

### Activity 2
#### Teacher

#### Student

#### Resources

[Previous](./1.3-momentum)


text:
# Reanime

A light&flexible lib to create games in JS

## Getting Started
### In the browser
Download the [production version][min] or the [development version][max].

[min]: https://raw.github.com/Reanime/Reanime/master/dist/Reanime.min.js
[max]: https://raw.github.com/Reanime/Reanime/master/dist/Reanime.js

In your web page:

```html
<script src="dist/Reanime.min.js"></script>
<script>
    new Reanime( );
</script>
```

## Documentation
_(Coming soon)_

## Examples
_(Coming soon)_

## Contributing
_(Coming soon)_

## Release History
_(Nothing yet)_

## License
Copyright (c) 2014 Anmo
Licensed under the MIT license.

repository: Reanime/Reanime

repo_name: Reanime/Reanime


text:
# ParticleScattering.jl

A Julia package for solving large-scale electromagnetic
scattering problems in two dimensions; specifically,
those containing a large number of penetrable smooth
particles. Provides the ability to optimize over particle parameters for various design problems.

## Installation

ParticleScattering for julia 0.7 can be installed using `Pkg.add`:

```julia
Pkg.add("ParticleScattering")
using ParticleScattering
```

For julia 0.6, an older version of ParticleScattering can be installed manually
by cloning [release v0.0.4 from GitHub](https://github.com/bblankrot/ParticleScattering.jl/releases/tag/v0.0.4).

## Getting Started

Users are encouraged to follow the tutorials, as they provide a gradual
introduction to this package yet cover most of its functionality.
Complex and complete examples involving optimization are available in the
 [examples](https://github.com/bblankrot/ParticleScattering.jl/tree/master/examples)
folder.

gha_language: Julia


text:
# VBS_Utilities

![Banner](./banner.svg)

> A list of small, stand-alone and straight-forward, VBS utilities

I've written some of these scripts, modified some others or just get a copy of an existing script (original author always mentioned and linked).

## Table of Contents

* [Database](#database)
	* [Test connection](#test-connection)
* [Files](#files)
	* [Find](#find)
* [Folders](#folders)
	* [Get folder size](#get-folder-size)
	* [Get list of files](#get-list-of-files)
	* [Select folder](#select-folder)
* [GitHub](#github)
	* [Auto_update](#autoupdate)
* [Outlook](#outlook)
	* [Get mail's subject](#get-mails-subject)
	* [Retrieve old messages](#retrieve-old-messages)
	* [Send email](#send-email)
* [Author](#author)
* [Licence](#licence)

## Scripts

### Database

#### Test connection

> Try to establish a connection to a SQL database

This script will allow you to quickly check if access to your SQL Server database is possible.

The objective is to establish a connection and check if it works before starting, e. g., to investigate your program code or the permissions required for the user to use your tables, views, stored procedures,...

This script will only do this, i.e. try to connect to the database, which will eliminate the possibility of a login problem.

[go to database/test_connection](https://github.com/cavo789/vbs_utilities/tree/master/src/database/test_connection)

### Files

#### Find

Take advantage of Windows Desktop Search and very fast, get the list
of MS Access applications present on the computer (local drives so
also return files present, f.i. on a D: drive if you run the script
from the C: drive; don't scan network drives).

Just adjust the searched extension for searching for any other type
of files like .docx, .png, .xlsx, ...

This script is really, really fast but only works for local drives.

[go to files/find](https://github.com/cavo789/vbs_utilities/tree/master/src/files/find)

### Folders

#### Get folder size

Scan a folder recursively and display the size of each folders (first level)

[go to folders/get_folder_size](https://github.com/cavo789/vbs_utilities/tree/master/src/folders/get_folder_size)

#### Get list of files

Get the list of files of the current folder + subfolders and generate a .csv file with files informations like path, size, extensions, author, ... making then easy to work with that list in Excel

[go to folders/get_list_of_files](https://github.com/cavo789/vbs_utilities/tree/master/src/folders/get_list_of_files)

#### Select folder

Display a select folder dialog box and then return then selected foldername

[go to folders/select_folder](https://github.com/cavo789/vbs_utilities/tree/master/src/folders/select_folder)

### GitHub

#### Auto_update

Sample script to demonstrate how it's possible to add an auto-update feature in a VBS script.

The script will check for newer version on GitHub and if there is one, the script will overwrite himself with that newer version.

[go to github/auto_update](https://github.com/cavo789/vbs_utilities/tree/master/src/github/auto_update)

### Outlook

#### Get mail's subject

Simple pattern VBS script for retrieving the list of MS Outlook
objects like emails, contacts, ...

The current demo script will just echoed the email's subject in a DOS prompt

Adjust the constant for GetDefaultFolder to retrieve emails,
contacts, ...

[go to mails/get_subject](https://github.com/cavo789/vbs_utilities/tree/master/src/mails/get_subject)

#### Retrieve old messages

Retrieve messages over 14 days old from Outlook's `Sent Items` folder

[go to mails/retrieve_old](https://github.com/cavo789/vbs_utilities/tree/master/src/mails/retrieve_old)

#### Send email

Simple pattern VBS script for demonstrating how to retrieve the default's mail signature, create a new email, add a file to it and send (or display) the mail

[go to mails/send_mail](https://github.com/cavo789/vbs_utilities/tree/master/src/mails/send_mail)

## Author

See copyrights when mentionned or comments at the top of the script.
If no one are mentionned, the author is Christophe Avonture.

## Licence

[MIT](LICENSE)


text:
---
title: Controlling Nform
path: guide/advanced-modeling/controlling-nform
parent: guide/advanced-modeling
ordinal: 0
---
# Controlling NForm

To create a **nForm** component we need an instance of a model which we bind to the [model] attribute.

```html
<pbl-nform [model]="model"></pbl-nform >
```

The **nForm** component will use the model to create a `FormGroup` instance and render that instance.

The model and the form group represent the same entity, the user can edit the form and once done we commit the changes done in the form onto the model.
The model and the form group are linked, an operation on one requires the other and there are tasks that apply on both.

We need a container we can put them both in and let the container manage them internally and expose an interface for us, a controller.

This is what the `NForm` class does, it is created by the **nForm** component and exposed through the property `nForm`.

## NForm

We've [already covered](../../basics/model-form-sync) what `commitToModel()` and `sync()` do, let continue from there:

## Read/Write

Using `getValue` and `setValue` we can read/write values from/to the form.

Using `getValueModel` we can read values from the model.

I> All read/write methods support deep paths using dot notation strings or deep path arrays, similar to how it is supported by `@angular/forms`,
`getValue` and `setValue` are just proxies.

I> `getValueModel` is aligned with the API allowing easy access to values on the model based on path's from the form, i.e. using the same path
you can get the form value and the model value.

W> Read/Write operations are common when working with complex data structure such as Array's or nested objects. We will revisit them in the relevant chapters.

## Working with Arrays

Adding and removing controls are operations performed on forms with arrays, these are `FormArray` controls.

When we want to add an item to a `FormArray` we can not added a new instance of the item, we need to add the form control that represent that item.

For example, a model with the property names of type string[], if we want to push a new string to the names property we can not use the model (`model.push('new name')`) instead we need to push a new `FormControl` to the `FormArray` that represent names.

What if **names** is not `string[]` but an array of a complex type, a nested model. Now we can't push a `FormControl` we need a `FormGroup`.

To simplify the process the addControl will do all the work for us.

`appendControl(path: Array<string | number> | string, value?: any): FormGroup | FormControl`
We just need to provide the full path and a new form control is added. If we provide a **value** it will be used to populate the new control.

`removeControl(path: Array<string | number> | string, query: number | AbstractControl): AbstractControl | undefined`
Here we also need a **query** which is the index we want to remove at or a control which the method will use to resolve the index to remove.

W> The **path** in the add/remove methods must point to an instance of FormArray

## Working with child forms

`createChildForm<Z = any>(path: Array<string | number> | string, model?: Z): TDMModelForm<Z>`
A method that returns a new instance of the `NForm` class based on the type the **path** points at.

The type must be a known model and explicitly declared as a `childForm` in it's `FormPropMetadataArgs`.
The optional model parameter is used to populate the form (hint: use `getValueModel()` to get it)

I> `createChildForm` is used when working with complex data structures, child forms in particular.

repository: shlomiassaf/nform

repo_name: shlomiassaf/nform


text:
---
layout: documentation
title: Android and Bazel
---

# Android and Bazel

This page contains resources that help you use Bazel with Android projects. It
links to a tutorial, build rules, and other information specific to building
Android projects with Bazel.

## Getting started

The following resources will help you work with Bazel on Android projects:

*  [Tutorial: Building an Android app](tutorial/android-app.html). This tutorial
   is a good place to start learning about Bazel commands and concepts, and how
   to build Android apps with Bazel.
*  [Codelab: Building Android Apps with Bazel](https://codelabs.developers.google.com/codelabs/bazel-android-intro/index.html).
   This codelab explains how to build Android apps with Bazel.

## Features

Bazel has Android rules for building and testing Android apps, integrating with
the SDK/NDK, and creating emulator images. There are also Bazel plugins for
Android Studio and IntelliJ.

*  [Android rules](be/android.html). The Build Encyclopedia describes the rules
   you can use to build and test Android apps with Bazel.
*  [Integration with Android Studio](ide.html). Bazel is compatible with
   Android Studio using the [Android Studio with Bazel](https://ij.bazel.build/)
   plugin.
*  [`mobile-install` for Android](mobile-install.html). Bazel's `mobile-install`
   feature provides automated build-and-deploy functionality for building and
   testing Android apps directly on Android devices and emulators.
*  [Android instrumentation testing](android-instrumentation-test.html) on
   emulators and devices.
*  [Android NDK integration](android-ndk.html). Bazel supports compiling to
   native code through direct NDK integration and the C++ rules.

## Further reading

*  Learn [How Android Builds Work in Bazel](https://blog.bazel.build/2018/02/14/how-android-builds-work-in-bazel.html).

repository: chenshuo/bazel

repo_name: chenshuo/bazel


text:
# BSL- Percent Of Streetlight Outages Repaired Within 10 Business Days

## Dataset

| Name | Value |
| :--- | :---- |
| Catalog | [Link](https://catalog.data.gov/dataset/bsl-percent-of-streetlight-outages-repaired-within-10-business-days) |
| Metadata | [Link](https://data.lacity.org/api/views/fc3u-86zh) |
| Data: JSON | [100 Rows](https://data.lacity.org/api/views/fc3u-86zh/rows.json?max_rows=100) |
| Data: CSV | [100 Rows](https://data.lacity.org/api/views/fc3u-86zh/rows.csv?max_rows=100) |
| Host | data.lacity.org |
| Id | fc3u-86zh |
| Name | BSL- Percent Of Streetlight Outages Repaired Within 10 Business Days |
| Category | A Well Run City |
| Tags | street lighting, customer service, streetlight |
| Created | 2014-05-30T22:11:54Z |
| Publication Date | 2017-03-13T21:12:53Z |

## Description

This dataset shows the percentage of streetlight outages that are repaired within 10 business days.

## Columns

```ls
| Included | Schema Type    | Field Name                               | Name                                       | Data Type     | Render Type   |
| ======== | ============== | ======================================== | ========================================== | ============= | ============= |
| No       |                | date_name                                | Date Name                                  | text          | text          |
| Yes      | time           | date_value                               | Date Value                                 | calendar_date | calendar_date |
| Yes      | numeric metric | outages_repaired_within_10_business_days | % outages repaired within 10 business days | percent       | percent       |
```

## Time Field

```ls
Value = date_value
Format & Zone = yyyy-MM-dd'T'HH:mm:ss
```

## Series Fields

```ls
Excluded Fields = date_name
```

## Data Commands

```ls
series e:fc3u-86zh d:2013-08-01T00:00:00.000Z m:outages_repaired_within_10_business_days=96

series e:fc3u-86zh d:2013-09-01T00:00:00.000Z m:outages_repaired_within_10_business_days=96

series e:fc3u-86zh d:2013-10-01T00:00:00.000Z m:outages_repaired_within_10_business_days=91
```

## Meta Commands

```ls
metric m:outages_repaired_within_10_business_days p:integer l:"% outages repaired within 10 business days" d:"Percent of streetlight outages repaired within 10 business days" t:dataTypeName=percent

entity e:fc3u-86zh l:"BSL- Percent Of Streetlight Outages Repaired Within 10 Business Days" t:url=https://data.lacity.org/api/views/fc3u-86zh

property e:fc3u-86zh t:meta.view v:id=fc3u-86zh v:category="A Well Run City" v:averageRating=0 v:name="BSL- Percent Of Streetlight Outages Repaired Within 10 Business Days"

property e:fc3u-86zh t:meta.view.license v:name="Creative Commons 1.0 Universal (Public Domain Dedication)" v:termsLink=http://creativecommons.org/publicdomain/zero/1.0/legalcode v:logoUrl=images/licenses/ccZero.png

property e:fc3u-86zh t:meta.view.owner v:id=kmuv-58sk v:profileImageUrlMedium=/api/users/kmuv-58sk/profile_images/THUMB v:profileImageUrlLarge=/api/users/kmuv-58sk/profile_images/LARGE v:screenName="Public Works: Street Lighting OpenData" v:profileImageUrlSmall=/api/users/kmuv-58sk/profile_images/TINY v:displayName="Public Works: Street Lighting OpenData"

property e:fc3u-86zh t:meta.view.tableauthor v:id=kmuv-58sk v:profileImageUrlMedium=/api/users/kmuv-58sk/profile_images/THUMB v:profileImageUrlLarge=/api/users/kmuv-58sk/profile_images/LARGE v:screenName="Public Works: Street Lighting OpenData" v:profileImageUrlSmall=/api/users/kmuv-58sk/profile_images/TINY v:roleName=publisher v:displayName="Public Works: Street Lighting OpenData"
```

## Top Records

```ls
| date_name | date_value          | outages_repaired_within_10_business_days |
| ========= | =================== | ======================================== |
| Aug-13    | 2013-08-01T00:00:00 | 96                                       |
| Sep-13    | 2013-09-01T00:00:00 | 96                                       |
| Oct-13    | 2013-10-01T00:00:00 | 91                                       |
| Nov-13    | 2013-11-01T00:00:00 | 95                                       |
| Dec-13    | 2013-12-01T00:00:00 | 87                                       |
| Jan-14    | 2014-01-01T00:00:00 | 93                                       |
| Feb-14    | 2014-02-01T00:00:00 | 96                                       |
| Mar-14    | 2014-03-01T00:00:00 | 96                                       |
| Apr-14    | 2014-04-01T00:00:00 | 91                                       |
| May-14    | 2014-05-01T00:00:00 | 96                                       |
```

repository: SpellarBot/open-data-catalog

repo_name: SpellarBot/open-data-catalog


text:
# Donovan

Inspired by @xxhomey19's [nba-bar](https://github.com/xxhomey19/nba-bar).

View Major League Soccer scores from your menu bar and scroll through live updates.

## Screenshots:
![List view](/Images/list.png)
![Pregame view](/Images/pre-game.png)
![Postgame view](/Images/post-game.png)

## Installation:
* [Download the latest release](https://github.com/akeaswaran/mls-bar/releases) and unzip.

## Contributing:
* Clone (or fork) the repo and `cd` into it: `git clone https://github.com/akeaswaran/mls-bar.git && cd mls-bar`
* Install the dependencies: `pod install`
* Make your changes, and submit a pull request!

## Credits:
* HTMLReader
* SDWebImage
* HexColors
* CCNNavigationController
* DateTools
* Mantle
* ESPN
* Major League Soccer
* Icons8

## License
View [LICENSE.md](https://github.com/akeaswaran/mls-bar/blob/master/LICENSE.md) for copyright details.

repository: akeaswaran/mls-bar

repo_name: akeaswaran/mls-bar


text:
# Disney Movies CLI

This CLI program lists Disney's 50 best animated movies per the website Rotten Tomatoes. It also provides more information for each movie as requested by the user including movie description, release date, runtime, director(s), and writer(s).

## Installation

You can clone from the git repository by typing the following command in your terminal:

    git clone git@github.com:michellemoon236/disney-movies-cli.git

To run, type the following:

    ruby bin/run

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/'michellem'/disney-movies-cli. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).


text:
# QueryInterface

To support running mock queries, we use this object to queue results for queries. This
is to provide full control over the objects that are returned and do so in a way that
allows you to target specific code paths.

Queries are queued in a "first in, last out" manner, so they should be inserted in the
order your code would expect them in. The queue itself does no checking or validation
for what types of objects are being passed around except in the case of failures
(see `$queueFailure`).

**Note:** This is not an equivalent mock of Sequelize's built in `QueryInterface` at
the moment. The built in object for Sequelize is undocumented and is marked as `@private`
in their code, meaning it is not likely something to be relied on. If this changes it
can be mocked here. Functions have been prefixed with the mock prefix (`$`) for this
reason.

## new QueryInterface([options])

The `QueryInterface` class is used to provide common mock query functionality. New
instances of this class should mostly be created internally, however the functions on
the class are exposed on objects utilize this class.

###  Parameters

Name | Type | Description
--- | --- | ---
[options] | Object | Options for the query interface to use
[options.parent] | QueryInterface | Parent `QueryInterface` object to propagate up to
[options.stopPropagation] | Boolean | Flag indicating if we should not propagate to the parent
[options.createdDefault] | Boolean | Default value to be used for if something has been created if one is not passed in by the query. Defaults to true
[options.fallbackFn] | Function | Default function to call as a fallback if nothing is left in the queue and a fallback function is not passed in with the query

## $queueResult(result, [options]) -> QueryInterface

Queue a new success result from the mock database

###  Parameters

Name | Type | Description
--- | --- | ---
result | Any | The object or value to be returned as the result of a query
[options] | Object | Options used when returning the result
[options.wasCreated] | Boolean | Optional flag if a query requires a `created` value in the return indicating if the object was "created" in the DB
[options.affectedRows] | Array.<Any> | Optional array of objects if the query requires an `affectedRows` return value

###  Return
`QueryInterface`: self

## $queueFailure(error, [options]) -> QueryInterface

Queue a new error or failure result from the mock database. This will cause a query
to be rejected with the given error/failure object. The error is converted into a
`BaseError` object unless specified by the `options.convertNonErrors` parameter.
**Alias** $queueError

###  Parameters

Name | Type | Description
--- | --- | ---
error | Any | The object or value to be returned as the failure for a query
[options] | Object | Options used when returning the result
[options.convertNonErrors] | Boolean | Flag indicating if non `Error` objects should be allowed. Defaults to true

###  Return
`QueryInterface`: self

## $useHandler(handler) -> QueryInterface

Adds a new query handler from the mock database

###  Parameters

Name | Type | Description
--- | --- | ---
handler | Function | The function that will be invoked with the query.

###  Return
`QueryInterface`: self

## $clearQueue([options]) -> QueryInterface

Clears any queued query results
**Alias** $queueClear

###  Parameters

Name | Type | Description
--- | --- | ---
[options] | Object | Options used when returning the result
[options.propagateClear] | Boolean | Propagate this clear up to any parent `QueryInterface`s. Defaults to false

###  Return
`QueryInterface`: self

## $clearHandlers([options]) -> QueryInterface

Clears any handles
**Alias** $handlersClear

###  Parameters

Name | Type | Description
--- | --- | ---
[options] | Object | Options used when returning the result
[options.propagateClear] | Boolean | Propagate this clear up to any parent `QueryInterface`s. Defaults to false

###  Return
`QueryInterface`: self

## $clearResults([options]) -> QueryInterface

Clears any reesults (both handlers and queued results)
**Alias** $handlersClear

###  Parameters

Name | Type | Description
--- | --- | ---
[options] | Object | Options used when returning the result
[options.propagateClear] | Boolean | Propagate this clear up to any parent `QueryInterface`s. Defaults to false

###  Return
`QueryInterface`: self

## $query([options]) -> Promise

This is the mock method for getting results from the `QueryInterface`. This function
will get the next result in the queue and return that wrapped in a promise.

###  Parameters

Name | Type | Description
--- | --- | ---
[options] | Object | Options used for this query
[options.fallbackFn] | Function | A fallback function to run if there are no results queued
[options.includeCreated] | Boolean | Flag indicating if a `created` value should be returned with the result for this query. Defaults to false
[options.includeAffectedRows] | Boolean | Flag indicating if the query expects `affectedRows` in the returned result parameters. Defautls to false
[options.stopPropagation] | Boolean | Flag indicating if result queue propagation should be stopped on this query. Defaults to false
[options.query] | String | Name of the original query: "findOne", "findOrCreate", "upsert", etc.
[options.queryOptions] | Object | Array with the arguments passed to the original query method

###  Return
`Promise`: resolved or rejected promise from the next item in the review queue

repository: Foyer-Inc/sequelize-mock

repo_name: Foyer-Inc/sequelize-mock


text:
All code under this directory is to be compiled for the embedded target: ARM
Cortex-A7.

There are two compilation targets (see `--target` in `rustc -h`) for this
embedded target:

- armv7a-none-eabihf, hard float ABI; float operations are performed on the
  hardware FPU. NOTE: currently untested

- armv7a-none-eabi, soft float ABI; float operations are emulated

The default compilation target for the whole directory is currently set to the
most compatible soft float target. If you need to use the hard float target
modify `.cargo/config`, or pass `--target armv7a-none-eabihf` to Cargo.

branch_name: refs/heads/develop

gha_language: Rust


text:
# CarND-Path-Planning-Project

## Goals
In this project the goal is to safely navigate around a virtual highway with other traffic that is driving +-10 MPH of the 50 MPH speed limit, and meet the following criteria:
* Drives 4.32 miles without incident - completes one loop (6946m)
* Drives close to or under the 50MPH speed limit
* Max acceleration (10 m/s^2) and max jerk (10 m/s^3)
* No collisions
* Stays in lane except when changing lanes (max 3 seconds)
* Smooth lane changes when required

The car's localization and sensor fusion data is provided and there is also a sparse map list of waypoints around the highway.

This document sets out the process of developing the model and the current results and state of the project.

---

## Getting smooth trajectories
By making use of the suggested [spline tool](https://kluge.in-chemnitz.de/opensource/spline/) with the `spline.h` function, a subset of the sparse waypoints (in the current  solution, 3 ahead and 3 behind the current car position) are used to generate smooth splines, which are then able to create a denser grid of closer sub-waypoints for the car to follow. The initial speed limit is set to 49.5 in order to see if the car would behave as planned.

## Define model behaviour
The code implemented to obtain smooth trajectories in the previous step is successful in allowing the car to remain in its own lane regardless of what obstacles it may find in its way. The next step would be to determine what steps the car should take in order to remain at its optimum speed as close to the speed limit as possible.
1. The `sensor_fusion` data is read in order to slow the car down by 5m/s^2 should it find another car within 30m in its path. Should the path be clear, the car should increase it's acceleration by 5m/s^2 until it arrives close to the speed limit (set at 49 m/s, line 232 of main.cpp).
2. Once this is successfully implemented, the next step is to implement a lane change where possible. This is done by checking the left and right lanes for cars which may be up to 30m ahead (in the next time step, due to the delay) and also up to 10m behind the ego vehicle, in order to be extra sure collisions may be avoided. Left lane changes are checked first, followed by the right lane change.

![Initial Performance](performanceInit.png)

The initial performance was satisfactory, with the minimum requirements of the assignment being met - driving 4.32 miles without incident. But there was still an occasional collision, or the rare acceleration limit being reached specifically when changing lanes and it never reached 15 miles incident-free. So I wanted to see the effect that some minor tweaking would have on the model.

## Modifications to the initial model
1. Originally, the changing of lanes was made before slowing down, but this occasionally caused the maximum acceleration to be exceeded, so the algorithm was tweaked to slow the car down slightly before trying to change lanes.

2. The deceleration is smoothed to only slow down as a function of the current speed and the speed of the vehicle ahead - not with a constant deceleration - so as to reduce the rhythmic yoyo-ing between slowing down and speeding up when stuck in a situation when it is not possible for a change in lanes because of cars in neighbouring lanes as well.

3. The checking of vehicles in the left and right lane were extended from 30m ahead to 10m behind the current vehicle - this is to avoid the cases where a car would pull up alongside and suddenly speed up, causing a collision.

## Performance
The tweaked model successfully met all the goals as detailed in the first step, and managed to drive for a considerable amount of time (>30 miles and counting as I stopped the simulator after 40 minutes) switching lanes without any incidents - no collisions, nor exceeding the max acceleration and jerk set out, while driving close to the 50MPH speed limit whenever possible.

![Final Performance](performanceFinal.png)

Next steps to implement would be to introduce cost functions rather than simple boolean logic for the lane changes in order to decide on the best trajectories (more than one lane if necessary) or the slowing down and speeding up of the ego vehicle according to lane speeds. And to pre-empt close-range lane changes from vehicles two lanes away, as this was one of the causes of the rare collisions that the current solution could not avoid.

---


text:
# Log of changes for Catalogue Frontend module

## 1.0.0

* First initial release

## 1.0.1

* Ensure disabled products do not appear in the frontend

## 1.0.2

* Add support for SEO module being installed

## 1.0.3

* Add additional fields to product export

## 1.0.4

* Minor code cleanup

## 1.0.5

* Add upgrade from previous SS Commerce

repository: silvercommerce/catalogue-frontend

repo_name: silvercommerce/catalogue-frontend


text:
---
title: Pre-heating the Pi
image: /assets/images/2023/raspberry-pi-in-argon-one-case.jpg
tag:
    - Adventures in FOSS
    - Self Hosted
affiliate: true
---

To host [all of the FOSS things](https://tonyedwardspz.co.uk/blog/adventures-in-foss-the-journey-begins/), this little Pi is going to be sitting quietly in the corner of the living room for the foreseeable. To do that, we need to tinker with getting the software setup.

The following setup is working well on a Pi 4 well as a foundation for an internal network facing server with an internet connection. Be sure to do a full update, backup and cross your fingers before starting. This is also a good moment to check the settings on your router. Be sure your firewall is switched on. Many would recommend [switching off UPnP](https://nordvpn.com/blog/what-is-upnp/) to make your network a tad bit more secure, however prepare for the potential inconvenience.

## Use the 64bit OS

If you haven't already, go back and install the 64-bit OS variant onto your SD card rather than the 32-bit option. As soon as you need anything machine learning related (i.e. tagging faces in photos), you'll wish you did.

## Change the default username and password

Default usernames and passwords are never, ever a good idea. [Here's](https://thepihut.com/blogs/raspberry-pi-tutorials/how-to-change-the-default-account-username-and-password) how to change your default user credentials if it still exists after setup.

## Boot into the command line.

For this project, my preference is to do as much as possible via the command line. [Changing a few settings](https://www.digikey.co.uk/en/maker/blogs/2018/how-to-boot-to-command-line-and-ssh-on-raspberry-pi) in the boot config will make device launch directly into the command line.

You can always run the command `startx` to load the GUI interface.

## Disable bluetooth and wifi

You might want to skip this one. For our setup, WiFi and Bluetooth aren't used and disabling them will reduce power draw by ~45mA. Disabling LAN would save double that, but not having the extra radio waves bouncing around can't be a bad idea.

In the terminal, run

```bash
sudo nano /boot/config.txt
```

and add the following to the bottom of the file.

```bash
##turn on/ off bluetooth
dtoverlay=disable-bt

##turn on/off wifi
dtoverlay=disable-wifi
```

While you're there, you might as well turn off the onboard LEDs.

```bash
# Turn off onboard LED's
dtparam=act_led_trigger=none
dtparam=act_led_activelow=on
```

## Overclock the processor

The processor is going to be idling a lot of the time, but a snappy response would be nice in the heat of the moment. Because the [Argon ONE](https://amzn.to/3JKj8yP) case both actively and passively cools the CPU, a healthy dose of overclocking is achievable.

```bash
sudo nano /boot/config
```

and add the following lines.

```bash
#uncomment to overclock the arm. 700 MHz is the default.
arm_freq=2000
over_voltage=6
```

This gives a noticeable 30% boost in peek processing power, without pushing too far and compromising stability. If your Pi is not properly cooled, do not overclock. You can easily brick your device.

## Reduce writes to the SD card

SD cards are not designed for the intensity of usage generated by a Raspberry Pi setup. With this configuration intended to run day in and day out, anything above a year's use from a decent SD card is gifted time. Longer term, the plan is to boot from a small-capacity SSD.

In the meantime, we can reduce the number of writes to the card by logging to RAM rather than directly to the SD card, dumping to disk a few times a day rather than every few seconds.

The instructions are straight forward and [available here](https://pimylifeup.com/raspberry-pi-log2ram/).

## Auto mount the hard drive

By default, external hard drives aren't automatically mounted when using the Pi OS. Controlling mounting will allow our docker containers (more on that in future posts) to reach our filesystem to find media. [Here's some instructions](https://pimylifeup.com/raspberry-pi-mount-usb-drive/).

### Set a static IP for the Pi

This will make so many things so much easier by allowing you to always find the server at the same IP address. [Here's the instructions](https://www.makeuseof.com/raspberry-pi-set-static-ip/).

## Setup the Firewall

If your device is connected to the internet, you'll need a firewall. [UFW] is a straightforward option, but there are plenty of others. Install it via

```bash
sudo apt install ufw
```

Let's set up our firewall to have sensible, secure defaults to begin with.

```bash
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw limit ssh
sudo ufw allow HTTP
sudo ufw allow https
sudo ufw logging on
```

We can then layer application specific rules on top. If you want to access the web, you'll probably want to allow a couple of ports.

```bash
sudo ufw allow 80
sudo ufw allow 443
```

There is some duplication in the rules above, but UFW will sort that out. Then we can enable the application

```bash
sudo ufw enable
```

We'll add some more shas we setup other software, but there's plenty of options to play with [in the docs](https://help.ubuntu.com/community/UFW) if you want to get ahead of class.

## Install Fail2ban

Fail2ban complements UFW almost as an extension of its `limit` rules. Fail2Ban "scans log files and bans IPs showing potentially malicious behaviour, e.g. too many password failures, seeking exploits and similar". It comes with sensible defaults, although I opted to decrease the number of failed attempts before a ban is implemented and increase the length of the ban.

You'll find the instructions [here](https://pimylifeup.com/raspberry-pi-fail2ban/).

## IP4 filtering

Buried in the Raspberry Pi system config are settings that enhance security at a relatively low level. Switching on this filtering improves the robustness of the Pi to attack and is one of the simplest ways to enhance the network security of the device.

To enable this functionality, open up the `sysctl.conf file:

`sudo nano /etc/sysctl.conf`

and uncomment the following lines in the file:

```bash
net.ipv4.conf.all.rp_filter=1
net.ipv4.conf.all.accept_redirects = 0
net.ipv6.conf.all.accept_redirects = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv6.conf.all.accept_source_route = 0
```

## Setup SSH

For the moment, the intention is to keep this as an internal facing service. This means SSH access can be limited to the home network. Edit / create a local ssh config file via:

```bash
sudo nano /etc/ssh/sshd_config.d/local_network_only.conf
```

The separate file to the rest of the config prevents conflicts when upgrading your Pi. If you're on a fresh installation, it will likely be a new file. Add the following to the file.

```bash
# Disable all auth by default
PasswordAuthentication no
PubkeyAuthentication no

# Allow auth from local network
Match Address  192.168.1.*
    PubkeyAuthentication yes
    PasswordAuthentication yes
    AllowUsers tony
```

This disables authentication completely, then re-enabling it for a specific user on the internal network only. Note that the password authentication will get switched off totally once the server is operating as intended.

We should now grant access to SSH to specific IP addresses.

```
sudo ufw allow from <IP_ADDRESS> to any port 22
```

You'll need to repeat this with any device / app you want to SSH in via, once you've enabled SSH.

```bash
sudo systemctl enable ssh
sudo systemctl start ssh
```

Terminal is perfectly adequate from a Mac, and [Termius](https://play.google.com/store/apps/details?id=com.server.auditor.ssh.client&hl=en&gl=US) is a nice option for Android.

## Use a European time server

As a European, I like to get my time from somewhere in Europe. By default, it's only a tiny transatlantic request, but it does not need to be made. Plus, we get dates right on this side of the pond.

Open up the relevant config file:

`sudo nano /etc/systemd/timesyncd.conf`

Change (or add) the lines below:

```bash
[Time]
NTP=0.europe.pool.ntp.org 1.europe.pool.ntp.org 2.europe.pool.ntp.org 3.europe.pool.ntp.org
#FallbackNTP=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org
```

Done.

repository: tonyedwardspz/tonyedwardspz

repo_name: tonyedwardspz/tonyedwardspz


text:
---
layout: page
title: Donate
permalink: /donate/
---

Surely there might have been updates that have slipped under the radar and was not reflected on this site yet. Ooopsie! You can contribute to this project by reporting any error or missing data that you find. Unfortunately, the contents may be 99% accurate, so any feedback would definitely make a difference that it may even save a life.

Building this site and maintaining it requires time and resources. Please consider supporting this project in another way by donating if you think it’s a worthwhile endeavor. It would mean a lot for the residents of this community to keep the project going.

### Your Support
You can donate [₱100][paymaya-100] thru PayMaya, [buy me a pizza][buymeacoffee] or by becoming a patron at my [Patreon][patreon] page to support my ongoing creative work.

[paymaya-100]: https://www.paymaya.com/app/sendmoney?p=eyJyIjoiKzYzOTE4OTE4ODE3MyIsInQiOiJQQVlNQVlBIiwiYyI6IlBIUCIsImEiOiIxMDAuMCJ9

[buymeacoffee]: https://buymeacoff.ee/jerbau

[patreon]: https://www.patreon.com/jerbau

repository: jerbau/tcev-emergency

repo_name: jerbau/tcev-emergency


text:
Catalog Manager
====================

A manager for managing categories and cards within a [Card-Catalog](https://github.com/School-Yard/Card-Catalog).

repository: particlebanana/Catalog-Manager

repo_name: particlebanana/Catalog-Manager


text:
# babel-vscode-source-map-woes

- `npm|yarn install`
- `babel input.js --source-maps > out.js`
- `node --debug-brk out.js`
  - observe `sourceMaps: true` in the attach config
- Attach, and observe

If you look inside of `input.js`, you will see some cues for trying debugging
with a debugger statement, and using the built in VSCode red breakpoints.

I wager what you discover is:

- on entry, sourcemaps are not immediately loaded
- VSCode breakpoints are not honored

repository: cdaringe/babel-vscode-source-map-woes

repo_name: cdaringe/babel-vscode-source-map-woes


text:
---
id: getting-started
title: Getting Started
sidebar_label: Getting Started
---

import { AstFn, ZuzeTabs } from '../src/examples/tabs';

## Forward

**@zuze/schema** was created out of love and admiration for projects like [joi](https://github.com/hapijs/joi), [yup](https://github.com/jquense/yup), and [ajv](https://github.com/epoberezkin/ajv) which are all schema validators. Each package brings it's own strengths. The strength (I hope) that `@zuze/schema` brings is that it's fun to use, whether you're somebody who likes to write functional code or somebody who likes to write highly reusable configuration (who doesn't love a some good [YAML](https://www.reddit.com/r/ProgrammerHumor/comments/9fhvyl/writing_yaml/)....but we use JSON.)

**@zuze/schema** is one package that comes in two flavors - [functional](https://en.wikipedia.org/wiki/Functional_programming) or [ast](https://en.wikipedia.org/wiki/Abstract_syntax_tree).

Throughout these docs code examples will be presented in tabs in functional and AST form (where applicable). Pick the one that's right for you and your project!

More on that after the set up:

## Installation

Install **@zuze/schema** using yarn or npm

<ZuzeTabs tabs={['npm','yarn']}>

```bash
npm install @zuze/schema
```

```bash
yarn install @zuze/schema
```

</ZuzeTabs>

## Creating a Schema

Let's start by creating some very simple schemas:

<AstFn>

```js
import { ast } from '@zuze/schema'

const { matches } = ast;

matches({ schema: 'string', tests: [['min', 10]] }, 'short'); // false
matches({ schema: 'string', tests: [['min', 10]] }, 'this should work'); // true
```

```js
import { string, min, tests, isValidSync } from '@zuze/schema'

const schema = string(tests(min(10)));

isValidSync(schema, 'short'); // false
isValidSync(schema, 'this should work'); // true
```

</AstFn>

license: ISC

repository: zuze-lab/schema

gha_license_id: ISC

repo_name: zuze-lab/schema


text:
# Tests for Rune

This project is structured slightly differently than your average Rust testing
project.

Autodiscover is **turned off**, meaning all tests have to be included manually
in [tests/mod.rs]. This is done so that all tests can be compiled into a single
binary which has a significant speedup effect on running them. Especially on
systems which have very slow linkers.

This is also done so that we can provide a few convenient macros in [tests.rs]
which are available implicitly in all test cases.

repository: udoprog/rune

repo_name: udoprog/rune


text:
[Hypothesis](https://hypothesis.readthedocs.io/) is the Python library for
[property-based testing](https://increment.com/testing/in-praise-of-property-based-testing/).
Hypothesis can infer how to construct type-annotated classes, and supports builtin types,
many standard library types, and generic types from the
[`typing`](https://docs.python.org/3/library/typing.html) and
[`typing_extensions`](https://pypi.org/project/typing-extensions/) modules by default.

Pydantic v2.0 drops built-in support for Hypothesis and no more ships with the integrated Hypothesis plugin.

!!! warning
    We are temporarily removing the Hypothesis plugin in favor of studying a different mechanism. For more information, see the issue [annotated-types/annotated-types#37](https://github.com/annotated-types/annotated-types/issues/37).

    The Hypothesis plugin may be back in a future release. Subscribe to [pydantic/pydantic#4682](https://github.com/pydantic/pydantic/issues/4682) for updates.

repository: slafs/pydantic

repo_name: slafs/pydantic


text:
# Tech-Blog
![Top Language](https://img.shields.io/github/languages/top/Kpetiote/Tech-Blog)
![Repository Size](https://img.shields.io/github/repo-size/Kpetiote/Tech-Blog)
![Last Commit](https://img.shields.io/github/last-commit/Kpetiote/Tech-Blog)
![Issues](https://img.shields.io/github/issues/Kpetiote/Tech-Blog)
![Issues](https://img.shields.io/github/issues/Kpetiote/Tech-Blog)

## Table of Contents
* [Description](#description)
* [Demo](#demo)
* [Program Installation](#program-installation)
* [Program Usage](#program-usage)
* [Technologies](#technologies)
* [Links](#links)
* [Contribution](#contribution)
* [Questions](#questions)
* [License](#license)

## Description
The purpose of this application is to allow users to post on a technology blog.\
Upon first loading the program, the end-user will see the most recent post.\
To create a post users will need to sign up and create an account.\
User should be able to create, comment, and edit post in the blog site.

## Demo
![Alt text](./public/images/tech-blog.gif "Tech-Blog")

## Program Installation
To use this program we will need to install Node.js & MySQL Workbench.\
Please use the link below to download a suitable version for your OS:

[Node.js Downloads](https://nodejs.org/en/download/)

[MySQL Workbench Downloads](https://dev.mysql.com/downloads/workbench/)

Once installed we can use your command-line interface\
(Git/Terminal - MacOS, Linux & Ubuntu, CMD/Git - Windows)\
to run browse to the main repository, then run the following commands:

```bash
npm run seed
```

To seed data to your database so to test the routes.

```bash
npm install
```

To install the necessary dependencies from the package.json for the program to run.

## Program Usage
After using the program installation instructions, we can then start using the program\
Remaining in the terminal, we can use the following command to run the application:

```bash
npm run start
```

The program will then initialize and function as shown in the demo.

## Technologies
- [Bcrypt](https://www.npmjs.com/package/bcrypt)
- [Bulma](https://bulma.io/)
- [Dotenv](https://www.npmjs.com/package/dotenv)
- [Express](https://www.npmjs.com/package/express)
- [Javascript](https://www.javascript.com/)
- [Handlebars](https://www.npmjs.com/package/express-handlebars)
- [MySQL](https://www.mysql.com/)
- [Node.js](https://nodejs.org/en/about/)
- [Sequelize](https://sequelize.org/)

## Links
- [Github Repository URL](https://github.com/Kpetiote/Tech-Blog)
- [Heroku Live Site](https://kenpet-tech-blog.herokuapp.com/)
## Contribution
None

## Questions
Please feel free to contact me with any questions:
-<EMAIL_ADDRESS>- [Github](https://github.com/Kpetiote)

## License
![badge](https://img.shields.io/badge/license-MIT-yellow)
<br />
Licensed under the MIT License license.

repository: KPetiote/Tech-Blog

repo_name: KPetiote/Tech-Blog