text:
# Palmtree

Unofficial Android client for [Naamapalmu.com](http://naamapalmu.com) - developed because a native implementation always beats the website (usually). Due to the lack of an API, Jsoup is used to scrape data from the website. We're also using libraries and frameworks that are all the hype in the Android community - like RxJava. With this project I also wanted to try out a less-known MVP library called [ThirtyInch](https://github.com/grandcentrix/ThirtyInch): it turned out to be quite nice and no doubt I'll be using it in other projects as well.

You are free to submit issues, pull requests or just learn from the code. Sometime in the future after this app will not result in a suspension from Google Play, you'll be able to download the app on your device and be amazed at the quality of Finnish memes.

![Screenshot][ss1] ![Screenshot][ss2]

### Features for users:

* Browse images and videos from Naamapalmu.com seamlessly
* With over 1,500 pages worth of content, you'll be entertained for... forever
* Customize to your liking: change the theme, default category and more!

### License

    Copyright 2016 Santeri Elo

    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.

[ss1]: http://i.imgur.com/ZtlNNrRl.png
[ss2]: http://i.imgur.com/FW3fgPNl.png

repository: iffa/palmtree

repo_name: iffa/palmtree


text:
XEMACS-PACKAGES.ECLASS
Section: eclass-manpages (5)
Updated: Sep 2020
Index Return to Main Contents
NAME
xemacs-packages.eclass - Eclass to support elisp packages distributed by XEmacs.
DESCRIPTION
This eclass supports ebuilds for packages distributed by XEmacs.
ECLASS VARIABLES
XEMACS_PKG_CAT (REQUIRED)
The package category that the package is in. Can be either standard, mule, or contrib.
XEMACS_EXPERIMENTAL
If set then the package is downloaded from the experimental packages repository, which is the staging area for packages upstream. Packages in the experimental repository are auto-generated from XEmacs VCS, so they may not be well-tested.
MAINTAINERS
<EMAIL_ADDRESS>REPORTING BUGS
Please report bugs via https://bugs.gentoo.org/
FILES
xemacs-packages.eclass
SEE ALSO
ebuild(5)
https://gitweb.gentoo.org/repo/gentoo.git/log/eclass/xemacs-packages.eclass
Index
NAME
DESCRIPTION
ECLASS VARIABLES
MAINTAINERS
REPORTING BUGS
FILES
SEE ALSO
This document was created by man2html, using the manual pages.
Time: 00:27:03 GMT, October 11, 2020

branch_name: refs/heads/main

extension: md

gha_language: HTML

license_type: permissive


text:
# PairRDDFunctions

`PairRDDFunctions` is an extension of [RDD](RDD.md) API for extra methods for key-value RDDs (`RDD[(K, V)]`).

`PairRDDFunctions` is available in RDDs of key-value pairs via Scala implicit conversion.

##  saveAsNewAPIHadoopFile

```scala
saveAsNewAPIHadoopFile(
  path: String,
  keyClass: Class[_],
  valueClass: Class[_],
  outputFormatClass: Class[_ <: NewOutputFormat[_, _]],
  conf: Configuration = self.context.hadoopConfiguration): Unit
saveAsNewAPIHadoopFile[F <: NewOutputFormat[K, V]](
  path: String)(implicit fm: ClassTag[F]): Unit
```

`saveAsNewAPIHadoopFile` creates a new `Job` ([Hadoop MapReduce]({{ hadoop.api }}/org/apache/hadoop/mapreduce/Job.html)) for the given `Configuration` ([Hadoop]({{ hadoop.api }}/org/apache/hadoop/conf/Configuration.html)).

`saveAsNewAPIHadoopFile` configures the `Job` (with the given `keyClass`, `valueClass` and `outputFormatClass`).

`saveAsNewAPIHadoopFile` sets `mapreduce.output.fileoutputformat.outputdir` configuration property to be the given `path` and [saveAsNewAPIHadoopDataset](#saveAsNewAPIHadoopDataset).

##  saveAsNewAPIHadoopDataset

```scala
saveAsNewAPIHadoopDataset(
  conf: Configuration): Unit
```

`saveAsNewAPIHadoopDataset` creates a new [HadoopMapReduceWriteConfigUtil](../HadoopMapReduceWriteConfigUtil.md) (with the given `Configuration`) and [writes the RDD out](../SparkHadoopWriter.md#write).

`Configuration` should have all the relevant output params set (an [output format]({{ hadoop.api }}/org/apache/hadoop/mapreduce/OutputFormat.html), output paths, e.g. a table name to write to) in the same way as it would be configured for a Hadoop MapReduce job.

##  groupByKey and reduceByKey

```scala
reduceByKey(
  func: (V, V) => V): RDD[(K, V)]
reduceByKey(
  func: (V, V) => V,
  numPartitions: Int): RDD[(K, V)]
reduceByKey(
  partitioner: Partitioner,
  func: (V, V) => V): RDD[(K, V)]
```

`reduceByKey` is sort of a particular case of [aggregateByKey](#aggregateByKey).

You may want to look at the number of partitions from another angle.

It may often not be important to have a given number of partitions upfront (at RDD creation time upon spark-data-sources.md[loading data from data sources]), so only "regrouping" the data by key after it is an RDD might be...the key (_pun not intended_).

You can use `groupByKey` or another `PairRDDFunctions` method to have a key in one processing flow.

```scala
groupByKey(): RDD[(K, Iterable[V])]
groupByKey(
  numPartitions: Int): RDD[(K, Iterable[V])]
groupByKey(
  partitioner: Partitioner): RDD[(K, Iterable[V])]
```

You could use `partitionBy` that is available for RDDs to be RDDs of tuples, i.e. `PairRDD`:

```scala
rdd.keyBy(_.kind)
  .partitionBy(new HashPartitioner(PARTITIONS))
  .foreachPartition(...)
```

Think of situations where `kind` has low cardinality or highly skewed distribution and using the technique for partitioning might be not an optimal solution.

You could do as follows:

```scala
rdd.keyBy(_.kind).reduceByKey(....)
```

or `mapValues` or plenty of other solutions. _FIXME_

##  combineByKeyWithClassTag

```scala
combineByKeyWithClassTag[C](
  createCombiner: V => C,
  mergeValue: (C, V) => C,
  mergeCombiners: (C, C) => C)(implicit ct: ClassTag[C]): RDD[(K, C)] // <1>
combineByKeyWithClassTag[C](
  createCombiner: V => C,
  mergeValue: (C, V) => C,
  mergeCombiners: (C, C) => C,
  numPartitions: Int)(implicit ct: ClassTag[C]): RDD[(K, C)] // <2>
combineByKeyWithClassTag[C](
  createCombiner: V => C,
  mergeValue: (C, V) => C,
  mergeCombiners: (C, C) => C,
  partitioner: Partitioner,
  mapSideCombine: Boolean = true,
  serializer: Serializer = null)(implicit ct: ClassTag[C]): RDD[(K, C)]
```

`combineByKeyWithClassTag` creates an [Aggregator](Aggregator.md) for the given aggregation functions.

`combineByKeyWithClassTag` branches off per the given [Partitioner](Partitioner.md).

If the input partitioner and the RDD's are the same, `combineByKeyWithClassTag` simply [mapPartitions](spark-rdd-transformations.md#mapPartitions) on the RDD with the following arguments:

* Iterator of the [Aggregator](Aggregator.md#combineValuesByKey)

* `preservesPartitioning` flag turned on

If the input partitioner is different than the RDD's, `combineByKeyWithClassTag` creates a [ShuffledRDD](ShuffledRDD.md) (with the `Serializer`, the `Aggregator`, and the `mapSideCombine` flag).

###  Usage

`combineByKeyWithClassTag` lays the foundation for the following transformations:

* aggregateByKey
* combineByKey
* countApproxDistinctByKey
* foldByKey
* groupByKey
* reduceByKey

###  Requirements

`combineByKeyWithClassTag` requires that the `mergeCombiners` is defined (not-``null``) or throws an `IllegalArgumentException`:

```text
mergeCombiners must be defined
```

`combineByKeyWithClassTag` throws a `SparkException` for the keys being of type array with the `mapSideCombine` flag enabled:

```text
Cannot use map-side combining with array keys.
```

`combineByKeyWithClassTag` throws a `SparkException` for the keys being of type `array` with the partitioner being a [HashPartitioner](HashPartitioner.md):

```text
HashPartitioner cannot partition array keys.
```

###  Example

```text
val nums = sc.parallelize(0 to 9, numSlices = 4)
val groups = nums.keyBy(_ % 2)
def createCombiner(n: Int) = {
  println(s"createCombiner($n)")
  n
}
def mergeValue(n1: Int, n2: Int) = {
  println(s"mergeValue($n1, $n2)")
  n1 + n2
}
def mergeCombiners(c1: Int, c2: Int) = {
  println(s"mergeCombiners($c1, $c2)")
  c1 + c2
}
val countByGroup = groups.combineByKeyWithClassTag(
  createCombiner,
  mergeValue,
  mergeCombiners)
println(countByGroup.toDebugString)
/*
(4) ShuffledRDD[3] at combineByKeyWithClassTag at <console>:31 []
 +-(4) MapPartitionsRDD[1] at keyBy at <console>:25 []
    |  ParallelCollectionRDD[0] at parallelize at <console>:24 []
*/
```


text:
# Rasa-Chatbot

# Problem Statement

An Indian startup named 'Foodie' wants to build a conversational bot (chatbot) which can help users discover restaurants across several Indian cities. You have been hired as the lead data scientist for creating this product.

The main purpose of the bot is to help users discover restaurants quickly and efficiently and to provide a good restaurant discovery experience. The project brief provided to you is as follows.

The bot takes the following inputs from the user:

-   **City:**  Take the input from the customer as a text field. For example:

    Bot: In which city are you looking for restaurants?

    User: anywhere in Delhi

**Important Notes:**

-   Assume that Foodie works  **only in Tier-1 and Tier-2 cities**. You can use the  [current HRA classification of the cities from here](http://en.wikipedia.org/wiki/Classification_of_Indian_cities). Under the section 'current classification' on this page, the table categorizes cities as X, Y and Z. Consider 'X ' cities as tier-1 and 'Y' as tier-2.
-   The bot should be able to  **identify common synonyms**  of city names, such as Bangalore/Bengaluru, Mumbai/Bombay etc.

Your chatbot should provide results for tier-1 and tier-2 cities only, while for tier-3 cities, it should reply back with something like "We do not operate in that area yet".

-   **Cuisine Preference:**  Take the cuisine preference from the customer. The bot should list out the following  **six cuisine categories**  (Chinese, Mexican, Italian, American, South Indian & North Indian) and the customer can select any one out of that. Following is an example for the same:

    Bot: What kind of cuisine would you prefer?

    -   Chinese
    -   Mexican
    -   Italian
    -   American
    -   South Indian
    -   North Indian

    User: I’ll prefer Italian!

-   **Average** **budget for two people:**  Segment the price range (average budget for two people) into  **three price categories**: lesser than 300, 300 to 700 and more than 700. The bot should ask the user to select one of the three price categories. For example:

    Bot: What price range are you looking at?

    -   Lesser than Rs. 300
    -   Rs. 300 to 700
    -   More than 700

    User: in range of 300 to 700

While showing the results to the user, the bot should display the  **top 5 restaurants**  in a  **sorted order**  (descending) of the average Zomato user rating (on a scale of 1-5, 5 being the highest). The  **format should be**: {restaurant_name} in {restaurant_address} has been rated {rating}.

Finally, the bot should ask the user whether he/she wants the details of the  **top 10 restaurants on email**. If the user replies 'yes', the bot should  **ask for user’s email id**  and then send it over email. Else, just reply with a 'goodbye' message. The mail should have the following details for each restaurant:

-   Restaurant Name
-   Restaurant locality address
-   Average budget for two people
-   Zomato user rating

## **Goals of this Project**

In this project, you will build a chatbot for ‘Foodie’

license: MIT

repository: aniketbangar/Rasa-Chatbot

repo_name: aniketbangar/Rasa-Chatbot


text:
# Merlin 3 protocol documentation

## Changes from merlin 2

The communication protocol was redesigned between merlin 2 and 3. Answers have
the same format, but merlin is no longer invoked as an asynchronous process: a
new merlin process is started for each query.  Under the hood, merlin will make
its best to manage resources in an efficient way (via a resident process called
*ocamlmerlin-server*).

In other word, editor modes no longer have to do process management.

Finally, commands no longer maintain state on merlin side. In previous
versions, buffer specific settings (compiler flags, findlib packages, syntax
extensions, ...) were set by calling the appropriate commands.  State was split
between merlin and the editor, which was hard to track and could cause
desynchronization.

In this version, all this settings are passed on the command line. Arguments
look a lot like the ocaml compiler ones.

Try calling:
- `ocamlmerlin single -help` for general information
- `ocamlmerlin single -flags-help` for a detailed list of accepted flags
- `ocamlmerlin single -commands-help` for a list of supported commands

### Backward compatibility

This change is made in a backward compatible way: sessions that worked with
merlin 2 should give the same answer with merlin 3.
This new protocol is only enabled if a command is passed on the commandline.

Two binaries are distributed: `ocamlmerlin` and `ocamlmerlin-server`.
`ocamlmerlin` is a lightweight wrapper that will call the server in the way it
determined to be appropriate.

In simple cases, a new instance of ocamlmerlin-server is ran for each query.  A
more efficient but more complex setup is to reuse an existing instance. The
wrapper will take care of that transparently.

`ocamlmerlin` is the only binary one should execute. `ocamlmerlin-server` will
be used by the wrapper if necessary and should never be executed manually.

The first argument passed to `ocamlmerlin` determines how merlin will behave:

- `old-protocol` executes the merlin frontend from previous version.  It is a
  top level reading and writing commands in a JSON form.

- `single` is a simpler frontend that reads input from stdin, processes a
  single query and outputs result on stdout.

- `server` works like `single`, but uses a background process to speedup
  processing.

If the first argument is not one of these, Merlin fallbacks to `old-protocol`
for compatibility. The new protocol is enabled only with `single` and `server`.

Finally, `ocamlmerlin server stop-server` is a special case to shutdown the
background server, if it is running.

During development or debugging of the editor mode, one can use the single mode
and switch to server mode for deployment: visible behavior shouldn't differ,
the merlin server will be managed automatically.

## Getting started

You can play with Merlin from the commandline. This can give you a feeling of
how Merlin could be driven from an editor:

```shell
$ cat test.ml
let x = 5
let y = 3.0 *. x
$ ocamlmerlin single type-enclosing -position '1:5' -filename test.ml < test.ml
{
  "class" : "return",
  "value" : [
    {
      "tail" : "no",
      "end" : {
        "line" : 1,
        "col" : 5
      },
      "type" : "int",
      "start" : {
        "line" : 1,
        "col" : 4
      }
    }
  ]
}
$ ocamlmerlin single complete-prefix -prefix 'List.m' -position '2:14' -filename test.ml < test.ml
{
  "class" : "return",
  "value" : {
    "entries" : [
      {
        "info" : "",
        "name" : "map",
        "kind" : "Value",
        "desc" : "('a -> 'b) -> 'a list -> 'b list"
      },
      {
        "info" : "",
        "name" : "map2",
        "kind" : "Value",
        "desc" : "('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list"
      },
      {
        "name" : "mapi",
        "info" : "",
        "desc" : "(int -> 'a -> 'b) -> 'a list -> 'b list",
        "kind" : "Value"
      },
      {
        "name" : "mem",
        "info" : "",
        "desc" : "'a -> 'a list -> bool",
        "kind" : "Value"
      },
      ...
    ],
    "context" : null
  }
}
$ ocamlmerlin single errors -filename test.ml < test.ml
{
  "class" : "return",
  "value" : [
    {
      "message" : "Unbound value List.m",
      "valid" : true,
      "end" : {
        "line" : 2,
        "col" : 14
      },
      "sub" : [],
      "type" : "error",
      "start" : {
        "col" : 8,
        "line" : 2
      }
    }
  ]
}
```

## Anatomy of command line arguments

Merlin command line looks like:

```shell
$ ocamlmerlin <single|server> <command-global-and-compiler-flags> < ml-source.ml
```

Command flags are described below. Global and compilers flags are described by
`ocamlmerlin single -flags-help`.

## Answers

Merlin answers always have the same shape:

```javascript
{
  "class": "return" | "failure" | "error" | "exception",
  "value": <defined-by-class-and-request>,
  "notifications": string list
}
```

If processing succeeded, class is "return" and "value" is defined by the
command. Otherwise, value is a string:
- "exception" means something bad happened to Merlin, you should fill a bug
  report
- "failure" means that Merlin couldn't understand your request, maybe there is
  a typo, an argument missing, etc.
- "error" means Merlin couldn't process the query because of some problem with
  the setup: wrong OCaml version, missing file, etc.

Notifications are messages to be reported to the user. For instance if there is
a typo in the `.merlin` file, Merlin will generate a notification then ignore
the error and continue processing.

## Commands

### `case-analysis -start <position> -end <position>`

       -start <position>  Where analysis starts
         -end <position>  Where analysis ends

When the range determined by (-start, -end) positions is an expression,
this command replaces it with [match expr with _] expression where a branch is introduced for each immediate value constructor of the type that was determined for expr.
When it is a variable pattern, it is further expanded and new branches are introduced for each possible immediate constructor of this variable.
The return value has the shape `[{'start': position, 'end': position}, content]`, where content is string.

### `complete-prefix -position <position> [ -doc <bool> ] -prefix <string> [ -types <bool> ]`

    -position <position>  Position to complete
             -doc <bool>  Add docstring to entries (default is false)
        -prefix <string>  Prefix to complete
           -types <bool>  Report type information (default is true)

This functions completes an identifier that the user started to type.
It returns a list of possible completions.
With '-types y' (default), each completion comes with type information.
With '-doc y' it tries to lookup OCamldoc, which is slightly more time consuming.

The result has the form:
```javascript
{
  'context': (null | ['application',{'argument_type': string, 'labels': [{'name':string,'type':string}]}]),
  'entries': [{'name':string,'kind':string,'desc':string,'info':string}]
}
```

Context describe where completion is occurring. Only application is distinguished now: that's when one is completing the arguments to a function call. In this case, one gets the type expected at the cursor as well as the other labels.

Entries is the list of possible completion. Each entry is made of:
- a name, the text that should be put in the buffer if selected
- a kind, one of `'value'`, `'variant'`, `'constructor'`, `'label'`, `'module'`, `'signature'`, `'type'`, `'method'`, `'#'` (for method calls), `'exn'`, `'class'`
- a description, most of the time a type or a definition line, to be put next to the name in completion box
- optional information which might not fit in the completion box, like signatures for modules or documentation string.

### `construct -position <position> [ -with-values <none|local> -depth <int> ]`

    -position <position>      Position where construct should happen
    -with-values <none|local> Use values from the environment
                              (experimental, defaults to none)
    -depth <int>              Depth of the search (defaults to 1)

When the position determined by `-position` is a hole (`_`), this command
  returns a list of possible terms that could replace it given its type.
When `-with-values` is set to local, values in the current environment will be
  used in the constructed terms. This feature is still under development.

### `document -position <position> [ -identifier <string> ]`

    -position <position>  Position to complete
    -identifier <string>  Identifier

Returns OCamldoc documentation as a string.
If `-identifier ident` is specified, documentation for this ident is looked up from environment at `-position`.
Otherwise, Merlin looks for the documentation for the entity under the cursor (at `-position`).

### `enclosing -position <position>`

    -position <position>  Position to complete

Returns a list of locations `{'start': position, 'end': position}` in increasing size of all entities surrounding the position.
(In a lisp, this would be the locations of all s-exps that contain the cursor.)

### `errors`

Returns a list of errors in current buffer.
The value is a list where each item as the shape:

```javascript
{
'start' : position,
'end'   : position,
'valid' : bool,
'message' : string,
'sub' : sub_error list,
'type'  : ('type'|'parser'|'lexer'|'env'|'warning'|'unknown')
}

sub_error ::=
{
  'start'   : position,
  'end'     : position,
  'message' : string
}
```

`start` and `end` are omitted if error has no location (e.g. wrong file format), otherwise the editor should probably highlight / mark this range.
`type` is an attempt to classify the error.
`valid` is here mostly for informative purpose. It reflects whether Merlin was expecting such an error to be possible or not, and is useful for debugging purposes.
`message` is the error description to be shown to the user.
`sub` is an experimental extension to put more detailed information about type errors (for instance the location of the field that mismatches between an interface and an implementation).

### `expand-prefix -position <position> -prefix <string> [ -types <bool> ]`

    -position <position>  Position to complete
        -prefix <string>  Prefix to complete
           -types <bool>  Report type information (default is false)

The function behaves like `complete-prefix`, but it also handles partial, incorrect, or wrongly spelled prefixes (as determined by some heuristic).
For instance, `L.ma` can get expanded to `List.map`. This function is a useful fallback if normal completion gave no results.
Be careful that it always return fully qualified paths, whereas normal completion only completes an identifier (last part of a module path).

### `extension-list [ -status <all|enabled|disabled> ]`

-status <all|enabled|disabled>  Filter extensions

List all known / currently enabled / currently disabled extensions as a list of strings.

### `findlib-list`

Returns all known findlib packages as a list of string.

### `flags-list`

Returns supported compiler flags.The purpose of this command is to implement interactive completion of compiler settings in an IDE.

### `holes`

This command will return the ordered list of the positions and types of all
holes in the current document.

### `jump -target <string> -position <position>`

        -target <string>  Entity to jump to
    -position <position>  Position to complete

This command can be used to assist navigation in a source code buffer.
Target is a string that can contain one or more of the 'fun', 'let', 'module' and 'match' words.
It returns the starting position of the function, let definition, module or match expression that contains the cursor

### `phrase -target <next|prev> -position <position>`

     -target <next|prev>  Entity to jump to
    -position <position>  Position to complete

Returns the position of the next or previous phrase (top-level definition or module definition).

### `list-modules [ -ext <extension> -ext ... ]`

        -ext <extension>  file extensions to look for

Looks into project source paths for files with an extension matching and prints the corresponding module name.

### `locate [ -prefix <string> ] -position <position> [ -look-for <interface|implementation> ]`

        -prefix <string>  Prefix to complete
    -position <position>  Position to complete
-look-for <interface|implementation>  Prefer opening interface or implementation

Finds the declaration of entity at the specified position, Or referred to by specified string.
Returns either:
- if location failed, a `string` describing the reason to the user,
- `{'pos': position}` if the location is in the current buffer,
- `{'file': string, 'pos': position}` if definition is located in a different file.

### `occurrences -identifier-at <position> [ -scope <buffer|project> ]`

-identifier-at <position>  Position to complete
  -scope <buffer|project>  Scope of the request

Returns a list of locations `{'start': position, 'end': position}` of all
occurrences in current buffer of the entity at the specified position. If scope
is set to `project` the returned locations will also contain a field `file`:
`{'file': string, 'start': position, 'end': position}`.

### `outline`

Returns a tree of objects `{'start': position, 'end': position, 'name': string, 'kind': string, 'children': subnodes}` describing the content of the buffer.

### `path-of-source -file <filename>`

        -file <filename>  filename to look for in project paths

Looks for first file with a matching name in the project source and build paths

### `shape -position <position>`

    -position <position>  Position

This command can be used to assist navigation in a source code buffer.
It returns a tree of all relevant locations around the cursor.
It is similar to outline without telling any information about the entity at a given location.
```javascript
shape =
{
  'start' : position,
  'end'   : position,
  'children' : [shape]
}
```

### `type-enclosing -position <position> [ -expression <string> ] [ -cursor <int> ] [verbosity <smart|int>] [ -index <int> ]`

      -position <position>  Position to complete
      -expression <string>  Expression to type
             -cursor <int>  Position of the cursor inside expression
              -index <int>  Only print type of <index>'th result
    -verbosity <smart|int>  Verbosity level

Returns a list of type information for all expressions at given position, sorted by increasing size.
That is asking for type enlosing around `2` in `string_of_int 2` will return the types of `2 : int` and `string_of_int 2 : string`.

If `-expression` and `-cursor` are specified, the first result will be the type
relevant to the prefix ending at the `cursor` offset.

`-index` can be used to print only one type information. This is useful to
query the types lazily: normally, Merlin would return the signature of all
enclosing modules, which can be very expensive.

`-verbosity` determines the number of expansions of aliases in answers.
`smart` only expands module types."

The result is returned as a list of:
```javascript
{
  'start': position,
  'end': position,
  'type': string,
  // is this expression not in tail position, in tail position, or even a tail call?
  'tail': ('no' | 'position' | 'call')
}
```

### `type-expression -position <position> -expression <string>`

    -position <position>  Position to complete
    -expression <string>  Expression to type

Returns the type of the expression when typechecked in the environment around the specified position.

### `check-configuration`

This command checks that merlin project and options are correct.
The return value has the shape:
```javascript
{
  'dot_merlins': [path], // a list of string
  'failures': [message]  // a list of string
}
```

## Details about the client/server protocol

single mode

the wrapper
socket rendez vous
stopping server
passing command line arguments
passing environment variable

## Miscellaneous

`__MERLIN_MASTER_PID` environment variable is set in processes invoked by
merlin.

For PPX writers, the tool name is set to "merlin".

### Locations in PPX rewriters

FIXME: this should go somewhere else.

When trying to match a location with an AST node, Merlin traverses the tree
from the root, descending into all nodes that overlaps the location.

The most important part is that the locations of the rewritten AST nodes
actually form a tree.

A few attributes can be added on AST nodes to guide Merlin.

####<EMAIL_ADDRESS>
The location of "merlin.loc" will be used instead of the normal location of the
node when traversing the AST.  This is useful to extend the range of nodes.

For instance in the AST for `let x = y in z` nothing can be said about the
location of `in` as it doesn't appear in the abstract syntax.

Thus if the cursor is after `y` and before `z`, merlin cannot tell which node
to chose (should the completion use the context `y`, where `x` doesn't appear,
or the context of `z` ?).

This is solved by tweaking the parser to add<EMAIL_ADDRESS>attributes, with
the locations marked by `[]`: `let x =[ y ]in[ z]`.

This way, merlin will pick `z` node after `in` and `y` node before.

####<EMAIL_ADDRESS>and<EMAIL_ADDRESS>
PPX rewriters sometime generate codes that need to be given a location so that
errors are reported appropriately but for which other Merlin features are not
meaningful (completion or type-enclosing).

<EMAIL_ADDRESS>attribute causes merlin to ignore a branch of the AST.

When multiple branches overlap a location<EMAIL_ADDRESS>attribute forces
merlin to select a single branch and ignore the others.

repository: ocaml/merlin

branch_name: refs/heads/master

gha_language: OCaml

gha_license_id: MIT

repo_name: ocaml/merlin


text:
# BAMCIS Networking Cmdlets

## Revision History

### <IP_ADDRESS>
Added the Get-IPv6ConfigurationOptions cmdlet.

### <IP_ADDRESS>
Initial Release. This module has been separated from the HostUtilities module to provide a lighter weight module that is more reusable across other modules.


text:
# Personal portfolio

![Web 1920 – 1](./homepage.png)

View the **[live site](https://irinazay.github.io/portfolio/)**.

### For my personal portfolio I used this clean, beautiful, minimal and responsive portfolio template!

To get template, **[click here](https://github.com/chetanverma16/react-portfolio-template)**.

## How To Use

From your command line, clone and run portfolio:

```bash
# Clone this repository
$ git clone https://github.com/irinazay/portfolio

# Go into the repository
$ cd portfolio

# Install dependencies
$ npm install

#Start's development server
$ npm start
```

## Technologies Used

- [React](https://reactjs.org/)
- [Gatsby](https://www.gatsbyjs.com/)

repository: irinazay/portfolio

repo_name: irinazay/portfolio


text:
# ReactiveAlamofire
Reactive extensions for Alamofire framework

# Extensions

```swift
extension Request {

  // General

  public func toOperation() -> Operation<(NSURLRequest?, NSHTTPURLResponse?, NSData?), NSError>

  public func toOperation<S: ResponseSerializerType>(responseSerializer: S) -> Operation<S.SerializedObject, S.ErrorObject>

  public func toDataOperation() -> Operation<NSData, NSError>

  public func toStringOperation(encoding encoding: NSStringEncoding? = nil) -> Operation<String, NSError>

  public func toJSONOperation(options options: NSJSONReadingOptions = .AllowFragments) -> Operation<AnyObject, NSError>

  public func toPropertyListOperation(options options: NSPropertyListReadOptions = NSPropertyListReadOptions()) -> Operation<AnyObject, NSError>

  // Streaming

  public func toStreamingOperation() -> Operation<NSData, NSError>

  public func toStringStreamingOperation(delimiter delimiter: String, encoding: NSStringEncoding = NSUTF8StringEncoding) -> Operation<String, NSError>

  public func toJSONStreamingOperation(delimiter delimiter: String = "\n", encoding: NSStringEncoding = NSUTF8StringEncoding, options: NSJSONReadingOptions = .AllowFragments) -> Operation<AnyObject, NSError>
}
```

## Installation

### CocoaPods

```
pod 'AlamofireReactive', '~> 1.0'
```

> Although framework is named ReactiveAlamofire, such name is already occupied on CocoaPods so we use alternative. You still import `ReactiveAlamofire` in your code.

### Carthage

```
github "ReactiveKit/ReactiveAlamofire" ~> 1.0
```

## License

The MIT License (MIT)

Copyright (c) 2015-2016 Srdan Rasic (@srdanrasic)

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

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

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

repository: turekj/ReactiveAlamofire

repo_name: turekj/ReactiveAlamofire


text:
---
uuid: 3dd68002-2b71-4322-a465-4298f4e2f885
layout: speaking
title: 'Did you know JavaScript has iterators?'
slug: 'did-you-know-javascript-has-iterators-javascript-global-summit'
date: 2023-09-20T11:30:00.000Z
author: Luciano Mammino
author_slug: luciano-mammino
header_img: null
status: published
language: en_US
presentation_language: en_US
meta_title: null
meta_description: null
event_name: 'JavaScript Global Summit 2023'
event_link: 'https://events.geekle.us/js23/'
event_location: 'Remote'
event_location_gps: ~
event_city: 'remote'
event_days: 'Sep 19-20, 2023'
is_workshop: false
slides_link: ~
video_link: ~
with: ~
---

How many ways do you know to do iteration with JavaScript and Node.js? While, for loop, for…in, for..of, .map(), .forEach(), streams, iterators, etc! Yes, there are a lot of ways! But did you know that JavaScript has iteration protocols to standardise synchronous and even asynchronous iteration? In this workshop we will learn about these protocols and discover how to build iterators and iterable objects, both synchronous and asynchronous. We will learn about some common use cases for these protocols, explore generators and async generators (great tools for iteration) and finally discuss some hot tips, common pitfalls, and some (more or less successful) wild ideas!

gha_language: JavaScript


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

### Description

An issue was discovered in MantisBT before 2.24.4. A missing access check in bug_actiongroup.php allows an attacker (with rights to create new issues) to use the COPY group action to create a clone, including all bugnotes and attachments, of any private issue (i.e., one having Private view status, or belonging to a private Project) via the bug_arr[] parameter. This provides full access to potentially confidential information.

### POC

#### Reference
- https://mantisbt.org/bugs/view.php?id=27357

#### Github
No PoCs found on GitHub currently.

repository: trickest/cve

repo_name: trickest/cve


text:
---
layout: post
title: Bountify
---

I have built a ton of various scrapers, parsers and scripts in the past to get at all kinds of data on the web. I have mostly used PHP, Ruby and more recently Node.js (JavaScript).

When I saw a post on [Bountify](https://bountify.co/scraper-for-seeking-alpha) for a Scraper for Seeking Alpha I was curious. I wasn't familiar with Seeking Alpha, but had a free night where my wife was at an event and I was at home watching the dog, so I figured why not give it a try.

After taking Seeking Alpha for a spin I knew I could parse the profiles, but scraping using their search was going to be more work than the bounty offered. Figuring that there was only going to be a couple of developers posting the answer if any, I figured why not do what I can in as little of time as possible.

![Bountify](/img/bountify.png "Scraper for Seeking Alpha")

I simplified the code below but you can download the [gist](https://gist.github.com/johnmurch/db4315d97716f9490ddc)

{% highlight js %}
var fs = require('fs'),
    request = require('request'),
    async = require('async'),
    _ = require('underscore'),
    cheerio = require('cheerio');

var outputCSV = [];
//******************************************************
// EACH CATGORY URL (Top 100)
// http://seekingalpha.com/leader-board/opinion-leaders
//******************************************************
var urls = [
"http://seekingalpha.com/opinion-leaders/long-ideas",
"http://seekingalpha.com/opinion-leaders/long-ideas/2",
"http://seekingalpha.com/opinion-leaders/long-ideas/3",
...
"http://seekingalpha.com/opinion-leaders/mutual-funds/3",
"http://seekingalpha.com/opinion-leaders/mutual-funds/4"
]

var authors = [];
async.forEach(urls,function(url,urlcb){
    request(url, function(error, response, body) {
      if (!error && response.statusCode == 200) {
        var $ = cheerio.load(body);
        ////*[@id="author_articles_wrapper"]/div/div[1]/ul
        $('.ld_top_list li a').each(function(i, elm) {
          authors.push($(this).attr('href'));
        });
        $('.ld_more_list li a').each(function(i, elm) {
          authors.push($(this).attr('href'));
        });
        console.log("FETCH: "+ url);
        urlcb();
      }else{
        console.log("Check Connection: Issue viewing: "+ url);
        console.log(error);
        process.exit(0);
      }
    });
},function(){
    var uniqAuthors = _.uniq(authors);
    async.forEach(uniqAuthors,function(name,pcb){
      var url = 'http://seekingalpha.com' + name;
      request(url, function(error, response, body) {
          if (!error && response.statusCode == 200) {
            console.log("Fetching: "+url);
            var $ = cheerio.load(body);
            var author = $("#author_full_name").text();
            var profile = $('.profile_item_mini_text').text().toLowerCase();
            // console.log(name+"|"+profile);
            //Check if keyword is in profile - save as boolean true or false
            var boolHedgeFund = contains(profile, 'hedge fund');
            var boolFormer = contains(profile, 'former');
            var boolEx = contains(profile, 'ex');
            var boolPortfolioManager = contains(profile, 'portfolio manager');

            var count=0;
            var keywords =[];
            if(boolHedgeFund){count++;keywords.push('hedge fund')}
            if(boolFormer){count++;keywords.push('former')}
            if(boolEx){count++;keywords.push('ex')}
            if(boolPortfolioManager){count++;keywords.push('portfolio manager')}

            var capture = {
              author:author,
              url:url,
              keywords:keywords,
              // profile: profile,
              count:count
            }
            if(count>0){
              outputCSV.push(capture);
              pcb();
            }else{
              pcb();
            }
          }else{
            pcb();
          }
      });
    },function(){
      console.log("DONE");
      var wstream = fs.createWriteStream('results.csv',{'flags': 'w'});
      wstream.write("Author,URL,Count,Keywords\n");
      async.forEach(outputCSV,function(a,acb){
        wstream.write(
            JSON.stringify(a.author)
            +","+a.url+","
            +a.count+","
            +JSON.stringify(a.keywords.join())
            +"\n"
        );
      },function(){
        wstream.end();
        console.log("DONE");
        process.exit(0);
      });
    })
})

function contains(r,s){
  return r.indexOf(s) !== -1;
}

{% endhighlight %}


text:
# J.O.B-Training-Network Commands Assignment

## You will now practice the network commands in Linux using the previously cloned repo that will track your work.

### Exercise 1 wget
In a terminal window practice the wget command. This command is used to download files from the internet without a browser.

1. In your terminal type the command ```man wget``` and read the documentation related to the command
  * press the Q button to quit out of the manual
2. Type the command ```wget https://techport.nasa.gov/api/items/11009```
  * Type the command ```ls -ltr``` and note that you now have a file called 11009 at was downloaded from nasa.gov
3. Now type ```less 11009``` and see that the header shows this as an xml file
  * press Q to exit less

### Exercise 2 curl
In a terminal window practice the curl command. This command is useful to extract data from API services.

1. Type the command ```man curl``` and read the documentation.
  * press the Q button to quit out of the manual
2. In your terminal type the command ```curl -L  -iH "Accept: application/vnd.crossref.unixsd+xml" http://dx.doi.org/10.5555/515151 > doi.txt```
  * note that the curl command went to doi.org to download metadata regarding the doi 10.5555/515151 and saved it into a file called doi.txt
3. Now type ```curl http://wttr.in/Moon > moon.txt``` and ```cat moon.txt``` to see that curl saved the output of wttr.in site with the moon phase information
4. Now type ```curl -Is http://www.ufl.edu -L | grep HTTP/``` and note that the website says ok. This can be used as a way to check if a website is online or not.
5. Now type ```curl -s http://artscene.textfiles\.com/vt100/wineglas.vt | pv -L9600 -q``` Cheers!

## You have now completed the fifth and final online exercise for Linux commands. You will now be taken back to the Jump on Board website to take a quiz on the material covered in the online exercises. At the conclusion of the quiz you will have a face-to-face meeting with your trainer for a review session to discuss your experience with the content in this course.

## Please return to the Linux Commands Course Website to start the quiz.


text:
httpignore
==========

[![Build Status](https://travis-ci.org/mwinche/httpignore.svg?branch=master)](https://travis-ci.org/mwinche/httpignore)

This is a utility and CLI for interfacing with `httpignore` files.

### A word on `httpignore` files

I made them up (thanks to @lund0n for the inspiration). I wanted a way to be
able to serve up files from my `node_modules` directory but to allow individual
modules to mark things which, while they are published, ought not to be served
over HTTP.

My use case was for a private npm registry where I don't mind if internal people
can see, say, our README.md files, but I don't want all our internal documentation
to be customer facing.

The approach is simple and should be very familiar if you've used a `.npmignore`
or a `.gitignore` file. It follows all the same rules as those files. In this
case they define what files ought *not* be served over HTTP.

### Installation

`npm install httpignore`. All the normal flags apply.

### API

#### ignored()

Returns a promise which resolves with an array of all the filters that are being
applied via the `httpignore` files.

#### files()

Returns a promise which resolves with an array of all files which are allowed
after the filters are applied.

#### copy(dest)

Returns a promise which resolves once all files from the `files` call are
copied to the directory `dest`. If `dest` does not exist, it will create it.

### CLI

Usage:

```
httpignore-copy <dest>
```

Performs the `copy` api method on the directory specified by `dest`. Paths are
relative to the current working directory.

### Development

A standard `npm install` and `npm test` will get you running here. Please merge
squash PRs.

### License

[MIT](https://opensource.org/licenses/MIT)

Copyright 2016 Matt Winchester

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

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

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

repository: mwinche/httpignore

repo_name: mwinche/httpignore


text:
---
home: true
heroImage: /assets/img/logo-small.png
actionText: Read documentation →
actionLink: /3.0/
features:
- title: 💪 Export collections to Excel.
  details: Supercharge your Laravel collections and export them directly to an Excel or CSV document. Exporting has never been so easy.
- title: 🚀 Supercharged exports.
  details: Export queries with automatic chunking for better performance. For even more superpowers, exports can also be queued.
- title: 🔥 Export Blade views.
  details: Want to have a custom layout in your spreadsheet? Use a HTML table in a Blade view and export that to Excel.
footer: MIT Licensed | Powered by Maatwebsite
---

:bulb: Install the package via `composer`

```
composer require maatwebsite/excel
```

:muscle: Create an export class

```php
php artisan make:export UsersExport --model=App\\User
```

:fire: Download your export

```php
<?php

use App\UsersExport;
use Maatwebsite\Excel\Facades\Excel;
use App\Http\Controllers\Controller;

class UsersController extends Controller
{
    public function export()
    {
        return Excel::download(new UsersExport, 'users.xlsx');
    }
}
```

repository: devinfd/laravel-excel-docs

repo_name: devinfd/laravel-excel-docs


text:
# Module GTStudio Query Log

    gtstudio/module-querylog

- [Main Functionalities](#markdown-header-main-functionalities)
- [Installation](#markdown-header-installation)
- [Specifications](#markdown-header-specifications)
- [Usage](#markdown-header-usage)

## Main Functionalities
This module helps you to debug and find database query bottlenecks.
You will be able to see the query execution time, stack trace through the front end of the store in real time.

![](docs/images/module.gif)

## Installation
\* = in production please use the `--keep-generated` option

### Type 1: Zip file

- Unzip the zip file in `app/code/Gtstudio`
- Enable the module by running `php bin/magento module:enable Gtstudio_QueryLog`
- Apply database updates by running `php bin/magento setup:upgrade`\*
- Flush the cache by running `php bin/magento cache:flush`

### Type 2: Composer

- Install the module composer by running `composer require gtstudio/module-querylog`
- enable the module by running `php bin/magento module:enable Gtstudio_QueryLog`
- apply database updates by running `php bin/magento setup:upgrade`\*
- Flush the cache by running `php bin/magento cache:flush`

## Specifications

- Console Command
   - dev:query-view:enable

- Console Command
   - dev:query-view:disable

## Usage

To enable you just need to run the following command :

`bin/magento dev:query-view:enable --include-all-queries=1 --query-time-threshold=0.001 --include-call-stack=1`.

To disable you must run the following command :

`bin/magento dev:query-view:disable`.

gha_language: PHP


text:
## The deployment

- Create a git repository: `git init`

- Add this repository on a remote git url (github for example).

- Configure the shipitfile with the remote repository url and the server IP address if you haven't done it yet.

- Launch deploy script:
```bash
./node_modules/.bin/shipit staging deploy
```

If deployment fails, it maybe because npm install requires a lot of memory. To bypass this issue, [add some swap file](https://www.cyberciti.biz/faq/linux-add-a-swap-file-howto/)

repository: tcheymol/generator-loopback-ansible

repo_name: tcheymol/generator-loopback-ansible


text:
# GeoIP Server

This simple Rack server is useful as a self-hosted service for making lookups to the GeoIP database from MaxMind.com

## Instant installation and deploy

* Clone this: `git clone git://github.com/JackDanger/geoip_server.git`
* Download the free GeoIP data files: `rake geoip:update_city_lite`
* Commit that data file to your clone: `git add vendor && git commit -m "adding data file"`
* Signup for an account at Heroku ([better details here](http://github.com/sinatra/heroku-sinatra-app))
* Create and name a new app where you want to host this
* Push it to Heroku.com: `git push heroku master`

## HowTo

Once the server is running you can make a GET request to the server and receive lookup results in JSON format.

```ruby
require 'json'
require 'open-uri'
# Get the requesting user's IP address
# In a Rails app, you can use: request.remote_ip
# In a Sinatra app, you can use: request.ip
# In a Rack app, you can use: @env['REMOTE_ADDR']
ip = "<IP_ADDRESS>"
data = JSON.load(open("http://my-geoip-service-app.herokuapp.com/#{ip}").read)
"You're in: #{data['city']}"
```

Or, straight from a terminal:

    curl http://my-geoip-service-app.herokuapp.com/<IP_ADDRESS>

Patches welcome, forks celebrated.

Copyright (c) 2010 [Jack Danger Canty](http://jåck.com). Released under the MIT License.

extension: markdown

gha_language: Ruby


text:
---
layout: default
---

# 1994-01-03 - Re: Current Operational Status

## Header Data

From<EMAIL_ADDRESS>(Paul Ferguson)

To<EMAIL_ADDRESS>(Mike McNally)

Message Hash: 509b8f69b11bb827e0b69e231d918b60ff6f5690e41953359056df796c8013ac

Message ID<EMAIL_ADDRESS>Reply To<EMAIL_ADDRESS>UTC Datetime: 1994-01-03 13:33:58 UTC

Raw Date: Mon, 3 Jan 94 05:33:58 PST

## Raw message

```
{% raw  %}From<EMAIL_ADDRESS>(Paul Ferguson)
Date: Mon, 3 Jan 94 05:33:58 PST
To<EMAIL_ADDRESS>(Mike McNally)
Subject: Re: Current Operational Status
In-Reply-To<EMAIL_ADDRESS>Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text

Mike McNally writes -

> Well, if there ever was any doubt about his sanity:
>
> 	#!/bin/csh -f
>
> It is a terrible thing to lose one's mind.

If you think that is bad, you should surf comp.org.eff.talk this morning.
Gads.

{% endraw %}
```

## Thread

+ Return to [January 1994](/archive/1994/01)

+ Return to<EMAIL_ADDRESS>() <> James Bond 007 <> ()](/authors/an12070_at_anon_penet_fi_james_bond_007_)"
+ Return to<EMAIL_ADDRESS>(Paul Ferguson)](/authors/ferguson_at_icm1_icp_net_paul_ferguson_)"
+ Return to<EMAIL_ADDRESS>(Mike McNally)](/authors/m5_at_vail_tivoli_com_mike_mcnally_)"

+ 1994-01-03 (Sun, 2 Jan 94 22:48:43 PST) - [Current Operational Status](/archive/1994/01/78339627ef8b939154762099b29a25301a4633a579e9cd401556a039211c4ed3) -<EMAIL_ADDRESS>() \<\> James Bond 007 \<\> ()_
  + 1994-01-03 (Mon, 3 Jan 94 05:14:00 PST) - [Re: Current Operational Status](/archive/1994/01/a79256b23de59ab01e6e20f944e544e0a5572183718f7ef6929392b76ce5cc03) -<EMAIL_ADDRESS>(Mike McNally)_
    + 1994-01-03 (Mon, 3 Jan 94 05:33:58 PST) - Re: Current Operational Status -<EMAIL_ADDRESS>(Paul Ferguson)_


text:
# aqmen_data_science_dw

## This is an AQMEN repository for -
## Data Wrangling & Munging
## Organising, Managing and Enabling Data for Analysis

### Stata Workshop (July 2018)

### A two day hands-on workshop led by Professor John MacInnes and Dr Diarmuid McDonnell, University of Edinburgh.

### Topics:

The course introduces participants to the skills required to discover data sources and organise raw data for data analysis. Practical operations such as matching and merging files, recoding measures, documenting data and storing data will be covered. There will be an emphasis on developing accurate, efficient, transparent and reproducible working practices when analysing data.

### Rationale:

There are many organisations that increasingly require employees to understand
data, and to analyse data using statistical methods.

The known universe of data with potential value for organisations is constantly expanding. A consequence of the new forms of data is that they are not usually in a format that is ready to analyse. Datasets are often unsystematic and messy and they require a great deal of work to be undertaken before they can be used for data analysis. Data wrangling, which is sometimes referred to as data munging, or data enabling, is the process of organising raw data and transforming it into formats that enable data analyses to be undertaken.

Many organisations report that they have an absence of data analysis skills. Other organisations report that some employees have skills but lack confidence in exercising them. The lack of skills and capacity is currently a major
obstacle to some organisations undertaking data analysis.

This course will provide an fast-track, comprehensive introduction for employees wishing to
rapidly improve their data wrangling skills.

### Reading List:

These links are to Amazon (https://www.amazon.co.uk) but there are a number of other reputable academic book sellers (e.g. https://blackwells.co.uk/bookshop/shops/).

#### Stata

Pevalin, D. and Robson, K., 2009. The Stata survival manual. McGraw-Hill Education (UK).
https://www.amazon.co.uk/stata-survival-manual-Pevalin/dp/0335223885/ref=sr_1_1?ie=UTF8&qid=1530725105&sr=8-1&keywords=stata+survival+manual

_Many students like this introductory textbook._

Mehmetoglu, M. and Jakobsen, T.G., 2016. Applied statistics using Stata: a guide for the social sciences. Sage.
https://www.amazon.co.uk/Applied-Statistics-Using-Stata-Sciences/dp/1473913233/ref=sr_1_2?s=books&ie=UTF8&qid=1530725649&sr=1-2&keywords=Stata

_This is a first class text book. It is clearly written and very comprehensive_

Kohler, U. and Kreuter, F., 2012. Data analysis using Stata. Stata press.
https://www.amazon.co.uk/Data-Analysis-Using-Stata-Third/dp/1597181102/ref=sr_1_1?s=books&ie=UTF8&qid=1530725888&sr=1-1&keywords=kohler+and+kreuter

_This is a first class text book. It is clearly written and very comprehensive and has successfully been used as a core textbook on several courses that I have taught._

#### Workflow

Gayle, V.J. and Lambert, P.S. (2017) The Workflow: A Practical Guide to Producing Accurate, Efficient, Transparent and Reproducible Social Survey Data Analysis. NCRM Working Paper. NCRM.
http://eprints.ncrm.ac.uk/4000/

_A practical guide to the data analysis workflow._

Long, J.S. and Long, J.S., 2009. The workflow of data analysis using Stata. College Station, TX: Stata Press.
https://www.amazon.co.uk/Workflow-Data-Analysis-Using-Stata/dp/1597180475/ref=sr_1_1?s=books&ie=UTF8&qid=1530726163&sr=1-1&keywords=stata+workflow

_A fantastic book. This is the 'bible' of good data analysis workflow practices._

#### Longitudinal Data Analysis

Gayle, V. and Lambert, P., 2018. What is Quantitative Longitudinal Data Analysis?. Bloomsbury Publishing.
https://www.amazon.co.uk/Quantitative-Longitudinal-Analysis-Research-Methods/dp/1472515404/ref=sr_1_1?s=books&ie=UTF8&qid=1530726864&sr=1-1&keywords=vernon+gayle

_My recent book on longitudinal data analysis (using Stata)._

### Useful Stata Related Websites

https://stats.idre.ucla.edu/stata/

https://www.stata.com

https://www.stata.com/links/resources-for-learning-stata/

http://www.restore.ac.uk/Longitudinal/

### Cheat Sheets (Stata)

https://www.stata.com/links/resources-for-learning-stata/

https://geocenter.github.io/StataTraining/portfolio/01_resource/

https://www.datasciencecentral.com/group/resources/forum/topics/stata-cheat-sheet

### Two Page Guide to Stata

http://www-personal.umich.edu/~agrogan/stata/TwoPageStata.pdf


text:
# Grafana Alert to Syslog

Listens to Grafana's webhooks and sends them to syslog server

## configuration (flags)

**dest** -  syslog server hostname (default "<IP_ADDRESS>:514")

**protocol** - protocol for syslog: tcp\udp (default "tcp")

**port** - port for this webserver (default ":38090")

**format** - syslog formats: RFC3164/RFC5424/DEFUALT (default "RFC3164")

for example sending to syslog server which listens in ```udp``` at ```<IP_ADDRESS>:514``` in ```RFC5424``` format execute:
```bash
./grafana-alert-to-syslog -dest <IP_ADDRESS>:514 -protocol udp -format RFC5424
```

## configure webhook in grafana
- navigate to ```Notification Channels```
- click ```new channel```
- choose "webhook" on ```type``` dropdown
- under ```Webhook settings``` set url with the port you configured via flag (defaults to 38090)
- leave ```Http Method``` as POST

it should look like:

## setting priority and tag for alerts
To set the priorities/tags for the different alerts:
- navigate to the alert and add tags named: "priority" and/or "tag" and set the value...
- priority accepts the following:
    - EMERG
    - ALERT
    - CRIT
    - ERR
    - WARNING
    - NOTICE
    - INFO
    - DEBUG

repository: eeddaann/grafana-alert-to-syslog

repo_name: eeddaann/grafana-alert-to-syslog


text:
# Build and Test
## Getting Started
To build snap you'll need:
* [Golang >= 1.4](https://golang.org)
    * An option to look into is using the [go version manager (gvm)](https://github.com/moovweb/gvm) if you want to easily switch between Go versions.
* [GNU Make](https://www.gnu.org/software/make/)
* [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
* snap:
    * `go get github.com/intelsdi-x/snap`. This will put snap in your `$GOPATH`.
    * Fork the repository
    * `cd` into your /intelsdi-x/snap directory on your machine and do the following to set your fork as the origin and make a branch on your fork
        ```
        git remote rename origin upstream
        git remote add origin git@github.com:<yourGithubID>/snap.git
        ```
        To push to your fork later, either do a `git push origin master` or do `git checkout -b <someBranchName>` then you can do `git push`.
## Build
In the /snap directory there's a `Makefile` that builds all dependencies and snap.
To get dependencies and build snap just run:
```
make
```
It runs the following `make deps` and `make all` commands.

Alternatively, you can run `make` with any of the following targets:

* `default`: runs make deps and make all
* `deps`: fetches all dependencies using godeps
* `check`: runs test suite
* `all`: builds snapd, snapctl, and the test plugins
* `snap` builds snapd and snapctl
* `install`: installs snapd and snapctl binaries in /usr/local/bin
* `release`: cuts a snap release

To update your branch with changes from the intelsdi-x master branch run:
```
git pull --rebase upstream master
```

To see how to run snap, look at [running snap](../README.md#running-snap), [SNAPD.md](SNAPD.md), and [SNAPCTL.md](SNAPCTL.md).

## Test
### Creating Tests
Our tests are written using [smartystreets' GoConvey package](https://github.com/smartystreets/goconvey).  See https://github.com/smartystreets/goconvey/wiki for an introduction to creating a test.

### Running Tests
#### In local machine
First you need to run the following to get all test dependencies (this runs ./scripts/test.sh as well):
```
make test
```
To run all tests in order (it will stop at any failure in a directory before continuing on):
```
./scripts/test.sh
```
To run all tests *and to continue through all directories even with errors*:
```
go test ./...
```
Tests can be pruned in go test with the `-run` option:
```
go test ./... -v -run <TestName>
```

e.g. `TestLoad` from `control_test.go`:
```
go test ./... -v -run TestLoad
```

e.g. using GoConvey UX:
```
go test -coverprofile=/tmp/coverage.out && go tool cover -html=/tmp/coverage.out
```

#### In Docker
You need to have Docker Engine installed. Visit [Install Docker Engine](https://docs.docker.com/engine/installation/) for detailed instructions on how to do it.
If you're using Docker on OS X(Darwin) you need to have an active Docker host and the env var, `$DOCKER_HOST`, needs to be exported.

repository: jpetazzo/snap

repo_name: jpetazzo/snap


text:
## Graph

The `Graph` data structure started out rather normal, as a typical
graph data structure where nodes are _any-type_ (their value can be of
any C++ type). As nodes also have a `key`, the data structure was also
an any-type dictionary (as in Python). This turned out so useful that
it is now used equally as dictionary, as graph, or a mix of
both. Further, a node can have a sub-graph (or sub-dictionary) as
value, making the data structure hierarchical and ideal to represent
XML or YAML kind of data. I use this data structure to read XML, YAML,
JSON. The `.g` file format is one-to-one with the Graph data structure
and is the only file format used in `rai` (for configuration files,
kinematic model descriptions, logic, factor graphs, optimization
problems, etc).

<!--
Our graph syntax is a bit different to standard conventions. Actually,
our graph could be called a \emph{key-value hierarchical hyper graph}:
nodes can play the role of normal nodes, or hypernodes (=edges or
factors/cliques) that connect other nodes. Every node also has a set
of keys (or tags, to retrieve the node by name) and a typed value
(every node can be of a different type). This value can also be a
graph, allowing to represent hierarchies of graphs and subgraphs.
\begin{itemize}
\item A graph is a set of nodes
\item Every node has three properties:
\begin{items}
\item A tuple of \textbf{keys} (=strings)
\item A tuple of \textbf{parents} (=references to other nodes)
\item A typed \textbf{value} (the type may differ for every node)
\end{items}
\end{itemize}
Therefore, depending on the use case, such a graph could represent
just a key-value list, an 'any-type' container (container of things of
varying types), a normal graph, a hierarchical graph, or an xml data
structure.
-->

The best way to understand the `Graph` class is to first understand the file format, which clarifies what is actually represented. Here is the `example.g` from `test/Core/graph`, hopefully the comments are self-explanatory:
```
## a trivial graph (all boolean-typed nodes)
x            # a 'vertex': key=x, value=true, parents=none
y            # another 'vertex': key=y, value=true, parents=none
(x y)        # an 'edge': key=none, value=true, parents=x y
x            # key=x, value=true, parents=none
y            # key=y, value=true, parents=none
(x y)        # key=none, value=true, parents=x y
(-1 -2)      # key=none, value=true, parents=the previous and the y-node

## nodes with Graph value: hierarchical
node A { color:blue }         # keys=node A, value=<Graph>, parents=none
node B { color:red, value:5 } # keys=node B, value=<Graph>, parents=none
edge C(A B) { width:2 }       # keys=edge C, value=<Graph>, parents=A B
hyperedge(A B C) : 5          # keys=hyperedge, value=5, parents=A B C

## standard value types
a:string      # rai::String (except for keywords 'true' and 'false' and 'Mod' and 'Include')
b:"STRING"    # rai::String
c:'file.txt'  # rai::FileToken (with RELATIVE path; creates file pointer on parsing)
d:-0.1234     # double
e:[1 2 3 0.5] # rai::arr
g!            # bool (default: true, !means false)
h:true        # bool
i:false       # bool
j:{ a:0 }     # sub-Graph (special: does not require a '=')

## parsing: : {..} (..) , and \n are separators for parsing key-value-pairs
b0:false b1 b2, b3() b4   # 4 boolean nodes with keys 'b0', 'b1 b2', 'b3', 'b4'
k:{ a, b:0.2 x:"hallo"     # sub-Graph with 6 nodes
  y
  z():filename.org x }

## special Node Keys

## editing: after reading all nodes, the Graph takes all Edit nodes, deletes the Edit tag, and calls a edit()
## this example will modify/append the respective attributes of k
Edit k { y:false, z:otherString, b:7, c:newAttribute }

## including
Include : 'example_include.g'   # first creates a normal FileToken node then opens and includes the file directly

## any types
trans:<t(10 0 0)>  # trans is initially untyped; becomes types when accessed first in the code

## strange notations
a()       # key=a, value=true, parents=none
()        # key=none, value=true, parents=none
[1 2 3 4] # key=none, value=rai::arr, parents=none
```

Subgraphs may contain nodes can have parents from the containing
graph, or from other subgraphs of the containing graph. Some methods
of the @Graph@ class (to find nodes by key or type) allow to specify
whether also nodes in subgraphs or parentgraphs are to be
searched. This connectivity across (sub)-graphs e.g. allows to
represent logic knowledge bases.

repository: DannyDriess/rai-maintenance

repo_name: DannyDriess/rai-maintenance


text:
# ArcGIS Insights scripting guide

Welcome to the ArcGIS Insights scripting guide.

This repo contains information on getting started with scripting in ArcGIS Insights. This feature enables the execution of Python and R code using a bring-your-own scripting environment. Among many topics, we outline how to deploy a Jupyter Kernel Gateway, how to connect to a Jupyter Kernel Gateway, and tips and tricks for using the ArcGIS Insights scripting environment with other ArcGIS Insights features. In addition, the repo serves as a place to find and share useful Python and R scripts and creates a community around those who prefer to write code to advance data science and knowledge sharing.

We welcome any contributions for improving this guide. If you find a bug or would like to report a problem in the ArcGIS Insights scripting environment, please log an issue in this repo.

## Overview

* Learn how to configure a Jupyter Kernel Gateway (this is a requirement for using the ArcGIS Insights scripting environment).
* Pick a [Windows](#windows-instructions) or [macOS](#macos-instructions) machine, such as a desktop or laptop, to host your Jupyter Kernel Gateway.
* Generate Transport Layer Security (TLS) or Secure Sockets Layer (SSL) certificates.
* Follow the guide for installing and deploying a Jupyter Kernel Gateway.
* Learn tips about keyboard shortcuts and important scripting options.
* Search for Python and R code.
* Contribute Python and R code.
* Read ArcGIS Insights use cases and product documentation.
* Try ArcGIS Insights in Enterprise.
* Use the ArcGIS Insights scripting environment in Enterprise.

### Required packages to export data from the scripting environment to the data pane
To export data from the ArcGIS Insights scripting environment to the ArcGIS Insights data pane, the following Python and R packages are used:
* The Python Kernel uses ```pandas```, ```geopandas```, ```numpy```, ```matplotlib```, ```msgpack```, ```shapely``` and ```requests```.
* The R Kernel uses ```jsonlite```, ```data.table```, and ```itertools```.

## Install and deploy a Jupyter Kernel Gateway

The ArcGIS Insights scripting environment uses a Jupyter Kernel Gateway. This section includes guidance on how to configure a Jupyter Kernel Gateway. It requires using either Docker or Anaconda and enabling TLS or SSL for security. TLS and SSL permit ArcGIS Insights to access your gateway over HTTPS and WSS.

## Windows instructions

### Create a TLS or SSL certificate
> The instructions below will create a self-signed certificate. If you are able to create a trusted certificate in your enterprise, you can skip these steps and use the trusted enterprise certificate.

1) Clone the insights-scripting-guide repo to your local machine.
2) Use [Anaconda](https://www.anaconda.com/distribution/#windows) to install ``` openssl ``` for creating a self-signed certificate.
3) Open the Anaconda Command Prompt window.
4) Create a folder called __insightsgw__ on your local machine. For example, ``` C:\insightsgw ```.
5) Copy and paste the __insightsgw.cnf__ file from this repo's __Cert__ folder into the __insightsgw__ folder and edit each placeholder value (__host_name__ and __domain__) within the file.

Example:

```
[dn]
CN=insights.esri.com
[req]
distinguished_name=dn
[EXT]
subjectAltName=DNS:insights.esri.com
keyUsage=digitalSignature
extendedKeyUsage=serverAuth
```

> When editing the __insightsgw.cnf__ file, if you are unsure of your __host_name__ run ``` hostname ``` from a command prompt to get the correct value. If you are unsure of your __domain__ run ``` set user ``` from a command prompt to get the correct value.

6) Using the Anaconda Command Prompt, change directories to __insightsgw__. For example, ``` cd C:\insightsgw ```.
7) Change the placeholders for __<host_name>__ and __<dns_name>__ and run the following command:

``` openssl req -x509 -days 365 -out <host_name>.crt -keyout <host_name>.key -newkey rsa:2048 -nodes -sha256 -subj "/CN=<host_name>.<dns_name>" -extensions EXT -config insightsgw.cnf ```

Example:

``` openssl req -x509 -days 365 -out insights.crt -keyout insights.key -newkey rsa:2048 -nodes -sha256 -subj "/CN=insights.esri.com" -extensions EXT -config insightsgw.cnf ```

8) Close the Anaconda Command Prompt when the command has finished running. There should now be a __<host_name>.key__ and a __<host_name>.crt__ file in your __insightsgw__ folder.
9) Using administrative privileges, import the .crt file in your __insightsgw__ folder into the Windows Certificate Store's Trusted Root Certification Authorities. Use the following steps:
   * Open Manage computer certificates.
   * Open Trusted Root Certification Authorities.
   * Right click Certificates.
   * Click All Tasks > Import.
   * Select the .crt file created using ``` openssl ```.
   * Flush DNS using by running ```ipconfig /flushdns``` from the command prompt.
10) Add new _Inbound_ and _Outbound_ rules for port 9999 using Windows Defender Firewall with Advanced Security.

### Create a gateway

_When creating a Jupyter Kernel Gateway choose either the Docker or Anaconda section below (not both)._

#### Create a gateway using Docker

1) Install [Docker](https://www.docker.com/products/docker-desktop).
2) Create a folder called __insightsgw__ on your local machine for example, ``` c:\insightsgw ```.
3) Copy and paste ``` Dockerfile ``` from this repo's _Docker_ folder into the __insightsgw__ folder.
4) Edit ``` Dockerfile ``` to fit your requirements.

> The ENV KG_ALLOW_ORIGIN and ENV KG_LIST_KERNELS parameters are required for the Jupyter Kernel Gateway

> If you want to load data into the container to work with inside the ArcGIS Insights console, create a local folder and add the data files to it and then set that folder to be copied from the local machine to the container in the ```Dockerfile```. For example, create a folder in your local project folder __insightsgw__ named __data__ and add working data files to it. Then, add ```COPY /data/* /data/``` to the ```Dockerfile``` to copy the local __data__ folder with the files to the container. Adding ```WORKDIR /data``` to the ```Dockerfile``` will set the container working folder to the __data__ folder.

5) Run ``` docker build -t insightsgw . ``` from a command prompt in the folder created in step 2. For example, ``` c:\insightsgw>docker build -t insightsgw . ```
6) Run ``` docker run -p 9999:9999 insightsgw ``` from a command prompt in the folder created in step 2. For example, ``` c:\insightsgw>docker run -p 9999:9999 insightsgw ```

> If there is a database on the local host machine with data to be used in the ArcGIS Insights console, a connection to it can be created in the docker run command. For example, connecting to PostgreSQL in Windows ``` docker run -p 9999:9999 -e DB_PORT=5432 -e DB_HOST=docker.for.win.host.internal insightsgw ```

    Upon success the prompt will show the following output:

      ``` [KernelGatewayApp] Jupyter Kernel Gateway at https://<IP_ADDRESS>:9999 ```

7) Leave the command prompt open while the Jupyter Kernel Gateway is running.
8) To test that the gateway is running as expected, open a web browser and navigate to ``` https://<host_name>.<dns_domain>:9999/api ```. For example, https://insights.esri.com:9999/api.

    You should see JSON text on the web page showing the api version information. For example,
``` {"version": "5.7.4"} ```.

> The default configuration of Docker is limiting so it is best practice to use Docker's Advanced Setting tab to configure additional CPU and memory resources.

> In addition to configuring resources for the container from the Docker application, they can be configured within ``` Dockerfile ``` as well. See the Docker documentation for configuration details.

#### Create a gateway using Anaconda

1) Install [Anaconda](https://www.anaconda.com/distribution/).
2) Open the Anaconda Command Prompt window.
3) Create an ArcGIS Insights Python environment using the command ``` conda create -n my_insights_env python=3.7 ```.
4) Activate the ArcGIS Insights Python environment using the command ``` conda activate my_insights_env ```.
5) Install Jupyter Kernel Gateway using the command ``` conda install -c anaconda jupyter_kernel_gateway=2.1.0 ```.
6) Install pandas and numpy packages using the command ``` conda install -c anaconda numpy pandas```.
7) Install geopandas and matplotlib package using the command ``` conda install -c conda-forge geopandas matplotlib ```.
8) Install msgpack package using the command ``` conda install -c conda-forge msgpack-python ```.
9) Install shapely package using the command ``` conda install -c conda-forge shapely ```.
10) Install requests package using the command ``` conda install -c conda-forge requests ```.
11) Add the ArcGIS API for Python using the command ``` conda install -c esri arcgis ```.
12) Install essential R packages using the command ``` conda install -c r r-essentials ```.
13) Add the itertools package using the command ``` conda install -c conda-forge r-itertools ```.

> Consider what directory to use when launching the Jupyter Kernel Gateway. If you have a ``` C:\insightsgw\data ``` directory which contains ``` .csv ``` files, launching the Jupyter Kernel Gateway from this folder will enable easy access to those files within scripts by allowing the use of relative paths for file and folder access.

> The ``` KernelGatewayApp.allow_origin ``` and ``` JupyterWebsocketPersonality.list_kernels ``` parameters are required.

10) Launch the Jupyter Kernel Gateway using the following command, changing the placeholders for __<host_name>__
```
jupyter kernelgateway --KernelGatewayApp.ip=<IP_ADDRESS> --KernelGatewayApp.port=9999 --KernelGatewayApp.allow_origin='*' --KernelGatewayApp.allow_credentials='*' --KernelGatewayApp.allow_headers='*' --KernelGatewayApp.allow_methods='*' --JupyterWebsocketPersonality.list_kernels=True --certfile=C:\insightsgw\<host_name>.crt --keyfile=C:\insightsgw\<host_name>.key
```

Example:

```
jupyter kernelgateway --KernelGatewayApp.ip=<IP_ADDRESS> --KernelGatewayApp.port=9999 --KernelGatewayApp.allow_origin='*' --KernelGatewayApp.allow_credentials='*' --KernelGatewayApp.allow_headers='*' --KernelGatewayApp.allow_methods='*' --JupyterWebsocketPersonality.list_kernels=True --certfile=C:\insightsgw\insights.crt --keyfile=C:\insightsgw\insights.key
```
    Upon success the prompt will show the following output:

      ``` [KernelGatewayApp] Jupyter Kernel Gateway at https://<IP_ADDRESS>:9999 ```

11) Leave the command prompt open while the Jupyter Kernel Gateway is running.

12) To test that the Gateway is running as expected, open a web browser and navigate to ``` https://<host_name>.<dns_domain>:9999/api ```. For example, https://insights.esri.com:9999/api.

    You should see JSON text on the web page showing the api version information. For example,
``` {"version": "5.7.4"} ```.

> If you are experiencing issues connecting to the console after creating a self-signed certificate, check the browser to make sure an exception does not need to be added for the site created in the certificate. In the example above, the site is ``` https://insights.esri.com ```. Navigate to ``` https://insights.esri.com ``` in the browser. If an exception is required for the self-signed certificate, a warning page will be shown:

>

> Click Advanced

>

> Click Add Exception...

>

> Click Confirm Security Exception

## macOS instructions

### Create a TLS or SSL cert
> The instructions below will create a self-signed certificate. If you are able to create a trusted certificate in your enterprise, you can skip these steps and use the trusted enterprise certificate.

1) Clone the insights-scripting-guide repo to your local machine.
2) Create a directory called __insightsgw__ on your local machine. For example, ``` insightspc:insightsgw insightsuser$  ```.
3) Copy and paste the __insightsgw.cnf__ file from this repo's __Cert__ directory into the __insightsgw__ directory and edit each placeholder value (__host_name__ and __domain__)  within the file.

Example:

```
[dn]
CN=insights.esri.com
[req]
distinguished_name=dn
[EXT]
subjectAltName=DNS:insights.esri.com
keyUsage=digitalSignature
extendedKeyUsage=serverAuth
```

> When editing the __insightsgw.cnf__ file, if you are unsure of your __host_name__ run ``` sudo scutil --get LocalHostName ``` from the terminal to get the correct value. If you are unsure of your __domain__ run ``` sudo scutil --get HostName ``` from the terminal to get the correct value.

4) Using the terminal, change directories to __insightsgw__. For example, ``` insightspc:Documents insightsuser$ cd insightsgw ```.

    ``` openssl ``` is installed on macOS by default.

5) Change the placeholders for __<host_name>__ and __<dns_name>__ and run the following command:

``` openssl req -x509 -days 365 -out <host_name>.crt -keyout <host_name>.key -newkey rsa:2048 -nodes -sha256 -subj '/CN=<host_name>.<dns_name>' -extensions EXT -config ../insightsgw.cnf ```

Example:

``` openssl req -x509 -days 365 -out insights.crt -keyout insights.key -newkey rsa:2048 -nodes -sha256 -subj '/CN=insights.esri.com' -extensions EXT -config ../insightsgw.cnf ```

    The terminal can be closed when finished.

    There should now be a __<host_name>.key__ and a __<host_name>.crt__ file in your __insightsgw__ directory.

6) Using administrative privileges, import the .crt file in your __insightsgw__ directory into the Mac Keychain. Use the following steps:
   * Open Keychain
   * Choose System from Keychains
   * Choose Certificates from Category
   * Click File > Import Items
   * Choose ```.crt``` file created using ```openssl```
   * Flush the DNS using ```sudo killall -HUP mDNSResponder``` from terminal

### Create a gateway

_When creating a Jupyter Kernel Gateway choose either the Docker or Anaconda section below (not both)._

#### Create a gateway using Docker

1) Install [Docker](https://www.docker.com/products/docker-desktop).
2) Create a directory called __insightsgw__ on your local machine. For example, ``` insightspc:insightsgw insightsuser$ ```.
3) Copy and paste ``` Dockerfile ``` from this repo's __Docker__ directory into the __insightsgw__ directory.
4) Edit ``` Dockerfile ``` to fit your requirements.

> The ENV KG_ALLOW_ORIGIN and ENV KG_LIST_KERNELS parameters are required for the Jupyter Kernel Gateway.

> If you want to load data into the container to work with inside the ArcGIS Insights console, create a local directory and add the data files to it and then set that directory to be copied from the local machine to the container in ```Dockerfile```. For example, create a directory in your local project directory __insightsgw__ named __data__ and add working data files to it. Then, add ```COPY /data/* /data/``` to ```Dockerfile``` to copy the local __data__ directory with the files to the container. Adding ```WORKDIR /data``` to ```Dockerfile``` will set the container working directory to the __data__ directory.
5) Run ``` docker build -t insightsgw . ``` from the terminal in the directory created in step 2. For example, ```insightspc:insightsgw insightsuser$docker build -t insightsgw . ```
6) Run ``` docker run -p 9999:9999 insightsgw ``` from the terminal in the folder created in step 2. For example, ``` insightspc:insightsgw insightsuser$docker run -p 9999:9999 insightsgw  ```

    Upon success the prompt will show the following output:

      ``` [KernelGatewayApp] Jupyter Kernel Gateway at https://<IP_ADDRESS>:9999 ```

    Leave the terminal open while the Jupyter Kernel Gateway is running.

7) To test that the Gateway is running as expected, open a web browser and navigate to ``` https://<host_name>.<dns_domain>:9999/api ```. For example, https://insights.esri.com:9999/api.
    You should see JSON text on the web page showing the api version information. For example,
``` {"version": "5.7.4"} ```.

> The default configuration of Docker is limiting so it is highly recommended to use Docker's Advanced Setting tab to configure additional CPU and memory resources.

> In addition to configuring resources for the container from the Docker application, they can be configured within the Dockerfile as well. See the Docker documentation for configuration details.

#### Create a gateway using Anaconda

1) Install [Anaconda](https://www.anaconda.com/distribution/).
2) Open the terminal window.
3) Create an ArcGIS Insights Python environment using the command ``` conda create -n my_insights_env python=3.6 ```.
4) Activate the ArcGIS Insights Python environment using the command ``` source activate my_insights_env ```.
5) Install Jupyter Kernel Gateway using the command ``` conda install -c anaconda jupyter_kernel_gateway ```.
6) Install pandas and numpy packages using the command ``` conda install -c anaconda numpy pandas ```.
7) Install geopandas and matplotlib package using the command ``` conda install -c conda-forge geopandas matplotlib ```.
8) Install msgpack package using the command ``` conda install -c conda-forge msgpack-python ```.
9) Install shapely package using the command ``` conda install -c conda-forge shapely ```.
10) Install requests package using the command ``` conda install -c conda-forge requests ```.
11) Add the ArcGIS API for Python using the command ``` conda install -c esri arcgis ```.
12) Install essential R packages using the command ``` conda install -c r r-essentials ```.
13) Add the itertools package using the command ``` conda install -c conda-forge r-itertools ```.

> Consider what directory to use when launching the Jupyter Kernel Gateway. If you have a ``` /Users/insightsuser/Documents/insightsgw/data ``` directory which contains ``` .csv ``` files, launching the Jupyter Kernel Gateway from this directory will enable easy access to those files within scripts by allowing the use of relative paths for file and directory access.

> The ``` KernelGatewayApp.allow_origin ``` and ``` JupyterWebsocketPersonality.list_kernels ``` parameters are required.

10) Launch the Jupyter Kernel Gateway using the following command, changing the placeholders for __<host_name>__
```
jupyter kernelgateway --KernelGatewayApp.ip=<IP_ADDRESS> --KernelGatewayApp.port=9999 --KernelGatewayApp.allow_origin='*' --KernelGatewayApp.allow_credentials='*' --KernelGatewayApp.allow_headers='*' --KernelGatewayApp.allow_methods='*' --JupyterWebsocketPersonality.list_kernels=True --certfile=../certs/<host_name>.crt --keyfile=../certs/<host_name>.key
```

Example:

```
jupyter kernelgateway --KernelGatewayApp.ip=<IP_ADDRESS> --KernelGatewayApp.port=9999 --KernelGatewayApp.allow_origin='*' --KernelGatewayApp.allow_credentials='*' --KernelGatewayApp.allow_headers='*' --KernelGatewayApp.allow_methods='*' --JupyterWebsocketPersonality.list_kernels=True --certfile=../certs/insights.crt --keyfile=../certs/insights.key
```
    Upon success the prompt will show the following output:

      ``` [KernelGatewayApp] Jupyter Kernel Gateway at https://<IP_ADDRESS>:9999 ```

    Leave the terminal open while the Jupyter Kernel Gateway is running.

11) To test that the gateway is running as expected, open a web browser and navigate to ``` https://<host_name>.<dns_domain>:9999/api ```. For example,  https://insights.esri.com:9999/api.

14) You should see JSON text on the web page showing the api version information. For example,
``` {"version": "5.7.4"} ```

> If you are experiencing issues connecting to the console after creating a self-signed certificate, check the browser to make sure an exception does not need to be added for the site created in the certificate. In the example above, the site is ``` https://insights.esri.com ```. Navigate to ``` https://insights.esri.com ``` in the browser. If an exception is required for the self-signed certificate, a warning page will be shown:

>

> Click Advanced

>

> Click Add Exception...

>

> Click Confirm Security Exception

## Use the console in ArcGIS Insights

The ArcGIS Insights Console is available within workbooks only in the Enterprise version, not in Online. You can launch the console by clicking the _Console_ button   next to the _Basemap_ button in the workbook toolbar.

Learn more about the scripting console in the ArcGIS Insights documentation.

### Connecting your Jupyter Kernel Gateway

1) To connect ArcGIS Insights to your Jupyter Kernel Gateway, click the _Console_ button .

    The New Jupyter Kernel Gateway connection window opens.

2) Enter the URL and web socket connection information.

    If using the examples in this guide, the __URL__ parameter will be ``` https://<host_name>.<dns_domain>:9999 ``` and the __Web socket__ parameter will be ``` wss://<host_name>.<dns_domain>:9999 ```.

Example:

  * URL

        ```https://insights.esri.com:9999```

  * Web Socket

        ```wss://insights.esri.com:9999```

### Shortcuts and ArcGIS Insights magic commands

The ArcGIS Insights console uses keyboard shortcuts and magic commands so that routine tasks can be performed quickly and efficiently.
* Use the ```%insights_return(<R data frame or Pandas DataFrame>)``` magic command to add an R data frame or Pandas DataFrame to the ArcGIS Insights data pane.

    __The %insights_return magic command must be run on a single line in a single cell in the ArcGIS Insights Console__

* ``` Ctrl/control + Alt/option + B ``` Add ```%insights_return``` magic command to cell.
* ``` Ctrl/control + / ``` Comment line.
* ``` Ctrl/control + Spacebar ``` Enable IntelliSense.
* ``` Shift/shift + Enter/return ``` Execute the code in the current cell.
* ``` Shift/shift + Up Arrow or Down Arrow ``` Access the history of executed cells.

# What is ArcGIS Insights?

Part of the Esri Geospatial Cloud, ArcGIS Insights is web-based data analytics made for advanced location intelligence. Answer questions you didn’t know to ask, analyze data completely, and tell powerful data stories. Connect to your data directly, then use maps, charts and tables to perform basic to complex analyses that scale based on skill level and business need.

* [Case studies and testimonials](https://www.esri.com/en-us/arcgis/products/insights-for-arcgis/overview)
* [Product and analytical tool documentation](https://doc.arcgis.com/en/insights/)

## Why Get Involved?

Send feedback to us concerning the ArcGIS Insights scripting console. Found an issue or have questions? Feel free to post questions or comments and report bugs to the issues section of this repo.

## Start using ArcGIS Insights with a Free Trial

Sign-up to [start a free trial](https://www.esri.com/en-us/arcgis/products/insights-for-arcgis/trial?adumkts=product&adupro=Insights_for_ArcGIS&aduc=pr&adum=blogs&utm_Source=pr&aduca=arcgis_insights_existing_customers_promotions&aduat=blog&aduco=exploring-the-atlantic-ocean-in-insights&adupt=lead_gen&sf_id=70139000001eKGfAAM).

## Licensing
Copyright 2019 Esri

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.

A copy of the license is available in the repository's [license.txt]( https://raw.github.com/Esri/quickstart-map-js/master/license.txt) file.

repository: Esri/insights-scripting-guide

gha_language: Jupyter Notebook

repo_name: Esri/insights-scripting-guide


text:
socketExample
==============

Simple examples using node.js and socket.io to achieve synchronous multi-client interactions.

* userCount: shows how many users are connected. All clients update simultaneously as users connect and disconnect.

repository: scottgwald/node-socket-examples

repo_name: scottgwald/node-socket-examples


text:
# Json Configuration

Like for many classes in *Jodd*, *Json* serialization and parsing can be configured globally using the static fields.

The global configuration for `JsonSerializer` is defined in `JsonSerializer.Defaults` class. There you can enable some flags and set some values that will be used by default by any new instance of the `JsonSerializer`.

The same thing applies to the `JsonParser`. It's default configuration is in `JsonParser.Defaults`.


text:
## GSoC Day 79

## ZoomIn, ZoomOut, ResetZoom buttons

- Today the ```ZoomInButton```, ```ZoomOutButton``` and ```ResetViewButton```  were added.
  It's specifically ```ResetView``` because it may be used for the ```Panning``` functionality
  as well (which is the next thing to be worked on, along with a ```zoomSlider```).
- We also spoke about Monoids and the conditions for a monoid. In ```CodeWorld```, the ```&```
  is the same as ```<>```.

<img src="/images/GSoc_/zoombuttons.png" width="500">

- For the drawing of the ```zoomInButton```, this was the code for the image:

```
import CodeWorld

main :: IO ()
main = drawingOf magnifyingGlass

magnifyingGlass =
      translated (-0.05) (0.05)
      (thickCircle 0.1 0.22
      & solidRectangle 0.06 0.25
      & solidRectangle 0.25 0.06
      & rotated (-pi / 4) (translated 0.35 0
      (solidRectangle 0.2 0.1)))
```
- Try it out [here](https://code.world/haskell#PY_-qCEXBDA20q4rFLCWKQg)

- For the ```ResetViewButton```, this was the code for the image:

```
import CodeWorld

main :: IO ()
main = drawingOf resetZoom

resetZoom =
      colored white (solidRectangle 0.7 0.2) &
      colored white (solidRectangle 0.2 0.7) &
      thickRectangle 0.1 0.5 0.5 &
      rectangle 0.8 0.8
```
- Try it out [here](https://code.world/haskell#Phr10XlWAEc5G-uGHsbSIJg)

## About formatting

- One of the things that has really astounded me this summer is how picky the senior engineers I've been
  working with are about code and formatting. I *love* it. Chris is particular about the code visually
  expressing its intent.

- For example

```
p =
        colored
            (RGBA 0 0 0 alpha)
            (translated (-0.05) (0.05) (
                thickCircle 0.1 0.22 <>
                solidRectangle 0.06 0.25 <>
                solidRectangle 0.25 0.06 <>
                rotated (-pi / 4)
                (translated 0.35 0
                (solidRectangle 0.2 0.1))
            ))

```
- By viewing it, you immediately have the sense that there are outer functions and inner functions.
  So a function is applied to other nested values (sort of like you would imagine ```html``` would
  visually show which attributes are in which containers. I wish *everyone* would code like this!

- I think that that alone is motivation for me to keep going with programming. It's almost like
  having good taste or finesse, which I guess would come with time and experience and a tonne of
  programming.

## Anyways, that's about it!


text:
# tetrabrick
C++ Tetris Game

This is a game that I made for fun when I was a kid. I was trying to apply and understand different techniques related to OOP and game design.
The original plan was to create a multiplayer game where you can play Tetris up to 8 players in a network, but I never finished the multiplayer feature (Although I learned a lot about networking and socket programming trying to accomplish this).

The game is functional in Single Player mode, and I think is pretty fun actually. I'll add some screenshoots and instructions to compile soon.

I'm not interested in continuing the development of the game, but if anyone is interested in doing that, just fork it :) .

repository: jion/tetrabrick

repo_name: jion/tetrabrick


text:
Molokai-Terminal
================

Molokai-Terminal is a molokai-like theme for a 16-color terminal.  It is a
high-contrast theme, which is designed for general terminal application.  So if
an application looks good in the default linux's 16 color theme, it should also
look clear in Molokai-Terminal.  This makes Molokai-Terminal have a very good
compability.

There is also a modified vim's theme shipped with Molokai-Terminal.  It makes
use of both xterm-256 color and 16 terminal color to present a uniform
experience in terminal, vim and gvim.

Any comments are welcome!

![terminal](https://github.com/zhou13/molokai-terminal/raw/master/image/terminal.png)

![eix](https://github.com/zhou13/molokai-terminal/raw/master/image/eix.png)

![linux](https://github.com/zhou13/molokai-terminal/raw/master/image/linux.png)

Comparasion between Gvim and terminal vim (Click to Enlarge):
![comparision](https://github.com/zhou13/molokai-terminal/raw/master/image/comparision.png)

![htop](https://github.com/zhou13/molokai-terminal/raw/master/image/htop.png)

![xterm16](https://github.com/zhou13/molokai-terminal/raw/master/image/xterm16.png)


text:
# 🐨 KoalaUIKit 🐨

## Manage your view using Design System components

### Instalation
- If you dont have CocoaPods in your project, fallow the steps in ths links:
> https://guides.cocoapods.org/using/getting-started.html
- You can also fallow this link to know how to install your first pod in your project:
> https://guides.cocoapods.org/using/using-cocoapods.html
- If you already install the cocoapods, follow the next steps:
- Insert the line in your podfile and save: pod 'FoxDesignSystem'
- In your project folder, execute 'pod install' in terminal
### Configureation
1. On your Build Phases click in the plus("+") button
2. Select New Run Script (you can rename it, to easier identification)
3. Your run script needs to be right before "Compile Sources" otherwise you get the error
4. Insert the Code: ${PODS_ROOT}/FoxDesignSystem/FoxDesignSystem/generateTagFiles.sh
5. Inside Input Files add the path: ${PROJECT_DIR}/DesignSystem/DesignSystemTokens.swift.gyb
6. Insite Output Files add the path: ${PROJECT_DIR}/DesignSystem/DesignSystemTokens.swift
7. Build your project. Your project shold not have any erros.
8. Inside your project folder, check if was created a folder called DesignSystem
9. Drag the DesignSystem folder into your project and uncheck Copy items if needed
10. Create a JSON file called 'Design_System_Tokens.json' with your design system in the root of your project. You can check an example of the json here: https://github.com/leobmaffei/FoxDesignSystem/blob/main/FoxDesignSystem/Design_System_Tokens_Example.json
11. Build your project, your DesignSystemTokens.swift file will be updated with the JSON values.
### Usage
- Use the tokens by acessing the struct 'DesignSystem.yourFamilyToken' any place in your project. Any time witch you json file will be changed, you DesignSystemTokens will be automaticaly updated.

repository: leobmaffei/KoalaUIKit

repo_name: leobmaffei/KoalaUIKit


text:
# golor
A go library for formatting the color of text output to a terminal

Status:

This library does work. However, I primarily use it just as a reference for all the ASCII color codes in other projects. I'm sure there are better terminal coloring libraries for Go available now, so I'd suggest using those over this one.

# Usage

`go get github.com/mhoc/golor`

```
import github.com/mhoc/golor
package main
func main() {
  golor.PrintlnPurple("This text is absolutely royal!")
}
```

# Functions

```
func <ColorName>(string) string`
```

Returns a string which is formatted the given color, suitable for printing. Example: `golor.Red("ERROR!")`

```
func Print<ColorName>(string)`
```

Prints out a string in the given color. Example: `golor.PrintYellow("WARNING!")`

```
func Println<ColorName>(string)`
```

Printlns a string in the given color. Example: `golor.PrintlnGreen("GREAT!")`

```
func Printf<ColorName>(string, ...interface{})`
```

Printfs a string and arguments, just like you'd expect. Example: `golor.PrintfCyan("Is this %s\n", "Blue?")`

# Colors

You can pick from any of these fabulous colors!

* Red
* LightRed
* Yellow
* LightGreen
* Green
* LightCyan
* Cyan
* LightBue
* Blue
* LightPurple
* Purple
* Brown
* LightGrey
* Grey
* Black
* White

# Extras

```
func Rainbow(string) string
```

You can guess what this does :)

repository: mhoc/golor

repo_name: mhoc/golor


text:
---
layout: default
---

# 1996-07-30 - Re: Source Codes in C or Pascal

## Header Data

From: Bill Stewart<EMAIL_ADDRESS>To: Jerome Tan<EMAIL_ADDRESS>Message Hash: 4dbba2bc4e3abf50e7ac620f45e15f1e45aecbba2e0b491597fc6cbc88a93990

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1996-07-30 11:13:30 UTC

Raw Date: Tue, 30 Jul 1996 19:13:30 +0800

## Raw message

```
{% raw  %}From: Bill Stewart<EMAIL_ADDRESS>Date: Tue, 30 Jul 1996 19:13:30 +0800
To: Jerome Tan<EMAIL_ADDRESS>Subject: Re: Source Codes in C or Pascal
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

At 03:42 PM 7/28/96 +0800, you wrote:
>Does anyone knows where to find source codes of sample encryption
>programs? I just wanted to know how they work... Thanks in advance!

The best archives are outside the US and not subject to its export laws.
Some popular locations are ftp.funet.fi (in Finland), ftp.ox.ac.uk
(at Oxford University in England), and ftp.dsi.unimi.it (in Italy.)
You can also use AltaVista to look for Ron Rivest's home page,
and look at his reference lists.  The Cypherpunks home page
is on www.csua.berkeley.edu .

If you're somewhere that US technical books are readily available,
Bruce Schneier's book "Applied Cryptography" is very good.
#			Thanks;  Bill
# Bill Stewart, +1-415-442-2215<EMAIL_ADDRESS># <A HREF="http://idiom.com/~wcs">
#			Dispel Authority!

{% endraw %}
```

## Thread

+ Return to [July 1996](/archive/1996/07)

+ Return to "[Bill Stewart <stewarts@ix.netcom.com>](/authors/bill_stewart_stewarts_at_ix_netcom_com_)"

+ 1996-07-30 (Tue, 30 Jul 1996 19:13:30 +0800) - Re: Source Codes in C or Pascal - _Bill Stewart<EMAIL_ADDRESS>


text:
# Request -- Simplified HTTP client

[![NPM](https://nodei.co/npm/request.png)](https://nodei.co/npm/request/)

## Super simple to use

Request is designed to be the simplest way possible to make http calls. It supports HTTPS and follows redirects by default.

```javascript
var request = require('request');
request('http://www.google.com', function (error, response, body) {
  if (!error && response.statusCode == 200) {
    console.log(body) // Print the google web page.
  }
})
```

## Streaming

You can stream any response to a file stream.

```javascript
request('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png'))
```

You can also stream a file to a PUT or POST request. This method will also check the file extension against a mapping of file extensions to content-types, in this case `application/json`, and use the proper content-type in the PUT request if one is not already provided in the headers.

```javascript
fs.createReadStream('file.json').pipe(request.put('http://mysite.com/obj.js