text:
---
layout: post
title: Background of temporal relation classification
category: Temporal-Relation
tags: Introduction
description: first part of my works
---
@Author
Guoliang Ji, Kang Liu, Shizhu He, Jun Zhao

AAAI 2017

#### 1. Introduction

#### 1.1 Begging
Temporal relation classification plays an important role in the field of natural language processing. Long short-term memory (LSTM) has been widely used to classify temporal relations. However, existing LSTM-based models usually fail to capture the important information by just using the final hidden state to produce the label. To overcome this drawback, we propose a simple attention-based LSTM model for the temporal relation classification task, which mainly focuses on the awareness of event words and time expressions in processing the final hidden state. We show that our approach outperforms the state-of-the-art on publicly available "Timebank-Dense" corpus.

#### 1.2 Significance
As a subtask of natural language processing (NLP), temporal relation classification has benefitted various NLP related tasks. Take news search [1] as an example, due to the rapid development of information technology, news on the Internet is exploding. Helping users to search for the news they want more quickly become a problem that needs to be handled. Temporal relation classification can be beneficial for timelines construction with which a search engine can provide more accurate results and tips.

#### 1.3 Task Description
 The main task of temporal relation classification is to ordering temporal relations between events and temporal expression within a text. Here, we descripbe them in details.
1.3.1 Event in temporal relation classification
News text
新闻总是不可避免地带有各种事件，而这些事件带有时间属性。例如在下面的新闻中，出现了XXX，XXX等几个事件。

1.3.2 Temporal expression
为了使得报导更加准确，报纸在描述事件时通常会带有时间描述，例如
<IP_ADDRESS> Temporal relation

Temporal relation classiﬁcation aims to identify temporal relations (e.g. BEFORE, OVERLAP, or AFTER) between events and time. For instance, the following sentence shows an example of BEFORE relation between event said and event barred.

>Example 1: He said he believed the "conditions for a meeting" between Mr Trump and Mr Rouhani "in the next few weeks" had been established.

#### contributions
Over the years, several feature-based methods have been explored to address temporal relation classification [2,3,4]. However, most of them rely on manually annotated features and rules which are very time consuming as well as labor intensive. For instance, to improve temporal ordering, Chambers and Jurafsky [5] summarized more than 20 features which range from lexical aspect to grammatical aspect. Moreover, some
features require a large quantity of hand tagged attributes in corpus.

Recently, due to the success of neural networks, various of neural networks-based models such as CNNs [6] and RNNs [7] have been employed to address temporal relation classification. Neural networks-based models have many advantages over feature-based methods. For example, feature-based methods need complex hand-crafted Rules to ensure high performance, while neural networks-based models can automatically learn the rules as well as achieve higher performance simply with more input data.

However, neural networks mentioned above [6, 7] ignore that not all words contribute equally in classifying the right relation. Consider the sentence in example 1, some words (e.g. had, been) are obviously important than other words (e.g. meeting, Trump) in deciding the correct temporal relation. In this paper, we explore to use a word attention to identify such important words in a sentence. The contributions of this paper can be summarized as follows.

1. We employ bi-LSTMs to extract sentence level features from the input text.
2. We explore an attention unit to identify critical words by using event expressions and time expressions. Our proposed attention unit are able to detect which parts are important in the input sentence for classifying temporal relation correctly.
3. We conduct experiments using the "Timebank-Dense" corpus. The experimental results show that the proposed model can effectively improve the performance.

1.4

The rest of this paper is organized as follows. Section 2 summarizes some related works which include feature-based methods and neural network-based methods. Section 3 presents our model in detail. Section 4 describe some experimental settings. Section 5 details the experimental results. The summary of our paper and future work are concluded in section 6.


text:
# JSON Web Token(JWT)

* [Where to Store your JWTs – Cookies vs HTML5 Web Storage](https://stormpath.com/blog/where-to-store-your-jwts-cookies-vs-html5-web-storage)
* [Cookies vs Tokens: The Definitive Guide](https://auth0.com/blog/cookies-vs-tokens-definitive-guide/)
* [Where to save a JWT in a browser-based application and how to use it](http://stackoverflow.com/questions/26340275/where-to-save-a-jwt-in-a-browser-based-application-and-how-to-use-it)
* [10 Things You Should Know about Tokens](https://auth0.com/blog/ten-things-you-should-know-about-tokens-and-cookies/)
* [JSON Web Tokens vs. Session Cookies: In Practice](https://ponyfoo.com/articles/json-web-tokens-vs-session-cookies)
* [八幅漫画理解使用JSON Web Token设计单点登录系统](http://blog.leapoahead.com/2015/09/07/user-authentication-with-jwt/)
* [JWT 可以实现 stateless authentication，但是 refresh token 不是无状态的，那 JWT 的意义是什么？](https://v2ex.com/t/757713#reply46)

license: MIT

repository: northbright/bookmarks

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: northbright/bookmarks


text:
### AWS Machine Learning Stack
#### Four layers
* Service
  - Amazon Polly: convert text to speech; 25 languages; 52 voices; real-time solution.
  - Amazon Lex: text/voice comprehension and response (English, Spanish); build chatbot, detect intent.
  - Amazon Rekognition: picture & video content; object, face, activity, adult content, OCR.
  - Amazon Transcribe: speech to text for call center, video subtitle, meeting note.
  - Amazon Translate: real-time or batch translation.
  - Amazon Comprehend: entity, key phrase, sentiment, insight and relationship; use case: semantic search makes search smarter.

![alt-text](assets/service_arthitect.png)

* Platform
  - SageMaker (flagship for enterprise ML):
    * Support data streaming.
    * Pre-built notebook; high performance algorithm.
    * one-click training, hypyerparameter tuning.
    * One-click deploy, hosting with auto-scaling.
  - AWS Deeplense: HD video camera with built-in CV model.
    * e.g. open garage door when seeing a car
    * Alert owner when dog sits on couch.

* Framework & Interface
  - Caffe2
  - CNTK: cognitive toolkit
  - Apache MXNet
  - PyTorch
  - TensorFlow
  - Torch
  - Keras
  - Gluon: high level DL interface.
  - Apache MXNet

* Infrastructure
  - GPU instances, CPU, IoT/Edge
  - AWS Greengrass: IoT real-time; operate offline; quick response (emergency stopping, medical call); privacy compliance.

#### Some Stats
* Data science spend 80% of time preparing data.
  - Explore data: AWS Glue, Athena
* 50% of models never get implemented.

> The value of data science relies upon operationalizing models within business applications and processes.

___
### Machine Learning for Business Challenges
Use case at Amazon
* What products to recommend at detail page.
* How many units of ASIN will be purchased next month.
* What is customer asking Alexa for.
* Is this a stolen credit card.

When to apply ML:
* When logic is not difficult to program.
* When manual process is not cost effective.
* Lots of data.
* Formalize as regression/classification tasks.

___
### AWS Core Services
#### Interface
* AWS Management Counsel
* AWS Command Line Interface
* AWS SDKs
  - Languages: JS, Python, Node, C++, PHP, Java, Go, .Net, Node.js
  - Incorporate into code.

___
#### EC2: Elastic Compute Cloud
1. Choose AMI (Amazon machine image, software selection)
2. Choose instance type (hardware selection)
3. Instance detail: number of instance, network
4. Add storage
5. Add tags
6. Security groups: firewall rule
* Create a key pair to connect over SSH.

___
#### EBS: Elastic Block Store
* Can choose HDD, SSD.
* Durable & available: duplicated automatically in same zone.
* Use **snapshot** for backup.
* Can create a volume and attach to an existing instance (same zone required)

Set up volume:
1. Choose zone.
2. Choose volume type (magnetic, SSD); size
3. Create volume and get a *Volume ID*
* Under *Volume*, click *Actions*, *Attache Volume*. Specify EC2 instance, device `dev/sdb`

```bash
# check blocks attached
lsblk

# create a file system in the volume
# xvdb is the name shown in lsblk
sudo mke2fs /dev/xvdb

# mount volume (linux)
sudo mount /dev/svdb /mnt

cd /mnt

# unmount
sudo unmount /mnt
```

Detach volume. State changes `in-use` to `available`

___
#### S3: Simple Storage Service
* Fully managed storage service.
  - Fault tolerant; replicated.
* Virtually unlimited number of objects.
* Access & retrieve data any time, from anywhere.
  - virtual private cloud end-point.
  - console, CLI, SDKs, HTTP, HTTPS
  - bucket name must be globally unique, DNS complaint, URL-safe.t
* Rich security control.
* Object is stored as key-value pair. Key resembles file path.

![alt-text](assets/s3_object.png)

1. Create bucket: name, region.
2. Upload object from local machine (file)

```bash
# upload single file
aws s3 cp demo.txt s3://bucket-name-1/hello.txt

# sync folder
aws s3 sync src_dir s3://bucket-name-1/dst_dir
```

3. Log into EC2, which must have access to the S3 bucket.

```bash
# check content
aws s3 ls s3://bucket-name-1 --recursive

# copy file to EC2
aws s3 cp s3://bucket-name-1/hello.txt .

# sync folder
aws s3 sync s3://bucket-name-1/dst_dir ec2_dir
```

___
#### AWS Global Infrastructure
Region
* Host >= 2 availability zones.
* Organizing level for AWS services.
* Optimize for latency, cost, regulatory compliance.
* Resource in one region is not automatically replicated in another.
* All resources are not available in every region.

availability zone
* Collection of data center in a region.
* Connected via fast low-latency network.
* Independent from each other (protected from failure).

Edge Location
* CDN (Amazon Cloud Front).
* Request for content is routed to nearest edge location.

___
#### Virtual Private Cloud (VPC)
* Same concepts as on-premise networking.
* Private network in the AWS Cloud.
* What to expose to the internet, and what to remain private in VPC.
* Divide VPC into subnets
* Route tables
  - Control traffic going out of the subnets
* Internet gateway (IGW)
  - Allow access to the internet from Amazon VPC.
* NAT gateway
  - Allow private subnet resources to access internet.
* Network access control list (NACL)
  - Control access to subnets; stateless.

___
#### Security Groups
* Default: all inbound denied, outbound allowed;
* Best practice: minimum allowed
* `<IP_ADDRESS>/0` means all IP address,

![alt-text](assets/security_groups.png)

___
### Integrated Services
#### Application Load Balancer
![alt-text](assets/app_load_balancer.png)

___
#### Auto-scaling
Add or remove instances.
Launch configuration
* AMI, instance group, security group, roles
Auto scaling group
* VPC, subnets, load balancer, max/min instances, desired capacity
Auto scaling policy
* Scheduled time; on-demand; scale-out scale-in.

___
#### Route 53
Translate domain name to IP address.
1. Create hosted zone.
2. Add record set `www`
3. End point: EC2, load balancer, cloud front distribution etc.
* Compliant with IPv4, IPv6

![alt-text](assets/route53.png)

___
#### Relational Database Service (RDS)
* Building block: DB instance.
* DB engine: MySQL, Amazon Aurora, MS SQL, PostgreSQL, MariaDB, Oracle.
* DB in *private subnet*, only accessibly from EC2.
  - private subnet associated with a single availability zone.
* Automatically copied in another availability zone (**standby instance**)
  - synchronized.
  - Failover and automatically replaced

![alt-text](assets/db_net.png)
![alt-text](assets/db_replica.png)

* Read replica
  - async, needs manual promotion to master
  - Reroute read query to read replica

![alt-text](assets/db_read_replica.png)

___
#### AWS Lambda
* Fully managed server-less compute.
* Event-driven execution.
* Sub-second metering.
* Constraint:
  - 5 minute
  - request, response payload 6MB
  - memory 512 MB
* Trigger:
  - CloudWatch event
* Use case: automatic backup, process upload to S3, event driven log analysis, transformation; IoT; ELT; validate user input.

![alt-text](assets/lambda_stream.png)

___
#### Elastic Beanstalk
Platform as a service; get application onto cloud as quickly as possible.

___
#### Simple Notification Service
* Fully managed pub/sub messaging and mobile communication services.
* Coordinate the delivery of messages to subscribing endpoints and clients.
* Edit topic policy: who can publish and subscribe
* End point: HTTP, Email, Lambda

___
#### CloudWatch
* Real-time monitoring: CPU, I/O, status check, custom check; alarm; automatically react.
* Respond to state change.
* Trigger AWS to update DNS entry when new EC2 boosts up
* Components:
  - Metric: can be customized
  - Alarm: watches a single metric; invoke one or more actions
    - stop, terminate, reboot, recover, auto-scale, SNS
  - Event: **near real time**;
  - Log: EC2 instances real-time
  - Dashboard

![alt-text](assets/cloud_watch_eg.png)

___
#### CloudFront: CDN
Cache content at edge location near users. Deliver content faster.
* Types: Web, RTMB (video streaming).
* Origin: S3 bucket, IP address of webserver, load balancer etc.
* Use case
  - static asset caching
  - live & on-demand video streaming
  - security, DDOS protection
  - dynamic & customized content
  - API acceleration
  - software distribution

___
#### CloudFormation
Simplify the task of repeatedly and predictably creating groups of related resources that power your applications.
* Automate provisioning of AWS resource.
* Template file + CloudFormation = Stack of AWS resources
* Template: yaml or JSON, describe the resource
  - contain same information as needed in AWS console manual deployment.
  - Don't need to be in same order.
  - Use `depends-on` attribute to build dependencies.
  - Automatically saved to a S3 bucket.
* Stack: Unit of deployment.
* Permission: whoever calling template must have permission to operate all resources specified in template.

![alt-text](assets/cloud_front_eg.png)

___
### Architecture Design Principles
- Security:
  * Five areas: IAM, detective control, Infrastructure protection, data protection, incident response.
  * Five principles: all layers, enable traceability (logging, auditing), least privilege, securing your system , automate.
- Reliability:
  * Recover from issue/failures
  * Three area: foundation; change management; failure management.
  * anticipate, respond, prevent failures
  * test recovery procedure.
  * automatically recovery.
  * scale horizontally (increase aggregate system availability).
- Performance efficiency
  * select customizable solutions.
  * continually innovate. Review newly released products.
  * principles:
    - democratize advanced tech
    - go global
    - use server-less architecture
    - experiment more often
- Cost efficiency
  - Choose cheap resource
  - elastic scaling to match demand with supply
  - increase expenditure awareness
  - optimize over time
  - principles:
    * adopt a consumption model
    * measure overall efficiency
    * stop investing on data center
    * analyze and attribute expenditure (Grocery)
    * Use managed service (e.g. server-less)
- operational excellence
  * manage and automate changes
  * responding to events
  * define standards

___
#### Fault Tolerance & High Availability
* Built-in redundancy of application components.
* Minimize downtime & human intervention.
  - Elastic load balancer
    * distribute incoming load
    * send metrics to CloudFront
    * trigger & notify
  - Elastic IP address
    * greater fault tolerance
    * mask failures
  - Route 53
    * simple routing;
    * latency-based routing;
    * health checks;
    * DNS failure;
    * geo-location routing;
  - Auto-scaling
    * terminate or start instances
    * modify capacity
    * create new resources on demand
  - CloudWatch
    * distributed statistics gathering system.
    * used with auto-scaling
* Fault tolerance tools:
  - Simple Queue Service: distributed messaging system
  - Simple Storage Service: redundancy across devices and facilities in a region.
  - Relational Database System

___
### Security
Shared responsibility model
* Some module is managed by AWS, some managed by You

| Layer           | Note           |
| :-------------- | :------------- |
| User Data       | User access    |
| Application     | Choose your software (above which AWS has zero visibility) |
| Guest OS        | Choose Linux, windows on EC2 |
| Hypervisor      | Zen-based |
| Network         | AWS-managed |
| Physical        | AWS managed |

* User: a permanent main operator (human, machine)
  - credentials are permanent until forced rotation
* Group: a collection of user
* Role: an authentication method
  - operator (human, machine)
  - credentials are temporary
* policy documents: attached to user, group, or role (a JSON document)

Sample workflow: put a object in S3
1. an operator makes API call, name object, present credential (username, password, secret key)
2. **authentication**: Validate authorization credentials. Is it a user, or role, or group.
3. **authorization**: Take policy documents associated with the operator. Is action sanctioned by policy doc?
  - Policy may have explicit deny, that overwrites any allow statement.
  - If hacker gets password, can still cut off authorization.

#### Amazon Inspector
Assess application for vulnerabilities and deviation from best practices.
* Integrate security into DevOps
* Increase development agility.
* Leverage AWS security expertise.
* Streamline security compliance.
* Enforce security standards.
* Identify application security issues.
* Accessible via Amazon Inspector Console, CLI, API, SDK

#### AWS Shield
A managed, DDoS protection service that safeguards applications running on AWS (ELB, Route 53, CloudFront).
* DoS vs DDoS:
  - DoS: flooding with network traffic, consume bandwidth.
  - Distributed DoS:
    * Infrastructure layer: use multiple sources (botnet)
    * Application layer attack: misleads web app to connect to other site. Use *web application firewall* to block requests before reaching server.
Two protection options:
* AWS Shield Standard: free; always-on; self-service; any AWS resource & region.
* AWS Shield Advanced: 24/7 access to DDoS response team.

#### Security Compliance
Measured by customer success. Three components:
* Risk management
* Control environment
* Information security

![alt-text](assets/security_compliance.png)

Workflow
1. Review trusted information and document compliance requirement.
2. Design and implement control objectives that meet compliance requirement.
3. Identify and document controls owned by outside parties.
4. Verify all control objectives are met and all key controls are designed and operating effectively.

___
### Pricing
* Pay for computing, storage, outbound data (tiered)
  - No pay for inbound data
* Cost factor
  * Server clock time
  * Machine configuration
  * Deployment type: single/multiple availability zones
Types of instances
  - on-demand instance, pay by hour
  - reserved instance, discount with low up-front charge
  - spot instance: bid for unused capacity
**Trusted Advisor**: keep best practices in
  * cost optimization
  * performance
  * security
  * fault tolerance

gha_language: HTML

gha_license_id: MIT


text:
DEPRECATED - Interinstitutional Agreement (IIA) API
======================================

**DEPRECATED: This proposal was replaced by [IIAs API](https://github.com/erasmus-without-paper/ewp-specs-api-iias).**

* [What is the status of this document?][statuses]
* [See the index of all other EWP Specifications][develhub]

Summary
-------

This document describes the **IIA API**. These are the APIs needed to exchange interinstitutional agreements between two
or more partners. There is need for APIs on both sides to be able to exchange this information.

Participants
------------

* **MASTER** - This will be the owner of the agreement. The institution that initiates the work on the agreement will be designated
  master. The master is responsible for merging any changes that the other partners propose to the document. This is to
  avoid the problem of different partners trying to over write each other's changes.
* **SLAVE** - The other partners in the agreement are called slaves. They cannot change the master document, only propose changes
  and accept or reject an agreement.

Basic flow
----------

![Flow](API_IIA_v01.png)

The Master initiates the IIA and sends the IIA-XML to all partners (slaves). The slaves can then either approve, reject or propose
changes to the IIA. This will be relayed to the master, using an XML with both structured and unstructured data (XML with text).
Examples to come later. It is the Master's responsibility to keep track of change requests and approvals. Every time the IIA is
changed by the master (based on the change requests), the version of the IIA is changed, so the other partners can see what state
the document is in, and for the Master to know exactly what has been approved or rejected. There is some manual labour required by
the Master, both in merging changes and keeping track of approvals.

Implementation
--------------

The IIA-API will contain functionality for both the Master and the Slave; if you implement the IIA-API you can be both Master
and Slave in the network.

* **Master API** - Receive a Slave response (Accept, Reject, Change)
* **Slave API** - Receive a Master request (IIA XML)

repository: erasmus-without-paper/ewp-specs-api-iia

repo_name: erasmus-without-paper/ewp-specs-api-iia


text:
# Sleep as Android - Captcha Examples

[Sleep as Android](https://play.google.com/store/apps/details?id=com.urbandroid.sleep) is an Android app that helps you sleep better. To help you with waking up, Sleep as Android offers you tasks to solve when the alarm rings. The alarm will stop ringing once you solve the task. These tasks are called **CAPTCHAs**.

Sleep as Android has an open API for CAPTCHAs, so you can create your own CAPTCHAs to solve in the morning. This repository gives out some examples. Feel free to build upon it!

## API overview

To get an overview of the CAPTCHA API and the Captcha lifecycle, see [the docs on our website](http://sleep.urbandroid.org/documentation/developer-api/captcha-api/).

## ReverseCaptcha

There is one CAPTCHA in the example project at the moment - ReverseCaptcha.

### ReverseCaptchaActivity.java and the AndroidManifest.xml

The heart of the CAPTCHA is the CaptchaActivity class, in the example this is `ReverseCaptchaActivity.java`. This activity shows up when the Captcha is called by the alarm. The activity is also declared in `AndroidManifest.xml` as

    <activity
        android:name=".ReverseCaptchaActivity" // this needs to be the same as the activity class name (except for the dot)
        android:launchMode="singleTop"
        android:label="@string/captcha_label"
        android:exported="true"
    >

`ReverseCaptchaActivity` holds a few things needed in every Captcha:

+ `private CaptchaSupport captchaSupport;` declaration which loads the captcha library (see [documentation of the Captcha library](https://github.com/urbandroid-team/sleep-captcha-support))
+ `onCreate()` hook which defines what happens when the activity is loaded
+ `onNewIntent()` hook which defines what happens when the activity is reopened
+ `captchaSupport = CaptchaSupportFactory.create(this);` in the onCreate(), onNewIntent() hook
+ `onDestroy()` hook which defines what happens when the activity is destroy
+ `captchaSupport.destroy();` in the onDestroy()

### Use of the CaptchaSupport library

#### Interaction with Sleep as Android

CaptchaSupport library makes it easy to interact with the main Sleep as Android application via the following methods:

+ `captchaSupport.solved()` -- call this when user solves the Captcha
+ `captchaSupport.unsolved()` -- call this when user fails to solve the Captcha (typically when he leaves the activity), will send an intent to start the alarm again
+ `captchaSupport.alive()` -- call this to reset the captcha timeout (typically when the user somehow interacts with the captcha)

#### Captcha modes

The Captcha activity can be started in one of three modes:

+ preview mode (when started from the **Sleep as Android > Settings > CAPTCHA > (your CAPTCHA) > Preview**)
+ configuration mode (when started from **Sleep as Android > Settings > CAPTCHA > (your CAPTCHA) > Settings**)
+ operational mode (when started by the alarm)

You can check in which mode has the activity been started by

+ `captchaSupport.isPreviewMode()`
+ `captchaSupport.isConfigurationMode()`
+ `captchaSupport.isOperationalMode()`

and then make adjustments according to that. For example, when started in config mode, you might show a completely different layout than when starting in operational mode. The ReverseCaptcha doesn't do any of those checks as it doesn't offer a settings view (no `<action android:name="com.urbandroid.sleep.captcha.intent.action.CONFIG"/>` in the `AndroidManifest.xml`) and preview is the same as operational view.

### Where to find your CAPTCHA:
In Sleep as Android, you choose the active CAPTCHA in **Settings > CAPTCHA**. Once you build a new CAPTCHA apk and install it, your CAPTCHA will also appear there.

### Links
* [Captcha-support library](http://sleep.urbandroid.org/documentation/developer-api/captcha-api/)
* [CAPTCHA 2016 Hackathon](http://sleep.urbandroid.org/captcha-hackathon-12016/)
* In case of any problems, open an issue on github or drop us a line at support@urbandroid.org


text:
# erlang-tls-misc

Miscellaneous Erlang TLS examples.

## Resources

https://erlef.github.io/security-wg/secure_coding_and_deployment_hardening/ssl.html

https://elixirforum.com/t/ssl-with-tortoise-lib-not-working/18256/4

https://github.com/vernemq/vernemq/issues/1485

https://github.com/hexpm/hex/pull/798

## Prerequisites

* `bash` version 4 or higher (tested with `5.0.18`)
* `git` (tested with `2.29.2`)
* `sed` (tested with GNU version `4.8`)
* `python` (tested with `3.8.6`)
* `openssl` (tested with `1.1.1h`)
* `erl` (tested with `23.1.2`)

## TLS-encrypted distribution usage

* Set up environment and certificates:

```
./setup.sh
```

* Run node a in one terminal:

```
./run-node-a.sh
```

* Run node b in another terminal:

```
./run-node-b.sh
```

## Expected output:

```
$ ./run-node-b.sh
Erlang/OTP 23 [erts-11.1.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Eshell V11.1.2  (abort with ^G)
(b@shostakovich)1> ['a@shostakovich']

(b@shostakovich)1> nodes().
[a@shostakovich]
(b@shostakovich)2> init:stop().
ok
(b@shostakovich)3>
```

## TLS client usage

* Setup Python environment:

```
./setup-py.sh
```

* Start RabbitMQ:

```
make RABBITMQ_CONFIG_FILE="/home/lbakken/development/lukebakken/erlang-tls-misc/rabbitmq-tls.config" PLUGINS='rabbitmq_management rabbitmq_top' LOG=debug run-broker
```

* Run Python client:

```
source venv/bin/activate
python ./tls-client.py
```

RabbitMQ log should have entries like these:

```
2020-12-09 09:31:57.137 [debug] <0.772.0> @@@@@@@@ sni_fun ServerName: "shostakovich"
2020-12-09 09:31:57.142 [debug] <0.775.0> @@@@@@@@ sni_info items value: [{sni_hostname,"shostakovich"}]
2020-12-09 09:31:57.142 [debug] <0.775.0> @@@@@@@@ sni_info SNI value: shostakovich
```

license: Unlicense

repository: Zabrane/erlang-tls-misc

repo_name: Zabrane/erlang-tls-misc


text:
## [0.2.0-preview.1] - 2021-04-19
- Change minimum requirement Unity version to 2020.3
- Add DSC_Input_Multiplayer script.
- Add InputButtonName script.

## [0.1.4-preview.1] - 2021-02-05
- Fix bug error if call input player id more than init player number.

## [0.1.3-preview.2] - 2021-02-04
- Add Add/Remove input event listener for whole down/hold/up event in one method.

## [0.1.2-preview.1] - 2021-02-03
- DSC_Input now support input event callback.

## [0.1.1-preview.1] - 2021-02-01
- Change dependency Input System to version 1.0.2

## [0.1.0-preview.1] - 2021-01-07
- Change minimum requirement Unity version to 2020.2
- Change dependency Input System to version 1.0.1
- Add DSC_InputEventType enum.
- Move DSC_Input,GameInputData script from DSC-Core package.
- Move Global_InputManager script and prefab from DSC-Core package.
- DSC_Input now support event callback during before and after update input.

## [0.0.2-preview.1] - 2019-07-03
- Add DSC_Event_RunEventsByInputButton.

## [0.0.1-preview.1] - 2019-07-02
- Add DSC_Input_Player script.

## [0.0.0-preview.1] - 2019-07-01
- Add Input template sample.

repository: DeStiCap/DSC-Input

repo_name: DeStiCap/DSC-Input


text:
# Nextjs Demo using Client side Firebase session

## Installation

Add .env file in the project root folder with values from firebase config json and spring boot host and port

```
NEXT_PUBLIC_API_KEY=REPLACE_WITH_API_KEY
NEXT_PUBLIC_AUTH_DOMAIN=REPLACE_WITH_AUTH_DOMAIN
NEXT_PUBLIC_DB_URL=REPLACE_WITH_DB_URL
NEXT_PUBLIC_PROJECT_ID=REPLACE_WITH_PROJECT_ID
NEXT_PUBLIC_APP_ID=REPLACE_WITH_APP_ID
NEXT_PUBLIC_MIDDLEWARE_URL=REPLACE_WITH_SPRING_BOOT_URL
```

First, run the development server:

```bash
npm run dev
# or
yarn dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.


text:
---
layout: post
title: Travel Hacking - the $24 Ticket
author: Geoffrey Byers
date: 2014-05-02
quote:
image: https://farm7.staticflickr.com/6212/6284803164_e02bdb3e3c_b.jpg
attribute_author: Benson Kua
attribute_url: https://flic.kr/p/azng2f
description: Cheap traveling tips while living a nomadic lifestyle.
excerpt: I travel a lot.  Between Chicago, San Francisco, New Orleans, Dallas and Denver to name a few places I frequent.  I've learned to travel cheaply by utilizing a few tools and techniques.
keywords: travel,nomad,jetsetter,jetset
video: false
comments: true
---

##tl;dr##
I travel a lot.  Between Chicago, San Francisco, New Orleans, Dallas and Denver to name a few places I frequent.  I've learned to travel cheaply by utilizing a few tools and techniques.  In all honestly, just travel on ticket prices as opposed to specifically fixed dates.    Regardless, use some of the tools on Kayak to try to squeeze some money out of those ticket purchases.

##My cheapest ticket##
During my time in Dallas, I booked an all time low ticket for $24 on Spirit Airlines to New Orleans.  For the price of 3 drinks I was back in my home city enjoying some of the best jazz music in the world.  Sure, Dallas is a hub.  Sure, Dallas and New Orleans is a 500 mile ~7 hour drive.  No, I'm not a member of the $9 fare club.  No, I didn't hack in the sense of breaking into a database to get an artificially low fare.  I used a few techniques I've been developing over the last year to get an ultra low fare.  This is just one example of the many cheap flights I've scored.

##Travel as a commodity##
One of the important realizations I made was that flying domestically is a commodity.  It's not a service, at least that's not how the industry treats it.  It's an all out race for the bottom.  If you look at flying in this way, in the end you're getting from one place to another regardless of airline.  I don't believe airlines are quantitatively or even qualitatively better.  I do think Virgin is in a league of it's own domestically.  After that, it's a rat race and price is the only differentiating factor.

##Travel based on location, with flexible dates##
Probably the most important thing I do to lower fares is to embrace the mentality that I want to get somewhere specific, within a date range.  I make things work.  Sure, holiday travel will always have massive peaks.  You can still avoid things like weekend peaks and some holiday peaks too by nimbly traveling around them.  People like me buy the less desirable tickets.  Sometimes this means traveling on holiday days.  It often means traveling during the middle of the day and during the week days.  As I work from wherever I am, this doesn't really matter and I make up for the travel time by working without my computer.

##Use Kayak's tools##
I use Kayak for most of my initial flight researching.  This is mainly because of their tools: price alert, price matrix, and price trend.

###Price alert###
In short, you create an alert for a searched flight.  You are then emailed as prices drop.  I usually search multiple times through the day/night across multiple days to track this myself.  It's useful if you're into automation or reminders though.

###Price matrix###
Searching across multiple days makes sense if you've got very restricted travel-ability.  As I'm open to all options I use the matrix to see when flights are cheapest if time is a variable.  I use this more than price alert, as it lets me check nearly all potential flights simultaneously.

###Price Trend###
This is a fascinating and, in my opinion, the most useful feature of Kayak.  You can use their graph of prices of tickets to figure out whether to buy a flight now, or whether to wait it out and see if the price falls.

##Choose your fare##
I've used Priceline to get steep discounts up to 40% on flights.  This was true of last minutes flights during peak times too.  The interesting point here is that you bid with the agreement that if you win your credit card is charged.  You can still specify times you're willing to travel so that you're not stuck with red eye flights.

##Buy one way tickets##
I've noticed that buying round trip tickets is often easier on the consumer, however not necessarily cheaper.  Buying multiple one way tickets allows for the maximum flexibility regarding airlines as well as time and date.  I often buy multiple one way tickets back to back.  This is by far the easiest way to do trips with more than one destination other than paying a travel agent.

##Include nearby airports##
Many times, you may have one option to fly to a set destination.  Other times, flying across the country to LA can be had for cheaper by flying through SFO, renting a car, and driving.  This is true of most places where airports are within reasonable driving or public transportation distance.

##Pack light##
Being a minimalist, packing light isn't difficult.  However, catching last minute flights, giving up seats for vouchers and avoiding luggage costs can be avoided by packing a small duffel or backpack.


text:
[common appium.app](/common/appium.app.md)

Appium.app's inspector works on iOS. The data is based on the same source as
the page command that we used in the last lesson.

![](inspector_ios.png)

repository: aslamz/appium

gha_language: Ruby

repo_name: aslamz/appium


text:
## About

A simple implementation of Minesweeper using python and the terminal.

Requires Python >= 3.6 for fstrings no other packages required.

May be interesting to others as I used set coordinates to perform the mine
and flag handling instead of nested looping.

```
~/projects/minesweeper$ python3 minesweeper.py

Mine Sweeper

Input coordinates in xyc format where:

x = the position on the x axis
y = the position on the y axis
c = the command type. f for flag c for clear

Rules:
There are a set number of mines on the board.
Mark them all with a flag (f) while not attempting
to clear any coordinates that contain a mine.

Each time you clear an empty tile that tile will
show you how many mines are neighboring that tile.

To remove a placed flag enter the coordinates of
the tile with a flag and the flag command (eg. 23f)
and the flag will be removed.

Enter 'help' at any time to see this screen again.

Flags placed 0
Total mines 7
Mines left 7
[['x', 'x', 'x', 'x', 'x', 'x'],
 ['x', 'x', 'x', 'x', 'x', 'x'],
 ['x', 'x', 'x', 'x', 'x', 'x'],
 ['x', 'x', 'x', 'x', 'x', 'x'],
 ['x', 'x', 'x', 'x', 'x', 'x'],
 ['x', 'x', 'x', 'x', 'x', 'x']]
```

branch_name: refs/heads/main


text:
# _Wikipedia Homepage Rebuild_

#### _HTML and CSS Epicodus Project for Bootstrap Styling, March 19, 2020_

#### By _**Jessica Hvozdovich and Erik Grove*_

## Description

_This exercise demonstrates the use of Bootstrap to style a HTML webpage. The goal is to recreate the homepage of Wikipedia._

## Setup/Installation Requirements

* Clone this repository.
* Navigate to index.html file.
* Right click and open in the browser of your choice.

* Alternatively, open the webpage at jhvozdovich.github.io/wikipedia-rebuild

## Known Bugs

No known bugs

## Support and contact details

If you have any suggestions or questions please email us at<EMAIL_ADDRESS>or<EMAIL_ADDRESS>
## Technologies Used

HTML
CSS
Bootstrap
Git and GitHub

### License

This software is licensed under the MIT license.

Copyright (c) 2020 **_Jessica Hvozdovich and Erik Grove_**

repository: jhvozdovich/wikipedia-rebuild

repo_name: jhvozdovich/wikipedia-rebuild


text:
# XPPlus
## A Minecraft plugin to manage XP in an advanced way
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://wylarel.com/mit/)
[![Discord](https://img.shields.io/badge/Chat-Discord-blue)](https://discord.gg/7qvmeh2)
[![Versions](https://img.shields.io/badge/Tested%20Versions-1.15.x-orange)](#)
[![Download](https://img.shields.io/badge/Download%20on-SpigotMC-orange)](https://www.spigotmc.org/resources/xp-plus.80057/)
[![Spigot Rating](https://img.shields.io/spiget/stars/80057?color=yellow&label=Spigot%20Rating)](https://www.spigotmc.org/resources/xp-plus.80057/)

## Permissions
### Players
**bottlexp.use** - Command /bottlexp
**clearxp.self.use** - Command /clearxp
**oneclickbottles.use** - Use the one click bottle functionality
**xpsign.use** - Click on XP Sign
### Admins
**clearxp.other.use** - Command /clearxp \[player\]
**xpsign.manage** - Command /xpsign

## Configuration
```yaml
bottlexp:
  type: [Integer] - type 0 -> Exponential | type 1 -> Linear
  ratio: [Double] - This is the ratio xp/bottles. If type is set to Exponential (default), 1.0 means that you get the same amount of xp that you have when you transform it in bottles. If type is set to Linear, this is the number of xp bottles that you'll get per level. To avoid abuse, if the number of bottles that the player should get is not an integer, we round down.
  message: [String] - Message when /bottlexp | Variables: <bottles> & <levels> | Support chat color (&)
  error:
    not_enough: [String] - Error message when the player doesn't have enough XP | Support chat color (&)
clearxp:
  self:
    message: [String] - Message when /clearxp on self | Support chat color (&)
    error:
      already_null: [String] - Error message when the player doesn't have XP | Support chat color (&)
  other:
    message: [String] - Message when /clearxp on others | Variable: <player> | Support chat color (&)
    error:
      already_null: [String] - Error message when the targeted player doesn't have XP | Variables: <player> | Support chat color (&)

oneclickbottles: - Sneak + Throw to use all your XP bottles
  enabled: [Boolean] - Is the functionality enabled
  message: [String] - Message when using the functionality | Variable: <bottles> | Support chat color (&)
xpsign:
  oncreate: [String] - Message when creating a XP Sign | Variables: <sign> & <location> | Support chat color (&)
  onremove: [String] - Message when removing a XP Sign | Variables: <sign> & <location> | Support chat color (&)
  list: - List of XP Signs, better not to touch
```

## [MIT License](https://wylarel.com/mit/)
```
Copyright (c) 2020 Wylarel

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: Wylarel/XPPlus

repo_name: Wylarel/XPPlus


text:
# ESP8266 on Windows 7 with Arduino IDE

[Arduino code for ESP8266](https://github.com/esp8266/Arduino)

[Introduction to nodeMCU on Arduino IDE](http://embeddedcomputing.weebly.com/nodemcu-board.html)

## Install Arduino IDE

**Note** In the context of the ESP8266, the term 'Arduino IDE' can be used in two meanings: (1) the developer environment and (2) the core libraries developed for use in the development environment.
The original Arduino core libraries were developed to program the Arduino microcontrollers, but the ESP8266 developers created an ESP8266 core library API that very strongly resembles the Arduino API.  This means that the software developed for the ESP8266 with the Arduino ESP8266 core library has very much the same look and feel as the code developed for the Arduino itself.  There obviously are differences, but the similarity in the core API is high.  The differences arise in the non-core libraries, scuh as the wifi libraries, etc.

This document describes the use of the Arduino IDE software and core ESP8266 libraries to program and flash the ESP8266.  The Arduino IDE core libraries can also be used in other development environments.  One such development environment is the [platformio-ide](https://github.com/NelisW/myOpenHab/blob/master/docs/413b-ESP8266-PlatformIO-Arduino-Framework.md).

The Arduino IDE can be used to build and download ESP8266 software.  The [GitHub repo](https://github.com/esp8266/Arduino) for the project describes it as  follows: "This project brings support for ESP8266 chip to the Arduino environment. It lets you write sketches using familiar Arduino functions and libraries, and run them directly on ESP8266, no external microcontroller required. ESP8266 Arduino core comes with libraries to communicate over WiFi using TCP and UDP, set up HTTP, mDNS, SSDP, and DNS servers, do OTA updates, use a file system in flash memory, work with SD cards, servos, SPI and I2C peripherals."

<https://github.com/esp8266/Arduino/blob/master/doc/reference.md>  Reference

At the time of writing the IDE version is 1.6.7.

<https://github.com/esp8266/Arduino/blob/master/README.md>  how-to install.
<http://randomnerdtutorials.com/how-to-install-esp8266-board-arduino-ide/>
<http://www.instructables.com/id/ESP8266-ESP-12Standalone-Blynk-101/>
<http://www.instructables.com/id/ESP8266-Arduino-IDE-164-Portable-Full-Quick-Instal/>
<http://www.esp8266-projects.com/2015/06/esp8266-arduino-ide-v164-portable.html>

1. You have to have an internet connection to execute the procedure below.
1. Download and install the Arduino IDE from here: <https://www.arduino.cc/en/Main/Software>.
 -  You can download the exe for installation as a regular Windows application.
 -  Alternatively you can create a portable installation by  downloading the zip file and unzipping in the directory of your choice.  This directory may be on a USB memory device for portability.
 -  Either way, the IDE will create a directory in your user home directory, something like `C:\Users\YourUserName\AppData\Roaming\Arduino15`
2. The exe install will create all the shortcuts automatically.  If you downloaded and unzipped the zip file, Windows will not know of the software. Create a shortcut to the IDE and place it in QuickLaunch or in the Start Menu.
2. Create directory where you want to place all your working files.  This can be anywhere on your PC.
3. Open the IDE and navigate to the *Files > Preferences* dialog box.  Copy the location of your working directory into the edit box that is marked with `Sketchbook location` (top of the following picture).

  ![''](images/arduino-ide-file-prefs.png)
3. While in the preferences dialog, note the location on your PC where the IDE stores your user-specific information, right at the bottom of the dialog window.  There is a `preferences.txt` file where you can set additional preferences that are not presented in the dialog box.

4. Install the ESP8266 support for IDE:

- Open the Arduino IDE and navigate to *File > Preferences*

- In the *Additional boards manager URLs* paste this link:  <http://arduino.esp8266.com/stable/package_esp8266com_index.json>. Click the OK button to close the dialog box.  You will do well to regularly check for updates to these files, development takes place at a brisk pace.  The GitHub repo for the first library is at <https://github.com/esp8266/Arduino>, which has links to the [documentation](https://github.com/esp8266/Arduino/blob/esp8266/hardware/esp8266com/esp8266/doc/reference.md) and the list of [supported boards](https://github.com/esp8266/Arduino/blob/esp8266/hardware/esp8266com/esp8266/doc/boards.md), which also has some hints on using the various ESP boards.  This IDE board extension provides a well-integrated development environment for the ESP8266 (assuming you want to use the C-language libraries).

- Navigate to *Tools > Board* and then click on *Board Manager...*. A new dialog box will open. Scroll down to the ESP8266 entry, click on it and click *Install*. The IDE will now download the ESP board definitions (this software is not part of the Arduino IDE product offering, but uses the Arduino IDE's ability to load new board definitions).

- After the installation is complete the version number should be shown, together with all the new board definitions contained in the package. Depending on the version you downloaded the board definitions may be different from the list shown here.
   ![''](images/arduino-ide-esp8266-installed.png)

- Once the board definitions are installed they will be available as selections on the Boards menu entry, as shown here:

  ![''](images/arduino-ide-install-8266.png)

5. Install the ESP8266 File System IDE tool, as described [here](https://github.com/esp8266/Arduino/blob/esp8266/hardware/esp8266com/esp8266/doc/reference.md# uploading-files-to-file-system).  This tool is used to upload files to the ESP flash file system.

6. If you have the [nodeMCU V3.0 lolin](http://www.wemos.cc/d1/Getting_Started) ESP8266 board
-  Paste the link <https://github.com/wemos/WeMos_Boards/raw/master/package_wemos.cc_index.json> in the *Additional boards manager URLs*.  You can add multiple URLs, separating them with commas.
-  Navigate to *Tools > Board* and then click on *Board Manager...*. A new dialog box will open. Scroll down to the WeMos WiFi entry, click on it and click *Install*.  The board and example information should now appear in the menus (might be called 'D1').

## Setting up the comms config

Once the board has been selected, you can set up the communication parameters for connecting the IDE with the ESP8266.  The example below shows how to set the serial download speed.

  ![''](images/arduino-ide-setup-8266.png)

## Installing libraries

<https://www.arduino.cc/en/guide/libraries>

1. navigate the menu to *Sketch > Include Library >Manage Libraries*.

  ![''](images/arduino-ide-library-install-8266.png)

2. Click on *Manage Libraries*. This will show a list of all the libraries currently installed to that are ready for installation.

3. Scroll to the library you want to install and click on it. Selected the version (if shown) and then click on *Install*.  This will download and install the library - you have to be on the internet for this task.

  ![''](images/arduino-ide-library-install-2-8266.png)

4. You can also install zip libraries, directly from the menu, no need to unzip the file.  Navigate to *Sketch > Include Library > Add .ZIP Library* and select the library in your file system.

4.  Most of the popular libraries are already included in the core package, including WiFi using TCP and UDP, set up HTTP, mDNS, SSDP, and DNS servers, do OTA updates, use a file system in flash memory, work with SD cards, servos, SPI and I2C peripherals.  Suggested libraries to be additionally installed include:

 - [Adafruit MQTT library](https://github.com/adafruit/Adafruit_MQTT_Library)

 - If you want to use [Blynk](http://www.blynk.cc/), open the Blynk library [GitHub page](https://github.com/blynkkk/blynk-library) and click on the  ![''](images/github-download-zip.png) button on the right side of the page and save the file in your file system.  Then install the ZIP library as outlined above.

---------------------------------------------------------
---------------------------------------------------------
## Example software

There is some example code [here](https://github.com/adafruit/Adafruit_ESP8266).

	// the setup function runs once when you press reset or power the board
	void setup() {
	  // initialize digital pin 13 as an output.
	  pinMode(15, OUTPUT);
	}
	// the loop function runs over and over again forever
	void loop() {
	  digitalWrite(15, HIGH);   // turn the LED on (HIGH is the voltage level)
	  delay(1000);              // wait for a second
	  digitalWrite(15, LOW);    // turn the LED off by making the voltage LOW
	  delay(1000);              // wait for a second
	}

repository: NelisW/myOpenHab

gha_language: Python

repo_name: NelisW/myOpenHab


text:
# The experience with compiling DG on Ubuntu Trusty

This is my experience with compiling DG on (a clean installation of) Ubuntu Trusty for different versions of LLVM.
To summarize, compiling DG with a custom build of LLVM goes fine on Ubuntu Trusty.
Using system LLVM packages does not work at all. The only way how to compile DG without compiling also LLVM
is to use our packages that we use in CI.

If LLVM is compiled from sources, it should be enough to set `LLVM_DIR` (and possibly
`LLVM_SRC_DIR` and `LLVM_BUILD_DIR` to the right directories.

The LLVM 3.4-3.8 packages from the system repositories unfortunately contain broken cmake files.
Not only the config file is named `LLVM-Config.cmake` instead of `LLVMConfig.cmake`
for some LLVM version,but there is also broken the mapping to LLVM libraries.

The configuration with system LLVM 3.9 goes smoothly, but the compilation fails with this error:

```
/usr/lib/llvm-3.9/lib/libLLVMCore.a(AsmWriter.cpp.o): unrecognized relocation (0x2a) in section `.text._ZN4llvm24AssemblyAnnotationWriterD2Ev'

```

Greater versions of LLVM are not available from the repositories.

## Building with LLVM package from our CI

If you do not want to compile LLVM from sources,
for LLVM 3.8, 4, and 5 you can use the packages that we use in our CI:

```
git clone --depth 1 https://github.com/tomsik68/travis-llvm.git
cd travis-llvm
chmod +x travis-llvm.sh
./travis-llvm.sh 3.8  # change 3.8 to 4 or 5 if wanted
```

Now we can proceed normally with configuration and compilation:

```
cd dg
cmake . -DLLVM_DIR=/usr/share/llvm-3.8/cmake
make -j4
```

repository: mchalupa/dg

repo_name: mchalupa/dg


text:
---
title: Docker, Node and Nginx
date: 2018-01-01
tags:
  - docker
  - node
  - nginx
author: Dave
featuredimg: /assets/img/docker.png
summary: Creating a docker container with node.js and nginx
meta:
  - name: description
    content: Creating a docker container with node.js and nginx
  - name: keywords
    content: docker node nginx
  - name: og:title
    content: Docker, Node and Nginx
  - name: og:description
    content: Creating a docker container with node.js and nginx
  - name: og:site_name
    content: davidjamesherzog.github.io
  - name: og:image
    content: https://davidjamesherzog.github.io/assets/img/docker.png
  - name: og:type
    content: website
  - name: twitter:title
    content: Docker, Node and Nginx
  - name: twitter:description
    content: Creating a docker container with node.js and nginx
  - name: twitter:card
    content: summary_large_image
  - name: twitter:image
    content: https://davidjamesherzog.github.io/assets/img/docker.png
  - name: twitter:site
    content: '@evadgozreh'
  - name: ttwitter:creator
    content: '@evadgozreh'
---

There may be times in your development process where you might want to run your code locally just like you would run it in production. Most of us run different operating systems for development than where we run our production code. Docker makes it easy for you to spin up an enviroment that mimics your production enviroment locally.

## Getting Started
We'll start off by creating a new project. This is easy to do by using the npm init command.

```bash
$ npm init -f
```

Lets go ahead and create a source directory and create a simple index.html file.

```bash
$ mkdir src
$ cd src
$ touch index.html
```

Once you have created the index.html file, add the following html code for a very simple example.

```html
<html>
  <head>
    <title>Node-Docker-nginx</title>
  </head>

  <body>
    <p>Hello Node Docker nginx example</p>
  <body>
</html>
```

## Create Dockerfile
Now you will create your Dockerfile.

```bash
$ touch Dockerfile
```

We'll leverage the existing nginx docker container from [here](https://hub.docker.com/_/nginx/).

```
# Builds a Docker to deliver src/
FROM nginx:latest
COPY src/ /usr/share/nginx/html
```

## Create Image and Container
We'll use your Dockerfile to create the nginx docker image.

```bash
$ docker build -t node-docker-nginx:latest .
```

Now the docker image should be created. To verify, run the following docker command:

```bash
$ docker images
```

You should see your newly created docker image like this.

```
REPOSITORY               TAG                 IMAGE ID            CREATED             SIZE
node-docker-nginx        latest              4a3eea93df52        5 seconds ago       181.5 MB
```

Next, you'll create the docker container by running the following docker command. This will run nginx on port 8080 instead of the default port of 80.

```bash
$ docker run --name node-docker-nginx -d -p 8080:80 node-docker-nginx
```

List the containers that you have created.

```bash
$ docker ps -a
```

You should see your new docker container like this.

```
CONTAINER ID    IMAGE                COMMAND                  ...   PORTS                           NAMES
38be8f13dcd9    node-docker-nginx    "nginx -g 'daemon off"   ...   443/tcp, <IP_ADDRESS>:8080->80/tcp   node-docker-nginx
```

## Test It Out
Now all you have to do is start your container.

```bash
$ docker start node-docker-nginx
```

Go to your `index.html` page by going [here](http://localhost:8080/).

gha_language: Vue


text:
# @reduxed/actions

Provides helper for managing Redux state

Written in Typescript and includes types

More features to come (WIP)

Part of [@reduxed](https://www.npmjs.com/search?q=%40reduxed) utilities for [Redux](http://redux.js.org/).

Assumes the use of [redux-actions](https://github.com/reduxactions/redux-actions) and [reselect](https://github.com/reactjs/reselect)

### Table of Contents
* [Installation](#installation)
* [Usage](#usage)

# Installation

```bash
$ yarn add @reduxed/actions
```

or

```bash
$ npm i -S @reduxed/actions
```

The [npm](https://www.npmjs.com) package provides a [CommonJS](http://webpack.github.io/docs/commonjs.html) build, a UMD build, as well as an AMD build.

# Usage

## Component
Binding your redux store to a component with separate actions props and state props:
```ecmascript 6
import { connect } from '@reduxed/actions'

export default connect(mapStateToProps, mapDispatchToProps)
```
connect is used the same way as connect from [react-redux](https://github.com/reactjs/react-redux)

state will be accessible in the component via input prop and actions via output props:
```ecmascript 6
export default ({ input, output }) => (
  //Component
)
```

## Selector
Create wrapper selectors for a [named reducer](http://redux.js.org/docs/recipes/reducers/ReusingReducerLogic.html):
  * inputs: parent selector, object containing root selector functions
  * output: object containing selectors children of parent selector with key: selector name, value: selector function
  * */

```ecmascript 6
import { createSelector } from 'reselect'
import { createWrapperSelectors } from '@reduxed/actions'

const getFriend = ({ friend }) => friend

const parentSelector = createSelector(state => state, getFriend)

const selectors = {
  getFirstName: ({ firstName }) => firstName,
  getLastName: ({ lastName }) => lastName
}

const namedSelectors = createWrapperSelectors(parentSelector, selectors)

const {
  getFirstName,
  getLastName
} = namedSelectors
```

Create selectors from state props
```ecmascript 6
import { createSelector } from 'reselect'
import { createSelectors } from '@reduxed/actions'

const getFriend = ({ friend }) => friend

const parentSelector = createSelector(state => state, getFriend)

const props = [
  'firstName',
  'lastName'
]

const selectors = createSelectors(parentSelector, props)

const {
  getFirstName,
  getLastName
} = selectors
```

## Actions
Create named actions:
```ecmascript 6
import { createActions } from 'redux-actions'
import { createWrapperActions } from '@reduxed/actions'

const creators = createActions('CHANGE_FIRSTNAME', 'CHANGE_LASTNAME')

const wrapperCreators = createWrapperActions(creators, 'best')

const {
  changeFirstName,
  changeLastName
} = wrapperCreators
```

Combine actions for use in a reducer:
```ecmascript 6
import { createActions } from 'redux-actions'
import { combineWrapperActions } from '@reduxed/actions'

const creators = createActions('CHANGE_FIRSTNAME', 'CHANGE_LASTNAME')

const combinedActions = combineWrapperActions(creators)

const reducer = handleActions({
[combinedActions]: state => ({ ...state })
}, {})
```

## Reducer
Create a higher order reducer combining multiple reducers:
```ecmascript 6
import { createActions } from 'redux-actions'
import { createReducer } from '@reduxed/actions'

const {
  changeFirstName,
  changeLastName
} = createActions('CHANGE_FIRSTNAME', 'CHANGE_LASTNAME')

const reducer = handleActions({
[changeFirstName]: (state, { payload }) => payload
}, {})

const wrapperReducer = createReducer({
[changeLastName]: (state, { payload }) => ({ lastName: payload })
}, {
  firstName: 'John',
  lastName: 'Doe'
}, {
  firstName: {
    actions: { changeFirstName },
    reducer
  }
  // could contain other reducers
})
```

Get initial state from a reducer:
```ecmascript 6
import { createAction } from 'redux-actions'
import { getInitialState } from '@reduxed/actions'

const changeLastName = createAction('CHANGE_LASTNAME')

const reducer = handleActions({
  [changeLastName]: (state, { payload }) => ({ lastName: payload })
}, {
     lastName: 'Doe'
 })

 getInitialState(reducer) // => { lastName: 'Doe' }

```

Create a reducer responding to given named actions:
```ecmascript 6
import { createActions } from 'redux-actions'
import {
  createWrapperActions,
  createWrapperReducer
} from '@reduxed/actions'

const creators = createActions('CHANGE_FIRSTNAME', 'CHANGE_LASTNAME')

const { changeLastName } = creators

const reducer = handleActions({
  [changeLastName]: (state, { payload }) => ({ lastName: payload })
}, {
  firstName: 'John',
  lastName: 'Doe'
})

const namedActions = createWrapperActions(creators, 'friend')

const namedReducer = createWrapperReducer({ actions: namedActions, reducer })

namedReducer({ lastName: 'Doe' }, namedActions.changeLastName('Dupont')) // => { lastName: 'Dupont' }
```

repository: xhite/reduxed-actions

repo_name: xhite/reduxed-actions


text:
# Per-Server Configuration
You can configure some settings on a per-server basis.

The `config` command will let you get, set, and reset options:
- `!sau config get <option>`: Get the current value of the option.
- `!sau config set <option> <value`: Set a new value for the option.
- `!sau config reset <option>`: Reset the value of the option back to the default.

_Note:_ Each deployed instance of the bot uses a different settings database.

## Prefix
- **Default:** `!sau|!s`
- **Example:** `!sau config set prefix !sau|!s`

The `prefix` option allows you to change which prefixes the bot listens to.

If you want to set multiple options, you can separate prefixes with spaces or `|`.

If you want to run multiple instances of the bot, you'll need to set each of them to listen on a different prefix. This can be tricky, if they're all in a channel together already. But it can be fixed:
1. First, add one of the instances to a private text channel without the others.
1. In that private channel, change its prefix with `!sau config set prefix <new prefixes>`.
1. Then, add the next bot to the private channel and change its prefix.
1. Repeat this as many times as needed to make all the instances different

To make test them, you can use `!sau-rollcall` in a channel with all of them, to make sure they have unique prefixes.

## Auto-join
- **Default:** `true`
- **Valid Options:** `on`, `off`, `true`, `false`
- **Example:** `!sau config set autojoin off`

With this feature enabled, discord users spectating an automated lobby will be automatically joined to the lobby if their saved in-game name matches an unlinked player from the capture. This auto-join is done whenever a user connects to the voice channel _and_ whenever the capture reports a new player has connected to the game. So users can connect to the game and discord in either order.

Use `!sau config set autojoin off` to disable this feature for your server.

## Speech
- **Default:** `true`
- **Valid Options:** `on`, `off`, `true`, `false`
- **Example:** `!sau config set speech off`

With this feature enabled, the bot will play spoken announcements in the voice channel if it has the permissions to do so.

Use `!sau config set speech off` to disable this feature for your server.

repository: vrnagy/silence-among-us

repo_name: vrnagy/silence-among-us


text:
# String

## 1. Creating a String

#### 1. Double quotes

```javascript
const doubleQuoteStr = "JavaScript";
```

#### 2. Single quotes

```javascript
const singleQuoteStr = 'JavaScript';
```

#### 3. Template literals

#### Substitutions

```javascript
let count = 0
console.log('Current count is %s', count);
```

#### Template literals

Template literals as opposed to substitions above are a better approach to using placeholders in a string.

Template literals are backtick embedded strings with the use of `${variableName}` as a placeholder.

```javascript
const value1 = 10;
const value2 = 23;
console.log(`value 1 is ${value1} and value 2 is ${value2}, sum is ${value1 + value2}`);
// value 1 is 10 and value 2 is 23, sum is 33
```

```javascript
let today = 'Friday';
let greeting = 'Thank God it\'s';

console.log(`${greeting} ${today}`);
```

#### 4. String Object

```javascript
const stringObjectInstance = new String('String Object instance.');
console.log(stringObjectInstance); // [String: 'String Object instance.']
```

## 2. `length` of a String

```javascript
const language = 'JavaScript';
console.log(`The length of ${language} is ${language.length}`); // The length of JavaScript is 10
```

## 3. Accessing characters in a String

#### 1. Indexing a String

```javascript
const name = 'Alex';
const firstChar = name[0];
console.log(firstChar); // A
```

#### 2. Using `charAt()`

```javascript
const name = 'Sarah';
const char = name.charAt(name.length - 1);
console.log(char); // h
```

## 4. Comparing strings

```javascript
if ('a' < 'b') {
  console.log('a is less than b'); // a is less than b
}

if ('z' > 'Z') {
  console.log('Z is greater than z'); // Z is greater than z
}
```

## 5. `valueOf()` to access the value of an Object

```javascript
const stringObject = new String('Bob Marley');
console.log(stringObject); // [String: 'Bob Marley']
console.log(stringObject.valueOf()); // Bob Marley
```

## 6. `eval()`

```javascript
console.log('10 + 5') // 10 + 5
console.log(eval('10 + 2')) // 12
```

## 7. Concatenation

#### Using `+`

```javascript
const str1 = 'Learning';
const str2 = 'JavaScript';
console.log(str1 + ' ' +  str2); // Learning JavaScript
```

Be careful with accidentally thinking the logic below will result in a math addition

```javascript
const value1 = '1';
const value2 = 1;
// answer is 11 here as JavaScript will treat the evaluation as concatenation of two String not adding numbers e.g 1 + 1 is 2.
console.log(value1 + value2)
```

#### Using `concat()`

```javascript
const firstName = 'John';
const lastName = 'Appleseed';
const formattedLastName = ` ${lastName}`
console.log(`The person\'s full name is ${firstName.concat(formattedLastName)}`); // The person's full name is John Appleseed
```

## 8. Escape characters

Some escape characters `\', \" and \n` . See documentation for a list of more escape characters.

```javascript
// \'
const escapeSingleQuote = 'Alex\'s Book';
console.log(escapeSingleQuote); // Alex's Book

// \"
const escapeDoubleQuote = 'Swift\"s latest version is 5.3';
console.log(escapeDoubleQuote); // Swift"s latest version is 5.3

// \n
const newLine = 'Today is Sunday.\nReturned from a weekend trip.';
console.log(newLine);
/*
Today is Sunday.
Returned from a weekend trip.
*/
```

## 9. Long literal strings

```javascript
const longLiteralString = "Welcome to JavaScript " +
                          "the language " +
                          "of the web."
console.log(longLiteralString);
```

## 10. Converting String to Number `parseInt()`

#### Example 1

```javascript
let stringNum = '150';

console.log(parseInt(`${2020 + 1}`)); // 2021
console.log(parseInt(stringNum)); // 150
console.log(parseInt('eight')); // NaN
console.log(parseInt('0xF')); // hexadecimal number
```

#### Example 2

```javascript
console.log(parseInt('  123')); // 123, ignores the spaces
console.log(parseInt('.123')); // NaN , sees a special character and return NaN (not a number)
console.log(parseInt('1 23')); // 1 , only parses the first number and ignores everything after the space
```

## 11. Converting String to Float `parseFloat()`

```javascript
console.log(parseFloat(2.50 + 0.13)); // 2.63
console.log(parseFloat('five')); // NaN
```

## 12. Converting Number to String `toString()`

```javascript
let number = 150;
let floatValue = 1.50;

console.log(number.toString()); // '150'
console.log(floatValue.toString()); // '1.50'
console.log((100).toString()); // '100'
```

## 13. `split()`

`split` is used to separate a given string by a given character and form and array.

```javascript
const str = 'Every developer should learn JavaScript.';

const spaceSeparated = str.split(' ');
console.log(spaceSeparated); // [ 'Every', 'developer', 'should', 'learn', 'JavaScript.' ]

const noCharSeparation = str.split('');
console.log(noCharSeparation);
/*
[
  'E', 'v', 'e', 'r', 'y', ' ', 'd',
  'e', 'v', 'e', 'l', 'o', 'p', 'e',
  'r', ' ', 's', 'h', 'o', 'u', 'l',
  'd', ' ', 'l', 'e', 'a', 'r', 'n',
  ' ', 'J', 'a', 'v', 'a', 'S', 'c',
  'r', 'i', 'p', 't', '.'
]
*/
```

## 14. `indexOf()`

`indexOf` is used to search the first occurrence of a substring.

```javascript
const str = 'Prior to Swift, iOS developers used Objective-C to write apps.';
const searchWord = 'Objective-C';
const index = str.indexOf(searchWord);
console.log(`${searchWord} was found at index ${index}`); // Objective-C was found at index 36
```

## 15. `includes()`

`includes()` returns a boolean value indicating the presence of a substring in a given string.

```javascript
const str = 'Thanksgiving is one of the biggest holidays of the year';
const searchWord = 'Thanksgiving';
console.log(`\`${searchWord}\` ${str.includes(searchWord) ? `is` : `is not`} in the sentence.`);
// `Thanksgiving` is in the sentence.
```

## 16. `substring()`

Creates a `substring` from given indices.

```javascript
const language = 'JavaScript';
const substring = language.substring(0, 4);
console.log(substring); // Java
```

## 17. `replace()`

Replace the occurrence of a substring with another string.

```javascript
let currentLanguage = 'I am currently learning Swift.';
currentLanguage = currentLanguage.replace('Swift', 'JavaScript');
console.log(currentLanguage); // I am currently learning JavaScript.
```

## 18. `slice()`

> MDN documentation: The slice() method extracts a section of a string and returns it as a new string, without modifying the original string.

```javascript
const str = 'JavaScript';

slicedStr = str.slice(0, 4);
console.log(slicedStr); // Java

let slicedStr = str.slice(-6);
console.log(slicedStr); // Script
```

## 16. Challenges

#### Challenge 1

Use escape characters to console log: We are "Vikings".

  Solution

```javascript
console.log('We are \"Vikings\"'); // We are "Vikings"
```

***

#### Challenge 2

Create two constants to store "Hello" and "Swift" to form "Hello Swift".

  Solution

```javascript
const msg1 = 'Hello';
const msg2 = 'Swift';
console.log(msg1 + ' ' + msg2); // "Hello Swift"
```

***

#### Challenge 3

Create a function called `verbing`. It should take a single argument, a string.
If its length is at least 3, it should add 'ing' to its end, unless it already ends in 'ing', in which case it should add 'ly' instead.
If the string length is less than 3, it should leave it unchanged. For example:

```javascript
verbing('swim'): 'swimming'
verbing('swimming'): 'swimmingly'
verbing('go'): 'go'
```

  Solution

```javascript
function verbing(inputString) {
  if (typeof inputString !== 'string') {
    console.log('Not a valid string.');
    return;
  }
  if (inputString.length >= 3) {
    const lastCharIndex = inputString.length;
    const suffix = inputString.substring(lastCharIndex - 3, lastCharIndex);
    if (suffix === 'ing') {
      inputString += 'ly'
    } else {
      inputString += 'ing';
    }
  }
  return inputString;
}

console.log(verbing('swim')); // swiming
console.log(verbing('swimming')); // swimmingly
console.log(verbing('go')); // go
```

***

#### Challenge 4

Create a function called `mixUp`. It should take in two strings, and return the concatenation of the two strings (separated by a space) slicing out and swapping the first 2 characters of each. You can assume that the strings are at least 2 characters long. For example:

```javascript
mixUp('mix', pod'); // 'pox mid'
mixUp('dog', 'dinner'); // 'dig donner'
```

Look up the JavaScript string reference to find methods which may be useful!

  Solution

```javascript
function mixUp(str1, str2) {
  const str1Prefix = str1.substring(0, 2);
  const str2Prefix = str2.substring(0, 2);

  str1 = str1.replace(str1Prefix, str2Prefix);
  str2 = str2.replace(str2Prefix, str1Prefix);

  return str1.concat(` ${str2}`);
}

console.log(mixUp('mix', 'pod')); // pox mid
console.log(mixUp('dog', 'dinner')); // dig donner
```

***

#### Challenge 5

You can get the Nth character, or letter, from a string by writing "string"[N]. The returned value will be a string containing only one character (for example, "b"). The first character has position 0, which causes the last one to be found at position string.length - 1. In other words, a two-character string has length 2, and its characters have positions 0 and 1.

Write a function `countBs` that takes a string as its only argument and returns a number that indicates how many uppercase “B” characters there are in the string.

Next, write a function called `countChar` that behaves like countBs, except it takes a second argument that indicates the character that is to be counted (rather than counting only uppercase “B” characters). Rewrite countBs to make use of this new function.

```javascript
console.log(countBs("BBC")); // 2
console.log(countChar("kakkerlak", "k")); // 4
```

  Solution

```javascript
function countBs(inputString) {
  let charCounter = 0;
  for (const char of inputString) {
    if (char === 'B') {
      charCounter += 1;
    }
  }
  return charCounter;
}
console.log(countBs("BBC")); // 2

function countChar(inputString, targetChar) {
  let count = 0;
  for (const char of inputString) {
    if (char === targetChar) {
      count += 1;
    }
  }
  return count;
}
console.log(countChar("kakkerlak", "k")); // 4
```

***

#### Challenge 6

Not Bad

* Create a function called `notBad` that takes a single argument, a string.
* It should find the first appearance of the substring 'not' and 'bad'.
* If the 'bad' follows the 'not', then it should replace the whole 'not'...'bad' substring with 'good' and return the result.
* If it doesn't find 'not' and 'bad' in the right sequence (or at all), just return the original sentence.

For example:

```javascript
notBad('This dinner is not that bad!'): 'This dinner is good!'
notBad('This movie is not so bad!'): 'This movie is good!'
notBad('This dinner is bad!'): 'This dinner is bad!'
````

  Solution

```javascript
function notBad(inputStr) {
  const indexOfNot = inputStr.indexOf('not');
  const indexOfBad = inputStr.indexOf('bad!');

  if (indexOfNot === -1 || indexOfBad === -1) {
    return inputStr;
  }

  if (indexOfNot < indexOfBad) {
    let sliceToReplace = inputStr.slice(indexOfNot, indexOfBad + 4);
    inputStr = inputStr.replace(sliceToReplace, 'good!')
  }

  return inputStr;
}

console.log(notBad('This dinner is not that bad!')); // 'This dinner is good!'
console.log(notBad('This movie is not so bad!')); // 'This movie is good!'
console.log(notBad('This dinner is bad!')); // 'This dinner is bad!'
console.log(notBad('This dinner is not!')); // 'This dinner is not!'
```

***

## Resources

1. [MDN - String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)
1. [StackOverflow - What is the difference between String.slice and String.substring?](https://stackoverflow.com/questions/2243824/what-is-the-difference-between-string-slice-and-string-substring)

repository: alexpaul/JavaScript

repo_name: alexpaul/JavaScript


text:
Courier Data Binding Generator for Android
==========================================

Experimental!

Gradle Configuration
--------------------

In your main build.gradle file, add:

```groovy
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'org.coursera.courier:courier-gradle-plugin:2.0.0'
        classpath 'org.coursera.courier:courier-android-generator:2.0.0'
    }
}
```

In the build.gradle file for a project, add:

```groovy
apply plugin: 'courier'

courier {
    codeGenerator 'org.coursera.courier.AndroidGenerator'
}

dependencies {
    compile 'com.google.code.gson:gson:2.3.1'
    courierCompile 'org.coursera.courier:courier-android-runtime:2.0.0'
}
```

Then add pegasus schema files to the `src/main/pegasus` directory of your project. Java classes
will be generated next time `gradle build` is run.

How code is generated
---------------------

**Records:**

* Records are generated as a Java class with public fields.
* Primitive optional types are boxed.  E.g. an optional "int" field in a Pegasus schema is
  represented as a Java `Integer`.

**Enums:**

* Enums are represented as a Java enum.
* TODO: an `$UNKNOWN` symbol will be in all enums to make wire compatibility issues easier to manage

**Arrays:**

* Arrays are represented as a Java `List`. This is primarily to enable immutable lists.
* To ease migrations, support for generating Java arrays (`[]`) will be supported, but for mutable
  types only.

**Maps:**

* Maps are represented as Java `Map`.

**Unions:*

* Unions are represented as an interface with a subclass for each member type.
* A `UnknownMember` is generated for each union to make wire compatibility issues easier to manage

For example, given a union "AnswerFormat" with member types "TextEntry" and "MultipleChoice", the
Java class signatures will be:

```java
interface AnswerFormat {};

class TextEntryMember implements AnswerFormat {
  public final TextEntry textEntry;
}

class MultipleChoiceMember implements AnswerFormat {
  public final MultipleChoice multipleChoice;
}

class UnknownMember {};
```

Projections
-----------

When a record is projected, only the requested fields are present. Even required fields may be
absent.

To support this, all fields are nullable, so that they my be treated as optional in the generated
data binding classes.

Mutable and Immutable types
---------------------------

Either mutable or immutable data bindings may be generated.

Immutable types should be preferred.

-                     |  Mutable bindings                 | Immutable bindings
----------------------|-----------------------------------|-------------------------------------------------------
Field access          | `public` fields                   | `public final` fields
Constructor           | `Course()`                        | `Course(Field1 field1, Field2 field2, ...)`
Builder               | not needed                        | `Course.Builder()` with `public` fields and `.build()`
`hashCode` / `equals` | No                                | Yes, structural
Arrays                | Configurable. `List` by default   | `List`
Primitives            | Configurable. nullable by default | nullable

#### Immutable Bindings

Immutable classes are preferred when using Courier with Android.

They may be constructed either using the public constructor:

```java
Course course = new Course("name", "slug", /*...*/ );
```

Or, via a builder:

```java
Course.Builder builder = new Course.Builder();
builder.name = "name";
builder.slug = "slug";
Course course = builder.build(); // builds an immutable type
```

The builder should be favored when constructing class instances with a large number of fields or
where many fields are optional.

#### Mutable Bindings

Where needed, Courier is able to generate mutable bindings for Android.

Mutable bindings are simple Java classes with an default constructor and public fields.

Example usage:

```java
Course course = new Course();
course.name = "name";
course.slug = "slug";
```

To configure Courier to generate mutable bindings, set the mutability property to "MUTABLE" in the
Pegasus schema:

```
@android.mutability = "MUTABLE"
record Course {
  // ...
}
```

To represent Pegasus 'arrays' in Java as arrays (`[]`), set the arrayStyle property to "ARRAYS" in
the pegasus schema:

```
@android.mutability = "MUTABLE"
@android.arrayStyle = "ARRAYS"
record Course {
  // ...
}
```

To represent Pegasus primitive type in Java as primitive value type, set the primitiveStyle property
to "PRIMITIVES" in the pegasus schema:

```
@android.mutability = "MUTABLE"
@android.primitiveStyle = "PRIMITIVES"
record Course {
  // ...
}
```

### hashCode/equals

`hashCode` and `equals` operators on the Android generated bindings.

Since it is unsafe to add these methods to mutable types, Courier will only generate them for
immutable classes.

### Adapters / Custom Types

GSON Adapters can be used to bind to arbitrary Java classes.

For example, to bind to `org.joda.time.DateTime`, define a typeref to a Long (for unix timestamps) or
a String (for ISO 8601 or whatever format of string date you would like to use). E.g.:

```
namespace org.example

@android.class = "org.joda.time.DateTime"
@android.coercerClass = "org.example.DateTimeAdapter"
typeref DateTime = long
```

And write a GSON `TypeAdapter`:

```java

import com.google.gson.TypeAdapter;
// ...

public class DateTimeAdapter extends TypeAdapter<DateTime> {

  @Override
  public void write(JsonWriter out, DateTime value) throws IOException {
    out.value(value.getMillis());
  }

  @Override
  public DateTime read(JsonReader in) throws IOException {
    return new DateTime(in.nextLong());
  }
}
```

The `org.example.DateTime` pegasus type will now be bound to `org.joda.time.DateTime` in all
generated Java code. E.g.:

```java
public final class ExampleRecord {

  @JsonAdapter(DateTimeAdapter.class)
  public DateTime time;
}
```

Development / Contributing
--------------------------

Set your JAVA_HOME to a Java 7 SDK!  Do **not** use Java 8 yet, there are a lot of
developers still on Java 7.

To run tests in IntelliJ, make sure `src/main/resources` is marked as a source root.

### Building dependencies

To pick up changes from Courier, first update all versions to a `-SNAPSHOT` in both courier
and this project, then run:

```
cd courier
sbt fullpublish-mavenlocal
```

To pick up changes from `courier/gradle-plugin` first update all versions to a `-SNAPSHOT` in both
gradle-plugin and this project, then run:

```
cd courier/gradle-plugin
./gradlew install
```
### Publishing

To publish locally:

```sh
gradle install
```

To publish to a maven repository:

```sh
gradle uploadArchives
```

To publish to an artifactory repository:

```sh
gradle artifactoryPublish
```

Design notes
------------

### Code generator

Currently using the Rythm string template engine. Which is fairly simple and is quite fast.

There are some reasonable alternatives that we could have used, and may switch to in the future:

* https://github.com/square/javapoet
* https://codemodel.java.net

TODO
----

**DONE!** Add support for all base types (records, maps, arrays, unions, enums, primitives)

**DONE!** Add Immutable type bindings

### Migrate to a streaming Jackson parser

Jackson can easily outperform GSON, we should migrate to it. The main technical difficulty
with doing so is transition to streaming serialization/deserialization, where deserializing
typed definitions, in particular, will be difficult, mainly because the 'typeName' may
appear after the 'definition' in the JSON being deserialized. When 'typeName' appears
after 'definition', the deserializer won't know what type to deserialize the 'definition' to and
will need to accumulate the 'definition' JSON until the 'typeName' is encountered.

### Add validation support

Not sure how to do this yet. Delegate the heavy lifting back to Peagsus?  Just need
the SCHEMA and a dependency on pegasus data and it could be done that way.

Alternatively, we could simply provide a "validate" method that just checks that
all required fields are present...

### Improve custom type support
This could be done by taking the .pdsc "coercerClass" as a adapter or adapter factory
(developer could choose) and using it to set a `@JsonAdapter` wherever the type is used.
(see: https://sites.google.com/site/gson/gson-type-adapters-for-common-classes-1)

- Custom type support is partially available. Custom types on record fields are supported.
- Custom types in arrays and maps currently to NOT work properly. (although the type adapter could
  be added to the GSONBuilder to work around this for the time being)

### Add default support

For primitives this is trivial. For complex types this is more difficult, although GSON
may be able to produce the default value from static JSON text ?

### Other improvements

[ ] Support $UNKNOWN for enums, this could be done with a TypeAdapter that delegates back to the
    enum adapter for recognized symbols? To ease backward compatible changes we need this.

[ ] Disallow any attempt to serialize to JSON with a unknown union member of enum symbol. Clients
    should identify an handle these cases since we do not provide pass-thru.

[ ] Emit a warning or fail the build when mutable types are referenced by immutable types.

repository: coursera/courier

gha_language: Scala

repo_name: coursera/courier


text:
# Changelog

## 0.0.1.alpha5

- Allow omitting skeleton.css, via html-context.

## 0.0.1.alpha4

- Add component: search-input
- Add component: search-hide
- Add components for toggling sidebars

## 0.0.1.alpha3

- Add a nice introduction to `sections/article.html`
- Add component: related-pages
- Add responsive off-canvas sidebars, and corresponding components.
- Host documentation on ReadTheDocs.
- Rename certain sections of the scaffolding.
- Add more headers and footers to the scaffolding.

## 0.0.1.alpha2

- Add initial documentation scaffolding.
- Add component: breadcrumbs
- Add component: edit-this-page
- Add component: ethical-ads
- Add component: logo
- Remove Sphinx variables from skeleton.
- Updating terminology for parts of this project.

## 0.0.1.alpha1

Initial release.


text:
---
tags:
  - REMARK
  - Replication
  - Notebook
  - Blog
remark-name: "PortfolioChoiceBlogPost"
title: Optimal Financial Investment over the Life Cycle - Blog Post
github_repo_url: https://github.com/econ-ark/PortfolioChoiceBlogPost
authors: # required
  -
    family-names: Carroll
    given-names: "Christopher D."
    orcid: "https://orcid.org/0000-0003-3732-9312"
notebooks: # path to any notebooks within the repo - optional
  - PortfolioChoiceBlogPost.ipynb
---

## PortfolioChoiceBlogPost

A [blog post](https://econ-ark.github.io/PortfolioChoiceBlogPost/PortfolioChoiceBlogPost.html) showcasing use of HARK
to the portfolio choice allocation problem.


text:
A Ruby implementation of the Myers diff algorithm.

Basically a minimal and incomplete port of the [jsdiff](https://github.com/kpdecker/jsdiff) Javascript library.

# Links

* Algorithm paper: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=<IP_ADDRESS>.6927
* Reference JS implementation: https://github.com/kpdecker/jsdiff

# Usage

You can use `MyersDiff::CharDiff#diff(s1, s2)` to calculate an edit script that changes a string `s1` into `s2`.
The return value is an edit script, represented as an array of edit commands.
The edit commands are hashes that are formatted in three ways:

1. Match: `{ count: <integer>, value: <string> }`
2. Add: `{ count: <integer>, added: true, value: <string> }`
3. Remove: `{ count: <integer>, removed: true, value: <string> }`

```.rb
diff = MyersDiff::CharDiff.new
diff.diff('abcabba', 'cbabac')

 => [{:count=>1, :added=>nil, :removed=>true, :value=>"a"}, {:count=>1, :added=>true, :removed=>nil, :value=>"c"}, {:count=>1, :value=>"b"}, {:count=>1, :added=>nil, :removed=>true, :value=>"c"}, {:count=>2, :value=>"ab"}, {:count=>1, :added=>nil, :removed=>true, :value=>"b"}, {:count=>1, :value=>"a"}, {:count=>1, :added=>true, :removed=>nil, :value=>"c"}]
```

# License

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

# Releasing

* Update version file
* Run `bundle install`
* Commit changes
* Add tag `git tag -s vVERSION`
* `git push && git push --tags`
* `gem build myers_diff.gemspec`
* `gem push myers_diff-VERSION.gemspec`


text:
## File Watcher Php Library [![Build Status](https://travis-ci.org/koala-framework/file-watcher.svg?branch=master)](https://travis-ci.org/koala-framework/file-watcher)

Php library for watching for file system changes.

Supports different backends for best cross platform usage.

### Backends

* [watchmedo](https://pythonhosted.org/watchdog/) (Cross platform pything shell utility)
* [fswatch](http://emcrisostomo.github.io/fswatch/) (Cross-platform file change monitor with multiple backends)
* [inotifywait](http://linux.die.net/man/1/inotifywait) (Linux shell utility)
* [inotify](http://php.net/manual/en/book.inotify.php) (Php PECL extension)
* Polling fallback (Slow)

### Requirements

* Php 5.3+

### Installation
Install using composer:

    composer require koala-framework/file-watcher

### Example Usage

    $watcher = Kwf\FileWatcher\Watcher::create('.');
    $watcher->addListener(Kwf\FileWatcher\Events::MODIFY, function($e) {
        var_dump($e->filename);
    });
    $watcher->start();

repository: WackyStudio/file-watcher

repo_name: WackyStudio/file-watcher


text:
# Introduction to Python

The notebooks:

- [Jupyter](https://github.com/vafaei-ar/alzahra-workshop-2019/blob/master/SI/0-jupyter_notebooks.ipynb) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/vafaei-ar/alzahra-workshop-2019/blob/master/SI/0-jupyter_notebooks.ipynb)

- [Python](https://github.com/vafaei-ar/alzahra-workshop-2019/blob/master/SI/1-python_basics.ipynb) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/vafaei-ar/alzahra-workshop-2019/blob/master/SI/1-python_basics.ipynb)

- [Numpy](https://github.com/vafaei-ar/alzahra-workshop-2019/blob/master/SI/2-numpy.ipynb) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/vafaei-ar/alzahra-workshop-2019/blob/master/SI/2-numpy.ipynb)

- [Matplotlib](https://github.com/vafaei-ar/alzahra-workshop-2019/blob/master/SI/3-matplotlib.ipynb) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/vafaei-ar/alzahra-workshop-2019/blob/master/SI/3-matplotlib.ipynb)


text:
# Daily-Planner

Plan your work day in a snap!

___

## Description

The daily planner is a helpful tool that will allow the user to write, save, and view his/her plans for the work day.  The main body changes colors depending on the time of day. It is an interactive display that highlights the days events.
___

## How It Works

The daily planner is arranged with rows and columns that the provide the user with a number of options to chose from. In the main body of the planner, the hour corresponding to the current time is displayed.  As the time changes, the hour rows change colors to keep the user aware of their current tasks for that hour, the past tasks that have already happened in that day, and what is to come until end of the work day.

The user can interact with the planner by adding in tasks at the needed time, then clicking the save button on the right side of the screen.  By doing this, the users tasks get saved into local storage where they will stay until the user deletes the task.

The functionality of the planner is based around the usage of Moment JS that is used to not only indicate the hour of the day, but to also set the date in the header of the page. Below is a visual representation of the daily planner. During the hours of 9 AM - 5 PM, the calendar displays red for the current hour and green for anytime in the future. For this example, the blocks are grey to show that the work has ended.

![IMAGE of END OF DAILY PLANNER](Assets/DailyPlanner.png)
___

## Link to Project

https://ccraig7321.github.io/Daily-Planner/

___

## Technologies

- HTML
- CSS
- Moment JS
- Bootstrap
- Bootswatch
- Javascript
- Visual Studio Code

___

### License

Copyright 2020 CHELSEY CRAIG

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.


text:
# Overview

Dandelion is a powerful tool that can be used to build a variety of
applications. Here are just a few examples:

- A tool for extracting information from text
- A tool for automatically generating summaries of text
- A tool for automatically categorizing text
- A tool for identifying the sentiment of text
- A tool for translating text


text:
# What's in this folder?

This folder contains a Postman collection with sample calls from one of the demos, to do various operations against the Time Series Insights environment.

## Configuring Postman

1. If you're not familiar with postman, you can download it for free and find all documentation here: https://www.postman.com

2. To use the collection with the sample calls, import it into Postman.

   For help on using collections, see here: https://learning.postman.com/docs/getting-started/importing-and-exporting-data.

3. The collection uses the following variables, so make sure to create them in Postman, and fill in the right values from your own Time Series Insights environment and app registration. See the demo in the course for more info:

   ![enter image description here](/rest-samples/readme-postman-collection-variables.png)

   For help on using variables, see here: https://learning.postman.com/docs/sending-requests/variables.


text:
![Fatboy Logo](https://cdn.rawgit.com/AnthonySuper/fatboy/master/assets/logo-optimize.svg)

##### See views, right here, right now
[![Build Status](https://travis-ci.org/AnthonySuper/fatboy.svg)](https://travis-ci.org/AnthonySuper/fatboy)
[![Code Climate](https://codeclimate.com/github/AnthonySuper/fatboy/badges/gpa.svg)](https://codeclimate.com/github/AnthonySuper/fatboy)
[![Test Coverage](https://codeclimate.com/github/AnthonySuper/fatboy/badges/coverage.svg)](https://codeclimate.com/github/AnthonySuper/fatboy)

Fatboy is a gem which manages view counts on ActiveRecord objects (or things that quack like them).

It's great for seeing the most (and least) viewed models on your website.
To make things even better, Fatboy will store view counts by day, month, year,
and all-time.

It doesn't touch your SQL database.
Fatboy stays slim in Redis.

## Installation

Add this line to your application's Gemfile:

    gem 'fatboy'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install fatboy

## Usage

Fatboy is easy to set up. First, initialize it:

```ruby
  # if you don't provide your own redis, fatboy will create one
  # with Redis.new
  fatboy = Fatboy.new(redis: redis)
```

Then, just tell it what your users look at.

```ruby
  # As long as the variable you're passing in responds to
  # .id, this will work
  fatboy.view(image)
  # You can also use the shorthand method:
  # fatboy[image]
```

Now, managing views is pretty useless if you can't retrieve them later.
Thankfully, fatboy makes this easy as well:

```ruby
  fatboy.views_for(image).today # => 1
  fatboy.views_for(image).this_year # => 1
```

Don't worry if that's a brand-new Fatboy instance---as long as the Redis is the same, Fatboy's view count will be the same.

#### Getting Top Viewed

Fatboy makes it easy to retrieve a list of the most-popular records in your database.
Check it now now:
```ruby
  fatboy.popular(Image).today.most # => most viewed image today
```

Want it from other days?

```ruby
  # most popular image a month ago
  fatboy.popular(Image).day(Time.now << 1).most
  # Or with active support
  fatboy.popular(Image).day(1.months.ago).most
```
Don't want just the most popular?
Maybe you'd like the least popular?

```ruby
  fatboy.popular(Image).day(Time.now).least
  fatboy.popular(Image).month(Time.now).least
```

Or perhaps a range?

```ruby
  fatboy.popular(Image).this_month.range(10..20)
  # or, a range for a while ago
  fatboy.popular(Image).month(3.months.ago).range(10..20)
```

Fatboy makes it easier. See the rdoc for details.
##### Pipelined

If you need to view lots of models at once, you may find Fatboy::Many to be a good option.
Check it out now:

```ruby
  m = fatboy.many
  m[image]
  comments.each{|c| m[c]}
  m[description]
  m.commit!
```

## Contributing

1. Fork it ( https://github.com/AnthonySuper/fatboy/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Write functionality and tests
4.  Push to the branch (`git push origin my-new-feature`)
6. Create a new Pull Request

repository: AnthonySuper/fatboy

repo_name: AnthonySuper/fatboy


text:
`Picker` is used to pick a file from local device storage. `PhotoPicker` and `TextPicker` components are specific to image and text file types .

![Image](~/images/photo_picker_and_code.png)

Listen to `PhotoPicker` onPick event:
```jsx
import { PhotoPicker } from 'aws-amplify-react';

render() {
    <PhotoPicker onPick={data => console.log(data)} />
}
```

To display a preview, you can use `preview` directive:

```jsx
<PhotoPicker preview onLoad={dataURL => console.log(dataURL)} />
```

You can retrieve the URL of the image by implementing `onLoad` action. In this case, you may also want to hide the preview:

```jsx
<PhotoPicker preview="hidden" onLoad={dataURL => console.log(dataURL)} />
```

repository: SebastianKurp/docs

repo_name: SebastianKurp/docs


text:
---
anchor: ical-display
title: iCal Display
start_date: 2015
end_date: 2015
images:
  -
    file: cal/main.png
    desc: Assignments and exams from multiple calendars are displayed, as well as the current date and time.
type: Web Application
technologies: ["PHP", "JS", "HTML", "CSS"]
link: https://github.com/brandondusseau/ics-display/
link_title: GitHub Repository
order: 9
---
While I was at school, I utilized Google Calendar to track which assignment due
dates and exams I had coming up, as something of a to-do list. As someone who
is motivated by seeing tasks get completed, I grew frustrated with the
inflexibility of the traditional calendar that Google provided. I could not
show that a task had been completed, or was late, without deleting the event.

I wrote this simple 10-foot style interface to display upcoming events from
only the calendars I wanted. I added the ability to read special tags from
event descriptions which would cause events to be shown as complete, or
urgent.

The application uses a PHP backend to read an iCal file from Google's server
(though any iCal file would work). The frontend uses JavaScript to periodically
reload the calendar content and make necessary formatting changes.

repository: BrandonDusseau/brandonjd-net

repo_name: BrandonDusseau/brandonjd-net