text:
# Work day Scheduler
This project is a schedule for a work day. The current day is shown and the user can enter events between the times of 9AM to 5PM. The schedule shows events in the past, present and future in different colors. The user can save the events and they will be shown the next time the user loads the page. This project was implemented using Javascript local storage, moment JS and jQuery.

## Site Picture
![Site](./assets/images/work_day_scheduler.gif)

## Getting Started

To view and edit the files you can clone the repo from github using the following command:

```
git clone git@github.com:ts795/work-day-scheduler.git
```

### Prerequisites
No additional software besides a text editor and a web browser are needed to view and edit the files.

### Installing
No installation of software is required.

## Built With

* [HTML](https://developer.mozilla.org/en-US/docs/Web/HTML)
* [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS)
* [Javascript](https://developer.mozilla.org/en-US/docs/Web/Javascript)
* [jQuery](https://code.jquery.com/)
* [momentJS](https://momentjs.com/docs/)

## Deployed Link

* [See Live Site](https://ts795.github.io/work-day-scheduler/)

## Authors

* Sam Lingampalli

- [Link to Portfolio Site](https://ts795.github.io/)
- [Link to Github](https://github.com/ts795)
- [Link to LinkedIn](https://www.linkedin.com/in/sam-l-3b3838132/)

## License

This project is licensed under the MIT License

## Acknowledgments

* UC Berkeley Extension


text:
n: Number files in scope s
u: Number users in scope s
x: Number of shares per file

# Each scope:
- implicit 1 Scope-Key [SK]
	- (Sym) (e.g. valid forever, used for 1 year)
- u * UK.encrypt(SK)			(stored in DB-Table `scope-keys`)

# Each file:
- implicit 1 FileKey [FK]
	- (Sym) (valid forever)
- 1 * SK.sym_enc(FK)			(stored in DB-Table `files`)
- x * XK.sym_enc(FK)			(stored in DB-Table `file-shares`)
	- XK transmitted via shared link (url?token#key)

# Each user:
- implicit 1 * User-Key-Encryption [UK]
	- (Asym + Certificate)
- Password Encrypted UK 		(stored in DB-Table `users`)

# User-Key Change:
- Update encrypted scope keys with the user's new key.

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
`Browserify` require that you build test first, for automation you can use `watchify` module.

To build tests:
```
npm i
npm run build
```
Now you can open this index.html in browser. Don't forget to look on package.json to see how browserify called.
As an additional step you will need to combine you tests in some way (e.g. require each from one file, or concat them).

license: MIT

repository: yardfarmer/bone

gha_language: JavaScript

gha_license_id: MIT

repo_name: yardfarmer/bone


text:
# Beancount Daily Report

Build daily report for the beancount file

## Build

`docker build -t beancount-daily-report .`

## Run

`docker run -d -e REPORT_TYPES="cash trial networth" -e BEANCOUNT_FILE="journal_file_name.beancount" -v folder/path/to/journal:/beancount -v folder/path/to/report/output:/reports beancount-daily-report`

repository: chryoung/beancount-daily-report

repo_name: chryoung/beancount-daily-report


text:
# Battery Status Checker
The battery status checker requires `python3.` Assuming you have this, it also requires
```
sudo apt install python3-serial
```
To run the script, call
```
python3 BMSStatusChecker.py
```
Note: the user must also have access to the USB device. One option is to instead run
```
sudo python3 BMSStatusChecker.py
```
Alternatively (which has alreayd been done on the operator station `dair01`), you can add the user to the group dialout.
```
sudo adduser $USER dialout
```

repository: hanliumaozhi/dairlib

gha_license_id: NOASSERTION

repo_name: hanliumaozhi/dairlib


text:
---
layout: page
permalink: "/membership/join/"
title: Joining the Readium Foundation
---
<style>
table, td, th {
        border: 1px solid black; padding:10px;
        }
</style>

Thank you for your interest in joining the Readium Foundation!

The Readium Foundation is a non-profit membership association, open to all. Your dues support the mission of the Foundation, i.e. fostering the development of an open and modern collaborative playground for digital reading technologies.

Members are entitled to participate in the governance of the Foundation, including electing the Board of Directors and proposing matters put to votes of the membership.

Member dues reflect the revenue of member companies, or the annual budget of non-profit organization.

First year dues are payable at time of application. Subsequent annual dues will be billed on a rolling annual basis on the month that you joined the organization. Payment can be made online by credit card, Paypal or bank transfer.

From January 2021, the dues structure is as follows:

|  Company Type  | Total Company Revenue | Member Dues |
|:-------------:|:-------------:|:------------:|
| A | Under $300,000 and max 2 individuals | $400 per year |
| B | Between $300,000 and $1 million and less than 20 employees | $800 per year |
| C | Between $1 and $5 million and less than 50 employees | $1200 per year |
| D | Between $5 million and $250 million | $2000 per year |
| E | Between $250 million and $2 billion | $3000 per year |
| F | Over $2 billion | $4000 per year |

**Important: New members benefit from a 25% discount during the two first years of membership if they pay their membership fee immediately.**

<br/>

If you wish to join the Readium Foundation or if you have questions, please navigate to the [membership application page](/membership/application).

gha_language: HTML


text:
# Regression
Regression work

# Exercises:

1) Create a directory named regression-exercises within your codeup-data-science directory.

2) Initialize this directory as a git repository.

3) Create a README.md file that outlines the contents.

4) Create a repository on github with the same name (regression-exercises) and link your local repo to the remote.

5) Add, commit, and push the readme file.

6) The filename for this exercise is wrangle.py.

7) As always, add, commit, and push your work.

# Problem 1

Throughout the exercises for Regression in Python lessons, you will use the following example scenario: As a customer analyst, I want to know who has spent the most money with us over their lifetime. I have monthly charges and tenure, so I think I will be able to use those two attributes as features to estimate total_charges. I need to do this within an average of $5.00 per customer

The first step will be to acquire and prep the data. Do your work for this exercise in a file named wrangle.py.

1) Acquire customer_id, monthly_charges, tenure, and total_charges from telco_churn database for all customers with a 2 year contract.

2) Walk through the steps above using your new dataframe. You may handle the missing values however you feel is appropriate.

3) End with a python file wrangle.py that contains the function, wrangle_telco(), that will acquire the data and return a dataframe cleaned with no missing values.

branch_name: refs/heads/main


text:
combojure
=========

[S K I combinators](http://en.wikipedia.org/wiki/SKI_combinator_calculus) and [Y combinator](http://en.wikipedia.org/wiki/Fixed_point_combinator) in [Clojure](http://clojure.org/)

This is only experimental.

The ycombo.clj namespace is inspired by James Coglan's [Deriving the Y Combinator](http://blog.jcoglan.com/2008/01/10/deriving-the-y-combinator/).

The ski.clj namespace is inspired by D. A. Turner's [A New Implementation Technique for Applicative Languages](http://courses.engr.illinois.edu/cs421/sp2012/project/turner-implementation.pdf) and uses @sunilnandihalli's [curry macro](https://gist.github.com/sunilnandihalli/745654).

repository: scottbale/combojure

repo_name: scottbale/combojure


text:
---
title: "Cation States of Ethane: HEAT Calculations and Vibronic Simulations of the Photoelectron Spectrum of Ethane"
date: 2016-09-01
publishDate: 2021-05-01T00:06:02.275144Z
authors: ["Kin Long Kelvin Lee", "Scott M. Rabidoux", "John F. Stanton"]
publication_types: ["2"]
abstract: "High-accuracy ab initio calculations have been carried out on ethane and its radical cation. With the HEAT-345(Q) scheme, adiabatic ionization potentials of 11.52 and 11.57 eV are determined for the X̃ 2Eg and Ã 2A1g states, respectively, with an uncertainty of ±0.015 eV. Also considered in this report are linear and quadratic vibronic coupling involving both states. With this simple vibronic model, the photoelectron spectrum of ethane was simulated in the 11–15 eV region using linear and full quadratic Jahn–Teller coupling Hamiltonians, and with up to 70 billion direct product basis functions in a high-performance computing environment. Although the linear vibronic coupling model adequately reproduces the spectral envelope, the quadratic vibronic treatment results in much better agreement with the observed spectrum."
featured: false
publication: "*The Journal of Physical Chemistry A*"
url_pdf: "http://dx.doi.org/10.1021/acs.jpca.6b07516"
doi: "10.1021/acs.jpca.6b07516"
---

repository: MartinDrumel/personal-website

repo_name: MartinDrumel/personal-website


text:
---
layout: post
title: Solarize Vim and Ubuntu terminal
comments: true
---

After trying both dark and light  themes for serval month, I decided to use Solarized Light colorscheme for all editors and IDEs. I think the background color should match the surrounding to reduce eye tiredness. At work or at home, I always work/game in a bright area. Therefore, a lighter theme like Solarized Light is a natural choice for me.

<!--more-->
### Solarize Ubuntu terminal

{% highlight bash %}
sudo apt-get install dconf-cli
git clone https://github.com/Anthony25/gnome-terminal-colors-solarized.git
cd gnome-terminal-colors-solarized
./install.sh
{% endhighlight %}

### Solarize Vim
Add the following to your ~/.vimrc file. Assuming you are using **vim-plug** as a plugin manager
{% highlight bash %}
Plug 'altercation/vim-colors-solarized' # Use Plugin 'altercation/vim-colors-solarized' for Vundle
{% endhighlight %}
Inside Vim, run
{% highlight bash %}
:PlugInstall # Use :PluginInstall for Vundle
{% endhighlight %}
After the plugin is installed, add this to your ~/.vimrc
{% highlight bash %}
syntax on
let g:solarized_termcolors=16
set t_Co=256
set background=light
colorscheme solarized
{% endhighlight %}
If your terminal color looks ugly, you might want to tweak the value of solarized_termcolors and t_Co.

gha_language: CSS


text:
# Changelog 1.2

### Algorithm
* Add option to ignore AIDS predictions in regions with low HIV prevalence
* Change the causes aggregation on the adult cause list. Specifically:
    * Other Cancers is no longer aggregated into Other NCDs
    * Congestive Heart Failure is no longer aggregated into Other CVD
    * Congestive Heart Failure and Acute Myocaridal Infarction are aggregated
      into Ischemic Heart Disease
    * Asthma and COPD are aggregated into Chroic Respiratory Disease
    * Epilepsy is aggregated into Other Non-communicable Diseases
* Add logic rules to predict cases where the endorsement of key symptoms
  definitively leads to a certain prediction.
* Add logic rule requiring the endorsement of key symptoms for causes. Without
  these endorsements tariff ignores the cause regardless of the score or rank.
* Add logic rules for diagnostic rule-outs. Some key symptoms are enough to say
  a certain cause cannot be underlying cause of death. Tariff ignores these
  causes regardless of the score or rank.
* The minimum tariff score required for a cause to be considered a valid
  prediction is now cause specific.
* Remove tariffs for symptoms which have no clinical significance. These are
  artifacts of small number of gold standards for certain causes. Most of these
  are words said in the open response which do not generalize to other
  populations.

### Data Validation
* Verifies interviewee consented to survey and removes non-consenting
  observations.
* Increased verification of age values. Observations without valid ages are now
  removed from the data before estimation.

### User Experience
* Add warnings for errors in input data.
* Add progress bar and estimated time remain for each step.
* Add option to turn off generation of figures.
* Move common options for Health Care Experience (HCE) and Freetext questions
  from main console to options drop down menu.
* Add command line interface which enhances usability for automated systems.

### Technical Improvements
* Robust to errors in input data. The app no longer stalls when the input data
  is missing columns.
* Increased computational performance with threads.
* Separate model logic from GUI logic to increase code maintainability.
* Separate functional logic from data values to promote testability and ease
  customizability.
* Add test suite.

repository: ihmeuw/SmartVA-Analyze

gha_language: Python

repo_name: ihmeuw/SmartVA-Analyze


text:
# RgTrello

Basic frontend integration with the Trello API. It features the following:
* OAuth authentication against Trello to get token that enables user impersonation.
* Basic display of user's boards.
* Basic display of cards belonging to a board.
* Basic display of card name and description. A form is provided to post a comment to the card currently being displayed.

## Installation

This solution is an ASP.NET MVC 5 project, along with some helper libraries. To run it, you'll need IIS 10 and above:
1. Unzip solution package.
2. Go to create a new website under the `Sites` categories.
3. Under `Physical path`, choose the path where the package was unzipped.
4. Make sure the AppPool created runs under .NET CLR v4 and the pipeline mode is `Integrated`.
5. Click on save.
6. Fire up a browser and go to the configured host name.

## Basic usage

Before performing any action, the app needs to be authenticated against Trello. Once this is done, the `Boards` menu will be enabled.

## Future work

A couple of concessions have been made to deliver this completely functional solution:

* The use of a persistence layer could not be justified. Right now, the user needs to perform an authentication against Trello every time the application is started. The obtained token is then stored in a singleton TokenManager class, which proved to be enough for the identified scope of the exercise. Future work could include persisting the user and related token in the database, avoiding using a singleton, which is considered an antipattern for large scale systems. This would allow:
  * Having a record of all the users of the application, by making use of Trello as a third-party login provider. Each profile can be registered via cookies dropped in the client and on each new run, the user id from the cookie could be matched against the user's profile in the database to retrieve the proper token.
  * Making proper use of token expiration and renewal by updating the recorded sets.

* Secrets and keys are stored in the source code. This is a security issue that would need to be solved by storing them in encrypted configuration files. For large scale solutions, secrets are stored outside source control, under the deployment pipeline tool infrastructure.

* Most of the controller actions follow the same pattern of performing logic and handling any exceptions. This could definitely be improved by refactoring common logic out to shared generic methods. In this case in particular, and given the fact that the solution scope is limited to this exercise, undergoing this work is probably not worth it.

repository: svillamonte/rg-trello

repo_name: svillamonte/rg-trello


text:
# consulpp

> This repo is forked from [base repo](https://github.com/chinuno-usami/Consulpp) to suit for our own project.
> I will commit PR to the base repo.

Header-only C++ consul client, based on Consul HTTP API.
Just have single head file.

Implemented

- Register service
- Deregister service
- Set checks for service
- Add/Modify KV store
- Detele KV store
- Get KV store
- Health check

## Requirements

[C++ REST SDK](https://github.com/Microsoft/cpprestsdk)

## Build

Because we just have a single header file, so just need to build the test project.

Require compiler supports C++ 11.

Linux OR Windows
```bash
mkdir build
cd build
cmake -DBUILD_TEST=ON -DCPPREST_DIR=/path/to/cpprestsdk -DCPPREST_LIB=/path/tp/cpprestsdk_lib ../
make
```

> Please use the **debug libraray** in debug runtime mode on `Windows` platform.

## Usage

Refer to `test.cpp`.

## TODO

- Different check type (_Now just have `Script+Interval` type, will add `Script+Interval` `Script+Interval`. `Script+Interval`_)
- Bug fix and more test.

## Note

Some newer APIs may not support for now, if you are interesting about this project, welcome to commit PR.

repository: OpenArkStudio/consulpp

repo_name: OpenArkStudio/consulpp


text:
# DeepWriting
Code for `DeepWriting: Making Digital Ink Editable via Deep Generative Modeling` [paper](https://arxiv.org/abs/1801.08379).

[![Watch the video](https://img.youtube.com/vi/NVF-1csvVvc/0.jpg)](https://www.youtube.com/watch?v=NVF-1csvVvc)

Implementation of conditional variational RNNs (C-VRNN) fow handwriting synthesis, generation, beautification and editing tasks.

## Dataset
We collected data from 94 authors by using [IAMOnDB](http://www.fki.inf.unibe.ch/databases/iam-handwriting-database) corpus. After discarding noisy samples of IAMOnDB, we compiled a dataset of 294 authors, fully segmented. You can download our preprocessed data from [project page](https://ait.ethz.ch/projects/2018/deepwriting/downloads/deepwriting_dataset.tar.gz).

The dataset is in compressed .npz format. Strokes, labels and statistics can be accessed by using <key, value> pairs. We split handwriting samples by end-of-characters such that each sample consists of ~300 strokes. Samples are then moved to the origin and represented by using the offset values between consecutive strokes.

For example, you can visualize validation samples with indices 1, 5 and 20 by running
```
python visualize_hw.py -D ./data/deepwriting_validation.npz -O ./data_images -S 1 5 20
```

If you use our data, we kindly ask you to cite our work, and also fill [IAMOnDB's registration form](http://www.fki.inf.unibe.ch/DBs/iamDB/iLogin/index.php) and follow their citation requirements since our dataset extends IAMOnDB.

## Training Model
1. Training details and hyper-parameters are defined in `config.py`.
2. Download training dataset and copy into `data` folder. Otherwise, don't forget to update `training_data` and `validation_data` entries in `config.py`.
3. Set `PYTHONPATH` to include `source`.
```
export PYTHONPATH=$PYTHONPATH:./source
```
4. Run training
```
python tf_train_hw.py -S <path_to_save_experiment>
```
5. If you want to continue training
```
python tf_train_hw.py -S <path_to_save_experiment> -M <model_folder_name>
```

## Evaluating Model
1. You can either train a model or download our pretrained model from [project page](https://ait.ethz.ch/projects/2018/deepwriting/downloads/tf-1514981744-deepwriting_synthesis_model.tar.gz).
2. You can run
```
python tf_evaluate_hw.py -S <path_to_save_experiment> -M <model_folder_name> -QL
```
3. Evaluation options are defined in `tf_evaluate_hw.py` globally.

## Dependencies
1. numpy
2. Tensorflow 1.2+ (not sure if earlier versions work.)
3. matplotlib
4. OpenCV (pip install opencv-python is enough)
5. svgwrite

## Missing
We are not planning to release demo interface.

## Citation
If you use this code or dataset in your research, please cite us as follows:
```
@inproceedings{Aksan:2018:DeepWriting,
	author = {Aksan, Emre and Pece, Fabrizio and Hilliges, Otmar},
	title = {{DeepWriting: Making Digital Ink Editable via Deep Generative Modeling}},
	booktitle = {SIGCHI Conference on Human Factors in Computing Systems},
	series = {CHI '18},
	year = {2018},
	location = {Montr{\'}eal, Canada},
	publisher = {ACM},
	address = {New York, NY, USA},
}
```

repository: Bradan/deepwriting

repo_name: Bradan/deepwriting


text:
snbopen
=======

convert samsung S-note files (.snb) to pdf

use
=======
just run snbopen.py snbfilename [pdffilename].
the script converts the file into pdf and open it with your default application for pdf files.
if you supply the script with a pdffilename, it will save the pdf to the required file insteed of opening it.

to convert all files in all subdirectories run convertInAllSubDirectories.sh.

dependencies
=======
the script should run on python (v2), and require reportlab and PIL (Pillow).

TODO
=======
- text handling is very poor

repository: ajnsit/snbopen

repo_name: ajnsit/snbopen


text:
---
title: Pledging Allegiance To Fundamentalism
author: Kerim
layout: post
permalink: /archives/2002/06/30/pledging-allegiance-to-fundamentalism/
categories:
  - Old Blog Import
---
A religious litmus test for Judges?

>   “But after Bush had a night to ponder the court’s decision — you think he read it? — he took pledge-mania fundamentalism a giant step further. At the summit, he opened a press conference with Russian president Vladmir Putin by saying, "We need common sense judges who understand that our rights were derived from God and those are the kind of judges I intend to put on the bench." That is a major — and stunning — policy declaration. Bush was announcing a new litmus test for judges. It’s not just whether you’re a conservative or constructionist (or meet the political needs of Karl Rove, Bush’s uberstrategist). The question is, do you believe in God and believe that secular law follows the law of God? In other words, there are no atheists — or agnostics — in Bush’s chambers.
>
>
>     Did Bush realize what he was saying? Is he going to ask all potential judicial nominees to tell him their view of God and the derivation of rights? How is this fundamentalism — only believers need apply — different from that of America’s enemies?”
>

AlterNet

repository: kerim/keywords

repo_name: kerim/keywords


text:
iOS Workflow
============

A lightweight workflow component for iOS applications.

This code is made available under the MIT license.

This code has been tested on iOS 5.1 iOS 6.1. Requires ARC is enabled.

The source code includes a demonstration of using the Workflow component, see DEMOViewController.m for details.

All of the files that you should add to your project are in the Workflow subdirectory, and are prefixed with JAS.

Documentation
=============

Refer to Josh Smith's blog for an in-depth overview of this project.

http://ijoshsmith.com/2013/03/24/objective-c-workflow-for-ios-apps/

Why use a workflow?
===================

Modeling complex and/or asynchronous application logic as a workflow makes it easier to decompose a difficult problem into
loosely coupled steps, or "nodes" of responsibility. This enables your code to mimic a workflow diagram that expresses an
overall solution to the problem being solved.

Workflow objects
================

JASWorkflow manages a graph of JASWorkflowNode objects and notifies your code when the workflow completes.

A decision node, of type JASDecision, acts as a predicate that causes one of its two associated nodes to execute.

A work item node, of type JASWorkItem, represents a task that must be performed to complete the workflow.

When a node executes it must immediately evaluate to a result. If the node cannot determine its result at that time
it should evaluate to 'Pending' and report its result to the workflow later. This scenario is commonly seen when a node
must wait for a Web service response to arrive before it can determine its result.


text:
# Web Libraries

## `standard.css`
`standard.css` provides a selection of useful CSS classes. See the file for the
classes.

## JavaScript Libraries
These are, effectively, relics of the old times of wAPI. These used to be huge,
OOP-using behemoths! Now, they have shrunk to singular functions, with 10 lines
of code.

### Importer
Imports elements into tags. Previously used BetterElement, now iterates over tags.

#### Usage
```html
<!-- index.html -->
<topbar></topbar>
<!-- bar.html -->
foo
```
with
```js
aliasElementToUrl('topbar', 'bar.html');
```
results in
```html
<!-- index.html -->
<topbar>foo</topbar>
```

repository: thatlittlegit-archive/wapi

repo_name: thatlittlegit-archive/wapi


text:
## fluent-builder
### Motivation
There already is the widely used "fluent-api" plugin for XJC. That, however isn't a real builder pattern since there is no distinction between initialization and state change in fluent-api.

fluent-builder now creates a real "Builder" pattern, implemented as an inner class to the generated classes.

### Function
fluent-builder creates a builder class with a "[fluent interface](https://en.wikipedia.org/wiki/Fluent_interface)", and a number of methods to create builder instances.
The builder class is generated as a static inner class to all of the value object classes generated with XJC.
It supports the "episode" mechanism to generate builder code seamlessly across multiple compilation schema modules.

Example use in code:

        MyElement newElement = MyElement.builder().withPropertyA(...).withPropertyB(...).addCollectionPropertyA(...).build();

#### Additional Features

##### "Choice Expansion"
In standard JAXB, if you define a `<choice>` group in an XSD complexType definition with cardinality "many", the generated code will only contain a generic collection of "java.lang.Object" type, named something like "AorBorC...".

However, fluent-builder will determine exactly which types are actually possible in this collection, and will generate individual "addXXX" methods for each of them.

So, imagine you have generated code from the XHTML 1.0 schema, and you wish to use fluent-builder to generate an XHTML document programmatically.
Now, again imagine you have already created the "html" and "head" elements, and you are about to populate the "body" eith a table.

Without fluent-builder, you would do something like:

``` java
Body body = new Body();
Table table = new Table();
body.getPorH2orH2().add(table);
Tr tr = new Tr();
table.getTheadOrTrOrTdata().add(tr);
Td td = new Td();
tr.getTd().add(td);
td.setContent("Hello World");
```

With fluent-builder, you can achieve the same more intuitively:

```java
Body.builder().addTable().addTr().addTd().withContent("Hello World").end().end().end().build();
```

##### Object Deep-Copy strategies and Behaviors
In addition, new instances can be created as copies of existing instances using the builder, with an optional modification by other builder methods:

###### Static Deep Copy
        MyElement newElement = MyElement.copyOf(oldElement).withPropertyA(...).withPropertyB(...).build();

Or, similar to the java `clone()` method, creating a runtime copy of a reference:

###### Polymorphic Deep Copy
		MyObj myObj = oldObj.newCopyBuilder().with... .build();

###### Partial Copy (Static and Polymorphic)
The "partial" copy introduced in the "copy" plugin will work here as well, with both static (`copyOf()`) as well as polymorphic (`newCopyBuilder()`) behaviors:

        PropertyTree selection = MyElement.Select.root().propertyA().propertyAB().build();
        MyElement newElement = MyElement.copyExcept(oldElement, selection).withPropertyA(...).withPropertyB(...).build();
		MyObj myObj = oldObj.newCopyBuilder(selection, PropertyTreeUse.EXCLUDE).with.... .build();

###### Static vs. Polymorphic Deep Copy

The difference between `copyOf()` and `newCopyBuilder()` is their respective polymorphic behavior.
`newCopyBuilder()` always returns a builder instance that corresponds to the current runtime type of the object upon which the `newCopyBuilder()` method was invoked.
I.e., using `newCopyBuilder()`, you always get an object of exactly the same type as before as soon as you call `build()`.

In contrast, `MyClass.copyOf()`, being a static method, always returns an object of the class on which it is called, `MyClass` in this case.
You can pass an object of any base type (from the same XSD model or one referenced via "episode") or any derived type of `MyClass` to `copyOf()`, and you still get an instance of `MyClass` as
soon as you call `build()`.
If you pass an instance of a more general class than `MyClass` to `MyClass.copyOf()`, the generated code will only copy the fields that exist in the argument object, and will leave all additional fields uninitialized.
You should then initialize them with the other builder methods.

##### Chained Builder Support
Often, properties of generated classes represent containment or references to generated classes in the same model.
The fluent-builder plugin lets you initialise properties of such a type (and of types declared in upstream modules
via the "episode" feature) - if it isn't an abstract type - by using sub-builders ("chained" builders) in the following
way, given that both A and B are types defined in the XSD model, and A has a property of type B, and B has three
properties of type String, x,y, and z:

        A newA = A.builder().withB().withX("x").withY("y").withZ("z").end().build();

Of course, this plugin is most useful if `immutable` is also activated.

#### Javadoc genration from schema annotations
By default _xjc_ will add class level Javadoc content from the `xs:annotation/xs:documentation` element of the corresponding named/anonymous complex type or root element.
If you enable `generateJavadocFromAnnotations` fluent-builder will additionally generate javadoc comments for class getters/setters and builder add/with methods.
This enables you to add rich documentation to the schema that will also be available in the JAXB generated code.
The content of the `<xs:documentaion>` element will be added to the head of the existing javadoc comment section as a new paragraph.

##### Class level Javadoc
Class level Javadoc comments are generated by _xjc_ from anonymous compex types as follows:

```xml
  <element name="root-element">
    <complexType>
      <annotation>
        <documentation>This is my Anonymous complex type annotation.</documentation>
      </annotation>
      <sequence>
        <element name="child-element" type="string">
```

This will produce Javadoc similar to:

```java
/**
 * This is my Anonymous complex type annotation.
 *
 * <p>Java class for anonymous complex type.
 * ...
 */
 // ...
 public class RootElement implements Cloneable
```

Class level javadoc comments are also generated from named complex types as follows:

```xml
  <complexType name="some-complex-type">
    <annotation>
      <documentation>This is my named complex type annotation</documentation>
    </annotation>
    <sequence>
      <element name="some-element" type="string">
```

This will produce Javadoc similar to:

```java
/**
 * This is my named complex type annotation
 *
 * <p>Java class for some-complex-type complex type.
 * ...
 */
 // ...
 public class SomeComplexType implements Cloneable
```

##### Method level Javadoc

Method level Javadoc will be added to the get.../set... methods that corresponds to the schema `element` or `attribute` that contains the `annotation/documentation` element. It will also be added to the with.../add... builder methods.

For example, the schema annotation should be as follows:

```xml
    <sequence>
      <element name="some-element" type="string">
        <annotation>
          <documentation>This is my element annotation</documentation>
        </annotation>
      </element>
```

This will produce java code in the corresponding class along the lines of:

```java
    /**
     * This is my element annotation
     * <P>
     * Gets the value of the someElement property.
     * ...
     */
    public String getSomeElement() {
        return someElement;
    }

    /**
     * This is my element annotation
     * <P>
     * Sets the value of the someElement property.
     * ...
     */
    protected void setSomeElement(String value) {
        this.someElement = value;
    }
```

And java code in the corresponding Builder class as follows:

```java
        /**
         * This is my element annotation
         * <P>
         * Sets the new value of "someElement" (any previous value will be replaced)
         * ...
         */
        public SomeComplexType.Builder<_B> withSomeElement(final String someElement) {
            // ...
        }
```

### Limitations
* It generates a large amount of code.
* Note: Shared builder instances are NOT thread-safe by themselves.

### Usage
#### -Xfluent-builder

#### Options

##### -rootSelectorClassName=`<string>` (Select)
Name of the generated nested static "Select" entry point class to be used by client code for the "partial copy" feature. This setting will only have an effect if the "deep-copy-plugin" isn't also active. If it is, the "copy" plugin's settings will take precedence.

##### -newBuilderMethodName=`<string>` (builder)
Name of the generated static method to instantiate a new fluent builder. Can be set to handle naming conflicts.

##### -newCopyBuilderMethodName=`<string>` (newCopyBuilder)
Name of the generated instance method to instantiate a new fluent builder intitialized with a copy of the current instance.

##### -copyToMethodName=`<string>` (copyTo)
Name of the generated "copyTo" method.

##### -builderFieldSuffix=`<string>` (_Builder)
Suffix to append to the field holding the builder, change to  prevent name clashes.

##### -generateTools=`{y|n}` (y)
Generate utility classes as static source code artifacts. If no, the plugin JAR must be in compile- and runtime classpath.

##### -narrow=`{y|n}` (n)
Uses copy constructors for all child nodes in the object tree as long as they are available. This will cause the new instance to be as narrow as possible to the declared types.
Abstract types and types not generated from this XSD-model will always be copied by their "clone()"-method.

##### -copyPartial=`{y|n}` (y)
Generates an additional 'copyOf'-method  that takes a PropertyTree instance to restrict the copy operation to selected nodes in the object tree.

##### -selectorClassName=`<string>` (Selector)
Name of the generated nested "Selector" builder class, used to build up a property tree for partial copy functionality. This setting will only have an effect if the "deep-copy-plugin" isn't also active. If it is, the "copy" plugin's settings will take precedence.

##### -builderClassName=`<string>` (Builder)
Name of the generated nested builder class. Can be set to handle naming conflicts.

##### -builderInterfaceName=`<string>` (BuildSupport)
Name of the generated nested builder interface. Can be set to handle naming conflicts.

##### -copyAlways=`{y|n}` (n)
If true, generate code of fluent-builder "withXXX" methods so that all objects passed to the builder are inherently deep-copied.

##### -buildMethodName=`<string>` (build)
Name of the generated "build" method that concludes building and returns the product. Can be set here to handle naming conflicts.

##### -endMethodName=`<string>` (end)
Name of the generated "end" method that concludes a nested builder and returns to the outer builder. Can be set here to handle naming conflicts.

##### -generateJavadocFromAnnotations=`{y|n}` (n)
If true, append schema annotation text (./annotation/documentation) to class getters/setters and builder methods.


text:
---
hrs_structure:
  division: '2'
  volume: '10'
  title: '25'
  chapter: 468M
  section: 468M-2.5
type: hrs_section
tags:
  - Business
menu:
  hrs:
    identifier: HRS_0468M-0002_0005
    parent: HRS0468M
    name: 468M-2.5 Activity desk principal; responsibilities
weight: 94015
title: Activity desk principal; responsibilities
full_title: 468M-2.5 Activity desk principal; responsibilities
---
**[§468M-2.5] Activity desk principal; responsibilities.** (a) Each activity desk shall designate a principal who shall have direct management and supervision of the activity desk, including but not limited to compliance with sections 468M-9 and 468M-10.

(b) The activity desk shall designate the activity desk principal with each registration and registration renewal and shall provide notification in writing to the department within ten days after any change in the designation of the activity desk principal.

(c) The activity desk shall disclose the name and contact information of the activity desk principal to a client trust account beneficiary upon request.

(d) For purposes of this section, "principal" means a corporate officer or director, a partner in a partnership, a sole proprietor, or an individual with an ownership interest in the activity desk who shall be a signatory of any client trust account of the activity desk. [L 2015, c 61, §1]

Note

Current registrants: Disclosure of an activity desk principal commences with the registration renewal required for registrations that expire on December 31, 2017\. L 2015, c 61, §4.

repository: SamMade/BlueAndKrabby

repo_name: SamMade/BlueAndKrabby


text:
# Tip Calc

Submitted by: [@jordanmerrick](https://twitter.com/jordanmerrick)

Calculate the tip to leave when paying the check. Unlike the tip calculator available in the Workflow Gallery, this includes some predefined percentages for one-tap calculation of a tip, or you can enter your own amount.

license: Unlicense

repository: FurnasAZ/shortcutsdirectory

path: /shortcuts/Tip Calc/README.md

repo_name: FurnasAZ/shortcutsdirectory


text:
Multibrowse: Multi-Monitor Kiosk Mode
=====================================

Multibrowse is a CLI launcher for Google Chrome that makes it trivial to open full-screen browser windows onto multiple monitors.

Package Parameters
------------------

* `/installLocation` - Install to a different destination folder. Default: `$Env:ChocolateyToolsLocation\multibrowse`
Example: `choco install multibrowse --params '"/installLocation:C:\\opt"'`

Usage
-----

Open `http://ivo.la` on display 1 and `http://bbc.com` on display 2

```
multibrowse http://ivo.la http://bbc.com
```

Open `http://ivo.la` on display 1 and `http://bbc.com` on display 3

```
multibrowse http://ivo.la - http://bbc.com
```

To exit windows opened in fullscreen, use:
 * Mac: ⌘-Q
 * Windows/Linux: Alt-F4

### Display Order

Displays are ordered according to their x/y position from left to right, then top to bottom. Top-left display is always display #1.

### Additional Options

Additional CLI options passed to the `multibrowse` binary will be delegated to the browser instance. Check out the [wiki page](https://github.com/foxxyz/multibrowse/wiki) for common options.

repository: foxxyz/multibrowse

repo_name: foxxyz/multibrowse


text:
---
layout: about
title: Home
permalink: /
subtitle:
 Ph.D. Student
 School of Electrical Engineering and Computer Science
 Penn State University

profile:
  align: left
  image: prof_pic.jpg
  image_circular: true # crops the image to make it circular
  address:

social: true  # includes social icons at the bottom of the page
news: true  # includes a list of news items
latest_posts: false  # includes a list of the newest posts
selected_papers: false # includes a list of papers marked as "selected={true}"
---

Hello! I am a third-year Ph.D. candidate at PennState University working on v2l & figure captioning + NLP + HCI. I am fortunate to be advised by Dr. [Ting-hao (Kenneth) Huang](https://crowd.ist.psu.edu) and Dr. [C. Lee Giles](https://clgiles.ist.psu.edu). Prior to Penn State, I received B.S. in CS from [National Tsing Hua University](https://eecs-en.site.nthu.edu.tw). Before Ph.D., I spent great time working with Dr. [Shang-Hong Lai](http://www.cs.nthu.edu.tw/~lai/) in CVLAB and Dr. [Yuan-Hao Chang (Johnson Chang)](https://homepage.iis.sinica.edu.tw/~johnson/index.php?SelectedItem=&SelectedGroup=&SelectedSubGroup=) in [Academia Sinica](https://www.sinica.edu.tw/en).

My research lies in the intersection of vision-and-language and HCI. I am particularly interested in multimodal learning, specifically in vision and language tasks. Currently focusing on vision-to-language generation. My goal is to bridge the gap between vision and language and build AI systems that can be applied on social media platforms, writing/reading support, and increase accessibility for people. I am also interested in language-related tasks, such as data-to-text generation and QA summarization.


text:
# Ran2Ran-NDD

This project is to get the Ran2Ran distance distribution within an arbitrary polygon,
    based on the line kinematic measure approach and the probabilistic sum method.
Node density is considered.

The project contains two folders:
* /single_triangle for calculating the Ran2Ran distance distribution within a single triangle, and
* /any_two_triangles for calculating the Ran2Ran distance distribution between any two triangles.

Two sections will be introduced below: Sec1: Approach; Sec2: Simualtion
## Sec1: Approach:
   The genergal function is
   * -> function [ d_array, cdf_array ] = f_rand2rand_arbitrary_polygon( triangle_cell,varargin )

        % This function is to get the numerical Ran2Ran distance distribution

        %   within an arbitrary polygon.

        %

        % Input:

        %   triangle_cell: Triangulated triangules of an arbitrary polygon. Each

        %       cell element contains a triangle, which is like

        %       [x1 y1;x2 y2;x3 y3], where [xi yi] is a vertex of the triangle.

        %

        %   varargin contains the following one optional argument:

        %       -> density array: (n-2)*1, containing "node densities" of each

        %          triangle.

        % Output:

        %   [ d_array, cdf_array ]: Ran2Ran distance distribution within the polygon

    This general function will call the following to functions to get the results associated with the triangulated triangles.
    Then with the probabilistic sum method, the result assiciated with the polygon can be obtained:
   * -> in folder /single_triangle

       function [d_array,pdd_pdf,pdd_cdf] = f_formula_pdd_pdf_triangle(x,y,d_step)%(X,Y,Z,a,b,c)

        % This function is to get the Ran2Ran distance distribution within a

        % single triangle, including both pdf and cdf.

        % Input:

        %   (x,y): the 3 vertexes of the triangle.

        %   d_step: A large number which determines the accuracy of the results.

        % Output:

        %   numerical results of pdf: [d_array,pdd_pdf] and cdf: [d_array,pdd_cdf]

   * -> in folder /any_two_triangles

       function [ d_array, pdf_array, cdf_array ] = f_rand2rand_between_any_2_triangles( t1,t2,d_step )

        % This function is to get the Ran2Ran distance distribution between any

        % two triangles.

        %

        % Input:

        %   t1: triangle 1, t1 is like [x1 y1;x2 y2;x3 y3], where [xi yi] is a

        %       vertex of t1.

        %   t2: triangle 2, t2 is similar to t1;

        %   d_step: A large number which determines the accuracy of the results.

        %

        % Output:

        %   [d_array, cdf_array]: Numerical result of the Ran2Ran distance

        %                         distribution between 2 triangles

       The above function: f_rand2rand_between_any_2_triangles will call the following function:
   * -> function [ L ] = f_theta_func_between_any_2_triangles( theta,t1,t2 )

        % This function is to get the lengths of 3 segments which are generated due

        % to the intersection between a line with angle theta (with regard to

        % x-axis) and the two triangles.

        % The function will be called by the following function:

        % function [ d_array, pdf_array, cdf_array ] = f_rand2rand_between_any_2_triangles( t1,t2,d_step )

        %

        % Input:

        %   theta: the angle of an arbitrary line passed the origin.

        %   t1: triangle 1, t1 is like [x1 y1;x2 y2;x3 y3], where [xi yi] is a

        %       vertex of t1.

        %   t2: triangle 2, t2 is similar to t1.

        % Output:

        %   L: n*3, Lengths of three segments. n is determined by the step distance

        %       between two adjacent parallel lines with angle of theta.

## Sec2: Simulation:
   * -> function [d_array,pdd_cdf,sim_density] = f_sim_rand2rand_arbitrary_polygon( triangle_cell,varargin)

        % Simulation: to get the Ran2Ran distance distribution within an

        %             arbitrary polygon triangulated into several triangules,

        %             stored in triangle_cell

        % Input:

        %   triangle_cell: Triangulated triangules of an arbitrary polygon.Each

        %       cell element contains a triangle, which is like

        %       [x1 y1;x2 y2;x3 y3], where [xi yi] is a vertex of the triangle.

        %

        %   varargin contains the following one optional argument:

        %       -> density array: (n)*1, containing "node densities" of each

        %          triangle (n: the number of triangles).

        % Output:

        %   [ d_array, pdd_cdf, sim_density ]: Ran2Ran distance distribution within the

        %                      polygon, with the simulated density of each triangle.


text:
---
title: 'Bytesize 40: Software packaging'
subtitle: Alexander Peltzer - Boehringer Ingelheim Pharma GmbH & Co. KG, Germany
type: talk
start_date: '2022-04-05'
start_time: '13:00 CEST'
end_date: '2022-04-05'
end_time: '13:30 CEST'
youtube_embed: https://www.youtube.com/watch?v=0ZpcYtKDZrU
location_url:
  - https://www.youtube.com/watch?v=0ZpcYtKDZrU
  - https://doi.org/10.6084/m9.figshare.19923425.v1
---

# nf-core/bytesize

Join us for our **weekly series** of short talks: **“nf-core/bytesize”**.

Just **15 minutes** + questions, we will be focussing on topics about using and developing nf-core pipelines.
These will be recorded and made available at <https://nf-co.re>
It is our hope that these talks / videos will build an archive of training material that can complement our documentation. Got an idea for a talk? Let us know on the [`#bytesize`](https://nfcore.slack.com/channels/bytesize) Slack channel!

## Bytesize 40: Software packaging

This week, Alexander Peltzer ([@apeltzer](http://github.com/apeltzer/)) will present: _**Software packaging.**_

This will include how to package a tool in BioConda, and how that ends up in BioContainers where we can use it in pipelines.


text:
## There are 3 different wallet options for the TFT:

### 1. [3Bot Connect App](3bot_connect.md)

Wallet included in the 3Bot app. Basic features. For iOS and Android.

### 2. [TF Desktop Wallet](desktop_wallet.md)

Desktop wallet for the advanced user. Including multisignature wallet functionality that allows for example companies to add multiple signatures for TFT transactions.

### 3. [ThreeFold App](threefold_app.md)

The First Itteration of the ThreeFold App. This will fully be replaced by the 3Bot Connect app in the near future.


text:
# poissonFits

<!-- badges: start -->
<!-- badges: end -->

This package provides convenient functions for fitting Poisson distributions, regressions, and processes to count data of some phenomena or events. It also contains data-sets for examples of approximately Poisson distributed phenomena. These include data-sets named in R as "stormReport", "ENSO", and "atlanticStormsENSO" and "shootings". See the internal R documentation for more info and sources.

## Installation

You can install the latest version from GitHub with:

``` r
devtools::install_github("shill1729/poissonFits")
```

## Fit a Poisson distribution on the number of hurricanes per year in the Atlantic basin
We can load hurricane data from NHC NOAA, since they conveniently provide an XML file of all storm reports since 1958. See documentation on "stormReport" for more details. The data-set is provided with the package, however, a scraper is also available to get the latest file of storm-reports (which I imagine does not change frequently until after new storm seasons are over). NOTE: Early data contains named storms without designating them either a hurricane, a tropical storm, or a subtropical storm. The parameter for the Poisson distribution is chosen via MLE. A Chi-square test is then performed on the goodness of fit of the distribution to the empirical data.

```r
library(poissonFits)
# Significance level for Chi-square test
alpha <- 0.05

# Default loads no tropical storms;
countData <- loadStormData()

# Pick either the atlantic, pacific, or world
countsYear <- countData$atlantic
# Get just the counts
countsData <- countsYear$freq

# Pass just the count data to poissonFit
poissonFit(countsData)
```


text:
---
layout: page
title: Projects
permalink: /projects/
---

#### [Tidygeocoder](https://jessecambon.github.io/tidygeocoder/)

Tidygeocoder is an R package for geocoding. You read more about it on [its website](https://jessecambon.github.io/tidygeocoder/) and in the [Journal of Open Source Software publication](https://joss.theoj.org/papers/10.21105/joss.03544) below.

<object data="https://www.theoj.org/joss-papers/joss.03544/10.21105.joss.03544.pdf" type="application/pdf" width="100%" height="500px">
</object>

#### [Data Science "Sandbox"](https://github.com/jessecambon/Data-Science-Sandbox)

A loosely organized collection of Python and R code for data science projects. I sporadically update this repository with new code snippets and examples I think could be useful to have for reference in the future.

gha_language: Jupyter Notebook


text:
---
title: "Install Open Peer Power"
description: "Getting started: How to install Open Peer Power."
---

{% comment %}

Note for contributors:

The getting started guide aims at getting new users get Open Peer Power up and
running as fast as possible. Nothing else. All other things should not be
written down, as it creates a spaghetti of links and the user will lose focus.

So here are guidelines:

 - Focus on the bare necessities. No remote port, no securing installation. The
   defaults are good enough to get a system up and running for the first guide.
 - Avoid or explain technical terms.
 - Do not talk about YAML if it can be partially/fully done in UI.
 - Do not tell people about stuff they can do later. This can be added to a
   2nd tier guide.
 - The first page of the guide is for installation, hence Open Peer Power specific.
   Other pages should not refer to it except for the page introducing the last
   page that introduces `configuration.yaml`.

{% endcomment %}

This guide will help you get Open Peer Power running on a Raspberry Pi, to create an efficient power management hub.

### Suggested hardware

The Raspberry Pi 4 Model B is a good, affordable option for the power management server.

- Raspberry Pi 4 Model B (2GB) + Power Supply (at least 2.5A)
- Micro SD Card. Ideally get one that is Application Class 2 as they handle small I/O much more consistently than cards not optimized to host applications. A 32 GB or bigger card is recommended.
- SD Card reader. This is already part of most laptops, but you can purchase a standalone USB adapter if you don't have one. The brand doesn't matter, just pick the cheapest.
- Ethernet cable. Open Peer Power can work with Wi-Fi, but an Ethernet connection would be more reliable.

### Software requirements

- Download and extract the Open Peer Power image.
- Download [balenaEtcher] to write the image to an SD card

[balenaEtcher]: https://www.balena.io/etcher

### Installation

1. Put the SD card in your card reader.
2. Open balenaEtcher, select the Open Peer Power image and flash it to the SD card.
3. Unmount the SD card and remove it from your card reader.
4. Follow this step if you want to configure Wi-Fi or a static IP address (this step requires a USB stick). Otherwise, move to step 5.
   - Format a USB stick to FAT32 with the volume name `CONFIG`.
   - Create a folder named `network` in the root of the newly-formatted USB stick.
   - Within that folder, create a file named `my-network` without a file extension.
   - Copy one of [the examples] to the `my-network` file and adjust accordingly.
   - Plug the USB stick into the Raspberry Pi.

5. Insert the SD card into your Raspberry Pi. If you are going to use an Ethernet cable, connect that too.
6. Connect your power supply to the Raspberry Pi.
7. The Raspberry Pi will now boot up, connect to the Internet and download the latest version of Open Peer Power. This will take about 20 minutes.
8. Open Peer Power will be available at `http://openpeerpower.local:8123`. If you are running an older Windows version or have a stricter network configuration, you might need to access Open Peer Power at `http://openpeerpower:8123` or `http://X.X.X.X:8123` (replace `X.X.X.X` with your Pi's IP address).
9. If you used a USB stick for configuring the network, you can now remove it.

[the examples]: https://github.com/OpenPeerPower/oppos/blob/dev/Documentation/network.md

### [Next step: Provisioning »][next-step]

[next-step]: /getting-started/provisioning/

extension: markdown


text:
## Image Search

Demo application built with [Xamarin](https://visualstudio.microsoft.com/xamarin?WT.mc_id=devdayslabs-github-bramin) to do a [Bing Image Search](https://azure.microsoft.com/services/cognitive-services/bing-image-search-api?WT.mc_id=devdayslabs-github-bramin).

## Setup

You must use setup a API key that can be set in ImageSearch/Services/ServiceKeys.cs

### Microsoft Cognitive Services

Setup a Bing Search API Key at: [https://azure.microsoft.com/services/cognitive-services/bing-image-search-api](https://azure.microsoft.com/services/cognitive-services/bing-image-search-api?WT.mc_id=devdayslabs-github-bramin)

repository: brminnick/dev-days-labs

gha_language: C#

repo_name: brminnick/dev-days-labs


text:
![Alt text](/img/logog.png?raw=true)

#Privacy Policy

Prashant Baid does not collect any personal information that the extension may have access to.

Google user data, in the case of this extension, your gmail emails, is accessed by the extension solely in order to display it to the user via the popup window or the notifications, which is the purpose of the extension.

This extension has read-only access to your gmail emails; it cannot create, send, modify or delete your emails.

No Google user data is shared with anyone else other than the extension user. The extensions act as a conduit to the user's Google data.

This extension was designed to use an authorization system via the industry-standard OAuth 2.0 protocol as a secure way to outsource user authentication. This means that Prashant Baid does NOT have access to your passwords.

The permissions you agree to when installing the extensions are the minimum requirements for the extension to perform its basic purpose.

This extension cannot

This is an open source extension and you can view the entire [source code](https://github.com/prashantbaid/gmail-onthisday) on Github.

repository: prashantbaid/gmail-onthisday

repo_name: prashantbaid/gmail-onthisday


text:
# Python Class in Design

Abstract: Review the discussion of comparing designs between Python class and module interfaces, and provide a more complicate demo to illustrate how to use Python classes to resolve dependencies, in following sections.

Class Design

Commonly-used Functions

Source Code

  In last [part](python-design-part-1.md) ("Python class vs module"),
  the discussion has been slightly in favor of using
  Python class
  mechanism to inject dependencies (e.g. settings for swift store, in the demo)
  via a natural OOP approach, instead of traditional python (scripting) module
  methods (either passing dependencies in parameters or more complicatedly
  introducing SwiftConfig class and @checks_config
  decorator in swift module).

  The idea of using class is to have some abstraction in design, so that
  an application can program to interfaces (e.g. ISettings
  and IStore) other than concrete implementations.

  Let's say to program the interface of IStore.
  The contracts are listed here -

  ```python
  get_files_list()
  get_file_contents(file_name)
  save_file(file_name, file_contents)
  ```

  By one implementation, of using [swiftclient](http://docs.openstack.org/developer/python-swiftclient/swiftclient.html)
  on object store, the [Swift](python-design-part-1.md#swift) class
  has encapsulated dependencies in constructor and merely exposed/implemented methods
  per above IStore contracts.

  In other situation or project, if backend store happened to be a database (or
  some file system), the implementation could be easily swapped by a concrete
  DBStore or FileStore class, certainly with different
  signatured constructor (since dependencies vary), but remained same interfaces
  so that application needs less code and logic change, and less regression.

  In this context, settings (e.g. user name, url, auth token, container name
  for swift, database connection string for db store, or a base directory
  for file system) are more about how a concrete implmentation exactly set up
  before the interface can be called. Such dependencies vary from implementations,
  and should be separated from major business logic (which should care only about
  IStore interface). Without encapsulation, the interface method
  signature would have to change for different store. For example, to get a file,
  a container name is required for swift store, but a base directory is
  needed for file store.

1. Class Design

  Continued on the topic, the next demo, also in python code, is to
  deploy package to Helion Development Platform (by using Application Lifecycle Service,
  a.k.a. ALS - a Cloud Foundry-based,
  managed runtime environment).

  The procedure of the deployment is actually processing a batch of Helion CLI (cf equivalent tool) commands running against an ALS endpoint.
  The whole process could have any numbers of sequential steps (each runs a
  command, with arguments, and returns exit code). If any command failed,
  the process would stop and fail; otherwise, the process continued in success
  state to the last command.

  During the process (by an artificial deployment identifier), it would be ideal
  to log the status of each step with certain details.
  And the whole execution should be running in a fork thread or process in a
  typical GUI or web application so that the main process (likely the UI) won't
  be frozen and held on waiting for the execution completes. The status (with
  deployment info, might include some history and package details) is
  recorded/saved to a store (e.g. a swift or database) so that the main UI
  can use another thread or the web can call a (RESTful) service to check on
  the progress asynchronously per a deployment identifier.

  Although not quite enough "acceptance criteria" for a real project, the
  above requirements have provided some basic to start a design: a
  Deployment can launch a Process and also call on an
  IStatus (which is separated from how status is recorded and retrieved).
  There is an encapsulated Package model could be part of
  Deployment and passed along the process.
  The Process is the interface to execute the Batch.
  And in this case, since ALS is a concrete service that the deployment process
  will target to, it can be bound to the Process (but not to
  Deployment or Batch).
  The design is fully described as in below.

1.1. Batch

  * Usage: A class module contains a batch (a series of shell commands, with CWD, target status on success, accepted exit code, or allowing non-zero exit code)
  * Dependencies: CWD (default working directory specified)
  * Interfaces:

    ```python
    add(self, command, expected_status, description='', accept_error=False)
    ```

1.2. BatchProcess (optionally implements an IProcess)

  * Usage: A class module represent a batch process (e.g. loop through each command in a batch sequentially and use subprocess to execute the command)
  * Dependencies: Batch instance, and IStatus interface (or a function pointer to set status record on each step of the process)
  * Interfaces:

    ```python
    execute(self)
    ```

1.3. HelionCliComposer

  * Usage: A class module wrapper to compose Helion CLI command
  * Dependencies: ALS cluster endpoint, user name (admin email), login password, and optional CWD (working directory)

1.4. Package (Model)

  * Usage: A model class represent package-related information (e.g. manifest, package/file type, destination, etc.)
  * Dependencies: None, or a more detailed package manifest (including type and destination)

1.5. DeploymentStatus (IStatus interface)

  * Usage: A class module represent an interface of getting and setting status (against, e.g. swift or db store)
  * Dependencies: Package, IStore (Swift or DB store for status record)
  * Interfaces:

    ```python
    get_status(self, deployment_id)
    set_status(self, deployment_id, status)
    ```

1.6. Deployment

  * Usage: A class module represent a deployment process (e.g. process package and deployment info, build batch commands, and kick off batch process)
  * Dependencies: Package, HelionCliComposer, IProcess, and IStatus
  * Interfaces:

  ```python
  deploy(self)
  ```

2. Commonly-used Functions

  Based on the [Swift class](python-design-part-1.md#swift) (in
  last [part](python-design-part-1.md)), it is easy and straightforward to
  add more functions related to the store. Assuming to use the store saving
  both packages and deployment state records, the following piece is a partial
  of Swift class to include 3 more methods:
  * check_file_exists,
  * check_package_exists and
  * get_deployment_list.
  Noticing latter two methods have some business logic (about package and deployment)
  that may not belong to a "pure" IStore interface, it would be a
  design decision how services are structured and if they should be in
  Deployment or another middle tier class.

  See swift.py (partial of Swift class) -

  ```python
    def check_file_exists(self, file_name):
        if (not self.check_container()):
            return False
        result = self.connection.get_container(
                container_name, full_listing=True)
        for file in result[1]:
            if (file['name'] == file_name):
                return True
        return False

    def check_package_exists(self, package_name):
        file_name = '{0}.tar.gz'.format(package_name)
        return self.check_file_exists(file_name)

    def get_deployment_list(self):
        deployment_list = []
        result = self.connection.get_files_in_container()
        regex = re.compile('^deployment_(.+).json$')
        for file in result:
            filename = file['name']
            re_match = regex.search(filename)
            add_flag = \
                file['content_type'] == 'application/json' and \
                re_match is not None
            if (add_flag):
                try:
                    file_contents = self.get_file_contents(filename)
                    item = json.loads(file_contents)
                    deployment_list.append(item)
                except Exception:
                    continue
        return deployment_list
  ```

  Another helper module is utils.py, which could have commonly
  used functions that do not belong to any of classes in this demo.
  There is no need to wrap these functions into a class.
  In other OOP language (like Java or C#), they are usually grouped as
  public static methods. Python module serves the same perfectly here.
  The utils.py module also includes a get_store method.
  This is to demonstrate as a factory to construct a IStore object,
  especially in a multi-project environment when IStore implementations
  come from a common namespace but dependencies (e.g.
  settings) in application domain.

  See utils.py -

  ```python
  # utils.py
  import re
  import StringIO
  import shutil
  import tarfile

  from config import settngs
  from keystone import get_auth_token
  from swift_class import get_swift, Swift
  from logging import getLogger
  logger = getLogger(__name__)

  def delete_directory_tree(dir_path):
      """
      Cleanup a directory
      """
      if (dir_path):
          try:
              logger.info('Deleting {0}'.format(dir_path))
              # Clean up working directory
              shutil.rmtree(dir_path, ignore_errors=True)
              logger.info('Deleted dir: {0}'.format(dir_path))
          except Exception as e:
              err_message = \
                  'Failed to clean up working directory "{0}".' \
                  .format(dir_path)
              logger.exception(err_message)

  def extract_manifest_from_package(file_contents):
      """
      Extract the manifest from the vendor package
      """
      manifest_regex = '^.+[/]manifest.json$'
      pattern = re.compile(manifest_regex, re.IGNORECASE)

      # tarfile - https://docs.python.org/2/library/tarfile.html
      manifest = None
      with tarfile.TarFile.open(
              mode='r:gz',
              fileobj=StringIO.StringIO(file_contents)) as tar_package:
          for tarinfo in tar_package.getmembers():
              if (pattern.search(tarinfo.name)):
                  manifest = tar_package.extractfile(tarinfo.name).read()
                  break
      return manifest

  def get_store():
      """
      Get a Swift instance per application settings
      """
      auth_token = get_auth_token()
      container = settings('swift_container')
      swift_url = settings('swift_url')
      swift = Swift(auth_token, swift_url, container)
      return swift

  ```

  The last piece in this discussion section is Batch
  and BatchProcess. Both of them are very self-contained
  and have nothing specifically related to major business logic (Deployment
  in this case). The separation here is used to isolate each problem domain
  without too much dependencies at interface level. Envision that the deployment
  business might need to target on a different platform or require to call a
  RESTful service instead of a batch of commands, the deploy interface
  in Deployment would be rewritten to call a different process.
  The deploy call could have minimum, or even no code change (if
  an IProcess is defined).

  See batch.py (Batch and BatchProcess) -

  ```python
  # batch.py
  import json
  import os
  import subprocess
  import threading

  from logging import getLogger
  logger = getLogger(__name__)

  class Batch(object):
      def __init__(self, cwd):
          """
          Initialize an instance of Batch
          Params:
              cwd: current working directory (where the batch to be executed)
          """
          self.batch_cmds = []
          self.cwd = os.path.abspath(os.path.expanduser(cwd))

      def add(self, status, command, accept_error=False):
          """
          Add a command to batch, with expected status on success, and
          optionally allowing non-zero exit code by accept_error=True
          """
          self.batch_cmds.append({
              'accept_error': accept_error,
              'command': command,
              'cwd': self.cwd,
              'exit_code': 0,
              'status': status,
              'stdout': '',
          })

      def clear(self):
          self.batch_cmds = []

  class BatchProcess(object):
      def __init__(self, batch, set_status_func):
          """
          Initialize an instance of BatchProcess
          """
          self.batch_cmds = batch.batch_cmds
          self.set_status = set_status_func
          self.started = False
          self.success = False

      def execute(self):
          """
          Start to execute a batch process
          """
          can_continue = True
          self.started = True
          self.set_status('STARTED')

          logger.info('Batch:\n{0}'.format(self.batch_cmds))
          for next_cmd in self.batch_cmds:
              logger.info('CWD=={0}'.format(next_cmd['cwd']))
              logger.info('next cmd:\n{0}'.format(
                  json.dumps(next_cmd, indent=2, sort_keys=True)))
              accept_error = next_cmd['accept_error']
              cmd = next_cmd['command']
              # ToDo [zhuyux]: add timeout mechnisam
              proc = subprocess.Popen(
                  cmd,
                  cwd='{0}'.format(next_cmd['cwd']),
                  stderr=subprocess.STDOUT,
                  stdout=subprocess.PIPE)
              next_cmd['stdout'] = proc.communicate()[0]
              stdout = next_cmd['stdout'].decode('string_escape')
              logger.info('stdout:\n{0}'.format(stdout))
              exit_code = proc.returncode

              if (accept_error or exit_code == 0):
                  self.set_status(next_cmd['status'])
              else:
                  logger.error('Exit code {0} from {1}'.format(exit_code, cmd))
                  next_cmd['exit_code'] = exit_code
                  can_continue = False
                  break

          self.set_status('SUCCESS' if can_continue else 'FAILED')
          self.success = can_continue
          return can_continue

  ```

3. Source Code

  This section mainly lists rest of the source code at core business of the
  Deployment. By this far, it should be clear to see how a class
  is designed to be highly cohesive (to its own problem domain) but also loosely
  decoupled from other classes, modules, or layers. Dependencies between
  each class/module are kept at minimum by object constructor or a factory,
  while interfaces are maintained clean and consistent regardless of concrete
  implementations. Services are self-contained and swappable without affecting
  too much on other part of the application. The design thought is for Python
  classes, but applies as generic in any programming practice.

  See helion_cli.py (HelionCliComposer class) -

  ```python
  #helicon_cli.py
  import os

  class HelionCliComposer(object):
      def __init__(self, endpoint, username, password, cwd=None):
          """
          Initialize an instance of HelionCliComposer
          """
          self.cwd = None
          if (cwd is not None):
              self.cwd = os.path.abspath(os.path.expanduser(cwd))
          self.endpoint = endpoint
          self.username = username
          self.password = password
          pass

      def get_delete_cmd(self, name):
          return [
              'helion', 'delete',
              '--target', '{0}'.format(self.endpoint),
              '-n', '{0}'.format(name)]

      def get_list_cmd(self):
          return ['helion', 'list', '--target', '{0}'.format(self.endpoint)]

      def get_login_cmd(self):
          return [
              'helion', 'login',
              '{0}'.format(self.username),
              '--credentials', 'username: {0}'.format(self.username),
              '--password', '{0}'.format(self.password),
              '--target', '{0}'.format(self.endpoint)]

      def get_logout_cmd(self):
          return ['helion', 'logout']

      def get_push_cmd(self, name, path):
          if (self.cwd is not None):
              path = '{0}/{1}'.format(self.cwd, path)
          return [
              'helion', 'push',
              '--target', '{0}'.format(self.endpoint),
              '--as', '{0}'.format(name),
              '--path', '{0}'.format(path),
              '--no-prompt']

      def get_target_cmd(self):
          return ['helion', 'target', self.endpoint]

  ```

  See package.py (Package class) -

  ```python
  # package.py
  import re
  import os

  from logging import getLogger
  logger = getLogger(__name__)

  class Package(object):
      def __init__(self, package_id, package_path, endpoint_url=None):
          """
          Initialize an instance of Package
          Params:
              package_id: package id or name
              package_path: full path of the package (including file name)
          """
          self.id = package_id
          self.file_name = os.path.basename(package_path)
          self.name = self.get_package_name(package_path)
          self.path = os.path.abspath(os.path.expanduser(package_path))
          self.destination = self.get_destination(endpoint_url, self.name)
          self.cwd = os.path.dirname(self.path)

      def get_destination(self, endpoint_url, package_name):
          """
          Get package destination url from endpoint and package name
          """
          dest = ''
          if (endpoint_url):
              regex = re.compile('^(http[s]?://)api\.(.+)$')
              re_match = regex.search(endpoint_url.strip('/'))
              if (re_match is not None):
                  prot = re_match.group(1)
                  addr = re_match.group(2)
                  dest = '{0}{1}.{2}'.format(prot, package_name, addr)
          # returning package destination url
          return dest

      def get_package_manifest_filename(self):
          """
          Get package manifest filename (e.g. foo.json) without path
          """
          return '{0}.json'.format(self.name)

      def get_package_name(self, package_path):
          """
          Get package name (e.g. foo) from package path (e.g. '/path/foo.tar.gz')
          """
          pkg_file = os.path.basename(package_path)
          pkg_name = os.path.splitext(os.path.splitext(pkg_file)[0])[0]
          return pkg_name

  ```

  See deploy_status.py (DeploymentStatus class) -

  ```python
  # deploy_status.py
  import json
  import os

  from datetime import datetime
  from time import gmtime, strftime

  from logging import getLogger
  logger = getLogger(__name__)

  class DeploymentStatus(object):
      def __init__(self, package=None, store):
          """
          Initialize an instance of DeploymentStatus
          """
          self.package = package
          self.destination = '' if package is None else package.destination
          self.package_name = 'N/A' if package is None else package.name
          self.store = store

      def get_all(self):
          return self.store.get_deployment_list()

      def get_deployment_filename(self, id):
          filename = 'deployment_{0}.json'.format(id)
          return filename

      def get_status(self, id):
          """
          get status record (as json object) by deployment id
          """
          result = {
              'deploy_id': id,
              'deploy_status': '',
              'datetime': '',
              'destination': self.destination,
              'history': [],
              'package': self.package_name}
          try:
              filename = self.get_deployment_filename(id)
              contents = self.store.get_file_contents(filename)

              if (contents):
                  # logger.debug('Deployment status: {0}'.format(contents))
                  result = json.loads(contents)
          except Exception as e:
              logger.exception("Failed to get status for {0}.\n".format(id))
          # logger.debug('Deployment result: {0}'.format(result))
          return result

      def set_status(self, id, status):
          """
          set status record (json file) by deployment id and status (string)
          """
          logger.info('======= Setting status: "{0}" =======\n'.format(status))

          result = self.get_status(id)

          date_time = datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S.%f")
          history = result['history']
          record = '{0} ~ {1}'.format(date_time, status)
          if (type(history) is list):
              history.append(record)
          else:  # creating a history list
              history = [record]

          result['deploy_id'] = id
          result['deploy_status'] = status
          result['datetime'] = date_time
          result['destination'] = self.destination
          result['package'] = self.package_name
          result['history'] = history

          filename = self.get_deployment_filename(id)
          contents = json.dumps(result, sort_keys=True)
          self.store.save_file(container_name, filename, contents)

          return result

  ```

  See deploy.py (Deployment class) -

  ```python
  # deploy.py
  import os
  import shutil
  import tempfile

  from multiprocessing import Lock, Process, Queue
  from batch import Batch, BatchProcess

  from utils import delete_directory_tree
  from logging import getLogger
  logger = getLogger(__name__)

  class Deployment(object):
      def __init__(
              self,
              package, cli_composer, deploy_status,
              use_package_path=False):
          """
          Initialize an instance of Deployment
          """
          import uuid
          if (use_package_path):
              self.batch = Batch(package.cwd)
          else:
              self.batch = Batch(tempfile.mkdtemp())
          self.cli_composer = cli_composer
          self.cwd = self.batch.cwd
          self.cwd_use_package_path = use_package_path
          self.deployed = False
          self.deployment_id = '{0}'.format(uuid.uuid1())
          self.deploy_status = deploy_status
          self.package = package
          self.store = deploy_status.store  # backend store
          self.started = False

      def cleanup(self):
          """
          Cleanup Deployment BatchPrcess working directory
          """
          try:
              logger.info('Deleting deployment cwd={0}'.format(self.cwd))
              # Clean up working directory
              delete_directory_tree(self.cwd)
              logger.info('Deleted deploy deployment cwd.')
          except Exception as e:
              err_message = \
                  'Failed to clean up deployment cwd "{0}".' \
                  .format(self.cwd)
              logger.exception(err_message)

      def deploy(self):
          """
          Start a Deployment process
          """
          if (self.started):
              err = 'Deployment {0} already started'.format(self.deployment_id)
              raise Exception(err)

          self.get_deployment_batch()

          try:
              self.started = True
              self.download_package() # preparing package

              logger.info('Starting deployment ...')
              process = BatchProcess(self.batch, self.set_status)
              logger.debug('Batch process: {0}'.format(process))
              self.deployed = process.execute()
          except Exception as e:
              err_message = 'Exception on BatchProcess execution.'
              logger.exception(err_message)
              self.set_status('FAILED')
          else:
              logger.info('DONE deployment - {0}'.format(self.deployment_id))
          finally:
              self.cleanup()

      def download_package(self):
          if (self.cwd_use_package_path):
              self.set_status('DOWNLOADING')
              pkg_filename = self.package.file_name
              pkg_contents = store.get_file_contents(pkg_filename)
              logger.info('Downloading package {0} to {1}...'.format(
                  pkg_filename, self.package.path))
              with open(self.package.path, 'w') as package_file:
                  # write the package as a tar.gz into deployment cwd
                  package_file.write(pkg_contents)
          return self.package.path

      def get_deployment_batch(self):
          """
          Get a batch of commands for the deployment
          """
          pkg_path = self.package.path
          pkg_name = self.package.name

          self.batch.clear()
          # add unpacking script to batch
          logger.info('Adding batch to unpack {0} from {1}'.format(
              pkg_name, pkg_path))
          self.get_package_batch()

          # add deployment script to batch
          self.batch.add('TARGET', self.cli_composer.get_target_cmd())
          self.batch.add('LOGIN', self.cli_composer.get_login_cmd())
          self.batch.add(
              'REMOVED', self.cli_composer.get_delete_cmd(pkg_name), True)
          self.batch.add('LIST', self.cli_composer.get_list_cmd())
          self.batch.add('DEPLOYED', self.cli_composer.get_push_cmd(
              pkg_name, '{0}'.format(pkg_name)))
          self.batch.add('NEWLIST', self.cli_composer.get_list_cmd())
          self.batch.add('DIR', ['ls', '-al'])

      def get_package_batch(self):
          """
          Get a batch of commands for preparing the package
          """
          dst_path = self.cwd
          src_path = self.package.path
          pkg_name = self.package.name

          # no need this copy command if package path is used as cwd
          if (not self.cwd_use_package_path):
              copy_cmd = [
                  'cp', '-rf',
                  '{0}'.format(src_path),
                  '{0}'.format(dst_path)]
              self.batch.add('COPY', copy_cmd)

          view_cmd = [
              'tar', '-tvf',
              '{0}'.format(src_path)]
          # Assume any foo.tar.gz contains -
          #   - foo/foo.tar.gz (the package to deploy)
          #   - manifest.json
          unpack_cmd = [
              'tar', '-zxvf',
              '{0}'.format(src_path)]
          xtract_cmd = [
              'tar', '-zxvf',
              '{0}/{1}/{2}.tar.gz'.format(dst_path, pkg_name, pkg_name)]
          dir_cmd = [
              'ls', '-al',
              '{0}/{1}'.format(dst_path, pkg_name)]
          self.batch.add('PREVIEW', view_cmd)
          self.batch.add('UNPACK', unpack_cmd)
          self.batch.add('EXTRACT', xtract_cmd)
          self.batch.add('DIR', dir_cmd)

      def get_status(self):
          '''get status by self.deployment_id
          '''
          return self.deploy_status.get_status(self.deployment_id)
          # return status
          pass

      def set_status(self, status):
          '''set status by self.deployment_id
          '''
          self.deploy_status.set_status(self.deployment_id, status)

  ```

  See deployment.py (app module) -

  ```python
  # deployment.py
  import json
  import shutil
  import tempfile
  import traceback

  from multiprocessing import Process
  from subprocess import call, check_output, CalledProcessError

  from deploy import Deployment
  from deploy_status import DeploymentStatus
  from helion_cli import HelionCliComposer
  from package import Package
  from utils import delete_directory_tree, get_store
  from logging import getLogger
  logger = getLogger(__name__)

  def deploy_package(package_name, endpoint_url, username, password):
      """
      Deploy a package into destination (e.g. ALS/Cloud Foundry)
      Params:
          package_name - the name of the package to deploy
          endpoint_url - the destination (e.g. ALS/Cloud Foundry) endpoint URL
                         ie: 'https://api.<IP_ADDRESS>.xip.io'
          username - the user name (admin email) for destination login
          password - the password for destination login
      """
      store = get_store()

      if (not store.check_package_exists(package_name)):
          return {'status': 404}

      cwd = ''
      try:
          cwd = tempfile.mkdtemp()
          pkg_filename = '{0}.tar.gz'.format(package_name)
          package_path = '{0}/{1}'.format(cwd, pkg_filename)
          package = Package(package_name, package_path, endpoint_url)

          # instantiate a cli composer
          composer = HelionCliComposer(endpoint_url, username, password)

          deploy_status = DeploymentStatus(package, store)
          deployment = Deployment(package, composer, deploy_status, True)
          deployment_id = deployment.deployment_id

          deployment.set_status('INIT')

          # Start a new process to execute the deployment
          process = Process(
              name='deployment_{0}'.format(deployment_id),
              target=deployment.deploy)
          process.start()

          logger.info('Deployment {0} started for {1}.'.format(
              deployment_id, package_name))

          return {
              'status': 201,
              'deployment_id': deployment_id,
              'package': package_name}

      except Exception as e:
          stack_info = traceback.format_exc()
          error_message = "Exception on deploy {0}. Details:\n{1}".format(
              package_name, stack_info)
          logger.exception(error_message)
          delete_directory_tree(cwd)
          return {'status': 500, 'errors': error_message}

  def get_status(id):
      """
      Get the deployment status by id
      """
      try:
          logger.info("======= deployment::get_status =======")
          store = get_store()
          deploy_status = DeploymentStatus(store=store)
          result = deploy_status.get_status(id)

          logger.debug('Deployment result: {0}'.format(result))
          if result == {} or not result['deploy_status']:
              return {'status': 404}
          else:
              return {'status': 200, 'data': result}
      except Exception as e:
          stack_info = traceback.format_exc()
          error = "Exception on getting deployment status"
          error_message = "{0} for {1}. Details:\n{2}".format(
              error, id, stack_info)
          logger.exception(error_message)
          return {'status': 500, 'errors': error_message}

  ```

repository: dockerian/pyapi

repo_name: dockerian/pyapi


text:
---
layout: post
title:  "Hello World!"
date:   2016-05-08 19:12:13
categories: info
permalink: /records/hello
---

# Total Newb
I will attempt to share my experience as I develop as a Software Developer. As I work in a .Net shop most of the experiences will be with C# and web development.

My goals are to dive into the MEAN stack focusing on Angular 2 and also trying out electron for applications. I will try to post at least once a week at a minimum sharing what I learned that week. I dive into web development on my free time as it is different from what I do at work. I want to try and build applications that will integrate what I have learned in my business curriculum during my undergrad.


text:
# Go Starter Kit

A simple template to help get a new project started.

## Check Out the Code

Code is contained in `src/go_starter.go`
Go convention is actually not to use a src folder, but I find it helpful to have top-level scripts, and it starts to get cluttered.

## Install
Install all modules defined in go.mod:
```bash
go install
```

## Run the Code
```bash
./run.sh
```

## Build the Code

```bash
./build.sh
```

This outputs to the dist folder, which is gitignored by default.

## Install testing library

```bash
go get github.com/stretchr/testify/assert
```

## Run Tests

```bash
./test.sh
```

These scripts don't really add much functionality beyond what go makes available via the CLI but they are useful to get started, especially if you're used to JS projects with scripts defined in `package.json`


text:
# FSC - Fast Scan Cropper

We present FSC - the Fast Scan Cropper - a tool for extracting pictures from scans images with white background.
FSC is written in Python3 and exploiting many builtin function from numpy to achieve quickly cropped images from your scan.
With a clever edge identification, the tool is able to rotate the images if necessary.

FSC was build with regard to the following requirements:

1. Easy and intuitive handling on command line without any major installation
2. Accurate preprocessing of the picture, i.e., appropriate cropping and rotation

### Prerequisites
FSC needs a *Python3* interpreter and the numpy, PIL libraries preinstalled and an image to crop, say:

### Using FSC

To run the script, simply type in:

```
python3 FSC.py your-image.jpg
```
Depending on the number of identified pictures in the image, these pictures will be stored in the same folder with "IMG" prefix and incremental number.

When only a preview is desired, just type in:

```
python3 FSC.py -p your-image.jpg
```

repository: dominik-kopczynski/FSC

repo_name: dominik-kopczynski/FSC


text:
# Lane's Knowledge Repository

- Dev Ops
  * [Spinnaker](dev-ops/spinnaker.md)
- Docker
  * [Docker Login](docker/docker-login.md)
- [GNU Make](GNU-make/README.md)
- Linux
  * [Debugging](linux/debugging.md)
- [Low Level Programming](low-level-programming/README.md)
- Management
  * [Hiring](management/hiring.md)
  * [Repairing Broken Teams](management/repairing-broken-teams.md)
- [Neovim](neovim/README.md)
  * [coc.nvim](neovim/coc.nvim.md)
  * [vista.vim](neovim/vista.vim.md)
- [Observability](observability/README.md)
- Programming Language
  - [Go](programming-language/go/README.md)
    * [A Conversation With Go Modules](programming-language/go/a-conversation-with-go-modules.md)
    * [Basic Types](programming-language/go/basic-types.md)
    * [Database Libraries And ORM](programming-language/go/database-libraries-and-ORM.md)
    * [Debugging](programming-language/go/debugging.md)
    * [Go Modules](programming-language/go/go-modules.md)
    * [Logging](programming-language/go/logging.md)
    * [Terrible Things In Go](programming-language/go/terrible-things-in-Go.md)
    * [Testing](programming-language/go/testing.md)
    * [TUI Libraries](programming-language/go/TUI-libraries.md)
- [Size Coding](size-coding/README.md)
- Testing
  * [Integration](testing/integration.md)
  * [Move Fast Without Breaking Things](testing/move-fast-without-breaking-things.md)
  * [Testing Categories](testing/testing-categories.md)
- [Web Development](web-development/README.md)
  - [React](web-development/react/README.md)
    * [Hooks](web-development/react/hooks.md)
    * [Testing Hooks](web-development/react/testing-hooks.md)
  * [Css In Js](web-development/css-in-js.md)
  * [Css](web-development/css.md)

repository: lseppala/knowledge

repo_name: lseppala/knowledge


text:
# plantuml-themes
Color themes for PlantUML diagrams

* Tomorrow Night Eighties

![Tomorrow Night Eighties](https://github.com/gabrieljoelc/plantuml-themes/blob/master/tomorrow-night-eighties.png)

repository: gabrieljoelc/plantuml-themes

repo_name: gabrieljoelc/plantuml-themes


text:
# Exploring Bees

This project has a few main parts:
* Generating a world with resources and a way to sense them
* Creating a hive that can command bees to do certain tasks
* Creating bees that can be semi-autonomous
* Using deep learning to train the hive to find the most efficient way to maximize food, and minimize time to plunder the map.

Wishlist:
 - Search and sort functionality

repository: Nezgun/Exploring-Bees

repo_name: Nezgun/Exploring-Bees


text:
### Vert.x HTTP/2 showcase

This projects aims at showing [Vert.x](http://vertx.io) [HTTP/2](https://en.wikipedia.org/wiki/HTTP/2) capabilities.

To run the project, simply run `./gradlew run` from the project's root directory, then point your browser at [http://localhost:8080](http://localhost:8080) to get started.

Two HTTP servers are running:

* An HTTP/1.1 server running on http://localhost:8080
* An HTTP/2 server running on https://localhost:8443

They both are running the exact same code, the only difference is that the second one has been declared with a specific option : `setUseAlpn(true)`.

By default, when running on your local machine, a latency of 100ms is arbitrarily simulated. So that you can figure out the difference it makes in a real-life environment.
You can change the latency by clicking on the links on the right of the image, or by adding a query parameter named `latency` to the page's URL.

e.g. [http://localhost:8080/image.hbs?latency=999](http://localhost:8080/image.hbs?latency=999)

The project uses :
* [Vert.x](http://vertx.io)
* [Vert.x web](http://vertx.io/docs/#web)
* [Handlebars](https://github.com/jknack/handlebars.java) as template engine

Licensed under [Apache 2.0 license](http://www.apache.org/licenses/LICENSE-2.0)

Any contribution is welcome.

gha_language: Java


text:
# mros_reasoner

A meta-controller implementation for ROS1

## Installation

### Previous steps

#### Install java jre

The `mros_reasoner` uses  [Owlready2](https://owlready2.readthedocs.io/en/latest/index.html) to handle the ontologies and perform reasoning.

Owlready2 by default uses the [HermiT reasoner](http://www.hermit-reasoner.com/) which is written in Java, and thus you need a Java Vitual Machine to perform reasoning in Owlready2.

You can use this command **To install the Java Vitual Machine**

```console
sudo apt-get install openjdk-11-jre
```

Under Linux, Owlready should automatically find Java.

### Create reasoner_ws

- We recommend you to create a workspace only for `mros1_reasoner`, for example:

```console
  mkdir -p ~/mros1_reasoner_ws/src
  cd mros1_reasoner_ws
```

### Get mros1_reasoner and dependencies using wstool

- You need to copy the `mros1_reasoner` and its dependencies into the reasoner workspace (ie: `mros1_reasoner_ws`).

```console
  cd ~/mros1_reasoner_ws
  wstool init ~/mros1_reasoner_ws/src https://raw.githubusercontent.com/tud-cor/mc_mros_reasoner/master/mros1_reasoner/mros1_reasoner.rosinstall
  rosdep install --from-paths ~/mros1_reasoner_ws/src -y -i -r
```

**Note** The above `rosdep install` uses the `-r` argument in order to ignore possible errors. Please check the console output to make sure all dependencies are installed correctly.

### Build the code

- Once you have the workspace setup, you can build the workspace
- Do not forget to source ROS Melodic workspace before building your `mros1_reasoner_ws`

```console
source /opt/ros/melodic/setup.bash
catkin build
```

## User instructions

The mros1_reasoner node needs the following elements:

- an OWL model of the system to be metacontrolled. This can be manually created directly in OWL, e.g. using Protege, or it can be generated automatically from other models of the system ([rosin-experiments](https://github.com/rosin-project/rosin-experiments) provides a way to develop the model according to RosModel, and the script [`rosmodel2owl.py`](https://github.com/tud-cor/mc_mros_reasoner/blob/master/mros1_reasoner/scripts/rosmodel2owl.py) provides a way to transform it to OWL)
- monitoring and reconfiguration infrastructure for the given platform, e.g. for ROS1 reconfiguration capabilities are provided by [`ros_manipulator.py`](https://github.com/rosin-project/metacontrol_sim/blob/master/scripts/rosgraph_manipulator.py) and by the launchfiles in [metacontrol_move_base_configurations](https://github.com/rosin-project/metacontrol_move_base_configurations)

### Execution

Source your ws and launch the reasoner:

```console
source mros1_reasoner_ws/devel/setup.bash
roslaunch mros1_reasoner run.launch
```

### Testing

Two [rostest](http://wiki.ros.org/rostest) have been created for this package:

1. The **1-level functional architecture** test, which checks that the reasoner is capable of loading an `owl` file compliant with TOMAsys including:

    1. a Function and multiple FDs that solves it.
    1. QA performance values for the FDs.

    To run this first test use:

    ```console
    source mros1_reasoner_ws/devel/setup.bash
    rostest mros1_reasoner test_level_1_functional_arch.test
    ```

1. The **QA reception** test, checks wheter or not the reasoner can correctly receive a QA value and update it on its knowledge base.

    To run this second test use:

    ```console
    source mros1_reasoner_ws/devel/setup.bash
    rostest mros1_reasoner test_qa_reception.test
    ```


text:
# `.equals(node) => Boolean`

Returns whether or not the current wrapper root node render tree looks like the one passed in.

#### Arguments

1. `node` (`ReactElement`): The node whose presence you are detecting in the current instance's
render tree.

#### Returns

`Boolean`: whether or not the current wrapper has a node anywhere in it's render tree that looks
like the one passed in.

#### Example

```jsx
function MyComponent() {
  return <div className="foo bar" />;
}

const wrapper = shallow(<MyComponent />);
expect(wrapper.equals(<div className="foo bar" />)).to.equal(true);
```

#### Common Gotchas

- `.equals()` expects a ReactElement, not a selector (like many other methods).
- Keep in mind that this method determines equality based on the equality of the node's children as
well.
- Following React's behavior, `.equals()` ignores properties whose values are `undefined`.

repository: enzymejs/enzyme

repo_name: enzymejs/enzyme


text:
---
description: Fixing tests
---

# How to fix the tests locally ?

Switching branches or changing npm packages can provoke the tests to fail.
A quick fix is to reinstall the packages, clean the cache of hardhat with those commands:

```bash
yarn && yarn hardhat clean && yarn compile && yarn test
```

repository: autodexnetwork/sandbox-smart-contracts

repo_name: autodexnetwork/sandbox-smart-contracts


text:
Subaru

Features

Custom prefix

Autoroles

AFK messages

Autoroles

Music

Easy emoji management

Image commands

wip currency system

Simple utilities

Basic moderation

Other shit

Note: I Can call anything a feature if I want to

Self-Hosting

Subaru was made with the intention to be easy to self-host. Things you'll need:

Node.js

	That should be about it....
	Now download this repo either by doing git clone Or by downloading it manually.

Editing the config

Once downloaded make a copy of config/config.js.example and name it config.js. Here you should choose your preferred prefix and set your token. You can get your bot token here by creating a bot application if you haven't already. At the admin space enter your own id. Mentioning yourself with a \ in front displays it. What show_invite does is if anyone runs bot command an invite for the bit will display depending on the value of that setting. Set to false if you don't want anyone to be able to invite the bot to their server. The rest of the settings are API keys, without these the bot won't be able to communicate with some services. If these are left at false the bot will automatically disable any command using these services.

Installing the dependencies

When you installed node.js you also installed npm which we'll use to install some packages. Simply run npm install in the root of the Subaru folder.  Then rerun npm install. When on linux you should install build-essential from your package manager.

Running the bot

After inviting the bot with this tool we can finally run the bot. We must do so with a terminal located in Subaru's root directory and running node . You should see some fun stuff popping up in the console. When there are no errors you should be good to go!

Links:

Trello board

Discord Bots list

Invite

Developer

LevitatingBusinessMan#0504

repository: asadmarcus/Subaru

repo_name: asadmarcus/Subaru


text:
# Telepresence Robot
### A robot controlled via voice to roam around following actions uttered via the user in the vicinity of Google Home, an AI engine. User experience is made available to a remote area using webRTC, i.e the Telepresence Bot can be controlled as well as monitored from any remote corner around the globe.

# Deploy to:
[![Deploy to Heroku](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)

# What does the service do?
It's a simple echo service that takes `resolvedQuery` and `action` fields from the dialogflow.com JSON reponse and echoes them back in into `speech` and `displayTest` fields in the fulfillment JSON.