text:
---
id: 527
title: 'Episode #13 – 007 James Bond Special & Skyfall Revisited'
date: 2013-10-14T19:10:08+00:00
author: Nick Schlegel
layout: post
guid: http://www.thatsawrapshow.com/?p=527
permalink: /2013/10/14/episode-13-007-james-bond-special-skyfall-revisited/
enclosure:
  - |
    http://traffic.libsyn.com/thatsawrap/TAW13final.mp3
    41698036
    audio/mpeg
    a:2:{s:8:"duration";s:8:"01:26:13";s:8:"explicit";s:1:"1";}
categories:
  - Uncategorized
tags:
  - "007"
  - cold war
  - daniel craig
  - espionage
  - film
  - fleming
  - james bond
  - skyfall
---
**Episode #13
******************

  Note:  We had severe audio difficulties that were unknown to us until we were in post.  As a result, we have had to makes some edits to the content.  We sincerely apologize for this calamity and are taking measures to ensure that this does not happen again.

  <img class="aligncenter  wp-image-532" style="border-width: 2px; border-color: black; border-style: solid;" alt="007-Legends-logo" src="http://www.thatsawrapshow.com/wp-content/uploads/2013/10/007-Legends-logo-1024x768.jpg" width="584" height="438" srcset="http://www.thatsawrapshow.com/wp-content/uploads/2013/10/007-Legends-logo-1024x768.jpg 1024w, http://www.thatsawrapshow.com/wp-content/uploads/2013/10/007-Legends-logo-300x225.jpg 300w, http://www.thatsawrapshow.com/wp-content/uploads/2013/10/007-Legends-logo-400x300.jpg 400w, http://www.thatsawrapshow.com/wp-content/uploads/2013/10/007-Legends-logo.jpg 1600w" sizes="(max-width: 584px) 100vw, 584px" />

    2012 marked the 50th Anniversary of James Bond on Film.  Join Erik, Nick and Chris they discuss all things Bond: the legacy and continuing relevance of this famed literary and cinematic character.  As a lifelong Bond fanatic, I (Nick) am very proud of our discussion (audio warts and all) and our discussion of last year’s spectacular SKYFALL.  Cue Bond Theme – play us out Monty…

    Links mentioned:

    Bond at 50 (SFX series – impeccable retrospective)

    James Burlingame’s book on Music in Bond films

    One of the Bond theme song compilation albums

    Alamo Drafthouse Phone Message Video

    Articles mentioned in Segment 2 on Audiences in the theater:

    – Audiences in Horror Films

    – From Russia with Love isn’t unsophisticated. You are.

    http://vimeo.com/53372914

  <audio class="wp-audio-shortcode" id="audio-527-13" preload="none" style="width: 100%;" controls="controls"><source type="audio/mpeg" src="http://media.blubrry.com/thatsawrap/p/traffic.libsyn.com/thatsawrap/TAW13final.mp3?_=13" />http://media.blubrry.com/thatsawrap/p/traffic.libsyn.com/thatsawrap/TAW13final.mp3</audio>

  Podcast: Play in new window | Download (Duration: 1:26:13 — 39.8MB) | Embed

  <input id="powerpress_embed_527-podcast_t" type="text" value="" onclick="javascript: this.select();" onfocus="javascript: this.select();" style="width: 70%;" readOnly />

  Subscribe: iTunes | Android | RSS | More


text:
# Bowie Shoreline v1.0

![Robot Missions logo, a green leaf on a white diamond situated within a purple circle](http://robotmissions.org/images/github/robot_missions_colour_500px.png)

Bowie Shoreline is for the [Robot Missions](http://robotmissions.org) introductory robot platform, _Bowie_, as applied to Mission #1: Shoreline Cleanup. This contains behaviours that use the core modules in the Bowie Library.

### More information about our robot platform at the [Robot Missions Website ➞](http://robotmissions.org)

Compatible with the Robot Missions Brain Board, using either a [Teensy 3.6](https://www.pjrc.com/store/teensy36.html) for full functionality (Mega), or a [Teensy 3.2](https://www.pjrc.com/store/teensy32.html) (Mini).

## System Diagram

![System diagram showing the information flow between core modules](http://robotmissions.org/images/github/BowieShorelineFirmware_web.jpg)

## Required Libraries

You will need to have these libraries installed:

* [BowieLib](https://github.com/RobotMissions/BowieLib)
* [Streaming](http://arduiniana.org/libraries/streaming/)
* [PromulgateBig](https://github.com/RobotGrrl/PromulgateBig)
* [Xbee](https://github.com/andrewrapp/xbee-arduino)
* [SD](https://www.arduino.cc/en/Reference/SD)
* [TimeLib](https://www.pjrc.com/teensy/td_libs_Time.html)
* Servo _Included with Arduino_
* SPI _Included with Arduino_

## API

Below you will find the messages that can be input to the robot, and messages the robot can output. To review how messages are sent through the communications interface, please see [this section of the Bowie Lib](https://github.com/RobotMissions/BowieLib#comms-messages).

**Input: Operator to Robot**

| Description | Action specifier | Command | Key | Value |
| --- | --- | --- | --- | --- |
| **Left motor** | `#` | `L` | `1` is forward, `0` is backward | `0` is slowest, `255` is fastest |
| **Right motor** | `#` | `R` | `1` is forward, `0` is backward | `0` is slowest, `255` is fastest |
| **Arm** | `#` | `S` | `1` for up, `0` for down | Value to increment the position by |
| **Scoop** | `#` | `C` | _TBD_ | _TBD_ |
| **Button #1 (Red)** | `#` | `P` | `1` is pressed on, `0` is pressed off | _None_ |
| **Button #2 (Yellow)** | `#` | `Y` | `1` is pressed on, `0` is pressed off | _None_ |
| **Button #3 (Green)** | `#` | `G` | `1` is pressed on, `0` is pressed off | _None_ |
| **Button #4 (White)** | `#` | `W` | `1` is pressed on, `0` is pressed off | _None_ |
| **Button #5 (Blue)** | `#` | `B` | `1` is pressed on, `0` is pressed off | _None_ |
| **Button #6 (Black)** | `#` | `N` | `1` is pressed on, `0` is pressed off | _None_ |
| **Super Bright LEDs** | `#` | `Q` | `1` is front left TODO | `0` is off, `255` is full brightness |
| **Joystick Button** | `#` | `J` | `1` is pressed on, `0` is pressed off | _None_ |
| **Mode Switch** | `#` | `M` | _TBD_ | _TBD_ |
| **State** | `#` | `Z` | _TBD_ | _TBD_ |
| **Operator ID** | `$` | `X` | `1` | `OPERATOR_ID` from `0` to `255` |

**Output: Robot to Operator**

| Description | Action specifier | Command | Key | Value |
| --- | --- | --- | --- | --- |
| **Motor Current Sensor** | `#` | `E` | `1` | Current sensor reading of type `uint16_t` |
| **Servo Current Sensor** | `#` | `F` | `1` | Current sensor reading of type `uint16_t` |
| **Robot ID** | `$` | `W` | `1` | `ROBOT_ID` from `0` to `255` |
| **Reserved for testing** | `@` | `Z` | `0` | `0` |

If your robot running Mission #1 needs more functionality, feel free to add new API commands. For example, one could add an API command for an output of the IMU.

## License

Code is released under the [MIT license](https://opensource.org/licenses/MIT).

## Bug Reports / Feature Requests

Found a bug? Looking for a feature? Let us know by opening an Issue report. Further questions can be posted to our [forum](http://forum.robotmissions.org).

---

🤖✌🌎

**Robot Missions - Helping the planet with robots**

license: MIT

repository: RobotMissions/BowieShoreline

branch_name: refs/heads/master

extension: md

gha_license_id: MIT

license_type: permissive

repo_name: RobotMissions/BowieShoreline


text:
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "netbox_virtualization_vm_primary_ip Resource - terraform-provider-netbox"
subcategory: ""
description: |-
  Manage a primary ip assignment for a VM (virtualization module) resource within Netbox.
---

# netbox_virtualization_vm_primary_ip (Resource)

Manage a primary ip assignment for a VM (virtualization module) resource within Netbox.

## Example Usage

```terraform
resource "netbox_virtualization_vm_primary_ip" "name" {
  virtualmachine_id = netbox_virtualization_vm.vm_test.id
  primary_ip4_id = netbox_ipam_ip_addresses.ip_test.id
  primary_ip6_id = netbox_ipam_ip_addresses.ip6_test.id
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `virtualmachine_id` (Number) ID of the virtual machine.

### Optional

- `primary_ip4_id` (Number) ID of the primary IPv4 address.
- `primary_ip6_id` (Number) ID of the primary IPv4 address.

### Read-Only

- `id` (String) The ID of this resource.

## Import

Import is supported using the following syntax:

```shell
# Virtual machine primary IP assignments can be imported by virtual machine id
terraform import netbox_virtualization_vm_primary_ip.name 1
```

license: ISC

repository: smutel/terraform-provider-netbox

gha_language: Go

gha_license_id: ISC

repo_name: smutel/terraform-provider-netbox


text:
# STIM 300
https://www.sensonor.com/products/inertial-measurement-units/stim300/

## Dependensies

https://github.com/ros-drivers/rosserial

Run with:

    rosrun driver_stim300 stim300_driver_node

or to run the entire visual inertial sensor:

    roslaunch usm_stim300_driver usm_VI_sensor.launch

see launch file for available parameters.

## Comunicate with teensy

The teensy can be controlled by sending a ros message at the /VI_command topic. The first number, command, can be either 0 or 1 to turn it on or off, if 1 the second number, data, represents the number of imu messages between each image. The IMU rate is 125 Hz, the default is 7 imu messgages for each image, giving fps = 125/7 = 17.85.

    rostopic pub /VI_command usm_stim300_driver/UInt8UInt8 "command: 1 data: 7" -1

## Firmware

The firmaware code is designed for teensy 3.2 microcontroller using the arduino framework.
To program the microcontroller follow these steps:

* Set up arduino with the Teensyduino plugin, see https://www.pjrc.com/teensy/teensyduino.html.
* Build the rospackage ````catkin build --this ````
* Delete the old arduino ros_lib ```rm -r ~/Arduino/libraries/ros_lib```
* Create and export the ros_lib to your arduino library folder
    ```rosrun rosserial_arduino make_libraries.py ~/Arduino/libraries```
* Open firmware/stim300_driver/stim300_driver.ino in the arduino IDE and upload to the teensy microcontroller.

## Communicate with STIM300 over terminal
For testing and configuration during development it can be useful to comunicate with the STIM300 IMU directly over terminal.
Here is a simple example for how to that using minicom.

Install minicom:

    sudo apt-get install minicom

Look for device:

    dmesg | grep tty

Open minicom with setings:

    sudo minicom -s

Setup minicom for stim300:

Serial port setup:

    A - Serial Device: /dev/ttyUSB0
    E - 921600 8N1
    F - Disable hardware flow control

Modem and dialing: (Clear option A...I)

    A -
    * -
    * -
    * -
    I -

Screen and keyboard:

    P - Add linefeed

Save setup as dfl then Exit minicom, and enter again in hex display mode:

    sudo minicom -H

The stim300 is in normal mode and will reapeatidly send the standard datagram.

Enter service mode: write "SERVICEMODE" and press enter

    SERVICEMODE

Clear the screen:

    Ctrl-A c

If the incomming datagram feed stopped it means you enter service mode sucsessfully. While in service mode the stim 300 will comunicate with asci characters. Exit minicom and enter in normal ASCI mode:

    Ctrl-A x
    sudo minicom

Write ? and press enter, and the STIM300 should send info about available commands

    ?

This will show a list on available commands including how to go back to normal mode. For example:

    c

 will perform a system check.


text:
---
toc: true
layout: post
description:
categories: [markdown, inquiry-based-learning, recall]
title:  What do I remember about Kalman filters?
keywords: robotics, computer-vision
categories: [blurb]
tags: blurb
search_exclude: false
---

# What do I remember about Kalman Filters...

### What are Kalman filters

Core idea: Kalman filters are used to combine different measurements of some state, make use of the the variance of each measurements errors distribution to make a "best" guess.  An unbiased estimator?

Kalman filters are used to solve the problem: how to track a moving object.

More abstractly, Kalman filters are a way to track state when we have one or several measurements of the state, from possibly different sensors with different error distributions, as well as knowing the previous state.

Always working with gaussian errors allows us to to stay in a space.  Gaussian distributions are a "closed" space under addition and scalar multiplication.  If our way of combining distributions makes use of only these operations, then maybe we can always add information as it comes in.

### Questions about Kalman Filters

Are there any restrictions on our motion model?

If there are restrictions on our motion model, what sort of problems have motion models that allow Kalman Filters to be applicable, and which don't?

Is applying a Kalman filter in some sense the "optimal" way to make use of the information we have in order to infer the state of the object?

Are predictions by our motion model treated any differently from another sensor providing a measurement when we combine our information to make an estimate of state with the Kalman filter?  How much weight do we give to our model vs our measurements?

### Trying to reconstruct the gist of Kalman filters

Say we have two measurements $m_1, m_2$ with gaussian error terms, $\epsilon(0, \sigma_1), \epsilon(0, \sigma_2)$, or alternatively written $m_1 \sim N(\mu_1, \sigma_1)$, and if $m_2$ is measuring the same thing and it is unbiased, $m_1 \sim N(\mu_1, \sigma_2)$.  I can't imagine we would be able to do anything if the errors where unbiased ($\mu \neq 0$).  How would we combine these two measurements in a way that gave an unbiased estimator?  One might be to just take an average

$$ \frac{m_1 + m_2}{2} $$

and the estimator would be unbiased, since $E(\frac{m_1 + m_2}{2}) =  0$.  However, is this the really the best we can do?  What if the variance of the second measure is huge, and the first measurement has nearly no variance?  Our intuition would be to almost just take the first measurement and forget the second, or at least heavily weight towards the first.  Why?  Because the first has much lower variance.  So can we combine the measurements in a way such that the variance of the combined variance is lower than the variance of either of the measurements on the their own?

$$
\begin{aligned}
Var(m_1 + m_2) &= \sum ((m_1 + m_2) - (u_1 + u_2))^2p(m_1, m_2) \\
  &= \sum((m_1 - u_1) + (m_2 - u_1))^2p(m_1, m_2)
\end{aligned}
$$

Continuing to expand the lhs term in the product

$$
\begin{aligned}
&= \sum_{m_1,m_2 \in D} \big [(m_1 - u_1)^2 + (m_2 - u_2)^2 + (m_1 - u_1)(m_2 - u_2)\big ]p(m_1, m_2) \\
&= \sigma_1^2 + \sigma_2^2 + 2\sum_{m_1}\sum_{m_2} (m_1 - u_1)(m_2 - u_1)p(m_1, m_2)
\end{aligned}
$$

but that last term is just 2 times the covariance of $m_1$ and $m_2$!

<details>
<summary>tangent</summary>
We can actually continue this step to expand the covariance to find a formula of covariance in terms of expected values.
$$
\begin{aligned}
= \sigma_1^2 + \sigma_2^2  + 2u_1^2 + \sum_{m_1}\sum_{m_2} (m_1m_2 - (m_1 + m_2)u_1)p(m_1, m_2) \\
&= \sigma_1^2 + \sigma_2^2  + u_1^2 - u_1E(m_1) -u_1E(m_2) + E(m_1m_2) \\
&= \sigma_1^2 + \sigma_2^2  - u_1^2 + E(m_1m_2)
\end{aligned}
$$
And to reduce $E(m_1m_2)$ further,
$$E(u_1 + \epsilon(0, \sigma_1)(u_1 + \epsilon(0, \sigma_2))) \\
= E(u_1^2 + \epsilon_2u_1, + \epsilon_1u_2 + \epsilon_1\epsilon_2)\\
= E(u_1^2) + E(\epsilon_1\epsilon_2))\quad \text{by linearity and $E(\epsilon_i) = 0$}$$

If $\epsilon_1$ and $\epsilon_2$ are independent, then $E(\epsilon_1\epsilon_2) = 0$, because we can write $p(m_1,m_2)$ as $p(m_1)p(m_2)$ and

$$\sum_{\epsilon_1}\sum_{\epsilon_2} \epsilon_1 \epsilon_2 p(m_1)p(m_2) = \sum_{\epsilon_1}\epsilon_1 p(m_1)E(\epsilon_1) = 0 $$
</details>

Here's the thing.  If the covariance of these errors is zero, then our equation is much simplified.  We'll just have to remember later to keep this assumption in mind when we start to apply this to real-world problems.

But remember, we wanted to take a linear combination of these two measurements.  Because $Var(am_1) = a^2Var(m_1)$, we have

$$ Var(\lambda m_1 + (1 - \lambda) m_2) = \lambda^2 \sigma_1^2 + (1 - \lambda)^2 \sigma_2^2 $$

We parametrize our linear combination of measurements this way, because it is the only way to create an unbiased estimator if $\lambda$ is to be our coefficient of $m_1$.  If we want to minimize the variance, we need to solve for the derivative with respect to $\lambda$

$$
2\lambda \sigma_1^2 - 2(1 - \lambda)\sigma_2^2 = 0 \implies \left (\frac{1}{\lambda} - 1\right)
= \left ( \frac{\sigma_1}{\sigma_2} \right) \\ \implies \lambda = \frac{1}{\left(\frac{\sigma_1}{\sigma_2}\right) + 1}
$$

A quick check with our intuition also tells us this seems right - if two measurements have the same variation in the error, our formula for $\lambda$ tells us they should be equally weighted.  If the relative variance of $m_1$ is much lower, our $\lambda$ approaches 1, telling us to pretty much just use measurement 1 and ignore the second measurement.

However, notice in what we've done so far, we haven't needed to assume our error is gaussian.  All we've assumed is that our measurements are unbiased, and that the errors have zero covariance.

Now let's apply this to an example.

Thoughts for example here:
- temperature datasets - combining satellite and ground-station measured temperatures

### Adding in additional measurements as they come (or "realtime" filtering)

Let's say we're trying to measure some quantity that doesn't vary over time, or vary very much other a short time period over which we're taking consecutive samples.  It could be something like sticking a thermometer in the ocean and reading out measurements every minute for an hour to try and get an accurate picture of ocean temperature in that place.  Perhaps this isn't such a great example, because the ocean isn't uniform enough in temperature, with currents, solar radiation of the top layer, tides, etc.

Perhaps let's contrive an example out of something we know is constant.  Like the force of gravity at sea level at the lattitude of the equator.  Now suppose every day we drop the same rubber ball 10 feet until some sensor detects it hits ground level.  Our sensor is unbiased, but it's error has variance $0.2s^2$.  We want to keep performing this experiment until we have an estimate of the gravitational constant with variance $10^-3$.  How many times do we repeat this experiment?

One way of doing this is to repeat the experiment, at each iteration finding some way to combine the variance of the current best estimate with the current trial.  If at iteration $i$ our best estimate is $c_i$ with variance $\sigma_i$, we can treat this as if we just made a observation $c_i$ with a instrument that had error variance $\sigma_i$, and apply the above formula.

### Kalman filtering for multiple variables

Now suppose instead of measuring just temperature, we're measuring temperature and current flow at a stationary bouy in the ocean.

Notice that, while we could treat each of the variables separately, we're missing out on some possibly important information.  That is, it is likely that temperature and flow are correlated in this scenario.  Perhaps the bouy is in an inlet, where water warms up, and hence when the tide flows out it is warmer than when it flows in.

To get a complete picture of variation in our system, we look at something called the covariance matrix.  We generalize our notion of covariance from one dimension

$$ E[(m_1 - \mu_1)^2)]$$

to multiple dimensions

$$\mathbf
E[(\vec{m} - \vec{\mu})(\vec{m} - \vec{\mu})^T]
$$

Or written in matrix form in 2 dimensions:

$$
\sum_{\vec{m}} \begin{bmatrix} (m_1 - \mu_1)^2 & (m_1 - \mu_1)(m_2 - \mu_2) \\ (m_1 - \mu_1)(m_2 - \mu_2) & (m_2 - \mu_2)^2 \end{bmatrix}p(\vec{m})
$$

Now, we'll repeat the investigation that we made early in this higher-dimensional space. What's the covariance matrix of two measurements added together?

$$\begin{aligned}
\mathbf E[(\vec{m + n} - (\vec{\mu_m + \mu_n}))(\vec{m + n} - (\vec{\mu_m + \mu_n}))^T] \\
&= \sum_{\vec{m}}
  \begin{bmatrix}
    (m_1 + n_1 - (\mu_{m_1} + \mu_{n_1}))^2 & (m_1 + n_1 - (\mu_{m_1} + \mu_{n_1}))(m_2 + n_2 - (\mu_{m_2} + \mu_{n_2})) \\
    (m_1 + n_1 - (\mu_{m_1} + \mu_{n_1}))(m_2 + n_2 - (\mu_{m_2} + \mu_{n_2})) & (m_2 + n_2 - (\mu_{m_2} + \mu_{n_2}))^2
  \end{bmatrix}
p(\vec{m})
\end{aligned}
$$

Yikes.  That's looking like a handful to make sense of at first sight.  However, if we look at just the diagonal entries, each one just repeats the signle-dimensional case we did earlier of calculating variance for two measurements added together.  If we again make the assumption that measurements $m_i$ and $n_i$ are pairwise uncorrelated (have zero covariance), then each diagonal entry simplifies to $\sigma_{m_i}^2 + \sigma_{n_i}^2$.  The off-diagonal entries measure the cross-correlation between variables $m_i$ and $n_j$.  Should these as well be zero?  Our intuition says yes, given our example ----.

It's possible that we have non-zero covariance on the non-diagonals though.  Intuitively, remember our tidal example from above.  Adding together the temperature/flow vectors from two different instruments will maintain a covariance between summed temperature and summed vector flow values.

However, we're confusing two different notions here.  One is that current flow and temperature are related, and hence should show a correlation.  The other is that, at a given point in time where we assume that there is a fixed flow and temperature, two instruments (really, likely four), one providing measure $\vec{m}$ and the other providing measurement $\vec{n}$ have uncorrelated errors, both in components with the same indice, but also between components with different indices (e.g. flow $m_2$ measured from instrument 1 and temperature $n_1$ from instrument 2 should remain uncorrelated).

Instead of describing our estimator as a linear combination of measurements, we can also describe it as a linear operator (matrix) on our measurements

$$ \vec{y} = A_{\vec{m}}\vec{m} + A_{\vec{n}}\vec{n} $$

where the matrices are diagonal.

$$
\begin{aligned}
&\sigma^2_{m_1 + n_1, m_2 + n_2}\\
=&\sum_{m_1,n_1}(m_1 + n_1 - (\mu_{m_1} + \mu_{n_1}))(m_2 + n_2 - (\mu_{m_2} + \mu_{n_2}))p(m,n)\\
=&\sum_{m_1,n_1}((m_1 - \mu_{m_1}) + (n_1 - \mu_{n_1}))((m_2- \mu_{m_2}) + (n_2 - \mu_{n_2})))p(m,n)\\
  =&\sum_{m_1,n_1} \big [(m_1 - \mu_{m_1})(m_2 - \mu_{m_2}) \\
  & \quad\quad - (m_1 - \mu_{m_1})(n_1 - \mu_{n_1})\\
  & \quad\quad- (m_2 - \mu_{m_2})(n_2 - \mu_{n_2}) \\
  & \quad\quad + (n_1 - \mu_{n_1})(n_2 - \mu_{n_2}) \big ]p(m_1, n_1)\\
=& \sigma^2_{m_1 m_2} - \sigma^2_{m_1 n_2} - \sigma^2_{n_1 m_2} + \sigma^2_{n_1 n_2}
\end{aligned}
$$

repository: rjbergerud/journal

gha_language: Jupyter Notebook

repo_name: rjbergerud/journal


text:
---
layout: post
title:  "Migrate Database From SQLite To PostgreSQL"
date:   2017-07-26 00:00:00 +0800
category: programming
tags:
  - python
  - django
  - postgresql
---

Task

I have a djagno project which has been developed on sqlite database on my local machine (it's easy and fast!)

We need to move it to production environment, which is running on PostgreSql.

Step 1. dump the data from sqlite db

used `python manage.py dumpdata --indent=2 > ~/dump.json` to dump the data out

Step 2. Get content type data in SQL format

we use python to generate the SQL components
```
from django.contrib.contenttypes.models import ContentType

content_type_data = []
for content_type in ContentType.objects.all():
    row = "({i.id}, '{i.app_label}', '{i.model}')".format(i=content_type)
    content_type_data.append(row)

```

so here we have the content types
```
print(',\n'.join(content_type_data))

(1, 'admin', 'logentry'),
(3, 'auth', 'group'),
(4, 'auth', 'permission'),
(5, 'contenttypes', 'contenttype'),
...
```

```
from django.contrib.auth.models import Permission
permission_data = []
for permission in Permission.objects.all():
    single_data = "{i.id}, '{i.name}', '{i.content_type_id}', '{i.codename}'".format(i=permission)
    permission_data.append(single_data)

```
here wre have the permissions

```
print(',\n'.join(permission_data))
(1, 'Can add log entry', 1, 'add_logentry'),
(2, 'Can change log entry', 1, 'change_logentry'),
(3, 'Can delete log entry', 1, 'delete_logentry'),
(7, 'Can add group', 3, 'add_group'),
...
```

Step3. create the PostgreSQL db using django admin

```
python manage migrate
```

noted that this would create the content type as well as permission by default. we need to override those from PSQL

```
BEGIN;

SET CONSTRAINTS ALL DEFERRED;

DELETE FROM django_content_type;

INSERT INTO django_content_type (id, app_label, model) VALUES
(1,  'admin',  'logentry'),
(3,  'auth',  'group'),
(4,  'auth',  'permission'),
(5,  'contenttypes',  'contenttype'),
...

DELETE FROM auth_permission;

INSERT INTO auth_permission (id, name, content_type_id, codename) VALUES
(1, 'Can add log entry', 1, 'add_logentry'),
(2, 'Can change log entry', 1, 'change_logentry'),
(3, 'Can delete log entry', 1, 'delete_logentry'),
...

```

Step4. need to update the sequences for content type and permission

```

truuue_commercial_db=# alter sequence django_content_type_id_seq restart with 64;
ALTER SEQUENCE

truuue_commercial_db=# select max(id) from auth_permission;
 max
-----
 189
(1 row)

truuue_commercial_db=# alter sequence auth_permission_id_seq restart with 190;
ALTER SEQUENCE

```

Step5. load the rest of the data into db using django manager

```
python manage.py loaddata < dump.json
```


text:
---
layout: post
author: viridi
title: multiple linear regression
mathjax: true
ptext: false
x3dom: false
threejs: false
oo: false
category: math
tags: ["regression", "linear", "multiple"]
date: 2021-02-25 03:54:00 +07
permalink: /math/multiple-linear-regression
---
A linear approach in statistics to model the relationship between a scalar response (dependent variable) and more than many explanatory variables (independent variables) is known as multiple linear regression [[1](#ref1)].

## data set
Supposed that there is a data set [[2](#ref2),[3](#ref3)] of $N$ statistical unit [[4](#ref4)]

\begin{equation}
\label{eqn:mlr-data-set}
\\{y_i, x_{i1}, x_{i2}, \dots, x_{iM}\\}_{i = 1}^N,
\end{equation}

where the relation between dependent variable $y$ and regressor $\mathbf{x}$ is linear, where $x$ is a $M$- dimensional vector [[5](#ref5)].

## linear equation
From a linear equation of $M$ unknown variables [[6](#ref6)] we can write

\begin{equation}
\label{eqn:mlr-linear-equation}
y_i = \sum_{j = 1}^M x_{ij} c_j,
\end{equation}

for the each data $i$ with $\\{c_j\\}_{j = 1}^M$ are coefficients to be found.

## least square
For a linear regression line in the form of

\begin{equation}
\label{eqn:mlr-linear-equation-2}
y = c_0 + c_1 x,
\end{equation}

we can use least square, where the example data [[7](#ref7)] and code [[8](#ref8)] are available. And the coefficients are

\begin{equation}
\label{eqn:mlr-linear-equation-2-c0}
c_0 = \bar{y} - c_1 \bar{x}
\end{equation}

and

\begin{equation}
\label{eqn:mlr-linear-equation-2-c1}
c_1 = \frac{\displaystyle \sum_{i = 1}^N (x_i - \bar{x})(y_i - \bar{y})}{\displaystyle \sum_{i = 1}^N (x_i - \bar{x})^2}
\end{equation}

for $N$ data, where $\bar{x}$ and $\bar{y}$ are average of $x$ and $y$, respectively.

## model
From model for one unknown variable in Eqn. \eqref{eqn:mlr-linear-equation-2}, we can extend it to $M$ unknown variables

\begin{equation}
\label{eqn:mlr-linear-equation-M}
y = c_0 + c_1 x_1 + c_2 x_2 + \dots + c_M x_M,
\end{equation}

that will turn Eqn. \eqref{eqn:mlr-linear-equation} into

\begin{equation}
\label{eqn:mlr-linear-equation-model}
p_i = c_0 + \sum_{j = 1}^M x_{ij} c_j
\end{equation}

with additional term $c_0$. We can see $p_i$ as predicted value of $y_i$ using the model.

## quadratic loss function
To represent the difference between observation data $y_i$ and predicted value $p_i$ obtained from the model in Eqn. \eqref{eqn:mlr-linear-equation-model} we can use quadratic loss function

\begin{equation}
\label{eqn:mlr-loss-function-i}
\varepsilon_i = (y_i - p_i)^2,
\end{equation}

for every data $i$ from our data set as in Eqn. \eqref{eqn:mlr-data-set}. Then there are coefficients

\begin{equation}
\label{eqn:mlr-linear-equation-model-coefficients}
\\{c_j\\}_{j = 0}^M
\end{equation}

to be determined by minimizing sum of Eqn. \eqref{eqn:mlr-loss-function-i} for all data with respect to the coefficients

\begin{equation}
\label{eqn:mlr-linear-equation-model-coefficients-minimizing}
\\left\\{\frac{ \partial \varepsilon}{\partial c_j} = 0 \\right\\}_{j = 0}^M
\end{equation}

with

\begin{equation}
\label{eqn:mlr-loss-function}
\varepsilon = \sum_{i =1}^N \varepsilon_i
\end{equation}

is loss error in the model. Using Eqns. \eqref{eqn:mlr-loss-function-i} and \eqref{eqn:mlr-linear-equation-model}, Eqn. \eqref{eqn:mlr-loss-function} will be as follow

\begin{equation}
\label{eqn:mlr-loss-function-detail}
\varepsilon = \sum_{i =1}^N \left( y_i - c_0 - \sum_{j = 1}^M x_{ij c_j} \right)^2,
\end{equation}

which will be minimized through Eqn. \eqref{eqn:mlr-linear-equation-model-coefficients-minimizing}.

## exercises
1. Statistical unit of a data set $i$ is $\\{y_i, x_i\\}$ and the data are $(3, 0)$, $(5, 1)$, $(7, 2)$, $(9, 3)$, $(11, 4)$, and $(13, 5)$. If the relation between independent variable $x$ and the dependent variable is assumed as in Eqn. \eqref{eqn:mlr-linear-equation-2}, use Eqns. \eqref{eqn:mlr-linear-equation-2-c1} and \eqref{eqn:mlr-linear-equation-2-c0} to find $c_1$ and $c_0$.

## references
1.  Wikipedia contributors, "Linear regression", Wikipedia, The Free Encyclopedia, 16 Feb 2021, 07:19 UTC, <https://en.wikipedia.org/w/index.php?oldid=1007058436> [20210225].
2. Adam Ross Nelson, "What Is A Data Set?", Towards Data Science,
27 Jan 2020, url <https://towardsdatascience.com/what-is-a-data-set-9c6e38d33198> [20210225].
3. U.S. Geological Survey, "https://www.usgs.gov/faqs/what-are-differences-between-data-a-dataset-and-a-database", USGS, url <> [20210225].
4. -, "Definition Statistical unit", Statista, url <https://www.statista.com/statistics-glossary/definition/372/statistical_unit/> [20210225].
5. Christopher Stover, Eric W. Weisstein, "n-Vector", from MathWorld--A Wolfram Web Resource, url <https://mathworld.wolfram.com/n-Vector.html> [20210225].
6. Wikipedia contributors, "Linear equation", Wikipedia, The Free Encyclopedia, 24 Feb 2021, 14:22 UTC, <https://en.wikipedia.org/w/index.php?oldid=1008679832> [20210225].
7. Andrew Lee, "Calculating a Least Squares Regression Line: Equation, Example, Explanation", Technology Networks, 21 Aug 2020, url <https://www.technologynetworks.com/informatics/articles/calculating-a-least-squares-regression-line-equation-example-explanation-310265> [20210225].
8. Adarsh Menon, "Linear Regression Using Least Squares", Towards Data Science, 8 Sep 2018, url <https://towardsdatascience.com/linear-regression-using-least-squares-a4c3456e8570> [20210225].
9. Wikipedia contributors, "Loss function", Wikipedia, The Free Encyclopedia, 29 Dec 2021, 12:30 UTC, <https://en.wikipedia.org/w/index.php?oldid=996973613> [20210225].

+ [Article history](https://github.com/butiran/butiran.github.io/commits/master/_posts/math/2021-02-25-multiple-linear-regression.md)

gha_language: JavaScript


text:
#  Search As You Type

The idea behind this it to create a reusable solution using **combine** for consulting a Search API as you type a query.

### Main points:
* Don't start searching until a minimun characters (3 will be fine) is reached.
* Avoid duplicates if posible.
* Delay or debounce the request so calls are not done for each character but instead after a given time. (300 to 500 millisecons will be fine).
* Cancel in flight request when a new one is trigered.

For the UI only show a text result for the seach.

[01-SeachAsYouTypeView](../CaseStudies/01-SeachAsYouTypeView.swift)

branch_name: refs/heads/main


text:
ChefDK
------
This cookbook was created with the ChefDK, available here:
https://downloads.chef.io/chef-dk/

Adding platform support
-----------------------------
- Add the platform `platforms` section in .kitchen.yml or .kitchen.cloud.yml
- Add the platform to the `includes` attributes in the `suites`
  section of .kitchen.yml or .kitchen.cloud.yml
- Make sure the platform shows up when doing `kitchen list`
- Run a `kitchen converge <platform_name>` and watch it fail
- Edit cookbook until it passes ServerSpec
- Add ChefSpec coverage in spec/

TODO
----
Refactor the gigantic Monster Mash in helpers.rb into something more
sensible. Perhaps use value_for_platform.

repository: Fendoe/open-hackathon-o

gha_language: Python

repo_name: Fendoe/open-hackathon-o


text:
# code-challenges
Taking on coding challenges in a variety of languages.
## Challenges
Challenge | Language | Status
----------|----------|--------
[Fizz Buzz](https://www.codeeval.com/open_challenges/1/) | Lua | Complete
[Reverse Words](https://www.codeeval.com/open_challenges/8/) | Go | Complete
[Chardonnay or Cabernet](https://www.codeeval.com/open_challenges/211/) | Python 2.7 | Complete
[Undecided](https://www.codeeval.com/open_challenges//) | C# | Incomplete

repository: gitter-badger/code-challenges

repo_name: gitter-badger/code-challenges


text:
**Circat** is a package for expressing computations in terms of `Category` and friends and then extracting circuits.
To visualize circuits, you'll need [Graphviz](http://graphviz.org) (or at least `dot`).

See the `Circat.Examples` module for examples.
For instance, run `outSimples` to construct some simple circuits, render them to PDF (easy to change), and display the results.

Install with `stack install`.

repository: capn-freako/circat

gha_language: Haskell

repo_name: capn-freako/circat


text:
# Firebase Cloud Storage for Flutter

[![pub package](https://img.shields.io/pub/v/firebase_storage.svg)](https://pub.dev/packages/firebase_storage)

A Flutter plugin to use the [Firebase Cloud Storage API](https://firebase.google.com/products/storage/).

For Flutter plugins for other Firebase products, see [README.md](https://github.com/FirebaseExtended/flutterfire/blob/master/README.md).

## Usage

To use this plugin, add `firebase_storage` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/).

### Logging

If you wish to see status events for your upload tasks in your logs, you should listen to the `StorageUploadTask.events` stream.
This could look like the following if you are using `StorageReference.putData`:

```dart
final StorageReference storageReference = FirebaseStorage().ref().child(path);

final StorageUploadTask uploadTask = storageReference.putData(data);

final StreamSubscription<StorageTaskEvent> streamSubscription = uploadTask.events.listen((event) {
  // You can use this to notify yourself or your user in any kind of way.
  // For example: you could use the uploadTask.events stream in a StreamBuilder instead
  // to show your user what the current status is. In that case, you would not need to cancel any
  // subscription as StreamBuilder handles this automatically.

  // Here, every StorageTaskEvent concerning the upload is printed to the logs.
  print('EVENT ${event.type}');
});

// Cancel your subscription when done.
await uploadTask.onComplete;
streamSubscription.cancel();
```

## Getting Started

See the `example` directory for a complete sample app using Firebase Cloud Storage.

## Issues and feedback

Please file FlutterFire specific issues, bugs, or feature requests in our [issue tracker](https://github.com/FirebaseExtended/flutterfire/issues/new).

Plugin issues that are not specific to Flutterfire can be filed in the [Flutter issue tracker](https://github.com/flutter/flutter/issues/new).

To contribute a change to this plugin,
please review our [contribution guide](https://github.com/FirebaseExtended/flutterfire/blob/master/CONTRIBUTING.md)
and open a [pull request](https://github.com/FirebaseExtended/flutterfire/pulls).

repository: phamnhuvu-dev/flutterfire

gha_language: Dart

repo_name: phamnhuvu-dev/flutterfire


text:
# Notice for VS 2017
The functionality of this extension is now included
https://www.visualstudio.com/en-us/news/releasenotes/vs2017-relnotes#manifest-designer-capability-for-creating-visual-assets

# UWP Tile Generator Revised

Generate all UWP tiles needed for your UWP application, on mouse click.

This is a revised version of https://github.com/shenchauhan/UWPTileGenerator (there is no more activity in this project)

I follow the guidelines provided here:
https://msdn.microsoft.com/windows/uwp/controls-and-patterns/tiles-and-notifications-app-assets

repository: ddaymn/UWPTileGeneratorRevised

repo_name: ddaymn/UWPTileGeneratorRevised


text:
---
layout: default
---

# 1997-12-31 - IPO Alert: King Pharmaceutical available through Wit Capital

## Header Data

From<EMAIL_ADDRESS>To<EMAIL_ADDRESS>Message Hash: ba474be38db88fa99235761cc18cbed2829b8ff8863da4ecd1759cbed3332f1f

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1997-12-31 00:11:22 UTC

Raw Date: Wed, 31 Dec 1997 08:11:22 +0800

## Raw message

```
{% raw  %}From<EMAIL_ADDRESS>Date: Wed, 31 Dec 1997 08:11:22 +0800
To<EMAIL_ADDRESS>Subject: IPO Alert: King Pharmaceutical available through Wit Capital
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

Wit Capital Corporation is pleased to announce that we are able to provide participation in the following public offering as described below:

Issuer: King Pharmaceutical, an integrated pharmaceutical company that manufactures, markets and sells branded and generic prescription pharmaceutical products.

Security:  Common Stock

Expected Size of Offering: 8,919,000 shares

Expected Price Range: $16.50 to $19.50 per share

Lead Underwriters: LEHMAN BROTHERS

If you think you may be interested in this Public Offering available through Wit Capital, please visit http://www.witcapital.com or call (888) 4-WIT-CAP.

You can view, print or download the Preliminary Prospectus from the New Issues section of our web site.  To purchase shares, you must first open an account, which you can do online.

Investing in public offerings is speculative, involves a high degree of risk and may not be appropriate for every investor.  As with all of your investments with Wit Capital, you must make your own determination of whether an investment in this offering is consistent with your investment objectives and risk tolerance.  To learn more about the risks of investing in public offerings please visit the New Issues section of our web site.

A REGISTRATION STATEMENT RELATING TO THESE SECURITIES HAS BEEN FILED WITH THE
SECURITIES AND EXCHANGE COMMISSION BUT HAS NOT YET BECOME EFFECTIVE.  THESE
SECURITIES MAY NOT BE SOLD NOR MAY OFFERS TO BUY BE ACCEPTED PRIOR TO THE TIME
THE REGISTRATION STATEMENT BECOMES EFFECTIVE.  THIS COMMUNICATION SHALL NOT
CONSTITUTE AN OFFER TO SELL OR THE SOLICITATION OF AN OFFER TO BUY, NOR SHALL
THERE BE ANY SALE OF THESE SECURITIES IN ANY JURISDICTION IN WHICH SUCH OFFER,
SOLICITATION OR SALE WOULD BE UNLAWFUL PRIOR TO REGISTRATION OR QUALIFICATION
UNDER THE SECURITIES LAWS OF SUCH JURISDICTION.

NO OFFER TO BUY THE SECURITIES CAN BE ACCEPTED AND NO PART OF THE PURCHASE
PRICE CAN BE RECEIVED UNTIL THE REGISTRATION STATEMENT BECOMES EFFECTIVE, AND
ANY SUCH OFFER MAY BE WITHDRAWN AND REVOKED WITHOUT OBLIGATION OR
COMMITMENT OF ANY KIND, AT ANY TIME PRIOR TO NOTICE OF ITS ACCEPTANCE GIVEN
AFTER THE EFFECTIVE DATE.  AN INDICATION OF INTEREST IN RESPONSE TO THIS RESPONSE TO THIS ADVERTISEMENT WILL INVOLVE NO OBLIGATION OR COMMITMENT OF ANY KIND.

A broker dealer or its agent may only transact business in a state after licensure or satisfying qualification requirements of that state. If you reside in a particular state that Wit Capital is not registered in as a
broker dealer or has registered agents in, this message is not directed to you. Wit Capital will not open a brokerage account or sell securities to you until such time registration requirements in your home state are fulfilled.  Thank you.

Wit Capital Corporation
Member NASD/SIPC

{% endraw %}
```

## Thread

+ Return to [December 1997](/archive/1997/12)

+ Return to "[ian@witcapital.com](/authors/ian_at_witcapital_com)"

+ 1997-12-31 (Wed, 31 Dec 1997 08:11:22 +0800) - IPO Alert: King Pharmaceutical available through Wit Capital -<EMAIL_ADDRESS>


text:
# go-instagram

[![Build Status](https://travis-ci.org/hieven/go-instagram.svg?branch=master)](https://travis-ci.org/hieven/go-instagram)[![codecov](https://codecov.io/gh/hiEven/go-instagram/branch/master/graph/badge.svg)](https://codecov.io/gh/hiEven/go-instagram)

This project is for study and personal use only. We hold no responsibilty of any use that violate Instagram's terms and conditions.

## Installation

```sh
$ go get github.com/hieven/go-instagram
```

## Documentation

- [![GoDoc](https://godoc.org/github.com/hieven/go-instagram?status.svg)](https://godoc.org/github.com/hieven/go-instagram) Instagram
- [![GoDoc](https://godoc.org/github.com/hieven/go-instagram/models?status.svg)](https://godoc.org/github.com/hieven/go-instagram/models) Instagram Models

## Features

You can use this repo to:
- like/unlike media
- get timeline feed
- get ranked media / recent media of a location
- get inbox messages
- broadcast to any inbox thread
- approve pending inbox thread

The project is still in its early stage. Any pull request to extend its functionalities is most welcome.

## Example

```go
cnf := &config.Config{
  Username: "USERNAME",
  Password: "PASSWORD",
}

ctx := context.Background()

ig, _ := instagram.New(cnf)
ig.Login(ctx)

Aresp, _ := ig.Timeline().Feed(ctx, instagram.TimelineFeedReques{})
fmt.Println(Aresp.Items[0].MediaOrAd)
```

Find more complex examples on [examples](examples)

## License

MIT

## Similar Projects

- [instagram-private-api](https://github.com/huttarichard/instagram-private-api) (Node.js)
- [Instagram-API](https://github.com/mgp25/Instagram-API) (PHP)

repository: a-dera/go-instagram

repo_name: a-dera/go-instagram


text:
Please go to the website to download the dataset:
[download](https://github.com/SeungjunNah/DeepDeblur_release)

Extract and place the dataset in this folder like:
```bash
./training_set/GOPR0372_07_00/sharp/000047.png
./training_set/GOPR0372_07_00/blur/000048.png
...
```


text:
# Hercules data model extensions

Hercules extends the OpenConfig model with new data elements that are required
for SDN management of switches. Extensions are in the form of additional YANG
modules that augment existing parts of the OpenConfig model, or add new subtrees
to the model. This document provides an overview of the model structure and
extensions.

## Hercules model structure

Hercules leverages the component model described by the OpenConfig platform
model, as well as several logical elements including interfaces, QoS, and L2
protocols. The diagram below summarizes the model elements.

Hercules defines a standard physical component hierarchy consisting of `chassis
-> linecard -> node -> port`. Nodes are generally implemented by a switching
ASIC, which in turn manages multiple physical ports. As with the base OpenConfig
model, a physical port gives rise to one or more logical interfaces, depending
on whether port channelization is in effect. The layout is illustrated below.

## Discovery of Node-Interface Mapping

For multi-node chassis, even though the gNMI subscription is per-chassis, some
SDN controllers' architecture is aligned with the "node" entity. Such controller
needs to understand which interfaces belong to which node, so that it can
demultiplex the gNMI messages to each node.

In Hercules, the 32-bit `/interfaces/interface/state/id` (i.e. the SDN port
number) is not guaranteed to be unique across chassis: two nodes on the same
chassis may have different interfaces with the same SDN port number. Therefore,
the controller can not simply rely on the `/interfaces/interface/state/id` path
to map interfaces to nodes. Instead, the controller constructs a mapping by
subscribing to several paths that associate nodes, ports and interfaces.

### Paths Used for Node-Interface Mapping

The Subscribe request contains the following paths to build the node-interface
mapping:

```
/components/component[name=*]/integrated-circuit/state/node-id
/components/component[name=*]/state/parent
/interfaces/interface[name=*]/state/hardware-port
/interfaces/interface[name=*]/state/id
```

-   By subscribing to the `node-id` leaf, the mapping between the 64-bit integer
    ID of the nodes (`node-id`) to the component name for the node (the `name`
    key) is discovered.
-   By subscribing to the `parent` leaf, the mapping between a component's name
    (`parent`) to its subcomponents' names (the `name` key) is discovered. From
    this, the controller can learn the mapping from node component name to its
    port component names.
-   By subscribing to the `hardware-port` leaf, the mapping between a port
    component name (`hardware-port`) to the interface names (the `name` key) is
    discovered. One hardware port may contain more than one interface if it is a
    multi-channel port.
-   By subscribing to the `id` leaf, the mapping between the 32-bit SDN port
    number (`id`) to the interface names (the `name` key) is discovered. This
    allows the controller to verify if the discovered interfaces are consistent
    with the controller's configuration.

After getting the response of these subscriptions, the controller build maps
from node ID to node component name, then maps node component name to port
component name, then maps port component name to interface name, then maps
interface name to interface ID. Combining these mappings, the controller gets
the `node-id` -> (interface name, interface ID) mapping. After that, the
controller is able to demultiplex the gNMI responses to each nodes.

repository: openconfig/hercules

repo_name: openconfig/hercules


text:
# 1. Problem

This problem uses the ResNet-50 CNN to do image classification.

## Requirements
* [MXNet 20.06-py3 NGC container](https://ngc.nvidia.com/catalog/containers/nvidia:mxnet)
* [nvidia-docker](https://github.com/NVIDIA/nvidia-docker) (single-node)
* Slurm with [Pyxis](https://github.com/NVIDIA/pyxis) (multi-node)

# 2. Directions

## Steps to download and verify data
Download the data using the following command:

Please download the dataset manually following the instructions from the [ImageNet website](http://image-net.org/download). We use non-resized Imagenet dataset, packed into MXNet recordio database. It is not resized and not normalized. No preprocessing was performed on the raw ImageNet jpegs.

For further instructions, see https://github.com/NVIDIA/DeepLearningExamples/blob/master/MxNet/Classification/RN50v1.5/README.md#prepare-dataset .


text:
---
title: "Custom Filter Criteria"
author: "Alex F. Bokov"
date: "January 21, 2019"
output: html_document
---

If you only want certain values extracted into a new column, these are the
controls you can use to describe AND/OR criteria that are as deeply nested as
needed.


text:
# Shuffling
##Pattern Description
```
The total order sorting and shuffling patterns are opposites in terms of effect, but the
latter is also concerned with the order of data in records.
```
##Intent
```
You have a set of records that you want to completely randomize.
```
##Motivation
```
This whole chapter has been about applying some sort of order to your data set except
for this pattern which is instead about completely destroying the order.
The use cases for doing such a thing are definitely few and far between, but two stand
out. One is shuffling the data for the purposes of anonymizing it. Another is randomizing
the data set for repeatable random sampling.
Anonymizing data has recently become important for organizations that want to main‐
tain their users’ privacy, but still run analytics. The order of the data can provide some
information that might lead to the identity of a user. By shuffling the entire data set, the
organization is taking an extra step to anonymize the data.
Another reason for shuffling data is to be able to perform some sort of repeatable random
sampling. For example, the first hundred records will be a simple random sampling.
Every time we pull the first hundred records, we’ll get the same sample. This allows
analytics that run over a random sample to have a repeatable result. Also, a separate job
won’t have to be run to produce a simple random sampling every time you need a new
sample.
```
##Applicability
```
The main requirement here is pretty obvious: your sort key has to be comparable so the
data can be ordered.
```
##Structure
![Structure](https://github.com/geftimov/MapReduce/tree/master/readme/img/Filtering.png)
```
• All the mapper does is output the record as the value along with a random key.
• The reducer sorts the random keys, further randomizing the data.
In other words, each record is sent to a random reducer. Then, each reducer sorts on
the random keys in the records, producing a random order in that reducer.
```
##Consequences
```
Each reducer outputs a file containing random records.
```
##Resemblances
###SQL

    The SQL equivalent to this is to order the data set by a random value, instead of
some column in the table. This makes it so each record is compared on the basis of
two random numbers, which will produce a random ordering. We don’t have to go
all the way and do a total ordering in MapReduce, as in the previous pattern. This
is because sending data to a random reducer is sufficient.
SELECT * FROM data ORDER BY RAND();
###Pig

    Shuffling in Pig can be done as we did it in SQL: performing an ORDER BY on a
random column. In this case, doing a total ordering is unnecessary. Instead, we can
GROUP BY a random key, and then FLATTEN the grouping. This effectively imple‐
ments the shuffle pattern we proposed behind the scenes.
c = GROUP b BY RANDOM();
d = FOREACH c GENERATE FLATTEN(b);
##Performance analysis
```
The shuffle has some very nice performance properties. Since the reducer each record
goes to is completely random, the data distribution across reducers will be completely
balanced. With more reducers, the data will be more spread out. The size of the files will
also be very predictable: each is the size of the data set divided by the number of reducers.
This makes it easy to get a specific desired file size as output.
Other than that, the typical performance properties for the other patterns in this chapter
apply. The pattern shuffles all of the data over the network and writes all of the data back
to HDFS, so a relatively high number of reducers should be used.
```

repository: geftimov/hadoop-map-reduce-patterns

gha_language: Java

repo_name: geftimov/hadoop-map-reduce-patterns


text:
golang-image
============

Adds support of CMYK jpeg files to Golang image library.

You can use it as a drop-in replacement for the Golang default image library.

import "github.com/zhnxin/golang-image/jpeg"

## JFIF support

You can wirte jfif metadata by calling:

    EncodeWithJfif(w io.Writer, m image.Image,jfif *Jfif, o *Options)

And set the thumbnail by calling:

    jfif := jpeg.NewJfif()
    err = jfif.SetThumbnail(thumbnail)
    checkErr(err)

_Notic: The thumbnail should not be lager than 21845 px, which means width*hight <= 21845_


text:
---
sidebar_position: 1
---

import Button from "@site/src/components/button";

# Why should you use this tool?

Are you tired of sifting through cluttered folders and endless streams of unorganized photos?
Say goodbye to the headache of finding the perfect picture and hello to a streamlined,
efficient way to publish, sort, and label your content.
Our app makes it easy to keep track of all your photos in one convenient location,
so you can quickly find exactly what you're looking for.
Whether you're a professional photographer or just looking to keep your personal collection organized,
our app has the tools you need to succeed. Try it out today and see just how much time and energy you'll save!

# What is Starsky? (an introduction)

Starsky is a free photo-management tool, which runs on your server or web-space.
Installing is a matter of running the application.
It acts as an accelerator to find and organize images driven by meta information.
Browse and search images in your own cloud.
Starsky is the name of the Starsky DAM (Digital asset management) system that runs as a desktop application and web service.
You could add how to add users, set up your archives, upload content, control metadata, share content and more.

## Accelerator for self-hosted photo-management

Starsky helps you get more value from creative digital assets like images and videos by making them easy to organize,
access and distribute. The focus of the application is an individual’s digital file library or a photographer’s photo database.
The goal is to have a application that store, organize, find, retrieve and share digital content.

<Button href="getting-started" color="#25c2a0">
  Read more about how to get started
</Button>

## Demo app

There is a online demo of the Starsky Application. Please have **some patience** before the app warms up.

<Button href="https://demo.qdraw.nl" color="#25c2a0">
  See the online demo
</Button>

> Azure quits the application after 30 minutes of inactivity.

> Content changes in the demo environment are not stored.

## Say Goodbye to Digital Clutter.

An organized flow is a smooth flow.
Why shouldn’t photo management be the same? With Starsky’s unrivalled
Digital Asset Management (DAM), you’ll find a powerful,
versatile, and easy to use system that will leave your files feeling seen and adored.

repository: qdraw/starsky

gha_language: C#

repo_name: qdraw/starsky


text:
# JavaScript testing with jsdom, mocha, chai & sinon

![JavaScript testing application](https://raw.githubusercontent.com/pjlangley/js-testing-jsdom-mocha-chai-sinon/master/misc/app-preview.png "JavaScript testing application")

To get your own live version of this demo up and running, clone the repo to a local directory on
your computer, ensure you `cd` into the directory from the command line, then run the following commands:

```
npm install
npm test
node server
```

Load up `http://localhost:3000` in the browser and experience the amazing!

This repo accompanies the blog post [JavaScript testing with jsdom, mocha, chai & sinon](http://www.codechewing.com/library/testing-javascript-jsdom-mocha-chai-sinon), which
contains a lot more information you should check out.

## Sample test results

![Testing JavaScript with jsdom, mocha, chai & sinon](https://raw.githubusercontent.com/pjlangley/js-testing-jsdom-mocha-chai-sinon/master/misc/mocha-output.png "Testing JavaScript with jsdom, mocha, chai & sinon")

### License
MIT


text:
# Batch Normalization
![](https://img.shields.io/badge/Python-3.6.5-brightgreen.svg) ![](https://img.shields.io/badge/Tensorflow-1.8.0-yellowgreen.svg)

Implementation of Batch Normalization in Tensorflow, Batch Normalization is a strategy to address the problem of _internal covariate shift_, the description of _internal covariate shift_ is that for deep neural networks, the distribution of each layer’s inputs changes during training, as the parameters of the previous layers change, which slows down the training by requiring lower learning rates and careful parameter initialization, and makes it notoriously hard to train models with saturating nonlinearities.

Batch Normalization draws its strength from making normalization a part of the model architecture and performing the normalization for each training mini-batch, which also allows to use much higher learning rates and be less careful about initialization, as well as acts as a regularizer, in some cases eliminating the need for Dropout.

This repository is inspired by the paper [Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift](https://arxiv.org/abs/1502.03167) and [tomokishii/mnist_cnn_bn.py](https://gist.github.com/tomokishii/0ce3bdac1588b5cca9fa5fbdf6e1c412). Improvement and modifications are done to make the codes more readable and flexible.

More details about Batch Normalization please go through the [Reference](#Reference), which contains the information I read when I learned this technique.

### Training Results:
```bash
 Training...
  step     0: validation loss = 22.7861, validation accuracy = 0.1146
  step   200: validation loss = 0.1514, validation accuracy = 0.9562
  step   400: validation loss = 0.1149, validation accuracy = 0.9684
  ...
  step  1600: validation loss = 0.0627, validation accuracy = 0.9800
  step  1800: validation loss = 0.0553, validation accuracy = 0.9836
  step  2000: validation loss = 0.0501, validation accuracy = 0.9852
  ...
  step  3800: validation loss = 0.0426, validation accuracy = 0.9880
  step  4000: validation loss = 0.0388, validation accuracy = 0.9894
  step  4200: validation loss = 0.0373, validation accuracy = 0.9900
  ...
  step  5000: validation loss = 0.0342, validation accuracy = 0.9898

 Testing...
  test loss = 0.0295, test accuracy = 0.9894, multiclass log loss = 0.0295
```

### Reference
- [Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift](https://arxiv.org/abs/1502.03167)
- [tomokishii/mnist_cnn_bn.py](https://gist.github.com/tomokishii/0ce3bdac1588b5cca9fa5fbdf6e1c412)
- [stackoverflow/How could I use Batch Normalization in TensorFlow?](https://stackoverflow.com/questions/33949786/how-could-i-use-batch-normalization-in-tensorflow)
- [Rui Shu/TENSORFLOW GUIDE: BATCH NORMALIZATION](http://ruishu.io/2016/12/27/batchnorm/)
- [tensorflow/tf.nn.batch_normalization](https://www.tensorflow.org/api_docs/python/tf/nn/batch_normalization)
- [Why does batch normalization help?](https://www.quora.com/Why-does-batch-normalization-help)
- [神经网络梯度与归一化问题总结+highway network、ResNet的思考](https://zhuanlan.zhihu.com/p/26076292)
- [深度学习中 Batch Normalization为什么效果好？](https://www.zhihu.com/question/38102762)
- [深度学习（二十九）Batch Normalization 学习笔记](http://blog.csdn.net/hjimce/article/details/50866313)
- [《Batch Normalization Accelerating Deep Network Training by Reducing Internal Covariate Shift》阅读笔记与实现](http://blog.csdn.net/happynear/article/details/44238541)

repository: GyxChen/AmusingPythonCodes

repo_name: GyxChen/AmusingPythonCodes


text:
## Family Tree 365 - Open Source Family Tree Software - Nuxt Client
 ![Latest Stable Version](https://img.shields.io/github/release/familytree365/nuxt.svg)
[![StyleCI](https://github.styleci.io/repos/399057031/shield?branch=master)](https://github.styleci.io/repos/399057031)
[![CircleCI](https://circleci.com/gh/familytree365/nuxt.svg?style=svg)](https://circleci.com/gh/familytree365/nuxt)

## Description

Browser based Genealogy software for interacting and processing data efficiently. Easily create your
own family tree by importing your existing data or manual data entry. Storage of all data is securely on your own server and does
not leave your environment without your permission. In the future there will be optional
smart matching with other servers. This is the Nuxt client for the backend please see https://github.com/familytree365/genealogy

## Demo

https://www.familytree365.com- register a free account

### Official Laravel Enso Documentation

The documentation is available [here](https://docs.laravel-enso.com) split into backend and frontend.
Note that most sections have short demo clips.

### Installation Steps

1. Download the project with `git clone https://github.com/familytree365/nuxt.git --depth 1`

2. Within the project folder run `yarn install`

7. Run `yarn build`

9. For live reload / hot module replacement functionality run `yarn dev`

### Thanks

Built with Laravel Enso 4.x and Nuxt:

[Vue Router](https://router.vuejs.org/en), [Vuex](https://vuex.vuejs.org/en/), [Axios](https://github.com/axios/axios),
[Font awesome 5](https://fontawesome.com), [Animate.css](https://daneden.github.io/animate.css/),
[Bulma-Extensions](https://wikiki.github.io/bulma-extensions/overview), [Driver.js](https://kamranahmed.info/driver.js/),
[Chart.js](http://chartjs.org), [Flatpickr](https://chmln.github.io/flatpickr/),

Special thanks to [Taylor Otwell](https://laravel.com/), [Jeffrey Way](https://laracasts.com), [Evan You](https://vuejs.org/) and [Jeremy Thomas](https://bulma.io). [Laravel Enso](https://github.com/laravel-enso)

### Contributions

are welcome. Pull requests are great, but issues are good too.

## Contributors

This project exists thanks to all the people who contribute.

## Backers

Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/genealogy#backer)]

## Sponsors

Support this project by becoming a sponsor.  [[Become a sponsor](https://opencollective.com/genealogy#sponsor)]

### License

This package is released under the MIT license.

gha_language: Vue


text:
# Portfolio website built in Gatsby

Kick off your portfolio website with this default boilerplate. This barebones starter ships with the main portfolio items you might need.

_Have another more specific idea? You may want to check out our vibrant collection of [official and community-created starters](https://www.gatsbyjs.org/docs/gatsby-starters/)._

## 🚀 Quick start

1. **Install the dependencies.**

   ```sh
   # install the dependencies
   npm install
   ```

2. **Build it. Open the source code and start editing!**

   Navigate into your your portfolio's directory and start it up.

   ```sh
   gatsby develop
   ```

   Your site is now running at `http://localhost:8000`!

3. **Deploy it.**

   After applying your changes, run this command to deploy it.

   ```sh
   gatsby build
   gatsby serve
   ```


text:
## About

This project is a simple introduce about me, Gustavo Oshiro and builded with Boilerplate, Stylus and Gulp

### Tasks

- `gulp`: Initialize watch for changes and a server(localhost:3000)
- `gulp js`: execute js files
- `gulp notes`: copy speaker notes
- `gulp stylus`: compile stylus files
- `gulp imagemin`:compress image files
- `gulp watch`: call for watch files
- `gulp pug`: compile pug files
- `gulp deploy-pages`: deploy compiled files at `build` to `github` on branch `gh-pages`.

### License

This boilerplate is free and open source software, distributed under the The MIT License. So feel free to use this to create your site without linking back to me or using a disclaimer.

If you’d like to give me credit somewhere on your blog or tweet a shout out to [@willian_justen](https://twitter.com/willian_justen), that would be pretty sweet.

repository: GuOshiro/Introduce-Myself

repo_name: GuOshiro/Introduce-Myself


text:
# Praw
Change your desktop wallpaper to Reddit's hot🔥 posts of famous subreddit like r/wallpaper, r/naturepics, r/earthporn

I have used the python reddit API wrapper to get the top posts from any random specified subreddits and bloom filters to make sure that wallpapers does not repeat as there might be chances that the program picks the same post again. After downloading and setting the wallpaper it automatically deletes the image from your drive so that it doesn't accumulate and takes your disk space.

If you want to explore more about bloom filters then here's 👉 the [LINK](https://apoorvtyagi133.blogspot.com/2020/05/bloom-filter.html) to my blog post where i have explained how a bloom filter works in detail.

## Install requirements by running
```pip install -r requirements.txt```

## How to RUN
First you need to get [PRAW credentials](https://praw.readthedocs.io/en/latest/getting_started/quick_start.html) from Reddit. Then :

git clone https://github.com/ApoorvTyagi/praw.git

cd praw <l/i>

python main.py

![](demo.mp4)

repository: ApoorvTyagi/praw

repo_name: ApoorvTyagi/praw


text:
# Harpocrates

## Overview

Harpocrates is a pair of scripts for backup and restore of (small,
critically important) files on paper (yes, paper), such as
cryptographic keys:

* You can run paperbackup.sh for a file to be backed up to
  create a PDF document containing a two-column hexdump with many rows
  of numbers and characters. Each row consists of an address (2 bytes),
  the CRC16 checksum (2 bytes) covering all previous data bytes and the
  following, remaining data bytes of this row, and the data bytes (up
  to 14 bytes) themselves, grouped into 2-byte blocks for easier reading.

  Print the created PDF document and store the printout in a safe
  location to protect against the original files becoming corrupted
  or lost.

* If you ever need to restore the file from paper, retrieve its printout
  and manually enter the CRC16 checksum (without the brackets) and the
  following data bytes of each row into a text file using a text editor.
  This may take a while, and may introduce one or more errors (we are
  human, after all).

  Once you have entered all rows as described above, you can run
  paperrestore.sh to check for typing errors in your text file using
  the CRC16 checksums, and restore the original file from the data.
  In case of a typing error or an omitted line, the computed CRC16
  checksum does not match the entered CRC16 checksum in the vast
  majority of cases. If a CRC error is observed, it is reported with
  a row and byte range, so you can compare the printout to the text
  file, fix the error and continue.

For that purpose, Harpocrates depend on the availability of hexdump,
enscript, ps2pdf and xxd as well as on its own crcwrap and crcunwrap,
two commandline tools that come as part of Harpocrates:

* crcwrap reads blocks of up to 14 data bytes as they exist,
  computes a continuous 2-byte CRC16 checksum, and writes the checksum
  followed by the data bytes.

* crcunwrap reads pairs of a 2-byte CRC16 checksum and a block of up to
  14 data bytes as they exist, computes its own CRC16 checksum over all
  data bytes up to and including this block, and compares the checksums.
  If the checksums match, crcunwrap writes just the data bytes,
  otherwise crcunwrap aborts.

## Build

Run `make` to build crcwrap and crcunwrap as a prerequisite for
using paperbackup.sh and paperrestore.sh.

## Usage

Run `./paperbackup.sh <data-file>` in the same directory to produce a
<data-file>.wrapped.pdf containing the CRC-protected hexdump.

Run `./paperrestore.sh <text-file>` in the same directory to produce a
<text-file>.restored containing the restored file.

## Hints

* If you want to back up cryptographic keys and certificates, consider
  backing up DER-encoded representations rather than their larger
  base64-wrapped PEM-encoded alternatives.

## Recommendation

Before using these scripts in production, do actually test whether
these work as intended. Although this is used by the author, no guarantee
is given that this software serves any purpose at all; and you would
not put blind faith into the tools of a total stranger safeguarding
your most important files, would you?

You can test it by backing up a test-file and entering only 1-2 rows
of data into a text file; running paperrestore.sh on that partial file
will convert these rows to binary data, which can be checked by
comparing the first lines of their corresponding hexdumps, e.g. by

```
./paperrestore <test-file.txt>
hd <test-file.txt>.restored | head -4
hd <test-file.original> | head -4
```

## Limitations

* The CRC16 checksum used to protect every 14-byte block may detect
  certain types of errors, but it cannot detect each and every possible
  alteration to the data bytes.

* The usage of a continuous CRC16 checksum provides some protection
  against omitted and duplicated rows, but there is no protection
  against missing tailing rows, as no metadata is stored regarding the
  total row count.

## Related work

This work was mainly inspired by David Shaws [Paperkey](https://www.jabberwocky.com/software/paperkey/)
along the same line of thought; I just wanted to have a more generic,
end-to-end solution.

repository: mhartle/harpocrates

repo_name: mhartle/harpocrates


text:
#Learnopoly

This is a basic JavaScript/HTML/CSS Learnopoly implementation. Up to eight players can play at once. If you're familiar with Learnopoly, game play should be fairly self-explanatory. But if you have trouble, hovering the mouse over a control will usually display more information. Please report any issues you find.

New: Added capability to play against an AI. A AI for demonstration purposes only is included. A future update will include a more realistic opponent.


text:
---
# use person layout if you want a page generated for you
layout: person
first_name: Linda
last_name: Gorman
key: gorman
permalink: /team/gorman/
# Pick one of the following
role: msstudent
email<EMAIL_ADDRESS>image: /assets/images/people/gorman.jpg
organization: University of Utah
position: MS Student
# use either a local link like here, or a URL
website: /team/gorman/
interests: "Text Visualization, Online Health Communities"
#  leave empty if you're active. Add something like "M.S.'16" or "B.S.'17" if you got a degree while at VDL. Add "N" if you left VDS before you got a degree.
graduated:

# stuff below can be ignored if you don't use the group website for your private website
gh: https://github.com/lggorman
twitter: "@lggorman"
# cv:
address: |
    School of Computing, University of Utah

    50 S. Central Campus Drive

    Salt Lake City, Utah 84112

# flag used to determine whether to show teaching
showteaching: false
graduated: MS '20

---
I am an MS student working with Miriah Meyer. I am interested in user-centered design and visualizing language. My current project involves visualizing text data from online health communities.

Before graduate school I worked as a developer at a design agency and earned my BS in journalism and IT.

gha_language: HTML


text:
---
# Display name
title: Kristian Nørgaard Jensen

# Username (this should match the folder name)
authors:
- admin

# Is this the primary user of the site?
superuser: true

# Role/position
role: Computer Science Master Student

# Organizations/Affiliations
organizations:
- name: IT University of Copenhagen
  url: "itu.dk"

# Short bio (displayed in user profile at end of posts)
bio: My research interests include natural language processing, artificial intelligence, robotics

interests:
- Artificial Intelligence
- Natural Language Processing
- Robotics

education:
  courses:
  - course: BSc in Data Science
    institution: IT University of Copenhagen
    year: 2020
  - course: MSc in Computer Science
    institution: IT University of Copenhagen
    year: 2022

# Social/Academic Networking
# For available icons, see: https://sourcethemes.com/academic/docs/page-builder/#icons
#   For an email link, use "fas" icon pack, "envelope" icon, and a link in the
#   form<EMAIL_ADDRESS>or "#contact" for contact widget.
social:
- icon: envelope
  icon_pack: fas
  link<EMAIL_ADDRESS># For a direct email link, use<EMAIL_ADDRESS>- icon: twitter
  icon_pack: fab
  link: https://twitter.com/krnj1997
- icon: google-scholar
  icon_pack: ai
  link: https://scholar.google.com/citations?user=3emijZYAAAAJ&hl=en
- icon: github
  icon_pack: fab
  link: https://github.com/kris927b
# Link to a PDF of your resume/CV from the About widget.
# To enable, copy your resume/CV to `static/files/cv.pdf` and uncomment the lines below.
# - icon: cv
#   icon_pack: ai
#   link: files/cv.pdf

# Enter email to display Gravatar (if Gravatar enabled in Config)
email: ""

# Organizational groups that you belong to (for People widget)
#   Set this to `[]` or comment out if you are not using People widget.
user_groups:
- Researchers
- Visitors
---

Kristian Jensen is a Data Science student at the IT University of Copenhagen. His research interests include Natural Language Processing/Understanding, Artificial Intelligence and Robotics.
He is currently pursuing a Master in Computer Science with a focus on Data Science and Machine Learning.

He works as a research assistant in the computer science lab run by Barbara Plank. Here he is currently aiding in research in the field of Natural Language Processing.


text:
## What is Dockerfile.alpine

Dockerfile.alpine contains base image for jupyterhub. It does not work independently, but only as part of a full jupyterhub cluster

## How to use it?

1. A running configurable-http-proxy, whose API is accessible.
2. A jupyterhub_config file.
3. Authentication and other libraries required by the specific jupyterhub_config file.

## Steps to test it outside a cluster

- start configurable-http-proxy in another container
- specify CONFIGPROXY_AUTH_TOKEN env in both containers
- put both containers on the same network (e.g. docker network create jupyterhub; docker run ... --net jupyterhub)
- tell jupyterhub where CHP is (e.g. c.ConfigurableHTTPProxy.api_url = 'http://chp:8001')
- tell jupyterhub not to start the proxy itself (c.ConfigurableHTTPProxy.should_start = False)
- Use dummy authenticator for ease of testing. Update following in jupyterhub_config file
  - c.JupyterHub.authenticator_class = 'dummyauthenticator.DummyAuthenticator'
  - c.DummyAuthenticator.password = "your strong password"

repository: viperproject/code-server-hub

gha_license_id: NOASSERTION

repo_name: viperproject/code-server-hub


text:
# Filtering

`defmt` supports 5 different logging levels listed below from lowest severity to highest severity:

- TRACE
- DEBUG
- INFO
- WARN
- ERROR

By default all logging is *disabled*.
The amount of logging to perform can be controlled at the *crate* level using the following Cargo features:

- `defmt-default`, log at INFO, or TRACE, level and up
- `defmt-trace`, log at TRACE level and up
- `defmt-debug`, log at DEBUG level and up
- `defmt-info`, log at INFO level and up
- `defmt-warn`, log at WARN level and up
- `defmt-error`, log at ERROR level

These features must only be enabled by the top level *application* crate as shown below.

``` toml
# Cargo.toml
[package]
name = "app"

[dependencies]
usb-device = "0.3.0"

[features]
default = [
  # enable logs of the `usb-device` dependency at the TRACE/INFO level
  "usb-device/defmt-default",

  # enable logs of this crate (`app`) at the TRACE level
  "defmt-trace",
]
```

When only the `defmt-default` feature is enabled for a crate, that crate will:

- log at the TRACE level and up if `debug-assertions = true` (`dev` profile), or
- log at the INFO level and up if `debug-assertions = false` (`release` profile)

When any of the other features is enabled the crate will log at that, and higher, severity regardless of the state of `debug-assertions` or `defmt-default`.


text:
# iDAAS-Demo-Platform
Complete Platform Demo: HL7, FHIR, Third Party, Some DREAM Components and Data Distribution. The intent of this
solution is to provide a quick and simple platform.

This platform is designed to show the power of middleware across the healthcare industry. While this platform is able to
run as long as you have Java installed we have included the release of Kafka (also known as AMQ-Streams). It can be
found in the platform-addons directory. We have also included all the scripts that will create the Kafka topics within
platform-scripts/AMQ-Streams.

** - If you want test data you can find sample data within the testdata directory when the source code is downloaded locally.

1. Unzip the zip file. I have unzipped it without changing the name of the directory into my home directory within a
directory I created named RedHatTech.
2. You will need to change the default directory in the scripts (check the start-solutions script as well) but can run the scripts to either create, list or delete the
Kafka topics.
3. To build and create a jar you can run the build_solution script, it will build and generate an updated jar file with
any changes you might have added
4. Run the start_solution script in the platform-scripts directory.

repository: MrHimanshuSoni/iDAAS-Demo-Platform

repo_name: MrHimanshuSoni/iDAAS-Demo-Platform


text:
# uROS for FeatherS2
A repository for my own ROS2/uROS development related to the FeatherS2, ESP32S2 and uROS.

## Packages

### ROS FEATHER S2

A uROS driver for the naked FeatherS2 that exposes:
- the APA102 RGB LED as `std_msgs/ColorRGBA` subscriber on `apa102`
- the blue LED as a `std_msgs/Bool` subscriber in `blue_led`
- the temperature sensor as `sensor_msgs/Temperature` publisher on `temperature`
- the ALS [ambient light sensor] as a `sensor_msgs/Illuminance` publisher in `illuminance`

### ROS FEATHER WING

A uROS driver for the FeatherS2 + Feather wing 8x4 LED matrix that exposes:
- the LED matrix single color as a `std_msgs/ColorRGBA` subscriber on `color`
The maximal brightness can be through service `set_brightness` of type `led_strip_msgs/SetBrightness`.

### ROS LED DRIVER

A uROS interface to the Serial LED driver pro (https://www.bhencke.com/serial-led-driver-pro) that exposes:
- the LED strips colors as a `led_strip_msgs/LedStrips` subscriber on `led_strips`.

The maximal brightness can be through service `set_brightness` of type `led_strip_msgs/SetBrightness`.

## Caveats

The support for ESP32S2 / FeatherS2 is not complete. Currently, following is missing (from esp-idf and/or uROS):
- multiple subscribers
- console output through USB.


text:
Services, Load Balancing and Networking

`Service` is a resource you create to make a single, constant point of entry to a group of pods providing the same service. Each service has an IP address and port that never change while the service exists. Clients can open connections to that IP and port, and those connections are then routed to one of the pods backing that service. This way, clients of a service don’t need to know the location of individual pods providing the service, allowing those pods to be moved around the cluster at any time.

Creating services

```yaml
---
apiVersion: v1
kind: Service
metadata:
  name: kubia
spec:
  sessionAffinity: ClientIP
  ports:
    -
      port: 80
      targetPort: 8080
  selector:
    app: kubia
```

```
$ kubectl create -f kubia-svc.yaml
```

You’re defining a `service` called `kubia`, which will accept connections on port 80 and route each connection to port 8080 of one of the pods matching the `app=kubia` label selector.

You can list all Service resources in your namespace and see that an internal cluster IP has been assigned to your service:

```
$ kubectl get svc
```

The `kubectl exec` command allows you to remotely run arbitrary commands inside an existing container of a pod.

```
$ kubectl get pods
$ kubectl exec ${podName} bash
```

If you want all requests made by a certain client to be redirected to the same pod every time, you can set the service’s `sessionAffinity` property to `ClientIP` (instead of `None`, which is the default).

```yaml
---
apiVersion: v1
kind: Service
metadata:
  name: kubia
spec:
  sessionAffinity: ClientIP
  ports:
    -
      port: 80
      targetPort: 8080 // Port 80 is mapped to the pods’ port 8080.
  selector:
    app: kubia
```

This makes the service proxy redirect all requests originating from the same client IP to the same pod.

Services can also support multiple ports

```yaml
---
apiVersion: v1
kind: Service
metadata:
  name: kubia
spec:
  ports:
    -
      name: http
      port: 80
      targetPort: 8080 // Port 80 is mapped to the pods’ port 8080.
    -
      name: https
      port: 443
      targetPort: 8443 // Port 443 is mapped to the pods’ port 8443.
  selector:
    app: kubia
```

To use named ports, you can specify port names in a pod definition

```yaml
---
kind: Pod
spec:
  containers:
    -
      name: kubia
      ports:
        -
          containerPort: 8080
          name: http
        -
          containerPort: 8443
          name: https
```

You can then refer to those ports by name in the service spec

```yaml
---
apiVersion: v1
kind: Service
spec:
  ports:
    -
      name: http
      port: 80
      targetPort: http
    -
      name: https
      port: 443
      targetPort: https
```

The biggest benefit of doing so is that it enables you to change port numbers later without having to change the service spec.

Discovering services through environment variables

```
$ kubectl exec ${podName} env

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=kubia-3inly
KUBERNETES_SERVICE_HOST=<IP_ADDRESS> KUBERNETES_SERVICE_PORT=443
...
KUBIA_SERVICE_HOST=<IP_ADDRESS>
KUBIA_SERVICE_PORT=80
```

*NOTE: Dashes in the service name are converted to underscores and all letters are uppercased when the service name is used as the prefix in the environment variable’s name*

Discovering services through DNS by opening a connection to this FQDN `backend-database.default.svc.cluster.local`. `backend-database` corresponds to the service name, `default` stands for the namespace the service is defined in, and `svc.cluster.local` is a configurable cluster domain suffix used in all cluster local service names.

*NOTE: The client must still know the service’s port number. If the service is using a standard port (for example, 80 for HTTP), that shouldn’t be a problem. If not, the client can get the port number from the environment variable.*

*NOTE: The service’s cluster IP is a virtual IP, and only has meaning when combined with the service port. So curl-ing the service works, but pinging doesn’t*

Services don’t link to pods directly. Instead, a resource sits in between (the Endpoints resource). You may have already noticed endpoints if you used the kubectl describe command on your service.

```
$ kubectl describe svc ${serviceName}
```

An Endpoints resource is a list of IP addresses and ports exposing a service. The Endpoints resource is like any other Kubernetes resource, so you can display its basic info with kubectl get:

```
$ kubectl get endpoints ${endpointName}
```

Although the pod selector is defined in the service spec, it’s not used directly when redirecting incoming connections. Instead, the selector is used to build a list of IPs and ports, which is then stored in the Endpoints resource. When a client connects to a service, the service proxy selects one of those IP and port pairs and redirects the incoming connection to the server listening at that location.

If you create a service without a pod selector, Kubernetes won’t even create the Endpoints resource (after all, without a selector, it can’t know which pods to include in the service). It’s up to you to create the Endpoints resource to specify the list of endpoints for the service.

This service has no selector defined.

```yaml
---
apiVersion: v1
kind: Service
metadata:
  name: external-service
spec:
  ports:
    -
      port: 80
```

Because you created the service without a selector, the corresponding Endpoints resource hasn’t been created automatically, so it’s up to you to create it.

```yaml
---
apiVersion: v1
kind: Endpoints
metadata:
  name: external-service
subsets:
  -
    addresses:
      -
        ip: "<IP_ADDRESS>"
      -
        ip: "<IP_ADDRESS>"
    ports:
      -
        port: 80
```

The Endpoints object needs to have the same name as the service and contain the list of target IP addresses and ports for the service. After both the Service and the Endpoints resource are posted to the server, the service is ready to be used like any regular service with a pod selector. Containers created after the service is created will include the environment variables for the service, and all connections to its IP:port pair will be load balanced between the service’s endpoints.

To create a service that serves as an alias for an external service, you create a Service resource with the type field set to `ExternalName`. For example, let’s imagine there’s a public API available at `api.somecompany.com`.

```yaml
---
apiVersion: v1
kind: Service
metadata:
  name: external-service
spec:
  externalName: someapi.somecompany.com
  ports:
    -
      port: 80
  type: ExternalName
```

After the service is created, pods can connect to the external service through the `external-service.default.svc.cluster.local` domain name

You have a few ways to make a service accessible externally:

- Setting the service type to `NodePort`—For a `NodePort` service, each cluster node opens a port on the node itself (hence the name) and redirects traffic received on that port to the underlying service. The service isn’t accessible only at the internal cluster IP and port, but also through a dedicated port on all nodes.

- Setting the service type to `LoadBalancer`, an extension of the `NodePort` type—This makes the service accessible through a dedicated load balancer, provisioned from the cloud infrastructure Kubernetes is running on. The load balancer redirects traffic to the node port across all the nodes. Clients connect to the service through the load balancer’s IP.

- Creating an Ingress resource, a radically different mechanism for exposing multiple services through a single IP address—It operates at the HTTP level (network layer 7) and can thus offer more features than layer 4 services can.

Creating A `NodePort` Service:

```yaml
---
apiVersion: v1
kind: Service
metadata:
  name: kubia-nodeport
spec:
  ports:
    -
      nodePort: 30123 // the service will be accessible through port 30123 of each of your cluster nodes.
      port: 80 // This is the port of the service’s internal cluster IP.
      targetPort: 8080 // This is the target port of the backing pods.
  selector:
    app: kubia
  type: NodePort
```

```
$ kubectl get svc kubia-nodeport

NAME             CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
kubia-nodeport   <IP_ADDRESS>   <nodes>       80:30123/TCP   2m
```

The service is accessible at the following addresses:

- `<IP_ADDRESS>:80`
- `<1st node’sIP>:30123`
- `<2nd node’sIP>:30123`, and so on.

Creating A `LoadBalancer` Service:

```yaml
---
apiVersion: v1
kind: Service
metadata:
  name: kubia-loadbalancer
spec:
  ports:
    -
      port: 80
      targetPort: 8080
  selector:
    app: kubia
  type: LoadBalancer
```

After you create the service, it takes time for the cloud infrastructure to create the load balancer and write its IP address into the Service object. Once it does that, the IP address will be listed as the external IP address of your service:

```
$ kubectl get svc kubia-loadbalancer

NAME                 CLUSTER-IP       EXTERNAL-IP      PORT(S)         AGE
kubia-loadbalancer  <IP_ADDRESS>    <IP_ADDRESS>   80:32143/TCP      1m
```

In this case, the load balancer is available at IP `<IP_ADDRESS>`, so you can now access the service at that IP address:

```
$ curl http://<IP_ADDRESS>

You've hit kubia-xueq1
```

Exposing services externally through an Ingress resource:

*Note: Why Ingress are Needed? One important reason is that each LoadBalancer service requires its own load bal- ancer with its own public IP address, whereas an Ingress only requires one, even when providing access to dozens of services. When a client sends an HTTP request to the Ingress, the host and path in the request determine which service the request is forwarded*

Creating an Ingress resource

```yaml
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: kubia
spec:
  rules:
    -
      host: kubia.example.com
      http:
        paths:
          -
            backend:
              serviceName: kubia-nodeport
              servicePort: 80
            path: /
```

This defines an Ingress with a single rule, which makes sure all HTTP requests received by the Ingress controller, in which the host `kubia.example.com` is requested, will be sent to the `kubia-nodeport` service on port 80.

To access your service through `http://kubia.example.com`, you’ll need to make sure the domain name resolves to the IP of the Ingress controller.

To look up the IP, you need to list Ingresses:

```
$ kubectl get ingresses

NAME      HOSTS               ADDRESS          PORTS     AGE
kubia     kubia.example.com   <IP_ADDRESS>   80        29m
```

Exposing multiple services through the same Ingress

```yaml
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: kubia
spec:
  rules:
    -
      host: kubia.example.com
      http:
        paths:
          -
            backend:
              serviceName: kubia  // Requests to kubia.example.com/kubia will be routed to the kubia service.
              servicePort: 80
            path: /kubia
          -
            backend:
              serviceName: bar // Requests to kubia.example.com/bar will be routed to the bar service.
              servicePort: 80
            path: /foo
```

You can use an Ingress to map to different services based on the host in the HTTP request instead of (only) the path

```yaml
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: kubia
spec:
  rules:
    -
      host: foo.example.com
      http:
        paths:
          -
            backend:
              serviceName: foo
              servicePort: 80
            path: /
    -
      host: bar.example.com
      http:
        paths:
          -
            backend:
              serviceName: bar
              servicePort: 80
            path: /
```

Requests received by the controller will be forwarded to either service foo or bar, depending on the Host header in the request.

repository: Clivern/Toad

repo_name: Clivern/Toad


text:
This is a desktop application written in Python 3.4. We use PodSixNet and Pygame. Through the main application the users will be able to chanllenge each other to specific games.

For developer uses:

--------------------

To start kick ball game type:

  python kick_ball_server.py host:port

Open 2 other terminal windowns and type:

  python kick_ball_client.py host:port-like-the-one-for-server

-------------------

To start maze game type:

  python maze_server.py host:port

Open 2 other terminal windowns and type:

  python maze_client.py host:port-like-the-one-for-server

-------------------

To start game of luck type:

  python game_of_luck_server.py host:port

Open 2 other terminal windowns and type:

  python game_of_luck_client.py host:port-like-the-one-for-server


text:
---
hrs_structure:
  division: '1'
  volume: '6'
  title: '19'
  chapter: 323F
  section: 323F-54
type: hrs_section
tags:
  - Government
menu:
  hrs:
    identifier: HRS_0323F-0054
    parent: HRS0323F
    name: 323F-54 Real property; terms and conditions
weight: 20165
title: Real property; terms and conditions
full_title: 323F-54 Real property; terms and conditions
---
**[§323F-54] Real property; terms and conditions.** (a) The corporation shall enter into a fixed-term lease with the private entity or its nonprofit management entity to rent the real property, including all improvements and fixtures on the property, of the Maui regional system facility or facilities that is to be transferred to the private entity or its nonprofit management entity under this part.

(b) At minimum, the lease shall include the following terms and conditions:

(1) The lease shall not be terminated other than for good cause and upon a minimum of three hundred sixty-five days prior written notice to ensure that the delivery of health care services to the community served will not be disrupted;

(2) During the term of the lease, the private entity or its nonprofit management entity shall have exclusive control of all matters related to the management, operation, and provision of health care services in the leased facilities, except as otherwise set forth in the lease;

(3) The responsibility to oversee the performance of the terms and conditions of the lease by the private entity or its nonprofit management entity shall rest with the Maui regional system board as the custodial caretaker of the real property under section 323F-3.5; and

(4) The corporation or the State shall retain ownership of the leased property throughout the term of the lease. [L 2015, c 103, pt of §2]

repository: SamMade/BlueAndKrabby

repo_name: SamMade/BlueAndKrabby