teleren/devto huggingface dataset:
O tym jak “Blogging for busy programmers” przekonało mnie do blogowania

Tags: blogging, arkademy, firstpost, polish
Published: 2021-04-14 22:07:10

Obserwując [Andrzeja Krzywdę](https://www.instagram.com/andrzejkrzywda_po_polsku/) na Instagramie, szybko można zauważyć jego pozytywne nastawienie do tematu blogowania wśród programistów. A szczególnie tego, że programiści wręcz powinni “*serializować*” się do blogów, aby dzielić się zdobytą wiedzą czy też wyrażać swoje opinie. A wszystko po to, aby wzajemnie sobie pomagać i budować lepsze jutro.
Tak, zdecydowanie brzmi to trochę górnolotnie, ale … w zupełności się z nim zgadzam!


Odkładając kolejny raz temat blogowania na rzecz innych potencjalnie ważniejszych projektów, trafiłem na kurs **[Blogging for busy programmers](https://products.arkency.com/blogging/)** w ramach platformy [Arkademy](https://arkademy.dev/). Niby nic wielkiego, bo realnie jest to **bardzo krótki kurs**, ale zmienił moje nastawienie i znacznie podniósł motywację do prowadzenia bloga. Dlatego, dłużej nie zwlekając, postanowiłem, że zacznę przelewać moją wiedzę, opinie oraz przemyślenia w temacie około IT na “papier”.

**Dlaczego nie założyłem bloga bez kursu?**

Założyłem! Około sześć lat temu [napisałem 13 postów](https://karollotkowski.wordpress.com/) i odłożyłem temat na bok. Przez cały ten czas nie uznawałem tematu bloga za najważniejszy pracując przy wielu projektach jednocześnie. Skoncentrowałem się na popychaniu featerów do przodu, pomijając temat dzielenia się wiedzą poza obszarem projektu.

Przerabiając kurs *Blogging for busy programmers* otrzymuje się unikalny wgląd w sposób myślenia twórczy kursu/książki, który ma za sobą **wieloletnie doświadczenie w blogowaniu** (ponad 200 postów). Podejście, przedstawione w niezwykle zwięzłej formie, jest bardzo pragmatyczne i przedstawia jasny bilans benefitów jakie niesie za sobą publiczne dzielenie się wiedzą za pomocą bloga.

**Nano lekcje**, bez owijania w bawełnę, same konkrety z przykładami zastosowania. Idealna pozycja dla osób zastanawiających się nad blogiem, gdyż kurs jasno i dosadnie promuje ideę: “*Done is better than perfect*”. 
 
Nie znajdziesz w nim instrukcji poradnikowych prowadzących za rączkę jak założyć bloga. **Po prostu blogujesz, albo nie.** Decyzja należy do Ciebie. Tylko nie miej do siebie pretensji w przyszłości, w stylu “*blogowałbym, ale kto będzie to czytał*”, lub “*blogowanie nie jest dla mnie*”. Raz odpuściłem, i żałuję tego, bo jakby mnie jutro pokonał Covid lub coś gorszego to zostałyby po mnie marne 13 postów, i to w większości o Dropwizardzie :(

Dlatego jeżeli jesteś w podobnej sytuacji do mnie i czytasz ten post, oznacza to, że warto sięgnąć po *Blogging for busy programmers* i wreszcie wyjść z “piwnicy” do ludzi.
Pandas in the Pandaemic. (COVID-19 in Scotland — statistics) Part 3
Tags: plotly, flask, covid19, pandas
Published: 2022-02-08 17:24:22

---
title: Pandas in the Pandaemic. (COVID-19 in Scotland — statistics) Part 3
published: true
date: 2021-04-14 22:05:35 UTC
tags: plotly,flask,covid19,pandas
canonical_url: 
---

[![](https://cdn-images-1.medium.com/max/680/0*G-jeuXG53U-NkHQS.png)](https://vallka.medium.com/pandas-in-the-pandaemic-covid-19-in-scotland-statistics-part-3-88ff9f9c5f6f?source=rss-b12a2c268778------2)

This is the 3rd part of an exploration of pandas package.

[Continue reading on Medium »](https://vallka.medium.com/pandas-in-the-pandaemic-covid-19-in-scotland-statistics-part-3-88ff9f9c5f6f?source=rss-b12a2c268778------2)

UPD (2022-02-08):
The URL of myCovidash has changed to
https://www.vallka.com/mycovidash/
and it uses Django now instead of Flask. But still working fine for nearly a year without serious adjustments. And death rate is currently lower then ever indeed...

https://dailysceptic.org/2022/02/08/deaths-9-below-average-when-will-the-government-declare-the-pandemic-over/

The graph on the above link shows stats in England and Wales, mine is for Scotland. Similar figures... Looks like the end is near?
Day 345 : Shut 'em Down
Tags: hiphop, code, coding, lifelongdev
Published: 2021-04-14 22:03:50

_liner notes_:
- Professional : Pretty chill day. Had a meeting in the morning and then worked a "booth" at a virtual conference. It's the same conference I went to last year that was the last in person before organizers shut 'em down. It was cool. Not as much interaction at the booth, but I was tweeting during the event and got some good interaction on there. While listening to the talks I would work on my blog post and keep an eye on the chatroom.

- Personal : Didn't really do much last night. I ordered some items online and had to do research before purchasing. Then I watched an episode of "Dr. Stone". Ended the night going through tracks for the radio show this week.

![View of the mountainous coast of Cape Schanck, Australia through an opening in some trees](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m46daamhiyz5ggj94r59.jpg)

So this morning, I woke up with an idea to refactor a feature in an upcoming side project and separate it out into it's one site that can be linked from other sites or visited directly. It involves the live streaming I want to do in the future. If I get that done, I can then stream me working on the other side projects. I just need a good URL. Been thinking about it in the back of my mind. I want to see if I can plan it out and maybe shift to that, get it done "quickly" and go back to the other side projects while creating content at the same time. Hmmmm we'll see I need to get the URL figured out. Looking to watch another episode of "Dr. Stone" and maybe that will spark inspiration. If not, I'll also go through some tracks. We'll see. RIP DMX!

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube UJrWjUBrrQk %}
#NikemaLearns About AWS – #3 We Have an Exam Date
Tags: cloudpractitioner, aws, learninpublic
Published: 2021-04-14 21:46:00

I [passed my practice exams](https://aws.nikema.dev/practice-test-scores) thrice in a row so I felt ready to register for the real thing. I booked my test yesterday (February 26, 2021) and my exam date is April 9th.

## Sharing what I’ve learned
{% youtube Z3S7fS9K_YQ%}

So far, I’ve written about how I’m studying for this exam, but I haven’t shared much about what I’ve learned. I thought it would be fun to make bite-sized presentations covering key topics. I know teaching and sharing what I’ve learned are ways to reinforce and solidify new concepts. I abandoned the idea to review the video course that I completed; that would have been boring.

I did start working with [the e-book I mentioned last time](https://learning.oreilly.com/library/view/aws-certified-cloud/9780135266960/) and I added this [video course provided by AWS](https://www.aws.training/Details/eLearning?id=60697). I like both resources for different reasons. The AWS course from Amazon does a great job of simplifying terms and making the concepts relatable. The cert guide (e-book) makes it easy to check your understanding and goes into more detail with technical terms.

I planned to add a voice-over to the video below and that will still happen, but not today. I’ll probably re-upload the video to the same URL once I record the voice-over.

>[The-Value-Proposition-of-Cloud](https://nikemaprophet.com/wp-content/uploads/2021/02/The-Value-Proposition-of-Cloud.pdf)
👆🏾 Download the PDF version of the slides

I’m going to keep this short and take it easy. Next time I should have the “Value Proposition of Cloud” video completed plus a new video on a different topic. See you around the internet 👋🏾.
Documentando minha API #2 — Criando mock server com Drakov
Published: 2021-04-14 20:48:31

Já diz a frase:

> Uma API documentada é uma API feliz

Mas também existe uma outra frase:

> Uma API com mock server tem dev felizes

Eu criei e documentei a API 😃, e ele será usada pela equipe de front-end. Para facilitar a integração do trabalho deles com essa API, posso prover um *mocke server* que vai gerar uma api mockada baseada nas especificações do meu arquivo de documentação.

![Não ter que esperar você deployar tudo pra poder integrar? Show! #partiu](assets/img/0_v15ujwdq_rno4kej.gif "Não ter que esperar você deployar tudo pra poder integrar? Show! #partiu")

## \#partiu

Pra poder fazer isso, farei uso da ferramenta[Drakov](https://github.com/Aconex/drakov).

Para subir meu mock eu apenas preciso rodar os seguintes comandos:

* npm install -g drakov
* drakov -f “\*\*/*.apib” -p 4000 — discover

Com esse último comando será feito algumas coisas:

* Servidor mockado rodando na porta 4000;
* A flag “--discover” criará uma rota*GET /drakovque listará todas as rotas disponíveis;*
* Importará para mockar o servidor todos os arquivos com extensão **.apib**.

![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4f05lllr4kvr5fzmm7jc.png)
X-Ray tracing from SQS to Lambda
Tags: aws, xray, sqs, lambda
Published: 2021-02-08 23:57:55

SQS supports X-Ray tracing but it does not propagate the trace to Lambda function. Lambda always starts a new trace with an immutable facade segment.

This is a known issue, see:
- aws-xray-sdk-node: https://github.com/aws/aws-xray-sdk-node/issues/208
- aws-xray-sdk-dotnet: https://github.com/aws/aws-xray-sdk-dotnet/issues/110

### Workaround

There were some workaround discussions in the above issues.

The following is a solution I implemented for a demo: 
- Create a new segment to replace the facade segment created by Lambda, and
- assign with the retrieved trace ID and parent ID from the trace header of the SQS segment.

Example in typescript:
```javascript
import { Handler, SQSEvent, SQSRecord } from "aws-lambda"
import { Segment, setSegment, utils } from "aws-xray-sdk"
...

// Create a new Segment
const traceHeaderStr = sqsRecord.attributes.AWSTraceHeader
const traceData = utils.processTraceData(traceHeaderStr)
const sqsSegmentEndTime = Number(sqsRecord.attributes.ApproximateFirstReceiveTimestamp) / 1000

const lambdaSegment = new Segment(
    functionName,
    traceData.root,
    traceData.parent
)
lambdaSegment.origin = "AWS::Lambda::Function"
lambdaSegment.start_time = lambdaExecStartTime - (lambdaExecStartTime - sqsSegmentEndTime)
lambdaSegment.addPluginData({
    function_arn: functionArn,
    region: sqsRecord.awsRegion,
    request_id: awsRequestId
})

// Set it as the current Segment
setSegment(lambdaSegment)

// Do something

// Close the segment
lambdaSegment.close()
```

From Trace Map console:

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

Example code can be found here on GitHub [kyhau/aws-tools/b/X-Ray/xray-sqs-to-lambda/handler.ts](https://github.com/kyhau/aws-tools/blob/master/X-Ray/xray-sqs-to-lambda/handler.ts).
How to install typescript on Ubuntu
Tags: typescript, javascript, ubuntu, linux
Published: 2021-04-14 20:47:23

## 1. Install node
Firstly you have to install node, if you haven't done that yet just type these two commands:
```
curl -fsSL https://deb.nodesource.com/setup_15.x | sudo -E bash -
sudo apt-get install -y nodejs
```
&nbsp;
## 2. Install TypeScript
When your node is installed, you can proceed to install TypeScript:

```
npm install -g typescript
```
&nbsp;
## 3. Check if everything works
Now check if everything working properly by typing this simple command:

```
tsc
```

You should see a version of TypeScript you just install, and a list of options for `tsc` command.
Documentando minha API #1 — API Blueprint + Aglio
Published: 2021-04-14 20:46:13

Mexer num projeto cuja API não tem documentação é um sofrimento… ter que vasculhar no código do projetos os endpoints e entender o que é possível fazer com cada um deles é um trabalho desnecessário, e seria resolvido de forma simples com uma bendita documentação :(.

Já diz a frase:

> Uma API documentada é uma API feliz

Eis que chega a minha hora de fazer um projeto novo, e não posso cair na mesma mancada de deixar o código ser a fonte de entendimento da API.

Como especificação para a construção dessa documentação, optei pela **[API Blueprint](https://apiblueprint.org/).** Criada pela [Apiary](https://apiary.io/)(Oracle), tem a vantagem de ser escrita utilizando Markdown, facilitando a leitura.

## Começando

Seguindo o padrão da API Blueprint, podemos escrever nossa documentação em **Markdown** ou com a extensão **.apib**. Optei pela segunda, já que é possível encontrar extensões para meu editor de texto.

```markdown
FORMAT: 1A
HOST: http://api.meninogaimeiro.com.br

# API do Menino Gaimeiro

Uma API pra você gerenciar a sua carteirinha xD.

# Group Games

## Games [/games]

### Criar games [POST]

+ Request Criar um game
    + Headers

            Accept: application/json
            Content-Type: application/json

    + Attributes

        + name (required)

+ Response 201 (application/json)
    + Attributes

        + id: 1 (number) - ID do game
        + name: Desperados 3 (string) - Nome do game

+ Response 400 (application/json)
    + Attributes

        + status_code: 400 (number) - Status code da Request
        + errors (array) - Objeto de erros
            + (object)
                + parameter_name: name (string) - Nome do parâmetro
                + message: field is required (string) - Tipo do erro
```

O exemplo acima faz o seguinte:

* Seta a url da api para[http://api.meninogaimeiro.com.br;](http://api.meninogaimeiro.com.br%3B/)
* Cria um grupo de rotas chamada*games*;
* Cria um grupo de rotas*Games /games.*Nesse meu exemplo ficou repetido, mas poderia existir junto com essa rota o*Platforms /games/platforms*;
* Crio uma request informando seus headers e seus atributos;
* Crio uma response informando seus status codes e seus payloads

Para ver como essa documentação é renderizada usando o Apiary,[clique aqui](https://gamer1.docs.apiary.io/).

## Gerando a documentação

A **API Blueprint** é apenas uma especificação, não uma tecnologia. Para gerar uma documentação em meu projeto Node, acabei por utilizar a engine [Aglio](https://github.com/danielgtaylor/aglio), que será responsável por interpretar os arquivos nesse formato e renderizar a documentação formatada.

Para isso, faça:

* npm install -g aglio
* aglio -i api.apib — theme-template triple -s

Esse último comando lerá o arquivo**api.apib**, gerando um template de 3 colunas em um servidor.

Eis que o resultado será algo como mostrado na imagem abaixo:

![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n9pgybf83klc0lvppnyr.png)  

Pronto! Com isso já posso dar continuidade na documentação da API :).
JavaScript Maze Game Tutorial Part 2 is up!
Tags: webdev, javascript, css, gamedev
Published: 2021-04-14 20:40:43

Hi all,

<a href="https://medium.com/codex/build-a-maze-game-with-vanilla-javascript-part-2-of-2-41f44a040f45?source=friends_link&sk=0bd9285b1aa7acdbcdb7f4a782c2d44f" target="_blank">Part 2</a> of my JS Maze game tutorial is now available!

This is Part 2 of my two-part tutorial series on how to build a simple maze game with CSS and Javascript. It will hopefully be helpful for game prototyping as well as for learning CSS and JS.

It also has some fairly reusable code for four-direction button controls, a CSS wobble animation, and basic level-switching logic that are transferable to other HTML5 games.

If you want to build the whole game, you can also visit <a href="https://medium.com/codex/build-a-maze-game-with-vanilla-javascript-part-1-of-2-ddfd35e84e93" target="_blank">Part 1</a> for some direction on how to start from the outset.

The full code for both Part 1 and 2 is also available on [Github](https://github.com/nevkatz/js-maze-game-1).
Work and Study Routine
Tags: productivity, routine, dev, womeninitech
Published: 2021-04-14 20:29:50

I have been working and studying ever since I was 17. My routine has changed many times along these years, but in essence some things remain the same.

I wanted to share in general lines the overall idea of what my routine looks like and how I keep track of it.

- Telegram group you can write how you want your day to be, and how it actually went. It's easy to change things so you do not need a physical planner or to open any special apps, a messaging app works quickly.

- A physical productivity planner you write down the primary, secondary and nice to have tasks for the week.

- A project management or a notepad tool such as trello or notion.

What's most important is that you find something that works for you, one small change at a time and see how you react to it. If you know for instance your body doesn't work at time xx:xx maybe that's a good time to set a relaxation time. 

Priority can change quite often, that is why I set the intention for the week and each day I write what went accordingly and what could be changed. Without judgment. A journey of self discovery.

**In General lines what my routine can look like** 
07:00 - Morning rituals: Brush your hair & teeth, Wash your face, etc
07:15 - Calligraphy - **Anything fun that actually gives you motivation to get out of bed as first activity**
07:25 - Exercise, Shower, Meditate, Breakfast
08:30 - Watch a TV series episode/ Study a byte sized lesson/ Read tech blogs/ Watch something fun on youtube/ Do some Karaoke 
09:00 - 17:30 - Work hours
12:00 - Prepare and eat Lunch & Call someone you care about/ take a nap
18:00 - Community Event/ Respond messages and emails
19:00 - Dinner & Call someone you care about/ Sweep the Floor, Wash clothes, Do some house chore.
20:30 - Study/ Work on a side project/ Learn something/ Create content/ Do nothing at all
23:00 - Wind down to sleep, bring a book/ kindle to bed, Aromatherapy until falling asleep.

Maybe you're an early bird or a night owl, just see what works best for you trying to incorporate the daily elements that would help you reach a goal in the long run.
Talk Notes: "Implicit to Explicit: Decoding Ruby's Magical Syntax" (RailsConf 2021)
Tags: rails, techtalks
Published: 2021-04-14 20:12:26


✨ **What is this post about**: As a part of my professional growth, I make time to watch conference talks on Ruby, Rails, JS, React, tech writing, and tech trivia. Previously, I'd just watch them but now I will take and publish notes for future reference. This talk was a part of RailsConf 2021 that I'm participating in at the time of writing. 

✨ **Talk:** 'Implicit to Explicit: Decoding Ruby's Magical Syntax' by [Justin Gordon](https://twitter.com/railsonmaui)

✨ **One-paragraph summary**: Ruby's implicitness makes it great for readability and DSLs. But that also gives Ruby a "magical" syntax compared to JavaScript. In this talk, let's convert the implicit to explicit in some familiar Rails code. What was "magic" will become simple, understandable code.

✨ **Impression**:  I feel this talk was much more about pry and I am blown away by Justin's 🔥 `~/.pryrc` 🔥 (see [below](#read-more) ) and the ease it introduces into debugging 💕 I loved this talk, and Justin's way of calm and kind explaining complex concepts.

---

## Table of contents:
- [Notes](#notes)
- [Read more](#read-more)


---

## Notes
- DSL: Domain-Specific Language
- Rails leverages Ruby's implicitness:
  - self
  - variable declarations
  - parentheses
  - much more
- Can we learn to read Ruby code like the Ruby interpreter?
  - ideally, you should understand the code, not just copy-paste
- 🔥 🔥 🔥 OMG Justin's pry demo is a must-watch! I need to re-watch it and code along 🔥 🔥 🔥 

## JS vs Ruby
- JS is very explicit: 
  - you need the parentheses for function invocations; 
  - `this` is rarely implicit;
  - explicit return in standard functions;
- Ruby is *often* implicit: 
  - parentheses are optional and so zero arg method calls are the same as object values (`user.first` can be a method invocation or just a call for the attribute);
  - `self` can be implicit or explicit (it's explicit for writer methods because otherwise, Ruby's trying to declare a new local var)
  - implicit returns;

---

## Read more
- [Justin's resources](https://shakacode.com/talks)
- [slides](https://drive.google.com/file/d/1UUePkLINNN-Gpm5x5kPGBjNafrn29DdK/view?usp=sharing)
- [Justin's `~/.pryrc`](https://gist.github.com/justin808/1fe1dfbecc00a18e7f2a)
- [ShakaCode Forum Pry Articles](https://forum.shakacode.com/search?q=pry)
- [Running puma for debugging](https://forum.shakacode.com/t/running-puma-for-debugging-with-pry/2018)
HTML elements and difference between <p> and <span> element
Published: 2021-04-14 20:05:35

<!DOCTYPE html>
<html>

<!--head tag contain the content that machine see while SEO --> 

   <head>
     <meta charset="utf-8">
     <title>html element</title>
   </head>

<!-- body that contains the element that we see on the website  -->
   <body>
<!-- p element -->

     <p> This is a block level, therefore, add padding and margin before and after the line</p>
     <p> This is single line sentence.</p>
<!-- span element -->
    <span>This is inline element and therefore does not add any padding and margin before and after the line.</span>
     <span>This is single line sentence.</span>
      
    </body>
</html>

>>>>>>>>Result/ output 

This is a block level, therefore, add padding and margin before and after the line

This is single line sentence.

This is inline element and therefore does not add any padding and margin before and after the line. This is single line sentence.


>>>>>we can see that in case of the <p> element the result printed on two different line, however, in span the same code printed on the same line.
we actually use span element for styling purpose and it has not semantic meaning in html, however, the <p> element is block element and has semantic meaning in HTML
unordered_map: vector< string > as key
Published: 2021-04-14 19:25:56

I recently ran into a problem that required storing 
vector< string > in unordered_map as a key.
I have searched on the web for a solution but haven't found one. So I've decided to use what I already know to solve this. 
I just would like to share my solution and hope that for somebody it can be useful.
```cpp
struct hasher {
        long long operator()(const vector<string>& v) const {            
            int prime = 31;
            long long mod = 1e9 + 9;
            long long hash = 0;
            for(string s: v) {
                long long string_hash{};
                long long pow = 1;
                for(int i = 0; i < s.length(); ++i) {
                    string_hash = (string_hash + (s[i] - '0' + 1) * pow) % mod;
                    pow = (prime * pow) % mod;
                }
                hash = (hash + string_hash + (prime * hash) % mod) % mod;
            }
            return hash;
        }
    };
unordered_map<vector<string>, int, hasher> mp{};
// can be used just like any other unordered_map
```
In this approach, I've used rolling hash algo to calculate the hash of each string, and then I've added them to the resulting hash. The total complexity of the function is O(N * max_n), where N is the size of the input vector and max_n is the length of the string with max length into the input vector.
I would be glad for any suggestions about optimization/improvements of this code :) 

References:

1. cp-algorithms - https://cp-algorithms.com/string/string-hashing.html
2. CodeNCode - https://www.youtube.com/watch?v=zURFD55lGBI