teleren/devto huggingface dataset:
📽 Presentador: Build a presentation by writing Markdown
Tags: opensource
Published: 2020-12-13 17:00:13

More often than not, when I'm creating a presentation, I find myself being distracted on each slide by the looks of it and start editing and altering the fonts and colors and sizes.

All I want is to write a presentation and make my points. That's why I built [Presentador](https://www.presentador.dev).


📽 With Presentador, you write your presentation in Markdown files and it will produce a beautiful website. No code or configuration required.

It's easy! Let me show you how:

## Write your presentation

Create a folder and start writing your presentation in Markdown files. Create one file for each slide and name them after the order you want them to take, e.g. `1.md`, `2.md`, etc.

Use regular Markdown. Presentador will parse each slide and assign a predefined layout to each of them based on the elements in them. 

**If you find a combination of elements that could be presented differently, [please open an issue](https://github.com/kbariotis/presentador/issues). 👍**

## Build your presentation

Run:

`> npx presentador build -d FOLDER_NAME`

and Presentador will produce a website ready to be hosted anywhere you want. 

**While developing your presentation, run `npx presentador serve -d FOLDER_NAME` for instant changes while you're editing it.**

That's it!

Head over to https://www.presentador.dev to see it in action. 🙂

Let me know what you think, I really need your feedback to make Presentador better.

Also, Presentador is open source. Let's build it together. 🤝
Friendly reminder: String.replaceAll is only supported on 83.7% of devices
Tags: webdev, javascript
Published: 2020-12-13 16:35:26

I just found out after one of my friends couldn't access my NextJS web app. Finished my free trial of [BrowserStack](https://www.browserstack.com/) on it.

[Can I Use replaceAll ?](https://caniuse.com/?search=replaceAll)
I've got a badge. Yeah...
Tags: hacktoberfest
Published: 2020-12-13 16:28:27

I've got a badge for "successfully" participating in the Hacktoberfest this year. Yeah, go check my profile. This means two things: not only I submitted at least four PR explicitly tagged for the Hacktoberfest, I also explicitly applied for the badge here on Dev. Double shame for me. Why?

Well, pretty much everything there's to say about Hacktoberfest was [already said](https://drewdevault.com/2020/10/01/Spamtoberfest.html) October 1st. And I agree with almost all of it. More than that, my own participation is an example of Hacktoberfest fraud.

First and foremost, I'm not an Open Source contributor. By far the most of code I write I write for my job and it's closed and proprietary. Thus the best thing I can do for Open Source is to just change my job to writing Open Source code full time for another company that pays for it. And frankly speaking I can do that. But I don't. So my "contribution" in Hacktoberfest is a mockery from the beginning.

Continuing the same reasoning the very idea underlining Hacktoberfest &mdash; the idea that four PRs you make over four weekends makes a difference for the Open Source &mdash; is kinda joke for the people writing Open Source full-time, 40 or more hours a week every week of every month. Especially the ones making a leaving out of it. Twice so for ones struggling to make a leaving out of Open Source.

Speaking of my actual "contributions", only two of my PRs were to someone else's repository, and that were adding just two references to a sort of "awesome list" of technical books. Another four PRs were to my own repository I've made during Hacktoberfest adding four small features each with a separate PR. If that's not a fraud that's an embarrassment for sure.

And now I'm waiting for my new shiny Hacktoberfest t-shirt, while actual Open Source contributors wait for nothing and just continue writing, testing, debugging and publishing their code as they did years before and going to do the years to come...
Introduction to Postman Scripts
Tags: postman, testing, tutorial, beginners
Published: 2020-12-13 16:28:19

In this post, we will do a quick introduction to Postman Scripts. Learning scripting will give you the power to automate your API collections, so it’s really important you understand how Scripting works if you want to do API automation using Postman.

#### **What are Postman Scripts?**
Postman Scripting allows you to add dynamic behavior to requests and collections by executing JavaScript code. Essentially, what you are doing is using JavaScript code to manipulate your API requests.

There are 2 types of scripting you can do with Postman –

- Pre-requests scripts
- Test scripts

**Pre-request Scripts** – manipulate the data of the request before Postman sends the request

**Test Scripts** – validate the response of the request by writing tests (gets executed after Postman receives the response)

#### **What can you do with the Scripts?**
Postman Scripts allow you to change the behavior of the requests, let’s understand what that means. Using Scripts you can do some of the following:

- Set or Get the variable values / parameters / headers / body data etc… in the request directly
- Debugging (log output to the console)

Let’s take a look at an example –
![Postman Scripts](https://automationbro.com/wp-content/uploads/2020/12/image-3.png)

Let’s assume you are creating a user using the POST request and then you need to fetch the id of that user in your GET request. Instead of manually copy/pasting the id, you can take advantage of scripts to do that for you.

First, you can set a variable called ‘id’ in the **Tests** script of the POST request. Then, get the variable in the **Pre-request** script of the GET request and set it in the parameter.
 
This allows us to automate this flow using Postman collection without having to worry about relying on existing data.

--- 

### **Check out the video below to learn more about Postman Scripts – –**
{% youtube UkKdwxbFzsY %}

---

#### To learn about API Test Automation using JavaScript, check out my free tutorial series here –
[JavaScript API Test Automation Tutorial Series](https://www.youtube.com/watch?v=ZSVw3TyZur4&list=PL6AdzyjjD5HDR2kNRU2dA1C8ydXRAaaBV)

---

📧 Subscribe to my [mailing list](https://automationbro.com/mailing-list) to get access to more content like this 
👍 Follow @automationbro on Twitter for the latest updates

...

I love coffees! And, if this post helped you out and you would like to support my work, you can do that by clicking on the button below and buying me a cup of coffee -

<a href="https://www.buymeacoffee.com/automationbro">![Buy me a coffee](https://dev-to-uploads.s3.amazonaws.com/i/4aw2ub3f4qkyjk0ivwt4.png)</a>

You can also support me by liking and sharing this content.

Thanks for reading!
Proxy Inferno
Tags: tutorial
Published: 2020-12-13 16:27:34

If like me you are or have been confronted with corporate proxies bullshit and whatnot, you might understand this article's title.
I cannot even count the amount of time I have lost trying to make things work, fiddling, googling, etc.
After running into so many **walls**, I decided to document my journey through Proxy Hell, one of the missing circles of Hell as described in Dante's Inferno.
This list isn't exhaustive but represents the many configurations I had to set up in my former position.
Hopefully, it will be of use to you.

### apt
Create a new file in `/etc/apt/apt.conf.d/`
And add the following lines in the file `proxy.conf`. Create it if it doesn't exist.
```sh
Acquire::http::Proxy "http://user:password@proxy.server:port/";
Acquire::https::Proxy "http://user:password@proxy.server:port/";
```

### git
```sh
git config --global http.proxy <http://proxyUsername:proxyPassword@proxy.server.com>:port
git config --global https.proxy <https://proxyUsername:proxyPassword@proxy.server.com>:port
```

### npm
```bash
npm config set proxy "<http://"username:password"@proxy.big-corp.com>"
npm config set https-proxy "<http://"username:password"@proxy.big-corp.com>"
```

If you're running nodejs INSIDE a Docker container you might have to set the proxy for the npm running INSIDE the container before running `npm install`. Otherwise the install just **won't** work when building your containers.

Dockerfile
```docker
FROM node:14.2.0

ARG HTTP_PROXY

WORKDIR /server
COPY package*.json ./
RUN npm config set proxy $HTTP_PROXY
RUN npm install
```
This line: `ARG HTTP_PROXY` declares a docker variable that you can pass when building your container.
The `RUN npm config set proxy $HTTP_PROXY` line sets the proxy for the npm instance running in your container.


Edit your docker-compose file

```docker
    build:
      context: .
      args:
        HTTP_PROXY: ${HTTP_PROXY}
```

It has to be under the build section.
Here I set the proxy by calling my machine's environment variable.
You can also hardcode the proxy value but it's not really safe.

```docker
    build:
      context: .
      args:
        HTTP_PROXY: <http://"username:password"@proxy.big-corp.com>
```

### curl

Edit or create the file located at `~/.curlrc`
And add this line :
```
proxy = <http://username:password@ip>:port
```
It’s Okay to be An Average Developer
Tags: devjournal, motivation, career, productivity
Published: 2020-12-13 16:26:12

You **do not** have to code 13 hours a day.

You **do not** have to be up to date with the latest libraries and frameworks.

You **do not** have to write top libraries.

You **do not** have to build 3 side projects in parallel.

You **do not** have to be accepted at Facebook, Amazon, Google or your local hyped company.

You **do not** have to be a specialist in Frontend, Backend, Machine Learning, Augmented Reality whilst knowing your way through AWS, and oh, let’s not forget, also work on your Flutter and React Native side projects in the evenings!

You don’t have to, because…

# Being Average may just be The Best for You

Employers are mostly searching for developers they can trust. For developers that can get their assigned tasks done in their own pace. For *average* developers.

Remember, there are *very few* people that are truly exceptional. These developers, well, you can see from a thousand miles. They quickly get up the ladder and are put into tech lead roles. A lot of responsibility. Stress. Long workings hours. Would you even want that if that’s not what you were born for?

The vast majority of us are average. We get our tasks done. We solve problems. And that, in most cases, **is perfectly fine**!

# About Guilt

We all get that *nasty* feeling sometimes! Am I doing enough? Am I learning, building, hustling enough? Am I enough?

Do **not** feel guilty that you did not work on your side project on Saturday evening!

Do **not** feel guilty that you haven’t had the time to experiment with the latest frameworks!

It’s fine!

As long as you get your tasks done at your own pace, you should feel pretty darn good about yourself!

As long as you are conscious enough to know that you will always need to learn new things on some occasions, do **not** let the complicated and quickly changing world of programming overwhelm you.

# Progress & Opportunities

Take everything in at your own pace.

Learn, experiment and build in your free time **only** when you feel like it.

Do **not** do it out of obligation, as this only puts more unnecessary stress on you and won’t get you anywhere.

Remember, most of the jobs are filled by average developers. You, me, the average Joe.

Learn, experiment and build only out of **fun and passion!**





*If you liked this short opinion post, feel free to follow me and my newsletter at https://adamkiss.net. I would love that!*
Any Open Source Solution for Container as a Service ( CaaS) ?
Tags: docker, containers, digitalocean, saas
Published: 2020-12-13 15:59:32

Hi, I have a question.
Is there any open source software which provides Containers as a service CaaS.

For more details, Actually I am looking for a solution, in which a customer comes to my webpage, selects an app (e.g. Django, flask ). And it is deployed as a container and then user can access it.
Exactly like DigitalOcean. But in containers instead of virtual machine.
Thanks
Advent of Code 2020 Solution Megathread - Day 13: Shuttle Search
Tags: adventofcode, challenge
Published: 2020-12-13 15:57:54

---
title: Advent of Code 2020 Solution Megathread - Day 13: Shuttle Search
published: true
description: Put your algorithm pants on: we're dealing with staggered multiples and busses and literally quadrillions of timesteps.
tags: adventofcode, challenge
series: Advent of Code 2020
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/dbrxqnbi8a150aqvi6gm.png
---

Yesterday was a cool one.  I usually enjoy the simulation puzzles.  Although I did have some brain farts when it came to rotating things on a discrete grid.  We're now officially over halfway done!  Keep it going!

## The Puzzle

In [today’s puzzle](https://adventofcode.com/2020/day/13), we're officially done with boats!  Boats are so yesterday.  Today, shuttles are the new boats, and we're trying to optimize our way through a staggered schedule of departures to get on our way to another airport.

## The Leaderboards

As always, this is the spot where I’ll plug any leaderboard codes shared from the community.

```
Ryan's Leaderboard: 224198-25048a19
```

If you want to generate your own leaderboard and signal boost it a little bit, send it to me either in a DEV message or in a comment on one of these posts and I'll add it to the list above.

## Yesterday’s Languages

Updated 07:55AM 12/13/2020 PST.

| Language   | Count |
|------------|-------|
| JavaScript |     3 |
| Rust       |     2 |
| C          |     1 |
| COBOL      |     1 |
| Elixir     |     1 |
| Haskell    |     1 |
| Python     |     1 |

Merry Coding!
PHP Apidocs generation tool
Tags: php, laravel, api, github
Published: 2020-12-13 15:55:05

I don't like writing tons of lines of stupid annotations just to have hope that api documentation will be generated correctly without errors that says nothing. And I am not the only one.

So I created package that solves this problem the way I like - by writing PHP code.

Can be found here: [Laravel Apidocs](https://github.com/johnylemon/laravel-apidocs)

**This way you can:**
 - reuse, extend and modify existing api definitions
 - create generic endpoint definitions and just modify them ad-hoc or by creating child classes
 - define multiple examples
 - define multiple sample responses
 - define and reuse parameter definitions
 - make your controllers readable again

## Getting started

 1. Add `johnylemon/laravel-apidocs` repository

```
composer require johnylemon/laravel-apidocs
```

2. Register `Johnylemon\Apidocs\Providers\ApidocsServiceProvider` provider if not registered automagically .


3. Install package. This command will publish all required assets.
```
php artisan apidocs:install
```

4. **Enjoy!**


## Generating route documentation

Package ships with command for rapid route definition generation.

```
php artisan apidocs:endpoint SampleEndpoint
```
Brand new `SampleEndpoint` class will be placed within `app\Apidocs\Endpoints` directory.
Target directory may be changed within your `apidocs` config file.

This class contains only one `describe` method, where you have to use any of available methods that will describe your endpoint. Like that:

```php
<?php

namespace App\Apidocs\Endpoints;

use Johnylemon\Apidocs\Endpoints\Endpoint;
use Johnylemon\Apidocs\Facades\Param;

class SampleEndpoint extends Endpoint
{
    public function describe(): void
    {
        $this->title('List users')
            ->desc('Returns paginated list of users');
    }
}

```

As you can see we set title and description as endpoint definition.
Every method returns endpoint instance so you can chain them.


## Endpoint definition usage

Okay, you created your first endpoint definition. Now it's time to use it as some real route definition.

Lets assume you have following routes:

```php

Route::get('api/users', [UsersController::class, 'index']);

```
If you want to use `App\Apidocs\Endpoints\SampleEndpoint` class as definition for first of them you should simply do this:

```php

use App\Apidocs\Endpoints\SampleEndpoint;

Route::get('api/users', [UsersController::class, 'index'])->apidocs(SampleEndpoint::class);

```

and... yes, thats it!

The only thing you have to do now is to call `php artisan apidocs:generate` command and visit `/apidocs` route to see it in action!

Look at [github package page](https://github.com/johnylemon/laravel-apidocs) to learn more!

Developed with ❤ by [johnylemon](https://github.com/johnylemon).
#8 DevOps Diary: No more Docker?
Tags: devops, kubernetes, tutorial, news
Published: 2020-12-13 15:48:57

Hey everyone, I hope you have/are having a lovely day and Welcome to week 8 🥳

This week's newsletter is out later than usual since life kind of got in the way. I hope you enjoy it anyway and you are having a great Sunday.

## News 📣

[Kubernetes is dropping Docker support](https://kubernetes.io/blog/2020/12/02/dont-panic-kubernetes-and-docker/) — don't freak out. Unless you have a self-managed cluster, it likely does not affect your use of Kubernetes nor your Kubernetes workflow. 

## What does this mean ❓

- [Video Explanation](https://youtu.be/7KUdmFyefSA) by TechWorld with Nana "Kubernetes is dropping Docker support - What does it mean for YOU?"
- Let's have a look at some of the alternatives that you can use to Docker — [Docker images without Docker](https://codefresh.io/devops/docker-images-without-docker-practical-guide/)

## Blog Posts (and other written content)🗞️

- Adding to [#7 of this newsletter](https://blog.anaisurl.com/7-devops-diary/); some amazing people have started collections of free resources on GitHub to help you prepare for the CNCF [Certified Kubernetes Security Specialist](https://github.com/walidshaari/Certified-Kubernetes-Security-Specialist) - CKS (or just to learn cool stuff about security)
- [ConfigMaps in Kubernetes: how they work and what you should remember](https://medium.com/flant-com/configmaps-in-kubernetes-f9f6d0081dcb)

## [View the full newsletter on my Blog](https://blog.anaisurl.com/8-devops-diary/)
Segmentation Fault, how to get rid of it!
Tags: c, cpp, rust
Published: 2020-12-13 15:40:48

It's very common for you to get a "Segmentation Fault" if you work with low level languages like C, C++ or Rust or even many more.
So the question is what's actually causing this error, is it that filthy pointer? maybe...

Segmentation Fault is a specific kinda error that arises when you try to access a unknown memory or that which doesn't belongs to you. There's quite a lot of ways you can get a segfault and to be honest its very hard to debug those memory stuffs. So I'll pointing out few of them that may help you to get rid of it (not sure).

First, a very common way to get a segfault is to dereference a null pointer.
```c
int *ptr = NULL;
*ptr = 1;
```

Another way you get a segfault is to change a read-only memory/value
```c
char *str = "Foo"; // compiler marks the string as "read-only"
*str = 'b'; //changing read-only memory results in segfault
//or
const int foo = 1; //const keyword makes the variable read-only
foo = 2; //changing read-only var results in segfault
```
And also another way of getting a segfault is pointing a pointer to a thing that doesn't exists anymore (I hope this is what they call it)
```c
char *p = NULL;
{
   char c;
   p = &c;
}
//p - where is my reference to c ?
```
Here, pointer `p` dangles as it points to `c` while its within the block but as soon as it get gets out of the block `c` has no existence and when you try again to dereference the pointer(now NULL) you probably will get a segfault.

Hope these examples might help you to cope up with your segfaults(maybe not). Why not share your views or solutions for handling segfaults in the comment section! :P
AWS on Air 2020: AWS Community Voices
Tags: aws
Published: 2020-12-13 15:35:58

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/uc1i603m27bfpgci4r2i.png)

Here's a [link](https://www.youtube.com/watch?v=e_G1e3gQwhg) to the session "AWS on Air 2020: AWS Community Voices" 

Enjoy our conversation -  we are 4 members in the [AWS Community Heroes program](https://aws.amazon.com/developer/community/heroes). We work in different areas around the globe. This talk was recorded for reInvent2020.

- **Vlad / Containers** - [link](https://aws.amazon.com/developer/community/heroes/vlad-ionescu/?did=dh_card&trk=dh_card) - based in Europe.
- **Peter / Serverless** - [link](https://aws.amazon.com/developer/community/heroes/peter-hanssens/?did=dh_card&trk=dh_card) - based in Australia.
- **Filipe / Community** - [link](https://aws.amazon.com/developer/community/heroes/filipe-barretto/?did=dh_card&trk=dh_card) - based in South America.
- **Me / Data** - [link](https://aws.amazon.com/developer/community/heroes/lynn-langit/?did=dh_card&trk=dh_card) - based in North America.

---

BTW - I'd love to hear which session(s) were YOUR favorites from #reInvent2020.  Leave comments!
Techniques For Writing Least Privilege IAM Policies
Tags: devops, aws, iam, policy
Published: 2020-12-13 15:32:16

- Least privilege is a principle of granting only the permissions required to complete a task.

- For example, if you have an Amazon Elastic Compute Cloud (Amazon EC2) instance that needs to access an Amazon Simple Storage Service (Amazon S3) bucket to get configuration data, you should only allow read access to the specific S3 bucket that contains the relevant data.

- The main elements of a policy statement are:

>**Effect**: Specifies whether the statement will Allow or Deny an action.

>**Action**: Describes a specific action or actions that will either be allowed or denied to run based on the Effect entered. API actions are unique to each service. For example, s3:CreateBucket is an Amazon S3 service API action and IAM action that enables an IAM Principal to create an S3 bucket.

>**NotAction**: Can be used as an alternative to using Action. This element will allow an IAM principal to invoke all API actions to a specific AWS service except those actions specified in this list.

>**Resource**: Specifies the resources—for example, an S3 bucket or objects—that the policy applies to in Amazon Resource Name (ARN) format.

>**NotResource**: Can be used instead of the Resource element to explicitly match every AWS resource except those specified.

>**Condition**: Allows you to build expressions to match the condition keys and values in the policy against keys and values in the request context sent by the IAM principal. Condition keys can be service-specific or global. A global condition key can be used with any service. For example, a key of aws:CurrentTime can be used to allow access based on date and time.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/p5kb7s9yerd9qu3cl15u.png)

Here is an example of how to set policy for users with AWS access console can rotate their Access keys but not others using [Condition](https://docs.aws.amazon.com/iot/latest/developerguide/tagging-iot-iam.html) combine with tag

- Add tag to IAM user
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/644fykg9yti2vvixn403.png)

- Create policy
```
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "AllowManageOwnAccessKeys",
            "Effect": "Allow",
            "Action": [
                "iam:CreateAccessKey",
                "iam:DeleteAccessKey",
                "iam:ListAccessKeys",
                "iam:UpdateAccessKey",
                "iam:ListUserPolicies"
            ],
            "Resource": [
                "arn:aws:iam::111111111111:user/*"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:ResourceTag/groupname": "developteam"
                }
            }
        }
    ]
}
```

Ref: https://aws.amazon.com/blogs/security/techniques-for-writing-least-privilege-iam-policies/