text:
# Multiverse of the Hurricane Dataset

In this example, we implemented the specification curve analysis on Jung's hurricane study,
described in the seminal paper of Simonsohn et al.

Useful URLs:
- Specification curve paper by Simonsohn et al.:
https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2694998

- The appendix of the specification curve paper:
http://urisohn.com/sohn_files/wp/wordpress/wp-content/uploads/Supplement-Specification-Curve-2019-10-29.pdf

- STATA code implementing the specification curve analysis:
http://urisohn.com/sohn_files/files/Specification%20Curve.zip

- Hurricane paper by Jung et al.:
https://doi.org/10.1073/pnas.1402786111

- Supporting material of the hurricane paper:
https://www.pnas.org/content/suppl/2014/05/30/1402786111.DCSupplemental

### Augmenting the Dataset

Following the description in Uri Simonsohn's STATA code, we augmented the original
hurricane dataset via the following steps:

- We added the two outliers excluded in Jung's study - Katrina and Audrey.
- We replaced the femininity ratings (MasFem) with the average ratings from 32 MTurkers,
collected using the same scale as described in Jung's paper. Uri Simonsohn kindly
provided the MTurk ratings to us.
- Accordingly, we also updated the binary gender indicator, so a femininity rating higher
than 6 is categorized as female.
- We updated the normalized damage to 2019 dollar values, using the same website as
Jung et al: http://www.icatdamageestimator.com/commonsearch
- We added a column of highest wind speed (mph) using the Wikipedia as the data source.

### Notes

1. The multiverse specification has two versions: `template.py`, which follows the decision definitions
in page 4 of Simonsohn's appendix and creates 864 universes, and `repro.R`, which replicates Simonsohn's
code implementation to create 1728 universes. The difference is due to separating the first decision (of size 6)
into a cross product of two decisions (3x4), thus doubling the size of the final multiverse.

2. As we used a slightly different dataset than the one used by Jung et al., we did not obtain the same result when using the original specification in Jung's study.

3. About 40 universes, all fitting a negative binomial model, will fail because
of this error:
```
Error in glm.fitter(x = X, y = Y, w = w, etastart = eta, offset = offset,  :
  NA/NaN/Inf in 'x'
Calls: glm.nb -> glm.fitter
```
The helper script `debug_count.py` outputs which universes had failed.

repository: eduardobsg/boba

repo_name: eduardobsg/boba


text:
# Milestone #2
In this milestone, you will extend your first milestone by extending your basic card game framework into a game of blackjack.

## Basic Functional Requirements
1. Your game needs to implement a [standard dealer AI](https://www.888casino.com/blog/blackjack-strategy-guide/how-to-play-blackjack)
2. Your game should use a C# ```List``` data structure for holding one or more decks
3. Your game should allow the user to specify the number of decks that will be used
4. Players should have a "bank" of money which they can bet from

### Advanced Functional Requirements
1. Your game allows players to "double down" or "split" their bet when appropriate
2. Your game allows players to take insurance and give appropriate bonus payout for blackjack
3. Your game allows for "multiple players" (more than one player deck on same screen)

### Super Advanced Functional Requirements
1. Your game supports networked multiplayer
2. Your game supports a Player AI that can count cards and uses an intelligent betting system.  Consider reading up on [AI/ML in C#](https://dotnet.microsoft.com/apps/machinelearning-ai).

## Basic Design Requirements
1. Your cards should have proper front (visible) and back (hidden) art. https://opengameart.org has some great free art that you can use.  For example, see [this](https://opengameart.org/content/casino-pack) and [this](https://opengameart.org/content/colorful-poker-card-back)

### Advanced Design Requirements
1. Card flips are animated
2. You create a 3D blackjack game
3. You create a unique art style (e.g. retro pixel art or whatever else)

## Grading
This assignment is worth 100 points.  Your grade will be based on the following:
* Completing the basic Functional and Design requirements or making reasonable substitutions from the advanced feature list (check with me first!)
* Using the ```List``` data structure when appropriate
* Regular, appropriately sized github checkins (no single-line checkins, no 1000+ line checkins)
* Maintaining a [design diary](../design_diary_prompts.md) for this assignment (place in the root of your project repository)
* Demonstrating reasonable progress during Lab 3 on February 7, 2020

## Due Date
This assignment is due midnight, February 14, 2020.  You will turn in your project by checking your code into github and by submitting a link to that repository on Canvas. Next, create an GIF walkthrough of your program using [LICEcap](https://www.cockos.com/licecap/).  Upload this image to your repository and put a link to the image in your reflection. *Be sure to place your reflection in _the root folder_ of your repository!*

path: /milestones/milestone 2/readme.md

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
---
layout: default
---

# 1993-10-05 - Re: Chaum on the wrong foot?

## Header Data

From: peter honeyman<EMAIL_ADDRESS>To<EMAIL_ADDRESS>Message Hash: 2de296a4713c424a92db95c2bb4112d60de641a466928cd892f78161c1e3d31b

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1993-10-05 23:35:06 UTC

Raw Date: Tue, 5 Oct 93 16:35:06 PDT

## Raw message

```
{% raw  %}From: peter honeyman<EMAIL_ADDRESS>Date: Tue, 5 Oct 93 16:35:06 PDT
To<EMAIL_ADDRESS>Subject: Re: Chaum on the wrong foot?
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

> Can you post the references for these papers?

sure.  i got them from ftp.cwi.nl in directory /pub/CWIreports/AA/.

CS-R9318.ps.Z is N. Ferguson "Single Term Off-Line Coins."  it is 13 pp.

CS-R9323.ps.Z is Stefan Brands "An Efficient Off-line Electronic Cash
System Based On The Representation Problem."  it is 77 pp.

does anyone else have any digital cash papers on-line?

	peter

{% endraw %}
```

## Thread

+ Return to [October 1993](/archive/1993/10)

+ Return to "[peter honeyman <honey@citi.umich.edu>](/authors/peter_honeyman_honey_at_citi_umich_edu_)"

+ 1993-10-05 (Tue, 5 Oct 93 16:35:06 PDT) - Re: Chaum on the wrong foot? - _peter honeyman<EMAIL_ADDRESS>

license: MIT

gha_license_id: MIT


text:
# Security

If you find a security vulnerability in cap-consumer, file a [new issue](https://github.com/lykmapipo/cap-consumer/issues).

repository: lykmapipo/cap-consumer

gha_language: JavaScript

repo_name: lykmapipo/cap-consumer


text:
# Home assistant add-on: alexbelgium

## About

My home assistant addon repository.
In case of issue, create an issue in the repository and reference the full log from supervisor (all red or white text).

- ![smb][smb-shield] : allows accessing smb shares, or a local external disk
- ![sql][sql-shield] : requires an external sql database server
- ![stale][stale-shield] : will be updated but not tested each time
- ![privileged][privileged-shield] : requires protection mode off to run

## Installation

Adding this add-ons repository to your Home Assistant instance is
pretty easy. Follow [the official instructions](https://home-assistant.io/hassio/installing_third_party_addons) on the
website of Home Assistant, and use the following URL:

```
https://github.com/alexbelgium/hassio-addons
```

## Available addons

[//]: # "ADDONLIST_START"

### ✓ [Addons Updater](addons_updater/)

- Automatic addons update by aligning version tag with github upstream releases

### ✓ [Bitwarden](bitwarden/)

- Open source password management solution
- Forked from : https://github.com/hassio-addons/addon-bitwarden

### ✓ [Code-server](code-server/)

- Code-server is VS Code running on a remote server, accessible through the browser.
- Based on https://hub.docker.com/r/linuxserver/code-server

### ✓ [Doublecommander](doublecommander/) ![smb][smb-shield]

- A free cross platform open source file manager with two panels side by side.
- Based on https://hub.docker.com/r/linuxserver/doublecommander

### ✓ [Emby](emby/) ![smb][smb-shield]

- A Free Software Media System that puts you in control of managing and streaming your media.
- Based on https://hub.docker.com/r/linuxserver/emby
- Forked from : https://github.com/petersendev/hassio-addons

### ✓ [Filebrowser](filebrowser/)

- A file manager for the web
- This addon is based on the [docker image](https://hub.docker.com/r/hurlenko/filebrowser).

### ✓ [Joal](joal/)

- An open source command line RatioMaster with WebUI.

### ✓ [Nextcloud OCR](nextcloud/) ![smb][smb-shield]

- A Nextcloud container, brought to you by LinuxServer.io.
- Based on linuxserver image : https://hub.docker.com/r/linuxserver/nextcloud
- Forked from : https://github.com/haberda/hassio_addons

### ✓ [Papermerge](papermerge/) ![smb][smb-shield]

- Open source document management system (DMS)
- Based on https://hub.docker.com/r/linuxserver/papermerge

### ✓ [Piwigo](piwigo/) ![smb][smb-shield] ![sql][sql-shield]

- Piwigo is a photo gallery software for the web
- Based on https://hub.docker.com/r/linuxserver/piwigo

### ✓ [Qbittorrent](qbittorrent/) ![smb][smb-shield]

- Based on https://hub.docker.com/r/linuxserver/qbittorrent

### ✓ [Radarr](radarr/) ![smb][smb-shield] ![stale][stale-shield]

- A fork of Sonarr to work with movies like Couchpotato
- Based on https://hub.docker.com/r/linuxserver/radarr

### ✓ [Scrutiny](scrutiny/)

- Scrutiny WebUI for smartd S.M.A.R.T monitoring
- Based on https://hub.docker.com/r/linuxserver/scrutiny

### ✓ [Transmission](transmission/) ![smb][smb-shield]

- The torrent client for Hass.io.
- Based on https://hub.docker.com/r/linuxserver/transmission

### ✓ [Ubooquity](ubooquity/) ![smb][smb-shield]

- Free, lightweight and easy-to-use home server for your comics and ebooks
- Based on https://hub.docker.com/r/linuxserver/ubooquity

[//]: # "ADDONLIST_END"
[stale-shield]: https://img.shields.io/badge/Stale--orange.svg
[smb-shield]: https://img.shields.io/badge/SMB--green?style=plastic.svg
[sql-shield]: https://img.shields.io/badge/SQL-external-orange.svg
[privileged-shield]: https://img.shields.io/badge/privileged-required-orange.svg


text:
# `social-components`

Experimental building blocks for a generic social service.

A React implemenation is available in [`social-components-react`](https://gitlab.com/catamphetamine/social-components-react).

## Install

```
npm install social-components --save
```

## Use

Currently this library is only used as a dependency of [`imageboard`](http://npmjs.com/package/imageboard) and [`webapp-frontend`](https://gitlab.com/catamphetamine/webapp-frontend).

The [`<Post/>` React component](https://gitlab.com/catamphetamine/webapp-frontend/blob/master/src/components/Post.js) is currently being experimented on.

## Model

* [Post](https://gitlab.com/catamphetamine/social-components/blob/master/docs/Post.md)
* [Content](https://gitlab.com/catamphetamine/social-components/blob/master/docs/Content.md)
* [ContentTypes](https://gitlab.com/catamphetamine/social-components/blob/master/docs/ContentTypes.md)
* [Attachments](https://gitlab.com/catamphetamine/social-components/blob/master/docs/Attachments.md)

## Services

* [YouTube](https://youtube.com) — Get video by URL or id.
* [Vimeo](https://youtube.com) — Get video by URL or id.
* [Instagram](https://instagram.com) — Get post by URL or id.
* [Twitter](https://twitter.com) — Get tweet by URL or id.

## API

### `getPostText(post: Post, options: object?): string?`

```js
import getPostText from 'social-components/utility/post/getPostText.js'
```

Returns a textual representation of a [Post](https://gitlab.com/catamphetamine/social-components/blob/master/docs/Post.md)

Availble `options`:

 * `softLimit: number` — A "soft" limit on the resulting text length. "Soft" means that the resulting text may exceed the limit.
 * `messages: object?` — Localized labels ("Video", "Picture", etc). See [Messages](#messages).
 * `getLinkTitle?: (linkElement: object) => string?` — Formats an "untitled" link: a link for which a custom title was not set. By default, when this function is not present, links are formatted using `messages.textContent.inline.linkTo`, if it's present, or are output as the URL itself. If this function doesn't return anything then it's ignored.
 * `skipPostQuoteBlocks: boolean?` — Skip all "block" (not "inline") post quotes.
 * `skipGeneratedPostQuoteBlocks: boolean?` — Skip all autogenerated "block" (not "inline") post quotes. Is `true` by default.
 * `skipAttachments: boolean?` — Skip attachments (embedded and non-embedded). Is `true` by default.
 * `skipNonEmbeddedAttachments: boolean?` — Skip non-embedded attachments. Is `true` by default.
 * `skipUntitledAttachments: boolean?` — Skip untitled attachments (embedded and non-embedded). Is `true` by default.
 * `spaceOutParagraphs: boolean?` — Defines how text for adjacent content blocks should be concatenated. By default, it concatenates it with `\n\n`. It `spaceOutParagraphs: false` flag is passed, it concatenates the text for adjacent content blocks with `\n`.
 * `trimCodeBlocksToFirstLine: boolean?` — Trim code blocks to first line. Is `true` by default.
 * `stopOnNewLine: boolean?` — If `true` then the function will stop on the first "new line" character of the generated text.

### `getInlineContentText(content: Content, options: object?): string?`

```js
import getInlineContentText from 'social-components/utility/post/getInlineContentText.js'
```

Returns a textual representation of an [InlineContent](https://gitlab.com/catamphetamine/social-components/blob/master/docs/Content.md#inline-content). Use this function as an equivalent of `getPostText()` for inline-level content.

### `transformContent(content: Content, transform: function)`

```js
import transformContent from 'social-components/utility/post/transformContent.js'
```

Recursively walks all parts of [`content`](https://gitlab.com/catamphetamine/social-components/blob/master/docs/Content.md), calling `transform(part)` for each such part. If `transform(part)` returns:

* `undefined`, then the `part` is left unchanged, and it will recurse into the `part`'s `.content`.
* `false`, then the `part` is left unchanged, and it won't recurse into the `part`'s `.content`.
* an array, then the array is expanded in place of the `part`.
* anything else, then the `part` is substituted with that.

### `generatePostQuote(post: Post, options: object?): string?`

```js
import generatePostQuote from 'social-components/utility/post/generatePostQuote.js'
```

Generates a textual representation of a [Post](https://gitlab.com/catamphetamine/social-components/blob/master/docs/Post.md), that's intended to be used in a quote citing the post. Uses `getPostText()` under the hood: first starts with a strict set of options, then gradually relaxes them until some text is generated. Then compacts inter-paragraph margins into just "new line" characters, and trims the resulting text to fit into `options.maxLength` (adjusted by `options.minFitFactor` and `options.maxFitFactor`).

Availble `options`:

* All `getPostText()` options are passed through.
* `maxLength: number` — A limit on the resulting text length.
* `minFitFactor: number?` — Provides some flexibility when defining `maxLength` lower boundary. See `minFitFactor` option of `trimText()`.
* `maxFitFactor: number?` — Provides some flexibility when defining `maxLength` upper boundary. See `maxFitFactor` option of `trimText()`.
* `getCharactersCountPenaltyForLineBreak?: ({ textBefore: string }) => number` — See `getCharactersCountPenaltyForLineBreak` option of `trimText()`.
* `trimMarkEndOfLine: string?` — See `trimMarkEndOfLine` option of `trimText()`.
* `trimMarkEndOfSentence: string?` — See `trimMarkEndOfSentence` option of `trimText()`.
* `trimMarkEndOfWord: string?` — See `trimMarkEndOfWord` option of `trimText()`.
* `trimMarkAbrupt: string?` — See `trimMarkAbrupt` option of `trimText()`.

### `generatePreview(post: Post, options: object): Content?`

```js
import generatePostPreview from 'social-components/utility/post/generatePostPreview.js'
```

Generates a preview for a [`Post`](https://gitlab.com/catamphetamine/social-components/blob/master/docs/Post.md) given the `options.limit`. If the post `content` is `undefined` then the returned preview content is too. Otherwise, the returned preview content isn't `undefined`. If the post `content` fits entirely then the preview content will be (deeply) equal to it. Otherwise, preview content will be a shortened version of `content` with a `{ type: 'read-more' }` marker somewhere in the end.

Available `options`:

* `maxLength: number` — Preview content (soft) limit (in "points": for text, one "point" is equal to one character, while any other non-text content has its own "points", including attachments and new line character).
* `minFitFactor: number?` — Provides some flexibility when defining `maxLength` lower boundary: sets it to `minFitFactor * maxLength`. The content then can usually be trimmed anywhere between `minFitFactor * maxLength` and `maxFitFactor * maxLength`. Is `0.75` by default.
* `maxFitFactor: number?` — Provides some flexibility when defining `maxLength` upper boundary: sets it to `maxFitFactor * maxLength`. The content then can usually be trimmed anywhere between `minFitFactor * maxLength` and `maxFitFactor * maxLength` limit. Is `1.2` by default.
* `textTrimMarkEndOfWord: string?` — Appends this "trim mark" when text has to be trimmed after word end (but not after sentence end). Is "…" by default.
* `textTrimMarkAbrupt: string?` — Appends this "trim mark" when text has to be trimmed mid-word. Is "…" by default.
* `minimizeGeneratedPostLinkBlockQuotes: boolean?` — Set to `true` to indicate that post links with generated block quotes are initially minimized when rendered: this results in skipping counting those post links' content characters when generating post preview.

### `trimText(text: string, maxLength: number, options: object?): string`

```js
import trimText from 'social-components/utility/post/trimText.js'
```

Trims the `text` at `maxLength`.

Available `options`:

* `minFitFactor: number?` — Provides some flexibility when defining `maxLength` lower boundary: sets it to `minFitFactor * maxLength`. The content then can usually be trimmed anywhere between `minFitFactor * maxLength` and `maxFitFactor * maxLength`. Is `1` by default, meaning "no effect".
* `maxFitFactor: number?` — Provides some flexibility when defining `maxLength` upper boundary: sets it to `maxFitFactor * maxLength`. The content then can usually be trimmed anywhere between `minFitFactor * maxLength` and `maxFitFactor * maxLength` limit. Is `1` by default, meaning "no effect".
* `getCharactersCountPenaltyForLineBreak?: ({ textBefore: string }) => number` — Returns characters count equivalent for a "line break" (`\n`) character. The idea is to "tax" multi-line texts when trimming by characters count. By default, having `\n` characters in text is not penalized in any way and those characters aren't counted.
* `trimPoint: string?` — Preferrable trim point. Can be `undefined` (default), `"sentence-end"`, `"sentence-or-word-end"`.Preferrable trim point. By default it starts with seeing if it can trim at `"sentence-end"`, then tries to trim at `"sentence-or-word-end"`, and then just trims at any point.
* `trimMarkEndOfLine: string?` — "Trim mark" when trimming at the end of a line. Is "" (no trim mark) by default.
* `trimMarkEndOfSentence: string?` — "Trim mark" when trimming at the end of a sentence. Is "" (no trim mark) by default.
* `trimMarkEndOfWord: string?` — "Trim mark" when trimming at the end of a word. Is " …" by default.
* `trimMarkAbrupt: string?` — "Trim mark" when trimming mid-word. Is "…" by default.

### `censorWords(text: string, filters: WordFilter[]): Content`

```js
import censorWords from 'social-components/utility/post/censorWords.js'
```

Replaces words in `text` matching the `filters` with objects of shape `{ type: "spoiler", censored: true, content: "the-word-that-got-censored" }`. The `filters: WordFilter[]` argument must be a list of word filters pre-compiled with the exported `compileWordPatterns(censoredWords, language)` function (described below).

```js
const FILTERS = compileWordPatterns(['red', 'brown', 'orange'], 'en')

censorWords('A red fox', FILTERS) === [
  'A ',
  { type: 'spoiler', censored: true, content: 'red' }
  ' fox'
 ]
```

### `compileWordPatterns(patterns: string[], language: string): WordFilter[]`

```js
import compileWordPatterns from 'social-components/utility/post/compileWordPatterns.js'
```

Compiles word patterns into `filters` that can be used in `censorWords()`.

Arguments:

* `patterns: string[]` — An array of `string` word patterns. The standard regular expression syntax applies, `^` meaning "word start", `$` meaning "word end", `.` meaning "any letter", etc.

* `language: string` — A lowercase two-letter [language code](https://en.wikipedia.org/wiki/IETF_language_tag) (examples: `"en"`, `"ru"`, `"de"`) that is used to generate a regular expression for splitting text into individual words.

Word pattern syntax:

* `^` — Word start.
* `$` — Word end.
* `.` — Any letter.
* `[abc]` — Any single one of letters: "a", "b", "c".
* `a?` — Optional letter "a".
* `.*` — Any count of any letter.
* `.+` — One or more of any letter.
* `.{0,2}` — Zero to two of any letter.

Word pattern examples:

* `^mother.*` — Matches `"mothercare"` and `"motherfather"`.

* `^mother[f].*` — Matches `"motherfather"` but not `"mothercare"`.

* `^mother[^f].*` — Matches `"mothercare"` but not `"motherfather"`.

* `^cock$` — Matches `"cock"` in `"my cock is big"` but won't match `"cocktail"` or `"peacock"`.

* `cock` — Matches `"cock"`, `"cocktail"` and `"peacock"`.

* `cock$` — Matches `"cock"` and `"peacock"` but not `"cocktail"` .

* `^cocks?` — Matches `"cock"` and `"cocks"`.

* `^cock.{0,3}` — Matches `"cock"`, `"cocks"`, `"cocker"`, `"cockers"`.

### `loadResourceLinks(post: Post, options: object?): Promise`

```js
import loadResourceLinks from 'social-components/utility/post/loadResourceLinks.js'
```

Loads "resource" links (such as links to YouTube and Twitter) by loading the info associated with the resources. For example, sets video `.attachment` on YouTube links and sets "social" `.attachment` on Twitter links.

Returns an object having a `cancel()` function and a `promise` property. Calling `stop()` function prevents `loadResourceLinks()` from making any further changes to the `post` object. Calling `cancel()` function multiple times or after the `promise` has finished doesn't have any effect. The `promise` is a `Promise` that resolves when all resource links have been loaded. Loading some links may potentially error (for example, if a YouTube video wasn't found). Even if the returned `Promise` errors due to some resource loader, the post content still may have been changed by other resource loaders.

Available `options`:

* `onContentChange: function?` — Is called on this post content change (as a result of a resource link being loaded). For example, it may re-render the post.
<!-- * `onReplyUpdate(id): function?` — When a resource link gets loaded, the post `content` gets updated, and if there're any "replies" to this comment that have "autogenerated" quotes of this comment in their `content`, then those autogenerated quotes get automatically re-generated and those replies' `content` gets updated as a result. And if those replies themselves do have their own replies that have "autogenerated" quotes, then the process repeats recursively. After it finishes, it calls `onReplyUpdate(id)` for each of the affected "descendant" replies so that they could be re-rendered. -->
* `getYouTubeVideoByUrl: function?` — Can be used for getting YouTube videos by URL from cache.
* `youTubeApiKey: (string|string[])?` — YouTube API key. If it's an array of keys then the first non-erroring one is used.
* `loadPost: function?` — This is a hacky point of customization to add some other custom resource loaders. Is used in `captchan` to fix `lynxchan` post attachment sizes and URLs.
* `contentMaxLength: number?` — If set, will re-generate `.contentPreview` if the updated `content` exceeds the limit (in "points").
* `messages: object?` — Localized labels for resource loading. This is not the same thing as [Messages](#messages). This is an object having shape:
  * `videoNotFound?: string` — When loading YouTube video links, if the video was not found, it sets the link's `content` to this text. Example: `"Video not found"`.
* `minimizeGeneratedPostLinkBlockQuotes: boolean?` — See the description of the same option of `generatePostPreview()`.

### `expandStandaloneAttachmentLinks(content: Content)`

Expands attachment links (objects of shape `{ type: 'link', attachment: ... }` into standalone attachments (block-level attachments: `{ type: 'attachment' }`).

<!-- In such case attachments are moved from `{ type: 'link' }` objects to `post.attachments`. -->

```js
import expandStandaloneAttachmentLinks from "social-components/utility/post/expandStandaloneAttachmentLinks"

const content = [
	[
		"See ",
		{
			type: "link",
			attachment: {
				type: "video",
				video: ...
			}
		},
		" for more info."
	]
]

expandStandaloneAttachmentLinks(content)

content === [
	[
		"See "
	],
	{
		type: "attachment",
		attachment: {
			type: "video",
			video: ...
		}
	},
	[
		" for more info."
	]
]
```

### `visitPostParts(type: string, visit: function, content: Content): any[]`

```js
import visitPostParts from .js'social-components/utility/post/visitPostParts.js'
```

Calls `visit(part)` on each part of `content` being of `type` type. Returns a list of results returned by each `visit(part)`. For example, the following example prints URLs of all `{ type: 'link' }`s in a post content.

```js
visitPostParts('link', link => console.log(link.url), post.content)
```

### `trimContent(content: Content, options: object?): Content?`

```js
import trimContent from 'social-components/utility/post/trimContent.js'
```

Trims whitespace (including newlines) in the beginning and in the end of `content`. **`content` internals will be mutated.** Returns the mutated `content` (the original `content` still gets mutated). Returns `undefined` if `content` became empty as a result of the trimming.

Available options:

* `left: boolean` — Pass `left: false` to prevent it from trimming on the left side.
* `right: boolean` — Pass `right: false` to prevent it from trimming on the right side.

```js
trimContent([['\n', ' Text '], ['\n']]) === [['Text']]
```

### `trimInlineContent(inlineContent: InlineContent, options: object?): InlineContent?`

```js
import trimInlineContent from 'social-components/utility/post/trimInlineContent.js'
```

Trims whitespace (including newlines) in the beginning and in the end of `content`. `content` must be an array. **`content` internals will be mutated.** Returns the mutated `content` (the original `content` still gets mutated). Returns `undefined` if `content` became empty as a result of the trimming.

Available options:

* `left: boolean` — Pass `left: false` to prevent it from trimming on the left side.
* `right: boolean` — Pass `right: false` to prevent it from trimming on the right side.

```js
trimInlineContent(['\n', { type: 'text', content: ' Text ' }, '\n'])
  === [{ type: 'text', content: 'Text' }]
```

### `YouTube.getVideoByUrl(url: string, options: object): Promise<object>`

```js
import getVideoByUrl from 'social-components/services/YouTube/getVideoByUrl.js'
```

Parses a YouTube video URL, queries the video info via YouTube V3 Data API and returns a `Promise` resolving to [`{ type: 'video' }`](https://gitlab.com/catamphetamine/social-components/blob/master/docs/ContentTypes.md#video) object.

Available `options`:

* `youTubeApiKey: string` — YouTube V3 Data API key.

Some additional YouTube utilities:

```js
// The list of possible YouTube preview picture ("thumbnail") sizes.
import { PREVIEW_PICTURE_SIZES } from 'social-components/services/YouTube/getVideo.js'
PREVIEW_PICTURE_SIZES[0] === {
  name: 'maxresdefault',
  width: 1280,
  height: 720
}

// Returns a URL of a YouTube video's preview picture ("thumbnail").
import { getPictureSizeUrl } from 'social-components/services/YouTube/getVideo.js'
getPictureSizeUrl(videoId, size.name)

// Returns a YouTube video URL.
import getVideoUrl from 'social-components/services/YouTube/getVideoUrl.js'
getVideoUrl(videoId, { startAt }?)

// Returns a URL for an embedded YouTube video.
// Can be used for embedding a video on a page via an `<iframe/>`.
import getEmbeddedVideoUrl from 'social-components/services/YouTube/getEmbeddedVideoUrl.js'
getEmbeddedVideoUrl(videoId, { autoPlay, startAt }?)
```

### `Vimeo.getVideoByUrl(url: string): Promise<object>`

```js
import getVideoByUrl from 'social-components/services/Vimeo/getVideoByUrl.js'
```

Parses a Vimeo video URL, queries the video info via HTTP REST API and returns a `Promise` resolving to [`{ type: 'video' }`](https://gitlab.com/catamphetamine/social-components/blob/master/docs/ContentTypes.md#video) object.

Some additional Vimeo utilities:

```js
// Returns a Vimeo video URL.
import getVideoUrl from 'social-components/services/Vimeo/getVideoUrl.js'
getVideoUrl(videoId)

// Returns a URL for an embedded Vimeo video.
// Can be used for embedding a video on a page via an `<iframe/>`.
import getEmbeddedVideoUrl from 'social-components/services/Vimeo/getEmbeddedVideoUrl.js'
getEmbeddedVideoUrl(videoId, { color, autoPlay, loop }?)
```

### `Twitter.getTweetByUrl(url: string, options: object): Promise<object>`

```js
import getTweetByUrl from 'social-components/services/Twitter/getTweetByUrl.js'
```

Parses a Vimeo video URL, queries the video info via HTTP REST API and returns a `Promise` resolving to [`{ type: 'social' }`](https://gitlab.com/catamphetamine/social-components/blob/master/docs/ContentTypes.md#social) object.

Available `options`:

* `messages: object?` — Localized labels ("Video", "Picture", etc). See [Messages](#messages).

### `Instagram.getPostByUrl(url: string): Promise<object>`

```js
import getPostByUrl from 'social-components/services/Instagram/getPostByUrl.js'
```

Parses a Vimeo video URL, queries the video info via HTTP REST API and returns a `Promise` resolving to [`{ type: 'social' }`](https://gitlab.com/catamphetamine/social-components/blob/master/docs/ContentTypes.md#social) object.

## Miscellaneous API

### `unescapeContent(string: string): string`

```js
import unescapeContent from 'social-components/utility/unescapeContent.js'
```

Unescapes HTML-escaped text.

```js
unescapeContent("<div/>") === "<div/>"
```

### `getColorHash(string: string): string`

```js
import getColorHash from 'social-components/utility/getColorHash.js'
```

Converts a string to a color.

```js
getColorHash("Some text") === "#aabbcc"
```

### `getHumanReadableLinkAddress(url: string): string`

```js
import getHumanReadableLinkAddress from 'social-components/utility/getHumanReadableLinkAddress.js'
```

Returns a more human-friendly link address:

* Strips "http(s):" protocol.
* Strips the "www." part.
* Removes trailing slash.

### `getContentBlocks(post: Post): any[]`

```js
import getPostThumbnailAttachment from 'social-components/utility/post/getContentBlocks.js'
```

Returns a list of ["content blocks"](https://gitlab.com/catamphetamine/social-components/blob/master/docs/Content.md#content-block) of the `post`'s `.content`. For example, if the `post`'s `.content` is just a string, then it returns an array of that string. Returns an empty array if the `post` has no content.

### `removeLeadingPostLink(post: Post, postLinkTest: (any|function))`

Removes a leading `post-link`, that satisfies the conditions, from the `post`'s `.content`. Can be used to remove parent post quotes from replies when showing the parent post's replies tree.

The `postLinkTest` argument should be the condition for removing a post link: either a post id or a function that returns `true` when the post link should be removed.

```js
import removeLeadingPostLink from 'social-components/utility/post/removeLeadingPostLink.js'

post.replies = post.replies.map((replyPost) => {
	return removeLeadingPostLink(replyPost, post.id)
	// Or, the same:
	// return removeLeadingPostLink(replyPost, (postLink) => postLink.postId === post.id)
})
```

### `getPostThumbnailAttachment(post: Post, options: object?): Attachment?`

```js
import getPostThumbnailAttachment from 'social-components/utility/post/getPostThumbnailAttachment.js'
```

Returns an attachment that could be used as a "thumbnail" for this post. For example, could return a `Picture` or a `Video`.

Available options:

* `showPostThumbnailWhenThereAreMultipleAttachments` — Pass `true` to allow returning post thumbnail in cases when the `post` has multiple thumbnail-able attachments. By default, if the `post` has multiple thumbnail-able attachments, none of them will be returned.

* `showPostThumbnailWhenThereIsNoContent` — Pass `true` to allow returning post thumbnail in cases when the `post` has no `content`. By default, if the `post` has no `content`, no post thumbnail will be returned.

### `getPicturesAndVideos(attachments: Attachment[]): Attachment[]`

```js
import getPicturesAndVideos from 'social-components/utility/post/getPicturesAndVideos.js'
```

Returns `Picture`s and `Video`s.

### `getMinSize(picture: Picture): object`

```js
import getPicturesAndVideos from 'social-components/utility/picture/getMinSize.js'
```

Returns the minimum "size" of a `picture`, "size" being an object of shape: `{ width: number, height: number, url: string }`.

### `getNonEmbeddedAttachments(post: Post): Attachment[]`

```js
import getNonEmbeddedAttachments from 'social-components/utility/post/getNonEmbeddedAttachments.js'
```

Returns a list of post attachments that aren't embedded in the `post`'s `.content`.

### `getSortedAttachments(post: Post): Attachment[]?`

```js
import getSortedAttachments from 'social-components/utility/post/getSortedAttachments.js'
```

Sorts post attachments in the order they appear embedded in the `post`, plus all the rest of them that aren't embedded in the `post`, sorted by thumbnail height descending.

Returns `undefined` if the `post` doesn't have any attachments.

### `getEmbeddedAttachment(block: ContentBlock, attachments: Attachment[]?): Attachment?`

```js
import getEmbeddedAttachment from 'social-components/utility/post/getEmbeddedAttachment.js'
```

Returns an `Attachment` object for an embedded attachment block.

### `hasPicture(attachment: Attachment): boolean?`

```js
import hasPicture from 'social-components/utility/attachment/hasPicture.js'
```

Returns `true` if the `attachment` has a picture. Examples: `Picture`, `Video`.

### `getThumbnailSize(attachment: Attachment): object?`

```js
import getThumbnailSize from 'social-components/utility/attachment/getThumbnailSize.js'
```

Returns the `attachment`'s thumbnail size. Returns `undefined` if the `attachment` doesn't have a thumbnail.

### `createLink(url: string, content: string?): object`

```js
import createLink from 'social-components/utility/post/createLink.js'
```

Creates a [`link`](https://gitlab.com/catamphetamine/social-components/blob/master/docs/Content.md#post-link) object from a link's URL (`url`) and a link's text (`content`). The `link` object can additionally have a `service: string` property (example: `"youtube"`).

The `url` will be parsed to see if a `service` can be detec For example, a YouTube video URL will be parsed and the resulting `link` will have `service` set to `"youtube"` and `content` set to the video ID, and a YouTube icon could then be shown before the link's `content` when the link is rendered (or, if there's no icon for a `service`, a simple `${service}:` prefix could be prepended to it).

### `getMimeType(url: string): string?`

```js
import getMimeType from 'social-components/utility/getMimeType.js'
```

Returns a [MIME type](https://en.wikipedia.org/wiki/Media_type) by file URL (or filesystem path, or filename). Basically, looks at the file extension. Returns `undefined` if the MIME type couldn't be determined.

### `combineQuotes(content: Content)`

```js
import combineQuotes from 'social-components/utility/post/combineQuotes.js'
```

Combines `{ type: "quote" }` objects on consequtive lines into a single `{ type: "quote" }` object with `"\n"`s inside. **Mutates the original `content`**.

### `findContentPart(content: Content, test: function, options: object?): number[]?`

```js
import findContentPart from 'social-components/utility/post/findContentPart.js'
```

Recursively searches `content` for the parts for which the `test(part)` function returns `true`. Returns an "index path" (an array of recursive content part indexes, like a path in a "tree").

The `test` function should be a:

```
function(
	part: (string|object),
	{ getNextPart }
): boolean?
```

Available options:

* `backwards: boolean` — Pass `true` to search from the end to the start of the `content`.
<!-- * `text: boolean` — Pass `true` to only call `test()` on "textual" parts of the `content`. -->

### `splitContent(content: Content, indexPath: number[], options: object?): Content[]`

```js
import splitContent from 'social-components/utility/post/splitContent.js'
```

Splits `content` by an `indexPath` path into two parts: a `leftPart: Content` and a `rightPart: Content`. An `indexPath` of a certain part of `content` could be obtained via `findContentPart()` function.

### `renderTweet(tweetId: string, container: Element, options: object?)`

```js
import renderTweet from 'social-components/Twitter/renderTweet.js'
```

Renders a tweet in a `container`.

Available options:

* `darkMode: boolean` — Pass `true` to render the tweet in dark mode.
* `locale: string` — Viewer's [language code](https://en.wikipedia.org/wiki/IETF_language_tag) (examples: `"en"`, `"ru"`, `"de"`).

### Messages

Messages is an object with localized labels having shape:

* `textContent?: object`
  * `block?: object`
	  * `audio?: string` — `"Audio"`
	  * `video?: string` — `"Video"`
	  * `picture?: string` — `"Picture"`
	  * `attachment?: string` — `"Attachment"`
	* `inline?: object`
	  * `attachment?: string` — `"(attachment)"`
	  * `link?: string` — `"(link)"`
	  * `linkTo?: string` — `"(link to {domain})"`
	    <!-- * An "external" URL is an "absolute" URL — a URL with a domain name. -->
	    * Parameters:
	      * `{domain}` — URL domain name.
	      <!-- * `{path}` — URL path. An empty string when not present or when equal to `"/"`. -->
	  <!--
	  * `linkToInternalUrl?: string` — `"{path}"`
	    * An "internal" URL is a "relative" URL — a URL with no domain name.
	    * Parameters:
	      * `{path}` — URL path. `"/"` when not present.
	  -->

## To do

* `source/services/YouTube/getVideo.js` and `source/services/Vimeo/getVideo.js` both use `fetch()` global function which isn't supported in Node.js. Developers using this package could optionally polyfill `fetch()` on server side (for example, see `/fetch-polyfill`).
* `source/services/Twitter/getTweet.js` and `source/services/Instagram/getPost.js` both use `fetch-jsonp` which doesn't work in Node.js. Some tests are skipped because of that (`describe.skip()`). Maybe somehow substitute `fetch-jsonp` for server side.

## GitHub Ban

On March 9th, 2020, GitHub, Inc. silently [banned](https://medium.com/@catamphetamine/how-github-blocked-me-and-all-my-libraries-c32c61f061d3) my account (erasing all my repos, issues and comments) without any notice or explanation. Because of that, all source codes had to be promptly moved to GitLab. The [GitHub repo](https://github.com/catamphetamine/social-components) is now only used as a backup (you can star the repo there too), and the primary repo is now the [GitLab one](https://gitlab.com/catamphetamine/social-components). Issues can be reported in any repo.

## License

[MIT](LICENSE)

repository: catamphetamine/social-components

repo_name: catamphetamine/social-components


text:
#Introduction
## Tools Selection
In the beginning, I spent sometime about searching for various tools that I may use in my project.

### Deep Learning Framework
I started with finding a suitable deep learning framework for this project. Here I am listing all the options I considered.

* [**Tensorflow**](https://www.tensorflow.org/)
* [**Theono**](http://deeplearning.net/software/theano/)
* [**Keras**](https://keras.io/)
* [**Caffe**](http://caffe.berkeleyvision.org/)
* [**Torch**](http://torch.ch/)
* [**Dl4j**](https://deeplearning4j.org/)

I had used Tensorflow earlier, so without much doubt, Tensorflow was my first choice. But to make things little easy, I chose to go with Keras(with Tensorflow backend). I found that it provides an easy implementation of deep neural nets. I installed Keras with Tensorflow as the backend, with GPU support.

repository: krishnapalS/Named-Entity-Recognition

repo_name: krishnapalS/Named-Entity-Recognition


text:
---
layout: default
title: Speak a shared language with developers
nav: Benefits
permalink: /benefits/speak-a-shared-language-with-developers/
sidenav: benefits-side-nav
---
# {{ page.title }}

- This is not about designers learning to code, or developers learning to design for that matter.
- Using design tokens helps both designers and developers feel comfortable that they're talking about the same thing.
- The Design System has its own lexicon; trying to use it this knowledge is like trying to navigate a foreign city where you don't know the language.
- Using the language of design tokens helps designers better communicate their intent and raise their expectations for the level of implementation quality.

## Recommended Resources
- Watch this video, [What the #&%$ are Design Tokens?!](https://www.youtube.com/watch?v=wtTstdiBuUk), to further understand how tokens can help you communicate and collaborate with developers.

license: Unlicense,MIT

repository: pglevy/uswds-design-tokens-guide

branch_name: refs/heads/main

detected_licenses: Unlicense MIT

repo_name: pglevy/uswds-design-tokens-guide


text:
---
layout: category
title:  "Lab FAQs"
date:   2016-08-22
excerpt: "Psych 3450"
tags: [writing,Psych 3450,assignments]
project: false
comments: false
categories:
  - Labs
---
### What skills will you learn?
The lab course will introduce you the tools necessary to run experimental psychology experiments. These skills will benefit those who plan to pursue a career in psychology or other research related field. You will also be trained to become a better writer and communicator. One of the primary goals is to develop your scientific thinking and communication skills. You will learn how to write an APA style research report and give a presentation that summarizes scientific data. Learning to become a better communicator will give you the advantage in the job market.

### Seems like a lot of writing...
This course is a writing intensive course, it will require a moderate level of effort. BUT, we will train you to become a better writer, and the course has been designed to make sure that you have enough time to complete assignments. If you are unsure of your writing ability that's ok. Everyone will be the given the opportunity to learn from their mistakes, and improve their final grade.

In general, the papers should be a minimum of 5 pages each, which isn't too long. Also, one goal of the course is to learn APA style. You will find out that sizeable portions of each paper are simply about following formatting rules.

### If I don't like my grade can I revise and resubmit my paper?
Whether you can revise and resubmit is determined by your individual lab instructor.

### What's the deal with class presentations?
The ability to verbally communicate information is incredibly important, and it is a skill that requires practice. You will be given instruction during the labs and lectures about how to improve your presentation skills. Your first presentation will be a 5 minute individual presentation, and the second will be a 10 minute group presentation.

### Do I get to run my own experiment?
YES. The lab is divided into projects and papers. For the first two papers you will be running predefined experiments on a computer. The third and final paper involves a group project where you will work with your group to come up with your own research project. However, before you join your group, you will create your own idea for a research project and propose your project to the class (this is your 5 minute individual presentation).

For all of the lab projects you will be asked to create, implement, and analyze experimental procedures in class.

### What computer skills are involved?
All of the labs will require you to have a basic working knowledge of excel. You will use excel for organizing data, doing basic statistics, and for creating graphs. You will also use SPSS to analyze your data. You may also use powerpoint for presentations, and even for running your own experiments. You will learn these skills throughout the lab course.

gha_language: CSS

gha_license_id: NOASSERTION


text:
# 2021-game-development-course

Starting place for this year's game development course.

During this year course we will be going over intermediate game design concepts using Godot 3.x and Blender. You will also learn basic work flow techniques using github's versioning system, issue tracker, and projects tool. All assets created in this repository are avaiable under the permissive Creatives Commons license and can be used (with attribution) in any project free or commercial.

## Prequisites

1. Github account.
2. Basic understanding of Godot.
3. Basic understanding of Blender.

## Recommended

1. Access to a microphone to record sounds.
2. Reference images for characters animations.
3. A well formed idea for your game.

### About this repository

This repository containes template code covering the concepts taught the last two years not including the assets used in those games.

Included:

* Basic menu using UI tools
* Basic enviroment
* Directory structure designed to help manage large projects.
* 3D player template based on Godot's first person shooter template (more about this in further lessons)
* Test ground "level"
* Attract screen to play behind main menu.

### Using this repository

1. Fork.
2. Rename.
3. Profit?

We will go over the general stucture of the repository in the first lesson as well as how to manage the project.


text:
# WizardVan: A Sensu Metrics Relay

[![Coverage Status](https://coveralls.io/repos/opower/sensu-metrics-relay/badge.png?branch=master)](https://coveralls.io/r/opower/sensu-metrics-relay?branch=master) [![Build Status](https://travis-ci.org/opower/sensu-metrics-relay.png?branch=master)](https://travis-ci.org/opower/sensu-metrics-relay)

WizardVan uses a combination of a handler and a metric extension to open
persistent TCP connections between the Sensu servers and back-end metric store
for firehose relaying of metrics events from Sensu to metric stores.

Handler extensions are useful in firehose situations.  You could easily write a
handler plug-in to do this, but an extension would be significantly less
resource intensive. Were a simple firehose implemented in a plug-in, every
event would cause a fork of the parent ruby process and writing data over a TCP
(more likely) or UDP connection.

An extension, on the other hand, could maintain persistent TCP connections to
the firehose destination and simply write serialized event data over that
connection. In high-volume metrics installations, 10-100k metrics per minute or
more, this kind of optimization is a requirement.

It also includes some mutation functionality to mutate from Graphite
to OpenTSDB as well as accepts a new metric format for submitting metrics
in JSON and mutating from that to any number of configured metric
backends. To implement a mutator you simply need to define the endpoint
in the relay configuration and then define a mutator in metrics.rb.

**NOTE**: If you are pushing metrics in a format other than Graphite, you will
have to to add "output\_type": "opentsdb" or "json" to your check definitions.

## Installation

As root:

1. cp -R lib/sensu/extensions/\* /etc/sensu/extensions
2. cp config\_relay.json /etc/sensu/conf.d
3. Edit the values in config\_relay.json according to your environment.
4. Restart sensu-server

Relay currently supports "graphite" and "opentsdb" as metric back-ends.

## Configuration

config\_relay.json:

```json
{
  "relay": {
    "graphite": {
        "host": "<IP_ADDRESS>",
        "port": 60000
    },
    "opentsdb": {
        "host": "<IP_ADDRESS>",
        "port": 4424
    }
  }
}
```

The behavior of the mutator and handler is heavily influenced by several configuration
options. The mutator introduces the concept of "output_type". By default, the extension
assumes an "output_type" of "graphite." If your metrics are outputting anything besides
graphite-formatted metrics, you will need to specify an "output_type" in your metrics
checks that corresponds to a configured relay endpoint.

In the example check below, you will also see the "auto_tag_host" configuration variable.
Most metrics will be associated with a particular host, so this will default to yes.

You must also specify "relay" as your handler.

For example, if you have a metric check that outputs opentsdb:

```json
"checks": {
    "my_check": {
        "name": "opentsdb_metric",
        "output_type": "opentsdb",
        "auto_tag_host": "yes",
        "type": "metric",
        "handler": [ "relay" ],
        "command": "/path/to/opentsdb_metric.rb"
    }
}
```

You would then configure "opentsdb" as an endpoint in relay.

In the configuration example above, you will notice that we define graphite and opentsdb
back-ends. The relay currently includes functionality to mutate between graphite and opentsdb.
So, if you are submitting graphite metrics and define an opentsdb backend in config_relay.json,
then it will automatically mutate from graphite to opentsdb and submit metrics to opentsdb.

## JSON Metric format

The relay currently only supports graphite and opentsdb as endpoints for
mutation from JSON. The JSON format for metrics is as follows:

```json
{
    "name": "metric_name",
    "value": 1,
    # optional epoch time stamp, precision can be higher, but graphite will floor()
    # and does not aggregate metrics, currently.
    "timestamp":<PHONE_NUMBER>
    "tags": {
      "service": "some_service", # optional
      "some_tag": "some_value" # optional
    }
}
```

## Development

### Running the test suite

To run tests continuously with guard, do:

```
bundle exec guard
```

Guard will start up a foreground process that runs the relevant specs every
time you save a file and runs all the (non-slow) specs if you hit enter.  For
fancier interactions and configuration information, see the [guard
documentation](https://github.com/guard/guard) and the [guard-rspec
documentation](https://github.com/guard/guard-rspec).

To run the full suite (this takes up to 10 minutes), do:

```
bundle exec rspec
```

For information on contributing, please see CONTRIBUTING.md

repository: sendgrid-ops/sensu-metrics-relay

gha_language: Ruby

repo_name: sendgrid-ops/sensu-metrics-relay


text:
Policy Reform Files
-------------------

This directory contains examples of policy reform files that can be
combined and modified to create your own policy reform files that
are stored on your local computer.

Such policy reform files can be analyzed on your local computer by
using the `tc` command-line interface to Tax-Calculator as described
in the [user
guide](https://PSLmodels.github.io/Tax-Calculator/uguide.html) or by
writing your own Python programs that import the Tax-Calculator
`taxcalc` package as described in the
[cookbook](https://PSLmodels.github.io/Tax-Calculator/cookbook.html).

[This
document](https://github.com/PSLmodels/Tax-Calculator/blob/master/taxcalc/reforms/REFORMS.md#how-to-specify-a-tax-reform-in-a-json-policy-reform-file)
provides access to several reform files that represent recent tax
reform proposals and guidelines about how to prepare your own reform
files.  Look in particular at the
[FAQ](https://github.com/PSLmodels/Tax-Calculator/blob/master/taxcalc/reforms/TCJA.md#tcja-faq)
on TCJA-related reforms.

repository: grantseiter/Tax-Cruncher-ARP

gha_language: Python

repo_name: grantseiter/Tax-Cruncher-ARP


text:
You can download a zip file that contains *Munee* as well as it's library dependencies. This means there is no need to use Composer.
______

## Step 1: Download Munee.zip File

Download the zip and extract it in your application; preferrably outside of webroot: Download Munee.zip
______

## Step 2: Use Munee in your library

Create a file called `munee.php` that is web accessible and paste in the following

```php
<?php
// Define webroot
define('WEBROOT', __DIR__);
// Include Munee's autoload.php file
require '../munee/autoload.php';
// Echo out the response
echo \Munee\Dispatcher::run(new \Munee\Request());
```

**Important**: Make sure the `cache` folder inside `munee/meenie/Munee` is writable by the server.
**Note:** Update the correct path to the `autoload.php` file.
______

## Step 3: Create A RewriteRule rule - [Optional](/Tips_&_Tricks#no-htaccess)

Open the `.htaccess` file in your webroot and paste in the following:

```bash
#### Munee .htaccess Code Start ####
RewriteRule ^(.*\.(?:css|less|scss|js|coffee|jpg|png|gif|jpeg))$ munee.php?files=/$1 [L,QSA,NC]
#### Munee .htaccess Code End ####
```


text:
### Install MySQL

#### Hostname

| Host         | User | Passwd        |
| ------------ | ---- | ------------- |
| <IP_ADDRESS> | root | Lhfeilaile@01 |

#### Start MySQL

```
systemctl start mysqld
```

#### Get temporary password

```
cat /var/log/mysqld.log | grep password
```

#### Update Password

```
>mysqladmin password -u root -p
Enter password: [Lhfeilaile@01]
New password: [Lhfeilaile@01]
Confirm new password:
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
```

#### Set Password Policy

```
mysql> SHOW VARIABLES LIKE 'validate_password%';

mysql> SET GLOBAL validate_password_policy=LOW;
```

Or we can set it in `my.cnf` file

```
[mysqld]
validate_password_policy=LOW
```

### Account

| Databases | User | Passpord | DDL  |
| :-------- | :--- | :------- | ---- |
|           |      |          |      |
|           |      |          |      |
|           |      |          |      |
|           |      |          |      |
|           |      |          |      |
|           |      |          |      |
|           |      |          |      |
|           |      |          |      |
|           |      |          |      |
|           |      |          |      |
|           |      |          |      |
|           |      |          |      |
|           |      |          |      |

## Creating Databases for Cloudera Software

Create databases and service accounts for components that require databases:

- Cloudera Manager Server
- Cloudera Management Service roles:
  - Activity Monitor (if using the MapReduce service in a CDH 5 cluster)
  - Reports Manager
- Each Hive metastore
- Sentry Server
- Cloudera Navigator Audit Server
- Cloudera Navigator Metadata Server

The databases must be configured to support the MySQL utf8 character set encoding.

Record the values you enter for database names, usernames, and passwords. The Cloudera Manager installation wizard requires this information to correctly connect to these databases.

1. Log in as the

   root

   user, or another user with privileges to create database and grant privileges:

   ```
   mysql -u root -p
   ```

   ```
   Enter password:
   ```

2. Create databases for each service you are using from the below table:

   ```
   CREATE DATABASE <database> DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
   ```

   ```
   Query OK, 1 row affected (0.00 sec)
   ```

   ```
   GRANT ALL ON <database>.* TO '<user>'@'%' IDENTIFIED BY '<password>';
   ```

   ```
   Query OK, 0 rows affected (0.00 sec)
   ```

   You can use any value you want for <database>, <user>, and <password>. The following examples are the default names provided in the Cloudera Manager configuration settings, but you are not required to use them:

   | Service                            | Database  | User   |
   | ---------------------------------- | --------- | ------ |
   | Cloudera Manager Server            | scm       | scm    |
   | Activity Monitor                   | amon      | amon   |
   | Reports Manager                    | rman      | rman   |
   | Hue                                | hue       | hue    |
   | Hive Metastore Server              | metastore | hive   |
   | Sentry Server                      | sentry    | sentry |
   | Cloudera Navigator Audit Server    | nav       | nav    |
   | Cloudera Navigator Metadata Server | navms     | navms  |
   | Oozie                              | oozie     | oozie  |

3. Confirm that you have created all of the databases:

   ```
   SHOW DATABASES;
   ```

   You can also confirm the privilege grants for a given user by running:

   ```
   SHOW GRANTS FOR '<user>'@'%';
   ```

## Setting Up the Cloudera Manager Database

After completing the above instructions to install and configure MySQL databases for Cloudera software, continue to [Step 5: Set up the Cloudera Manager Database](https://www.cloudera.com/documentation/enterprise/6/6.0/topics/prepare_cm_database.html) to configure a database for Cloudera Manager.

**Categories:** [Configuring](https://www.cloudera.com/documentation/enterprise/6/6.0/categories/hub_configuring.html) | [Databases](https://www.cloudera.com/documentation/enterprise/6/6.0/categories/hub_databases.html) | [Installing](https://www.cloudera.com/documentation/enterprise/6/6.0/categories/hub_installing.html) | [JDBC](https://www.cloudera.com/documentation/enterprise/6/6.0/categories/hub_jdbc.html) | [MySQL](https://www.cloudera.com/documentation/enterprise/6/6.0/categories/hub_mysql.html) | [Starting and Stopping](https://www.cloudera.com/documentation/enterprise/6/6.0/categories/hub_starting_and_stopping.html) | [All Categories](https://www.cloudera.com/documentation/enterprise/6/6.0/categories/hub.html)

# Create database

- [x] Enable Root Login

```
GRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY 'Lhfeilaile@01';
```

- [x] Master

```shell
CREATE DATABASE cloud_master
  DEFAULT CHARACTER SET utf8
  DEFAULT COLLATE utf8_general_ci;

CREATE USER 'cloud_admin'@'localhost' IDENTIFIED BY 'Admin_1473';

GRANT ALL ON cloud_master.* TO 'cloud_admin'@'localhost' IDENTIFIED BY 'Admin_1473';
GRANT ALL ON cloud_master.* TO 'cloud_admin'@'%' IDENTIFIED BY 'Admin_1473';

FLUSH PRIVILEGES;
```

- [x] Hive

```
CREATE DATABASE cloud_hive
  DEFAULT CHARACTER SET utf8
  DEFAULT COLLATE utf8_general_ci;

CREATE USER 'cloud_hive'@'localhost' IDENTIFIED BY 'Hiveuser_1473';

GRANT ALL ON cloud_hive.* TO<EMAIL_ADDRESS>IDENTIFIED BY 'Hiveuser_1473';
GRANT ALL ON cloud_hive.* TO 'cloud_hive'@'%' IDENTIFIED BY 'Hiveuser_1473';

FLUSH PRIVILEGES;
```

- [x] Oozie

```
CREATE DATABASE cloud_oozie
  DEFAULT CHARACTER SET utf8
  DEFAULT COLLATE utf8_general_ci;

CREATE USER 'cloud_oozie'@'localhost' IDENTIFIED BY 'Oozieuser_1473';
GRANT ALL ON cloud_oozie.* TO<EMAIL_ADDRESS>IDENTIFIED BY 'Oozieuser_1473';
GRANT ALL ON cloud_oozie.* TO 'cloud_oozie'@'%' IDENTIFIED BY 'Oozieuser_1473';

FLUSH PRIVILEGES;
```

- [x] Druid

```
CREATE DATABASE cloud_druid
  DEFAULT CHARACTER SET utf8
  DEFAULT COLLATE utf8_general_ci;

CREATE USER 'polaris_druid'@'localhost' IDENTIFIED BY 'Druid_1473';

GRANT ALL ON cloud_druid.* TO<EMAIL_ADDRESS>IDENTIFIED BY 'Druid_1473';

GRANT ALL ON cloud_druid.* TO 'polaris_druid'@'%' IDENTIFIED BY 'Druid_1473';

FLUSH PRIVILEGES;
```

- [x] Superset

```
CREATE DATABASE cloud_superset
  DEFAULT CHARACTER SET utf8
  DEFAULT COLLATE utf8_general_ci;

CREATE USER 'cloud_superset'@'localhost' IDENTIFIED BY 'Superset_1473';

GRANT ALL ON cloud_superset.* TO<EMAIL_ADDRESS>IDENTIFIED BY 'Superset_1473';

GRANT ALL ON cloud_superset.* TO 'cloud_superset'@'%' IDENTIFIED BY 'Superset_1473';

FLUSH PRIVILEGES;
```

- [x] Ranger

```
CREATE DATABASE cloud_ranger
  DEFAULT CHARACTER SET utf8
  DEFAULT COLLATE utf8_general_ci;

CREATE USER 'cloud_ranger'@'localhost' IDENTIFIED BY 'Rangeruser_1473';
GRANT ALL ON cloud_ranger.* TO<EMAIL_ADDRESS>IDENTIFIED BY 'Rangeruser_1473';
GRANT ALL ON cloud_ranger.* TO 'cloud_ranger'@'%' IDENTIFIED BY 'Rangeruser_1473';

FLUSH PRIVILEGES;
```

- [x] KMS

```
CREATE DATABASE cloud_kms
  DEFAULT CHARACTER SET utf8
  DEFAULT COLLATE utf8_general_ci;

CREATE USER 'cloud_rangerkms'@'localhost' IDENTIFIED BY 'KMSuser_1473';

GRANT ALL ON cloud_kms.* TO<EMAIL_ADDRESS>IDENTIFIED BY 'KMSuser_1473';

GRANT ALL ON cloud_kms.* TO 'cloud_rangerkms'@'%' IDENTIFIED BY 'KMSuser_1473';
```

```
GRANT ALL ON cloud_kms.* TO<EMAIL_ADDRESS>IDENTIFIED BY 'KMSuser_1473';

GRANT ALL ON cloud_kms.* TO 'cloud_rangerkms'@'%' IDENTIFIED BY 'KMSuser_1473';
```

```
mysql>FLUSH HOSTS;

$mysqladmin flush-hosts -u
```

update max_connect_errors

```
show variables like '%max_connect_errors%';

set global max_connect_errors =<PHONE_NUMBER>370954751;
```

Establishing SSL connection without server’s identity verification is not recommended

```
jdbc.url=jdbc:mysql://***/***?useSSL=false
```

repository: lhfei/cloud-doc

repo_name: lhfei/cloud-doc


text:
### [CVE-2010-3510](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2010-3510)
![](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

Unspecified vulnerability in the Oracle WebLogic Server component in Oracle Fusion Middleware 9.0, 9.1, 9.2.3, 10.0.2, 10.3.2, and 10.3.3 allows remote attackers to affect confidentiality, integrity, and availability via unknown vectors related to Node Manager.

### POC

#### Reference
- http://www.oracle.com/technetwork/topics/security/cpujan2011-194091.html

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

repository: trickest/cve

gha_language: HTML

repo_name: trickest/cve


text:
---
title: "Our Daily Reading List - 18/08/2018"
author<EMAIL_ADDRESS>tags: ["margaret","Daily Readings"]
date: 2018-08-18 07:30:11
description: "1

 How Delaware Refreshed Its LLC Act And General #Corp. #Law - by Allison Land and Anne Connolly @Law360  Read Here

2

 Tips On Negotiating A Contract - by Welbaum Guernsey #commercial #law..."
---

[https://clausehound.com/](https://clausehound.com/)

1

###  How Delaware Refreshed Its LLC Act And General #Corp. #Law - by Allison Land and Anne Connolly @Law360  [Read Here](https://www.law360.com/corporate/articles/1069815/how-delaware-refreshed-its-llc-act-and-general-corp-law)

2

###  Tips On Negotiating A Contract - by Welbaum Guernsey #commercial #law [Read Here](http://www.welbaum.com/blog/2018/08/tips-on-negotiating-a-contract.shtml)

Annotated Legal Contracts
for the Price of a Coffee

3

###  Inside The Latest Congressional Hearing On Crypto - by Todd Friedman #legal #technology @TechLaw360 [Read Here](https://www.law360.com/technology/articles/1069385/inside-the-latest-congressional-hearing-on-crypto)

4

###  The 60 second interview: Why law firms shouldn’t build their own #tech - by Denisa Luchian #legal @TheLawyermag [Read Here](https://www.thelawyer.com/60-second-interview-elevate/)

5

###  What Are Some Essentials Driving Small Business Success? - by @R3MLaw #socent #law [Read Here](https://www.r3mlaw.com/blog/2018/08/what-are-some-essentials-driving-small-business-success.shtml)

repository: sahilkanaya/clausehound-blog

repo_name: sahilkanaya/clausehound-blog


text:
# A0::TZMigration

This gem provides utilities to help with migrations between timezone changes. Please check the official webpage for documentation:
[https://a0.github.io/a0-tzmigration/](https://a0.github.io/a0-tzmigration/)

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'a0-tzmigration-ruby'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install a0-tzmigration-ruby

## Usage

```ruby
require 'a0-tzmigration-ruby'

# calculate changes from America/Santiago 2015a to America/Punta_Arenas 2017a
version_a = A0::TZMigration::TZVersion.new('America/Santiago', '2015a')
version_b = A0::TZMigration::TZVersion.new('America/Punta_Arenas', '2017a')

version_a.changes(version_b)
# =>
[{:ini_str=>"-∞", :fin_str=>"1890-01-01 04:43:40 UTC", :off_str=>"-00:00:54", :ini=>-Infinity, :fin=>-2524504580, :off=>-54},
 {:ini_str=>"1910-01-01 04:42:46 UTC", :fin_str=>"1910-01-10 04:42:46 UTC", :off_str=>"+00:17:14", :ini=>-1893439034, :fin=>-1892661434, :off=>1034},
 {:ini_str=>"1918-09-01 04:42:46 UTC", :fin_str=>"1918-09-10 04:42:46 UTC", :off_str=>"-00:42:46", :ini=>-1619983034, :fin=>-1619205434, :off=>-2566},
 {:ini_str=>"1946-09-01 03:00:00 UTC", :fin_str=>"1947-04-01 04:00:00 UTC", :off_str=>"+01:00:00", :ini=>-736376400, :fin=>-718056000, :off=>3600},
 {:ini_str=>"1947-05-22 04:00:00 UTC", :fin_str=>"1947-05-22 05:00:00 UTC", :off_str=>"+01:00:00", :ini=>-713649600, :fin=>-713646000, :off=>3600},
 {:ini_str=>"1988-10-02 04:00:00 UTC", :fin_str=>"1988-10-09 04:00:00 UTC", :off_str=>"-01:00:00", :ini=>591768000, :fin=>592372800, :off=>-3600},
 {:ini_str=>"1990-03-11 03:00:00 UTC", :fin_str=>"1990-03-18 03:00:00 UTC", :off_str=>"-01:00:00", :ini=>637124400, :fin=>637729200, :off=>-3600},
 {:ini_str=>"2016-05-15 03:00:00 UTC", :fin_str=>"2016-08-14 04:00:00 UTC", :off_str=>"-01:00:00", :ini=>1463281200, :fin=>1471147200, :off=>-3600}]

# get current known versions in the repository
A0::TZMigration::TZVersion.versions
# =>
  { "2013c" =>
    { "released_at" => "2013-04-19 16:17:40 -0700",
      "timezones" => [ "Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa/Algiers", "Africa/Asmara", …

# get current known timezones in the repository
A0::TZMigration::TZVersion.timezones
# =>
  { "Africa/Abidjan" =>
    { "versions" => [ "2013c", "2013d", "2013e", "2013f", "2013g", …
```

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).

## Contributing

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

## License

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

## Code of Conduct

Everyone interacting in the A0::TZMigration project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/a0/a0-tzmigration-ruby/blob/master/CODE_OF_CONDUCT.md).


text:
# grunt-merge-data

[![NPM version](https://badge.fury.io/js/grunt-merge-data.svg)](http://badge.fury.io/js/grunt-merge-data)
[![Build Status](https://travis-ci.org/shinnn/grunt-merge-data.svg?branch=master)](https://travis-ci.org/shinnn/grunt-merge-data)
[![Dependency Status](https://david-dm.org/shinnn/grunt-merge-data.svg)](https://david-dm.org/shinnn/grunt-merge-data)
[![devDependency Status](https://david-dm.org/shinnn/grunt-merge-data/dev-status.svg)](https://david-dm.org/shinnn/grunt-merge-data#info=devDependencies)

Merge multiple data into a single JSON file or Grunt config, based on their basename

## Getting Started

This plugin requires Grunt.

If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

```shell
npm install grunt-merge-data --save-dev
```

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

```javascript
grunt.loadNpmTasks('grunt-merge-data');
```

## The `merge_data` task

### Overview
In your project's Gruntfile, add a section named `merge_data` to the data object passed into `grunt.initConfig()`.

```javascript
grunt.initConfig({
  merge_data: {
    options: {
      // Task-specific options go here.
    },
    your_target: {
      src: ['path/to/src/*.{json,y{,a}ml}']
      dest: 'path/to/dest/all.json'
    }
  }
})
```

Running this task with `grunt merge_data` command will merge all data of specified JSON or YAML files into a single JavaScript object, and write it as a JSON file.

Each of the data will be formatted as `{<basename of file>: <data of file>}`.
For example, when the source path of task target specifies two files, such as:

data1.json:

```json
["Classic", "Jazz", "Rock"]
```
data2.yaml:

```yaml
first_name: John
family_name: Smith
```

they will be merged into a JSON file like this:

```json
{
  "data1": ["Classic", "Jazz", "Rock"],
  "data2": {
    "first_name": "John",
    "family_name": "Smith"
  }
}
```

### Options

#### options.data
Type: `Object|Function`
Default: `null`

This is an additional data that will be merged together with the sources files.

This option will overrides existing data of source files.
For example, when `option.data` is `{data1: 'something'}`, the data of `data1.json` won't be reflected in the output.

This value also might be a function taking a data object of source files as the first argument and returns a data object.

```javascript
options: {
  data: function (data) {
    return {
      next_year: data.year + 1,
      prev_year: data.year - 1
    };
  }
}
```

#### options.space
Type: `Number|String`
Default: `null`

This option will be directly passed to the [`space` argument](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#space_argument) of `JSON.stringify`. You can control indent style of output file with this option.

#### options.asConfig
Type: `String|Array|Boolean`
Default: `false`

If you specified the project's Grunt configuration in this option, merge result will be assigned to it. See [Accessing Config Data](http://gruntjs.com/api/grunt.config#accessing-config-data) to use this option.

Or, if you set this option `true`, the `context` property of the task traget will be overwritten with the merge result.

For example, if the task is configured such as:

```javascript
grunt.initConfig({
  merge_data: {
    target1: {
      options: {
        asConfig: true
      },
      src: ['path/to/src/*.{json,y{,a}ml}']
    }
  }
})
```

the merge result will be assigned to `merge_data.target1.context`.

When you use this option, you can also specify the destination path of task target but don't need to.
If you do so, at the same time the Grunt configuration will be updated, the JSON file will be output. Both the configuration and the JSON file will have the same value.

### Usage Examples

#### Default Options

```javascript
grunt.initConfig({
  merge_data: {
    files: {
      'dest/all.json': ['src/data1.json', 'src/data2.json'],
    }
  }
})
```

#### Updating Grunt configuration

```javascript
grunt.initConfig({
  merge_data: {
    options: {
      asConfig: 'someConfig.data'
    },
    src: ['src/data1.json', 'src/data2.json']
  }

  someConfig: {}
})
```

## Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).

## License

Copyright (c) 2013 - 2014 [Shinnosuke Watanabe](https://github.com/shinnn).
Licensed under [the MIT license](./LICENSE).

repository: jbnicolai/grunt-merge-data

repo_name: jbnicolai/grunt-merge-data


text:
# Logs

What I went through to get AndrewBot-Discord up and running. I started this log after doing some initial research. The requirements are:

- A server that is always running (no sleep) (needed for discord's websocket)
- Has automated deployments after merging to master
- A platform environment that can easily be swapped out for another (rpi => digital ocean => PaaS)
- Costs me 0\$ for upkeep

I investigated using [Zeit.co](https://zeit.co) with [next.js](https://nextjs.org) but couldn't use that because zeit doesn't support non-serverless environments (violated the "always running" requirement).

[Digital Ocean's Kubernetes](https://www.digitalocean.com/products/kubernetes/) deployments would make everything super easy, except that it costs ~\$50/month.

[A Digital Ocean droplet(s) running dokku](https://marketplace.digitalocean.com/apps/dokku) would also make everything super easy, except that it costs ~/\$10/month (want to run it on the 2nd lowest tier).

Also considered [heroku](https://www.heroku.com/pricing) but again they wanted to sleep my machines unless I paid \$5/month, might as well go with Digital Ocean (cause I kinda like them better) at that point.

I consulted my brother through the whole process and as we were talking I was wondering what would need to happen to make the original AndrewBot raspberrypi3 B+ work. That's where we start the investigation...

### Friday March 20, 2020

After suggestion from my brother, I investigated [piku](https://github.com/piku/piku); something that I hope will help me easily deploy applications to my local raspberrypi3 model B+.

However before I started, I wanted to shutdown the previously running items including amplify-agent, nginx, and my cron jobs (check-dns, gotd, certbot).

Over the night I `sudo apt update` and `sudo apt full-upgrade -y` to get as up-to-date as possible.

Tomorrow I'll begin installing piku onto AndrewBot, my raspberry pi. I worry that since Piku is heavily based on python methodologies, that the node.js support will be limited...

### Saturday March 21, 2020

Upgrade successful, I also removed custom sources from my apt lists, including old, non-gpg verified yarn installations. I believe they have a new way to install yarn onto debian systems so I'll check that out soon.

Today however, I hope to install piku and see what kind of automatic node.js support I can get. Looking at the piku built-in ansible playbook `nodeenv.yml`'s [documentation](https://github.com/ekalinin/nodeenv), it seems it's very old. The last time this was updated, the latest node version was `0.4.6`, I hope to get the latest LTS of 12 there.

### Saturday March 21, 2020 -- supplemental

I bootstrapped AndrewBot with piku using the installation instructions:

```bash
curl https://piku.github.io/get | sh

# important! bootstrap needs ssh access without password
ssh-copy-id<EMAIL_ADDRESS>
# actually bootstrap the thing
./piku-bootstrap<EMAIL_ADDRESS>```

I had to copy over an ssh key to the root user in order to bootstrap. Previously I was just using password logins. Now I'll have to be sure to always get my ssh key from this laptop...

Anyway, piku installed successfully. Going to see what I need for a node environment.

### Saturday March 21, 2020 -- supplemental

Screw it, piku isn't going to work for me, rolling my own ansible configuration is too much work, and I still don't want to pay money. I'm going with what I know and what is free for now.

I'm cleaning my single private Docker Hub repository I used long ago for my D&D 5E character app to use for this instead. Docker Hub also has a github integration for building and pushing to the hub on merge to master. Bonus!

All I gotta do now is see if github workflows can help me with the restarting process. If that doesn't work I'll see how much work a Docker Hub webhook is to set up (prolly just dns that is hard). Otherwise good ol' polling to see if there is a new version available on an interval on the pi.

### Saturday March 21, 2020 -- supplemental

Bash is sometimes super hard to do stuff, like a health check with a timeout. It's times like these I'm super happy that I can just jump into node.js land and execute a script...

### Saturday March 21, 2020 -- supplemental

Finally got Docker Hub working with my sample server app. Took a lot of googling for why I couldn't `mkdir` on Docker Hub's build step.

Turns out I can't build for a different cpu archicture. The [recommendation](https://github.com/docker/hub-feedback/issues/1261#issuecomment-441126749) was to build the images on the pi itself, but that kinda defeats the purpose. I dunno. might go that route anyway...

For now, I am [installing Docker on my pi](https://www.docker.com/blog/happy-pi-day-docker-raspberry-pi/) and seeing if I can even run the damn thing. Here goes!

### Saturday March 21, 2020 -- supplemental

Success! The images that are built from master via Docker Hub are runnable perfecty by the raspberry pi. now for watchtower.

### Sunday March 22, 2020

I start today evaluating [Watchtower](https://containrrr.github.io/watchtower/). I realized that I have a private docker hub repo for AndrewBot. This means I have to give watchtower (and the pi) my docker hub credentials. I'll need credential support anyway in order to set my discord bot token during runtime so might as well think about this too.

I'm thinking that I'll copy over a `secrets.json` file in a predictable directory, probably `/alorg/secrets.json`. Then I'll have my container mount that file, if it exists into the running container of the app, and I'll be able to require it in node.js. To handle watchtower / docker hub credentials, it seems the raspberry pi already has `jq` installed so I can use that to parse the secrets file and extract a username, then extract the password into a temporary file in order to send via standard in to `docker login --username <name> --password-stdin`. Dunno if this is worth it, could just make the Docker Hub repository public and not have to deal with this nonsense. I mean the code repo is already public...I'll decide later.

For now, onto watchtower.

### Sunday March 22, 2020 -- supplemental

Haven't gotten to watchtower yet. I got sidetracked setting up some more logging on startup and a better Dockerfile. Now it'll handle signals without having to pass them down via a bash script. Also outfitted my simple server with some examples of how to gracefully shutdown the server by capturing signals and unhandled events.

Although, it does mean that to test my app in production vs development is much harder. Might revisit later.

Anyway, now I have the git_hash and branch in my process so that I can know which version of the app I'm running. Thanks to [this post](https://artsy.github.io/blog/2018/09/10/Dockerhub-Stamping-Commits/). Think I'll add an "/info" route that returns the git sha, process id, maybe some other OS level things too? dunno. maybe I'll just have a separate process handle that monitoring stuff.

Hope this docker hub stuff works!

### Sunday March 22, 2020 -- supplemental

Watchtower is pretty nifty. There was some wonkiness with config/credentials. Need to start the andrewbot app with the image name: `index.docker.io/theoperatore/andrew-bot-discord`, then the config.json will match.

```bash
docker run --rm --name watchtower -e WATCHTOWER_DEBUG=true -e WATCHTOWER_POLL_INTERVAL=600 -v /home/pi/.docker/config.json:/config.json -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower:armhf-latest
```

Next step is to create some systemctl services so both andrewbot and watchtower will get restarted if the pi restarts.

### Sunday March 22, 2020 -- supplemental

Well I got everything working, then I rebooted the pi, but it wouldn't stay up. It seem to be kep crashing.

So I decided to start fresh. I flashed the newest verison of rasbian onto the sd card and started again. At least my documentation is up-to-date on how to bring up a headless pi...

### Sunday March 22, 2020 -- supplemental

Ok now I'm on latest raspian buster, installed everything, added watchtower and andrewbot as services in systemctl.

When I rebooted, it took an extra min to be stable, I assume because docker was doing lots of I/O which causes the system to hang waiting for the sd card?

Either way, we're in a stable place. Now going to make a change to the docker file to see if it'll crash if it tries to update the image.

After this, if everything works, I'll call this a good weekend!

### Monday March 23, 2020

Everything is set up, I even got environment variables in there. It's a bit wonky, but it seems to all be working right. I should put together a system diagram of the moving parts just so I know what's going on.

Now that I got the environment all set up, and everything is mostly automatic...I can actually start deving the server!

Progress!

### Tuesday March 24, 2020

Now I have watchtower reading from an env file as well, it should send me emails when it updates, hopefully.

Now that a majority of the infrastructure is in place, I can finally start working on the discord server itself! yay!

### Tuesday March 24, 2020 -- supplemental

I've found that watchtower stop scheduling updates if the notification stack fails. It uses smtp to send mail and by default, the raspberry pi doesn't have smtp as a service running.

Gonna install it via apt and see what happens:

```bash
sudo apt update
sudp apt install ssmtp
```

Here goes.

### Tuesday March 24, 2020 -- supplemental

`ssmtp` is deprecated on `raspian buster`. following the [instructions](https://www.raspberrypi.org/forums/viewtopic.php?t=244147#p1517480) I'm going to try swapping for `msmtp`.

Good ol' outdated packages!

### Tuesday March 24, 2020 -- supplemental

same problem from watchtower. Might skip the email and do notifications at a later date.

```bash
dial tcp: lookup smtp.google.com on <IP_ADDRESS>:53
```

### Tuesday March 24, 2020 -- supplemental

I took 5 mins to see if the slack integration would work and what do you know! It works.

I created a new workspace named `Alorg Notifications` and added a new integration to it named AndrewBot Notifier via slack's api page. Then created a new Incoming Webhook for the andrewbot channel. Copied the webhook url and added it as an environment variable to watchtower and there we go.

Now I got notifications.

### Sunday March 29, 2020

Ok I have separated out my discord app from the api http server. I think I'm all set to start doing actual commands now.

The last thing that I want to automate is the `version`. Every time I commit to master, I want it to bump the patch version. I wonder if I need to do something with a github workflow? maybe an environment variable during the build step? I dunno. I'll look into it later. For now, I'll just manually bump the versions as I see fit.

### Monday March 30, 2020

I wanted to add some tests when I copied over the parser from the old AndrewBot. Getting jest to work with babel with typescript is a real pain, so instead, I added nextjs as a dependency (because I probably want to use that as a small dashboard for andrewbot locally anyway) and then I really don't need to do anything else! Nextjs handles all the transpilation for me.

HOWEVER. It seems adding nextjs as a dependency made the Docker Hub builds fail. The error I was seeing was due to network timeout. A quick google saw that yarn will frequently fail to download files when dependencies are large and the connection is slow. The work around is to just increase the timeout :(

Hopething this will work.

### Tuesday March 31, 2020

Now that everything seems to be stable and the command parsing works, going to try to get the game of the day functionality working.

### Wednesday April 1, 2020

Copied over most of the game of the day files. Now it's a matter of finding the best discord message formatting.

It's tough not having a preview option.

### Wednesday April 1, 2020 -- supplemental

I think I've got it good for now. About to push it to master. Saw a curious thing though, I noticed that andrewbot the raspberry pi was a little sluggish when sshing. Ran a few commands, `htop` and `docker stats` and noticed that each container was allocating ~1Gb of memory. They definitely don't need that much.

I restarted them using the `--memory` command and limited AndrewBot to use `200MiB` and watchtower to use `100Mib`. Going to monitor if this number is adequate during bust moments, like downloading new images for andrewbot or when there is increased stress and load during the "peak" usage hours of the discord channel.

### Wednesday June 3, 2020

It's been a while, but I've been getting requests to add a history feature to AndrewBot. However in doing so, I have found that watchtower doesn't really work too well in the limited environment of the raspberry pi. Instead, I'll do it all manually. When I push to master, github will build and publish a new docker image. Then when I want to deploy to production, I will run an `ansible` playbook to deploy. Bonus, I can use the role `docker-pi` I've made to bootstrap docker on a new raspberry pi. Now it's even easier to template bootstrapping!

Everything is automated, except for logging into Docker Hub. If that isn't required it just works. Otherwise there will be a one-time step to run `docker login` after bootstrapping. :(

Now on to building a firebase integration to save games I've sent to the group!

repository: theoperatore/andrew-bot-discord

gha_language: TypeScript

repo_name: theoperatore/andrew-bot-discord


text:
# Fish Theme: clearance

A minimalist [fish shell](http://fishshell.com/) theme for people who use git

![clearance theme](https://raw.github.com/cseelus/clearance-fish/master/clearance-fish_preview.png)

## Like it?

Check out other versions of this theme for OSX Terminal or VIM!

repository: dyrkin/theme-clearance

repo_name: dyrkin/theme-clearance