teleren/devto huggingface dataset:
Json Web Token
Tags: jwt, authentication, vietnameseblogs
Published: 2022-08-19 03:49:00

Để phục vụ mục đích xác thực người dùng và bảo mật để trao đổi thông tin qua nhiều ứng dụng. JWT(json web token) ra đời. Sau đây là một số thông tin về JWT.
JWT structure: có 3 phần: Header, Payload, Signature.
1. Header: 
chứa loại token và thuật toán mã hóa nào
2. Payload: 
chứa các claim. Claims là các biểu thức về các đối tượng(thường là người dùng) và các dữ liệu liên quan. Có 3 loại claims: registered, public, private claims.
- Registered claim: 
cung cấp các thông tin: iss (issuer), exp (expiration time), sub (subject), aud (audience),... Claim này không bắt buộc nhưng được khuyên dùng.
- Public claim: 
Có thể được định nghĩa bởi người dùng.(Nhưng tránh trùng nhau giữa các claim sẽ được thông qua URI nơi chứa các namespace tránh trùng)
- Private claim:
Được định nghĩa bởi người dùng, dùng để chia sẻ thông tin giữa 2 partner.
3. Signature:
Là một chuỗi mã hóa được tạo bởi header, payload và sceret key.
Do signature bao gồm cả header và payload nên có thể dùng để kiểm tra dữ liệu có toàn vẹn khi truyền tải.

Workflow JWT: 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7tmams5ayhksbpye13y7.png)
 
Sự khác biệt giữa cookies và JWT:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/82wh56o26g72m50yyfua.png)
Cookies: 
- Chứa session id.
- Với mỗi request đều tra cứu dữ liệu database.
- Tất cả xử lý đều nằm trên cùng 1 máy chủ.
- Mở rộng qui mô khó khăn.

JWT:
- Chứa signature xác nhận thông tin người dùng.
- Không yêu cầu tra cứu dữ liệu database.
- Được lưu trữ tại client. Nên việc xử lý có thể trên nhiều máy chủ khác nhau.
- Mở rộng qui mô dễ dàng.

---
Cách server xác thực token:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/48ven0kxz1tztxzvtbie.png)
Khi server generate JWT sẽ tạo ra signature. Phần header và payload trong JWT được mã hóa dạng base64. Signature được tính toán bằng cách sử dụng một hàm hash chuỗi header và payload đã được mã hóa cùng với secret key(nhiều server thì đều phải chung 1 secret key). JWT sẽ bao gồm header, payload đã được mã hóa + chuỗi signature. Sau đó sẽ gửi đến Client.
Khi Client sử dụng dịch vụ sẽ gửi JWT về server. Sau đó server sẽ tách header và payload đã mã hóa của JWT, lấy + với secret key của server và hash tạo HMAC. Nếu HMAC giống với của signature của JWT gửi đến, server sẽ xác nhận verify thành công. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z4jgj2k1gsiu2w299jat.png)


Tài liệu tham khảo:
- https://viblo.asia/p/tim-hieu-ve-json-web-token-jwt-7rVRqp73v4bP
- https://documentation.softwareag.com/webmethods/compendiums/v10-5/C_API_Management/index.html#page/api-mgmt-comp/co-jwt_usecase_workflow.html
- https://nileshprasad137.github.io/lessonslearned/api%20security/jwts/oauth2.0/2018/12/08/jwt-auth.html
- https://whitehat.vn/threads/thac-mac-giua-ma-hoa-va-ham-bam.5468/
Pattern Matching With Functions
Tags: elixir, tutorial, programming, webdev
Published: 2022-08-19 03:42:00

Hey, dev!

Imagine a scenario where you need to compare 2 numbers and return which one is the biggest.

In Elixir, we can do it by using an ternary `if` statement:

```Elixir
defmodule CompareNumbers do
  def the_bigger_number_is(number_01, number_02) do
    bigger_number = if number_01 > number_02, do: number_01, else: number_02

    "The number #{number_01} is greater than #{number_02}"
  end
end

number_01 = 10
number_02 = 5

IO.inspect(CompareNumbers.the_bigger_number_is(number_01, number_02))

=> "The number 10 is greater than 5"
```

...

We can also use **Pattern Matching With Functions** to control the flow:

```Elixir
defmodule CompareNumbers do
  def the_bigger_number_is(number_01, number_02) do
    compare(number_01 > number_02, number_01, number_02)
  end

  defp compare(true, number_01, number_02) do
    "The number #{number_01} is greater than #{number_02}"
  end

  defp compare(false, number_01, number_02) do
    "The number #{number_02} is greater than #{number_01}"
  end
end

number_01 = 10
number_02 = 5

IO.inspect(CompareNumbers.the_bigger_number_is(number_01, number_02))

=> "The number 10 is greater than 5"
```
Here, we create 2 private functions with the same name `compare`, and then, with pattern matching, we check if the first argument is true or false.

_So, which of the 2 approaches above do you think is the best? Which makes the most sense?_

_Or, how could be better?_ **_Let me know in the comments below_** =D

**Contacts**
Email: contato@diegonovais.com.br
Linkedin: https://www.linkedin.com/in/diegonovais/
Twitter: https://twitter.com/diegonovaistech
Congratulations to the openGauss for winning the Gold Award at the 10th China Electronic Information Expo
Published: 2022-08-19 03:41:18

The 10th China Electronic Information Expo (CITE2022) opened in Shenzhen on August 16. In order to further enhance the authority and influence of the Expo and make the Expo a vane for the development of new products and new technologies in the electronic information industry, the Expo Organizing Committee organized the evaluation activities for the Gold Award and Innovation Award of the China Electronic Information Expo. The review is divided into seven categories: new display, integrated circuits, basic electronics, intelligent networking and new energy, artificial intelligence and intelligent hardware, innovative applications of information technology, and intelligent manufacturing. A total of 20 industry experts participated in the review. 
A total of 10 China Electronic Information Expo Gold Awards and 81 Innovation Awards were selected.



Among them, the openGauss enterprise-level open source database won the gold medal, the highest award of this year's China Electronic Information Expo.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2ug424qimol0xn8ezw6g.jpg)
Github Copilot Experience after 6months
Tags: vscode, productivity, programming
Published: 2022-08-19 02:26:00

## **Foreword**

If you've been playing around with extensions in vscode i think you're familiar with **GitHub Copilot**. Github Copilot is the closest thing you'll get if you're looking for [J.A.R.V.I.S.](https://en.wikipedia.org/wiki/J.A.R.V.I.S.) for coding. It helps you out by providing you solutions for tedious tasks and optimizing your code.

## **My experience**

Ive been using copilot for 6months now and it was probably one of the best tools I ever used(I might be addicted😅). I just got the news yesterday that it will be charged for starting end of August and still contemplating whether I should pay 10$ a month, I mean its ether Stranger Things or Copilot at this point lol.

Anyway I want to talk about the **pros** and the **cons** using Copilot. I hear many people saying _"Copilot will replace us all"_ but that's honestly the furthest thing from the truth. It sure does help but it's just a tool, people give AI too much credit but it's a boogyman(at least for now). Maybe they might take over the world one day, but some extension for vscode wont do that now so chill.

**Pros**
1. Saves time on tests 
It saves soooooo much time when you write unit test. Let's be honest here, we all hate unit tests. I write tests using jest and writing dummy data is just a tedious tasks. Lest say you have a bunch of states or variables that you have to test, you gotta write it all by hand ending up taking hours when you could be watching Netflix. Copilot guesses the answer just by writing the test case(you have to be specific tho). 

2. Great for prototyping
If you want to create a prototype to test out a method or a feature it makes it easier to create a prototype to test if your theory works.

3. Naming variables and methods
Coming up with names for variables or method can be painful and give you migraines. Copilot helps you mitigate that by reading the code and giving you suggestions using the best possible practice for readability. It works 7 out of 10 times so it's not bad in my opinion.

**Cons** 
1. It's dumb when not trained correctly
2. It's creates clutter when you want to think and breaks your flow
3. It's not good for the juniors and might have bad influence on them.
4. Lets be honest 10$ isn't really a good deal
5. Could take out the joy in programming




## **Conclusion**
If you think 10$ is a good deal go for it. I wouldn't buy it unless my company pays for it. You can ether google or think about it a second more and come up with the solution. I will miss the ease when testing or when making a brand new project but other than that it doesn't really benefit me. Maybe I'm using it wrong lol
Bit shift wraps values
Tags: c
Published: 2022-08-19 00:57:35

```c
#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>

int main () {
    for (uint32_t shift = 0; shift < 35; shift++) {
        uint32_t u32 = UINT32_MAX >> shift;
        printf ("1 >> %02" PRIu32 " = %" PRIu32 "\n", shift, u32);
    }
}
```

This example may be run [here](https://godbolt.org/z/dErrjh918).

I expected that `UINT32_MAX >> 32` to result in `0`. But the output disagrees:

```
1 >> 00 = 4294967295
1 >> 01 = 2147483647
1 >> 02 = 1073741823
1 >> 03 = 536870911
1 >> 04 = 268435455
1 >> 05 = 134217727
1 >> 06 = 67108863
1 >> 07 = 33554431
1 >> 08 = 16777215
1 >> 09 = 8388607
1 >> 10 = 4194303
1 >> 11 = 2097151
1 >> 12 = 1048575
1 >> 13 = 524287
1 >> 14 = 262143
1 >> 15 = 131071
1 >> 16 = 65535
1 >> 17 = 32767
1 >> 18 = 16383
1 >> 19 = 8191
1 >> 20 = 4095
1 >> 21 = 2047
1 >> 22 = 1023
1 >> 23 = 511
1 >> 24 = 255
1 >> 25 = 127
1 >> 26 = 63
1 >> 27 = 31
1 >> 28 = 15
1 >> 29 = 7
1 >> 30 = 3
1 >> 31 = 1
1 >> 32 = 4294967295
1 >> 33 = 2147483647
1 >> 34 = 1073741823
```

`1 >> 32` is undefined behavior by the C standard [6.5.7](https://port70.net/~nsz/c/c99/n1256.html#6.5.7) of left shift:

> If the value of the right operand is negative or is greater than or equal to the width of the promoted left operand, the behavior is undefined.

TIL
Auto Clicker simplifies tasks on Linux
Tags: autoclicker, mouse, linux, opensource
Published: 2022-08-19 00:42:00

Max Auto Clicker is a Linux program that helps you perform repeated click tasks. This is done by automatically clicking on items on your PC or laptop. It’s easy to use and can be installed on most Linux desktop distributions.

Mouse Auto Clickers are a great way to increase your mouse clicking speed. By using a mouse Auto Clicker, you can increase your [clicking speed](https://maxautoclicker.blogspot.com/2022/07/cps-score.html) by up to 400%! Auto Clickers can also help you improve your accuracy when clicking.

The Linux Auto Clicker can be used for a variety of purposes, such as:

- Auto-clicking in idle games.
- Data entry automation.
- Software testing.
- Tasks that require multiple clicks in the desktop environment, for example, the auto-refreshing web browser.

## Max Auto Clicker for Linux Desktops

The Max Auto Clicker program is a great alternative to other Auto Clickers such as XClicker or OP Auto Clicker. The main difference with the others is that it has a better interface and supports more features. For example, it allows you to schedule clicks, choose hotkeys, etc.

![Linux Auto Clicker](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1c21xo8dlt9uwmvtber7.png)

The best thing is that you don't even need to install anything in order to use it. It can be set up to click on a single point on the screen or to click on various points. The Auto Clicker can be programmed to click with a random delay between clicks or to click constantly. It can also be set to click a specific number of times.

The Max Auto Clicker has a large community of users and is constantly growing in popularity.

![Max Auto Clicker for Linux Desktops](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l8ivlsyd31lc3oyh2pen.png)

## Max Auto Clicker Features:

- User-friendly interface.
- It runs on both Linux and Windows (a cross-platform application).
- Tested and 100% functional on most Linux distributions: Ubuntu, Linux Mint, Debian, Manjaro, Zorin OS, etc.
- Auto Clicker with a recording feature.
- Ability to select mouse buttons (left, middle, right).
- Option to hold down the mouse button.
- Hotkey to start/stop Auto Clicker.
- Online documentation and tutorials.

## How to Install Max Auto Clicker on Linux

First, you need to download a zip archive from the official repository. This is done by following this web page:

[![Download a zip archive](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fjl3eiajqz9zj6n2nr6w.png)](https://sourceforge.net/projects/maxautoclicker/files/latest/download)

After you've finished downloading Max Auto Clicker for Linux, you'll be able to use it right away without having to install anything.

Simply unzip the archive and run the following Linux command to make the program executable:

```
chmod +x ./MaxAutoClicker
```

(Without sudo/root)
Building a Saas in public with Typescript!
Tags: typescript, node, saas, webdev
Published: 2022-08-19 00:03:51

Hey there, I’m starting today a project where I’m gonna build a Saas in public and document it.

If you want to follow me on that project, I’ll be doing live coding streams on Twitch.

You can check out the schedule of those live streams on my [Twitch channel](https://www.twitch.tv/joaofmaranhao/about)!

I’ll also update that project here on [Dev.to](http://Dev.to), so feel free to follow me and interact as you wish!

## What is the project?


The project is an application to manage veterinary clinics.
Users should be able to create appointments, register clients, and more.

The goal here is to make an MVP as soon as I can, so I can validate it with clients.

Keep in mind that, the business rules will be updated as needed.
Here is the first concept of the project backend:

![Database UML and Business rules](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sb02w0a90r436xu39mvy.JPG)

## What tools I’m gonna use?


Some of you guys, are following me because of my project where I created a script to automate the content creation of an Youtube channel with Python. (If you don’t know what I’m talking about, you can check out the text [here](https://dev.to/joaomaranhao/how-i-used-python-to-automate-a-youtube-channel-ph0)).

But for this project here, I’m going to use a different selection of tools.

The stack that I choose for that project is:

- Typescript
- NodeJS (Nest, Prisma)
- Postgres
- ReactJS (Next)

So, if you want to learn about those topics, this is a perfect oportunity to see how this works, and how to get an idea off the ground.

Follow me on [Twitter](https://twitter.com/joaofmaranhao)!

Check out my [Twitch channel](https://www.twitch.tv/joaofmaranhao/about)!

Take a look at my [Github](https://www.github.com/joaomaranhao)!
Blog: 2022-08-19: Content & Tooling Team Status Update
Tags: puppet, content, updates
Published: 2022-09-09 14:46:27

---
title: Blog: 2022-08-19: Content & Tooling Team Status Update
published: true
date: 2022-08-19 00:00:00 UTC
tags: puppet, content, updates
canonical_url: https://puppetlabs.github.io/content-and-tooling-team/blog/updates/2022-08-19-status-update/
---

Well, I’m back! My turn to update you all on the amazing and interesting work that we’ve been doing! Unfortunately however it has been something of a slow week and though we’ve got something special in the pipeline, it’s not yet at the stage where we can talk about it in any detail so you’re gonna have to be satisfied with the community PR and module release announcements. Hopefully we’ll have more to say next time, but until then enjoy the weekend and relax.

## Community Contributions

We’d like to thank the following people in the Puppet Community for their contributions over this past week:

- [`puppetlabs-apache#2294`](https://github.com/puppetlabs/puppetlabs-apache/pull/2294): “Allow integers for timeouts”, thanks to [traylenator](https://github.com/traylenator)
- [`puppetlabs-apt#1050`](https://github.com/puppetlabs/puppetlabs-apt/pull/1050): “Deal with net-ftp being unavailable”, thanks to [ekohl](https://github.com/ekohl)
- [`pdk-vanagon#302`](https://github.com/puppetlabs/pdk-vanagon/pull/302): “(maint) Update windows extra file sign command.”, thanks to [isaac-hammes](https://github.com/isaac-hammes)
- [`puppet-resource_api#298`](https://github.com/puppetlabs/puppet-resource_api/pull/298): “(PA-4558) Replaces Travis CI with GitHub Actions”, thanks to [mhashizume](https://github.com/mhashizume)

## New Module / Gem Releases

The following modules were released this week:

- [`puppetlabs-apt`](https://github.com/puppetlabs/puppetlabs-apt) (`9.0.0`)

- [`puppetlabs-apache`](https://github.com/puppetlabs/puppetlabs-apache) (`8.1.0`)

- [`puppetlabs-docker`](https://github.com/puppetlabs/puppetlabs-docker) (`5.0.0`)
Chrome插件开发 - 第一个主题
Published: 2023-08-13 13:32:49

---
title: Chrome插件开发 - 第一个主题
published: true
date: 2022-08-19 00:00:00 UTC
tags: 
canonical_url: https://manon.icu/blog/translate/build-chrome-extensions/first-theme
---

在上一篇文章[【First Extension】](https://manon.icu/blog/translate/build-chrome-extensions/first-extension)学习了创建第一个插件。

这篇文章学习创建一个主题插件。

## 结构

```bash
mkdir theme-extension && cd theme-extension
```

更改`manifest.json`

```json
{
  "manifest_version": 3,
  "version": "2.6",
  "name": "daily dev tips theme",
  "theme": {
    "images": {
      "theme_frame": "images/frame-background.png",
      "theme_frame_overlay": "images/frame-background.png",
      "theme_tab_background": "images/tab-background.png",
      "theme_ntp_background": "images/ntp-background.png"
    },
    "colors": {
      "toolbar": [0, 185, 232],
      "tab_background_text": [255, 255, 255],
      "tab_text": [255, 255, 255],
      "bookmark_text": [255, 255, 255],
      "ntp_text": [218, 0, 96],
      "ntp_link": [218, 0, 96],
      "ntp_section": [255, 255, 255],
      "ntp_background": [255, 255, 255]
    },
    "tints": {
      "buttons": [1, 1, 1]
    },
    "properties": {
      "ntp_logo_alternate": 0,
      "ntp_background_alignment": "center"
    }
  }
}
```

![HUvoYl](https://cdn.jsdelivr.net/gh/manonicu/pics@master/uPic/HUvoYl.jpg)

上图解释了每个配置对应的效果

Images:

- `theme_frame`:无法为外部框架设置颜色，但是可以选择 1x1 像素的图像。
- `theme_frame_overlay`:左上角
- `theme_tab_background`:tab 每个标签的背景，包括标签栏的其他按钮背景
- `theme_ntp_background`:当前 tab 背景，建议用大图

Colors:

- `toolbar`:工具栏颜色
- `tab_background_text`:标签背景字体颜色
- `tab_text`:标签字体颜色
- `bookmark_text`:书签字体颜色
- `ntp_text`:新标签导航字体颜色
- `ntp_link`:新标签链接字体颜色
- `ntp_section`:新标签模块字体颜色？
- `ntp_background`:新标签背景颜色

Tints:

有六个值，分别是`background_tab`,`buttons`,`frame`,`frame_inactive`,`frame_incognito`,`frame_incognito_inactive`
他们的用法都一样，都是色调在色调饱和度（HSL）格式，使用范围 0 - 1.0：色调是绝对值，在 0 和 1 之间饱和是相对于当前的图像的。0.5 没有变化，0 完全不饱和，1 是完全饱和度。亮度也是相对的，0.5 没有变化，0 像素黑色，1 作为所有像素白色。

Properties:

- `ntp_logo_alternate`:新页面大图是否重复-`no-repeat`、`repeat_x`、`repeat_y`、`repeat`
- `ntp_background_alignment`:新页面大图的位置-`center`、`left`、`top`、`right`、`bottom`

## 测试扩展

![r60uOV](https://cdn.jsdelivr.net/gh/manonicu/pics@master/uPic/r60uOV.jpg)
Press "start" to restart the game.
Tags: beginners, career
Published: 2022-08-18 23:53:00

Hello, it's been a while isn't? 

Well, the thing is, I wasn't in my best moment and my mental health was on the edge. At the same time, I started my first internship and the things I wanted to do, including writing in here, was gone.

A lot of things to care and I had to take things slowly, so now, almost two years later, I can say I'm back and I'll share more about what I've learned and whatsover.

Nowadays I'm studying ReactJS with Typescript a lot because of my internship. There they call me "The Joker" because I'm Android (kotlin) developer and now I have this front-end web project to do and I'm the only one who can switch between languages. Yeah, I know they are just kidding, they just want me to learn and do things they don't want do. Lol

> Até logo!
The Art of Storytelling in Engineering
Tags: productivity, cloud, management, leadership
Published: 2022-08-18 22:54:00

The last few years have forced companies and employees to rethink how remote work is performed. One of the most critical components of a successful remote workforce is communication. Communication is especially important for Engineering roles like SREs and DevOps that require collaborating with multiple disciplines across an organization. 

Different teams bring different function-specific language, business context, and team-specific goals to every discussion. How can teams effectively communicate all of that critical knowledge with each other? With storytelling. 

Every employee in a company views their work differently, much in the same way every character in a story views the world differently. Collaboratively building shared mental models of the problem at hand allows teams to identify and address those different views to form a more resilient solution. 

Similarly, every employee is driven by their own professional agenda, much in the same way every character in a story is driven by their own personal agenda. Identifying all involved employees’ wants and addressing them in the process of building a solution increases employee engagement and buy-in for the solution, which ultimately leads to better engagement with the solution.  

Storytelling isn’t always about what’s said, but what’s conveyed. Non-verbal communication like body language, posture, and tone of voice all influence the delivery and understanding of information. Employees will pick up on these cues and tune in or tune out of the conversation accordingly, so engaging your teammates with verbal and non-verbal communication is critical for effective communication.

Finally, let your team be the hero of their own story. Give your team a clear problem statement, position your company’s values as guardrails for solving the problem, and let the team find the solution themselves.

Want to hear more? [Check out my website](https://www.derose.cloud) or [shoot me an email](mailto:jesse@derose.cloud)!
Day 617 : GTFO
Tags: hiphop, code, coding, lifelongdev
Published: 2022-08-18 21:55:55

_liner notes_:
- Professional : Had a couple of meetings today. Got some revisions to image assets and sent them off to folks for another review. Created two demo applications that make calls to the backend server I deployed yesterday. Everything worked! Just need to clean up some code and make changes to the documentation next.

- Personal : Ordered some stuff last night for my upcoming trips. Should make live streaming easier so I'll actually do it. I really want to GTFO and explore cities while live streaming and bring other people along. I'll have to make some changes to my code. I need to make sure the new webcam I bought does what I want it to do. Last night, I went through tracks for the radio. I made changes to my code so that the site doesn't make calls to get upcoming events and deleting the events already there. So the events I added through the dashboard don't get deleted.

![An aerial view of the Cape Reinga, New Zealand coast with some mountains and a beach looking into the ocean under a blue sky with large clouds.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5hry2fghhtk5svs0g80z.jpg)

Going to play around more with the stuff that came in. Did some thinking on how I want to store the events, so I'll be making a small change to my site's dashboard. Next, I just need to get the events listed and be able to update and delete them. I want to also go through more tracks for the radio. Plus review some Japanese. Oh and I think "She Hulk" starts today. I'm out!

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube OlgRyo1bKCw %}