text:
# Improvement of log messages usability

The goal of this proposal is to provide a common, unified solution to logging across Kyma components, which will allow users and maintainers to easily track specific events happening in the Kyma ecosystem. The solution should be independent of the platform (AWS, Azure, GCP) and easy to introduce into the existing components.

Users, developers, and maintainers want to have an easy way to track events and issues that occur in Kyma, and to easily debug faulty components. This will make understanding of the Kyma ecosystem easier and more transparent.

## Solution

Every component should produce log entries in order to make the issue diagnosis process quick and effective.

Key assumptions for log messages:

- Transparency - every entry must be concise and contain all essential information about the process.
- Tracing - entries sequence must be connected so that it's easy to filter logs concerning a specific operation.
- GDPR-compliance - entries must not contain any sensitive data (password, personal data in the meaning of GDPR).
- No "responsibility overlapping" - as there are other diagnostic tools, logs, in general, should not contain information that can be taken from these tools (for example, there's tracing which can be used for timings).

Additional assumptions:

- If there is one quick solution for an occurring issue, add it to the message on the DEBUG level so the operator could use it while debugging.
- If the operation will be retried, specify when.
- JSON format should be enabled only on environments where monitoring is enabled. Text format is more readable for debugging purposes so make it configurable.
- In case of debug level, add the error stack tracing.
- Don't put redundant data into the logs. If something failed 10 times, log that it failed 10 times instead of printing the same error 10 times.

## Log structure

To unify the logs, which will make the debugging process and logs parsing much easier, I'd like to propose a single log format that every service, job, and all the components should follow:

- **date** - RFC3339 format of date, time, and timezone. For example: "2012-12-12T07:20:50.52Z".
- **level** - logging level. For example: "ERROR"
- **msg** - human-readable information with the specified format (notice that there is no data duplication in the context structure):
    - error and fatal message: past tense started with, for example, `Failed to...`, after that the error wrapped with some meaningful context. For example: `Failed to provision runtime: while fetching release: while validating release: release does not contain installer yaml`.
    - info message: present continuous tense for the things that are about to be done, for example, `Starting processing...`, or past tense for the things that are finished, such as `Finished successfully!`.
    - warning message: a short explanation of what happened and what this can cause. For example: `Tiller configuration not found in the release artifacts. Proceeding to the Helm 3 installation...` or `Connection is not yet established. Retrying in 5 minutes...`.
    - message language: English. To preserve unified number/date formatting, go with the `en-us` locale.
    - encoding: `UTF-8`.
- **context** - structure of the contextual information, such as operation (for example: `starting workers`), handler/ resolver (for example: `ProvisionRuntime`), controller, resource-namespaced name (for example: `production/application1`), operation ID, instance ID, operation stage, and so on. Users must be able to filter the logs so all the info provided here must be a useful and unique minimal set for every operation.
Flat context object is recommended as in the end the cloud storage flattens it to a key-value map to make it searchable using OpenSearch. Avoid dots (`.`) in the keys.
- **caller** - string with information where in the code the log was created. For example: `"pkg/components/client.go:45"`.
- **traceid** - 16-byte numeric value as a base16-encoded string. It'll be passed through a header, so the user can filter all the logs regarding the whole business operation in the whole system.
- **spanid** - 16-byte numeric value as a base16-encoded string. It'll be randomly generated for each request handling so the user can filter the component logs for a specific operation handling.
>**NOTE:** The **traceid** and **spanid** fields are required in the logs to be compliant with the [OpenTelemetry standards](https://github.com/open-telemetry/oteps/pull/114/files). The standard is still in the development phase, so we should keep an eye on it and change it accordingly.

## Log format

Log format should be configured and changeable. I'd like to propose the **log.format** Helm chart key which could have two possible values: `json` or `text`. For example:

```yaml
log:
  format: "json"
```

In the `deployment.yaml` file or other component's container specification, there will be an environment variable, for example:

```yaml
    spec:
      containers:
        - env:
          - name: APP_LOG_FORMAT
            value: {{ .Values.global.log.format }}
          ...
```

### Key-value pairs example
```text
2012-12-12T07:20:50.52Z WARNING Tiller configuration not found in the release artifacts. Proceeding to the Helm 3 installation... {"context":{"resolver":"ProvisionRuntime","operationID":"92d5d8fd-cbdc-4b7a-9bc3-2b2eccfcb109","stage":"InstallReleaseArtifacts","shootName":"c-3a38b3a","runtimeID":"19eb9335-6c13-4d40-8504-3cd07b18c12f"},"traceid":"0354af75138b12921","spanid":"14c902d73a", "caller":"pkg/components/client.go:45"}
```

### JSON example
```json
{
  "timestamp": "2012-12-12T07:20:50.52Z",
  "level": "WARNING",
  "message": "Tiller configuration not found in the release artifacts. Proceeding to the Helm 3 installation...",
  "context": {
    "resolver": "ProvisionRuntime",
    "operationID": "92d5d8fd-cbdc-4b7a-9bc3-2b2eccfcb109",
    "stage": "InstallReleaseArtifacts",
    "shootName": "c-3a38b3a",
    "runtimeID": "19eb9335-6c13-4d40-8504-3cd07b18c12f"
  },
  "traceid": "0354af75138b12921",
  "spanid": "14c902d73a",
  "caller": "pkg/components/client.go:45"
}
```

## What should not be logged

We should be careful about the information we put in logs. Every log should be easily connectable with the issue or the error but there should be no internal or confidential data provided in any log entry. Here is the list of items that should not be logged:

- Authorization data, such as passwords, usernames, certificates, and tokens. Note that sometimes basic auth or other tokens can be used in the URL, for example<EMAIL_ADDRESS>or  `http://www.example.com/api/v1/users/1?access_token=123` so you need to be extra careful in these cases.
- Person-identifiable information, such as tenant names. If the person-identifiable information is required in the audit log, it should be encrypted.
- User input to avoid log injection. If user input is required in the logs, it should be parsed and validated.

repository: kyma-project/community

gha_language: Go

repo_name: kyma-project/community


text:
# `numpy` operations

**References:**
- https://docs.scipy.org/doc/numpy-1.14.0/reference/generated/numpy.rot90.html
- http://www.scipy-lectures.org/intro/numpy/operations.html
- https://bic-berkeley.github.io/psych-214-fall-2016/dot_outer.html

## Mapping

Example: Boolean map of a matrix

`False`: not equal to 2
`True`: equal to 2

~~~~
labels = np.array([2,3,3,4,5,6,7,7,1,2,2,2,1])
boolean_map = (labels == 2)
~~~~

The boolean map can be converted to integers:

~~~~
y = boolean_map.astype(int)
~~~~

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

## `np.insert()`

**Example:**

Insert a vector of `1`s  in front of a matrix:

~~~~
M_new = np.insert(M, 0, 1, axis=1)
~~~~

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

## `rot90()`

~~~~
img_rot = np.rot90(img)
~~~~

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

## `where()`

- https://stackoverflow.com/questions/432112/is-there-a-numpy-function-to-return-the-first-index-of-something-in-an-array

~~~~
itemindex = numpy.where(array==item)
~~~~

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

## `numpy.delete(arr, obj, axis=None)`

- https://docs.scipy.org/doc/numpy/reference/generated/numpy.delete.html

Return a new array with sub-arrays along an axis deleted. For a one dimensional
array, this returns those entries not returned by `arr[obj]`.

**Parameters:**

- `arr`: `array_like`
    Input array.

- `obj : slice, int or array of ints
    Indicate which sub-arrays to remove.

- `axis`: `int`, optional
    The axis along which to delete the subarray defined by obj. If axis is None, obj is applied to the flattened array.

**Returns:**

- `out`: `ndarray` A copy of `arr` with the elements specified by obj removed.
Note that delete does not occur in-place. If axis is None, out is a flattened
array.

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

## `unique()`

**References:**
- https://docs.scipy.org/doc/numpy-1.14.0/reference/generated/numpy.unique.html

~~~~
numpy.unique(ar, return_index=False, return_inverse=False, return_counts=False, axis=None)[source]¶
~~~~

Find the unique elements of an array.

    Returns the sorted unique elements of an array. There are three optional outputs in
    addition to the unique elements: the indices of the input array that give the unique
    values, the indices of the unique array that reconstruct the input array, and the number of
    times each unique value comes up in the input array.

**Parameters:**

- `ar` : array_like

    Input array. Unless axis is specified, this will be flattened if it is not already 1-D.

- `return_index`: bool, optional

    If True, also return the indices of ar (along the specified axis, if provided, or in the flattened array) that result in the unique array.

- `return_inverse`: bool, optional

    If True, also return the indices of the unique array (for the specified axis, if provided) that can be used to reconstruct ar.

- `return_counts`: bool, optional

    If True, also return the number of times each unique item appears in ar. .. versionadded:: 1.9.0

- `axis`: int or None, optional

    The axis to operate on. If None, ar will be flattened beforehand. Otherwise, duplicate items will be removed along the provided axis, with all the other axes belonging to the each of the unique elements. Object arrays or structured arrays that contain objects are not supported if the axis kwarg is used. .. versionadded:: 1.13.0

**Returns:**

- `unique`: ndarray

    The sorted unique values.

- `unique_indices`: ndarray, optional

    The indices of the first occurrences of the unique values in the original array. Only provided if return_index is True.

- `unique_inverse`: ndarray, optional

    The indices to reconstruct the original array from the unique array. Only provided if return_inverse is True.

- `unique_counts`: ndarray, optional

    The number of times each of the unique values comes up in the original array. Only provided if return_counts is True. .. versionadded:: 1.9.0

**Example(s):**

~~~~
>>> np.unique([1, 1, 2, 2, 3, 3])
array([1, 2, 3])
~~~~

license: MIT

repository: Mecreal/manuals

branch_name: refs/heads/master

extension: md

gha_license_id: MIT

license_type: permissive

repo_name: Mecreal/manuals


text:
sanity
======

Hacks and utilities for cleaning, parsing, and transforming text

This library has evolved over the past decade to maintain my sanity while working with various text input and files.  Some of the techniques may be dated (and there may be better solutions that have found their way into the standard library), but the functions within solved a problem when another solution wasn't easily found.  Perhaps they'll help you in a jam as well.

## abbr.py ##
Used to expand/contract abbreviations.  Currently only handles US State names (ex., 'Texas' -> 'TX' and back.)  This is helpful when normalizing addresses.

## cast.py ##
Functions to cast data from one format to another. The most-used is probably `to_ascii`, but `to_int` and `to_bool` are helpful when normalizing form input. (Ex., `to_bool` can deal with 'yes', 'no', 'on', 'off', etc.)

## extract.py ##
For when you need to extract a substring or piece of data from a larger context.  Dates, numbers, prices, email addresses, etc. There's also a handy function for extracting text based on a regex pattern, provided the text doesn't match a supplied 'blacklist' pattern.  Use this when look-ahead/behind patterns won't cut it.

## find.py ##
Probably the wrong name. These functions are simliar to those in `extract.py`, in that they isolate sub-strings, but they also return the parent string with the isolated text removed.  You'll have to look at the doctests to see what I mean.

## fmt.py ##
This is the big daddy. There are all kinds of formatting functions in here. Use this to convert unicode characters to HTML encodings; strip HTML; create slugs; convert numbers to words (ie., 10 -> 'ten'); and in general, normalize text into whatever format you need. Most functions were written to deal with Word docs copy-pasted into HTML forms, sadly enough.

## identify.py ##
These are `is_` functions, like `is_numeric` and `is_whitespace`.

## numeraltable.py ##
This contains the numbers 0 to 100 spelled out (e.g., zero to one hundred.) It is used by `fmt.py` when converting numbers to numerals.

## shell.py ##
For when you want to run something in the shell rather than Python. This is really just so I don't have to keep looking up the subprocess syntax whenever this need comes up.

## split.py ##
Split strings based on patterns, or by things that look like taxonomy 'tags'.

## uniasciitable.py ##
Used by `fmt.py` to convert unicode text into HTML/XML-safe ascii, this is a big table that maps HTML encodings to unicode characters to ascii representations to HTML entities.  If you have '&gt;' and want '&#62;' or '>', you can look it up here.  There's over a thousand mappings in here, and yes, I did most by hand out of neccesity.

## util.py ##
Currently all it knows how to do is find non-ascii characters in files.  I needed it at some point when generating large quantities of XML that needed to be read by an ascii-only parser.

----

Copyright 2009-2016 Erik Smartt

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

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

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

repository: wolfspyre/sanity

repo_name: wolfspyre/sanity


text:
---
layout: post
title: "Scalable Spark Deployment using Kubernetes - Part 9 : Service Update and Rollback"
date : 2017-05-03
categories: scala spark kubernetes-series
---
In last few blog posts on kubernetes, we have discussed about how to build and scale spark cluster. Once services are deployed, we also
need to update services time to time. When we update a service, we need to make sure that, it don't interrupt the working of other
services. Kubernetes has built in support for the service update and rollbacks. This makes changing services on kubernetes
much easier than doing them manually in other platforms.

In this ninth blog of the series, I will be discussing about service update and rollback in kubernetes.
You can access all the posts in the series [here](/categories/kubernetes-series).

## Updating Service

In our discussion of deployment abstraction, I told that deployment helps us to handle life cycle of a service. Currently,
we are running the spark version 2.1.0. Let's say we want to change it to 1.6.3 without changing the
configuration. We can use deployment abstraction for achieving the same.

The below are the steps to change spark version from 2.1.0 to 1.6.3 using deployment abstraction.

### 1. Generate Spark Image for 1.6.3

As we did for spark 2.1.0, we first need to have an image of the spark 1.6.3. This can be easily done by changing docker file as below.

{% highlight sh%}

 ENV spark_ver 1.6.3

{% endhighlight %}

Once we update the docker file, we need to build new image with below command.

{% highlight sh %}

docker build -t spark-1.6.3-bin-hadoop2.6 .

{% endhighlight %}

Now we have  our new spark image ready.

###  2. Set Images to Deployment

The below two commands sets new images to already running spark-master and spark-worker deployments

{% highlight sh %}

kubectl set image deployment/spark-master spark-master=spark-1.6.3-bin-hadoop2.6

kubectl set image deployment/spark-worker spark-worker=spark-1.6.3-bin-hadoop2.6

{% endhighlight %}

In the command, we are setting the image for *spark-master*  and *spark-worker* container inside the deployment. This helps only update needed containers
inside deployment rather than updating all.

This only sets new images. It has not updated the service yet. We need to use roll out command for that.

### 3. Rollout the Deployment

The below commands rolls out the changes to deployment.

{% highlight sh %}

kubectl rollout status deployment/spark-master
kubectl rollout status deployment/spark-worker

{% endhighlight %}

When you roll out changes, kubernetes first brings up new pods with 1.6.3 version. Then once they are running
the old pods will be deleted.

This shown in the below output.

{% highlight sh %}

NAME                               READY     STATUS        RESTARTS   AGE
nginx-deployment-619952658-16z1h   1/1       Running       1          11d
spark-master-1095292607-mb0xh      1/1       Running       0          37s
spark-worker-1610799992-4f701      0/1       Pending       0          25s
spark-worker-671341425-xxlxn       1/1       Terminating   0          53s

{% endhighlight %}

As part of the roll out, kubernetes will update all dns entries to point to new pods.

This graceful switch over from older version to new version of pods makes sures that service is least interrupted when we
update services.

You can verify the spark version using *spark-ui* or logging into one of the pods.

## Service Rollback

As part of the service update, kubernetes remembers state of last two deployments. This helps us to roll back the changes
we made it to deployment using *undo* command.

If we want to undo our change of spark version, we can run the below commands

{% highlight sh %}

kubectl rollout undo deployment/spark-master
kubectl rollout undo deployment/spark-worker

{% endhighlight %}

The above commands reverses the spark version back to 2.1.0. This ability to quickly undo the service is
powerful. If something goes wrong, we can rollback the service to it's previous state without much effort.

## Conclusion

Kubernetes has native support for service update and rollback. Using deployment abstraction we can easily roll out the changes to
our services without effecting other services.


text:
---
template: project-writeup.jade
title: Buell 1125CR Charging System Overhaul
project: 1125-charging-system
---
# Buell 1125CR Charging System Overhaul

This writeup covers the charging system work I did on my 2009 Buell 1125CR. It
should apply to any 2009 or 2010 Buell 1125 motorcycle. This writeup is provided
for informational purposes only; I accept no responsibility for the results of
applying this information.

## Introduction

The 2009 and 2010 Buell 1125 motorcycles (the 1125R and the 1125CR) are
notorious for their charging system issues. In 2009, the stator output was
increased, and due to the use of a shunt-style regulator, this lead to higher
stator temperatures. Take this increased heat and add the fact that there is
very little air or oil flow to the stator, and it's easy to see why these
stators fail often. Eventually, the heat breaks down the insulation on the
stator windings, causing a short. A shorted winding takes out two of the three
phases, leaving you at roughly one-third electrical capacity.

When I bought my 2009 1125CR, it still had the original factory charging system.
I began to make some preventive upgrades, but the damage was already done. Once
my stator failed, I was lucky enough to have research and discussion from
several other people available to me online. Leveraging this, I overhauled my
charging system. My new system has been rock solid for the past several thousand
miles, and I am confident that the original shortcomings have been fixed, and
that the problem is solved for good on my bike.

Many others have purchased and installed 2008-spec stators and rotors, as those
were reliable. However, this solution didn't appeal to me. My goal was to fix
the 2009-spec system, and maintain the higher charging system output. These
machines tend to run hot and, when running on full blast, the electric cooling
fans can overtax the charging system while idling. Getting caught in traffic
with a motorcycle on a hot day can be stressful enough without worrying about
your charging system!

My solution is similar to one by Gregory Hildstrom. In fact, his extensive
documentation is what inspired me to tackle the task. There is a link to his
writeup, among other useful links, in the _more reading_ section at the bottom.

The overhauled charging system on my machine has been changed in several ways:

* Rotor was replaced with one that sprays oil on the stator
* Stator was rewound with high temperature wire and high temperature epoxy
* Regulator was replaced with a series regulator

## Rotor Replacement

The stock rotor is nothing special. It's pretty typical of similar charging
systems -- just a spinning permanent magnet whose purpose is to induce
electrical current in the stator windings. It forms a pretty close fit with the
stator, and doesn't allow very much oil or air past it at all. For a stator
that's constantly overheated, lack of oil- and air-flow is not your friend.

It turns out that the crankshaft has an oil port where the rotor bolts on. Very
convenient, as this means with a specially machined rotor, we can get some oil
flow to the stator.

Erik Buell Racing, in their very gracious support of the 1125 platform,
developed and released such a rotor! The cost of this rotor is $425, $250 of
which is a core charge that gets refunded upon return of your original rotor.

I purchased one for installation on my machine. I needed to tear it down to do a
valve check anyway, so this gave me the perfect opportunity to kill two birds
with one stone.

![EBR oil spraying rotor](photos/ebrrotor_hole.jpg)

If you look carefully at the photo of the rotor above, you can see the tiny oil
spraying hole in the area circled in yellow. It looks tiny, but it doesn't take
a very big hole to spray enough oil to cool things down.

### Materials Required

When I did this, some parts had to be ordered from Harley Davidson. Now, EBR
offers most, if not all, of these parts.

* EBR modified rotor
* Hardened crankshaft locking tool
* Replacement rotor nut
* Loctite 272 (or Permatex 27200 - same thing, same company, but much easier to
  find) - for rotor nut
* Loctite 648 - for sprag clutch bolts
* Ignition cover gasket - it's only paper, and easy to tear during removal

### Installation

Installation of this new rotor is definitely not for the faint of heart. The nut
that holds it on needs to be heated up for removal, and needs to be installed to
a high torque value.

#### Crankshaft Locking Tool

A special locking tool is required to lock the crankshaft in place while
applying the torque required to remove and install the rotor nut. From time to
time, you can buy one of these from EBR. However, it was out of stock for quite
a while when I was looking for one, and I was ultimately unable to source one. I
attempted to make my own, but it didn't work out very well.

I drilled out an appropriately sized bolt (to protect the threads in the engine
casing), and used an appropriately sized hardened steel rod.

![Drilled out bolt](photos/diy_cranklock_bolt1.jpg)

![Drilled out bolt](photos/diy_cranklock_bolt2.jpg)

![Steel rod](photos/diy_cranklock_rod.jpg)

I was able to get the crankshaft locked with the tool, however, the tool slipped
out of the hole with only around 50 ft-lbs of torque applied. Rotor nut
installation requires 295 ft-lbs, so this was nowhere near enough! _Note: I
wouldn't recommend attempting to DIY this tool, unless you or someone you know
is skilled in toolmaking. I've read reports of others not faring as lucky as I
did, and having the tool break off rather than slip. If you have something break
off in the crankshaft, it **will** ruin your day!_

I had an air impact that was rated for 300 ft-lbs tightening, which is just
beyond the torque spec from EBR. Many people recommend not using an impact
wrench for installing bolts like this. I did, and it worked out fine, but you
will have to weigh the risks involved before deciding to do so yourself.

#### Removal of Rotor Nut and Rotor

Removal of the rotor begins with dissembling the motor to get to the rotor. This
isn't particularly difficult, but there are several steps involved. I'd
recommend consulting a service manual here if you're not familiar with the
process. The rotor nut torquing process has been revised by EBR, however. The
torquing instructions and threadlocker specifications I give below will disagree
with your service manual, but are in fact correct as of this writing.

Since the locking tool I made wouldn't hold enough torque to remove the nut, I
used the impact to remove it. The DIY
locking tool _did_ hold enough to keep the crankshaft still during impact use,
but in retrospect, it was probably a bad idea to continue using the tool in this
manner.

Some folks report being able to remove the nut with very little force and
without needing to heat the nut to release the Loctite already installed. I had
no such luck. I used a small hand-held torch to apply heat to the nut for
several seconds, then hit it with the impact. After going back and forth a
couple of times, it came off. Careful with the heat though -- too much can
affect the magnets in the rotor -- so try and keep it localized to the nut.

After removing the nut, the rotor (and sprag clutch attached to the back) slid
right off the crankshaft.

#### Preparation of New Rotor

The new rotor came bare, so I had to detach the sprag clutch assembly from the
back of the old rotor and transfer it to the new. Just a few bolts are involved
with this. Be sure to apply Loctite to the bolts when installing on the new
rotor. Loctite 648 is recommended here, but I couldn't source any, and used
Permatex 27200 (Loctite 272). This is probably going to make removing these
bolts later, if necessary, a nightmare though.

#### Installation of Rotor and Rotor Nut

Once the splines are lined up properly, the new rotor slides right on the
crankshaft. I cleaned up the crankshaft threads with brake cleaner, and applied
threadlocker, and loosely put the nut on. The recommended torquing procedure is
to tighten to 210 ft-lbs, back the nut off 2 full turns, then tighten to 295
ft-lbs. This is to get the thread locker activated and such. I had to improvise
here, so I lightly torqued the nut on with the impact, backed it off a couple of
turns, then tightened it on. Since my impact was rated for 300 ft-lbs, I let it
work nut on for a couple seconds.

![EBR oil spraying rotor, installed](photos/ebrrotor_installed.jpg)

Afterwards, reassemble the engine, and it's done!

A quick note on the threadlocker: Loctite 272 is recommended. However, this
isn't the easiest thing to find in small quantities. Permatex 27200 is the same
thing, just with a different name. Permatex and Loctite are the same company.

## Stator Rewinding

Unfortunately, when installing the new rotor, I could tell that my stator was
almost toast. It had the tell-tale burnt epoxy and looked in bad shape. So, I
began investigating options for a new stator.

![Original rotor damage, at time of rotor install](photos/stockstator_atrotorinstall.jpg)

There are several options now for having your stator rewound with high quality
materials. When I made the decision to rewind mine myself, there were less
options, and they cost more. Thanks to Gregory Hildstrom's writeup, I was able
to source my wire from the same place he did (and for a similar cost), and
purchase one of the epoxies he discussed.

### Materials Required

* Wire - I purchased the same wire as Hildstrom (AWG 16 size magnet wire with
  double polyimide insulation, good to 240C) I, also, opted to purchase 1000
  feet. Somewhere around 150 feet is required, however, I was quoted a
  significantly lower price when buying in bulk, such that 1000 feet barely cost
  more than the 150 required. The decision to purchase extra turned out to be a
  good one.
* Epoxy - Duralco 4461. This stuff is fairly expensive, though research
  indicates it's quite durable, good at penetrating windings, and is
  electrically resistant properties. It is rated to 500F, which slightly higher
  than the rating of the wire. The epoxy is important for holding the windings
  in place against engine vibration.
* Rescue tape - high temperature, self-fusing silicone tape. I used this as
  wrapping around the junctions where the stator windings hook to the harness.
  It's oil/chemical resistant, electrically insulative, and can withstand high
  temperature.
* Loctite 243 (a.k.a. Permatex 24300) - for the bolts that hold the stator in
  place.

More discussion of wire and epoxy can be found in Hildstrom's writeup (see
_more reading_).

### Re-winding

I won't go into too much detail here, as Hildstrom's writeup (see _more
reading_) already does an excellent job of this.

#### Take One, Failure

My first rewound stator failed. This was due to my windings being messy. I'm
almost embarassed to show pictures...

![Stator rewind, just started](photos/stator_rewind_take1_progress1.jpg)

![Stator rewind, windings complete](photos/stator_rewind_take1_progress2.jpg)

![Stator rewind, epoxied and installed](photos/stator_rewind_take1_progress3.jpg)

I got everything buttoned up, and on the stock regulator, voltage output was
fine.

![Take one: good output!](photos/stator_rewind_take1_volts.jpg)

After the rewind, I bought the CE-605 SB regulator. My first one failed
relatively quickly after installation, and after receiving a replacement, I
started having charging issues. I rode using the stock regulator for a while,
and didn't rewind the stator again until I was preparing for a cross-country
trip.

I took the stator out, and immediately saw why it failed:

![Take one: failure!](photos/stator_rewind_take1_failed2.jpg)

The windings were too messy, and some made contact with the rotor, and
eventually rubbed through. Unfortunately, this took a toll on my new rotor as
well. Rotor is still working fine, it just looks ugly. Next time I have the
motor apart for a valve check/adjustment, I'm going to fill in the damaged
section with epoxy.

![Take one: failure!](photos/stator_rewind_take1_rotordamage.jpg)

The stator lasted several thousand miles before failing, and almost all of that
time was spent on the stock, shunt regulator (I'll discuss this in the regulator
section, but shunt regulators short the stator out to bring it down to the
regulated voltage, so stator is always running at maximum output). The stator,
aside from the damage, still looked brand new, so I'm confident in the wire and
epoxy choice:

![Take one: failed stator still looks new](photos/stator_rewind_take1_failed1.jpg)

#### Take Two, Success!

I rewound another failed stator core, this time taking more care in keeping the
windings neat and compact. It's still not as good as Hildstrom's job, but it did
come out _much_ neater. I'm happy with the result.

![Take two: Stock, burnt out stator](photos/stator_rewind_take2_progress1.jpg)

![Take two: Beginning disassembly](photos/stator_rewind_take2_progress2.jpg)

![Take two: First phase complete](photos/stator_rewind_take2_progress3.jpg)

![Take two: Second phase complete](photos/stator_rewind_take2_progress4.jpg)

![Take two: Third phase almost complete](photos/stator_rewind_take2_progress5.jpg)

![Take two: Third phase complete](photos/stator_rewind_take2_progress6.jpg)

![Take two: Stator complete, epoxy applied](photos/stator_rewind_take2_progress7.jpg)

![Take two: Epoxy cured, stator installed](photos/stator_rewind_take2_progress8.jpg)

I got everything buttoned up, again, and tested it out. Note that the picture
was taken with the bike under high electrical load (hot motor, fans running on
high, high beams on). This is also with the CE-605 SB regulator hooked up,
which works nicely with a properly working stator.

![Take two: Stator under load, fine output](photos/stator_rewind_take2_volts1.jpg)

## New Regulator

The stock regulator used on the 1125 is a shunt regulator. The way it regulates
voltage is by, essentially, shorting the stator out enough to bring voltage down
to the proper value. This means any excess power not being drawn from the
charging system is consumed and thrown away anyhow, effectively running the
stator at maximum output all the time.

Although I am confident that the stator rewind and rotor replacement is enough
to fix the issue, I still wanted to replace the regulator to reduce stator load
as well.

I chose the CE-605 SB. This is a series regulator, which means it regulates
power to the charging system, only conducting enough power to fulfill the
electrical demands. The stator is not shorted out to bleed off any extra power,
meaning the stator is no longer run at full load (unless full load is actually
being drawn), and less heat is generated.

Another option is the Compufire series regulator. However, I must recommend
against purchasing this. The company refuses to discuss use of their regulator
on the 1125 platform, and considers warranty void when installed on these
machines. I've heard reports of at least one person receiving one dead from the
factory, and being left high and dry by the company. Their solution was to sell
him a new one at cost, rather than replacing the failed one outright.

I personally received a faulty CE-605 SB -- it failed shortly after firing up
the bike for the first time after installing it. The company who sold it to me
stood behind the product 100% and quickly replaced it for me. Additionally, I've
heard report from an individual who had to return the regulator to the
manufacturer for a warranty issue, and also received prompt service. In both
cases, it was known that the application of the regulator was on the Buell 1125.

### Materials Required

* CE-605 SB Regulator
* Deutsch DTP04-4P connector (w/ stamped pins, for stator connection)
* Three matching Anderson SB50 connectors (for output to bike harness)
* Techflex mesh wire wrapping

### Installation

I mounted the regulator underneath the tail section. The instructions tell you
to keep it out in direct airflow, however this is the best place I had for
attaching it, and have not had any issues with the regulator staying cool.

![CE-605 SB mounted under tail section](photos/regulator_install1.jpg)

![CE-605 SB mounted under tail section](photos/regulator_install2.jpg)

I used a new Deutsch connector to mate with the stator connector, so as to leave
the stock regulator in place. I needed to cut the harness off the stock
regulator, as it is a non-standard connector, and I did not want to cut the
harness on the bike. I then put an Anderson SB50 connector on the harness, the
leads from the CE-605SB, and on the leads from the stock regulator. This allows
me to swap back to the stock regulator by swapping the two connectors, so if
something happens to the new regulator, I won't be stranded.

The instructions do tell you to wire the regulator straight to the battery.
However, I'd rather not route all of the electrical demands of the bike through
the battery fuse in the long run. I chose to hook it into the harness where the
stock regulator hooked in, to preserve the original electrical design. There's
no issue with the wiring harness, so I saw no need to bypass it.

![CE-605 SB wiring](photos/regulator_install3.jpg)

I also removed the band-aid charging "upgrade harness" from the bike. This uses
a relay to turn off 2/3 of the stator to try and manage heat. This is
incompatible with the CE-605 SB, and is no longer applicable with the oil
spraying rotor.

### Results

Voltage runs a little higher than with the stock regulator. On cool mornings,
I'll see 14.4-14.5 volts (indicated by the cluster, 14.2 indicated by digital
multimeter at the battery). Voltage usually settles in around 14.2 volts
indicated, and will slowly drop and maintain in the mid-13v range during
extended idling when the fans are running on high. Overall, voltages maintain
0.4-0.5 volts higher than stock regulator under most conditions.

## Overall Results

Aside from the stator mishap with my first rewind, this setup has been rock
solid. After rewinding the stator the second time, I proceeded to ride the bike
down the east coast, through Tennessee, Georgia, Florida, and back. I got stuck
in my fair share of traffic, both in cool and in hot weather, and the bike ran
flawlessly through it all.

Unfortunately, someone hit me while riding the 1125, totaling it all out, so I
never did get to evaluate the extremely long term prospects of the charging
system overhaul.

Here's the final timeline for the work I did:

* EBR rotor installed at 12,627 miles.
* Factory stator dead, first re-wind attempt at 12,954 miles.
* First re-wind faulty and dead before 14,505 miles. Second re-wind attempt
  was installed at 14,505 miles.
* Bike totaled at 21,028 miles.

Unfortunately, I wasn't in a good condition to be wrenching on the bike, so I
didn't have the opportunity to check out the stator condition before the
insurance company took the bike. I suspect it was in good condition though.
Voltages were still the same as they were after installing the second stator
re-wind. The second stator spent all of its life with the CE-605 regulator
attached.

## More Reading

Be sure to check out the following for more reading on the topic:

* [Gregory Hildstrom's Modifications] [1]
* [DIY thread on BadWeb] [2]
* [Discussion on rotor replacement] [3]
* [Discussion on stator rewind options] [4]
* [Discussion on Compufire and regulator wiring] [5]
* [Discussion on Compufire vs CE-605 SB] [6]
* [BadWeb 1125 stator forum - plenty more info] [7]

[1]: http://hildstrom.com/projects/buellstator/index.html
[2]: http://www.badweatherbikers.com/buell/messages/290431/674357.html
[3]: http://www.badweatherbikers.com/buell/messages/290431/694256.html
[4]: http://www.badweatherbikers.com/buell/messages/290431/684861.html
[5]: http://www.badweatherbikers.com/buell/messages/290431/664657.html
[6]: http://www.badweatherbikers.com/buell/messages/290431/704732.html
[7]: http://www.badweatherbikers.com/buell/messages/290431/646530.html


text:
# Fastly Compute@Edge

[Fastly's Compute@Edge](https://www.fastly.com/products/edge-compute) offering allows us to build high scale, globally distributed applications and execute code at the edge of Fastly CDN.

Hono also works on Fastly Compute@Edge.

## 1. Install CLI

To use Compute@Edge, you must [create a Fastly account](https://www.fastly.com/jp/signup/) if you don't already have one.
Then, install [Fastly CLI](https://github.com/fastly/cli).

macOS

```
brew install fastly/tap/fastly
```

Follow this link for other OS:

- [Compute@Edge services | Fastly Developer Hub](https://developer.fastly.com/learning/compute/#download-and-install-the-fastly-cli)

## 2. Setup

A starter for Fastly Compute@Edge is available.
Start your project with "create-hono" command.

```
npm create hono@latest my-app
```

Move to `my-app` and install the dependencies.

```
cd my-app
npm i
```

## 3. Hello World

Edit `src/index.ts`:

```ts
// src/index.ts
import { Hono } from 'hono'
const app = new Hono()

app.get('/', (c) => c.text('Hello Fastly!'))

app.fire()
```

## 4. Run

Run the development server locally. Then, access `http://localhost:7676` in your Web browser.

```
npm run dev
```

## 4. Deploy

```
npm run deploy
```

That's all!!

repository: ZerNico/website

branch_name: refs/heads/main

repo_name: ZerNico/website


text:
# PI estimation by Monte Carlo simulation
Project in Web Assembly (mosltly C) to observe the difference between Quasi and Pseudo Random number generation.

![picture](./img/pi_circle_7500_iterations.png)

For demo, click [here](https://leonardoandrade.github.io/montecarlo/)
#### running

1. make all
2. cd docs && python -m SimpleHTTPServer 3000 (or any other static web server)

#### links
This idea is not original, has been implemented several times through the years:

https://curiosity-driven.org/pi-approximation

http://mathfaculty.fullerton.edu/mathews/n2003/montecarlopimod.html

repository: leonardoandrade/montecarlo

repo_name: leonardoandrade/montecarlo


text:
# Proc: Log

Use the logger (logrus) to print the event. This component does not
modify the events in any way. **This can also be used as an OUTPUT component!**

Its main purpose is to be used for debugging and allow us to inspect events
mid-flight.

Example config:

```
{
    "module": "LogProc",
    "level": "info"
}
```

Supported log levels are:

-   `debug`
-   `info`
-   `warn`


text:
# Detailed Local Site Installation Instructions

This is the detailed installation instructions for building the docs locally. You are usually here if you are having problems with the [simple instructions](README.md#build-the-site-locally).

## Packages Prerequisites

Here are the required packages that you will need to build the site. If on something like Ubuntu, for example, you will normally `apt-get install` these. These packages assume an Ubuntu install. You may need `sudo` for these instructions.

First `apt-get update`.

* `apt-get install ruby1.9.3 bundler`
* `apt-get install build-essential zlib1g-dev`
* `apt-get install python-pygments`
* `apt-get install git` # You most likely have this already

## Configuration

The API reference documentation is generated from the HHVM source, so a copy of
that is needed:

Clone the [HHVM repository](https://github.com/facebook/hhvm) to the same parent directory - you might want `--depth=1`

*NOTE*: The configuration and dependency process requires network access, so if you are behind a proxy, take any steps necessary to be able to get through it.

## PHP Dependencies: Composer

We use Composer to manage our PHP library dependencies and to autoload classes.
If you don't have it already, you can download it from
[the Composer website](https://getcomposer.org/).

To install our dependencies and the autoload map in `vendor/`:

```
$ cd user-documentation
user-documentation$ hhvm /path/to/composer.phar install
```

**NOTE**: We try to keep this entire repo typechecker clean. i.e., if you run `hh_client`, you should see `No errors!`. If you are seeing errors in `vendor/`, then first try to run `hhvm composer.phar install` or `hhvm composer install` in the repo to make sure all dependencies are up to date.

**NOTE**: If you add, delete or rename a class in the primary source tree `src/`, you should run `hhvm composer.phar dump-autoload` in order to make the autoload maps refresh correctly; otherwise you will get class not found exceptions.

## Ruby Dependencies: Bundler

We use the GitHub-Flavored-Markdown pipeline to provide a familiar syntax, and SASS to provide CSS files from structured SCSS source.
As these are written in Ruby, dependencies aren't managed by Composer: the
similar Bundler tool is used instead.

If you do not already have a `bundle` executable in your path, either install
Bundler for all users:

```
$ sudo gem install bundler
```

... or, just for yourself:

```
$ gem install --user-install bundler
Fetching: bundler-1.10.6.gem (100%)
WARNING:  You don't have /home/fred/.gem/ruby/1.9.1/bin in your PATH,
    gem executables will not run.
    Successfully installed bundler-1.10.6
    1 gem installed
    Installing ri documentation for bundler-1.10.6...
    Installing RDoc documentation for bundler-1.10.6...
```

If you get a similar `WARNING`, modify your `$PATH` variable to include the
directory mentioned in the error.

You can then install the dependencies for this project:

```
$ cd user-documentation
user-documentation$ bundle --path vendor-rb/
Using i18n 0.7.0
Using json 1.8.2
Using minitest 5.5.1
Using thread_safe 0.3.4
Using tzinfo 1.2.2
Using activesupport 4.2.0
Using charlock_holmes 0.7.3
Using escape_utils 1.0.1
Using mime-types 2.4.3
Using rugged 0.22.0b5
Using github-linguist 4.4.2
Using github-markdown 0.6.8
Using mini_portile 0.6.2
Using nokogiri <IP_ADDRESS>
Using html-pipeline 1.9.0
Using bundler 1.10.6
Bundle complete! 3 Gemfile dependencies, 16 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
```

repository: watashi/user-documentation

gha_license_id: NOASSERTION

repo_name: watashi/user-documentation


text:
# Go WebOS 📺

A small Go library for interaction with webOS enabled TVs. ~Tested on LG webOS TV UH668V (webOS version 05.30.20).~ This is forked from github.com/kaperys/go-webos.

[![Go Report Card](https://goreportcard.com/badge/github.com/kaperys/go-webos)](https://goreportcard.com/report/github.com/kaperys/go-webos)

```go
tv, err := webos.NewTV("<tv-ipv4-address>")
if err != nil {
    log.Fatalf("could not dial TV: %v", err)
}
defer tv.Close()

// the MessageHandler must be started to read responses from the TV
go tv.MessageHandler()

// AuthorisePrompt shows the authorisation prompt on the TV screen
key, err := tv.AuthorisePrompt()
if err != nil {
    log.Fatalf("could not authorise using prompt: %v", err)
}

// the key returned can be used for future request to the TV using the
// AuthoriseClientKey(<key>) method, instead of AuthorisePrompt()
fmt.Println("Client Key:", key)

// see commands.go for available methods
tv.Notification("📺👌")
```

## V1.0.0 Goals:

- [x] make the examples runnable
- [ ] add `Discover` method to search local network for tv (if feasable without extraneous dependencies)
- [x] internalize the Dialer
- [ ] internalize MessageHandler
- [ ] use json.RawMessage for partial decoding of messages instead of github.com/mitchellh/mapstructure
- [ ] maybe switch to easyjson
- [ ] use standard go errors

## Long term goals

I would ideally like to have this on par with [PyWebOSTV](https://github.com/supersaiyanmode/PyWebOSTV) as far as features.

See [examples](examples/) for usage.

repository: robindiddams/go-webos

repo_name: robindiddams/go-webos


text:
---
hrs_structure:
  division: '1'
  volume: '4'
  title: '13'
  chapter: '201'
  section: 201-112
type: hrs_section
tags:
  - Government
menu:
  hrs:
    identifier: HRS_0201-0112
    parent: HRS0201
    name: 201-112 Hawaii television and film development board
weight: 5330
title: Hawaii television and film development board
full_title: 201-112 Hawaii television and film development board
---
**[§201-112] Hawaii television and film development board.** (a) There is established the Hawaii television and film development board. The board shall be attached to the department of business, economic development, and tourism for administrative purposes only. The board shall administer the grant and venture capital investment programs and the Hawaii television and film development special fund established under this part. The board shall also assess and consider the overall viability and development of the television and film industries and make recommendations to appropriate state or county agencies.

(b) The board shall be composed of nine members, four of whom shall be appointed by the governor pursuant to section 26-34, and all of whom shall serve four-year staggered terms. One of the governor's appointments shall be made from a list of nominees submitted by the president of the senate and another appointment shall be made from a list of nominees submitted by the speaker of the house of representatives. The four appointed members shall possess a current working knowledge of the film, television, or entertainment industry. The director of business, economic development, and tourism, and the chairs of the four county film commissions or its equivalent, shall serve as ex officio voting members, who may be represented on the board by designees.

The chairperson and vice chairperson of the board shall be selected by the board by majority vote. Five members shall constitute a quorum, whose affirmative vote shall be necessary for all actions by the board. The members shall serve without compensation but shall be reimbursed for expenses, including travel expenses, necessary for the performance of their duties.

(c) The film industry branch development manager shall serve as the executive secretary of the board.

(d) The board may adopt rules pursuant to chapter 91 to effectuate the purposes of this part. [L 2000, c 285, pt of §2]

repository: SamMade/BlueAndKrabby

repo_name: SamMade/BlueAndKrabby


text:
# Paga Collect Python library
The Paga Collect API allows anyone to initiate a payment request to a third party and automatically get notified when the payment request is fulfilled. This library makes it easier and faster for developers to integrate the API

### 1. Installation
Make sure you have `pip` installed, then run the command below
```sh
pip install pagacollect
```

### 2. Usage
Once installed to use the library see sample code below:
```sh
from pagacollect.paga_collect import Collect

principal = "public_key"
credentials = "private"
hash_key = "hash_key"

collect = Collect(principal, credentials, hash_key, False)
```

### Paga Collect API Operations
Now that you have created a collect api object you easily call its operations

#### Request Payment
Register a new request for payment between a payer and a payee. Once a payment request is initiated successfully, the payer is notified by the platform (this can be suppressed) and can proceed to authorize/execute the payment. Once the payment is fulfilled, a notification is sent to the supplied callback URL. See the callback notification section for more details.

To make a payment request see sample code below:
```sh
payment_request_payload = {
    "referenceNumber": "6020000011z",
    "amount": "100",
    "currency": "NGN",
    "payer": {
        "name": "John Doe",
        "phoneNumber": "07033333333",
        "bankId": "3E94C4BC-6F9A-442F-8F1A-8214478D5D86"
    },
    "payee": {
        "name": "Payee Tom",
        "accountNumber": "1188767464",
        "bankId": "40090E2F-7446-4217-9345-7BBAB7043C4C",
        "bankAccountNumber": "0000000000",
        "financialIdentificationNumber": "03595843212"
    },
    "expiryDateTimeUTC": "2021-05-27T00:00:00",
    "isSuppressMessages": "true",
    "payerCollectionFeeShare": "0.5",
    "recipientCollectionFeeShare": "0.5",
    "isAllowPartialPayments": "true",
    "callBackUrl": "http://localhost:9091/test-callback",
    "paymentMethods": ["BANK_TRANSFER", "FUNDING_USSD"]
}

response = collect.payment_request(payment_request_payload)
```

#### Register Persistent Payment Account

An operation for business to create Persistent Payment Account Numbers that can be assigned to their customers for payment collection.

To create a persistent payment account see sample code below:
```sh
register_persistent_payment_account_payload = {
    "referenceNumber": "test123451",
    "phoneNumber": "07022222222",
    "accountName": "Joh Doe",
    "firstName": "John",
    "lastName": "Doe",
    "email"<EMAIL_ADDRESS>    "accountReference": "22222222222220",
    "financialIdentificationNumber": "22182799077",
    "creditBankId": "3E94C4BC-6F9A-442F-8F1A-8214478D5D86",
    "creditBankAccountNumber":"0000000000",
    "callbackUrl": "http://localhost:9091/test-callback"
}

response = collect.register_persistent_payment_account(register_persistent_payment_account_payload)
```

#### Query Status
Query the current status of a submitted request

To check the status of a submitted request see sample code below:
```sh
status_payload = {"referenceNumber": "82000001109", }

response = collect.get_status(status_payload)
```

#### Query History
Get payment requests for a period between given start and end dates. The period window should not exceed 1 month.

See sample code below:
```sh
history_payload = {
    "referenceNumber": "82000001109",
    "startDateTimeUTC" : "2021-05-13T19:15:22",
    "endDateTimeUTC" : "2021-05-20T19:15:22"
}

response = collect.get_history(history_payload)
```

#### Get Banks
Retrieve a list of supported banks and their complementary unique ids on the bank. This is required for populating the payer (optional) and payee objects in the payment request model.

See usage sample code below:
```sh
banks_payload = {"referenceNumber": "0001109"}

response = collect.get_banks(status_payload)
```

repository: zubairAbubakar/paga-collect-python-lib

repo_name: zubairAbubakar/paga-collect-python-lib


text:
---
layout: post
title: "Groovy (Language) introduction"
excerpt: "A groovy way to use the Java Virtual Machine"
tags: [apple, mac, setup, Go]
shorturl: "https://goo.gl/JoaWV4"
image:
# feature: groovy-intro-1900x254-180k
  feature: https://user-images.githubusercontent.com/300046/27741686-efc74390-5d83-11e7-9f3f-ba4bb43bfbac.png
  credit: PioneerDrama.com
  creditlink: https://www.pioneerdrama.com/searchdetail.asp?pc=GROOVY
comments: true
---
{{ page.excerpt }}

{% include _toc.html %}

This is a hands-on introduction to the Groovy programming langauge.
Effort was taken to sequence topics for faster learning.

Groovy development began in 2003 by James Strachan and Bob McWhirter.
Groovy 1.0 was released in January 2, 2007.

The advantage of Groovy:

1. Can run on a variety of operating systems (Linux, Windows, etc.)
2. Create code faster than Java?
3. Can use Java library classes, such as Grails for web apps
4. Still use JVM (Groovy compiles to Java)

## Social

http://groovy-lang.org
is the Groovy language homepage, which is built from

https://github.com/groovy/groovy-website

It's called "Apache Groovy" because it's an Apache open-source project.
Apache runs conferences on the language. Some notable presentations:

* https://www.youtube.com/channel/UC-Vs_q9uWBlSx5NsDkxoGAQ
   gr8conf.eu
   by<EMAIL_ADDRESS>   @venkat_s  Subramaniam

## Docker Image

   Docker images contain a complete environment:

   https://github.com/groovy/docker-groovy

## Install

### Package Manager

   Formerly known as
   GVM the Groovy enVironment Manager,

   SDKMan.io
   (inspired by RVM and rbenv tools widely used by the Ruby community)
   is a tool for Mac OSX, Linux or Cygwin (Unix-based system) users to manage parallel versions of multiple Software Development Kits. It provides a convenient Command Line Interface (CLI) and API for installing, switching, removing and listing Candidates.

0. Install sdkman by running the following command in your Unix terminal:

curl -s "https://get.sdkman.io" | bash

0. As instructed in the response:

source ~/.sdkman/bin/sdkman-init.sh

0. Use SDK to install the latest version of Grails (this guide uses 3.2.4):

sdk install grails 3.2.4

   https://tutorials.techmytalk.com/2014/07/19/grails-understanding/

0. Choose 'yes' when sdkman prompts you to choose whether to set this version as the default.

0. Verify:

sdk help

   The response reaches out through the internet for version news:

==== BROADCAST =================================================================
* 28/06/17: Kotlin 1.1.3 released on SDKMAN! #kotlin
* 26/06/17: Grails 3.2.11 released on SDKMAN! #grailsfw
* 26/06/17: Grails 3.3.0.RC1 released on SDKMAN! #grailsfw
================================================================================

Usage: sdk <command> [candidate] [version]
       sdk offline <enable|disable>

   commands:
       install   or i    <candidate> [version]
       uninstall or rm   <candidate> <version>
       list      or ls   [candidate]
       use       or u    <candidate> [version]
       default   or d    <candidate> [version]
       current   or c    [candidate]
       upgrade   or ug   [candidate]
       version   or v
       broadcast or b
       help      or h
       offline           [enable|disable]
       selfupdate        [force]
       flush             <candidates|broadcast|archives|temp>

   candidate  :  the SDK to install: groovy, scala, grails, gradle, kotlin, etc.
                 use list command for comprehensive list of candidates
                 eg: $ sdk list

   version    :  where optional, defaults to latest stable if not provided
                 eg: $ sdk install groovy

0. List versions of sdk installed:

sdk version

0. List versions of groovy availble for install:

sdk list groovy

   At the : symbol, press q to quit out or spacebar.

0. See Java:

sdk current java

0. Install Java

sdk install java

0. Install Groovy

sdk install groovy

0. List all that has been installed:

sdk current

   For more, see http://sdkman.io/usage.html

### Install On Mac using HomeBrew

0. Homebrew install on Mac:

brew install groovy

   A sample response on June 2017:

==> Using the sandbox
==> Downloading https://dl.bintray.com/groovy/maven/apache-groovy-binary-2.4.11.zip
######################################################################## 100.0%
==> Caveats
You should set GROOVY_HOME:
  export GROOVY_HOME=/usr/local/opt/groovy/libexec
==> Summary
🍺  /usr/local/Cellar/groovy/2.4.11: 64 files, 27.6MB, built in 10 seconds

   ### Windows

   https://github.com/groovy/groovy-windows-installer

   See http://www.groovy-lang.org/install.html

   ## Verify Install

groovy

   A sample response on June 2017:

error: neither -e or filename provided
usage: groovy [options] [args]
options:
  -a,--autosplit <splitPattern>    split lines using splitPattern (default '\s')
                                   using implicit 'split' variable
  -b,--basescript <class>          Base class name for scripts (must derive from
                                   Script)
  -c,--encoding <charset>          specify the encoding of the files
  -classpath <path>                Specify where to find the class files - must
                                   be first argument
     --configscript <arg>          A script for tweaking the configuration
                                   options
  -cp,--classpath <path>           Aliases for '-classpath'
  -D,--define <name=value>         define a system property
  -d,--debug                       debug mode will print out full stack traces
     --disableopt <optlist>        disables one or all optimization elements.
                                   optlist can be a comma separated list with
                                   the elements: all (disables all
                                   optimizations), int (disable any int based
                                   optimizations)
  -e


text:
[![DOI](https://zenodo.org/badge/406670176.svg)](https://zenodo.org/badge/latestdoi/406670176)

# MODYS: Video analysis

MODYS-video provides a machine learning pipeline to train models to automatically assess dystonia and choreoathetosis of children with dyskinetic cerebral palsy using 2D coordinates of body points extracted from videos. The body coordinates are extraced using DeepLabcut (https://github.com/DeepLabCut/DeepLabCut). The clinical scoring is performed with the Dyskinesia Impairment Scale. Example data are available on zenodo.

![afbeelding](https://user-images.githubusercontent.com/54277291/159797915-6d0b671d-3ae0-4571-9544-891fd0fb1579.png)

## Folder structure
* data
* notebooks
* results
* scr
* tests

## Reading in data
* Download all data from https://doi.org/10.5281/zenodo.5638470 to
the /data folder in this repository.
* Unzip the .zip files.
* You should have a `data/data_stickfigure_coordinates_lying` and `data/data_stickfigure_coordinates_sitting` folder with `.csv` files,
and a file called `data/data_clinical_scoring.xlsx`

## Details Python Code Files (scr)
*	**setting.py**
This file contains the settings for the data
*	**helpers.py:**
This file contains helper functions for reading in data, filtering, normalizing, etc.
*	**statistics.py:**
Functions for applying the different statistics.
*	**features.py:**
Contains functions calculating features and one function reading in all the files and calculating all the features for each file.
*	**ai_func.py:**
Functions for running the AI such as: scaling data, splitting data, running experiments, etc.
*	**ai_models.py:**
Contains multiple Keras models.
*	**plotting.py:**
Functions to create a stick-figure-movie from the XY-data.
*	**data_generators.py:**
Generate data in the right input format for the experiments;
*	**data_selection.py:**
Read the clinical scores and match it to x,y-coordinates; drops if there is no match

## Notebooks (data generation)
* **generator_based_pipeline.ipynb:**
Basic data pipeline example

## Notebooks (machine learning experiments)
 * **experiment-2-different-random-forrest-models.ipynb:**
 Notebook trains random forest regressor models for different clinical outputs (dystonia: arm amplidute, arm duration, leg amplidute, leg duration)
 * **1.1-model-exploration-deep-learning.ipynb:**
 Notebook exploring deep learning to predict dystonia
 * **3.1-basic-deeplearning-lying.ipynb:**
 Notebook first step towards deeplearning

## Notebooks (visualisation)
* **scoring-visualisation.ipynb:**
 Notebook visualize the scoring of the different scorers e.g. scorer 1 vs scorer 2; scorer 1 vs scorer 3
* **feature-visualisation.ipynb:**
 Within this notebook single files (stick figure data) can be visualized
* **experiment-2-results-visualisation.ipynb:**
 Notebook includes different options for visualisation for results of experiment 2 i.e. predicted versus true scores

## Results folder
Results of experiments are stored as xls in the result folder

## Test folder
Automatic test for code changes

## Steps to get started
The steps to run MODYS-video
### Step 1: Data
*	Put your data in the data folder. Example data can be downloaded from https://doi.org/10.5281/zenodo.5638470 see reading in data. The notebooks can read data structured in the same way as the example data. The first 3 characters of the files contain the video number.
### Step 2: Settings
*	Put the right folder. For the example data you do not have change anything.
### Step 3 (optional) Feature - ruwe data visualisation
*  Run the feature-visualisation.ipynb for selected videos, to check data
### Step 4 Run the notebooks
*  Run the machine learning experiments notebooks
*	 Note: The code now uses coordinates of hip, knee and ankle for the lying videos and shoulder, elbow and wrist for the sitting video. This can adaped.
### Step 5: Check results folder
*	Results of predictions are stored in the result folder: scorer, true value and predicted values by model
### Step 6: Visualisation results
*	run the experiment-2-results-visualisation.ipynb. Exmaple plots are given to show the results for expmeriment 2 (random forest regressor)

## Citation
If you want to cite this software, please use the metadata in [CITATION.cff](CITATION.cff)

repository: RehabAUmc/modys-video

gha_language: Jupyter Notebook

repo_name: RehabAUmc/modys-video


text:
# Change Log

## [1.6.2] - 2019-09-13

## Bug fixes

-   Open all pinned document shortcut not working

## [1.6.1] - 2019-09-11

### Bug fixes

-   Click on pinned document not opening the editor
-   Sort function not cause extension fail

## [1.6.0] - 2019-09-05

### Added

-   New feature! - Sync with explorer `Ctrl + Alt + ;`
    -   Sync active document with explorer (vscode removed this feature we loved since 07/2019)

-   Add open related file to editor context menu

## [1.5.0] - 2019-08-02

### Changed

-   Pinned document now save related path
-   Change pinned document json now stored into .vscode folder

## [1.3.2] - 2019-07-08

### Changed

-   Extension now format regex for settings `smartOpen.openRelatedFile.fileFilters` and `smartOpen.openRelatedFile.ignoredFiles`
    -   Now you can use `*`, `.`, `\` as normal
    -   Updated `smartOpen.openRelatedFile.fileFilters` and `smartOpen.openRelatedFile.ignoredFiles` default values
    -   !!! You need update your regex as well.

### Bug fixes

-   Could not remove pinned document if no editor opened

## [1.3.0] - 2019-07-02

### Added

-   New feature! - Pin documents
    -   Pinned documents panel
    -   Editor right click context menu

## [1.2.0] - 2019-06-17

### Added

-   Add built in rule for Javascript, match js, css, less, etc
-   Add built in rule for C# Test, match Test.cs, Tests.cs

### Changed

-   Update built in rule for Angular, now will match files component, service, model

## [1.1.3] - 2019-06-04

### Changed

-   Improve results display order
-   Now the `default rule` will be sort by filename
-   Any rule order larger than 100 will be sort by filename
-   Performance improvements

## [1.1.0] - 2019-06-04

### Added

-   File filters
-   Ignore files or folders

### Changed

-   Significant performance improvements

## [1.0.0] - 2019-06-03

### Added

-   Open related files using shortcut Ctrl + ;
-   Add support for variables {number}, {-number},
-   Built in tag for Angular, Default, C#, C++
-   Allow custom tag to be created and used

repository: SmarterTomato/SmartOpen

gha_language: TypeScript

repo_name: SmarterTomato/SmartOpen


text:
# Free Porn Chat

The project was made *just for fun* and to play around with **sockets**.

The project was highly inspired by **The Net Ninja** youtube series.

## Features
- Absolutely free, absolutely anonymous, absolutly not secure!
- Use `ENTER` to send messages
- Use `UP` and `DOWN` keys to navigate your sent messages
- Use `<iframe>` to sent Youtube and other videos
- Use `HTML` markdown to sent any content!
- Use your `HTML`/`CSS`/`JS` experience to dominate in chat!

## TODO
1. Add commands for:
    * help
    * settings
    * styling (font-size, color)
    * spam (repeat message)
    * ~~history~~
    * change topic, background
    * iframes, links
    * show random porn video
2. Add porn sites support (iframes)
3. ~~Fix emit event 'typing'~~
4. Add feature: paste image from clipboard, drag and drop image to send it
5. Add Angular Material (?)
6. Make some cleaning up and refactoring

license: Unlicense

repository: KENLIEPLAYSPH/free-porn-chat

repo_name: KENLIEPLAYSPH/free-porn-chat


text:
# QueueJava

##  Introduction
This is my own Queue class that is written by me by using either Array List or Linked List. The purpose is to learn more about Queue
##  Version:
-	It is written by using IntelliJ IDEA Community Edition 2019.1.3 x64
-	JDK version 11
##	How to install:
If you use IntelliJ IDEA use new -> Project From Version Control -> Git and paste https://github.com/JimmyYouhei/QueueJava.git
##	How to use:
-	Using the Main class to run and test any method
-	Then you can use either the LinkedListQueue class or the ArrayListQueue:
    -	peek(): look at the object at the first of the queue
    -	dequeue() : remove but not return (intended that way) the object at the first of the queue
    -	enqueue(Object toBeAdded): push an object to the last of the queue
    -	print(): print all the elements
##	Note:
-	Due to the class is written purely for learning purpose so very little Exception handle is expected
##	License
[MIT License](https://github.com/JimmyYouhei/QueueJava/blob/master/LICENSE)

repository: JimmyYouhei/QueueJava

repo_name: JimmyYouhei/QueueJava


text:
# yieldable

The co [yieldable](https://github.com/tj/co/#yieldables) objects currently supported are:

* [x] promises
* [x] thunks (functions)
* [x] array (parallel execution)
* [x] objects (parallel execution)
- generators (delegation)
- generator functions (delegation)

Nested `yieldable` objects are supported, meaning you can nest promises within objects within arrays, and so on!

![](co.png)

## generator

http://wiki.ecmascript.org/doku.php?id=harmony:generators

![](http://wiki.ecmascript.org/lib/exe/fetch.php?w=&h=&cache=cache&media=harmony:es6_generator_object_model_3-29-13.png)

## co-express

- https://github.com/mciparelli/co-express

```
var co = require('co');

module.exports = function wrap(gen) {
  var fn = co.wrap(gen);

  if (gen.length === 4) {
    return function(err, req, res, next) {
      return fn(err, req, res, next).catch(next);
    }
  }

  return function(req, res, next) {
    return fn(req, res, next).catch(next);
  };
};
```

## 参考

- http://tobyho.com/2015/12/27/promise-based-coroutines-nodejs/
- https://github.com/airportyh/coroutines-in-node


text:
# Grocery App
> Keep your grocery list with this simple webapp.

Grocery App is a practice project built with **Flask**. Index is the only page served by the backend, while all other interactions with the app are made via asynchrounous javascript requests to its API endpoints, with data passed through JSON, and HTML editing through javascript.

You can check a live version at [Heroku](https://flask-grocery-app.herokuapp.com).

## Features

* Add a new item to the list
* Edit it's name
* Mark it as done or undone (check/uncheck)
* Remove it from the list

## Contributing

All help is welcome! Is there any feature you'd like to see on this app? What do you think of its design? Are there any flaws you spotted?

Feel free to open a new issue, fork this repository and submit pull requests.

## Links

- Repository: https://github.com/umluizlima/grocery-app
- Issue tracker: https://github.com/umluizlima/grocery-app/issues
- Inspiration and references:
  - [Cassio Botaro's Do Zero ao Deploy](https://github.com/cassiobotaro/do_zero_ao_deploy)
  - [Bruno Rocha's What The Flask](http://pythonclub.com.br/what-the-flask-pt-1-introducao-ao-desenvolvimento-web-com-python.html)
  - [yymm's Flask VueJS examples](https://github.com/yymm/flask-vuejs)

## Licensing

This project is licensed under MIT license.

repository: umluizlima/grocery-app

repo_name: umluizlima/grocery-app


text:
# MatrixProductPCA

## Overview
We consider the following problem: let `A` and `B` be two matrices of size d-by-n (assumed too large to fit in main memory), the goal is to find a rank-r approximation of their product A^TB using a few passes over the data. A naive way is to compute A^TB first, and then perform truncated SVD. This algorithm suffers from O(n^2 d) time and O(n^2) memory and is hard to scale in the large-scale setting. An alternative option is to directly run power method without explicitly computing the product. This requires to access the data matrices O(r) times and potentially incur a huge disk IO overhead.

For this problem we present Spark implementations for two pass-efficient algorithms: `LELA` and `OnePassPCA`. `LELA` is a two-pass algorithm, proposed by S. Bhojanapalli et al. in their paper [Tighter low-rank approximation via sampling the leveraged elements][LELA]. `OnePassPCA`, as its name suggests, is a one-pass algorithm, and hence can be used when the matrices are coming from live data streams. It implements the algorithm `SMP-PCA` (which stands for Streaming Matrix Product PCA) proposed in our paper [Single Pass PCA of Matrix Prodcuts][1passLELA].

__Note__: Both of `OnePassPCA` and `SMP-PCA` refer to the same single-pass algorithm. `OnePassPCA` is the old name.

The directory follows a typical layout: the source file is located under `/src/main/scala`

Here are two flow diagrams illustrating `LELA` (upper) and `OnePassPCA` (lower).

__Note__: 1) For ease of computation, `A` and `B` are stored as a single RDD[index,(blockMatrixOfA, blockMatrixOfB)]. The RDDs are stored in a slightly different way: `LELA` stores row blocks while `OnePassPCA` stores column blocks. 2) [SRHT][srht] is implemented as the sketching step in `OnePassPCA`. It requires O(ndlogd) complexity, independent of the sketching size.

Current version: Aug 10, 2016.

[LELA]: https://arxiv.org/abs/1410.3886
[srht]: https://arxiv.org/abs/1011.1595
[1passLELA]: https://arxiv.org/abs/1610.06656

## Synthetic experiments
We now present simulation results on a 150GB synthetic example: let n=d=100000, r=5, the matrices `A` and `B` are generated as `DG`, where `G` has entries independently drawn from standard Gaussian distribution and `D` is a diagonal matrix with D_ii = 1/i. Other parameters are set as #RDD partitions=80, #samples = 2nrlogn, sketching size = 2000, and #ALS iterations = 10.

We run Spark-1.6.2 on an Amazon EC2 cluster with two [m3.2xlarge][aws] instances. We use the [spark-ec2][ec2] script to lauch clusters. The results are shown in the following table. Here we compare the relative spectral norm error, which is calculated as ||A^TB- UV^T||/||A^TB||.

|    Methods |  Error    |  Runtime |
|----------- |-----------|----------|
|  Exact SVD |  0.0271   |  23 hrs  |
|    LELA    |  0.0274   |  56mins  |
| OnePassPCA |  0.0280   |  34mins  |

__Note__: 1) For `Exact SVD`, we adapt the source code of private object [EigenValueDecomposition][SVD] for our setting: compute B^TAA^TBv distributedly and send it to ARPACK's dsaupd to compute the top eigenvalues and eigenvectors. We set tol=1e-5 as the convergence tolerance. 2)  Sometimes we will encounter the error `"Remote RPC client disassociated"`. The exact cause is still unknown.

[SVD]:https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/mllib/linalg/EigenValueDecomposition.scala

The following figure illustrates the runtime breakdown on clusters of 2, 5, and 10 nodes. Each node is an [m3.2xlarge][aws] instance. We see that the speedup achieved by OnePassPCA is more prominent for small clusters (possibly due to the increasing spark overheads at larger clusters, see [this paper][ov] for more explanation on spark overheads).

[aws]:https://aws.amazon.com/ec2/pricing/on-demand/
[ec2]:http://spark.apache.org/docs/1.6.2/ec2-scripts.html
[ov]: https://arxiv.org/abs/1607.01335

## How to run our code?
There are two ways to run in Spark: `spark-shell` or `spark-submit`.

### spark-shell
Launch the spark-shell (make sure your Spark is [configured][sparkConfig] properly), and then copy and paste our source code in the terminal.
[sparkConfig]: http://spark.apache.org/docs/latest/configuration.html

### spark-submit
Build the JAR packge using `sbt package`. The generated JAR package is located under `/target/scala-2.10` Then copy the JAR pacakge to YOU_SPARK_HOME, and run application using spark-submit.

For example, the following scripts will run spark locally on 2 cores with memory 2g, with parameters #colns=5000, #rows=5000, rank=5, partitions=2, sketching size=1000, ALS iterations=10, ALS lambda=0, #samples=2nrlogn.

```$bin/spark-submit --class "LELA_ATB" --master local[2] --driver-memory 2g lela_2.10-1.0.jar 5000 5000 5 2 10 0 2```

```$bin/spark-submit --class "OnePassPCA" --master local[2] --driver-memory 2g onepasspca_2.10-1.0.jar 5000 5000 5 2 1000 10 0 2```

## Matlab implementation
We also provide Matlab code for the two algorithms. Note that the provided Matlab code uses standard JL (Gaussian matrix) for the sketching step, while our Spark code implementes Hadamard sketch ([SRHT][srht]) which runs faster.

repository: wushanshan/MatrixProductPCA

gha_language: Scala

repo_name: wushanshan/MatrixProductPCA


text:
DBCLI : a CLI utility for DBA (Oracle/DB2)
=====================================================
[![Licence](http://img.shields.io/badge/Licence-MIT-brightgreen.svg)](https://en.wikipedia.org/wiki/MIT_License)
[drag]:help.gif
![][drag]

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

DBCLI is a portable database command line utility, for DBA or application support to easily manage and execute their common scripts, similar to database built-in CLI tools but is more flexible.

It is  developed in Lua language, and bridges to JDBC in order to operate database.

It is designed to support multiple databases, and includes 2 types of modules, one is the public module whose functions are visible across all kinds of databases, and another one is the database-specific module.

Currently only public and Oracle and DB2 functions are developed, and only support windows platform.

It is not aim to support all features of the existing CLI utilities that embedded by the specific database(`Oracle SQL*Plus`, `DB2 CLP`, etc), but to provide the features other than those tools:

* Pretty-print of the select statement and the flexible control of the grid layouts(see set command)
* Automatically generate help documents for customized SQL/shell/etc scripts.
* The `alias` command to reduce the frequent inputs
* The powerful `snap` and `ora` commands as the replacement of the standard CLI scripts, so that DBA is able to quickly define and execute the SQL templates with the smallest input
* Support SSH operations
* Provide the graph charts of the database performance
* Easy to extend, modify or deploy, because most of the source code is not required to compile

Build and Configuration
-----------------------
DBCLI does not require compile, but depends on JRE 1.7+. Directly click `Download ZIP` and extract.

Branch `With-JRE` contains the shrinking JRE bundle, if you don't have JRE installed, you may switch to that branch to download. Due to the region and charset differences, this JRE bundle is not guaranteed to work well.

###Configure terminal window
To avoid the word wrap in the terminal window which affects the print layout, following settings are recommended in Windows command window:

* In the `Layout` tab, set buffer width and buffer height as `500+`
* In the `Font` tab, change the font size as smaller value.

###Configure environment
Before running dbcli, make sure that you have installed JRE 1.7+ in your local PC. If you are using the version of "With-JRE" branch, this step can be skipped.

Create file `init.cfg` under the "data" directory with following content:

    SET JRE_HOME=<JRE HOME>
    SET TNS_ADM=<location of tnsnames.ora>

Of which `TNS_ADM` is optional unless you need to connect Oracle via tnsnames.ora, or may also refer to `init_sample.cfg` for more settings. An example is:

    SET JRE_HOME=d:\soft\java
    SET TNS_ADM=d:\Soft\InstanceClient\network\admin

###Launch DBCLI Console
After the above configurations, you are able to start DBCLI by executing `dbcli.bat` or `bin\ConsoleZ\Console.exe`.

`dbcli.bat` also supports arguments in `"<command>=<args>"` format, all available commands can be found by typing `help` or `help -a`.

For example: `dbcli.bat "connect=tiger/scott@orcl"`

###Switch Database Platform
DBCLI supports multiple database platforms(Oracle,db2,etc), default is `Oracle`.

To permanently change the preferred platform other than `Oracle`, run `set -p <platform>` after launching the console.

Without the `-p` option, the change only takes affect on current console window. Type `set database` for more available options.

Quick Start
-----------------------
Below are some common use of the utility:

    1. "conn" or "connect" to connect to the database with or without installing Oracle client, and "reconn"  to re-connect.
    2. "login" command to connect to the db without password via the account that has been connected before.
    3. Execute SQL statements which should match the database syntax, similar to SQL*Plus.
    4. "ora","show","sys" commands to execute pre-defined scripts. i.e., ora ashtop, ora actives
    5. "alias" command which is similar to the Linux command
    6. "set" command to configure the shell environment
    7. 'q' or CTRL + D or CTRL + C to abort running command
    8. "help" or "help -a" to see other available commands.

References
-----------------------
The project depends on some binary files of open-source projects, the binaries have been included into this project.
Below is the list:

JLine2      : (BSD)  https://github.com/jline/jline2
luajit v2.1 : (MIT)  http://luajit.org/
jnlua       : (MIT)  https://github.com/hyee/JNLuaJIT(based on http://jnlua.googlecode.com/)
OpenCSV     : (MIT)  https://github.com/hyee/OpenCSV(based on opencsv.sourceforge.net)
ConsoleZ    : (GNU)  https://github.com/cbucher/console
MessagePack : (MIT)  https://github.com/fperrad/lua-MessagePack (pure lua)
dygraphs    : (MIT)  https://github.com/danvk/dygraphs
JSch        : (BSD)  http://www.jcraft.com/jsch/
ANSICON     : (ZLIB) https://github.com/adoxa/ansicon
PSCP        : (MIT)  http://www.putty.org/

Besides, some SQL scripts are from internet.

About ANSICON
-----------------------
`ANSICON` provides more ANSI escape features than JLine, especially when running bash commands(i.e.: top) via SSH.

If you have concern on `ANSICON`, please remove it from bin, and edit `data\init.cfg` to add line `set ANSICON_CMD=`

repository: gitter-badger/dbcli

repo_name: gitter-badger/dbcli