text:
# API Deployment

Django Settings from [this article](https://djangostars.com/blog/configuring-django-settings-best-practices/)

SSH [tutorial](https://www.hostinger.com/tutorials/ssh-tutorial-how-does-ssh-work)

Whitenoise[static files](http://whitenoise.evans.io/en/stable/)

[IaaS-Infrastructure as a Service](https://en.wikipedia.org/wiki/Infrastructure_as_a_service): online services that provide high-level APIs used to dereference various low-level details of underlying network infrastructure

[PaaS-Platform as a Service](https://en.wikipedia.org/wiki/Platform_as_a_service): or platform-based service is a category of cloud computing services that provides a platform allowing customers to develop, run, and manage applications without the complexity of building and maintaining the infrastructure typically associated with developing and launching an app

[CORS-Cross Origin Resourse Sharing](https://en.m.wikipedia.org/wiki/Cross-origin_resource_sharing): is a mechanism that allows restricted resources on a web page to be requested from another domain outside the domain from which the first resource was served

______________

Django `settings.py`: set and extend environment settings per project

`settings/local.py` extends basic approach to make settings available to other developers

- Run the project with `python manage.py runserver --settings=settings.local`

- shared tokens/passwords

Use environment variables for best practice

_______________

### 12 Factors

a collection of recommendations on how to build distributed web-apps that will be easy to deploy and scale in the Cloud. It was created by Heroku, a well-known Cloud hosting provider.

As the name suggests, the collection consists of twelve parts:

1. Codebase
2. Dependencies
3. Config
4. Backing services
5. Build, release, run
6. Processes
7. Port binding
8. Concurrency
9. Disposability
10. Dev/prod parity
11. Logs
12. Admin processes

[READ MORE](https://12factor.net/)

_________

Use Django environ
```
import environ

root = environ.Path(__file__) - 3  # get root of the project
env = environ.Env()
environ.Env.read_env()  # reading .env file

SITE_ROOT = root()

DEBUG = env.bool('DEBUG', default=False)
TEMPLATE_DEBUG = DEBUG

DATABASES = {'default': env.db('DATABASE_URL')}

public_root = root.path('public/')
MEDIA_ROOT = public_root('media')
MEDIA_URL = env.str('MEDIA_URL', default='media/')
STATIC_ROOT = public_root('static')
STATIC_URL = env.str('STATIC_URL', default='static/')

SECRET_KEY = env.str('SECRET_KEY')

CACHES = {'default': env.cache('REDIS_CACHE_URL')}
```

and .env file
```
DEBUG=True

DATABASE_URL=postgres://user:password@db.example.com:5432/production_db?sslmode=require

REDIS_CACHE_URL=redis://user:password@cache.example.com:6379/1

SECRET_KEY=Some-Autogenerated-Secret-Key
```
___________

### Django Settings: Best practices

1. Keep settings in environment variables.

2. Write default values for production configuration (excluding secret keys and tokens).

3. Don’t hardcode sensitive settings, and don’t put them in VCS.

4. Split settings into groups: Django, third-party, project.

5. Follow naming conventions for custom (project) settings.

__________

### SSH

SSH, or Secure Shell, is a remote administration protocol that allows users to control and modify their remote servers over the Internet.

It provides a mechanism for authenticating a remote user, transferring inputs from the client to the host, and relaying the output back to the client.

The significant advantage offered by SSH over its predecessors is the use of encryption to ensure secure transfer of information between the host and the client. Host refers to the remote server you are trying to access, while the client is the computer you are using to access the host. There are three different encryption technologies used by SSH:

1. Symmetrical encryption (shared key): where a secret key is used for both encryption and decryption of a message by both the client and the host

2. Asymmetrical encryption: uses two separate keys for encryption and decryption. These two keys are known as the public key and the private key.

3. Hashing: One-way hashing is another form of cryptography used in Secure Shell Connections. One-way-hash functions differ from the above two forms of encryption in the sense that they are never meant to be decrypted. They generate a unique value of a fixed length for each input that shows no clear trend which can exploited. This makes them practically impossible to reverse.


text:
---
title: 'Gun Control'
excerpt: "This week we solve guns."
tags: [Dan Marino, Chris Truman]
layout: post
episode: 5
---

{% include player.html url="https://raw.githubusercontent.com/jstart/AreWeRight/master/awr_04.mp3" %}

## Notes

Gun Control

http://www.cc.com/shows/jordan-klepper-solves-guns

Reasons people are resistant to gun control legislation:
1. Constitution
Militia Clause
http://www.heritage.org/constitution/#!/articles/1/essays/55/militia-clause

The Second Amendment Guarantees the Right of Revolution?
http://thefederalist.com/2016/06/20/the-second-amendment-isnt-about-hunting-or-self-defense-but-revolution/

2. Self-Defense
    - Rodney King Riots

Why now? What has increased gun violence, or is there just more awareness and fear?
1. Video Games/Media
    - Batman Shooting

Improvements we can push for today
- Mental Health/Background checks
- Gun Show loophole

Ongoing Challenges
- Weapons Smuggling (border issue?)
    - https://www.washingtonpost.com/news/wonk/wp/2016/01/14/why-mexicos-drug-cartels-love-americas-gun-laws/
- Buy Backs? Search and Seizure in poor/dangerous neighborhoods? (Australia example)
    - http://www.reuters.com/article/us-australia-guns-idUSKCN0XP0HG
    - https://www.thetrace.org/2015/07/gun-buyback-study-effectivness/

Conclusion
We can’t un-invent automatic weapons, the same way we can’t forget how to make nuclear weapons.  Nuclear disarmament, logical sanctions, and diplomacy all work towards minimizing the risk of nuclear fallout.
-NRA gains membership whenever people are afraid of gun restriction. The paradox of the media shouting for gun restriction or gun responsibility is that the NRA can use that to spin a paranoia narrative. So reasonable people who want background checks on people with mental help issues have to find a way to communicate the concern without beating the same old dead horse.
-black kids are getting shot in the streets by pigs. American citizens ought to be able to plug piggies if they are stepping over the law and getting away with it.
https://urbanintellectuals.com/2017/07/17/armed-black-protesters-cause-cleveland-police-call-temp-suspension-second-amendment-open-carry-law/

license: MIT

repository: jstart/AreWeRight

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: jstart/AreWeRight


text:
# AMQP 1.0 nodes for Node-RED

This project provides a set of nodes for [Node-RED](http://nodered.org/) that makes it easy to integrate AMQP 1.0 protocol in a flow application.

## Documentation

The official documentation is available [here](doc/Home.md).

## Installation

The nodes are based on [RHEA library](https://github.com/grs/rhea), a reactive library for AMQP protocol for easy development of both clients and servers. It's needed to install that library before starting to use RHEA nodes inside a Node-RED flow. The simpler way to do it is use the Node Package Manager (NPM) and install the ["rhea" module] (https://www.npmjs.com/package/rhea).

repository: gautric/node-red-contrib-rhea

repo_name: gautric/node-red-contrib-rhea


text:
>ℹ  SignalFx was acquired by Splunk in October 2019. See [Splunk SignalFx](https://www.splunk.com/en_us/investor-relations/acquisitions/signalfx.html) for more information.

# activemq-integration

This is a tool that measures the age of messages in ActiveMQ queues, and publishes the results to SignalFx. These metrics are different from the metrics that ActiveMQ reports to JMX: this tool inspects the messages that are waiting to be delivered in each queue, whereas ActiveMQ reports to JMX the ages of only those messages that have been successfully delivered. For this reason, this tool is especially useful for detecting messages that are "stuck" in ActiveMQ queues and unable to be delivered.

## Metrics Reported

- message.age.average (type:gauge): Average age of messages in each queue, in milliseconds.
- message.age.maximum (type:gauge): Maximum age of messages in each queue, in milliseconds.

## Requirements

- Linux/Unix
- Java 1.5 or higher
- ActiveMQ
- Maven

## Installation

- clone repo (`git clone https://github.com/signalfx/activemq-integration.git`)
- Configure the tool by modifying `<repo>/amq-message-age/properties` (see below)
- `cd <repo>/amq-message-age`
- `./run.sh`

## Configuration

Modify the `properties` file to provide values that make sense for your ActiveMQ instance.

| property name | definition |
| ------------- | ---------- |
| path | Filesystem path to ActiveMQ executable |
| token | SignalFx API token |
| sfx_host | Host to which to transmit data (default: `https://ingest.signalfx.com`) |
| interval | Interval at which to measure message age, in milliseconds. (default: `3000`) |
| host | URL at which to connect to ActiveMQ broker. (default: `tcp://localhost:61616`) |
| host_name | Name of this ActiveMQ host. This value appears in the dimension "host" in SignalFx. |
| broker_name | Name of this ActiveMQ broker. This value appears in the dimension "broker" in SignalFx. |

## License

 This tool is licensed under the Apache License, Version 2.0. See LICENSE for full license text.

repository: signalfx/activemq-integration

gha_language: Java

repo_name: signalfx/activemq-integration


text:
---
layout:     post
title:      "Whoa, We're Halfway There"
subtitle:   "Celebrating halfway in Chester"
date:       "2017-07-26 21:18:13"
author:     "Randall"
header-img: "img/Whoa,-We're-Halfway-ThereHeader.JPG"
mile:       "1344"
---
Yesterday, I passed the halfway point of the PCT. Part of me can't believe that I've already walked halfway to Canada and another part of me feels like I should be way farther than halfway. I still have over 300 miles left in this state.

The objective for yesterday was a highway that was 24 miles from camp. We were hoping to be in town in time for a pizza buffet, but that proved to be too difficult.

Found more snow today. Mile 1319.6, just before the halfway point. Lucky for me, I was able to use this snow to chill my halfway beer.

![photo0](/img/Whoa, We're Halfway TherePost0.JPG)

One of the nearby mountains has a pretty interesting name. I'm not sure if that's what it's supposed to look like or if someone once misspelled butte and the name just stuck.
![photo1](/img/Whoa, We're Halfway TherePost1.JPG)

After hiking like mad all morning, we made it to the halfway point. Because the trail get rerouted every once in awhile, the halfway marker is about 5 miles short of halfway. We celebrated there anyway.

![photo2](/img/Whoa, We're Halfway TherePost2.JPG)

After eating and drinking at the halfway post, we hiked into town as fast as we could. I rationed my water as much as I could so I wouldn't have to stop. This paid off and we made it to the highway at about 3 pm. We immediately got a hitch and headed into town to eat.

Chester is a small town on Lake Alminor. They have a grocery store and a few restaurants. The first hotel we tried was full for the night. There were no cars in the parking lot, so it must have been hikers. We stayed at the Best Western and 2Taps' mom offered to pay as a halfway done gift. We enjoyed the hotel and the nearby restaurants before heading out in the early afternoon. Oh yeah, we didn't make it to town in time for the pizza buffet, but we did have it for lunch today.

Just 15 miles from the highway is Lassen Volcanic National Park. The park requires a bear can and all of us sent ours home. Lucky for us, the trail only goes through 20 miles of the park, so we can hike through it in a day. Right now I'm just feet from the park boundary. In the morning we'll stop at a resort about 4 miles in for breakfast then finish the rest of the park and keep heading north.

extension: markdown


text:
---
name: Component Request
about: Request a new component for rock-ui
title: "[Component Request] Component Name..."
labels: component request
assignees: ''

---

**Why this component is necessary?**
A clear and concise description of why you think this component is necessary...

**Which product will use it?**
The name of the product that is going to use this component...

**Figma link, screenshot or an example of an existing component**
If you already have the proper design for the component, add the Figma link in here, otherwise add as much information as you can in order for us to research and develop the component...

**Technical Details**
Spacing, colors, how it should work and any other important description that we need to know to create this component...

repository: KelvinCS/rock-ui

repo_name: KelvinCS/rock-ui


text:
---
title: Enable command-line auto completion in bash
date: 2019-03-09 19:12:01
layout: post
draft: false
category: manjaro
tags:
  - manjaro
---

on Manjaro

```bash
$ yay -S bash-completion
```

on Ubuntu

```bash
$ apt-get update
$ apt-get install bash-completion
```

on CentOS/RedHat

```bash
$ yum -y install bash-completion
```

url: https://raw.githubusercontent.com/kinuz/myblog/d81093526cc8a305bfa556a8b5015aa32f756664/src/posts/2019-03-09---Enable command-line auto completion in bash/index.md

repository: kinuz/myblog

repo_name: kinuz/myblog


text:
---
layout: default
---

# 1994-07-29 - Re: FW: No SKE in Daytona and other goodies

## Header Data

From: Blanc Weber<EMAIL_ADDRESS>To<EMAIL_ADDRESS>Message Hash: ea68e5803495c02c5b21c848f4a2059283707f89e6465e6a8afc57362b5ead6e

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1994-07-29 19:41:31 UTC

Raw Date: Fri, 29 Jul 94 12:41:31 PDT

## Raw message

```
{% raw  %}From: Blanc Weber<EMAIL_ADDRESS>Date: Fri, 29 Jul 94 12:41:31 PDT
To<EMAIL_ADDRESS>Subject: Re: FW: No SKE in Daytona and other goodies
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

From: Timothy C. May

But what is the reason of the involvement of "law enforcement" and the
"intelligence community" in this matter? I refer you all to the
upcoming conference agenda, the involvement of NIST/NSA, TIS, Denning,
and FBI Director Louis Freeh. Look at the papers being presented at
the conference.

Any questions?
.............................................

If a system contains "protocols especially suited for eventual
mandatory use", like SKE, does this of necessity mean that the
developers intended that it should become part of a nationally-mandated
open avenue to spying on anyone who uses it?

Blanc

{% endraw %}
```

## Thread

+ Return to [July 1994](/archive/1994/07)

+ Return to "[Blanc Weber <blancw@microsoft.com>](/authors/blanc_weber_blancw_at_microsoft_com_)"
+ Return to<EMAIL_ADDRESS>(Eric Weaver)](/authors/eric_weaver_at_avtc_sel_sony_com_eric_weaver_)"
+ Return to<EMAIL_ADDRESS>(Paul Robichaux)](/authors/paul_at_poboy_b17c_ingr_com_paul_robichaux_)"
+ Return to<EMAIL_ADDRESS>(Timothy C. May)](/authors/tcmay_at_netcom_com_timothy_c_may_)"

+ 1994-07-29 (Fri, 29 Jul 94 12:41:31 PDT) - Re: FW: No SKE in Daytona and other goodies - _Blanc Weber<EMAIL_ADDRESS>  + 1994-07-29 (Fri, 29 Jul 94 13:34:52 PDT) - [Re: FW: No SKE in Daytona and other goodies](/archive/1994/07/ab361a1ab9747fa006415471bb1e6e9822c6fe1d6452d7125fa11076c3a134e1) -<EMAIL_ADDRESS>(Paul Robichaux)_
    + 1994-07-29 (Fri, 29 Jul 94 15:02:55 PDT) - [Re: FW: No SKE in Daytona and other goodies](/archive/1994/07/355393d1254abcbb64e1802a43b552ff04ceb8f7fe09d8a32899932f1945f5b5) -<EMAIL_ADDRESS>(Timothy C. May)_
  + 1994-07-29 (Fri, 29 Jul 94 13:36:54 PDT) - [FW: No SKE in Daytona and other goodies](/archive/1994/07/9dc4eb68429b8947a48513ec8679b2332a7b255b8a26bcaf4e93f4b947d3ff6a) -<EMAIL_ADDRESS>(Eric Weaver)_

gha_license_id: MIT


text:
---
parent: Features
---

# Elevation awareness

Elevation awareness is the most important issue in bike routing if not routing
in a flat country. But in most routing software, elevation is either not handled
at all or in a way that is not really useful.

Even worse, most tools do not even report on elevation in a useful manner. The
far-too-high *total climbs* usually reported do not only accumulate real, small
height-variations that are averaged-out by the bikers momentum - they accumulate
also noise and grid-interpolation errors from the elevation data source.

For most regions, BRouter uses elevation data from the [Shuttle Radar Topography
Mission (SRTM)](http://srtm.usgs.gov/), precisely the hole-filled Version 4.1
Data provided by [srtm.csi.cgiar.org](http://srtm.csi.cgiar.org/), which is the
data that is displayed e.g. in Google Earth and which is used in most
elevation-enabled routing tools. However, the routing algorithm is able to
extract the information on real ascends and descends and ignores the noise.

For latitudes above 60 degree in northern Europe, BRouter uses Lidar data, that
were [compiled and resampled by Sonny](https://sonny.4lima.de/)

On the reporting side, BRouter uses a similar concept to compute the *filtered
ascend*, which is the ascend without the noise and the small hills and which
turned out to be a valid concept to estimate the real elevation penalty.

repository: abrensch/brouter

repo_name: abrensch/brouter


text:
# Frozen Pipe :stopwatch: :wastebasket: :snowflake:

> Important: This is a python 3 module

A python3 implementation of a general purpose rate limiter

## What’s a rate limiter?

At a high level, a rate limiter limits the number of events an entity can perform in a certain time period.

For example:

- “A single IP can only create 20 accounts per day”.
- “Devices are allowed 5 failed credit card transactions per day”.
- “Users may only send 1 message per day with risky keywords”.

The standard algorithm for rate limiting is called a token bucket, sometimes called a “leaky bucket”. Each bucket has a key index and initially contains the maximum number of tokens. Every time an event occurs, we check if the bucket contains enough tokens and reduce the number of tokens in the bucket by the requested amount. After a period of time called the refill time, the number of tokens in the bucket is increased by the refill amount. Over time, these refills will fill up the bucket to the maximum number of tokens.

Token buckets with customizable refill amounts let you express more complex rate limits like:

- “Each user account is allowed a maximum of 10 failed logins per hour, which refill at a rate of 1 login per hour”.
- “Each geocoded shipping address is allowed a maximum of $200 worth of purchases per day from a risky country email addresses, which refills at a rate of $50 per day”.

As you can see, these rate limits allow a lot of freedom for legitimate user behavior, but quickly clamp down on repeated violations.

## Quick start

Import the module and initializes the rate limiter with the buckets.

```python
from ratelimiter import Limiter, Bucket, Time as per

# Initialize the bucket or buckets with the rules
buckets = [
    Bucket(
        # Rate of 1 per 1 second
        refill_amount=1, refill_time=per.SECOND,
        max_amount=10, timer=time
    )
    , Bucket(
        # Rate of 5 per 5 minutes
        refill_amount=5, refill_time=per.MINUTE,
        max_amount=5, timer=time
    )
    , Bucket(
        # Rate of 1000 per day
        refill_amount=1000, refill_time=per.DAY,
        max_amount=1000, timer=time
    )
]
rate_limiter = Limiter(buckets)

# Use the rate limiter.
if rate_limiter.reduce():
  print("You still have quota.")
else:
  print("You quota is exhausted")

# Display status of the buckets.
print rate_limiter.get_buckets_status()
```

## Testing on a fake server (included)

If you use any virtual env, activate it .

```bash
# Create virtual env (optional)
python -m venv env
# Activate virtual env (optional)
source env/bin/activate
```

and install the dependencies

```bash
(env) python -m pip install -r requirements.txt
```

### Start the server

```bash
# Start the test server
(env) python server.py
```

```bash
# Send a single HTTP GET request with curl
curl http://<IP_ADDRESS>:8080/

# Use a benchmarking tool like 'hey'. One request per second for a total of 100 request.
hey -n 100 -c 1 -q 1 http://<IP_ADDRESS>:8080/

# Display the bucket status on the server
# i.e: {'Bucket 0': 8, 'Bucket 1': 4, 'Bucket 2': 2}
hey -n 100 -c 1 -q 1 http://<IP_ADDRESS>:8080/status

```

## Unit test the module with pytest

```bash
# Run the unit test
(env) python -m pytest -v

# Run the Unit Test with test coverage
(env) python -m pytest -v --cov=ratelimiter
```

### Cited Work

- https://en.wikipedia.org/wiki/Leaky_bucket
- https://medium.com/smyte/rate-limiter-df3408325846

repository: glongh/frozenpipe

branch_name: refs/heads/main

repo_name: glongh/frozenpipe


text:
# shadowbox

Shadowbox is currently being developed on an ODroid XU4 running Ubuntu.

## System config

### Startup

Since Shadowbox needs do graphics stuff, it needs to be run in the context of
MATE. To do this, go to System > Preferences > Personal > Startup Applications,
and add the shadowbox binary. You should also add the Fadecandy server here.

### Drivers

The graphics drivers from the Odroid Github repos are more current than the
ones from their packages. This is also useful if you accidentally install the
Mesa drivers. Note that these drivers will be clobbered if you update the
mali-x11 package.

```bash
git clone https://github.com/mdrjr/5422_mali.git
cd x11
sudo make install
```

## Dependencies

### OpenCV 3.X

On the XU4, when building OpenCV, there are several options which provide a
significant speedup (BasicTracer at this revision went from ~30fps to ~53fps):

```
cmake -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX=/usr/local -DENABLE_VFPV3=ON -DENABLE_NEON=ON -DWITH_TBB=ON ..
```

This require building TBB from source and running `source tbbvars.sh` from the
build folder before running cmake. OpenCV has an option to automatically build
TBB (-DBUILD_TBB), but it doesn't work with the above options.

TODO: switch to Release build type

### libftdi

Shadowbox uses a SainSmart USB relay device to control power to the screen. This device is controlled via FTDI. It uses libftdi to interact with the relays.

Unfortunately, it seems to require root to communicate with the relays. I set up a udev rule and it appeared to be correctly applied, but libftdi couldn't find the device unless running as root.

```
sudo apt-get install libftdi-dev
```

### SDL2

### git-lfs

Shadowbox uses git-lfs to store video files for testing. There isn't a package
for it on arm, so you'll need to build it yourself. First [download
Golang](https://golang.org/dl/) and install it (as of writing, Go 1.7.3 is
required, and only 1.6 is available in the repos). Then, follow the instructions
[here](https://github.com/git-lfs/git-lfs/blob/master/CONTRIBUTING.md#building-git-lfs)
to build git-lfs. Copy the binary produced into `/usr/local/bin` and run `git
lfs install`.

### Google Test

Shadowbox uses Google Test, Google's C++ testing and mocking framework.
Download it from [the site](https://github.com/google/googletest), build it
with CMake, and `make install` it.

### Fadecandy

Shadowbox uses a Fadecandy to control "projector" lights that shine from the
camera on the underside of the screen, to create the "shadow" illusion. To set
up the Fadecandy server"

1. Clone the shadowbox repo:
```bash
git clone https://github.com/scanlime/fadecandy.git
cd fadecandy
```

Now, run the server:
```bash
bin/fcserver-rpi
```

repository: ademuri/shadowbox

repo_name: ademuri/shadowbox


text:
# Awesome Tools
> A curated list of awesome tools to make your life happier.

- [wechat-deleted-friends](https://github.com/0x5e/wechat-deleted-friends) - 查看被删的微信好友
- [cloud-to-butt](https://github.com/panicsteve/cloud-to-butt) - Chrome extension that replaces occurrences of 'the cloud' with 'my butt'
- [mama](https://github.com/coolzilj/mama) - 妈妈再也不用担心我的 macbook 发烫之超级偷懒计划

repository: coolzilj/awesome-tools

repo_name: coolzilj/awesome-tools


text:
---
layout: post
title:  "RNN Series:LSTM internals:Part-2:The Forward pass"
excerpt: "In this multi-part series, we look inside LSTM forward pass. Read the part-1's before you come back here. Once you are back, in this article, we explore the meaning, math and the implementation of an LSTM cell. I do this using the first principles approach for which I have pure python implementation Deep-Breathe of most complex Deep Learning models."
mathjax: true
date:   2019-07-09 15:07:19
categories: [article]
tags: Artificial-Intelligence Deep-Learning LSTM RNN Sequence-Modelling
comments: true
---

### Introduction
In this [multi-part series][multi-part series], we look inside LSTM forward pass. If you haven't already read it I suggest run through the previous parts ([part-1]) before you come back here. Once you are back, in this article, we explore the meaning, math and the implementation of an LSTM cell. I do this using the first principles approach for which I have pure python implementation Deep-Breathe of most complex Deep Learning models.

### What this article is not about?
> * This article will not talk about the conceptual model of LSTM, on which there is some great existing material [here][lstm-1] and [here][lstm-2] in the order of difficulty.
> * This is not about the differences between vanilla RNN and LSTMs, on which there is an awesome post by Andrej if a somewhat [difficult post][lstm-3].
> * This is not about how LSTMs mitigate the vanishing gradient problem, on which there is a little mathy but awesome posts [here][lstm-4] and [here][lstm-5] in the order of difficulty

### What this article is about?
> * Using the [first principles][first principles] we picturize/visualize the forward pass of an LSTM cell.
> * Then we associate code with the picture to make our understanding more concrete

### Context
This is the same example and the context is the same as described in [part-1]. The focus however, this time is on LSTMCell.

### LSTM Cell
While there are many variations to the LSTM cell. In the current article, we are looking at [LayerNormBasicLSTMCell].
> * Weights and biases of the LSTM cell.
> * Shapes color-coded.
{%
    include image.html
    src="/img/rnn/lstm1.jpg"
    caption="figure-1: Batch=1, State=5(internal states(C and H)), input_size=10(assuming vocab size of 10 translates to one-hot of size 10) ."
    hight="110%"
    width="110%"
%}

> * Weights, biases of the LSTM cell. Also shown is the cell state (c-state) over and above the h-state of a vanilla RNN.
> * ht-1 may be initialized by default with zeros.
{%
    include image.html
    src="/img/rnn/lstm2.jpg"
    caption="figure-2: Weights and biases for all the gates f(forget), i(input), c(candidatecellstate), o(output). The Shapes of these weights are 5X15 individually and stacked vertically as shown they measure 20X15. The Shapes of the biases are 5X1 individually and stacked up 20X1."
    hight="110%"
    width="110%"
%}

> * Weights and biases in the [code][code-1].
> * Often the code accepts constants as weights for comparison with [Tensorflow]
{%
    include image.html
    src="/img/rnn/lstm3.jpg"
    caption="figure-3: 4*hidden_size(5),input_size(10)+hidden_size(5)+1(biases). Making it 20X16, biases allocated with weights is a matter of convenience and performance."
    hight="110%"
    width="110%"
%}

> * Equations of LSTM and their interplay with weights and biases.
> * ht-1 and ct-1 may be initialized by default with zeros(Language Model) or some non-zero state for conditional language model.
{%
    include image.html
    src="/img/rnn/lstm4.jpg"
    caption="figure-4: Equations of LSTM and their interplay with weights and biases."
    hight="110%"
    width="110%"
%}

> * GEMM(General Matrix Multiplication) in [code][code-2]
> * h and x concatenation is only a performance convenience.
{%
    include image.html
    src="/img/rnn/lstm5.jpg"
    caption="figure-5: GEMM and running them though various gates."
    hight="110%"
    width="110%"
%}

> * The mathematical reason why the vanishing gradient is mitigated.
> * There are many theories though. Look into this in detail with back-propagation.
{%
    include image.html
    src="/img/rnn/lstm6.jpg"
    caption="figure-6: New cell state is a function of old cell state and new candidate state."
    hight="110%"
    width="110%"
%}

> * New cell state(c-state) in [code][code-3]
> * This is used in 2 ways as illustrated in figure-8.
{%
    include image.html
    src="/img/rnn/lstm7.jpg"
    caption="figure-7: The previous steps already decided what to do, we just need to actually do it."
    hight="110%"
    width="110%"
%}

> * c-statet is used to calculate the "externally visible" h-statet
> * Sometimes referred to as ct, ht, used as the states at the next time step.
{%
    include image.html
    src="/img/rnn/lstm8.jpg"
    caption="figure-8: Conceptually it is the same cell transitioning into the next state. In this case ct."
    hight="110%"
    width="110%"
%}

> * New h-state in [code][code-4]
> * The transition to the next time step is complete with ht.
{%
    include image.html
    src="/img/rnn/lstm9.jpg"
    caption="figure-9: Conceptually it is the same cell transitioning into the next state. In this case ht."
    hight="110%"
    width="110%"
%}

> * ht multiplied by the "Wy" and "by" added to it.
> * Traditionally we call this value "logits" or "preds".
{%
    include image.html
    src="/img/rnn/lstm10.jpg"
    caption="figure-10: Wy shape is 10X5 multiplied by ht which is 5X1 and by added to it which is 10X1 as shown above."
    hight="110%"
    width="110%"
%}

> * Usually, this is done in on the client-side code because only the clients know the model and when the loss calculation can be done.
> * Tensorflow version of the [code][code-5].
{%
    include image.html
    src="/img/rnn/lstm11.jpg"
    caption="figure-11: DEEP-Breathe version of the code."
    hight="110%"
    width="110%"
%}

> * Usually done internally by "cross_entropy_loss" function.
> * Shown here just so that you get an idea.
{%
    include image.html
    src="/img/rnn/lstm12.jpg"
    caption="figure-12: Traditionally called yhat."
    hight="110%"
    width="110%"
%}

> * Does a combination of softmax(figure-12) and loss calculation(figure-13).
> * [Softmax][softmax] and a [cross_entropy_loss][cross_entropy_loss] to jog your memory.
{%
    include image.html
    src="/img/rnn/lstm13.jpg"
    caption="figure-13: Similar to logistic regression and its cost function."
    hight="110%"
    width="110%"
%}

> * Summary with weights.
{%
    include image.html
    src="/img/rnn/lstmcelltemplate5.jpg"
    caption="figure-15: Summary with weights."
    hight="110%"
    width="110%"
%}

> * Summary as flow diagram.
{%
    include image.html
    src="/img/rnn/lstmforward.jpg"
    caption="figure-14: Summary as simple flow diagram."
    hight="110%"
    width="110%"
%}

> * A Sequence of 3 shown below, but that can depend on the use-case.
> * Tensorflow version of the [code][code-5] and DEEP-Breathe version of the [code][code-6].
{%
    include image.html
    src="/img/rnn/lstm14.jpg"
    caption="figure-16: The code below is merely shown to give you an idea of the sequence. In practice the 'dynamic_rnn' function does iteration part, the preds are multiplied 'Wy' added to 'By' by client code and then handed over to 'cross_entropy_loss' function."
    hight="110%"
    width="110%"
%}

### Summary
In summary, then, that was the walk through of LSTM's forward pass. As a study in contrast, if building a Language model that predicts the next word in the sequence, the training would be similar but we'll calculate loss at every step. The label would be the 'X' just one time-step advanced. However, Let's not get ahead of ourselves, before we get to a language model, let's look at the backward pass(Back Propagation) for LSTM in the next post.

[part-1]: /articles/2019-07/LSTMPart-1
[part-2]: /articles/2019-07/LSTMPart-2
[multi-part series]: /tags/#LSTM
[first principles]: https://medium.com/the-mission/elon-musks-3-step-first-principles-thinking-how-to-think-and-solve-difficult-problems-like-a-ba1e73a9f6c0
[Deep-Breathe]: https://github.com/slowbreathing/Deep-Breathe
[LayerNormBasicLSTMCell]: https://www.tensorflow.org/api_docs/python/tf/contrib/rnn/LayerNormBasicLSTMCell
[lstm-1]: https://colah.github.io/posts/2015-08-Understanding-LSTMs/
[lstm-2]: https://r2rt.com/written-memories-understanding-deriving-and-extending-the-lstm.html
[lstm-3]: http://karpathy.github.io/2015/05/21/rnn-effectiveness/
[lstm-4]: https://weberna.github.io/blog/2017/11/15/LSTM-Vanishing-Gradients.html
[lstm-5]: https://medium.com/datadriveninvestor/how-do-lstm-networks-solve-the-problem-of-vanishing-gradients-a6784971a577

[code-1]: https://github.com/slowbreathing/Deep-Breathe/blob/f9585bde9cbb61e71f67ccd936aa22a155c36709/org/mk/training/dl/rnn_cell.py#L76
[code-2]: https://github.com/slowbreathing/Deep-Breathe/blob/f9585bde9cbb61e71f67ccd936aa22a155c36709/org/mk/training/dl/rnn_cell.py#L210-L214
[code-3]: https://github.com/slowbreathing/Deep-Breathe/blob/f9585bde9cbb61e71f67ccd936aa22a155c36709/org/mk/training/dl/rnn_cell.py#L215
[code-4]: https://github.com/slowbreathing/Deep-Breathe/blob/f9585bde9cbb61e71f67ccd936aa22a155c36709/org/mk/training/dl/rnn_cell.py#L216
[code-5]: https://github.com/slowbreathing/Deep-Breathe/blob/f9585bde9cbb61e71f67ccd936aa22a155c36709/org/mk/training/dl/tfwordslstm.py#L95-L104
[code-6]: https://github.com/slowbreathing/Deep-Breathe/blob/f9585bde9cbb61e71f67ccd936aa22a155c36709/org/mk/training/dl/LSTMMainGraph.py#L98-L109

[softmax]: /articles/2019-05/softmax-and-its-gradient
[cross_entropy_loss]: /articles/2019-05/softmax-and-cross-entropy
[Tensorflow]: https://www.tensorflow.org/
[Listing-1]: https://github.com/slowbreathing/Deep-Breathe/blob/master/org/mk/training/dl/tfwordslstm.py
[Listing-2]: https://github.com/slowbreathing/Deep-Breathe/blob/master/org/mk/training/dl/LSTMMainGraph.py
[Listing-3]: https://github.com/slowbreathing/Deep-Breathe/blob/master/org/mk/training/dl/LSTMMain.py
[scr-1]: https://github.com/slowbreathing/Deep-Breathe/blob/f9585bde9cbb61e71f67ccd936aa22a155c36709/scripts#L13
[scr-2]: https://github.com/slowbreathing/Deep-Breathe/blob/f9585bde9cbb61e71f67ccd936aa22a155c36709/scripts#L15
[scr-3]: https://github.com/slowbreathing/Deep-Breathe/blob/f9585bde9cbb61e71f67ccd936aa22a155c36709/scripts#L14
[pygr-1]: https://github.com/slowbreathing/Deep-Breathe/blob/c3b538d9c3afeeb5a15c3d91ea9063976438c810/org/mk/training/dl/rnn.py#L75-L76
[pygr-2]: https://github.com/slowbreathing/Deep-Breathe/blob/c3b538d9c3afeeb5a15c3d91ea9063976438c810/org/mk/training/dl/common.py#L241-L255
[pygr-3]: https://github.com/slowbreathing/Deep-Breathe/blob/c3b538d9c3afeeb5a15c3d91ea9063976438c810/org/mk/training/dl/rnn_cell.py#L79-L81
[pygr-4]: https://github.com/slowbreathing/Deep-Breathe/blob/c3b538d9c3afeeb5a15c3d91ea9063976438c810/org/mk/training/dl/core.py#L107-L112

gha_language: HTML


text:
The recursive do-notation {#recursive-do-notation}
=========================

::: {.extension shortdesc="Enable recursive do (mdo) notation."}
RecursiveDo

since

:   6.8.1

Allow the use of recursive `do` notation.
:::

The do-notation of Haskell 98 does not allow *recursive bindings*, that
is, the variables bound in a do-expression are visible only in the
textually following code block. Compare this to a let-expression, where
bound variables are visible in the entire binding group.

It turns out that such recursive bindings do indeed make sense for a
variety of monads, but not all. In particular, recursion in this sense
requires a fixed-point operator for the underlying monad, captured by
the `mfix` method of the `MonadFix` class, defined in
`Control.Monad.Fix` as follows: :

    class Monad m => MonadFix m where
       mfix :: (a -> m a) -> m a

Haskell\'s `Maybe`, `[]` (list), `ST` (both strict and lazy versions),
`IO`, and many other monads have `MonadFix` instances. On the negative
side, the continuation monad, with the signature `(a -> r) -> r`, does
not.

For monads that do belong to the `MonadFix` class, GHC provides an
extended version of the do-notation that allows recursive bindings. The
`RecursiveDo`{.interpreted-text role="extension"} (language pragma:
`RecursiveDo`) provides the necessary syntactic support, introducing the
keywords `mdo` and `rec` for higher and lower levels of the notation
respectively. Unlike bindings in a `do` expression, those introduced by
`mdo` and `rec` are recursively defined, much like in an ordinary
let-expression. Due to the new keyword `mdo`, we also call this notation
the *mdo-notation*.

Here is a simple (albeit contrived) example:

    {-# LANGUAGE RecursiveDo #-}
    justOnes = mdo { xs <- Just (1:xs)
                   ; return (map negate xs) }

or equivalently

    {-# LANGUAGE RecursiveDo #-}
    justOnes = do { rec { xs <- Just (1:xs) }
                  ; return (map negate xs) }

As you can guess `justOnes` will evaluate to `Just [-1,-1,-1,...`.

GHC\'s implementation the mdo-notation closely follows the original
translation as described in the paper [A recursive do for
Haskell](http://leventerkok.github.io/papers/recdo.pdf), which in turn
is based on the work [Value Recursion in Monadic
Computations](http://leventerkok.github.io/papers/erkok-thesis.pdf).
Furthermore, GHC extends the syntax described in the former paper with a
lower level syntax flagged by the `rec` keyword, as we describe next.

Recursive binding groups
------------------------

The extension `RecursiveDo`{.interpreted-text role="extension"} also
introduces a new keyword `rec`, which wraps a mutually-recursive group
of monadic statements inside a `do` expression, producing a single
statement. Similar to a `let` statement inside a `do`, variables bound
in the `rec` are visible throughout the `rec` group, and below it. For
example, compare

    do { a <- getChar            do { a <- getChar
       ; let { r1 = f a r2          ; rec { r1 <- f a r2
       ;     ; r2 = g r1 }          ;     ; r2 <- g r1 }
       ; return (r1 ++ r2) }        ; return (r1 ++ r2) }

In both cases, `r1` and `r2` are available both throughout the `let` or
`rec` block, and in the statements that follow it. The difference is
that `let` is non-monadic, while `rec` is monadic. (In Haskell `let` is
really `letrec`, of course.)

The semantics of `rec` is fairly straightforward. Whenever GHC finds a
`rec` group, it will compute its set of bound variables, and will
introduce an appropriate call to the underlying monadic value-recursion
operator `mfix`, belonging to the `MonadFix` class. Here is an example:

    rec { b <- f a c     ===>    (b,c) <- mfix (\ ~(b,c) -> do { b <- f a c
        ; c <- f b a }                                         ; c <- f b a
                                                               ; return (b,c) })

As usual, the meta-variables `b`, `c` etc., can be arbitrary patterns.
In general, the statement `rec ss` is desugared to the statement

    vs <- mfix (\ ~vs -> do { ss; return vs })

where `vs` is a tuple of the variables bound by `ss`.

Note in particular that the translation for a `rec` block only involves
wrapping a call to `mfix`: it performs no other analysis on the
bindings. The latter is the task for the `mdo` notation, which is
described next.

The `mdo` notation
------------------

A `rec`-block tells the compiler where precisely the recursive knot
should be tied. It turns out that the placement of the recursive knots
can be rather delicate: in particular, we would like the knots to be
wrapped around as minimal groups as possible. This process is known as
*segmentation*, and is described in detail in Section 3.2 of [A
recursive do for
Haskell](http://leventerkok.github.io/papers/recdo.pdf). Segmentation
improves polymorphism and reduces the size of the recursive knot. Most
importantly, it avoids unnecessary interference caused by a fundamental
issue with the so-called *right-shrinking* axiom for monadic recursion.
In brief, most monads of interest (IO, strict state, etc.) do *not* have
recursion operators that satisfy this axiom, and thus not performing
segmentation can cause unnecessary interference, changing the
termination behavior of the resulting translation. (Details can be found
in Sections 3.1 and 7.2.2 of [Value Recursion in Monadic
Computations](http://leventerkok.github.io/papers/erkok-thesis.pdf).)

The `mdo` notation removes the burden of placing explicit `rec` blocks
in the code. Unlike an ordinary `do` expression, in which variables
bound by statements are only in scope for later statements, variables
bound in an `mdo` expression are in scope for all statements of the
expression. The compiler then automatically identifies minimal mutually
recursively dependent segments of statements, treating them as if the
user had wrapped a `rec` qualifier around them.

The definition is syntactic:

-   A generator ⟨g⟩ *depends* on a textually following generator ⟨g\'⟩,
    if
    -   ⟨g\'⟩ defines a variable that is used by ⟨g⟩, or
    -   ⟨g\'⟩ textually appears between ⟨g⟩ and ⟨g\'\'⟩, where ⟨g⟩
        depends on ⟨g\'\'⟩.
-   A *segment* of a given `mdo`-expression is a minimal sequence of
    generators such that no generator of the sequence depends on an
    outside generator. As a special case, although it is not a
    generator, the final expression in an `mdo`-expression is considered
    to form a segment by itself.

Segments in this sense are related to *strongly-connected components*
analysis, with the exception that bindings in a segment cannot be
reordered and must be contiguous.

Here is an example `mdo`-expression, and its translation to `rec`
blocks:

    mdo { a <- getChar      ===> do { a <- getChar
        ; b <- f a c                ; rec { b <- f a c
        ; c <- f b a                ;     ; c <- f b a }
        ; z <- h a b                ; z <- h a b
        ; d <- g d e                ; rec { d <- g d e
        ; e <- g a z                ;     ; e <- g a z }
        ; putChar c }               ; putChar c }

Note that a given `mdo` expression can cause the creation of multiple
`rec` blocks. If there are no recursive dependencies, `mdo` will
introduce no `rec` blocks. In this latter case an `mdo` expression is
precisely the same as a `do` expression, as one would expect.

In summary, given an `mdo` expression, GHC first performs segmentation,
introducing `rec` blocks to wrap over minimal recursive groups. Then,
each resulting `rec` is desugared, using a call to
`Control.Monad.Fix.mfix` as described in the previous section. The
original `mdo`-expression typechecks exactly when the desugared version
would do so.

Here are some other important points in using the recursive-do notation:

-   It is enabled with the extension `RecursiveDo`{.interpreted-text
    role="extension"}, or the `LANGUAGE RecursiveDo` pragma. (The same
    extension enables both `mdo`-notation, and the use of `rec` blocks
    inside `do` expressions.)
-   `rec` blocks can also be used inside `mdo`-expressions, which will
    be treated as a single statement. However, it is good style to
    either use `mdo` or `rec` blocks in a single expression.
-   If recursive bindings are required for a monad, then that monad must
    be declared an instance of the `MonadFix` class.
-   The following instances of `MonadFix` are automatically provided:
    List, Maybe, IO. Furthermore, the `Control.Monad.ST` and
    `Control.Monad.ST.Lazy` modules provide the instances of the
    `MonadFix` class for Haskell\'s internal state monad (strict and
    lazy, respectively).
-   Like `let` and `where` bindings, name shadowing is not allowed
    within an `mdo`-expression or a `rec`-block; that is, all the names
    bound in a single `rec` must be distinct. (GHC will complain if this
    is not the case.)


text:
+++
draft = false
date = 2021-04-27T23:15:47+08:00
title = "Adding photos to the site"
description = ""
slug = ""
authors = []
tags = []
categories = []
externalLink = ""
series = []
+++

# Adding photos

Photographs can be added to a post with this syntax:

> ![alternative description](location of image)

Be sure to save images inside the folder /static/images.

When images are saved there, the location is: "/images/imagename"

![owl](/images/owlpink.png)

To maintain site performance, keep images small in size.

repository: lawrenceaph/the-allsite

repo_name: lawrenceaph/the-allsite


text:
# VCF filtering tutorial

This tutorial shows how to perform standard filtering of a VCF file. It also includes a PCA to explore if there is any structure in the data.

The tutorial was implemented in [Databricks](https://community.cloud.databricks.com). So, you can import the [Genomics&Spark.dbc](Genomics&Spark.dbc) notebook into Databricks and replicate my analysis.

**DISCLAIMER:** USE THESE SCRIPTS AT YOUR OWN RISK. I MAKE NO WARRANTIES THAT THESE SCRIPTS ARE BUG-FREE, COMPLETE, AND UP-TO-DATE. I AM NOT LIABLE FOR ANY LOSSES IN CONNECTION WITH THE USE OF THESE SCRIPTS.


text:
# Bing Gallery

Command-line tool for change a desktop picture based on daily [Bing](https://www.bing.com) images

[![Build Status](https://travis-ci.org/vitalibo/bing-gallery.svg?branch=master)](https://travis-ci.org/vitalibo/bing-gallery)

### Installing
#### macOS

For macOS family you can use [Homebrew](https://brew.sh) package for that.

```bash
brew install https://raw.githubusercontent.com/vitalibo/bing-gallery/master/integration/brew/bing-gallery.rb
```

### Usage

```text
usage: bing_gallery [--offset {1..7}] [--market {en-US,zh-CN,ja-JP,en-AU,en-UK,de-DE,en-NZ,en-CA}]
                    [--output OUTPUT] [--version] [-h]

Command-line tool for change a desktop picture based on daily Bing images

optional arguments:
  --offset {0,1,2,3,4,5,6,7}
                        Specify index of photo to use.
  --market {en-US,zh-CN,ja-JP,en-AU,en-UK,de-DE,en-NZ,en-CA}
                        Specify market that you want to use.
  --output OUTPUT       Output folder for storing images.
  --version             Display the version of this tool.
  -h, --help            Show this help message.

Copyright (c) 2015-2020, Vitaliy Boyarsky
```

repository: vitalibo/bing-gallery

repo_name: vitalibo/bing-gallery


text:
# result_and_transcript_system
A Result and Transcript Processing System for Universities

# SYSTEM DEVELOPMENT
MODE OF DEVELOPMENT - Rapid Development

TOOLS AND LIBRARIES USED FOR DEVELOMENT:
- GitHub
- XAMPP (MySQL and PHP)
- Database Designer
- Microsoft Excel
- Visual Studio
- Inno Setup https://jrsoftware.org/isdl.php
- ExcelDataReader
- Microsoft Access
- Visual Studio Code
Progress Report with Tools:

** GitHub:
+ Communication and project contributions was done using this platform.
+ GitHub was also used to merge the codes from the contributors.

** Microsoft Excel:
+ The sample data is stored in spreadsheets using Microsoft Excel
+ This data is then imported into the database

** Xammp:
+ Xammp is then used to create and  design the database for the system using SQL code

** Database Designer:
+ The SQL syntax from the database has been imported to the Database Designer which is used to design the schema for the system.
+ This schema aided in  the design of the relationship between the entities of the tables.

** Visual Studio:
+ The design for the desktop application is underway using visual basic (visual Basic).


text:
# pixel-cartridge
Save data as an image

One pixel is made up of three RGB values which can become:
* Three integers 0 - 255
* One big integer 0 - 16,646,655 (255^3 + 255^2 + 255)
* With last-digit steganography:
   * Three digits 0 - 9
   * One integer 000 - 999

Two pixels can become:
* Six integers 0 - 255
* Two big integers 0 - 16,646,655
* One massive integer
* With last-digit steganography:
   * Six digits 0 - 9
   * Two digits 000 - 999
   * One digit 000000 - 999,999

How to read the pixels:

1. Read pixels left-to-right, top-to-bottom
1. Get RGB values as integers (0-255)
1. Look at last digit of each color value, e.g. `110, 225, 34` becomes `054`
1. First pixel without all zeroes is the "guide" pixel, and is used to determine the format of reading the pixels

| Guide Code | Name | Steganography? | Each pixel becomes... | Compression | Characters | Start | End | Width |
| ---------- | ---- | -------------- | --------------------- | --- | --- | --- | --- | --- |
| `000` | Reserved | | | | | | |
| `555` | White / Configurable Steg. | Using last digits | An integer 000 - 999 | Config | Config | Config | Config |
| `550` | Yellow | Using last digits | int 000 - 999 |
| `055` | Cyan | Using last digits | int 000 - 999 |
| `050` | Green | No | 3 ints 0 - 255 | Config |  Config | Config | Config |
| `500` | Red / Minimal | No | 3 ints 0 - 255 | Dupes |  ASCII Halved | After | Black
| `005` | Blue / Simple | No | 3 ints 0 - 255 | None | ASCII Offset | Next Black (Allows for a header) | Black | Full |
| `505` | Magenta | ?

Configuration Pixels

2. `000` for ending guide pixel to determine pixel size (integer)
3. Game format (key/code, 001 - 999)
4. Format version (varies, RGB, 255-255-255, key/code)
5. game info (varies)
6. Color offset

Data

6. Start coords (integer)
7. End coords (integer)
* Size (large integer)

Decoding

7. Compression format (000-999, key/code)
8. ASCII vs. ASCII extended vs. unicode

* Start coords (integer)
* End coords (integer)

* ASCII start number

Game Format Codes

| Code | Game | Example Colors |
| ---- | ---- | ------ |
| `000` | Reserved | Black, Gainsboro, Linen, Tan, Steelblue, Darkgreen, Lavender, Khaki, Lightgoldenrodyellow, Crimson |
|

repository: rocket-boots/pixel-cartridge

repo_name: rocket-boots/pixel-cartridge


text:
# Communicate_Data_Finding_Fifa19
This project is divided into two major parts. In the first part, I conducted an exploratory data analysis on the dataset.
I used Python data science and data visualization libraries to explore the dataset’s variables and understand the data’s structure,
oddities, patterns and relationships. The analysis in this part is structured,
going from simple univariate relationships up through multivariate relationships.

In the second part, I took my main findings from my exploration and convey them to others through an explanatory analysis.
To this end, I created a slide deck that leverages polished, explanatory visualizations to communicate my results.

## DataSet
This dataset includes detailed attributes for every player registered in the latest edition of FIFA 19 database.
It consists of 18207 observations, 88 features.
Features included are FIFA 2019 players attributes like Age, Nationality, Overall, Potential

The dataset can be found here: https://www.kaggle.com/karangadiya/fifa19

## Summary of Findings
### Univariate Exploration
- change value, wage and release clause from strings to numbers and remove all currency symbols and change the "M" and "K" to
corresponding zeros so we can use them in numerical values later
 - changing Height and Weight to numerical kg and cm
 - I started the cleaning with 18207 observations, 88 features.
After i removed columns not needed for my analysis and also removes null values.
There are 16,643 observations in the dataset with 45 features to work with.
 - remove players that are above 40 as they were only 4
 - most of the player in our data in thier 20s. and its slightly postivie skewed
 - most players have height from 175cm to 188cm
 - we removed unnecessary columns such as photo, flag and so on
 - checked for null and removed them
 - fixed value, wage and release clause formats
 - fixed Height and weight formats
 - scale value, wage and release clause

### Bivariate Exploration :

- In this section, investigate relationships between pairs of variables in my data.
- Of all playing position, Right Forward players are valued more and have more variaty in values.
Right wing back position and Left wing back position are valued lowest.
- most players in the data have a normal body type. Only few players have a stocky body type.
- player with st postison valued more than the rest of the positions
- A strong correlation between Acceleartion and sprint speed
- Acceleration has a negative correlation with Weight, Height and Strength
- Value has postive correlation with Wage and release clause

### Multivariate Exploration

 - Create plots of three or more variables to investigate my data even further
 - will make the value in ranges " superhigh, High, medium, low, superlow" so we can visualize it correctly
 - we see here that the super high values are above the overall of 75 and between the age of 18 to 32
 - Most of the younger players weighs lesser and they also have more of a lean body type.
 - Players whose work rate is High/High, High/Medium have a high acceleration and the Low/Low have a lower acceleration.

key insights for the presentation:
Most of the younger players weighs lesser and they also have more of a lean body type. Players whose work rate is
High/High, High/Medium have a high acceleration and the Low/Low have a lower acceleration.


text:
# DAY8-NIGHT

We would like to build an app that will allow us to enjoy our date night by going through D8 Night app and selecting the categories that are important to us based on the selection that is given.

An application for users to help them select from various categories in order to plan out the perfect date night. Users may search between categories of recipes, cocktails, movies, tv shows, workout ideas, nearby events, music playlists, and finding a new book to share.

MVP:
  + We would like to have a minimum of 3 APIs to set our categories to choose from
  + We will use routes to access the APIs and narrow down the selection within each category
  + Our app will then display your results from your categories and save your selections into our SQL database.
  + Deploy on Heroku.
  + This additional Bare minimum CSS will include a flexbox and grid CSS.
  + Bare minimum JS will include building our server, using appropriate dependencies, using routes to access APIs, storing favorite events in SQL will display         using ejs.

## User Stories
## 1. Create a Recipe Finder
As a user, I want to search through different categories of cuisine to find a nice date night meal to prepare.

# Feature Tasks
 - Search for a cuisine
 - Save meal
 - View Favorites
 - Delete Favorites

# Acceptance Tests
 - GIVEN: When user searches by category
 - THEN: The API displays recipe options
 - WHEN: User clicks submit to save to favorites, it is shown in the database
 + Error message provided if something goes wrong when searching/saving/deleting

## 2. Create a Cocktail Finder
As a user, I want to search through different categories of alcohol to find a nice date night beverage to prepare.

# Feature Tasks
- Search for a cocktails
- Save drink
- View Favorites
- Delete Favorites

# Acceptance Tests
- GIVEN: When user searches by category
- THEN: The API displays cocktail options
- WHEN: User clicks submit to save to favorites, it is shown in the database
+ Error message provided if something goes wrong when searching/saving/deleting

## 3. Create a Music Playlist Finder
As a user, I want to search through different genres of music to find a nice date night playlist to set the mood.

# Feature Tasks
- Search for a music genre, artist, or album
- Save your favorite playlist(s)
- View Favorites
- Delete Favorites

# Acceptance Tests
- GIVEN: When user searches by category
- THEN: The API displays playlist options
- WHEN: User clicks submit to save to favorites, it is shown in the database
+ Error message provided if something goes wrong when searching/saving/deleting

## 4. Create a Movie Finder
As a user, I want to search through different categories of movies to find a nice date night movie to watch.

# Feature Tasks
- Search for a movie
- Save movie
- View Favorites
- Delete Favorites

# Acceptance Tests
- GIVEN: When user searches by category
- THEN: The API displays movie options
- WHEN: User clicks submit to save to favorites, it is shown in the database
+ Error message provided if something goes wrong when searching/saving/deleting

## 5. Create a TV Show Finder
As a user, I want to search through different categories of tv shows to find a nice new tv series to watch.

# Feature Tasks
- Search for a tv show
- Save show
- View Favorites
- Delete Favorites

# Acceptance Tests
- GIVEN: When user searches by category
- THEN: The API displays tv series options
- WHEN: User clicks submit to save to favorites, it is shown in the database
+ Error message provided if something goes wrong when searching/saving/deleting

## About Us
As a user, I want to learn about the awesome individuals who made my date nights a success

# Feature Tasks
- View names and photos of group members
- Display a short bio of team members

# Acceptance Tests
- Navigate to the About us page
- Names, photos, and short bios are properly displayed

**- Not sure yet if we will be able to present everything on homepage or will have to make separate pages, would love for it to be a one stop shop, but we will see once we start calling the APIs. -**

branch_name: refs/heads/dev


text:
# Library service

A simple django web service for job interview purpose.

[![Mit License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/nikialeksey/meerk/library-service/master/LICENSE)
![Python 3.6](https://img.shields.io/badge/python-3.7-blue.svg)

## DB scheme

|**Reader**|
|----|
|name|

|**Book**|
|-----|
|title|
|reader|

There is the migration generates 50k readers and 100k books. For simplicity reader IDs are
sequential numbers. By default there is two database instances: `leader` and replica `follower`.

## API
- `/readers/id_bounds/` - see the reader IDs bounds
- `/reader/<reader_id>/` - reader info in `JSON` format
- `/all/` - db export in `CSV` format

## Run
```bash
docker-compose up
```

repository: nikialeksey/library-service

gha_language: JavaScript

repo_name: nikialeksey/library-service


text:
# Opyn Vault Aggregator Interface

This vault aggregator interface (name recommendations welcome 😄) provides users a unified place to view all the various strategies that are available on the Opyn platform (e.g. ribbon.finance, fontis.finance, opeth.finance, optional.finance).

## Usage

```bash
npm run dev
# or
yarn dev
```

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

Please make sure to update tests as appropriate.

## License
[MIT](https://choosealicense.com/licenses/mit/)

repository: Defi-Project-list/opyn-vault-aggregator

repo_name: Defi-Project-list/opyn-vault-aggregator


text:
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.  See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->

# Contributing to Fluo Website

Contributions to the website can be made by submitting pull requests to this repo.  Checkout [How to
Contribute][contribute] on for general instructions on contributing to Fluo projects.

## Local Builds for Testing

### Setting up Your Jekyll/Bundler Environment

Ruby and RubyGems are required to use Jekyll and Bundler, so first make sure
you have those on your machine.

If you are using an OS packaged version of Ruby, you may also need to install
the ruby-dev (Ubuntu) or ruby-devel (Fedora) package as well to build any
native code for gems that are installed later. Installing these will also
ensure your system's RubyGems package is installed. Depending on your OS, you
may also need other packages to install/build gems, such as ruby-full, make,
gcc, nodejs, build-essentials, or patch.

Bundler is included in Ruby 2.6 and later as a default gem, so installing it
may not be needed.

Because we use [Bundler] to install specific versions of gems, it is not
recommended to use an OS packaged version of gems other than what comes
built-in. If you are using an OS packaged version of Ruby, it is __strongly__
recommended to avoid `sudo` when installing additional gems, in order to avoid
conflicting with your system's package-managed installation. Instead, you can
specify a `GEM_HOME` directory for installing gems locally in your home
directory. You can do this in your `$HOME/.bashrc` file or other appropriate
place for your environment:

```bash
# in .bashrc
export GEM_HOME=$HOME/.gem/ruby
```

With Ruby installed on your machine, you can install [Bundler] using the
command below:

```bash
# not necessary in Ruby >2.6, since it is a default gem since 2.6
gem install bundler
```

Next, use [Bundler] to install [Jekyll] and other dependencies needed to run
the website (this command assumes your current working directory is your clone
of this repository with the `main` branch checked out, because that's where
the Gemfile dependency list exists).

```bash
bundle install
```

### Testing with the Built-in Jekyll Webserver

The command to serve the site contents using Jekyll's built-in webserver is as
follows (this webserver may behave differently than apache.org's servers).

```bash
bundle exec jekyll serve -w
```

You do __NOT__ need to execute a `bundle exec jekyll build` command first, as
the `serve` command is sufficient to both build the site and serve its
contents. By default, it will also try to re-build any pages you change while
running the webserver, which can be quite useful if trying to get some CSS or
HTML styled "just right".

Jekyll will print a local URL where the site can be viewed (usually,
[http://<IP_ADDRESS>:4000/](http://<IP_ADDRESS>:4000/)).

[Bundler]: https://bundler.io/
[Jekyll]: https://jekyllrb.com/
[contribute]: https://fluo.apache.org/how-to-contribute/
[kramdown]: https://kramdown.gettalong.org/
[production]: https://fluo.apache.org
[staging]: https://fluo.staged.apache.org

branch_name: refs/heads/gh-pages


text:
# PIP: Pictorial Interpretable Prototype Learning for Time Series Classification

The implimentation of PIP: Pictorial Interpretable Prototype Learning for Time Series Classification

## Data

We select three datasets: UCI-HAR, UCR-FordA, and UEA-SpokenArabicDigits for our expriment.

## Requirments

All python packages needed are listed in requirments.txt file and can be installed as follow:

```
conda config --append channels conda-forge
conda create --name <your env name> --file requirements.txt
```

## Expriments

To run each expriment you can following commands

```
python exp/uci-har-exp.py
python exp/ucr-fordA-exp.py
python exp/uea-arabic-exp.py
```

the result of all expriments save in 'trainin_history' folder.

repository: CSY-siyuan/PIPNet

repo_name: CSY-siyuan/PIPNet


text:
# TypeScript Next Starter

A starter kit for developing web applications with TypeScript and Next.

* **[TypeScript](https://github.com/Microsoft/TypeScript)** for scalable, statically typed JavaScript.
* **[TSLint](https://github.com/palantir/tslint)** for TypeScript linting.
* **[Next](https://github.com/zeit/next.js)** for effortless server-side development.
* **[HTML5 Boilerplate](https://github.com/h5bp/html5-boilerplate)** for providing a basic HTML structure.
* **[Normalize](https://github.com/necolas/normalize.css)** for normalizing HTML elements across browsers.
* **[commitlint](https://github.com/marionebl/commitlint)** for commit linting via **[Husky](https://github.com/typicode/husky)** Git hooks.
* **[Commitizen](https://github.com/commitizen/cz-cli)** for standardized commit messages.

## Installation

Clone this repository and delete the Git history:

```
git clone https://github.com/llorca/typescript-next-starter && rm -rf typescript-next-starter/.git
```

Search for the `TNS_CONFIG` string in the project, then replace each occurrence with your desired configuration.

Initialize as a new repository:

```
git init
```

Install the dependencies:

```
npm install
```

## Usage

Start the Next development server:

```
npm run dev
```

Commit changes with Commitizen:

```
npm run commit
```

Export a static React application:

```
npm run export
```

## License

[MIT](./LICENSE)

repository: llorca/typescript-next-starter

repo_name: llorca/typescript-next-starter


text:
# Contributing to Calico documentation

## Overview

We welcome contributions to the Calico documentation.

Instead of filing a GitHub issue, consider making a PR instead. You are likely to see a much more rapid resolution.

The doc contribution process works as follows.

1. Fork the [Project Calico repo](https://github.com/projectcalico/calico).
1. Create a branch in your fork off of the master branch.
1. Give your branch a short but descriptive name.
1. Preview your changes to make sure they render as expected. You can either [build the site locally](#building-the-doc-site-locally) or go directly to the "submit a pull request" to [build the site with the Project Calico CI/CD system](#previewing-the-changes-from-cicd).
1. Check for broken links. You can either [check for broken links](#checking-for-broken-links) in your local environment or submit a pull request and use the output of the Semaphore job.
1. Submit a pull request (PR) against the master branch of the [Project Calico repo](https://github.com/projectcalico/calico).
1. If you haven't already signed our contributer agreement, GitHub will prompt you to do so (required).
1. Request a review from one or more Calico maintainers.
1. After getting the approval of at least one Calico maintainer, we ask that you [backport the changes in the `master` folder to the folders of the last two releases](#how-to-quickly-apply-changes-in-master-to-a-previous-release), if appropriate.
1. Squash your commits.
1. One of the doc repo maintainers will give the PR a final look and then merge it.
1. The merge into master will kick off a new build of the live site. You should see your changes on the live site shortly after they are merged.

> **Important**: Ensure that your contribution conforms to the [Calico documentation style guide](DOC_STYLE_GUIDE.md).

> **Note**: For contributions that affect just one page, you can use the **Edit this page** buttons in the doc site. This allows you to skip a few steps in the process outlined above, but is suitable only for small contributions.

We also encourage you to review [Doc site organization](#doc-site-organization), [Organizational changes](#organizational-changes), [Link syntax](#link-syntax), and [RELEASING.md](RELEASING.md) for additional information.

## Previewing your changes

### Building the doc site locally

We use GitHub Pages and Jekyll to serve and build our site. While there are [several ways to build the site locally](https://help.github.com/articles/setting-up-your-github-pages-site-locally-with-jekyll/), we recommend using our Docker image and the Makefile in the root of the repo. These will allow you to build the site with a single command.

> **Prerequisite**: [Docker](https://docs.docker.com/engine/installation/).

Navigate into the root of the repo and issue the following command from a terminal prompt.

```
make serve
```

Once the build completes, it returns a URL as the value of `Server address:`. Copy and paste this URL into your browser to view the site.

> **Note**: To view the changes that you've made in the master branch, select **nightly** from the **Releases** page.

> **Pro tip**: Jekyll can take a while to render every page. To speed up builds, a supplemental `_config_dev.yml` exists which excludes all directories except `master`. You can include it in your builds as follows `jekyll serve --config _config.yml,_config_dev.yml`. Alternatively, you can pass enable it in `make` using the following environment variable `DEV=true make serve`.

### Previewing the changes from CI/CD

The Project Calico CI/CD system will generate a site preview automatically with every docs change. An automated response to the PR will indicate "Deploy preview for calico ready!" and provide a link to the preview. If your change is minor and you are not a regular contributor to the project, this method may be easier than building the doc site locally.

**Note** To view the changes you've made to the master branch, select **nightly** from the **Releases** page.

## Checking for broken links

> **Prerequisite**: [Docker](https://docs.docker.com/engine/installation/).

To check for broken links, navigate into the root of the repo and issue the following command from a terminal prompt.

```
make htmlproofer
```

The submission of a PR kicks off a continuous integration process which includes a `make htmlproofer` command. Any errors from `htmlproofer` will cause your PR to fail the continuous integration test, so it's best to run this locally before submitting your PR.

However, you can also run this after submitting your PR and experiencing an `htmlproofer` failure from the Semaphore job.

## How to quickly apply changes in master to a previous release

Let's say there's a single commit that makes changes to the `master` directory which I want to apply to the `v1.5` directory.

1. Generate a diff. A sample command follows which stores the diff in a file called `my-patch.diff`.

    ```
    git diff f35c02fe73e6a64d187ee3f6e9298ca47ded91ab^1 f35c02fe73e6a64d187ee3f6e9298ca47ded91ab > my-patch.diff
    ```

1. Apply the diff to the target version directory.

    ```
    git apply -p2 --directory=v1.5 my-patch.diff
    ```

    - `-p2` strips off /master on the front of the paths.
    - `--directory=v1.5` adds "v1.5" to the start of the paths.

1. Inspect the results (`git status`, `git diff`, etc.) and commit.

## Doc site organization

### Overview

The docs (currently) are split into four main sections.

- [Introduction](#introduction)
- [Getting started](#getting-started)
- [Usage](#usage)
- [Reference](#reference)

### Introduction

Landing page for new users covering Calico's purpose and high-level topics.

### Getting started

This should be where new users go. It includes quick-start guides, some basic tutorials to show off Calico's capabilities, and links to more advanced topics once users are comfortable with the basics.

Each orchestrator has a landing page that is targeted at people who are coming to see Calico for the first time. It's a transition from the "marketing" type material (why is Calico great) to some quick commands people can run to see it firsthand, and then funnels people off to the Usage section for more details.

### Usage

This section contains task-based information. All top-level titles in this section should start with a gerund. Each topic should include why you want to perform the task, a goal, and a set of steps you can follow to achieve it.

Examples:

- Configuring BGP peers
- Enabling IP-in-IP in AWS
- Troubleshooting Calico
- Using calicoctl in a Kubernetes deployment
- Configuring egress policy in Kubernetes

Do not include detailed description of components or tabulated
configuration information in this section. This type of content should be located in the [Reference](#reference) section.

### Reference

These docs contain complete reference information for Calico. If there's a configuration option you're looking for, it goes here in one of the per-component references. Not every option has a "how to" guide, but has enough description. The caveats and considerations when enabling options should be listed here.

Examples:

- Fully tabulated configuration options per-component
- `calicoctl` help text
- Calico API schema reference (policy, ip pool, etcd)

## Organizational changes

### Creating new pages

- To create a top level splash page for a URL path, simply name the file `index.md`.

- [Add the new page to the side navigation bar](#linking-content).

- Within the copies of the page in the `master` and previous release directories, add a `canonical_url` line below the `title` line in the metadata of the page. This should contain the absolute path to the page in the current latest directory. Example: `canonical_url: 'https://docs.projectcalico.org/v3.0/getting-started/kubernetes/'`. For more discussion of canonical URLs, refer to the [Canonical URLs](#canonical-urls) section.

### Deleting or renaming pages

If you need to delete or rename a directory or file:

- Ensure that you [adjust the side navigation bar to match](#side-navigation-bar).

- Update any `canonical_url` paths that reference the deleted or renamed page. The `canonical_url` metadata of all previous instances of the page may reference the deleted or renamed page. You must correct these pages to reference the final instance of the page. When you submit your PR, `htmlproofer` will flag these errors.

    - _Deletion example_: If you delete a page from the `master` and `v3.0` directories, you must update the `canonical_url` path of the page in the `v2.6` directory to point to itself. You would also need to update the `canonical_url` paths of any previous instances of the page to point to the copy in the `v2.6` directory. This final copy becomes the new canonical copy.

    - _Renaming example_: If you rename a page from the `master` and `v3.0` directories, you must update the `canonical_url` path of the page in the `v2.6` directory to point to the new path. Also correct any copies in previous directories.

    - For more discussion of canonical URLs, refer to the [Canonical URLs](#canonical-urls) section.

### Side navigation bar

The naming and layout of the side navigation bar is stored in `_data/$VERSION/navbars/*`. Jekyll automatically stores information from the `_data` directory in an accessible variable called `site.data`. The top-level layout (`_layout/docwithnav.html`) will iterate through all the files in `site.data[version].navbars` to construct the sidebar based on which version is being viewed.

> **Note**: Sidebar paths to index files (see [next section](#linking-content)) should end in a `/` in the yaml file. Sidebar paths to actual files should not end in a `/` in the yaml file.

## Link syntax

### Closing slashes

To link to a page not named `index.md`, omit the closing slash. To link to a page named `index.md`, include a closing slash. See the following table for some examples.

| URL                                           | File path                                         |
|-----------------------------------------------|---------------------------------------------------|
| `/getting-started/kubernetes/`                | `/getting-started/kubernetes/index.md`            |
| `/getting-started/kubernetes/troubleshooting` | `/getting-started/kubernetes/troubleshooting.md`  |

### `site.url`, `site.baseurl`, and `absolute_url`

**`site.baseurl`**

To create clickable links to other doc site content, use links prefixed with: `{{ site.baseurl }}`. For example:

```
[Get started]({{ site.baseurl }}/getting-started/)
```

Will render as:

```
<a href="/v3.8/getting-started/">Getting started</a>
```

**`absolute_url`**

The `absolute_url` filter must be used whenever you are not creating a clickable `<a href='...'>` element, but instead are showing the user a URL to copy locally. A common example is downloading manifests or showing a user how to `kubectl apply -f https://...` them.

For absolute links, use `{{ "/path" | absolute_url }}`. For example:

```
kubectl apply -f `{{ "/manifests/calicoctl.yaml" | absolute_url }}`
```

Will render as:

```
kubectl apply -f `https://docs.tigera.io/v3.8/manifests/calicoctl.yaml`
```

**`site.url`**

This renders as the top-level site authority string, without any version prefixes.  Use this when you are showing the user a URL to copy, but want to specify the path portion verbatim, without Jekyll adding any page version information.  For example, if you need to link to a hard-coded version of a page:

```
kubectl apply -f `{{site.url}}/v3.4/manifests/calicoctl.yaml`
```

Will render as:

```
kubectl apply -f `https://docs.tigera.io/v3.4/manifests/calicoctl.yaml`
```

### Case sensitivity

Do not include any uppercase letters in your links.

### Anchor links

An anchor link for each heading is automatically created. It consists of the title of the heading with each word separated by hyphens. Delete any slashes in the title. For example, to reference a heading titled "Working with the calico/kube-controllers container" on a page located at `https://docs.projectcalico.org/v3.0/reference/kube-controllers/configuration`, you would use the following:

```
/{{page.version}}/reference/kube-controllers/configuration#working-with-the-calicokube-controllers-container
```

## Canonical URLs

Because the documentation site includes content for past versions as well as the latest version, it contains many duplicate pages. When Google indexes the site, it needs to know which copy we prefer. We use [jekyll-seo-tag](https://github.com/jekyll/jekyll-seo-tag) to add [canonical URLs](https://support.google.com/webmasters/answer/139066?hl=en) to each page. This helps us to ensure that the latest copy of the page comes up first when people search for information via Google.

Each page should include a `canonical_url` tag that contains the absolute path to the latest copy of the page, even if the latest copy is the page itself.

You should _not_ need to modify the `canonical_url` metadata unless you are adding, deleting, or renaming a page.

## Code samples

Our site adds a copy button to each code block by default. To ensure that readers can copy and paste the code successfully, follow the [Code samples](https://github.com/projectcalico/calico/blob/master/DOC_STYLE_GUIDE.md#code-samples) recommendations in the DOC_STYLE_GUIDE.

To modify the default behavior for code samples that should not be copied, such as responses, append `{: .no-select-button}`. An example follows.

```
Successfully created 8 resource(s)
{: .no-select-button}
```

## Releases

See [RELEASING.md](RELEASING.md)

repository: jsabo/calico

repo_name: jsabo/calico


text:
# SimpleCsvCreator

SimpleCsvCreator has DSL to build the csv. It's inspired by activeadmin csv

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'simple_csv_creator'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install csv_creator

## Usage

SimpleCsvCreator has DSL to build the csv
it's inspired by activeadmin csv
example:

```ruby
class User
  attr_reader :name, :age, :gender
  def initialize(name, age, gender)
    @name = name
    @age = age
    @gender = gender
  end
end

user1 = User.new('test', 20, 'female')
user2 = User.new('mobile', 13, 'male')
csv_creator = SimpleCsvCreator.schema do
  column(:name) # if without block then it will run the name given(user.name), header name will be titleize of name
  column(:age) { |r| r.age + ' years' } # if with block will run the block
  column('User Gender') { |r| r.gender } # if want to use custom title need to give the block
end
result = SimpleCsvCreator.simple_generate([user1, user2])
csv_parse = CSV.parse(result)
csv_parse:
[
  ['Name', 'Age', 'User Gender'],
  ['test', '20 years', 'female'],
  ['mobile', '13 years', 'male']
]
```

Sometimes you want to do lazy fetch e.g: `find_each` method in ActiveRecord.
If you use simple_generate you won't be able to use this kind of method because simple_generate
need the array with all of its elements. To handle it you can use `generate_using` method

e.g:
```ruby
generator = Proc.new do |&block|
  resources.each do |resource|
    block.call(resource)
  end
end
result = SimpleCsvCreator.generate_using(generator)
end
```

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/csv_creator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.

## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).


text:
# Release Notes February 2020 (20.2)

## Editor

* Improved asset transform performance.
* Added support for 'template asset documents'.

## Runtime

* GameObjects now have an 'enabled' state that affects the entire sub-tree.

## Scripting

* *Finished a new scripting system that uses TypeScript as the scripting language.

## Samples

* The 'Testing Chambers' project now demonstrates the new scripting system with various features. See the 'Corridor' scene.

## Components

* Added a BeamComponent for laser effects.
* Added a RaycastComponent to move an object to the closest hit surface. Works well with the BeamComponent.

## See Also

* [Back to Index](../index.md)
* [Releases](releases.md)

repository: Ingrater/docs

repo_name: Ingrater/docs


text:
# rx-ios-initial-project
Second generation of iOS Initial Project - Project with lots of pre-installed libraries and frameworks for fast and simple project-up.

# Features
There are five categories of features in this project:
- managers;
- helpers;
- extensions;
- superclass for all view controllers with built-in funtions;
- other third-party libraries.

# Preinstalled managers
1. `APIManager` is ready to use API-manager (uses `RxAlamofire` framework).
2. `TokenManager` is ready to use manager for application's OAuth authorization.
3. `PushManager` is ready to use push notifications manager.

# Helpers
1. `DateTimeFormatter` is class for converting dates and times from `Date` object to `String` (for output) or `String` to `Date` for input.
2. `ProgressLoader` is class for showing loading indicators while some continues actions are running (i.e. network queries). It uses `SVProgressHUD` framework.
3. `Alerter` is powerfull popup generator system. It uses `BulletinBoard` framework for displaying interactive messages with actions instead of system `UIAlertController`. Popups are made according to new iOS 11 guidelines and looks like AirPods connection card.
4. `TapticEngine` class is made for awesome haptic feedback in response to some user's actions. It uses TapticEngine on iPhones 6s and higher. It works greate with `Alerter`.

# Extensions
What is Extension? It's addition to existing Swift classes, that allows to do more with system classes. Here is our extensions list with our additions:

1. `NSLayoutConstraint` extension allows to set constraint's multiplier programatically. By default, it can be changes in InterfaceBuilder only.
2. `NumberExtension` gives abbility to round float values to needed characters number after coma.
3. `StringExtension` implements lots of additions:
    - `localized` - returnes localized string value. Just call `myString.localized` instead of `NSLocalizedString(myString, tableName: tableName, bundle: Bundle.main, value: value, comment: comment)`;
    - `trimmed` - removes whitespaces from string. Just call `myString.trimmed` instead of `myString.trimmingCharacters(in: .whitespaces)`;
    - `substring` - cuts string to needed range;
    - `urlencoded` - returns url-encoded string. Just call `myString.urlencoded` instead of `myString.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)`;
    - `withoutHTMLTags` - removes all HTML-tags from string. Just call `myString.withoutHTMLTags` instead of `myString.replacingOccurrences(of: "<[^>]+>", with: "", options: .regularExpression, range: nil)`;
    - `getAttributedStringFromHTML` - function that allows to convert html-string to attributed string for displaying with needed attributes.
    - `+` allows easily concatanate to string or attributed strings. Just call `output = string1 + string2`;
    - `setAsLink` function sets as clickable link needed part of attribute string.
4. `UIColorExtension` brings support for next features:
    - initizlize color from hex-string;
    - create an image which is filled bu needed color.
5. `UIImageExtension` allows to do next things:
    - `rounded` allows easily create round image from regular. Just call `myImage.rounded`;
    - `imageWithCorrectOrientation` fixes invalid orientation in images which are made with system camera;
    - `imageWithColor` filles non-filled parts of image with selected color.
6. `UIImageViewExtension` brings nexr cool features:
    - loading image from web and save it to cache, displaying this image from cache, make image round, display loading progress in just one single line of code: `myImageView.image(from: urlString, withPlaceholder: placeholderImage, isRounded: true, progressHandler: { // display progress if needed })`. Without this extension we have to write about 30 lines of code to make this;
    - make imageView round. In some cases we need to show round image, but we also need image in non-round state. With this extension we can make rounded just image container without rounding original image.
    - show and hide activity indicators on imageViews while images are loading from web.
7. `UINavigationControllerExtension` allows to add ability for adding handlers after view controller is pushed or poped.
8. `UITableViewCellExtension` allows to add customized separators to UITableviewCell programaticaly.
9. `UITextFieldExtension` allows to set paddings to text fields.
10. `UIViewExtension` brings ability to customize some view's propertes dircetly from interface builder. They are `cornerRadius` (for making round corners), `borderWidth` and `borderColor`.
11. `UIDeviceExtension` allows to get current device model in readable mode. Needed for actions which are dependent from device model.

# BasicViewController: Superclass for all ViewControllers
All view controllers in app are subclassed from `BasicViewController`. Here is list of properies and functions which are already implemented in BasicViewController (and are available in all subclasses):
1. `ReachabilityManager` item.
2. `BulletinManager` item. Is used for popups.
3. `showAuthScreen` method allows direct navigation to authorization screen.
4. `logout` method erases all user data and calls `showAuthScreen`.
5. `showMainScreen` method navigates to root screen of app.
6. `showErrorScreen` method displays errors' messages. Uses `Alerter`.
7. `handleErrors` method processes all errors in application and shows relevant message to user. Uses `Alerter`.
8. `showApproriateAlert` method is used in form validators. It shows incorrectly filled field and sets focus to this field.
9. `Alerter` methods (all of them use `TapticEngine`):
    - `showSuccess` displays message about succesfully finished task;
    - `showWarning` displays warning message;
    - `showError` displays error message with "Retry" button;
    - `showCustom` displays fully customized popup with custom action handlers;
    - `showConfirm` displays confirm alert popup with two actions "Confirm" and "Cancel";
    - `showInfo` displays information message.
10. `makeTapticFeedback` uses `TapticEngine` and provides haptic feedback. Can use on of three presets:
    - success;
    - warning;
    - error.
11. And now lots of reactive properties, just check them!

As a result, all view controllers that are subclassed from BasicViewController are supporting all these features fully codeless.

# Other third-party libraries and frameworks
All third-party libraries are open-sourced.

In this list there are no frameworks which are used in managers, helpers and extension.
- `DZNEmptyDataSet` allows to setup customizable views to empty lists;
- `Kingfisher` allows to download and cache images with reactive methods;
- `RxCocoa` and `RxSwift`;
- `RxKeyboard` allows to subscribe on keyboard frame changes.

# Requires:
- `cocoapods` preinstalled

If you do not have cocoapods installed, then just run this command in terminal:
```sh
$ sudo gem install cocoapods
```

# How to start making project using AppSample:

 1. Open `rx-ios-initial-project.xcodeproj` in Xcode.
 2. Navigate to project settings.
 3. Change Name in all project's targets to needed.
 4. Change Bundle identifier to `com.new_app_name.ios.app`
 5. Close project.
 6. Open `terminal.app` and navigate to `.xcodeproj` directory

Now you need to init pods project in future workspace. Run this:
```sh
$ pod init
```
Once workspace is initialized, you need to install required pods. Run this:
```sh
$ open Podfile
```
Add next lines to your target section:

```
pod 'RxSwift'
pod 'RxCocoa'
pod 'ReachabilitySwift'
pod 'DZNEmptyDataSet'
pod 'RxKingfisher'
pod 'RxAlamofire'
pod 'KeychainAccess'
pod 'RxKeyboard'
pod 'SVProgressHUD'
pod 'RxGesture'
pod 'JMMaskTextField-Swift'
pod 'BulletinBoard'
```

# Next steps

Close `terminal.app` and open `.xworkspace` file. That's all! Now your app has all needed features for comfortable development. Enjoy :)

repository: attract/rx-ios-initial-project

repo_name: attract/rx-ios-initial-project


text:
---
layout: post
title: My first day of rails
comments: True
---

Hey Guys,

Being an experienced developer, and taking a pretty base level course, I wanted to give some feedback as to how I did in day 1 through day 6 of [One Month Rails](https://onemonth.com/courses/one-month-rails) (Even though I've only actually been doing Rails for about an hour).

##Day 1

So the first day is an intro/overview (totaling 3 minutes) and the much more lengthy installing rails.  Luckily for me, I already  had rails installed, however they did post a great resource called [Install Rails](installrails.com) that I genuinely wish I had when I was installing rails.  The website is intuitive and beautifully designed, they finish with a sanity check which details two ways to check your installations

    ruby -v
    rails -v

Fairly simple stuff in case you were wondering, this is what day 1 curriculum looks like:

As you can see it's a fairly nice website presumably built in rails (it would be funny if the website was built in PHP)

## Day 2

Day 2 was boring me to tears, in day 2 you learn about "the command line".  After spending several minutes teaching us how to open terminal he proceeds to show us the 'pwd', 'ls', and 'cd' commands, all of which I use on a daily basis.  However as with before, were I a complete beginer I would have found his explanation  extremely helpful.  The second and last video was common sense in addition to 100% true.  It was titled: "Debugging" 75% of code is googling.  A 4 minute example of him solving rvm (ruby version manager) errors by going on stack overflow and a Google group, once again quite boring.  It would be nice if some of these sites let you select your skill level to skip some of the basic, generic stuff (kind of like how whenever you learn a new programming language, you have to listen to the lecturer spent half an hour explaining the difference between a 'float' and a 'double').
##Day 3

Day 3 had one video entitled "Creating a new Application", it walked through the basics of creating a ruby project with the command line, and accessing the local server, still a little slow for my pace, but more along the lines of what I like in terms of pace.

##Day 4 and Day 5

I've condensed these because it seemed a little redundant talking about them on Github, these two days go over the basics of setting up git on your local computer, I skipped all of these except a cool form asking me for my Github URL.  It's worth mentioning that for the tutorial one month rails went with terminal over GUI.  This is what I do, but it is a rather strange choice for a "first coding class" website.

Days 2-4 Assignments:

##Day 6

Finally, I start learning what I signed up for, Rails, in this short two video day, I created a home page, and an about page.  Interestingly enough these pages were suffixed with .html.erb  HTML for what it would be rendered to erb to signify the need for rendering.  I also had to rout all these pages to a specific url, vs just folder placement.  This was definitely a different and new experience.  I'm assuming on build it will build folders according to routing instructions.

Note: 'by Today I mean Day x not today as in June 25th'

Days 5-6 Assignments:

A bold look ahead at Day 7 reveals I will be creating dynamic pages.  In a rendered language like Ruby I am wondering how this is done.

Thanks for Reading,

Jake

P.S. Sorry for being a bit above everything, this is just extremely boring

repository: jakesylvestre/blog

repo_name: jakesylvestre/blog


text:
# Restoring vim and neovim sessions

- save vim/neovim sessions. I recommend
  [tpope/vim-obsession](https://github.com/tpope/vim-obsession) (as almost every
  plugin, it works for both vim and neovim).
- in `.tmux.conf`:

        # for vim
        set -g @resurrect-strategy-vim 'session'
        # for neovim
        set -g @resurrect-strategy-nvim 'session'

`tmux-resurrect` will now restore vim and neovim sessions if `Session.vim` file
is present.

> If you're using the vim binary provided by MacVim.app then you'll need to set `@resurrect-processes`, for example:
> ```
> set -g @resurrect-processes '~Vim -> vim'
> ```

repository: tmux-plugins/tmux-resurrect

gha_language: Shell

repo_name: tmux-plugins/tmux-resurrect


text:
The relentless march of progress"_ - **[@jons520](https://twitter.com/jons520/status/611668022902697984)**

> _"lol straight to twitter, your followers probably hate you"_ - **[ChrisK2](https://github.com/ChrisK2)**

> _"you're creating a monster"_ - **Cidoku**

### Features

- Text adding
- Multi-screenshot drifting
- Annie-May hashtag retrieving

## Usage

Create your config using the `get_keys` binary. A browser window will open and you'll get a code after clicking Authorize. Write the code into the terminal and a file called `mpv-livetweet.conf` will be created.

Create a folder called `script-opts` in your mpv config folder (the one containing `mpv.conf`) and move the `mpv-livetweet.conf` file into it.

Copy the `twitter` binary somewhere and copy its path.

Open `mpv-livetweet.conf` and configure the path to `curl` and to the `twitter` binary.

```
# On Windows 10 curl_path is C:\Windows\SysWOW64\curl.exe
curl_path=/path/to/curl
twitter_path=/path/to/twitter/binary
```

Copy `mpv-livetweet.lua` to the `scripts` folder in your mpv config folder.

Download [`user-input.lua`](https://raw.githubusercontent.com/CogentRedTester/mpv-user-input/master/user-input.lua) and save it to the `scripts` folder in your mpv config folder.

The script tries to fetch the hashtag of the anime you're currently watching with the AniList API and appends it to the tweet text. If you don't want it to be fetched, set the `fetch_hashtag` option to `no` in the config file.

```
fetch_hashtag=no
```

By default the script sends tweets as a reply to the last tweet it sent during the same session. You can clear the last tweet ID by exiting the player, using the keybind, or you can disable this functionality by setting the `as_reply` option to `no` in the config file.

```
as_reply=no
```

## Commands

| Shortcut  | When queue is empty            | With screenshots in queue |
| --------- | ------------------------------ | ------------------------- |
| **Alt+s** | Queue a screenshot             | Queue a screenshot        |
| **Alt+t** | Take a screenshot and tweet it | Tweet queued screenshots  |
| **Alt+c** | -                              | Delete queued screenshots |
| **Alt+x** | Clear the last tweet ID        | Clear the last tweet ID   |

The keybinds can be changed in the config file.

```
keybind_queue_screenshot=Alt+s
keybind_tweet=Alt+t
keybind_cancel=Alt+c
keybind_clear_reply=Alt+x
```

To increase the font size of the tweet input (which is really tiny by default), create a file called `user-input.conf` in the `script-opts` folder and set the `font_size` option to your preferred size. The default is `16`.

```
font_size=24
```

### From source

Acquire a consumer API key and secret from a twitter app, either from an existing one or by creating your own on https://developer.twitter.com/en/apps.

Compile the `twitter` and `get_keys` crates with Rust with the CONSUMER_KEY and CONSUMER_SECRET env variables set to the tokens you acquired.

```
CONSUMER_KEY=foo CONSUMER_SECRET=bar cargo build --release
```

Or on Powershell:

```
$ENV:CONSUMER_KEY="foo"; $ENV:CONSUMER_SECRET="bar"; cargo build --release
```

---

Excessive use of the script might cause butthurt and follower loss. Use responsibly and in small doses.

repository: steinuil/mpv-livetweet

repo_name: steinuil/mpv-livetweet