text:
# prover

By Harry Sha and Tyler Yep

## Development Setup
- Run `pip install -r requirements-dev.txt`
- Then `pre-commit install`

# TODO

- Write out a sample proof for:
  - Non-mathy proof
  - Support for contradiction
  - Support for induction

# Proof writing section interface

All assumptions
Goal:

- Close to natural proof language in English
- Easy mode vs advanced mode
- Suggestions
  - "try induction! try arbitrary!"
- Auto solve in the background
- Should be able to prove everything in CS103

# Plan

- Backend first (all the proof logic)
  - Logic
    - How are we going to model FOL statements and proofs?
    - Proof checker (is this proof a valid proof for this statement)
  - Get simple 103 proofs like "Forall n is even => n^2 is even"
  - Should be able to print out first order logic formulas

# Logic

`Variable` and `Formula` are both classes

Formulas:
S T ->

- for_all(n, S)
- exists(n, S)
- and(S, T)
  - maybe this: S and T

```
Theorem: "Forall n is even => n^2 is even"
n = Var()
for_all(
    n,
    implies(
        even(n), even(square(n))
    ),
)
```

First proof: (103)

Pick arbitrary n. Assume n is even, we'll show that n^2 is even.
As $n$ is even, there is some $k$ such that $$n = 2k$$. Then $n^2 = 4k^2 = 2(2k^2)$.
Therefore there is some natural number $s$ namely (2k^2) such that $n^2 = 2s$
Thus $n^2$ is even.

Take 2: (lean)

```
It suffices to show that for an arbitrary n, if n is even, n^2 is even
Pick arbitrary n
It suffices to show that n is even implies n^2 is even.
Assume n is even
It suffices to show n^2 is even
If suffices to show exists k where n^2 = 2k
Because n is even, we have j = 2n
Pick k = (2j^2).

We found k so we're done!!
```

Take 3 (lean version)

```
Goal: prove for an arbitrary n, if n is even, n^2 is even
    Pick arbitrary n
Goal: prove n is even implies n^2 is even.
    Assume n is even
Goal: prove n^2 is even
Goal: prove exists k where n^2 = 2k
    Let j be such that n = 2j, (because n is even we know j exists)
    Pick k = 2j^2
Goal: show n^2 = 2k
    Simplifier:
        n = 2j
        n^2 = (2j)^2
        n^2 = 4j^2
        n^2 = 2 (2j^2)
        n^2 = 2k
```

## Working interactive proof

Take 4: (more-student-oriented)

```
Goal: prove for an arbitrary n, if n is even, n^2 is even
    Pick arbitrary integer n
Goal: prove n is even implies n^2 is even.
    Assume n is even
Goal: prove n^2 is even
    Use definition of even number
Goal: prove exists k where n^2 = 2k
    Let j be such that n = 2j, (because n is even we know j exists)
    Have n^2
        = (2j)^2
        = 4j^2
        = 2(2j^2)
    Pick k = 2j^2
```

```python
import arithmetic
import set_theory

def interactive_prover(theorem):
    context = {} # n: int, arbitrary, even
    goals = [Formulae()]

    while not goals: # or empty
        print(f"Goal: prove {goal}")
        stuff = parse(input())
        context += stuff
        for goal in goals:
            goal.try_step()

```

## Sample AND proof

```
Goal: prove for an arbitrary n, if n is even, n^2 is even
    Pick arbitrary integer n
Goal: prove n is even AND n^2 is even.
    Split on and:
    Goal: prove n is even
        sorry

    Goal: prove n^2 is even
        sorry
```

```python
def check_proof(proof, theorem, context={}):
    pass
```

Equality by... substitute, by_transitivity, etc
Finite number of possible actions (PickArbitrary, Assume, Have?, UseDefinition)

- Use Wolfram Alpha or some related package to ensure the rearranging step is true
- Goals are automatically added as the student types (or hard mode, we leave the student to write the new goal as well), and are included in the final output.
- Save to Pdf outputs the english

Very verbose proof language
Parsed into structure

Equals(x, x)

```python
def evaluate(S):
    pass

def is_even(n):
    return exists(k, equals(2-k, n))

def proof(thm, assumptions):
    n = PickArbitraryNum()
    n_is_even = Assume(even, n) # exists(k, equals(n, 2-k))
    k, f = get_example_from_existential(n_is_even) # f = equals(n, 2-k)
    f = apply_to_both_sides(square, f) # equals(n^2, (2k)^2)
    g = rewrite(f) # g = equals(n^2, 2(2-k^2))
    h = existential_introduction('a', 2-k^2, g) #h = exists(a, equals(n^2, a))
    i = implies_intro(n_is_even, h)
    forall_intro("n", i)

    if we can get to exists(k, even(square(n)))

    can_be_written_as_even(k-2)

pick arbitrary n
assume even(n)
    math
    conclude n^2 is even

    even(n) => even(n^2)  # implication introduction

forall n (even(n) => even(n^2)) # forall intro

n = Var(arbitrary=True, even=True)
# Bad - Might be too verbose + want to use even outside of this var
```

```python
class Var:
    def __init__(**kwargs):
        if "even" in kwargs:
            pass

for_all(lambda n: even(n) == even(n-2))
function == implication
```

## December 30, 2020

THEOREM: (A & (A -> B)) -> (B)

1. Goal: (A & (A -> B)) -> (B)
Assume (A & (A -> B))

2. Goal: B
Assumptions:
    - 1.  (A & (A -> B))

split_on_and(1)  # accepts 1 or   (A & (A -> B))

3. Goal: B
Assumptions:
    - 1.  (A & (A -> B))
    - 2.  A
    - 3.  A -> B

deduce(2, 3)
qed

THEOREM: (A & (A -> B)) -> (B)
output:
- Assume (A & (A -> B))
- split_on_and(A & (A -> B))
- deduce(A, A -> B)

THEOREM: ((A-> C) & (B -> C)) -> (A | B) -> (C)
- Assume ((A-> C) & (B -> C))
- split_on_and((A -> C) & (B -> C))

Goal: (A | B) -> C
Assumptions:
    1- (A -> C) & (B -> C)
    2- (B -> C)
    3- (A -> C)

assume(A | B)

Goal: C
Assumptions:
    1- (A -> C) & (B -> C)
    2- (B -> C)
    3- (A -> C)
    4- A | B

split_on_or
Goal: C
    Assumptions(A):
        1- (A -> C) & (B -> C)
        2- (B -> C)
        3- (A -> C)
        4- A | B
        5- A
    deduce(A, A->C)

    Assumptions(B):
        1- (A -> C) & (B -> C)
        2- (B ->s C)
        3- (A -> C)
        4- A | B
        5- B
    deduce(A, A->C)

ProgramState = contains lists of proofs / proofstates. each time the user inputs, advances the programstate, so as to alow them to "undo". Also allows us to examine the path a student takes to solve the proof.

ProofState = contains goals, assumptions
FitchProof =
FitchLine = (line_number:int, formula: [Formula], rule: FitchRule , lines_applied_to: [int], assumptions: list[FitchLine])
StudentProof

Theorem =
Goal =
Assumption =


text:
Home

Book

Part Three: Lisp So(u)rcery

Robotics

# Robotics

> "Relevant quote..."
> Source

Requires specialized hardware---a robot kit, or the the key components to build and design your own robot from scratch, i.e., servos, logic-board, etc.

Overview of robotics, and AI-controlled automatons, learning agents, etc.

Program a kit robot in Lisp.

Design a library that dispatches low-level functionality to robotic subsystems (?)

Integrate AI into kit robot, so it can make its own decisions based on an idealized environment.

« Previous

Table of Contents

Next »

license: MIT

repository: agreco/llthw

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: agreco/llthw


text:
# ajsd
  [![License: IPL 1.0](https://img.shields.io/badge/License-IPL%201.0-blue.svg)](https://opensource.org/licenses/IPL-1.0)
## Description
asd

## Table of Contents
* [Installation](#installation)
* [Usage](#usage)
* [License](#license)
* [Contribution](#contribution)
* [Tests](#test)
* [Questions](#questions)

## Installation

asd
## Usage

asd

## License
This project is licensed under the IBM license.

## Contribution

asd
## Test

asdasdasd

## Questions
To contact me or if any questions, please email me at<EMAIL_ADDRESS>Go to https://github.com/asdasd to view my github profile.

branch_name: refs/heads/main


text:
# Lecture 4: Risk Stratification

[Link to slides](https://mlhc19mit.github.io/slides/lecture4.pdf)

## Risk stratification
* With the goal of reducting cost and improving patient outcomes, **risk stratification** is separating high-risk and low-risk gropus from within a patient population
	* Interventions targeting high-risk patients
* Risk stratification was based on simple scores using human-entered data, but now automated with ML

## Case study: Early detection of Type 2 diabetes
* Diabetes cost $245 billion in 2012 within the US, $831 billion budgeted in 2014
* Requirements for large-scale prevention programs
	1. Identify true at-risk population
	2. Improve interventions being administered
	3. Lower the cost of intervention
* Traditional hand-written type 2 diabetes risk assessment forms
	* Why not embed in EMR's to capture data at point-of-care? eCRF?
* Looking at patients with diabetes today, examine which variables in their clinical histories could have predicted their health outcome
	* Example of data-driven approach to longitudinal data
	* **BUT** data might not be labeled, it might not have enough data


text:
# Password Locker

## Author

 Chepkirui Betty

## Description
This is a project that enable clients to store and retrieve their credentials upon log-in and create new credentials/passwords and even generate random passwords for different accounts.

## Features
* Create account for new user
* Loggin in
* Option of computer generated password
* Create new credential
* Delete credential
* Display existing credentials
* Search credential by site name
* exit for leaving the site

## Behavior Driven Development

      Behavior
      Input
      Output

        on load
        loging/signup
        Access to the account

        on login
        show the credential detail
        the store credentials are displayed

        Search for credential
        input account
        credentials with that name displays

        option of exit
        choose exit option
        exit

## Setup/Installation requirements
1.Clone or download and unzip the repository from github https://github.com/chepkiruibetty/Password-locker.git

2.You can use this command (git clone https://github.com/chepkiruibetty/Password-locker.git ) to clone the project to your machine if you have git .

3.cd into the project folder and open in text editor either code. or atom.

4.Then run chmod +x run.py on your project directory.

5.Run  ./run.py to launch the program.

## Technologies Used

- PYTHON
- Git

## Support and contact details
<EMAIL_ADDRESS>
### Code beat

- [![codebeat badge](https://codebeat.co/badges/a4834ad7-9168-4fcd-87ee-6305c883b8b8)](https://codebeat.co/projects/github-com-chepkiruibetty-password-locker-betty-password)

### License
- [![GitHub license](https://img.shields.io/github/license/Naereen/StrapDown.js.svg)](https://github.com/Naereen/StrapDown.js/blob/master/LICENSE)

repository: chepkiruibetty/Password-locker

repo_name: chepkiruibetty/Password-locker


text:
# MERN template project

## Introduction
This project is a template for building fullstack JavaScript applications running on node.js. The technology stack is as follows:
- **React** for the front-end, bootstrapped with "Create React App".
- **express.js** for the server
  - Serves the React app
  - Provides the JSON API for the React app using http

MongoDB is not used in this template but can be easily integrated into the server app (see the *mongoose* branch for an example).

The app is fully deployable to any PaaS like Heroku or AWS Elastic Beanstalk that understands how to build and run projects with a **package.json** file.

## Commands
The package.json provides all the commands needed to test and run this application.
- **npm install** install all dependencies for the server and the client.
- **npm run build** builds the static files for the React app.
- **npm start** starts the complete MERN app.
- **npm run react-dev** starts the React app in development mode on http://localhost:3000. This requires the server running as well.

## Development
Use this template to build your own apps. Since the React app is build using Create React App, you can easily update the React version.

During development of the React app, use **npm run react-dev** or simply navigate to the client folder and run **npm start**. Keep the server running as well.

If you want reload-functionality for the server code, I recommend using something like [nodemon](https://www.npmjs.com/package/nodemon). You can then navigate to the server folder and start it using **nodemon src/index.js**.

Before deploying, build and start the app, and test that everything works on http://localhost:8080. The react app should open when you visit http://localhost:8080 in the browser and the API should be available on http://localhost:8080/api/.

## Configuration
The app opens on port 8080 by default. If the environment variable **PORT** is set, that port will be used instead.

In production mode, the React app expects to find the API on the same port as itself on the `/api` path. In development mode, the React app expects to find the api on http://localhost:8080/api/ instead. You can change this in the React `.env` files.

## Server implementation
It's worth noting that a trick is used in the server implementation to concurrently serve the API and the React app from the same server app.

By default, when the express.js server receives a request, it tries to match it with one of the API routes. If none matches, it serves one of the static files instead. If none of those matches, it serves the React index.html file. This enables client-side routing in the React app (with React Router or similar library) without overriding the server API or hiding any of the other static assets.

Relevant code snippets from `server.js`:
```js
  // Serve the static files
  app.use(express.static(path.resolve('..', 'client', 'build')));
```

```js
  // "Redirect" all non-API GET requests to React's entry point (index.html)
  app.get('*', (req, res) =>
    res.sendFile(path.resolve('..', 'client', 'build', 'index.html'))
  );
```


text:
## Write a file to S3 from your Alexa Skill
----

##### Requirements

* [Amazon Developer Account](https://developer.amazon.com)
* [AWS Account](https://console.aws.amazon.com)

#### Instructions for deploying this sample skill

## 1. Create the lambda function

1. Login to [AWS Account](https://console.aws.amazon.com)
1. Be sure that your region is set to **N. Viginia** or **EU (Ireland)** otherwise you will not be able to progress past **step 6**.
1. Navigate to the lambda console by typing **"lambda"** into the AWS Services search box and selecting **Lambda**.
1. Click on **"Create Function**
1. Select the **alexa-skill-kit-sdk-factskill** blue print and click next (Don't check the check box. Click the link).
1. Under *Configure Triggers* add the **Alexa Skills Kit** trigger by clicking on the empty grey dashed box and click next.
**Fill out the form:**
   * Function Name: **fileWhisperer**
   * Description: **Write files to s3 from your alexa skill**
1. Copy the code from [src/index.js](https://github.com/alexa/alexa-cookbook/blob/master/aws/Amazon-S3/write/src/index.js) and paste it into the editor overwritting the fact skill boilerplate.
1. At the bottom of the page click the **next** button
1. Click the **Create Function** button.
1. Congratulations you're done creating the skill!!!! Leave AWS open and do the next step in another tab or window.

## 2. Create the Skill

1. Login to [developer.amazon.com](https://developer.amazon.com)
1. Create a new Alexa Skill
  * Click on **Alexa**`
  * Click on **Get Started** under **Alexa Skills Kit**
  * Click on **Add a new skill**
1. In the **Name** field enter **File Whisperer**
1. In the **Invocation Name** field enter **file whisperer**
1. Click Save
1. Click on the Interaction Model and click on the Builder Beta.
1. Copy the json from [speechAssets/InteractionModel.json](https://github.com/alexa/alexa-cookbook/blob/master/aws/Amazon-S3/write/speechAssets/InteractionModel.json)

## 3. Configure your S3 Bucket & Add trust policy

1. Login to [AWS Account](https://console.aws.amazon.com)
1. Create a bucket or use your existing one.
1. Update your lambda code to point to the bucket.
  `var myBucket = 'alexabucket12';      // replace with your own bucket name!`
1. Add the trust policy `AmazonS3FullAccess` to your lambda function's role

repository: KazuCocoa/alexa-cookbook

repo_name: KazuCocoa/alexa-cookbook


text:
---
date: '2019-07-25 13:46 +0100'
thumbnail-image: /img/P1170708%20(Custom)small.jpg
layout: default
published: true
title: Helping young adults find employment
summary: The GREAT Project helps a young adult find employment.
---
![]({{site.baseurl}}/img/P1170708%20(Custom)%20large.jpg)

Before joining the GREAT Project, Daniel* was unemployed and living at home with his parents. He’d been out of work for ten months and was at a loss with what to do next. At his local Jobcentre, he came into contact with the GREAT Project, and felt it was the project best suited to support him.

Daniel expressed to his Employment Support Officer, Leah, that he wanted to gain experience and learn new skills. This was taken into consideration by Leah when designing his bespoke programme of activities.

Leah began by helping Daniel with his CV; she showed him best practices and what not to write. The next thing for Daniel was attending an interview skills workshop. Here, participants are shown different interview scenarios, techniques on answering interview questions and how to handle themselves in a professional setting. Daniel benefitted from this and attended pre-placement training, delivered by Business in the Community, to hone in on his new skills. Here, participants are taught a variety of topics such as; what to expect in a work place, best practices and making a good first impression.

Daniel then felt ready to undertake a two-week work placement at a British multinational retailer. He enjoyed his experience so much, that when the retailer offered him a more permanent position, he was happy to accept.

Speaking of his time on the project, Daniel said:

> “The GREAT Project really helped me increase my confidence and encouraged me to come out of my comfort zone. I got to speak to new people, learnt new skills and I also learnt how to feel better about travelling alone. Most importantly though, I got the chance to work in a retail environment.”

Leah said:

> “I’m really happy with the progress Daniel has made. He’s come a long way and managed to do the things he set out to do when he joined the project. I’m happy I could help him and hope he’s happy in his new role.”

Daniel is currently enjoying his time at the retailer and is looking forward to what the future holds.

*Names have been changed to protect the participant’s identity.

branch_name: refs/heads/gh-pages

gha_language: CSS

gha_license_id: MIT


text:
---
num: "h04"
desc: "Chapter 4: Predefined and programmer defined functions "
ready: true
assigned: 2018-10-18 12:30:00.00-7:00
due: 2018-10-24 12:30:00.00-7:00
---

{% include no_staples_box.html %}
Read Chapter 4, sections 4.1 - 4.3.
Please turn in the physical copy of your homework in person. Write in PEN or DARK PENCIL.

PLEASE MARK YOUR HOMEWORK CLEARLY, REGARDLESS OF IF YOU WRITE IT OUT IN INK OR PENCIL!

1.  (2 pts) What is a flag in a program and of what use is it?

2.  (2 pts) What is type casting and how is it performed in C++?

3.(5 pts) Which of these uses of type casting will NOT ensure that f is 1.5? Answer should be (ex1), (ex2), (ex3), or (ex4) (or a combination of those).

```cpp
int a(1), b(2), c(2), d(2), e(2);
double f;

f = (a + b)*c / static_cast<double>(d + e); // (ex1)
f = static_cast<double>(a + b)*c / (d + e); // (ex2)
f = (a + b)*static_cast<double>(c) / (d + e); // (ex3)
f = static_cast<double>((a + b)*(c) / (d + e)); // (ex4)
```

4.(3 pts) We talked about three concepts that are very important to keep straight, and not confuse: (a) function declaration, (b) function definition, and (c) function call. Here is a short C++ program, with line numbers. Please indicate after the program which line number (or range of line numbers, e.g. 3-5 or 7-14) contains the function prototype, function definition, and function call for the isDivisibleBy function.

```cpp
1  #include <iostream>
2  using namespace std;
3
4  bool isDivisibleBy(int a, int b);
5
6  int main() {
7     cout << "result for (15,5) is " << isDivisibleBy(5,15) << endl;
8     cout << "result for (15,5) is " << isDivisibleBy(5,15) << endl;
9     return 0;
10  }
11
12  bool isDivisibleBy(int a, int b) {
13    return ( a % b == 0 );
14  }
```

5.  (10 pts) Write a Makefile to automate the compilation process for lab02. Your makefile should produce the executables: starC, starL, starT and starZ as specified in the writeup.

6. (6 pts) The infinite series: s = 1 + (2/3) + (4/9) + (8/27) + .... is a geometric series that converges to a whole rational number (i.e. like 2 or 3 or 4). Below is an unfinished C++ program that will calculate s to the kth position (so, for example, if k = 1, then s = 1 + (2/3) = 1.666...). Fill in the missing code:

```cpp
#include <iostream>
#include <cmath>
using namespace std;

int main(){
    double s(0.0);
    int k(0);
    cout << "Enter k: ";
    cin >> k;
    for (____________________________________________________) {

        s = ____________________________________________________; }

    cout << "Series converges to: " << s << endl;
    return 0;
}
```


text:
How to raid on Twitch
=====================

Raiding is a great way to share the love with other streamers, to meet new
friends, to carry the hype to another channel, and So Much More™. To help with
the various steps required to make everything work smoothly, here's a quick
checklist or step-by-step to out.

1. Select a raid target. Are you raiding an old friend? Raiding someone you
   just found because they're in a notable category? Returning the favour to
   someone who's raided you in the past? If you're interested, you can use a
   tool [from my channel bot](https://sikorsky.rosuav.com/raidfinder) to find
   streams with similar category, viewership, and tags to your own.
2. Snoop your target. (Make sure you're not accidentally revealing too much
   of that person's stream; be sure to mute the stream so you don't rebroadcast
   their audio by mistake.) Try to figure out whether they're about to end, or
   go on break. It's most fun to raid someone who is actually there to receive.
3. In your chat, type "/raid targetname" (eg "/raid devicat"), without the
   quotes. Alternatively, in your Twitch dashboard, go to the "Raid and Host"
   section, type in the channel name, and click Raid.
4. Do you have a raid call? Encourage your community to synchronize on some
   message that reflects your channel's theme or style. The clipboard is your
   friend here, as is a channel bot command like "!raid" to suggest some
   text to your viewers.
5. Say your goodbyes and thank-yous, your closer, etc.
6. Go to a closing screen for the last 10-15 seconds of the raid. Depending on
   how much Twitch lag people are on, they won't see or hear you for the last
   little bit.
7. Click "Raid Now" to bring everyone over! Since you had the target's stream
   open from step 2, you're there too (and you're past any preroll ads that
   might play).
8. IMPORTANT: Stop your streaming software from broadcasting. This is not an
   automatic part of the /raid command.
9. Unmute the stream you're visiting, and have all the fun!

It sounds complicated, but it feels a lot smoother when you're actually doing
it. I cannot recommend raiding highly enough, as it's a great way for people
to find new friends (your community meets the person you're raiding, and your
target's community meets you!), and sharing the love only strengthens it!

repository: Rosuav/TwitchTips

repo_name: Rosuav/TwitchTips


text:
_Ordinary People_ 是美国新灵魂乐歌手John Legend的歌曲。

John Legend，原名John Stephens，美国新灵魂乐歌手。1998年，John Legend已经开始在Lauryn
Hill的《Everything Is Everything》中进行钢琴演奏。2002年，John Legend已经广泛的开始与Kanye
West一起工作，也开始出现在一些大牌明星的专辑中。2004年12月28日，在Kanye West的打造下，John Legend的首张录音室专辑《Get
Lifted》正式发行。

歌词下方是 **Ordinary People钢琴谱** ，希望大家喜欢。


text:
## JSON Web Tokens
[Home](../README.md)

[Reference](https://jwt.io/introduction/)
[Debugger](https://jwt.io/#debugger-io)
[JWT in DjangoRESTFramework](https://simpleisbetterthancomplex.com/tutorial/2018/12/19/how-to-use-jwt-authentication-with-django-rest-framework.html)
[Video for JWT in DjangoRESTFramework](https://www.youtube.com/watch?v=Fhcn2qx-4VQ)

* JSON Web Token (JWT) is a compact, URL-safe means of representing claims to be transferred between two parties.
* The claims in a JWT are encoded as a JSON object that is used as the payload of a JSON Web Signature (JWS) structure or as the plaintext of a JSON Web Encryption (JWE) structure, enabling the claims to be digitally signed or integrity protected with a Message Authentication Code (MAC) and/or encrypted.

### Useful in :
1. __Authorization__:
2. __Information Exchange__: JSON Web Tokens are a good way of securely transmitting information between parties. Because JWTs can be signed—for example, using public/private key pairs—you can be sure the senders are who they say they are.

### Structure:

```
JWS tokens are made of header.payload.signature as xxxxx.yyyyy.zzzzz
```

1. __Header__   : Has two parts:
    * contains the type of the token, which is JWT,
    * and the signing algorithm being used, such as HMAC SHA256 or RSA.
    ```
    {
        "alg": "HS256",
        "typ": "JWT"
    }
    ```

2. __Payload__ : It contains the claims
    * _registered_: set of predifined [claims](https://tools.ietf.org/html/rfc7519#section-4.1)
    * _public_: defined at will. But to avoid collisions, they should be defined in the [registry](https://www.iana.org/assignments/jwt/jwt.xhtml)
    * _private_: custom claims created to share information between parties that agree on using them and are neither registered or public claims.
    ```
    {
      "sub": "1234567890",
      "name": "John Doe",
      "admin": true
    }
    ```

3. __Signature__ : To create the signature part you have to take the encoded header, the encoded payload, a secret, the algorithm specified in the header, and sign that.

```
HMACSHA256(
  base64UrlEncode(header) + "." +
  base64UrlEncode(payload),
  secret)
```

## How it works in Authentication?
![image](https://cdn2.auth0.com/docs/media/articles/api-auth/client-credentials-grant.png)

1. The application or client requests authorization to the authorization server. This is performed through one of the different authorization flows. For example, a typical OpenID Connect compliant web application will go through the /oauth/authorize endpoint using the authorization code flow.
2. When the authorization is granted, the authorization server returns an access token to the application.
3. The application uses the access token to access a protected resource (like an API).

repository: vijayetar/PythonReadingJournal

repo_name: vijayetar/PythonReadingJournal


text:
# minify
`require("./minify");`

This Module manages all /minified/* requests. It controls the
minification && compression of Javascript and CSS.

## Functions

- - -
### padJS (req, res)
Answers a http request for the pad javascript

* **req** the Express request
* **res** the Express response

repository: fjakobs/etherpad-lite

repo_name: fjakobs/etherpad-lite


text:
# IntersightClient::MacpoolLeaseRelationship

## Class instance methods

### `openapi_one_of`

Returns the list of classes defined in oneOf.

#### Example

```ruby
require 'intersight_client'

IntersightClient::MacpoolLeaseRelationship.openapi_one_of
# =>
# [
#   :'MacpoolLease',
#   :'MoMoRef',
#   :'Null'
# ]
```

### `openapi_discriminator_name`

Returns the discriminator's property name.

#### Example

```ruby
require 'intersight_client'

IntersightClient::MacpoolLeaseRelationship.openapi_discriminator_name
# => :'class_id'
```

### `openapi_discriminator_name`

Returns the discriminator's mapping.

#### Example

```ruby
require 'intersight_client'

IntersightClient::MacpoolLeaseRelationship.openapi_discriminator_mapping
# =>
# {
#   :'macpool.Lease' => :'MacpoolLease',
#   :'mo.MoRef' => :'MoMoRef'
# }

### build

Find the appropriate object from the `openapi_one_of` list and casts the data into it.

#### Example

```ruby
require 'intersight_client'

IntersightClient::MacpoolLeaseRelationship.build(data)
# => #<MacpoolLease:0x00007fdd4aab02a0>

IntersightClient::MacpoolLeaseRelationship.build(data_that_doesnt_match)
# => nil
```

#### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| **data** | **Mixed** | data to be matched against the list of oneOf items |

#### Return type

- `MacpoolLease`
- `MoMoRef`
- `Null`
- `nil` (if no type matches)

repository: xlab-si/intersight-sdk-ruby

gha_language: Ruby

repo_name: xlab-si/intersight-sdk-ruby


text:
---
layout: post
title: Transforming Coordinates
published: false
---

I love when someone asks me to provide them with some math help on a real-world problem. New London (CT) maker extraordinaire Mike Molinari recently sent me this message:

> Hey.
I have another math thing I am working on.
any chance you might be able to spare a few minutes and give me a hand?
It has to do with translation of 3d points.
...just need a bit of help to figure it out.

Mike explained the problem over the phone. What it boiled down to was that he:
1. was finding the coordinates of three points on a plane we'll call **T**
2. had the coordinates of points in some 3D object (e.g. a box) relative to the standard coordinate axes **i**, **j**, and **k**.
3. wanted to compute the coordinates of the points in the object relative to the coordinate axes and origin of the plane **T**.

For example, if given the points defining the cube to the lower left in the figure, and 3 points defining the plane that is graphed, the function should output the coordinates for the cube plotted in the upper right.
![coord transform img1](../images/coordTransImg1.png)

This is a nice problem for students involving concepts and techniques from linear algebra and multivariable calculus and that lends itself very readily to a computer programming implementation.  Since I was in the midst of teaching a computer programming course in Python to our sophomore Operations Research & Analytics majors, I used it as the basis of an assignment for that course.

There are a number of moving parts involved in solving this problem.  Ultimately and with input from my excellent colleauge Dana Dougherty, I decided to scaffold the assignment.  And since it is a numerical task, we used it as an opportunity to showcase an application of *NumPy*.  Next I will give an overview of the parts of the solution, describe what we scaffolded and why, and indicate where *NumPy* came in.

**Overview**

The basic idea is to covert a set of points from one coordinate system (the standard **i-j-k** one) to another coordinate system defined on the the new plane **T**.  So first, find the coordinate axes of **T**.  We are given three points in the plane **T**.  From those, we need to find two orthogonal vectors in **T** and a vector normal to **T**.  This is a straight-forward task that I assume is covered in most multivariable calculus classes (it is in ours, which the vast majority of students in this programming course have already taken).  So we leave the methodology of finding these vectors to the students, though we are ready with a couple of hints (compute a center point, how to find the second orthogonal vector in the plane) for the stuck student.  But what we do scaffold (i.e. supply to the student) are some relevant *Numpy* commands such as:
```python
np.linalg.norm(vectAB)
np.cross(vectAB,vectAC)
```
Note that in a prior class, we had the students go through one of our in-class [worksheets on *NumPy*](https://github.com/ifrommer/course-documents/blob/master/Worksheet%20-%20numpy%20and%20matplotlib.docx).  I hope to post about these worksheets at some point soon.  They are contain a number of statements of code.  Students have to write down what they think the code will do, what it does, and whether or not their hypothesis was correct.

...

Later I wrote back to Mike:
> I’m turning it into an assignment in my programming class for my students. As such I’ve refined the code a bit in case you want that. Also, was wondering why you needed this. Would help me motivate the lesson for the students. Thanks for the challenge.


text:
---
layout: index
title: useon
---

"useon" is an attribute that can be either a [scriptdictionary](../types/scriptdictionary.html) or [string](../types/string.html).

-   If not specified, objects cannot be used on this object.
-   If a [scriptdictionary](../types/scriptdictionary.html), the keys of the dictionary specify objects that can be used on this object. The script values specify scripts to run when that object is used.
-   If a [string](../types/string.html), that string is printed whenever an object is used on this object.

See also [give](give.html), [useanything](useanything.html).

repository: textadventures/quest

gha_language: C#

repo_name: textadventures/quest


text:
  Memory Search

  This repo is about university work, more specifically about the Data Persistency subject. Here, the goal was to use Java Language to search for specific positions of memory in a given file. So, the code should look and print out the amount and position of memory occupied by a certain typed entry.

	You can get this project on your local dev environment in 2 minutes with these four steps:

			**Clone this repository.**

			In your preferred shell type: git clone https://github.com/ipdmartins/DataPersistency_memorySearch.git

			**How to Contribute**

			Whether you're helping to fix bugs, improve the docs, or spread the word, I'd appreciate to have you as part of it.


text:
### feedforward neural network (FFN)

Go back to the [[AI Glossary]]

A neural network without cyclic or recursive connections. For example, traditional deep neural networks are feedforward neural networks. Contrast with recurrent neural networks, which are cyclic.

url: https://raw.githubusercontent.com/KGBicheno/KGB_Agora/70ea95c9d38ab2f31abbd510691bb4c050a6cb3b/Artificial Intelligence/Introduction to AI/Week 3 - Introduction/Definitions/Feedforward_Neural_Network_(Ffn).md


text:
TARTDetection
==========
This repository is a detection model written in Tensorflow.

## Applications
Below are some applications by using this repo:

- paper: [Expecting the Unexpected: Training Detectors for Unusual Pedestrians with Adversarial Imposters(CVPR2017)](https://arxiv.org/pdf/1703.06283)
- ViZDoom Objects Detection: (more details to be announced)
- Road Defects Detection: (more details to be announced)
- Solar Panels Defects Detection: (more details to be announced)

## Release Date
- To be released on 1st Jan, 2019.


text:
# boilerplate-react

Creating a react boiler plate using rollup

## Pre-requesite

node.js
npm

## Setup

```zsh
mkdir src
cd src/
npm init --yes
```

This creates a `package.json` file.

```zsh
npm install --save-dev rollup
```

We then add the build steps to `package.json`

```json
"scripts": {
    "build": "rollup --config",
},
```

Next we will create the rollup configuration file

```zsh
touch rollup.config.js
```
We then write the configuration for rollup

```js
// rollup.config.js
export default {
  input: 'src/index.js',
  output: {
    file: 'dist/bundle.js',
    format: 'cjs'
  }
};
```

We don't have an `index.js` file yet, so we need to create this file. For that we first need to install `react`.

```zsh
npm install --save react react-dom
```

Let's now create our `index.js` file.

```zsh
touch index.js
```

```js
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';

ReactDOM.render(<App />, document.getElementById('root'));
```

Now let's create our first component, `App.js`

```zsh
touch App.js
```

```js
import React from 'react';

function App() {
  return (
    <div>
      Hello world!
    </div>
  );
}

export default App;
```

At this point running build fails? Why?

TODO: Answer?

Let's try to install Babel to fix that.

```zsh
npm install --save-dev @babel/core @babel/cli @babel/preset-env @babel/preset-react
```

Then create the babel configuration file `.babelrc` (the format of .babelrc is json)

```zsh
cd .. # we want to add .babelrc at the root of the project and not in src/
touch .babelrc
```

We then add the following to `.babelrc`

```json
{
    "presets": [
      "@babel/preset-env",
      "@babel/preset-react"
    ]
}
```

Configuring rollup to use babel.

```zsh
npm install --save-dev rollup-plugin-babel @rollup/plugin-node-resolve
```

Then add this plugin in `rollup.config.js`

Add the following imports

```js
import resolve from '@rollup/plugin-node-resolve';
import babel from 'rollup-plugin-babel';
```

and then use them

```js
export default {
    ...,
    external: [
        "react",
        "react-dom"
    ]
    plugins: [
        resolve(),
        babel({
            exclude: 'node_modules/**'
        })
    ]
}
```

Let's try to run `npm run build` again:

```zsh
src/index.js → dist/bundle.js...
created dist/bundle.js in 281ms
```

Our build is now successful. We now want to run the react app to display our hello world locaaly. For that we need to create a server. And, of course, we will also make sure that hot reload is integrated. For that we need to install x plugins:

Rollup watch => rebuilds on changes

add to `package.json`

`npm-run-all`: gives the possibility to run npm-scripts in parallel
`serve`: serve a SPA

```zsh
npm install --save-dev npm-run-all serve
```

```json
"scripts": {
    "build.dev": "rollup --config --watch",
    "start": "serve dist",
    "start.dev": "run-p start build.dev"
}
```

Running `npm start.dev` does not work at the moment, as there is no html page. Next we are going to create that page in `src`

```zsh
cd src
touch index.html
```

Next we install a plugin that will copy the template to the dist folder and import the generated bundle.

```zsh
npm install --save-dev rollup-plugin-generate-html-template
```

We then need to update our rollup.config.js accordingly.

```js
import htmlTemplate from 'rollup-plugin-generate-html-template';

export default {
    ...,
    plugins: [
        ...,
        htmlTemplate({
            template: 'src/index.html',
            target: 'index.html',
        }),
    ]
}
```

repository: noejon/boilerplate-react

gha_language: JavaScript

repo_name: noejon/boilerplate-react


text:
PYPI Test mssql-scripter upload
========================================

### Requirements:
1. Create and Register a user account on testpypi at [test pypi](https://testpypi.python.org/pypi?%3Aaction=register_form)

2.  Add `<clone_root>` to your PYTHONPATH environment variable:
    ##### Windows
    ```
    set PYTHONPATH=<clone_root>;%PYTHONPATH%
    ```
    ##### OSX/Ubuntu (bash)
    ```
    export PYTHONPATH=<clone_root>:${PYTHONPATH}
    ```
3.	Install the dependencies:
    ```
    python <clone_root>/dev_setup.py clean
    ```

## Bump Version

	Versioning schema: {major}.{minor}.{patch}{release}{release_version}
    Example: 1.0.0a0
To bump a particular segment of the version, from `<clone_root>` execute:

bumpversion major              ->  2.0.0a0
bumpversion minor              ->  1.1.0a0
bumpversion patch              ->  1.0.1a0
bumpversion release            ->  1.0.0rc0
bumpversion release_version    ->  1.0.0a1

**Note**: bumpversion does not allow version bumping if your workspace has pending changes.This is to protect against any manual updates that may have been made which can lead to inconsistent versions across files. If you know what you are doing you can override this by appending `--allow-dirty` to the bumpversion command.

## Build
1. Clean distribution folders:

    ##### Windows
      ```
      rmdir /s dist
      ```

    ##### OSX/Ubuntu (bash)
      ```
      rm -rf dist
      ```
2. Build mssql-scripter platform wheels and verify readme.rst, From `<clone_root>` execute:
    ```
    python build.py
    ```

    Build a OS-Specific wheel:
	```
    python build.py build win32
    python build.py build win_amd64
    python build.py build macosx_10_11_intel
    python build.py build manylinux1_x86_64
	```

4. Add a .pypirc configuration file:

    - Create a .pypirc file in your user directory:
        #### Windows:
            Example: C:\Users\bob\.pypirc
		#### MacOS/Linux:
            Example: /Users/bob/.pypirc

    - Add the following content to the .pypirc file, replace `your_username` and `your_passsword` with your account information created from step 1:
        ```
		[distutils]
		index-servers=
		    pypitest

		[pypitest]
		repository = https://test.pypi.org/legacy/
		username = your_username
		password = your_password
        ```
4. Upload to pypi test server:
    ```
    python register_upload.py upload pypitest
    ```

5. Test install locally

	To install the local mssql-scripter wheel package, from `<clone_root>` execute:
    ```
    sudo pip install --no-index -i ./dist/mssql_scripter-1.0.0a1-py2.py3-none-win32.whl
    ```

6. Test install via pypi server:

	**Note**: Specifying the test pypi server as the index to search for, pip will attempt to search for mssql-scripter's dependencies from the same server. This can result in a requirement not found error, but should not be a problem if dev_setup.py was ran during developer setup. If the error does occur, manually pip install the dependencies that are listed in setup.py and ensure the versions are correct.

	Install the mssql-scripter package that was just uploaded:
    ```
	pip install -i https://testpypi.python.org/pypi mssql-scripter
	```

	Upgrade to the mssql-scripter that was uploaded:
	```
    pip install --upgrade -i https://testpypi.python.org/pypi mssql-scripter
    ```

repository: microsoft/mssql-scripter

branch_name: refs/heads/dev

gha_language: Python

gha_license_id: NOASSERTION

repo_name: microsoft/mssql-scripter


text:
# Debugging

Deptrac provides a series of debug commands that help you identify issues in
your config files. All commands output one issue per line and can therefore be
easily combined with other tools like `wc` or `grep`.

## `debug:layer`

With the `debug:layer`-command you can list all tokens which are matched in
a specific layer. This command only shows tokens that would be emitted by your analyser configuration.

```bash
php deptrac.phar debug:layer --config-file=examples/DirectoryLayer.depfile.yaml Layer1

examples\Layer1\AnotherClassLikeAController
examples\Layer1\SomeClass
examples\Layer1\SomeClass2
```

## `debug:token`

The `debug:token` (previously `debug:class-like`)-command will let you know which layers a specified token belongs to. Since you can specify the token type, this commands ignores your analyser configuration for emitted token types.

```bash
php deptrac.phar debug:token --config-file=examples/DirectoryLayer.depfile.yaml 'examples\Layer1\AnotherClassLikeAController' class-like

Controller
Layer1
```

## `debug:unassigned`

With the `debug:unassigned`-command you list all tokens in your path that are
not assigned to any layer. This is useful to test that your collector
configuration for layers is correct.  This command only shows tokens that would be emitted by your analyser configuration.

```bash
php deptrac.phar debug:unassigned --config-file=examples/DirectoryLayer.depfile.yaml

examples\Layer1\AnotherClassLikeAController
examples\Layer1\SomeClass
examples\Layer1\SomeClass2
```

## `debug:dependencies`

With the `debug:dependencies`-command you can see all dependencies of your layer. You can optionally specify a target layer to get only dependencies from one layer to the other:

```bash
php deptrac.phar debug:dependencies debug:dependencies Ast InputCollector

  Qossmic\Deptrac\Core\Ast\AstMapExtractor depends on Qossmic\Deptrac\Core\InputCollector\InputCollectorInterface (InputCollector)
  .../deptrac/src/Core/Ast/AstMapExtractor.php:15
  Qossmic\Deptrac\Core\Ast\AstMapExtractor depends on Qossmic\Deptrac\Core\InputCollector\InputException (InputCollector)
  .../deptrac/src/Core/Ast/AstMapExtractor.php:28
  Qossmic\Deptrac\Core\Ast\AstException depends on Qossmic\Deptrac\Core\InputCollector\InputException (InputCollector)
  .../deptrac/src/Core/Ast/AstException.php:13
```

## `debug:unused`

With the `debug:unused`-command you list all the rulesets that are not being used (i.e. there are no dependencies being allowed by this ruleset).

You can optionally specify a limit (`--limit=<int>`) of how many times can be the ruleset used to be considered unused. This is useful
if you want to find dependencies that are barely used and may be a prime candidate to get rid of.

```bash
php deptrac.phar debug:unused --limit=10

  Analyser layer is dependent Layer layer 5 times
  Ast layer is dependent File layer 9 times
  Ast layer is dependent InputCollector layer 3 times
  Console layer is dependent OutputFormatter layer 4 times
  Console layer is dependent DependencyInjection layer 2 times
  Console layer is dependent File layer 5 times
  InputCollector layer is dependent File layer 3 times
  OutputFormatter layer is dependent DependencyInjection layer 1 times
```

repository: dbrumann/deptrac

gha_language: PHP

repo_name: dbrumann/deptrac


text:
# Quiz Answers Chapter 1 #
## 1 ##
The nickname of the first mobile phone sold for personal use was "The Brick".

## 2 ##
The 1970s game called Snake came installed on the early mobile devices from Nokia.

## 3 ##
Android Inc was the name of the company that Google purchased that is credited for developing much of the technology used in the Android operating system.

## 4 ##
The first Android device was called G1. It was manufactured by HTC. It was sold by T-mobile in the United States.

path: /Chapter_01/Quiz Answers.md

filename: Quiz Answers.md


text:
# 3dsMouse
3dsmouse uses an udp server/client setup to make the 3ds act as a mouse. Currently this only works for linux because I would imagine it would be simple to port over to  Windows/Mac

# Why UDP
I choosen to use UDP over TCP just because of the smaller packet sizes that UDP as. I would assume this would make the 3ds feel more responsive than TCP would. The con to this is there is no way to limit the amount of clients connected to the 3ds. (At least to my knowledge). So using this program in a public area would provide to be quite dangerous at its current stage. I might switch to TCP at later point, this project was more of a Proof of Concept then anything else.

#What else is there to do
- Make a makefile for the server.
- Use the circlepad instead of the DPAD
- Maybe also use touchpad for navigation as well.
- Port to Windows/Mac

#Build Client
Use ftbrony or ftpony for quick development. There a small python script that will send over the files over over the host

```
make
```
And thats it, the files should be on your 3ds

#Build server
```
gcc -o server source/*.c -Iinclude -lX11 -lXst
```

license: Unlicense


text:
# Testing

The following tests are available:
- gtest
- pytest
- end-to-end
- Eigen

Tests can theoretically be added to any of gtest, pytest, or end-to-end.  Each has its own advantages:

- gtest: good for low-level unit tests. Runs quickly.
- pytest: easy to write unit-tests using bytecode, OpenCL, NVIDIA® CUDA™
- end-to-end: full end to end builds of NVIDIA® CUDA™ source-code files.  Probably the most convincing tests :-)

The Eigen tests are because Eigen is a framework used in Tensorflow, and being able to build/run Eigen is a key pre-requisite for that.

## `gtest` tests

```
cd build
make -j 8 gtest-tests
make run-gtest-tests
```

No dependencies on graphics card etc.  It simply takes some hand-crafted IR, and writes it to OpenCL.  It never actually tries to run the OpenCL, so it validates:
- can Coriander handle the IR without choking/crashing?
- do the hand-crafted OpenCL expected results match up with the actual cocl outputs?

gtest tests are at [test/gtest](test/gtest)

## pyopencl tests

### Pre-requisites

- built Coriander (from `build` folder, do `make -j 8`)
- installed python pre-requisites:
```
pip install -r test/requirements.txt
```

### Run

```
py.test -v
```

- python tests are at [test](test)

In theory, these should all pass, so please raise an issue for any that are failing, stating your operating system, and providing `clinfo` output

## End-to-end tests

### Build
```
make -j 8 endtoend-tests
```

### Run
```
make run-endtoend-tests
```

You can run a test by name, eg:
```
make run-offsetkernelargs
```
Result:
```
################################
# running:
################################
LD_LIBRARY_PATH=build: build/test-cocl-offsetkernelargs
Using Intel , OpenCL platform: Intel Gen OCL Driver
Using OpenCL device: Intel(R) HD Graphics 5500 BroadWell U-Processor GT2
126.456
```
- end-to-end tests are at [test/endtoend](test/endtoend)

## Eigen tests

### Pre-requisites

- have mercurial installed (so you can download Eigen)
- have downloaded a Coriander-adapted version of Eigen, eg:
```
hg clone https://github.com/hughperkins/eigen
cd eigen
hg update tf-coriander
```

### Build

- build Coriander tests as normal, but set `EIGEN_TESTS` to `ON` in the `ccmake ..` options
- make sure to specify `EIGEN_HOME`, which should be set to the downloaded Eigen folder, from 'pre-requisites', above
Then do:
```
make -j 8 eigen-tests
```

### Run

```
make run-eigen-tests
```

Eigen tests are at [test/eigen](test/eigen)

repository: dendisuhubdy/coriander

gha_language: LLVM

repo_name: dendisuhubdy/coriander


text:
## The game
Try the game [here](https://rafer45.github.io/voronoi/game/)!

## Description

Valorous Voronoi is a two-player arcade battle game prototype set on a dynamically rendered Voronoi diagram. It involves two players, Red and Blue. The goal of each player is to destroy the other player.

Red is visible and illuminates neighboring cells. Red can shoot grenades that also illuminate neighbors. They detonate after a short while, destroying neighboring cells and creating a base.

Any cell that isn't illuminated is dark. Dark cells are all the same color, so they blend together and cannot easily be told apart. Blue is a dark cell, so it is harder to spot, but it is also slower than Red.

Bases created by grenades can be captured by Red or Blue. A captured base can be used to destroy one's opponent.

There are three rules for player destruction

1. If Blue touches Red, Red is destroyed.
2. If a player is caught in a grenade explosion, that player dies.
3. If a player touches an opponent's base, that player dies.

## Technology
Valorous Voronoi uses the following technologies:
* [three.js](https://threejs.org/) for rendering.
* [Delaunator](https://github.com/mapbox/delaunator) for Delaunay triangulation.

## Geometry

A Voronoi diagram is a diagram made by taking a set of core points and assigning one region of space to each core point. Each core point is associated with all points closest to it by some metric (usually euclidean distance).

Voronoi diagrams have applications in art, robotics, epidemiology, among other fields. There are different algorithms to build Voronoi diagrams. One surprisingly simple method uses cones and an orthographic camera. The recipe for a Voronoi diagram with *n* cells goes like this:

1. Create *n* cones with the same height and the same width. They should be very wide.
2. Put all the cone tips at the same distance from the camera.
3. Point all the cone tips so they are looking at the camera.
4. Done! The tip of each cone corresponds to a Voronoi core.

The dual of a Voronoi diagram is called a Delaunay Triangulation. It has independently interesting properties (for instance, it maximizes the minimum angle), but for our purposes, we only care about its role as the dual. It is the graph made by connecting the Voronoi cores of cells that are adjacent to each other.

There are fast algorithms to generate Delaunay triangulations independently from generating the Voronoi diagram. One can use such an algorithm to compute the dual of the Voronoi, allowing for quick collision checks between cells.

## Challenges

Surprisingly, the biggest challenges involved architecture and keyboard/mouse IO, not geometry. While architecture is always a challenge in game development, I had taken for granted how easy keyboard/mouse IO is made by game engines. Communicating mouse and keyboard events correctly, without painting myself into a corner but without overthinking the architecture too much, took me a few weeks (combined with other homework).

## Easy bits

Drawing the Voronoi diagram was very easy, and the Delaunay triangulation library I used worked perfectly on the first try. Once keyboard inputs were correctly getting piped to the entities, adding new actions was easy.

## The Future

Voronoi diagrams are an underexplored tool in game design. For instance, a stealth game using dynamic Voronoi diagrams for the world and the characters would be interesting. The diagrams fully fill the world, so they give the opportunity to explore what gameplay could be like in a world without gaps between things.

## References
1. [three.js](https://threejs.org/)
2. Wikipedia contributors, "Voronoi diagram," *Wikipedia, The Free Encyclopedia*. [Link](https://en.wikipedia.org/wiki/Voronoi_diagram)
3. Wikipedia contributors. Delaunay triangulation. In *Wikipedia, The Free Encyclopedia*. [Link](https://en.wikipedia.org/wiki/Delaunay_triangulation)
4. Soffritti, P. How to organize your Three.js code in a cleaner way. [Link](https://medium.com/@soffritti.pierfrancesco/how-to-organize-the-structure-of-a-three-js-project-77649f58fa3f).


text:
---
layout: post
title: Tips for a Productive WFH
subtitle: ''
date: 2020-03-24 18:30:00 +0000
author: Akshay Khale
header-img: "/uploads/wfh.jpeg"

---
Due to the Corona Virus outbreak, almost every company in India is pushing for Work From Home (WFH). But WFH is not equally productive for everyone, most of the time, engineers are super-productive but there are many other people who are struggling with the WFH. So, in this article, I will be sharing some productivity tips from my _free-lancing_ days which might be helpful for you to knock off all the things from your To-Do List.

Let’s get started:

# 1. Set a Schedule:

It is very important to set a schedule, I am a nocturnal person, I am productive in the night. I prefer working in the night but I have to adjust my time according to my team so that I can attend the Conference call for the daily updates and discussions.

I have set a thorough schedule that helps me to work during my productive hours and I will be able to attend the Team meetings without being drowsy. I have set reminders and alarms which keep me on track and helps me to avoid distractions.

# 2. Comfort is paramount:

Everyone on Instagram is sharing the Pictures of their Home desk and almost all of those pictures looked like an office cubicle. I prefer the office desk but when I am working from home, I like it to be comfortable. No Fancy ergonomic chair, No desk, instead I sit on a pillow on the ground keeping my back straight taking support from the Sofa with a light snack for munching and a water bottle. Yes, that’s my home desk.

# 3. Fill in the silence:

Most of the time, I am alone in my room when I am working. I prefer some soothing music, Ebook, Podcast or Binaural Beats playing on my Google Home to fill in for the silence.

# 4. Don't neglect the health:

Health is important, especially in this endemic situation, I should be eating healthy food with all the nutrition and the food which improves my immune system. I hate to cook when I am alone at home. In such a situation, I optimize my food to minimum efforts and maximum results.

I keep a water bottle handy to keep myself hydrated and I also set a walking reminder on my fitness band which keeps reminding me to take a small walk after every 20 Minutes.

# 5. Reward yourself:

Don’t forget to reward yourself after a highly productive day, It could be one episode (and just one episode) of your favorite T.V. Series or giving yourself a small treat.

# 6. Don’t be lazy:

Since you don’t have to wake up for the office, you might be waking up late and start your day a little late, but I would recommend you, not to do that, instead replace the commute time with another activity like a workout session at home, reading session or spend that extra hour listening to a podcast or watching a video lecture from an online course. Waking up early is a good habit don’t lose that because of this temporary situation.

> Habits are like a chain reaction, you introduce one and it will lead to another. The choice is whether you start with a good one or a bad one.

***

Conclusion:

Staying all day at home almost quarantined at home, Working from home trying to avoid distractions can be daunting but it’s a temporary situation. It’s not easy but with a little discipline, you can turn it into a happy, productive day.

_Thank you for reading._

_Live long a prosper!!!_


text:
+++
date = "2017-04-30T01:36:43-04:00"
title = "Headless JavaFX"
draft = true

[params]
  scripts = [
  "https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js",
    "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js",
    "https://cdnjs.cloudflare.com/ajax/libs/raphael/2.2.7/raphael.min.js",
    "https://cdnjs.cloudflare.com/ajax/libs/js-sequence-diagrams/1.0.6/sequence-diagram-min.js"
  ]

+++

# Headless JavaFX

In this post, I will discuss my approach to running Dex headless, or without a GUI.
"Huh? What? Wait a minute! Why run without a GUI?" you might wonder.  After all,
isn't JavaFX all about the GUI?  When would you ever want to run a UI driven
application without its user interface?

As it turns out, there are many common situations where one might want to run without
a display which I will cover in this post; then address them specifically with respect
to my OSS JavaFX application: Dex.  I will discuss my approach to the problem
in enough detail so that others can use it as a roadmap for their own purposes.

## Motivations

So why no GUI?

### Automation

Automation is the primary driver.  There are a number of useful scenarios for this
type of automation which I will discuss.  Some are specifically applicable to Dex,
some are not.

#### Command Line Deployment

Automated environments tend to have no GUI capabilities.

Many times, I use Dex to create workflows which perform some general purpose ETL
(Extract Transformation Load).  This ETL process may need to be executed at some
cadence (monthly, weekly, daily or even hourly).  Even though this is a simple
task, it is still cumbersome if a human being is required to open the Dex GUI,
load the project and execute it.

For example purposes, let's say the flow looks like:

Title: Human Driven Workflow
User -> Dex : Start Dex
User -> Dex : Load Project
User -> Dex : Execute Project
Dex -> Load_Data : Execute Tasks
Load_Data -> Trim_Whitespace: Data
Trim_Whitespace->Populate_Database: Trimmed Data

While developing this workflow goes much smoother with a GUI, why do I need the
GUI if I simply want to execute the flow?  Since the flow requires no human
intervention, I don't.  Furthermore, it is unlikely
that I will perform the task at exactly the same time everyday. It is unlikely
that if I were to perform this repetitive task, say hundreds of times,
that I would not eventually make a mistake.

Title: Automated
Scheduler->DexCLI: Execute Project
DexCLI -> Load_Data : Execute Tasks
Load_Data -> Trim_Whitespace: Data
Trim_Whitespace->Populate_Database: Trimmed Data

Once I set the project execution using a scheduling tool such as cron or quartz, things are
fully automated and I am free to spend my time elsewhere (like on the beach).

#### Testing and CI/CD

In today's world of Agile methodologies and CI/CD (Continuous Integration/Continuous Deployment),
we need to trim out the need for human intervention in our testing pipeline wherever and
whenever possible.  This includes GUI applications as well.

For JavaFX, there is an automated testing framework called [TestFX](https://github.com/TestFX/TestFX)
which allows the user to program user interface interactions using a Java.  If automated testing is
your primary reason for a headless mode for your JavaFX application, I recommend that you check it out.

### Embedded Devices

While not applicable to Dex, another common usecase for the headless environment is embedded
devices.

### Decoupled Architecture

Another reason one might wish to support a headless mode for applications would be to
decouple the frontend from the service layer.  With respect to Dex, this is causing me to
consider new tasks which might be suitable for deployment as servlets, RESTful APIs or
simply deployed to Docker.

 JavaFX is the successor to Swing.  Originally developed by Chris
Oliver while working at SeeBeyond.  JavaFX, originally named F3 (Form Follows Function),
was intended to be a GUI scripting language which allowed deeper integration of people
into business processes.

Over time, this effort evolved into the JavaFX we know and love today.  Below is a diagram
of the JavaFX architecture:

![JavaFX Architecture](/blog/2017/headless_javafx/javafx_architecture.png)

### Scene Graph

### Graphics System

  * **Prism** - Processes render jobs.  It's Java's abstraction on top of things like DirectX,
  OpenGL, Java2D, etc...  This native accelleration is one of the reasons that JavaFX gives a
  much better user experience than Swing applications.
  * **Quantum Toolkit** - Ties Prism and Glass Windowing toolkit together and manages threading
  rules related to rendering and event handling.

### Windowing Tookit

#### Glass Windowing Toolkit

  * **Glass** - Glass is the lowest level in the JavaFX graphic stack.  Glass leverages the native
  platform for windowing and provides it's own resources when the native platform falls short. While
  AWT manages it's own event queue, Glass leverages the native event queue to schedule event usage.

  * **Web Engine** - The Web Engine is a full webkit based browser exposed as a JavaFX UI control
  which allows JavaFX to provide full web browsing capability.

## My Approach

### Monocle

First and foremost, we need to download Monocle.

Intially, I considered creating a new mode of operation for the existing Dex application, but
quickly discarded the idea because there was so much unnecessary setup of buttons, labels and
menus that the CLI application would never need.

```bash
-Dglass.platform=Monocle
-Dmonocle.platform=Headless
-Dprism.order=sw
-Dprism.text=t2k
-Dheadless.geometry="1600x1200-32"
```

```java
package com.dexvis.dex;

import java.io.File;
import java.util.List;
import java.util.concurrent.CompletionService;
import java.util.concurrent.ExecutorCompletionService;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

import javafx.application.Application;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.scene.Scene;
import javafx.stage.Stage;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.Options;
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
import org.tbee.javafx.scene.layout.MigPane;

import com.dexvis.dex.exception.DexException;
import com.dexvis.dex.wf.DexJob;
import com.dexvis.dex.wf.DexJobScheduler;
import com.dexvis.dex.wf.DexTaskState;
import com.dexvis.dex.wf.SerialJob;
import com.dexvis.javafx.scene.control.DexTaskItem;
import com.dexvis.util.ThreadUtil;

public class DexCLI extends Application
{
  // Thread factory for executing task serially.
  private final static BasicThreadFactory serialThreadFactory = new BasicThreadFactory.Builder()
      .namingPattern("Dex-Serial-Task-%d").daemon(true)
      .priority(Thread.MAX_PRIORITY).build();

  // Executor for executing task serially.
  public final static ExecutorService serialExecutor = Executors
      .newSingleThreadExecutor(serialThreadFactory);

  // Thread factory for concurrent task execution. Such task may not update the
  // UI.
  private final static BasicThreadFactory concurrentThreadFactory = new BasicThreadFactory.Builder()
      .namingPattern("Dex-Concurrent-Task-%d").daemon(true)
      .priority(Thread.MAX_PRIORITY).build();

  // Executor for parallel task execution.
  public final static ExecutorService concurrentExecutor = Executors
      .newFixedThreadPool(
          Math.max(1, Runtime.getRuntime().availableProcessors() - 1),
          concurrentThreadFactory);

  // Service for task completion notification.
  public final static CompletionService<Object> CCS = new ExecutorCompletionService(
      concurrentExecutor);

  // Main stage
  private Stage stage = null;
  // Main scene.
  private Scene scene;
  private static String[] arguments;

  private void init(Stage stage)
  {
    try
    {
      this.stage = stage;
      stage.setTitle("Data Explorer");
      MigPane rootLayout = new MigPane("", "[grow]", "[][grow]");
      scene = new Scene(rootLayout, 1600, 900);
      stage.setScene(scene);
    }
    catch(Exception ex)
    {
      ex.printStackTrace();
    }
  }

  public void start(Stage stage) throws Exception
  {
    init(stage);
    stage.show();
    Options options = new Options();
    options.addOption("p", "project", true, "The project to be run.");
    CommandLineParser parser = new DefaultParser();
    CommandLine cmd = parser.parse(options, arguments);
    System.out.println("Running: " + cmd.getOptionValue("project"));
    DexProject project = DexProject.readProject(stage,
        new File(cmd.getOptionValue("project")));
    List<DexTaskItem> tasks = project.getTaskItems();

    int taskNum = 1;
    DexTaskState state = new DexTaskState();
    long projectStartTime = System.currentTimeMillis();
    long taskStartTime;
    for (DexTaskItem task : tasks)
    {
      taskStartTime = System.currentTimeMillis();
      System.out.println("  TASK[" + taskNum + "]: '"
          + task.getName().getValue() + "'");
      //long startTime = System.currentTimeMillis();
      if (task.getActive().getValue())
      {
        state = task.getTask().getValue().execute(state);
      }
      System.out.println("    " + (System.currentTimeMillis() - taskStartTime) + " ms");
      taskNum++;
    }
    serialExecutor.shutdown();
    concurrentExecutor.shutdown();
    if (!serialExecutor.awaitTermination(3600, TimeUnit.SECONDS))
    {
      serialExecutor.shutdownNow();
    }
    if (!concurrentExecutor.awaitTermination(3600, TimeUnit.SECONDS))
    {
      concurrentExecutor.shutdownNow();
    }
    System.out.println("Excecution Completed In: " + (System.currentTimeMillis() - projectStartTime) + " ms");

    Platform.exit();
  }

  public void exit(ActionEvent evt)
  {
    System.exit(0);
  }

  public static void main(String[] args)
  {
    arguments = args;
    Platform.setImplicitExit(false);
    launch(args);
  }
}
```

repository: PatMartin/dex-site

repo_name: PatMartin/dex-site


text:
# DestroyedAt #

[![Build Status](https://secure.travis-ci.org/dockyard/destroyed_at.png?branch=master)](http://travis-ci.org/dockyard/destroyed_at)
[![Dependency Status](https://gemnasium.com/dockyard/destroyed_at.png?travis)](https://gemnasium.com/dockyard/destroyed_at)
[![Code Climate](https://codeclimate.com/github/dockyard/destroyed_at.png)](https://codeclimate.com/github/dockyard/destroyed_at)

## Looking for help? ##

If it is a bug [please open an issue on GitHub](https://github.com/dockyard/destroyed_at/issues).

## Installation ##

Add the `destroyed_at` gem to your `Gemfile`

```ruby
gem 'destroyed_at'
```

You can either mixin the modules on a case-by-case basis:

```ruby
class User < ActiveRecord::Base
  include DestroyedAt
end
```

or make the changes globally:

```ruby
class ActiveRecord::Base
  include DestroyedAt
end
```

**Please note you will need to make a migration**

Each model's table that is expected to have this behavior **must** have
a `destroyed_at` column of type `DateTime`.

## Usage ##
Allows you to "destroy" an object without deleting the record or
associated records.

### Destroying ###
Overides `#destroy` to set `#destroyed_at` to the current time on an object. The
default scope of the class is then set to return objects that have not
been destroyed (i.e., have `nil` for their destroyed_at value).

`#destroyed?` will be `true` when your model is destroyed; it will be
`false` when your model has been restored.

```ruby
class User < ActiveRecord::Base
  include DestroyedAt
end

user = User.create
user.destroy
# => true
user.destroyed_at
# => <DateTime>
```

### Restoring ####
When you'd like to "restore" a record, call the `#restore` method on
the instance. This will set its `#destroyed_at` value to `nil`, thereby
including it in the default scope of the class again.

To include this functionality on `has_many through` relationships,
be sure to `include DestroyedAt` on the through model, as well as the
parent model.

```ruby
class User < ActiveRecord::Base
  include DestroyedAt
end

user = User.create
user.destroy
user.restore
# => true
user.destroyed_at
# => nil
```

### Callbacks ###
`before_restore`, `after_restore` and `around_restore` callbacks are added to your
model. They work similarly to the `before_destroy`, `after_destroy` and `around_restore`
callbacks.

```ruby
class User < ActiveRecord::Base
  before_restore :before_restore_action
  after_restore  :after_restore_action
  around_restore :around_restore_action

  private

  def before_restore_action
    ...
  end

  def after_restore_action
    ...
  end

  def around_restore_action
    # before around
    yield # restoring...
    # after around
end
```

### Validations ###

If you are using the `uniqueness` validator you will need to run it as:

```ruby
validates :email, uniqueness: { conditions: -> { where(destroyed_at: nil) } }
```

Rails will by default not include default_scopes when querying for uniqueness. Rather than monkey
patching the validator we believe this is the best solution.

## Authors ##

* [Michael Dupuis](http://twitter.com/michaeldupuisjr)
* [Brian Cardarella](http://twitter.com/bcardarella)

[We are very thankful for the many contributors](https://github.com/dockyard/destroyed_at/graphs/contributors)

## Versioning ##

This gem follows [Semantic Versioning](http://semver.org)

## Want to help? ##

Please do! We are always looking to improve this gem. Please see our
[Contribution Guidelines](https://github.com/dockyard/destroyed_at/blob/master/CONTRIBUTING.md)
on how to properly submit issues and pull requests.

## Legal ##

[DockYard](http://dockyard.com), LLC © 2013

[@dockyard](http://twitter.com/dockyard)

[Licensed under the MIT license](http://www.opensource.org/licenses/mit-license.php)


text:
# IRC-Chat
--------------
An IRC Chat Bot for Live OBS Chat Replay

# What is This
---------------
A simple way to get yourself streaming along with your IRC chat. If you've ever wanted to overlay your IRC with your stream for whatever reason, afaik this is now the easiest way to do it.

# Installation
If you're on Linux (more likely) just clone it, download the tar, or use the binary.
If you're on Windows, same deal, clone it, download the zip, or use the binary (easiest if you don't understand or don't want much Python / CMD stuff).

# How To Use
--------------
Edit the config.json to your liking. SSL is tested, non-SSL is somewhat tested let me know if there's any issues. Currently no IRC password support but if desired contact me and I can probably add it within like an hour.

# Who am I?
-------------
Someone who likes to stream and use IRC.

repository: queercat/IRC-Chat

repo_name: queercat/IRC-Chat