text:
---
title: Requests vs Limits in Kubernetes
date: 2019-04-02 03:30:14 -07:00
permalink: /2019/04/02/requests-vs-limits-in-kubernetes/
categories:
- Solution
tags:
- Containers
---

Kubernetes doesn't know what resources (i.e. CPU & memory) your container needs.  That is why you must give it some hints.

If you run way under capacity and / or fairly similar pods, you do not need to do that.  But if you start approaching the maximum capacity of your cluster or if you have pods that consume more resources than others, you'll start to get in trouble.

In this article we will look at how to inform Kubernetes about pods' resources and how we can optimize for different scenarios.

A scenario that typically comes up is when a cluster has a bunch of pods where a lot of them are dormant, i.e. they don't consume CPU or memory.  Do we have to carve them a space they won't use most of the time?  The answer is no.  As usual, it's safer to provision capacity for a workload than relying on optimistic heuristic that not all workloads will require resources at the same time.  So, we can configure Kubernetes optimistically or pessimistically.

We'll review Kubernetes specs first.  Then, as we did recently with outbound traffic, we'll simply experiment to find answers.

As usual the code is in GitHub.

Managing compute resources

Kubernetes online documentation explains how to configure resources.

Here are some highlights.

There are two resources types:  CPU & memory.  The former is quantified in number of cores while the latter is quantified in bits of RAM.

Resources are configured at the container level, not pod level.  But since a pod is a deployment unit, the total resources required by the containers of a pod is what we focus on.

There are two ways to specify resources:  requests & limits.  This is where a lot of confusion arises.  Let's try to clarify it here.  Each one (i.e. requests and limits) can be specified with CPU and / or memory.  Here are key characteristics:

  Specify
  Description

  Requests
  The requests specification is used at pod placement time:  Kubernetes will look for a node that has both enough CPU and memory according to the requests configuration.

  Limits
  This is enforced at runtime.  If a container exceeds the limits, Kubernetes will try to stop it.  For CPU, it will simply curb the usage so a container typically can't exceed its limit capacity ; it won't be killed, just won't be able to use more CPU.  If a container exceeds its memory limits, it could be terminated.

It's tempting to see those two as minimum / maximum, but it isn't really.  Requests is only used for placement and creates a theoretical map of the cluster.  Kubernetes makes sure that the sum of requested resources for a node is equal or less the capacity of the node.  It isn't a minimum.  Our container could actually use less.  It's a hint at what it needs.

The limits are closer to the concept of maximum

Pessimistic vs Optimistic

So how should we use those configurations?

If we are pessimistic, we'll want to make sure our containers have enough resource at all time.  So, we'll the requests for what the containers need to run at all time.  We'll set the limits just to prevent bad behaviours.

If we are optimistic, we'll want to make sure our containers have enough resource to start but will rely of "over capacity" to peak.  That over capacity will be coming from the resources other containers happen not to be using at that time.

  Pessimistic
  Optimistic

  Requests
  What container needs to run at all time
  What container needs to start and when idle

  Limits
  Prevent bad behaviour, i.e. noisy neighbour:  what the container should never need
  Also to prevent bad behaviour.  Moreover, to ensure there will be over capacity by containing the runtime of each individual containers

Of course, there are degrees of optimisms.  The lower we push the requests, the more we rely on the ethereal "over capacity".  The higher we push it, the more we provision capacity.

Setup experiences

Let's experiment using Azure Kubernetes Service (AKS).

In order to run those experiments, we'll need the Azure CLI tool connected to an Azure subscription.

First, let's download an ARM template and a script invoking it:

```bash
curl https://raw.githubusercontent.com/vplauzon/aks/master/requests-vs-limits/deploy.json > deploy.json
curl https://raw.githubusercontent.com/vplauzon/aks/master/requests-vs-limits/create-cluster.sh > create-cluster.sh
```

Let's make the script executable:

```bash
chmod +x create-cluster.sh
```

We are going to run that script with five parameters:

  Parameter
  Description

  Name of the resource group
  If the group doesn't exist, the script will create it

  Azure region
  Must be compatible with regions supporting ACI in VNET.  At the time of this writing, i.e. end-of-March 2019, that means one of the following:  EastUS2EUAP, CentralUSEUAP, WestUS, WestCentralUS, NorthEurope, WestEurope, EastUS or AustraliaEast.

  Name of workspace
  This needs to be unique

  Name of cluster
  This is also used as the DNS prefix for the cluster, hence must be unique

  Service Principal Application ID
  Application ID of a Service Principal

  Service Principal Object ID
  Object ID of the same Service Principal

  Service Principal Password
  Password of the same Service Principal

We are using Log Analytics to monitor the CPU / memory usage of containers.

The last three parameters are related to the Service Principal that will be used by AKS.

Let's run the command locally, e.g.:

```bash
./create-cluster.sh aks-group eastus myuniquelaworkspace myuniqueaks \
    <my-principal-app-id> \
    <my-principal-object-id> \
    <my-principal-password>
```

This takes a few minutes to execute.

Exceeding CPU requests

Now that we have a cluster, let's deploy something on it:

```Javascript
apiVersion: apps/v1
kind: Deployment
metadata:
  name: cpu-ram-api
spec:
  replicas: 6
  selector:
    matchLabels:
      app:  cpu-ram-api
  template:
    metadata:
      labels:
        app: cpu-ram-api
    spec:
      containers:
      - name: myapp
        image: vplauzon/cpu-ram-request-api:4
        ports:
        - containerPort: 80
        resources:
          requests:
            memory: "64M"
            cpu: "250m"
          limits:
            memory: "128M"
            cpu: "2"
---
apiVersion: v1
kind: Service
metadata:
  name: web-service
spec:
  type: LoadBalancer
  ports:
  - port: 80
  selector:
    app: cpu-ram-api
```

We have a deployment and a public service load balancing the pods of the deployment.

The pod has one container.  Container's image is vplauzon/cpu-ram-request-api.  The source code of this container also is on GitHub.  It's an API implemented in C#.  It basically keeps the CPU busy and allocate memory.  This was built on purpose for these tests.

We see under the subsection resources that we specify a request of 64 Mb of RAM and 250 "mili core" or 1/4 of a core.  Similarly, we specify a limit of 128 Mb and 2 cores.

Let's deploy it:

```bash
kubectl apply -f https://raw.githubusercontent.com/vplauzon/aks/master/requests-vs-limits/service.yaml
```

Let's look at the pods:

```bash
$ kubectl get pods

NAME                           READY   STATUS    RESTARTS   AGE
cpu-ram-api-76cb6dbbff-926nk   1/1     Running   0          84s
cpu-ram-api-76cb6dbbff-gvp4t   1/1     Running   0          84s
cpu-ram-api-76cb6dbbff-sfjc4   1/1     Running   0          84s
cpu-ram-api-76cb6dbbff-wn7rr   1/1     Running   0          84s
cpu-ram-api-76cb6dbbff-wrpwv   0/1     Pending   0          84s
cpu-ram-api-76cb6dbbff-zh5q8   1/1     Running   0          84s
```

We see that one of the pods is pending.  Our cluster has a single node.  The VM sku (B2ms) has 2 cores and 8 Gb of RAM.  Kubernetes uses a portion of those resources.  We do not have access to all resources of the VM for our pods.  With 5 pods active, we requested 1.25 cores.  There weren't enough resources for 1.5.

Now let's look at the service:

```bash
$ kubectl get svc

NAME          TYPE           CLUSTER-IP    EXTERNAL-IP      PORT(S)        AGE
kubernetes    ClusterIP      <IP_ADDRESS>      <none>           443/TCP        175m
web-service   LoadBalancer   <IP_ADDRESS>   <IP_ADDRESS>   80:31146/TCP   11m
```

We need to copy the external IP of the web-service service.  That's the Azure public IP associated to the load balancer of that service.  Let's store that in a shell variable:

```bash
ip=<IP_ADDRESS>  # Here, let's replace that specific IP with the one from our cluster
```

Now let's try a few things:

```bash
$ curl "http://$ip/"

{"duration":1,"numberOfCore":1,"ram":10,"realDuration":"00:00:01.0021172"}
```

By default, the API will allocate 10 Mb of RAM, use one core to do some work and run for one second.

Let's see if we can find that usage.  Let's open the AKS cluster in the portal and let's look at the Metrics, under Monitoring:

Now we are going to maximize the view (little chevrons on both sides), select the containers tab, search for myapp and display CPU with Max:

We do not see a blip on the radar.  So, let's run that for a little longer.  We can do that with specific query strings:

```bash
$ curl "http://$ip/?duration=90"

{"duration":90,"numberOfCore":1,"ram":10,"realDuration":"00:01:30.0804972"}
```

This will take 90 seconds to run.

We'll need to wait a little for Log Analytics to catch up on the metrics.  But then:

We switched to "The last 30 minutes" in Time range.

We see that most of one core (895 mili core) was used.

Here we just proved that a container can consumed more than its "requests" specs which was 0.25 core.

Let's do the same thing with 2 cores:

```bash
$ curl "http://$ip/?duration=90&core=2"

{"duration":90,"numberOfCore":2,"ram":10,"realDuration":"00:01:30.0031934"}
```

we can see here:

The usage went close to 2 cores and is highlighted in red, since it's close to its limits.

Here the container went to the maximum of its limit.

We won't do it here, but if we set the limit to 1 core, the same experience would yield the result that only one core would be used.  Kubernetes enforces the limit.

Let's try to run many of those at the same time:

```bash
curl "http://$ip/?duration=90&core=2" &
curl "http://$ip/?duration=90&core=2" &
curl "http://$ip/?duration=90&core=2" &
```

Here we can see that each container takes less than one core:

Basically, they all pull on the blanket but none of the containers can fully used two cores.

This is the flip side of under provisioning:  if all pods peak at the same time, they won't all get the "over capacity".

Exceeding Memory requests

Now let's try to crank the memory used:

```bash
curl "http://$ip/?duration=5&ram=20"
```

Here we request to use 20Mb within the request.  That adds up to the rest of the memory used by the container:

We then get close to our 128 Mb limit.  Let exceed it:

```bash
$ curl "http://$ip/?duration=5&ram=100"

curl: (52) Empty reply from server
```

We see an error occurs.  That's because the container got killed when its memory demand occurred and the total memory exceeded the container's limit specification.

We can see from the logs the container was restarted since the memory went down.  The pod didn't get replaced, only the container.

Summary

We've looked at how we can specify resources allocated for containers.  We've looked at a few examples.

What sums it the best is this matrix:

  Pessimistic
  Optimistic

  Requests
  What container needs to run at all time
  What container needs to start and when idle

  Limits
  Prevent bad behaviour, i.e. noisy neighbour:  what the container should never need
  Also to prevent bad behaviour.  Moreover, to ensure there will be over capacity by containing the runtime of each individual containers

As part of our deployment strategy with Kubernetes, we need to think if we want to be pessimistic or optimistic.

If we are pessimistic, we'll always have enough resources, but the amount of resources will be higher.  And with resources in the cloud, the cost is higher.

If we are optimistic, it will be cheaper, but we might run out of capacity sometimes.

Kubernetes gives us the flexibility to make that decision ourselves.

gha_language: SCSS


text:
# xamla_egomo

### What is Xamla Egomo?

Egomo is an open-source research vision sensor developed at [Xamla](http://www.xamla.com/) for adaptive robotics research on a [Universal Robot UR5](http://www.universal-robots.com/) equipped with [Robotiq](http://robotiq.com/) end-of-arm technology. It integrates consumer cameras like the Logitech C920 and Structure IO and allows you to mount them on a robotic arm. It acts as a low-cost, 3D-printable reference smart-sensor device for our [ROSVITA](http://www.xamla.com/rosvita/) robot programming IDE which is currently under development (to be released in 2017).
For more information and product pictures visit the [egomo website](http://xamla.com/egomo).

Video: Watch our UR5 robot [stacking duplos](https://www.youtube.com/watch?v=uo04vuXcwlw) using the Egomo sensor (source code of the demo can be found [here](/egomo_demos/duplo_stacking)).

![sensorhead1](egomo_3d_printed_parts/egomo-1/images/egomo_left.jpg "Egomo sensor head side view, showing that the webcam can be mounten on the side as well as in the front.")

![sensorhead2](egomo_3d_printed_parts/egomo-1/images/egomo_front.jpg "Egomo sensor head front view")

### Unique Features of Xamla Egomo

* 2D+3D: two side- and front view Logitech C920 cameras in combinaton with a structure IO depth sensor, ideal for RGB-D scans and visual servoing experiments
* NO CABLES: wireless connection of all sensors and and the gripper (no cabled device offers more available joint-configuration space)!
* ROS: the functionalty of all sensors + actuators is exposed as ROS nodes
* EASY: A Lua client library is included which allows to capture images and move the robot to capturing poses + demos are provided
* The IO-board allows to directly connect a Robotiq 2-Finger-Gripper and a Robotiq FT-300 force torque sensor to Egomo. It also has IO ports for laser, high-power white/IR LEDs, simple grippers or tactile sensors (e.g. force-sensitive resistors).
* Egomo seamlessly integrates with the [Torch](http://torch.ch/) machine-learning framework (e.g. for deep learning based image segmentation, object detection or advanced RL-experiments).

### Xamla Egomo sensor head ROS Package ###

This package is based on [LUA](https://www.lua.org/) with [Torch](http://torch.ch/) and the wrappers
[torch-ros](https://github.com/Xamla/torch-ros),  [torch-pcl](https://github.com/Xamla/torch-pcl)  and [torch-opencv](https://github.com/VisionLabs/torch-opencv).

This packages comprises (in alphabetical order):

  * [egomo_3d_printed_parts](/egomo_3d_printed_parts): STL files for printing the mounting parts and case of the Egomo sensor.
  * [egomo_demos](/egomo_demos): Demos showing the sensor in action (like pick and place objects).
  * [egomo_depthcam](/egomo_depthcam): Contains a ros-node for the Strucure-IO depth sensor.
  * [egomo_ioboard](/egomo_ioboard): Contains the specs and pinout of the Xamla IO board.
  * [egomo_msgs](/egomo_msgs): ROS Messages, Services, Actions in order to talk to Gripper, Force-Torque Sensor, RGB-Camera, Depth-Camera, Laser, LED
  * [egomo_node](/egomo_node): A ros-node which is responsible for the communication to the IO-Board (e.g. Gripper, Force-Torque, LEDs, Laser).
  * [egomo_pi_image](/egomo_pi_image): Describes the steps required to download and setup our fast booting Raspberry PI linux image.
  * [egomo_tools](/egomo_tools): A client library offering an easy to use interfaces to gripper, structure IO, webcam and the robot itself.
  * [egomo_ur5](/egomo_ur5): Contains URDF Robot description of the UR5 equipped with Egomo sensor head as well as launch files for e.g. gazebo.
  * [egomo_webcam](/egomo_webcam): Contains ros-node for the Logitech C920 webcam.
  * [xamla_egomo](/xamla_egomo) Metapackage

### Calibration ###

We offer an implemented calibration routine [on request](http://xamla.com/en/contact/index.html) as well as CAD-Files when you would like to adapt the sensor head for another robot. In 2017 we will offer [ROSVITA](http://xamla.com/en/rosvita/index.html) which brings a lot of features such as a convenient calibration routine (including full robot calibration).

### Get a pre-assembled Egomo device

You like the idea of open-source hardware but the process of buying parts, 3D printing, soldering, building etc. is too cumbersome and time-intensive for you and you would like to get a tested/working sensor head quickly?
As a convenient solution we offer a pre-assembled version of the Egomo sensor head with all parts installed and tested (good quality 3D printed parts made from ABS Ultrat, Logitech C920 Web-Cam (2x), Structure IO sensor, white LEDs (3x), IR LED, Raspberry Pi 3, Xamla IO-Board, shortened USB cables, a customized RPi operating system on a 16 GB class 10 microSD card and a 20mW 830nm IR line laser (depending on your country's import restrictions)) for EUR 1499 + shipping. If you are interested in this offer please contact us via [E-mail](mailto:egomo@xamla.com).

### Support / Contact ###

If you have any trouble please let us know by [creating an issue](https://github.com/Xamla/xamla_egomo/issues/new). Do not hesitate to contact us via<EMAIL_ADDRESS>for questions, feedback and suggestions. We look forward to hear from you!

To stay always up-to-date about our latest developments you can follow [@xamla on Twitter](https://twitter.com/xamla) or [subscribe](http://xamla.com/en/egomo) to our newsletter.

branch_name: refs/heads/master

extension: md

license_type: permissive


text:
# milestone-backend

Backend for personal habit/goal setting app.

## Setup

1. Install dependencies using [`yarn` classic](https://classic.yarnpkg.com/lang/en/), [MongoDB](https://docs.mongodb.com/manual/administration/install-community/), [`nodemon` (install it globally)](https://www.npmjs.com/package/nodemon).
1. To build(?)/setup Mongo locally (might not need this step... Check in future. Also check if I should commit generated Mongo files)
   1. `sudo mkdir -p ./data/db/`
   1. `sudo chown `id -u` ./data/db`
   1. `yarn db-start`
1. Once MongoDB is setup and running, setup the dev environment db by following the steps in "Setup and Look Around the DB" section below
1. To run development server: `yarn dev`

The Express server should be running on `localhost:3000`.
The MongoDb server should be running on `mongodb://localhost:27017`.

## DB Stuff

For now, I'm going to be using the following naming convention for this project's MongoDB databases: `ms<Environemnt>DB` (example: `msDevDB`).

### Setup and Look Around the DB

I'm using a Mongo Compass to look view/edit my DB's. [You can get it here](https://docs.mongodb.com/compass/master/install). [For visuals for the below steps, you can take a look here](https://www.mongodb.com/basics/create-database#creating-with-compass)

1. Start up the MongoDB server running (with `yarn dev`).
1. Then open Compass and connect to it by pasting this url `mongodb://localhost:27017`.
1. Create a new database by pressing the "Create Database" button on the top left corner of Compass.
   1. Name it to `msDevDB`,
   1. For the required collection name, use `milestones`.

Your DB should be all setup now for dev!

> If the `msDevDB` only contains an empty collection, nothing might show up when viewing in Compass when you reopen it. This is normal behavior. It will show up once you have at least one document.

## API Stuff

I'm using Postman to play around with endpoints. You can look at my local collection here.

[![Run in Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/e18675b2bafae3b5e536)

license: MIT

repository: BrandenSoropia/milestone-backend

branch_name: refs/heads/main

repo_name: BrandenSoropia/milestone-backend


text:
---
title: "Find Screen"
metaTitle: "Application find screen"
metaDescription: "Documentation for application home screen"
---

The find screen was originally supposed to act as a tool to find nearby deskball users using the familiar Google Maps.
It was set up with a personalized API key which is shown in the documents, however, it is set to expire in January 2021.

#### Files
You can find the screen built in the following file after opening the repository:

- [/lib/screens/find.dart](https://github.com/TheDJZiegler/deskball_mobile_app/blob/master/lib/screens/find.dart)

There were plans to develop the find screen so that it would be more interactive for the user, however, they was a change
in priority and so a lot of the code found in the file above is commented out in order to provide basic functionaility in
the simulation of the application. You can find the API code in the following files:

- [/android/secure.properties](https://github.com/TheDJZiegler/deskball_mobile_app/blob/master/android/secure.properties)
- [/android/app/src/main/AndroidManifest.xml](https://github.com/TheDJZiegler/deskball_mobile_app/blob/master/android/app/src/main/AndroidManifest.xml)
- [/ios/Runner/AppDelegate.swift](https://github.com/TheDJZiegler/deskball_mobile_app/blob/master/ios/Runner/AppDelegate.swift)

The first two files set up Google Maps in the Find screen for the android side. The third file sets up google maps for the ios side. If there are plans to add/renew the Google Maps API key, it will be done here.

[Here is a current display of the Find Screen.](https://github.com/mirandaricky9/Deskball-Docs/blob/main/content/screenshots/findScreen.png)

repository: TheDJZiegler/Deskball-Docs

gha_language: JavaScript

gha_license_id: MIT

repo_name: TheDJZiegler/Deskball-Docs


text:
# Node Wrapper for AWS Lambda

[![JavaScript Standard Style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)

Runs recent versions of Node.js on AWS Lambda. Tested with Node.js v4.2.4.

## Rationale

[AWS Lambda](https://aws.amazon.com/lambda/)
is sweet but at the time of this writing, it still
[runs on Node.js v0.10.36](http://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html),
which is ancient. The docs
[suggest](https://aws.amazon.com/blogs/compute/running-executables-in-aws-lambda/)
including your own `node` binary in the package zip. This little app
demonstrates that concept.

## Usage

0. Make sure you have Node.js and [Gulp](http://gulpjs.com/) installed.
1. Clone this repository and `npm install` it.
2. Create a Lambda function. By default, this app uses `node-wrapper` in the
`eu-west-1` region; you can change that in `gulpfile.babel.js`.
3. Run `gulp deploy` to deploy the function.
4. Run the Lambda function.
5. View the logs.

## Findings

- Because zip files don't support permissions, you need to `chmod` the `node`
binary at runtime. However, the file is read-only, so you need to copy it
to `/tmp` first. Obviously, this implies a performance hit.

- With the 512 MB Lambda configuration, copying `node` takes about 300 ms, and
spawning the (trivial) child script adds another 300 ms. Even if your code isn't
time-critical, this slowdown will still impact your AWS bill.

- Even without the latest Node, deploying a Lambda is a hassle due to the fact
that you need to include the required `node_modules` manually. For the sake of
simplicity, this app only relies on `babel-runtime`.

## Author

[Tim De Pauw](https://github.com/timdp)

## License

MIT

repository: timdp/aws-lambda-node-wrapper

repo_name: timdp/aws-lambda-node-wrapper


text:
---
date: 2023-05-15

layout: post
title: Automating Google Photos download # Project post title
description: What's the lazy way?

comments: true
published: true

---
# The Problem

For the past five years, I have been a big admirer of Google and have used several of their services including Google Photos, Gmail, and Google Maps. I particularly rely on Google Photos to automatically upload and store my photos and videos. While Google offers free 15 GB of storage, recently, I have been capturing a lot of videos during special occasions, and they are quite long, resulting in me exceeding the free storage limit. To ensure I can continue backing up my photos and videos, I had to upgrade to the basic membership, which offers 100GB of storage, at a reasonable monthly fee of $2.79.

The amount may not seem like much at the moment. However, the amount of media stored in my Google Photos will only keep going up and I would have to constantly delete unwanted photos. Considering the potential cost over my lifetime and possible price increases by Google, I have adapted a script that utilizes Google Photos REST API to download all files automatically. This way, I can save money and also have offline backups of my precious memories in the event that I lost access to my Google account.

# The Solution

To create this script, I first sought out resources online to better understand and experiment with the Google Photos REST API. I found a helpful [Medium post](https://towardsdatascience.com/how-to-download-images-from-google-photos-using-python-and-photos-library-api-6f9c1e60a3f3) by Dominik Polzer (Jupyter notebook may be found [here](https://github.com/polzerdo55862/google-photos-api/blob/main/Google_API.ipynb)), which provided me with the necessary knowledge to use the API. After studying the code and playing around with it, I was able to successfully adapt it for my own use.

The codes written by Dominik work well generally and it is able to connect to your Google Photos with no issue after following the provided steps to obtain your credentials. However, upon further testing, I found that there are generally two main issues:

1. All images are downloaded as 512 by 288  instead of the original dimension.
2. All videos are downloaded as jpg instead of mp4 files.

With that said, Dominik's notebook would be sufficient if you intend to download all media as images in 512 by 288 dimension. My adapted codes may be found on my [github](https://github.com/brandonyongys/gphotos).

# The Code

## The credentials

The `GooglePhotosApi`, as found in my `gphotos.py` file, is as written by Dominik. The only change I made is to add a new function, `delete_pickle_file`, to delete the token file after each run. This is to, in my opinion, add a layer of security so that the user does not accidentally upload the token file online, which allows others to access the user's Google Photos. Though the user could always setup a `gitignore` file

## The downloads

The download functions are found in the `gphotos_download.py` file and they have been adapted from Dominik's original codes to address the two issues I've highlighted earlier. To resolve the issues, I've referenced the [Google Photos API](https://developers.google.com/photos/library/guides/access-media-items) on accessing media items.

The photo and video media files would generally have the same set of reponse. The only difference is in the `mediaMetadata`. The width, height and creation time would be available for both photo and video. However, both photo and video would have slightly different metadata of the camera, as shown below (as quoted from Google Photos API web):

**Metadata for photo:**
~~~
"mediaMetadata": {
"width": "media-item-width",
"height": "media-item-height",
"creationTime": "media-item-creation-time",
"photo": {
    "cameraMake": "make-of-the-camera",
    "cameraModel": "model-of-the-camera",
    "focalLength": "focal-length-of-the-camera-lens",
    "apertureFNumber": "aperture-f-number-of-the-camera-lens",
    "isoEquivalent": "iso-of-the-camera",
    "exposureTime": "exposure-time-of-the-camera-aperture"
    }
  }
~~~

**Metadata for video:**
~~~
"mediaMetadata": {
"width": "media-item-width",
"height": "media-item-height",
"creationTime": "media-item-creation-time",
"video": {
    "cameraMake": "make-of-the-camera",
    "cameraModel": "model-of-the-camera",
    "fps": "frame-rate-of-the-video",
    "status": "READY"
    },
  }
~~~

* **Issue 1:** All images are downloaded as xxx by xxx instead of the original dimension.
    * In order to download the photos as per the original dimension, the width and height would need to be extracted.
    * These information are then appended to the end of the `baseURL` with the line: `url += f"=w{item['width']}-h{item['height']}"` where `item` is the media item, `width` and `height` are the original dimension.

* **Issue 2:** All videos are downloaded as jpg instead of mp4 files
    * In order to download the videos as mp4 files, it would need to be identified correctly first. Hence, the check for `video` in the `mediaMetadata`.
    * The `baseURL` is then appended with `=dv` with the line: `url += f"=dv"`

I've also adapted the codes to allow the user to either download photos and/or videos. This is especially useful in my use case where videos are taking up 15GB (my entire free storage) and I could simply download them without having to screen through my Google Photos manually.

Though I would have to acknowledge that there are some limitations to the codes. The first is that there is a lack of ability of delete the media on Google Photos after successful download. According to this [issue tracker](https://issuetracker.google.com/issues/80162783?pli=1), this API call would not be available as of Feb 2022.

# The End

While my code may not be the most polished or organized, I am pleased with its functionality and the benefits it provides for me and others who are seeking to save on their storage usage. I would like to say thank you and give the credit to Dominik Polzer, who has very kindly posted a helpful Medium post.


text:
# [Method does not presize the allocation of a collection](http://fb-contrib.sourceforge.net/bugdescriptions.html#PSC_PRESIZE_COLLECTIONS)

This method allocates a collection using the default constructor even though it is known
			a priori (or at least can be reasonably guessed) how many items are going to be placed in the collection,
			and thus needlessly causes intermediate reallocations of the collection.

You can use the constructor that takes an initial size and that will be much better, but
			due to the loadFactor of Maps and Sets, even this will not be a correct estimate.

If you are using Guava, use its methods that allocate maps and sets with a predetermined size,
			to get the best chance for no reallocations, such as:

*   Sets.newHashSetWithExpectedSize(int)
*   Maps.newHashMapWithExpectedSize(int)

			If not, a good estimate would be the expectedSize / {LOADING_FACTOR} which by default is 0.75

repository: codacy/codacy-spotbugs

gha_language: Scala

gha_license_id: NOASSERTION

repo_name: codacy/codacy-spotbugs


text:
---
layout: default
---

# 1997-11-17 - No Subject

## Header Data

From: jjn43<EMAIL_ADDRESS>To<EMAIL_ADDRESS>Message Hash: f209f69643c55d5a919d66d7104b92a126efaa6e71a427f8ae5714573191bf6d

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1997-11-17 07:18:34 UTC

Raw Date: Sun, 16 Nov 1997 23:18:34 -0800 (PST)

## Raw message

```
{% raw  %}From: jjn43<EMAIL_ADDRESS>Date: Sun, 16 Nov 1997 23:18:34 -0800 (PST)
To<EMAIL_ADDRESS>Subject: No Subject
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

Authenticated sender is<EMAIL_ADDRESS>Subject:  Sunday
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit

MASS EMAIL WORKS!!!

It's quick, easy and effective!!
Mass email and targeted email marketing works!
With our special program we not only provide you with up to
30 MILLION email addresses, we also provide you with a terrific
mass emailing software FREE.  Imagine reaching 30 MILLION people!
With regular advertising it would cost you in the hundreds of
thousands of dollars.  Even if your response rate was 1 out of
20 thousand you would have many prospects right now.  If you are
getting this message by email then you do not need any additional
hardware or software.  We also have TARGETED email software providing
you TARGETED email lists!
Our Easy Email Business Package includes:

1) 20 or 30 MILLION email addresses
2)Special Mass Email Software that allows you to send upwards of 20
to 100 thousand ads per hour(depending upon ad length, system, traffic etc.)
3) Instruction Guide
4) How to Automate your mailings
5) How to write an effective email-ad...with samples
6) A list of "Friendly" internet service providers that allow
you to send mass-email on their systems
7) How to avoid Flames
8) Pages of "HOT" products to sell now...if you do not
already have one :)
9) How To Guide... Operate Your Own On-Line Business Part-Time
10) The 10 Secrets Bulk-Emailers do not want you to know
11) Many other valuable tips and tools

We cannot promise you success, but we know because WE DO IT, that
if you EMAIL consistently, the process works.  It' as simple as that...
and it pays for itself with just a few orders.  Also, If you need
targeted email lists call us for information about our NEW Bull's Eye
Gold software!!  Bull's Eye Gold allows you to AUTOMATICALLY collect
targeted email lists using ANY search criteria!

CALL FOR MORE INFORMATION!!!<PHONE_NUMBER>
CALL FOR MORE INFORMATION!!!<PHONE_NUMBER>

-------------------ORDERING INFORMATION-------------------
Customer Name...
Address
City                             State
Zip
Phone
Fax
Email Address

Please Check Below:

_________ EASY EMAIL BUSINESS PACKAGE for just           $259.00
           Includes 20 million email addresses on CD,
           FREE bulk email software, instructions and technical
           support

_________ MEGA-EASY EMAIL PACKAGE for just               $359.00
           Includes 30 Million email addresses on CD,
           FREE bulk email software, instructions and technical
           support

_________ Bull's Eye Gold Software for just              $259.00
           Includes automated email target marketing software
           on CD or disks, instructions and technical support
_________ Shipping & Handling   (2-3 Day FedEx)          $10.00
                                (FedEx Overnite)         $20.00

__________ TOTAL
              (CA Residents add applicable sales tax)

******** CREDIT CARDS ACCEPTED ********

MASTERCARD - VISA - AMEX

PLEASE CALL<PHONE_NUMBER> to process your order
8:00 am - 5:00 p.m. Pacific Time

Ckecks or Money Orders send to:

WorldTouch Network, Inc.
5670 Wilshire Blvd.
Suite 2170
Los Angeles, CA 90036

If you have questions...please call Customer
Service at<PHONE_NUMBER>.

{% endraw %}
```

## Thread

+ Return to [November 1997](/archive/1997/11)

+ Return to "[jjn43 <jjn43@ix.netcom.com>](/authors/jjn43_jjn43_at_ix_netcom_com_)"

+ 1997-11-17 (Sun, 16 Nov 1997 23:18:34 -0800 (PST)) - No Subject - _jjn43<EMAIL_ADDRESS>


text:
#XSS

Objective 1:  Identify two places that are vulnerable to XSS.

Objective 2: Exploit the XSS.
Do this both manually and try using a tool such as BeEF.

Objective 3: Fix the XSS so that the pages are no longer vulnerable.

Please read:
https://www.owasp.org/index.php/Top_10_2013-A3-Cross-Site_Scripting_(XSS)

For a walkthrough please read:
http://blog.securitymagick.com/2015/10/xss.html


text:
---
title: Use Forms Designer to create Document of Record (DoR) templates and form fragments
description: Use [!DNL AEM Forms] designer to create Document of Record templates.
exl-id: 88a95374-620c-45a9-ae94-2043b542fd62
---
# Using Designer {#install-designer}

Designer is a point-and-click graphical form design tool that simplifies the creation of XDP form templates. You can design a form template, define its logic, and meet strict legislative requirements. These templates server as a Document of Record template for an Adaptive Form. These forms templates are different from [Adaptive Form templates](template-editor.md).

The following documents provide instructions to use designer to create XDP templates and PDF forms:

+ [Using Designer](assets/using-designer-cs.pdf)
+ [Designer Quick Start Tutorials](https://helpx.adobe.com/content/dam/help/en/experience-manager/6-5/forms/pdf/designer-quickstart.pdf)
+ [Designer Samples](https://helpx.adobe.com/content/dam/help/en/experience-manager/6-5/forms/pdf/designer-samples.pdf)
+ [Designer Scripting Basics](https://helpx.adobe.com/content/dam/help/en/experience-manager/6-5/forms/pdf/scripting-basics.pdf)
+ [Designer Scripting Reference](https://helpx.adobe.com/content/dam/help/en/experience-manager/6-5/forms/pdf/scripting-reference.pdf)
+ [Designer FormCalc Reference](https://helpx.adobe.com/content/dam/help/en/experience-manager/6-5/forms/pdf/formcalc-reference.pdf)


text:
<!--Copyright 2023 The HuggingFace Team. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
-->

# Improve image quality with deterministic generation

[[open-in-colab]]

A common way to improve the quality of generated images is with *deterministic batch generation*, generate a batch of images and select one image to improve with a more detailed prompt in a second round of inference. The key is to pass a list of [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html#generator)'s to the pipeline for batched image generation, and tie each `Generator` to a seed so you can reuse it for an image.

Let's use [`runwayml/stable-diffusion-v1-5`](runwayml/stable-diffusion-v1-5) for example, and generate several versions of the following prompt:

```py
prompt = "Labrador in the style of Vermeer"
```

Instantiate a pipeline with [`DiffusionPipeline.from_pretrained`] and place it on a GPU (if available):

```python
>>> from diffusers import DiffusionPipeline

>>> pipe = DiffusionPipeline.from_pretrained(
...     "runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16, use_safetensors=True
... )
>>> pipe = pipe.to("cuda")
```

Now, define four different `Generator`'s and assign each `Generator` a seed (`0` to `3`) so you can reuse a `Generator` later for a specific image:

```python
>>> import torch

>>> generator = [torch.Generator(device="cuda").manual_seed(i) for i in range(4)]
```

Generate the images and have a look:

```python
>>> images = pipe(prompt, generator=generator, num_images_per_prompt=4).images
>>> images
```

![img](https://huggingface.co/datasets/diffusers/diffusers-images-docs/resolve/main/reusabe_seeds.jpg)

In this example, you'll improve upon the first image - but in reality, you can use any image you want (even the image with double sets of eyes!). The first image used the `Generator` with seed `0`, so you'll reuse that `Generator` for the second round of inference. To improve the quality of the image, add some additional text to the prompt:

```python
prompt = [prompt + t for t in [", highly realistic", ", artsy", ", trending", ", colorful"]]
generator = [torch.Generator(device="cuda").manual_seed(0) for i in range(4)]
```

Create four generators with seed `0`, and generate another batch of images, all of which should look like the first image from the previous round!

```python
>>> images = pipe(prompt, generator=generator).images
>>> images
```

![img](https://huggingface.co/datasets/diffusers/diffusers-images-docs/resolve/main/reusabe_seeds_2.jpg)

repository: huggingface/diffusers

gha_language: Python

repo_name: huggingface/diffusers


text:
# CFP
This repository contains information needed to answer call for papers.

It is modeled after the [Booster Conf 2020][booster] call for papers request.

## Talk length
3 hours

## Title
How agile is your agile?

## Abstract
Agile development is a staple of modern day development. But how does the promise pan out when the keyboards start clicking? What works and what doesn't?

In this workshop we invite you to bring your experience and showcase it in a handsone manner. We will challenge you to develop a working application. When the dust settles we would like to discuss what worked, what didn't work and what can we take away from the experience.

## What roles is this workshop appropriate for?
Developer, Tester/Test lead, Architect, Designer

## Outline
The participants are welcomed to the workshop. We introduce them to the goal of the workshop. Participants will be presented with a set of use-cases that need to be implemented. We will ask to form teams and set the timer.
During the implementation face participants will need to adjust to changes requirements.
Afterwards we will have an open discussion, relating the experience of the workshop to every day development.

## Maximum number of participants
40

## Have you held this workshop before
This will be the first time this workshop will be given.

## What do participants have to bring to the workshop
Participants should bring a laptop on which to prototype, or develop an application. Willingness to critique their own processes, and share experience with others

## Additional speakers

[booster]: https://2020.boosterconf.no/

repository: HermannEbbinghaus/CFP

repo_name: HermannEbbinghaus/CFP


text:
# App Mesh with EKS—Base Deployment

We will cover the base setup of AppMesh with EKS in this part.

## Prerequisites

In order to successfully carry out the base deployment:

- Make sure to have newest [AWS CLI](https://aws.amazon.com/cli/) installed, that is, version `1.18.82` or above.
- Make sure to have `kubectl` [installed](https://kubernetes.io/docs/tasks/tools/install-kubectl/), at least version `1.13` or above.
- Make sure to have `jq` [installed](https://stedolan.github.io/jq/download/).
- Make sure to have `aws-iam-authenticator` [installed](https://github.com/kubernetes-sigs/aws-iam-authenticator), required for eksctl
- Make sure to have `helm` [installed](https://helm.sh/docs/intro/install/).
- Install [eksctl](https://eksctl.io/). See [appendix](#appendix) for eksctl install instructions. Please make you have version `0.21.0` or above installed

Note that this walkthrough assumes throughout to operate in the `us-west-2` region.

```sh
export AWS_DEFAULT_REGION=us-west-2
```

## Cluster provisioning

Create an EKS cluster with `eksctl` using the following command:

```sh
eksctl create cluster \
--name appmeshtest \
--nodes-min 2 \
--nodes-max 3 \
--nodes 2 \
--auto-kubeconfig \
--full-ecr-access \
--appmesh-access
# ...
# [✔]  EKS cluster "appmeshtest" in "us-west-2" region is ready
```

When completed, update the `KUBECONFIG` environment variable according to the `eksctl` output:

```sh
export KUBECONFIG=~/.kube/eksctl/clusters/appmeshtest
```

## Install App Mesh  Kubernetes components

In order to automatically inject App Mesh components and proxies on pod creation we need to create some custom resources on the clusters. We will use *helm* for that.

**Code base**

Clone the repo and cd into the appropriate directory. We will be running all commands from this path.
```sh
git clone https://github.com/aws/aws-app-mesh-examples.git
cd aws-app-mesh-examples/walkthroughs/eks/
```

**Install App Mesh Components**

Run the following set of commands to install the App Mesh controller

```sh
helm repo add eks https://aws.github.io/eks-charts
helm repo update
kubectl create ns appmesh-system
kubectl apply -k "https://github.com/aws/eks-charts/stable/appmesh-controller/crds?ref=master"
helm upgrade -i appmesh-controller eks/appmesh-controller --namespace appmesh-system

```

Now you're all set, you've provisioned the EKS cluster and set up App Mesh components that automate injection of Envoy and take care of the life cycle management of the App Mesh resources such as meshes, virtual nodes, virtual services, and virtual routers.

At this point, you also might want to check the custom resources the App Mesh Controller uses:

```sh
kubectl api-resources --api-group=appmesh.k8s.aws
# NAME              SHORTNAMES   APIGROUP          NAMESPACED   KIND
# meshes                         appmesh.k8s.aws   false        Mesh
# virtualnodes                   appmesh.k8s.aws   true         VirtualNode
# virtualrouters                 appmesh.k8s.aws   true         VirtualRouter
# virtualservices                appmesh.k8s.aws   true         VirtualService
```

## The application

We use the [howto-k8s-http2](https://github.com/aws/aws-app-mesh-examples/tree/main/walkthroughs/howto-k8s-http2) to demonstrate the usage of App Mesh with EKS.

Make sure all resources have been created, using the following command:

```sh
kubectl -n appmesh-system get deploy,po,svc

NAME                                 READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/appmesh-controller   1/1     1            1           19h

NAME                                      READY   STATUS    RESTARTS   AGE
pod/appmesh-controller-5954995557-tsnf9   1/1     Running   0          19h

NAME                                         TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)              AGE
service/appmesh-controller-webhook-service   ClusterIP   <IP_ADDRESS>    <none>        443/TCP              19h
```

```sh
kubectl get pod -n howto-k8s-http2 -o wide

NAME                      READY   STATUS    RESTARTS   AGE     IP               NODE                                          NOMINATED NODE   READINESS GATES
blue-64885d7dd6-bjlx5     2/2     Running   0          3m48s   <IP_ADDRESS>   ip-192-168-70-3.us-west-2.compute.internal    <none>           1/1
client-6ddfdd884d-l9nvv   2/2     Running   0          3m49s   <IP_ADDRESS>   ip-192-168-70-3.us-west-2.compute.internal    <none>           1/1
green-5674cfb556-65qch    2/2     Running   0          3m48s   <IP_ADDRESS>    ip-192-168-4-114.us-west-2.compute.internal   <none>           1/1
red-5bf7f49fbd-86f54      2/2     Running   0          3m49s   <IP_ADDRESS>    ip-192-168-70-3.us-west-2.compute.internal    <none>           1/1
```

Now, validate the mesh creation using the `aws` CLI:

```sh
aws appmesh list-meshes

# {
#    "meshes": [
#        {
#            "arn": "arn:aws:appmesh:us-west-2:1234567890:mesh/howto-k8s-http2",
#            "createdAt":<PHONE_NUMBER>.868,
#            "lastUpdatedAt":<PHONE_NUMBER>.868,
#            "meshName": "howto-k8s-http2",
#            "meshOwner": "1234567890",
#            "resourceOwner": "1234567890",
#            "version": 1
#        }
#    ]
# }

aws appmesh list-virtual-services --mesh-name howto-k8s-http2

# {
#    "virtualServices": [
#        {
#            "arn": "arn:aws:appmesh:us-west-2:1234567890:mesh/howto-k8s-http2/virtualService/color.howto-k8s-http2.svc.cluster.local",
#            "createdAt":<PHONE_NUMBER>.971,
#            "lastUpdatedAt":<PHONE_NUMBER>.237,
#            "meshName": "howto-k8s-http2",
#            "meshOwner": "1234567890",
#            "resourceOwner": "1234567890",
#            "version": 2,
#            "virtualServiceName": "color.howto-k8s-http2.svc.cluster.local"
#        }
#    ]
# }

aws appmesh list-virtual-nodes --mesh-name howto-k8s-http2

# {
#    "virtualNodes": [
#        {
#            "arn": "arn:aws:appmesh:us-west-2:1234567890:mesh/howto-k8s-http2/virtualNode/green_howto-k8s-http2",
#            "createdAt":<PHONE_NUMBER>.934,
#            "lastUpdatedAt":<PHONE_NUMBER>.934,
#            "meshName": "howto-k8s-http2",
#            "meshOwner": "1234567890",
#            "resourceOwner": "1234567890",
#            "version": 1,
#            "virtualNodeName": "green_howto-k8s-http2"
#        },
#        {
#            "arn": "arn:aws:appmesh:us-west-2:1234567890:mesh/howto-k8s-http2/virtualNode/client_howto-k8s-http2",
#            "createdAt":<PHONE_NUMBER>.965,
#            "lastUpdatedAt":<PHONE_NUMBER>.965,
#            "meshName": "howto-k8s-http2",
#            "meshOwner": "1234567890",
#            "resourceOwner": "1234567890",
#            "version": 1,
#            "virtualNodeName": "client_howto-k8s-http2"
#        },
#        {
#            "arn": "arn:aws:appmesh:us-west-2:1234567890:mesh/howto-k8s-http2/virtualNode/blue_howto-k8s-http2",
#            "createdAt":<PHONE_NUMBER>.929,
#            "lastUpdatedAt":<PHONE_NUMBER>.929,
#            "meshName": "howto-k8s-http2",
#            "meshOwner": "1234567890",
#            "resourceOwner": "1234567890",
#            "version": 1,
#            "virtualNodeName": "blue_howto-k8s-http2"
#        },
#        {
#            "arn": "arn:aws:appmesh:us-west-2:1234567890:mesh/howto-k8s-http2/virtualNode/red_howto-k8s-http2",
#            "createdAt":<PHONE_NUMBER>.91,
#            "lastUpdatedAt":<PHONE_NUMBER>.91,
#            "meshName": "howto-k8s-http2",
#            "meshOwner": "1234567890",
#            "resourceOwner": "1234567890",
#            "version": 1,
#            "virtualNodeName": "red_howto-k8s-http2"
#        }
#    ]
# }

aws appmesh list-virtual-routers --mesh-name howto-k8s-http2

# {
#     "virtualRouters": [
#        {
#            "arn": "arn:aws:appmesh:us-west-2:1234567890:mesh/howto-k8s-http2/virtualRouter/color_howto-k8s-http2",
#            "createdAt":<PHONE_NUMBER>.039,
#            "lastUpdatedAt":<PHONE_NUMBER>.039,
#            "meshName": "howto-k8s-http2",
#            "meshOwner": "1234567890",
#            "resourceOwner": "1234567890",
#            "version": 1,
#            "virtualRouterName": "color_howto-k8s-http2"
#        }
#    ]
# }

```

You can access the `color` service of the app in-cluster as follows:

```sh
kubectl -n howto-k8s-http2 port-forward deployment/client 7000:8080 &

# Color virtual service uses the color virtual router with even distribution to 3 virtual nodes (red, blue, and green) over HTTP/2. Prove this by running the following command a few times:

curl localhost:7000/color ; echo;
red

curl localhost:7000/color ; echo;
green

curl localhost:7000/color ; echo;
blue
```

With this you're done concerning the base deployment. You can now move on to day 2 ops tasks such as using [CloudWatch](o11y-cloudwatch.md) with App Mesh on EKS.

## Clean-up

The AWS App Mesh Controller For Kubernetes performs clean-up of the mesh and its dependent resources (virtual nodes, services, virtual routers etc.) when deleting the demo namespace and the mesh custom resource like so:

```sh
kubectl delete ns howto-k8s-http2 && kubectl delete mesh howto-k8s-http2
```

```sh
helm delete appmesh-controller -n appmesh-system
```

Finally, get rid of the EKS cluster to free all compute, networking, and storage resources, using:

```sh
eksctl delete cluster --name appmeshtest
```

## Appendix

### eksctl Installation

```sh
curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp

sudo mv -v /tmp/eksctl /usr/local/bin
```

```sh
eksctl version
0.21.0
```

repository: aws/aws-app-mesh-examples

gha_language: Shell

repo_name: aws/aws-app-mesh-examples


text:
# PHP Option Type

This package implements the Option type for PHP!

![Banner](https://user-images.githubusercontent.com/2829600/71564011-3077bf00-2a91-11ea-9083-905702cc262b.png)

## Motivation

The Option type is intended for cases where you sometimes might return a value
(typically an object), and sometimes you might return a base value (typically
null) depending on arguments, or other runtime factors.

Often times, you forget to handle the case where a base value should be
returned. Not intentionally of course, but maybe you did not account for all
possible states of the system; or maybe you indeed covered all cases, then time
goes on, code is refactored, some of these your checks might become invalid, or
incomplete. Suddenly, without noticing, the base value case is not handled
anymore.

On one hand, the Option type forces a developer to consciously think about both
cases (returning a value, or returning a base value). That in itself will
already make your code more robust. On the other hand, the Option type also
allows the API developer to provide more concise API methods, and empowers the
API user in how he consumes these methods.

## Installation

Installation is super-easy via [Composer](https://getcomposer.org/):

```bash
$ composer require phpoption/phpoption
```

or add it by hand to your `composer.json` file.

## Usage

### Using the Option Type in your API

```php
class MyRepository
{
    public function findSomeEntity($criteria): \PhpOption\Option
    {
        if (null !== $entity = $this->em->find(...)) {
            return new \PhpOption\Some($entity);
        }

        // We use a singleton, for the None case.
        return \PhpOption\None::create();
    }
}
```

If you are consuming an existing library, you can also use a shorter version
which by default treats `null` as `None`, and everything else as `Some` case:

```php
class MyRepository
{
    public function findSomeEntity($criteria): \PhpOption\Option
    {
        return \PhpOption\Option::fromValue($this->em->find(...));

        // or, if you want to change the none value to false for example:
        return \PhpOption\Option::fromValue($this->em->find(...), false);
    }
}
```

### Case 1: You always Require an Entity in Calling Code

```php
$entity = $repo->findSomeEntity(...)->get(); // returns entity, or throws exception
```

### Case 2: Fallback to Default Value If Not Available

```php
$entity = $repo->findSomeEntity(...)->getOrElse(new Entity());

// Or, if you want to lazily create the entity.
$entity = $repo->findSomeEntity(...)->getOrCall(function() {
    return new Entity();
});
```

## More Examples

### No More Boiler Plate Code

```php
// Before
$entity = $this->findSomeEntity();
if (null === $entity) {
    throw new NotFoundException();
}
echo $entity->name;

// After
echo $this->findSomeEntity()->get()->name;
```

### No More Control Flow Exceptions

```php
// Before
try {
    $entity = $this->findSomeEntity();
} catch (NotFoundException $ex) {
    $entity = new Entity();
}

// After
$entity = $this->findSomeEntity()->getOrElse(new Entity());
```

### More Concise Null Handling

```php
// Before
$entity = $this->findSomeEntity();
if (null === $entity) {
    return new Entity();
}

return $entity;

// After
return $this->findSomeEntity()->getOrElse(new Entity());
```

### Trying Multiple Alternative Options

If you'd like to try multiple alternatives, the `orElse` method allows you to
do this very elegantly:

```php
return $this->findSomeEntity()
    ->orElse($this->findSomeOtherEntity())
    ->orElse($this->createEntity());
```
The first option which is non-empty will be returned. This is especially useful
with lazy-evaluated options, see below.

### Lazy-Evaluated Options

The above example has the flaw that we would need to evaluate all options when
the method is called which creates unnecessary overhead if the first option is
already non-empty.

Fortunately, we can easily solve this by using the `LazyOption` class:

```php
return $this->findSomeEntity()
    ->orElse(new LazyOption(array($this, 'findSomeOtherEntity')))
    ->orElse(new LazyOption(array($this, 'createEntity')));
```

This way, only the options that are necessary will actually be evaluated.

## Performance Considerations

Of course, performance is important.  The overhead incurred by the Option
type comes down to the time that it takes to create one object, our wrapper,
and one additional method call to retrieve the value from the wrapper. Unless
you plan to call a method thousands of times during a request, there is no
reason to stick to the `object|null` return value; better give your code some
options!

## Security

If you discover a security vulnerability within this package, please send an email to<EMAIL_ADDRESS>All security vulnerabilities will be promptly addressed. You may view our full security policy [here](https://github.com/schmittjoh/php-option/security/policy).

## License

PHP Option Type is licensed under [Apache License 2.0](LICENSE).

## For Enterprise

Available as part of the Tidelift Subscription

The maintainers of `phpoption/phpoption` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-phpoption-phpoption?utm_source=packagist-phpoption-phpoption&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)

repository: schmittjoh/php-option

gha_language: PHP

repo_name: schmittjoh/php-option


text:
<!-- markdownlint-disable-next-line first-line-h1 -->
{row}
{column width=12}

### Annotation Location

<!-- markdownlint-disable-next-line first-line-h1 -->
${synapsetable?query=select id as "Submission Id"%2C createdOn as "CreatedOn"%2C submitterid as Submitter%2C dataset%5Fname as "Dataset Name"%2Cdataset%5Fversion as "Dataset Version"%2C tool%5F%5Fapi%5Fversion as "Tool Api Version"%2C tool%5F%5Fname as "Tool Name"%2C tool%5F%5Furl as "Tool URL"%2C tool%5F%5Fdescription as "Tool Description"%2C tool%5F%5Flicense as "License"%2Clocation%5FF1%5Finstance%5Frelax  as "F1 Instance Relax"%2Clocation%5FF1%5Finstance%5Fstrict as "F1 Instance Strict"%2Clocation%5FF1%5Ftoken%5Fstrict as "F1 Token Strict"%2C dockerrepositoryname as Repository%2C dockerdigest as Digest  from  syn23747126 where evaluationid %3D9614657 and status %3D %27ACCEPTED%27&showquery=false}

{column}
{row}

branch_name: refs/heads/staging


text:
---
title: Intersection
desc: The QIntersection vue component, a wrapper over Quasar's Intersection directive.
keys: QIntersection
examples: QIntersection
related:
  - /vue-directives/intersection
  - /options/transitions
---

The QIntersection component is essentially a wrapper over the [Intersection directive](/vue-directives/intersection) with the added benefit that it handles the state by itself (does not require you to add it and handle it manually) and can optionally have a show/hide transition as well.

The main benefit of using QIntersection is, however, that the DOM tree is freed up of hidden nodes thus using the minimum possible RAM memory and making the page feel very snappy. As well, you can specify the `tag` property for the wrapper element to match your own needs, thus eliminating yet another DOM node.

Under the hood, it uses the [Intersection Observer API](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API).

::: warning
Not all browsers support the Intersection Observer API. Most [modern browsers](https://caniuse.com/#search=intersection) do, but other browsers do not. If you need to support older browsers, you can install and import (into a boot file) the official W3C [polyfill](https://github.com/w3c/IntersectionObserver).
:::

<doc-api file="QIntersection" />

## Usage

::: warning
In most cases, it is required that you apply CSS to the QIntersection element so that it acts as a necessary filler when the inner content is not rendered. This will allow for a smooth scrolling experience, because otherwise the scroll will jump erratically.

An example of such needed CSS would be, for example, a fixed height or at least a min-height (and possibly even a fixed width, as in the examples below, where multiple QIntersections can be displayed on same row).
:::

::: danger
If using the `transition` prop, it is required that the content be wrapped in one and only one element.
:::

::: tip
There are edge cases where the default viewport won't work. For instance, when your code is hosted in an iframe (like Codepen). This is where you need to use the `root` property. It allows you to define an alternative to the viewport as your root (through its DOM element). It is important to keep in mind that root needs to be an ancestor of the observed element.
:::

### Basic

<doc-example title="Basic" file="Basic" scrollable no-edit />

### With transition

In the example below we used a Quasar transition. For a full list, please head to [Transitions](/options/transitions) page.

<doc-example title="With transition" file="Transition" scrollable no-edit />

<doc-example title="A list with transition" file="List" scrollable no-edit />

### Only once

Triggering only once means, however, that you lose the benefit of freeing up the DOM tree. The content will remain in DOM regardless of visibility.

<doc-example title="Triggering only once" file="Once" scrollable no-edit />

The example below uses the `root` property and therefore can be seen in a Codepen (which hosts in an iframe).

<doc-example title="Root viewport" file="Root" scrollable />

repository: quasarframework/quasar

branch_name: refs/heads/dev

repo_name: quasarframework/quasar


text:
# Custom KT Tool
A KT tool build on the Quasar Framework by Razvan Stoenescu.

This KT tool enables you to set up your very own local KT tool.

It's fully customizable and uses the NeDB and a local JSON storage to even make it transportable.

For more information regarding the Quasar Framework head over to: http://quasar-framework.org/
For more information regarding NeDB head over to: https://github.com/louischatriot/nedb/

It's currently still under active development and will soon get it's first raw commit.

Have fun with it and reach out, when you need to know something.

repository: JonasViczian/customkt

repo_name: JonasViczian/customkt


text:
# Coder Forge Website
Beta version. To view the live site goto [http://coderforge.io](http://coderforge.io)

You can contact us at [mailto:coderforge.dublin<EMAIL_ADDRESS>
## Prerequisites

You will need the following things properly installed on your computer.

* [Git](https://git-scm.com/)
* [Node.js](https://nodejs.org/) (with NPM)
* [Bower](https://bower.io/)

## Installation

* `git clone <repository-url>` this repository
* `cd website`
* `npm install`
* `bower install`

## Running / Development

* `npm start`
* Visit your app at [http://localhost:3000](http://localhost:3000).

### Running Tests

* `npm test`

repository: paulmcquad/website

repo_name: paulmcquad/website


text:
Title: SciPy2014 Submissions, Diversity Funding
Date: 2014-04-12
Comments: true
Category: SciPy
Author: The SciPy2014 organizers<EMAIL_ADDRESS>Summary: Submissions due soon, Diversity Funding opportunity

April 1 - Final Submission Deadline!
------------------------------------------------------------

The final deadline for submitting talks, tutorials, posters, and application for sponsorship deadline is April 1, 2014!  This is the last warning that the submissions will be closed so please mark your calendars now. As always, please take a look at a few talks (http://conference.scipy.org/past.html) from previous years, our guidelines for this year (https://conference.scipy.org/scipy2014/participate/presentations/) , and we look forward to reviewing your submissions.

Submit your abstracts today (https://conference.scipy.org/scipy2014/) !

We particularly encourage introductory-level tutorial submissions. This is a great opportunity to help inform a new group of Python users on the basics they need to start solving problems with SciPy.

SciPy 2014 Diversity Funding Announcement
------------------------------------------------------------
The thirteenth annual Scientific Python conference, SciPy 2014, will be held in July in Austin, TX. The SciPy community knows that the more people who are involved in scientific problem-solving, the better off we all will be because the diversity of perspectives leads to a diversity of solutions. Therefore, in an effort to increase the diversity, as well as the pool of people who are able to attend the conference, there are now an additional 5 funding opportunities available, thanks to generous support from NumFOCUS. To apply for this funding, supply the information indicated on the financial aid application site.

We also encourage those interested in Diversity in Scientific Computing (DISC) to consider registering for the DISC luncheon. Registration for the lunch will be available during registration for the conference.

The SciPy 2014 Diversity Committee
* Patricia Francis-Lyon
* Katy Huff
* Leah Silen
* Kristen Thyng


text:
# Going Medieval Core
GMCore or Going Medieval Core is a core mod that makes it easier to develop mods for the game Going Medieval.

**This is still incomplete! All features are still getting changed and removed.**

## Installation
**This mod requires [BepInEx](https://github.com/BepInEx/BepInEx/releases) to be installed!**

 1. Download the zip file from the [releases](https://github.com/AtiLion/GM_Core/releases) section.
 2. Extract the directory from the zip file into your BepInEx/plugins directory.
 3. Run the game

## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

## License
The mod's license is [MIT](https://choosealicense.com/licenses/mit)


text:
---
layout: post
title: Community Map
---

This points-of-interest map has been compiled from direct reccomendations by residents, as well as information sourced from Yelp, Nextdoor, and Castro Valley News.

You can view and edit the map directly at http://castrovalley.github.io/map

<amp-iframe width="600" height="500"
    sandbox="allow-scripts allow-same-origin"
    layout="responsive"
    frameborder="0"
    src="https://www.google.com/maps/d/u/0/embed?mid=1beW7M52U9BM75EyQeOU8CCXb35w">
    <amp-img layout="fill" width="625" height="500" src="/assets/images/placeholder.png" placeholder></amp-img>
</amp-iframe>


text:
This example configures the multiplexer.

Any of the 16 inputs `IN_A1`, `IN_A2`, ..., `IN_A8`, `IN_B1`, `IN_B2`, ..., `IN_B8` can be connected
to any of the 2 outputs `OUT_A` and `OUT_B`. It's also possible to keep one or all outputs
disconnected from any input.

# How to run it

## Upload it to the device

```bash
$ DEVICE_IP=<IP_ADDRESS>
$ cd ../
$ scp -r 03* pi@${DEVICE_IP}:/home/pi/
```

## Run it over SSH

```bash
$ ssh pi@${DEVICE_IP}
password: raspberry
$ cd 03*
$ ./main.py
Current multiplexer state:
OUT_A is not connected.
OUT_B is not connected.

Setting multiplexer to ['B1', 'A6'] ...
Response: ['B1', 'A6']

New state:
OUT_A is connected to B1.
OUT_B is connected to A6.
```

# How it works

This example performs the following steps:

* Select the SPI slave containing the multiplexer.
* As an SPI master query the multiplexer's initial state.
* As an SPI master switch the multiplexer's connections randomly.
* Query the multiplexer's state again.

repository: esysberlin/lufo-ifez-datenkonzentrator

repo_name: esysberlin/lufo-ifez-datenkonzentrator


text:
# Keydnap

The download server of the torrent client Transmission was hacked and a
malicious version of the client was uploaded. The malicious copy of the
software was signed using a legitimate certificate (which appears to be stolen
from the Apple developer program).

## Impact

N/A

## Type of compromise

The publishing infrastructure was affected, plus a developer certificate (by
someone not associated with Transmission) was used to sign and allow for a
legitimate-looking installation

repository: myugan/sig-security

repo_name: myugan/sig-security


text:
# stm-java-backend

Backend for simple task manager using the power of spring boot, rest, jpa and spring security using jsonwebtoken and PostgresSQL as database

Download the frontend you prefer which designed for
You should read [stm](https://github.com/blacktoviche/stm) before start using this backend

## Installation

```bash
# Clone this repository
git clone https://github.com/blacktoviche/stm-java-backend
# Go into the repository
cd stm-java-backend
# Install dependencies
mvn install
# Compile the app
mvn compile
# Package the app
mvn package
# Run the app
mvn spring-boot:run
```

## Note
If you want to edit this project use any prefered ide eclipse, netbeans ( I'm using IntelliJ IDEA Community Edition )
Use import project and select the pom.xml not the folder at least if you use IntelliJ

## Note
CORS ( Cross-Origin Resource Sharing ) is enabled in this backend so I could connect stm-web from another server
In production mode this should not be enabled and stm-web must be deployed within this backend

## Note
When deploy this backend it must has at leats one admin user. in data.sql there are two users
admin with password admin and user with password user
For the passwords I'm using BCrypt to encrypt passwords in databas. BCrypt is part of spring security

Thank for [Stephan Zerhusen](https://github.com/szerhusenBC) I used his [https://github.com/szerhusenBC/jwt-spring-security-demo](https://github.com/szerhusenBC/jwt-spring-security-demo) It's well done
I had to edit it to suite my needs for storing and retriving token from database

## License
- [MIT](LICENSE)

Twitter [@SyrianDeveloper](https://www.twitter.com/SyrianDeveloper)

repository: JPdiedhiou/stm-java-backend

repo_name: JPdiedhiou/stm-java-backend


text:
---
title: "How to Awesome Learn"
template: "page"
---

# FAQ

### Why should I Awesome Learn?

Everyone in this industry deals with imposter syndrome. Technologies keep
advancing while we feel like we're falling behind. Saying it out loud is the
first step, changing it is the hard step.

### Who can Awesome Learn?

Anyone at any level is welcome to start a group. We strongly believe learning can be done without an "expert" in the room.

### How does Awesome Learning work?

Anyone can form a team. Once you gather a team,
the team selects the "Track" they want to learn first.
Each track has pre-built hour-long sessions with learning materials and coding
exercises included. We provide completed exercises and learning
annotations to make sure you never get stuck.

### What will this do for my team?

Awesome learning is a research-backed learning platform designed to help small
teams build lasting, foundational skills. The platform is a series of videos and
exercises in one hour intervals divided into subject-matter "tracks". Session
quizzes keep learners engaged, surveys keep leaders up to date with how well
team members are learning. A tight feedback loop drives constant iteration.

### What is a Session?

An Awesome Learning Session is a series of videos and exercises that can be
completed in a single hour.

### What is a Track?

An Awesome Learning Track is a collection of sessions grouped under an umbrella
theme. The specific goal of each session is to help you build a better mental
model of the broader topic.

### How long is the time commitment for a single Track?

A single Track should take no more than a total of 5 work hours to complete. The
recommended cadence is one session or course per week. But you are free to speed
up the process by tackling a new session each day. We do not recommend skipping
a week in-between sessions, as this proved to stagnate learning in the past.

repository: chrisknguyen/awesome-learning

repo_name: chrisknguyen/awesome-learning


text:
---
title: Easy | Pascal's Triangle II 119
tags:
  - common
  - implement
categories:
  - Leetcode
  - Array
date: 2020-05-24 20:30:37
---

Given a non-negative index *k* where *k* ≤ 33, return the *k*th index row of the Pascal's triangle.

[Leetcode](https://leetcode.com/problems/pascals-triangle-ii/)

<!--more-->

Note that the row index starts from 0.

![img](https://upload.wikimedia.org/wikipedia/commons/0/0d/PascalTriangleAnimated2.gif)
In Pascal's triangle, each number is the sum of the two numbers directly above it.

**Example:**

```
Input: 3
Output: [1,3,3,1]
```

**Follow up:**

Could you optimize your algorithm to use only *O*(*k*) extra space?

---

#### Implement

How to set the value in a list?

`list.set(j, list.get(j) + list.get(j + 1))`

---

#### My thoughts

Each time add a `1` into list, and set the rest of to a sum of contiguous values.

---

#### Standard solution

```java
class Solution {
    public List<Integer> getRow(int rowIndex) {
        List<Integer> res = new ArrayList<>();
        for (int i = 0; i < rowIndex + 1; i++) {
            res.add(0, 1);
            for (int j = 1; j < res.size() - 1; j++) {
                res.set(j, res.get(j) + res.get(j + 1));
            }
        }
        return res;
    }
}
```

T: O(k)			S: O(k)

repository: weiranfu/leetcode-with-me

repo_name: weiranfu/leetcode-with-me


text:
# APEX:E3 - API Nodejs Low Code Examples

![preview](https://github.com/apexe3/apexe3-api/blob/main/examples/nodejs/apexe3/assets/nodejsondemandscreener.png?raw=true)

All examples make use of the apexe3/apexe3.js wrapper which implements a subset of the REST and websocket API definitions defined in the [APEX:E3 API documentation](https://api.ae3platform.com/docs).

## Real-time Global Orderbook

Access the Real-time Global Orderbook for any asset Pair across any exchanges.

To run:

```shell
cd apexe3-api/examples/nodejs
node real-time-global-orderbook.js
```
This will output the global orderbooks for bids and asks, by best bid and ask prices respectively (only bids are shown in the picture below for the sake of example).

![preview](https://github.com/apexe3/apexe3-api/blob/main/examples/nodejs/apexe3/assets/nodejsglobalorderbook.png?raw=true)

**As the picture above shows, the top 25 depth for BTC/USDT is taken from each exchange, combined and ordered to produce a globally updating orderbook ready for real-time algorithmic trading or analysis.**

The initialiseGlobalOrderbook function initialises the global orderbook with BTC/USDT SPOT market. You can change the pair as desired. (Derivatives (SWAP, FUTURE) are also supported).
```javascript
   await apexe3.initialiseGlobalOrderbook(base,quote);
```

In this example, the following columns **are retrieved for every BTC/USDT orderbook update across supported exchanges in real-time.**

- bid price (bid px) (ordered by best bid across exchanges).
- bid size
- cumulative bid size (bid size added up at each depth)
- bid sum (bid px * bid size)
- cumulative bid sum are retrieved (bid sum added up at each depth)
- exchange

All updates are emitted and converted to an easily processable data structure for further programmatic analysis.

You can easily access the structured data as it updates in the streams callback function.

```javascript
    stream.on('GLOBAL_ORDERBOOK', (globalOrderbook) => { /** do stuff here **/ });
```
You can easily process the globalOrderbook of bids (or asks) in your trading algorithm logic, store it for historical analysis or manipulate as desired.

## Real-time Global Liquidity

Access the Real-time total supply & demand of Liquidity for any asset pair across any exchange.

To run:

```shell
cd apexe3-api/examples/nodejs
node real-time-liquidity.js
```

This will output the total demand (bid) and supply (ask) liquidity for the BTC/USDT Spot market.
![preview](https://github.com/apexe3/apexe3-api/blob/main/examples/nodejs/apexe3/assets/nodejsgloballiquidity.png?raw=true)

The above picture shows a real-time aggregation of the top 25 depth of BTC/USDT Spot markets across supported exchanges.
In this example, the following columns **are retrieved for every BTC/USDT orderbook update across supported exchanges in real-time.**

- Exchange
- Ask Liqudity (The total USDT amount available to buy on the relevant exchange at that moment in time. This is based on the top 25 depth)
- Bid Liqudity (The total USDT in demand on the relevant exchange at that moment in time. This is based on the top 25 depth)
- Amount (The amount of BTC available to buy on the relevant exchange at that moment in time. This is based on the top 25 depth)
- Imbalance (Ask Liquidity - Bid Liquidity)
- Market Price_25 (The likely price of a market order filling the top 25 orders on that exchange)

All updates are emitted and converted to structured data for further programmatic analysis.

You can easily access the structured data as it updates in real-time in the process_global_orderbook function.
```javascript
    stream.on('LIVE_LIQUIDITY', (globalLiquidity) => { /** do stuff here **/  });
```
**You can easily process this data in your trading algorithm, smart order routing logic, store it for historical analysis or manipulate as desired.**

## Real-time Insights

Identify whale prders, arbitrage opportunities, large/medium/small Bid/Ask imbalances & tightest spreads for any asset pair across any exchange.

To run:

```shell
cd apexe3-api/examples/nodejs
node real-time-insights.js
```
This will output ranked-by-exchange spread, whale and bid/ask imbalances BTC/USD. It will also output ranked arbitrage opportunities for pairs that can be arbitraged across 2 exchanges.

The following example output shows how arbitrages will look in the output.

![preview](https://github.com/apexe3/apexe3-api/blob/main/examples/nodejs/apexe3/assets/nodejsarbs.png?raw=true)

**You can easily process this data in your trading algorithm, or store them to analyse how orderbook whales, spreads, imbalances and arbitrage opportunities evolve over time**

## On-demand Screener

Programmatically screen markets using technical indicators for any asset pair, quote or any exchange.

To run:

```shell
cd apexe3-api/examples/nodejs
node on-demand-screener.js
```
This will output screened results for BTC/USDT consisting of price and volume metrics on an on-demand basis.

![preview](https://github.com/apexe3/apexe3-api/blob/main/examples/nodejs/apexe3/assets/nodejsondemandscreener.png?raw=true)

This example screens the BTC/USDT pair using the following code:

```javascript
    const stats = await screenPair('BTC','USDT');
    console.table(stats, ['exchangeId','baseId', 'quoteId', 'v24HrChg','v30dChg','v24HrVsV30dSum','p15MinChg','p1HrChg','p7dChg','pLast']);
```

A successful response will consist of the following columns:

- exchangeId
- baseId
- quoteId
- v24HrChange (24 hour volume change)
- v30dChg (30 day volume change)
- v24HrVsV30dSum (24 hour vs 30 day volume change)
- p15MinChg (15 minute price change)
- p1HrChg (1 hour price change)
- p7dChg (7 day price change)
- pLast (latest price)

The screen function, imported from the apexe3.js wrapper class, can take more parameters as follows:

```javascript
    screen(base,quote,exchanges=[], rsi=[],smaCross=[],volatility=[], weeklyOpenChg=[], bollingerBand='', fibRetracements=[], trends=[], ichimoku=[]);
```
This allows for instantly screening pairs, markets or exchanges by RSI, Moving Average, Volatility, Bollinger Bands, Fibretracement, Trends and Ichimoku cloud technical indicator analysis.

Example values for these parameters can be found in apexe3.js under the following section:

```javacript
//screener filter values for reference
```

## On-demand Aggregated OHLCV pricing and USD marketcap data

Programmatically fetch 1 day OHLCV pricing data for traditional and digital assets.

To run

```shell
node examples/nodejs/fetch-aggregate-ohlcv.js
```

This will output results for BTC-USD consisting of exchange aggregated Open, High, Low, Close and Volume for a supplied date range:

![preview](https://github.com/apexe3/apexe3-api/blob/main/examples/nodejs/apexe3/assets/AggOHLCVExample.png?raw=true)

You can change the ticker and date range as desired.

To retrieve OHLC USD marketcap for a crypto asset

run

```shell
node examples/nodejs/fetch-aggregate-marketcap.js
```

## On-demand OHLCV pricing data for a crypto exchange

Programmatically fetch 1d | 4h | 1h | 15m | 1m OHLCV pricing data for a digital asset listed on an exchange.
(Free tier only provides OHLCV for FTX and CoinbasePro)

To run

```shell
node examples/nodejs/fetch-ohlcv-crypto-exchange.js
```

This will output results for BTC USD on COINBASEPRO consisting of Open, High, Low, Close and Volume for a supplied date range:

![preview](https://github.com/apexe3/apexe3-api/blob/main/examples/nodejs/apexe3/assets/ohlcvexchangeExample.png?raw=true)

You can change the base, quote, exchange, date range and timeFrame as desired.


text:
![Build status](https://travis-ci.com/lilith645/Maat-Editor3D.svg?token=nw7eyDYfjBcSaxj1G3h7&branch=master)
# 3D editor for maat engine

### No longer maintained, a better option will be built later with new Maat-Graphics Library.

### Windows Specific Setup
### MacOs Specific Setup
### Linux Specific Setup

Use your package manager to install the required dev-tools and vulkan drivers

For example on ubuntu:
```
sudo apt-get install build-essential git python cmake libvulkan-dev vulkan-utils
```

### Notes for cross-compiling from Linux to windows

$ cargo build --target=x86_64-pc-windows-gnu --release

Need to include libstdc++-6.dll libgcc_s_seh-1.dll
from
/usr/lib/gcc/x86_64-w64-mingw32/8.3-win32

$ RUSTFLAGS='-C link-args=-static-libstdc++' cargo build --target=x86_64-pc-windows-gnu -v

## Donate

Lilith645 (Original and Current maintainer) [![Become a patron](https://c5.patreon.com/external/logo/become_a_patron_button.png)](https://www.patreon.com/AoAkuma)

## Contributing

Contributions are welcome! Feel free to submit pull requests.

## License

Licensed under
 * MIT license ([LICENSE](LICENSE) or http://opensource.org/licenses/MIT)


text:
# zipcodes-ph

[![Travis](https://img.shields.io/travis/arnellebalane/zipcodes-ph.svg)]([![Travis](https://img.shields.io/travis/rust-lang/rust.svg)](https://github.com/arnellebalane/zipcodes-ph))
[![Codecov](https://img.shields.io/codecov/c/github/arnellebalane/zipcodes-ph.svg)](https://github.com/arnellebalane/zipcodes-ph)
[![version](https://img.shields.io/npm/v/zipcodes-ph.svg)](https://github.com/arnellebalane/zipcodes-ph)
[![downloads](https://img.shields.io/npm/dw/zipcodes-ph.svg)](https://github.com/arnellebalane/zipcodes-ph)
[![license](https://img.shields.io/npm/l/zipcodes-ph.svg)](https://github.com/arnellebalane/zipcodes-ph)

Philippines zip code directory.

## Installation

Install via npm:

```bash
$ npm install --save zipcodes-ph
```

Browser builds are also available inside the `build` directory or in [unpkg.com](https://unpkg.com/zipcodes-ph@1.1.2/build/index.umd.js).

## Usage

NodeJS:

```js
const zipcodes = require('zipcodes-ph');

zipcodes.find(6000); // 'Cebu City'
zipcodes.reverse('Cebu City'); // 6000
```

Browser:

```html
<script src="path/to/zipcodes-ph/build/index.umd.min.js"></script>
```

```js
// global variable `zipcodesPH` is exposed

zipcodesPH.find(6000); // 'Cebu City'
zipcodesPH.reverse('Cebu City'); // 6000
```

## API

- **`find(zipcode)`**
  - `zipcode` _(Number|String)_: The zip code that will be resolved into a location name.
  - possible return values:
    - _String_ if one location with the zip code is found.
    - _Array_ if multiple locaitons with the zip code are found.
    - _null_ if no locations with the zip code are found.

- **`reverse(location)`**
  - `location` _(String)_: The name of the location that will be resolved into a zip code.
  - possible return values:
    - _Number_ if zip code for the location is found.
    - _null_ if zip code for the location is not found.

## License

MIT License


text:
---
layout: default
title: "The FileInput Component"
---

# `<FileInput>`

`<FileInput>` allows uploading files using [react-dropzone](https://github.com/okonet/react-dropzone).

![FileInput](./img/file-input.png)

## Properties

| Prop                  | Required | Type                             | Default                         | Description                                                                                |
|-----------------------|----------|----------------------------------|---------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `accept`              | Optional | `string                          | string[]`                       | -                                                                                | Accepted file type(s), e. g. 'application/json,video/*' or 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'. If left empty, all file types are accepted. Equivalent of the `accept` attribute of an `<input type="file">`. See [MDN input docs](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept) for syntax and examples. |
| `children`            | Optional | `ReactNode`                      | -                               | Element used to display the preview of a file (cloned several times if the select accepts multiple files).                                                                                |
| `minSize`             | Optional | `number`                         | 0                               | Minimum file size (in bytes), e.g. 5000 for 5KB                                                                                |
| `maxSize`             | Optional | `number`                         | `Infinity`                      | Maximum file size (in bytes), e.g. 5000000 for 5MB                                                                                |
| `multiple`            | Optional | `boolean`                        | `false`                         | Set to true if the input should accept a list of files, false if it should only accept one file                                                                                |
| `labelSingle`         | Optional | `string`                         | 'ra.input.file. upload_single'  | Invite displayed in the drop zone if the input accepts one file                                                                                |
| `labelMultiple`       | Optional | `string`                         | 'ra.input.file. upload_several' | Invite displayed in the drop zone if the input accepts several files                                                                                |
| `placeholder`         | Optional | `ReactNode`                      | -                               | Invite displayed in the drop zone, overrides `labelSingle` and `labelMultiple`                                                                                |
| `validateFileRemoval` | Optional | `(file) => void | Promise<void>` | -                               | Allows to cancel the removal of files                                                                                |
| `options`             | Optional | `Object`                         | `{}`                            | Additional options passed to react-dropzone's `useDropzone()` hook. See [the react-dropzone source](https://github.com/react-dropzone/react-dropzone/blob/master/src/index.js)  for details. |

`<FileInput>` also accepts the [common input props](./Inputs.md#common-input-props).

## Usage

Files are accepted or rejected based on the `accept`, `multiple`, `minSize` and `maxSize` props. `accept` must be a valid [MIME type](https://www.iana.org/assignments/media-types/media-types.xhtml) according to [input element specification](https://www.w3.org/wiki/HTML/Elements/input/file) or a valid file extension. If `multiple` is set to false and additional files are dropped, all files besides the first will be rejected. Any file which does not have a size in the [`minSize`, `maxSize`] range, will be rejected as well.

`FileInput` delegates the preview of currently selected files to its child. `FileInput` clones its child as many times as there are selected files, passing the file as the `record` prop. To preview a simple list of files names, you can use `<FileField>` as child, as follows:

```jsx
<FileInput source="files" label="Related files" accept="application/pdf">
    <FileField source="src" title="title" />
</FileInput>
```

Writing a custom preview component is quite straightforward: it's a standard [field](./Fields.md#writing-your-own-field-component).

When receiving **new** files, `FileInput` will add a `rawFile` property to the object passed as the `record` prop of children. This `rawFile` is the [File](https://developer.mozilla.org/en-US/docs/Web/API/File) instance of the newly added file. This can be useful to display information about size or MIME type inside a custom field.

The `FileInput` component accepts an `options` prop into which you can pass all the [react-dropzone properties](https://react-dropzone.netlify.com/#proptypes).

If the default Dropzone label doesn't fit with your need, you can pass a `placeholder` prop to overwrite it. The value can be anything React can render (`PropTypes.node`):

```jsx
<FileInput source="files" label="Related files" accept="application/pdf" placeholder={<p>Drop your file here</p>}>
    <ImageField source="src" title="title" />
</FileInput>
```

Note that the file upload returns a [File](https://developer.mozilla.org/en/docs/Web/API/File) object. It is your responsibility to handle it depending on your API behavior. You can for instance encode it in base64, or send it as a multi-part form data. Check [this example](./DataProviders.md#handling-file-uploads) for base64 encoding data by extending the REST Client.

### `validateFileRemoval`

To prevent selected files from being removed from the `FileInput` when submitting the form, use the `validateFileRemoval` prop. It should return either an empty promise (validated) or a rejected promise (failed). The latter will prevent items from being removed from the component.
This prop can also be used to confirm the deletion of items to users.

The following example shows a react-admin's `Confirm` dialog when clicking the delete button of an `FileInput` item. It will interrupt the removal of items if "dataProvider.deleteImages" fails or cancel button is clicked.
This example asumes the implementation of a `deleteImages` function in the dataProvider.

```jsx
import { Edit, SimpleForm, ImageInput, Confirm, useDataProvider } from 'react-admin';
import { useMutation } from 'react-query';

const MyEdit = (props) => {
    const [removeImage, setRemoveImage] = React.useState(null);
    const [showModal, setShowModal] = React.useState(false);
    const dataProvider = useDataProvider();
    const { mutate } = useMutation();

    return (
        <Edit {...props}>
            <SimpleForm>
                <ImageInput
                    source="images"
                    src="image"
                    validateFileRemoval={(file, _record) => {
                        const promise = new Promise((_resolve, reject) => {
                            setRemoveImage({
                                fileName: `Image ID: ${file.id}`,
                                delete: async (result) => {
                                    await mutate(
                                        ['deleteImages', { ids: [file.id] }],
                                        () => dataProvider.deleteImages({ ids: [file.id] })
                                    );
                                    return _resolve(result);
                                },
                                cancel: reject,
                            });
                        });
                        setShowModal(true);
                        return promise.then((result) => {
                            console.log('Image removed!');
                        });
                    }}
                />
                <Confirm
                    isOpen={showModal}
                    title="Delete image"
                    content={`${removeImage ? removeImage.fileName: ''} will be deleted`}
                    onConfirm={() => {
                        setShowModal(false);
                        removeImage && removeImage.delete();
                    }}
                    onClose={() => {
                        setShowModal(false);
                        removeImage && removeImage.cancel();
                    }}
                />
            </SimpleForm>
        </Edit>
    )
}
```

## `sx`: CSS API

The `<FileInput>` component accepts the usual `className` prop. You can also override many styles of the inner components thanks to the `sx` property (as most MUI components, see their [documentation about it](https://mui.com/customization/how-to-customize/#overriding-nested-component-styles)). This property accepts the following subclasses:

| Rule name                     | Description                                                                |
|-------------------------------|----------------------------------------------------------------------------|
| `& .RaFileInput-dropZone`     | Applied to the main container of the component                             |
| `& .RaFileInput-removeButton` | Applied to each of the MUI's `IconButton` component used as remove button  |

To override the style of all instances of `<FileInput>` using the [MUI style overrides](https://mui.com/customization/globals/#css), use the `RaFileInput` key.

repository: nicgirault/react-admin

repo_name: nicgirault/react-admin


text:
---
layout: kanji-remain
v4: 2727
kanji: 註
keyword: footnote
strokes: 12
on-yomi: チュウ
permalink: /rtk/註/
---

## Koohii stories:

1) [mcfate] 1-11-2007(29): A study Bible has many footnotes under the words of the Lord.

2) [Megaqwerty] 16-7-2007(18): The footnote's words were buried so far below the page that I had to pull out a candlestick in order to read it.

3) [mantixen] 28-7-2009(6): The lord always has to have the last word, as if everything people say needs a footnote.

4) [Monkeys_Spiders] 16-7-2010(2): In the realm of words, the king is a book, the lords are the footnotes.

5) [Crowfoot] 14-5-2008(1): Socrates was sure to read every footnote in the text on candlesticks.


text:
* py-evm Version: x.x.x
* OS: osx/linux/win
* Python Version (python --version):
* Environment (output of `pip freeze`):

### What is wrong?

Please include information like:

* full output of the error you received
* what command you ran
* the code that caused the failure (see [this link](https://help.github.com/articles/basic-writing-and-formatting-syntax/) for help with formatting code)

### How can it be fixed

Fill this in if you know how to fix it.


text:
---
layout: post
title: FB
---

**A short guide for those intimidated by Facebook.**

**Privacy**

You might want to check your settings to ensure anything you post is kept within your circle of 'Friends'.  Let's face it, when you win the Lottery (because you *will*) and you're milking the company sickness scheme  while you're still figuring out whether to retire early, it might not go down too well when your boss finds the raucous party/extreme ironing/nude parascending/cage-less shark taming pics.

**Basic interactions**

To 'Like' (this used to be a simple 'thumbs-up') a friend's post it's quite unacceptable to employ the icon with the big laugh and tears rolling down the face to show sympathy at the loss of a beloved pet, relative or football game; especially when the poster adds "*LOL*" at the end of every related sentence.  It's for them to determine whether laughing out loud at the loss of a limb it acceptable.  If in doubt and you must engage without using words, use the 'thumbs-up' like, it's potentially the least offensive.

To reply to a friend's post type something in the 'Write a comment' box below their post.

To see others' replies to a friend's post, press '(n) comments(s)', where '(n)' is a number.

To reply to a reply to a friend's post, press 'Reply' below the reply to the friend's post.

Not at all confusing is it.

**Gibberish**

You should visit [Snopes.com](https://www.snopes.com/) for fact checking events or stories vaguely related to domestic of world events.  Bearing in mind it's a US site with a bias towards that country, it's nonetheless *useful* for the big stuff.

Why?  Your friends and their friends will often post absolute nonsense, which your friends will share to be sociable, but Snopes cannot usually be used to check what they're been eating, drinking, and where.  It *can* be used to inquire about scams (e.g. [Mobile Phone Rates At £50 A Minute!!!](https://www.snopes.com/fact-check/mobile-phone-scam/)) or feel-good stories which seem too good to be true, (e.g. [Daisy The Dog Rescued 9/11 Survivors... awww.](https://www.snopes.com/fact-check/daisy-dog-rescued-911-survivors/))


text:
---
layout: post
title: Welcome to Gravity!
author: Kungen
---

In order to fully master anti gravity, one must first understand gravity!

![no gravity freindship](https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSRSm8HDBaLgBsjZHEy_VgEvndAa-EqgtqsrBoLgUBfvBCT0N9lww)

Gravity is an attractive force between any two bodys that pulls them together, like the freindshp between the freinds above.

![_config.yml]({{ site.baseurl }}/images/config.png)