teleren/devto huggingface dataset:
How to send logs Cloudflare to AWS Firehose
Tags: aws, firehose, cloudflare, log
Published: 2020-03-12 19:53:29

Few weeks ago I'm thinking about using Cloudflare but I need detailed access logs. Cloudflare provide access logs for enterprise customers. Maybe I'll be one not yet. So I look for a solution get logs. 
At the same time I will be using Cloudflare workers for another reason and I realized that I can user workers for both purpose.
In this article I'll tell you about workers code I wrote.

> **Source Repo!** You can find fully functional sample built with JS of this post at GitHub repository [Cloudflare Logs to AWS Firehose](https://github.com/irensaltali/.NET-Core-AWS-Lambda-Multiple-Function-in-Single-Project) 

It was hard to write. So here's the code. Maybe I finish later. Don't worry code is working.
🔛Review 3: Portfolio and AirShare Project, Developer: Rajitha | #elefDoesCode
Tags: review, code, design, freecodecamp
Published: 2020-03-12 19:34:22

⬇️I will review your... 

🤓The process:
1. Every week I will do a live stream on my youtube channel reviewing your site
2. I will give feedback and suggestions according to your needs. 
3. If I have a way to contact you, I'll gladly do so :)
4. If you have any question don't hesitate to contact me!

Take part [here](https://forms.gle/9AxiCUQ8YudTVYzs9) (I only need a URL and your name).

It doesn't matter if you are a beginner or more advanced. 
You can submit as many sites as you want.

🙏Thank you for taking part with your website into my live streams.
It takes courage to let someone you don't know to review your work...
But remember feedback is important and all of us need it...
 
🤗The review is FREE. You don't pay for anything. I won't be paid by anyone.

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

In particular, in this video you'll find:

🤓The developer: Rajitha Gunathilake | https://twitter.com/RiZkY_Rajitha
💪The project:  https://rizkyrajitha.me/ and   https://airsharebetav2.herokuapp.com

⌨Previously 
- review 1 [here](https://dev.to/eleftheriabatsou/review-1-tribute-page-by-freecodecamp-developer-kyle-elefdoescode-4006)
- review 2 [here](https://dev.to/eleftheriabatsou/review-2-personal-portfolio-developer-diego-elefdoescode-4g36)

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

👋Hello, I' m Eleftheria, an app developer, master student, freelancer, public speaker, and chocolate lover.


😎Top 3 list:
- How to stay motivated | A developer's edition | @BatsouElef: https://youtu.be/qMvEtb5OxNo
- How to be a Better Problem Solver | Tips and solutions: https://youtu.be/dELt7yKIxIA
- Simple Tips to Build a Personal Brand as a Developer (+ personal examples): https://youtu.be/7s0o1gi0iP0

🥰If you liked this video please share

🍩Would you care about buying me a coffee? You can do it here: [paypal.me/eleftheriabatsou](paypal.me/eleftheriabatsou) but If you can't that's ok too!


**************************************

🙏It would be nice to subscribe to my [Youtube](https://www.youtube.com/c/EleftheriaBatsou) channel. It’s free and it helps to create more content.

🌈[Youtube](https://www.youtube.com/c/EleftheriaBatsou) | [Codepen](https://codepen.io/EleftheriaBatsou) | [GitHub](https://github.com/EleftheriaBatsou) | [Twitter](https://twitter.com/BatsouElef) | [Site](http://eleftheriabatsou.com/) | [Instagram](https://www.instagram.com/eleftheriabatsou/)
Quebra de linha em texto longo no Flutter
Published: 2020-03-12 19:29:56

Aprenda como fazer quebra de linha em texto longo no Flutter.
```
final String someText = 
"stuff for the 1st paragraph\n\n"
"stuff for the 2nd paragraph\n\n"
"stuff for the 3rd paragraph\n\n";
```
ou então você pode simplesmente renderizá-lo dentro de um Textwidget como normalmente faria.

Fonte: https://stackoverflow.com/questions/51733023/line-breaks-in-long-text-flutter
[A boring title]
Tags: tutorial, jokes, writing
Published: 2020-03-12 19:15:06

Here, I subtly introduce you to the topic at hand, and grab your attention. I may use fantastic words and extravagant linguistics, or I can just be really boring and stuff. That's called an **introduction**. Use it.

Now, I start to get into the *nitty-gritty* of the article. I may include some cool things like `{% liquid:tags %}` or `code blocks`.

```js
document.before('codeBlock', () => {
  do("explain with words");
})
```

Now, I write another paragraph. Write at least two **body** paragraphs, with at least three sentences each. Use proper grammar, ~~ppl~~ people!

Lastly, I leave you with a thought which will remind you of what I've written. It's called a **conclusion**, and it's like a party favor or gift. It leaves the reader with a good impression. Think of it as a nice way of saying, *goodbye*.
Tech against Coronavirus
Tags: productivity, leadership, beginners, watercooler
Published: 2020-03-12 18:27:12

Hello guys,

I just wanted to share with you a list of tools that i believe will help in case you are forced to work remotely and this took you by surprise

In my city we just started testing the working from home process and i found this list very helpful summarizing some apps you might need


The list is [here](https://techagainstcoronavirus.com/?fbclid=IwAR1MGsOxfVTALEJIVka7KHKmbgrJWc_92reJXH6cp7wjUUlShvJMMUxKTXU)
Released Gem: save the request with curl
Tags: rails, ruby
Published: 2020-03-12 17:03:00

## Need

When I need to maintain an application whose specification is unknown, or when the conditions for reporting bugs are inadequate, I want more information about the request.


I'm very happy with the curl command.

## Usage

Add this line to your application's Gemfile:

```
gem 'recurl'
```

in Rails app:

```ruby
Recurl.configure do |config|
  config.logger = Logger.new(STDOUT)
end
```

That's all.

Example output:

```
I, [2020-03-12T23:12:35.416211 #30019]  INFO -- : curl -X GET  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36'  -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'  -H 'Cookie: key=value'  'http://localhost:3000/'
```

## Links

If you want to check out the code, it's on Github [here](https://github.com/zaru/recurl).

To download the Gem, [it's over here !](https://rubygems.org/gems/recurl)

Thanks a lot for reading !
#Day1 of my "100daysofcode" challenge
Tags: 100daysofcode, react, mongodb
Published: 2020-03-12 18:42:41

Day 1 of my "100daysofcode" challenge.

Hi, I hope everyone is doing great.

Just a quick update on my first day. Everything went great, the day was very productive, But I ended up spending a lot of time setting up things for programming.

I Spent 2 hours on learning and 1.5 hours on the actual programming. I decided to clone Instagram as a side project so that I could improve my skills in React.

These are the topics that I've completed learning today (Sounds basic)

On React Native

- Flexbox
- Use State hook
- Basic overview of components and how to use them

On MongoDB

- Setting up schema
- Relational data and population with Mongoose
- How to use methods and statics in Mongoose

I think this is probably the best decision that I've ever made with my career. Because after starting this challenge I find a lot of time to code and learn. I usually find excuses to skip something.
Adding cross-account access to EKS 
Tags: eks, iam, aws, kubernetes
Published: 2020-03-12 18:42:08

# introduction
When you want your users in IAM to access EKS cluster in another account, its very simple to do via cross account role. 
This assumes you have already created the role in account B to users in account A. 

# steps to access EKS in second account 

1. first make sure you have a IAM role `cross-account-role` created in Account B and having added trusted relationship for users in
that you would like to from account A to access it.
2. Once thats done , make sure you have access to the EKS cluster in account B(this needs to be done in order to edit the permissions of EKS). 
3. now edit the `aws-auth` configmap of that EKS cluster as:
    ```
    kubectl edit -n kube-system configmaps aws-auth
    ```
4. add following lines under `mapRoles` to add the `role` created in step#1:
    ```
    - "groups":
      - "system:masters"
      - "system:nodes"
      "rolearn": "arn:aws:iam::Account B:role/cross-account-role"
    ```
5. try setting the new `cross-account` for account B in `~/.aws/credentials` :
    ```
    [account-B]
    role_arn = arn:aws:iam::Account B:role/cross-accountrole
    region = us-west-2
    source_profile = account-A
    ```
6. export this profile on terminal and add the EKS cluster config :
    ```
    export AWS_PROFILE=account-B
    aws eks update-kubeconfig --name name-of-eks-cluster-in-account-B
    ```
7. try running kubectl now:
    ```
    kubectl get ns
    kubectl get pods
    ```
Latitude and Longitude with Google Maps
Published: 2020-05-07 23:50:58

---
title: Latitude and Longitude with Google Maps
published: true
date: 2020-03-12 18:33:42 UTC
tags: 
canonical_url: https://dcblog.dev/latitude-and-longitude-with-google-maps
---

Google Maps allows using its service to get map coordinates:

For instance, In your HTML, two fields to store the latitude and longitude 

```php
<input id="latitude" type="text" name="latitude" value="">
<input id="longitude" type="text" name="longitude" value="">
```

When a postcode is entered use Google Maps to update the latitude and longitude:

```php
<input id="postcode" type="text" name="postcode" value="">
```

The JS code, note the <?=$apiKey;?> should contain your Google Maps API key.

```php
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=<?=$apiKey;?>"></script>
<script type="text/javascript">
    $(document).on('change', '#postcode', function (e) {
        var geocoder = new google.maps.Geocoder();
        var address = this.value;
        geocoder.geocode({ 'address': address }, function (results, status) {
            if (status == google.maps.GeocoderStatus.OK) {
                var latitude = results[0].geometry.location.lat();
                var longitude = results[0].geometry.location.lng();

                //set the value of input elements with an id of latitude and longitude
                document.getElementById("latitude").value = latitude;
                document.getElementById("longitude").value = longitude;
            } 
        });
    });
</script>
```
Sources for business docs? - Policies, Proposals & SLAs
Tags: career, discuss
Published: 2020-03-12 18:26:22

##Q: For those running their own business, how did you source your first business docs?

###*Context:*

So I'm about 6 months into freelancing/small business and still very much running everything on my own, without much prior business management experience.

I'm struggling to know how to put essential business documents together in a professional way for day-to-day use.

Up until now, I've been using random online templates or putting agreement details in emails. But now, a client who's considering using me for web hosting needs a Service Level Agreement around response times, uptimes, etc. and I want something a) robust and b) that I can reuse and update over time.

There's also the question of technology, and whether these things should be signed digitally, or whether a simple email confirmation will do.

If you have any stories around where your fist documentation came from and any lessons you've learned, I'd love to hear it. I'm thinking about:

- Project Proposals
- Service Level Agreements
- Subcontractor Agreements
- Non-Disclosures
- etc.
Investigating the TMDB movie dataset, part 2
Tags: python
Published: 2020-03-12 18:23:26

This blog post is the second part of a whole series. I would recommend you read the [first part](https://dev.to/nkpremices/investigating-the-tmdb-movie-dataset-6co) if you want to understand this one.

In this blog post, I am going to talk about data cleaning. we are going to use the results that we got in the first part and build from there.

# Data Cleaning

##### Step 1. Remove some columns with a lot of null values.

> ```df.drop(['imdb_id', 'homepage', 'tagline', 'overview', 'budget_adj', 'revenue_adj'], axis=1, inplace=True)
df.head(1)```

![img](https://res.cloudinary.com/premices/image/upload/v1583942632/Screen_Shot_2020-03-11_at_18.03.05_czezk0.png)

##### Step 2. Remove duplicated data

> `df.drop_duplicates(inplace=True)`

##### Step 3. Remove all null values in the columns that have null values

> ```df.dropna(subset = ['cast', 'director', 'genres'], how='any', inplace=True)```

Let's check if there are still null values

> `df.isnull().sum()`

![img](https://res.cloudinary.com/premices/image/upload/v1583940342/Screen_Shot_2020-03-11_at_17.19.32_ei0xld.png)

##### Step 4. Replace zero values with null values in the budget and revenue column.

> ```df['budget'] = df['budget'].replace(0, np.NaN)
   df['revenue'] = df['revenue'].replace(0, np.NaN)
   df.info()```

![img](https://res.cloudinary.com/premices/image/upload/v1583940343/Screen_Shot_2020-03-11_at_17.19.42_jinvxt.png)

##### Step 5. Drop the runtime column.

> ```df.query('runtime != 0', inplace=True)
df.query('runtime == 0')```

![img](https://res.cloudinary.com/premices/image/upload/v1583940342/Screen_Shot_2020-03-11_at_17.19.57_wqlokv.png)

> `df.info()`

![img](https://res.cloudinary.com/premices/image/upload/v1583940343/Screen_Shot_2020-03-11_at_17.20.04_tfcs5d.png)

> `df.describe()`


![img](https://res.cloudinary.com/premices/image/upload/v1583943336/Screen_Shot_2020-03-11_at_18.15.18_vstnox.png)


From the table above, we can see that replacing the zeros by null values in the budget and revenue distribution made them look better. We can also see that the minimum makes now more sense

____

This is the end of the second part. If you got some good time reading, stay tuned. I will post the third part soon. 

thank you for reading.
Celery In A Shiv App - Building SaaS #31
Tags: python, django, saas
Published: 2020-03-12 18:05:21

{% youtube Gt-x9necwI4 %}

In this episode, we baked the Celery worker and beat scheduler tool into the Shiv app.  This is one more step on the path to simplifying the set of tools on the production server.

I started the stream by reviewing the refactoring that I did to `conductor/main.py`.  The main file is used to dispatch to different tools with the Shiv bundle.

The refactored version can pass control to Gunicorn, the Django management tools, or Celery.

To make Celery work, we hooked [`worker_main`](https://celery.readthedocs.io/en/latest/reference/celery.html#celery.Celery.worker_main) to the Celery dispatch function.

Once `worker_main` was set, I generated a new local Shiv app to test things out.  Since testing could require building the app multiple times, we took a detour to make the `package.sh` easier to use locally.

Before we started, the packaging script only worked in Continuous Integration.  I modified some paths to look somewhere only when CI runs.  Remembering how to do Bash `if` statements is surprisingly difficult for me.

```bash
if [ -n "${CI}" ]; then
    VENV=venv/bin/
fi
```

To create a new version of the package to test, we ran:

```bash
$ rm -f conductor-abcd.pyz && CIRCLE_SHA1=abcd package.sh
```

By chaining the commands together, it's very fast to fetch that command from history and run all the steps in a single line.

With our testable package available, we started Celery with a variety of options.  When I finished, we settled on an invocation that looked like:

```bash
$ /srv/apps/conductor.pyz celery \
    --loglevel INFO \
    --concurrency 2 \
    --beat \
    --schedule /tmp/celerybeat-schedule \
    --pidfile /tmp/celerybeat.pid
```

This set of options lets us run a Celery worker along with the beat scheduler tool.

To finish the GitHub issue, we deployed this to staging and checked on the processes.  We looked at the Celery processes with:

```bash
$ ps -ef | grep celery
```

From that output, I explained how process identifiers (PIDs) and parent process identifiers (PPIDs) work, and I covered how Celery creates multiple processes to increase concurrency.

Next time, we need to do a similar process with the Python-based Postgres backup tool, wal-e.  We'll call wal-e from the Shiv app to eliminate the last usage of the installed virtual environment.


Show notes for this stream are at [Episode 31 Show Notes](https://www.mattlayman.com/building-saas/celery-in-shiv/).

To learn more about the stream, please check out [Building SaaS with Python and Django](https://www.mattlayman.com/building-saas/).
How to use toggle outside of class component render and toggle inside variable reactjs?
Tags: react, javascript
Published: 2020-03-12 17:52:53

How to use toggle outside of class component render and toggle inside variable?
 I want to use toggle inside const variable but I am too confused about how I can override this one.
I set an input text when I enter the text I need the toggle after enter the text input 
Below the code:




```

import React, { Component } from 'react'

class App extends Component {
  constructor(props) {
    super(props)

    this.state = {
         mytoggle : false,
         p: ''
    }
  }

  myKey = (e)=> {
    let p = <div>

      <button onClick={()=> this.setState({mytoggle: !this.state.mytoggle})}> Click Me </button>
      {this.state.mytoggle ? <p>
    Lorem ipsum dolor sit amet.
  </p> : null}
    </div>

    if(e.key === "Enter") {
      this.setState(prev=> ({
        p: [...prev.p, p]
      }))
    }
  }
  render() {
    return (
      <div>
        <input onKeyPress={this.myKey} type="text"/>
        {this.state.p}
      </div>
    )
  }
}

export default App

```
New React Native guide to testing
Tags: reactnative, testing
Published: 2020-03-12 17:52:02

---
title: New React Native guide to testing
published: true
description: I worked with Vojtech Novak to illustrate his guide to testing for new React Native devs. This makes a great intro, regardless of your tech stack!
tags: react native, testing
---

Check it out: https://reactnative.dev/docs/next/testing

Authored by the React Native community's very own Vojtech Novak! This official React Native guide was written keeping in mind learners for whom React Native is their first introduction to programming as well as experienced React Native developers. It makes recommendations for which React Native community projects to use in which situations and features Jest examples.

(I'd love to see a "testing recipes" section featuring Jest one day. If you know anyone who'd like to help write that, let me know!)

![](https://dev-to-uploads.s3.amazonaws.com/i/his3py6zaf4ityrwhhhy.png)
รัน OCI Container ด้วย runc
Tags: oci, container, runc
Published: 2020-03-12 17:22:09

---
title: รัน OCI Container ด้วย runc
published: true
description: 
tags: oci,container,runc
---

`runc` เป็น command line interface (CLI) ที่เอาไว้รัน container ที่เป็นไปตาม spec ของ OCI ซึ่งใน CentOS 8 มีติดตั้งมาให้เรียบร้อย (น่าจะเพราะว่า `podman` ใช้) 

ในตัวอย่างนี้ เราจะเอา Docker container มาทำให้อยู่ในรุปแบบ OCI format จากนั้นก็ run container ตัวใหม่เราได้เลย ซึ่งในตัวอย่างนี้จะใช้ podman แทน docker นะครับ

```
mkdir my-container
cd my-container

#rootfs จะเป็น os / ของ container
mkdir rootfs

# สร้าง docker container และ export container ไปไว้ใน rootfs
podman  export $(podman create ubuntu) | tar -C rootfs -xf -

#สร้าง OCI config file
runc spec

```
เมื่อ `runc spec` จะได้ไฟล์ config.json ซึ่งเราสามารถแก้ไขตามต้องการได้ ในตัวอย่างนี้ผมแก้จาก container เดิมที่ start shell เป็นพิมพ์ os-release ออกมา โดยแก้ดังนี้

```json
 "args": [
                        "cat","/etc/os-release"
          ],
```

เมื่อแก้เสร็จก็พร้อมรันได้เลย

```
sudo runc run my-ubuntu
```
โดย my-ubuntu เป็นชื่อของ container 
ได้ผลลัพธ์ดังนี้
```
NAME="Ubuntu"
VERSION="18.04.4 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.4 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bioni
```

เพิ่มเติม
https://github.com/opencontainers/runc
Real time pixelazation video cam app
Tags: webassembly
Published: 2020-03-12 17:19:13

App is here!
https://pixelated-video.zaru.dev/

![dotmovie2](https://user-images.githubusercontent.com/235650/76547211-29791e00-64d0-11ea-911d-e8c97059c8af.gif)

## Links

If you want to check out the code, it's on Github [here](https://github.com/zaru/go-wasm-pixelate).
Focussing on essentials and asking why
Tags: focus, determination, thinking, essentials
Published: 2020-03-12 17:11:18

---
title: Focussing on essentials and asking why
published: true
description: Why I like to step back and ask 'why' at frequent intervals!
tags: focus, determination, thinking, essentials
---

Why I like to step back and ask 'why' at frequent intervals!
A better way to place your Cage
Tags: react, javascript, nicolascage, hooks
Published: 2020-03-12 16:53:23

I'm sure you find yourself way too often copying and pasting your placecage image url from [placecage.com](https://www.placecage.com/) - think about all that wasted time.

Well now there's a better way, with this `usePlaceCage` hook.

Github: [github.com/colbyfayock/use-placecage](https://github.com/colbyfayock/use-placecage)
npm: [npmjs.com/package/use-placecage](https://www.npmjs.com/package/use-placecage)
Demo: [use-placecage.now.sh](https://use-placecage.now.sh/)


### Want to add Nick?
```
const nick = usePlaceCage(400, 300);
// You got Nic
// https://www.placecage.com/400/300
```

### Want to add multiple Nicks?
```
const nick = usePlaceCage({
  width: 300,
  height: 300,
  count: 5
});
// You got 5 Nics
// ["https://www.placecage.com/300/300", "https://www.placecage.com/300/300", "https://www.placecage.com/300/300", "https://www.placecage.com/300/300", "https://www.placecage.com/300/300"]
```

### Want to get weird?
```
usePlaceCage([
  {
    width: 100,
    height: 200,
    count: 1
  },
  {
    width: 110,
    height: 200,
    count: 1
  },
  {
    width: 120,
    height: 200,
    count: 1
  },
  {
    width: 130,
    height: 200,
    count: 1
  },
  {
    width: 140,
    height: 200,
    count: 1
  },
  {
    width: 150,
    height: 200,
    count: 1
  }
])
// You do you, but you got Nic
// [
//   ["https://www.placecage.com/100/200"],
//   ["https://www.placecage.com/110/200"],
//   ["https://www.placecage.com/120/200"],
//   ["https://www.placecage.com/130/200"],
//   ["https://www.placecage.com/140/200"],
//   ["https://www.placecage.com/150/200"]
// ]
```

Enjoy! 🥳

https://github.com/colbyfayock/use-placecage

Get more content straight your inbox!
-------------------------------------
* 🐦 [Follow me on Twitter](https://twitter.com/colbyfayock)
* 📹 [Subscribe to my Youtube Channel](https://youtube.com/colbyfayock)
* 🗞️ [Sign up for my Newsletter](https://www.colbyfayock.com/newsletter/)