teleren/devto huggingface dataset:
How to compare two buffers in Node.js?
Tags: node
Published: 2020-09-25 00:00:00

---
  title: How to compare two buffers in Node.js?
  published: true
  tags: Nodejs
  date: Fri Sep 25 2020 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/compare-two-buffers-nodejs
  cover_image: https://melvingeorge.me/_next/static/images/main-f302fe88aaa2dee38b0b5bc834c296d4.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/compare-two-buffers-nodejs)
  
To compare 2 buffers in Node.js, we can use the `compare()` method in the buffer object.

Let's say we have a buffer object like this,

```javascript
// buffer 1
const buff1 = Buffer.from("EFG");
```

and another buffer like this,

```javascript
// buffer 1
const buff1 = Buffer.from("EFG");

// buffer 2
const buff2 = Buffer.from("HIJ");
```

Now let's use the `compare()` in the `buff1` Buffer object to compare our `buff2` Buffer object like this,

```javascript
// buffer 1
const buff1 = Buffer.from("EFG");

// buffer 2
const buff2 = Buffer.from("HIJ");

// comparing 2 buffers
const value = buff1.compare(buff2);

console.log(value); // -1
```

- The method will return `-1` if it finds that the buffer object which is passed as a parameter into the `compare()` method is coming after the string `EFG` in the first buffer.
- The method will return `0` if it is the same.
- The method will return `1` if it finds that the buffer object which is passed as a parameter into the `compare()` method is coming before the string `EFG` in the first buffer.

Let's do another example to clearly understand it better

Let's make 2 buffers,

```javascript
// buffer 1
const buff1 = Buffer.from("KLM");

// buffer 2
const buff2 = Buffer.from("ABC");

// comparing 2 buffers
const value = buff1.compare(buff2);

console.log(value); // 1
```

If you look closely here we have the two buffers and in the first buffer we have string `KLM` and the second string `ABC`, we know that the string `ABC` is coming before the string `KLM`, so the `compare()` method will return `1`.

The method will return `0` if the string are same like this,

```javascript
// buffer 1
const buff1 = Buffer.from("ABC");

// buffer 2
const buff2 = Buffer.from("ABC");

// comparing 2 buffers
const value = buff1.compare(buff2);

console.log(value); // 0
```

### Feel free to share if you found this useful 😃.

---
LoginRadius Open Source For Hacktoberfest 2020
Tags: hacktoberfest, opensource, loginradius
Published: 2020-09-27 17:57:49

---
title: LoginRadius Open Source For Hacktoberfest 2020
published: true
date: 2020-09-25 00:00:00 UTC
tags: hacktoberfest,opensource,loginradius
canonical_url: https://www.loginradius.com/engineering/blog/loginradius-opensource-repos-for-hacktoberfest-2020/
---

Checkout LoginRadius Open Source Repositories where you can contribute for hackotberfest 2020

   
[Read On](https://www.loginradius.com/engineering/blog/loginradius-opensource-repos-for-hacktoberfest-2020/)
Personalize seu perfil no Github 😬
Tags: github
Published: 2020-09-25 00:00:00

---
title: Personalize seu perfil no Github 😬
date: '2020-09-25'
spoiler: Um dica para deixar seu perfil mais completo e atrativo…
tags: github
published: true
---

O perfil do github é uma das mais importantes vitrines de promoção do próprio trabalho e também usado como portifólio de trabalho. O time do github lançou recentemente uma nova funcionalidade que permite aos desenvolvedores personalizar seu perfil, por meio de uma área aberta para escrita usando markdown.

Confira nos passos a seguir como executar o procedimento que é bem simples.

## Primeiro, vamos criar um novo repositório

O primeiro passo é acessar sua conta e no menu superior acessar a opção `new repository`.

![novo-repositorio.png](https://firebasestorage.googleapis.com/v0/b/from-tatooine.appspot.com/o/github-profile%2Fnovo-repositorio.png?alt=media&token=4917553c-2738-49b7-80e8-623de49d0ec7)

Em seguida, será aberta uma nova página para criação de um novo repositório.

![criar-repositorio.png](https://firebasestorage.googleapis.com/v0/b/from-tatooine.appspot.com/o/github-profile%2Fcriar-repositorio.png?alt=media&token=0d5c8a2b-ce0d-45d3-9cc7-7c64cd4e22fd)

No print acima, você precisa seguir algumas regras para poder criar esse repositorio especial. O nome do repositório deve ser igual ao nome de seu usuário do github, o repositório deve ser público e a opção `Adda README file` deve estar marcada.

![editar-readme.png](https://firebasestorage.googleapis.com/v0/b/from-tatooine.appspot.com/o/github-profile%2Feditar-readme.png?alt=media&token=7e5b84b7-6c80-49c9-b883-fcdd466a230f)

Logo quando você abrir a página do seu novo repositório, você deve clicar no lápis indicado no print para editar o arquivo README.md que está no seu repositório, cuja responsabilidade é de manter o código que aparecerá no seu perfil.

## Agora você precisa usar sua criatividade

![texto-readme.png](https://firebasestorage.googleapis.com/v0/b/from-tatooine.appspot.com/o/github-profile%2Ftexto-readme.png?alt=media&token=04357ea3-3ab3-413e-9f75-013d25acfaa3)

Ao abrir o arquivo para edição, você já terá um template de exemplo disponível com algumas informações básicas do seu perfil. Agora você pode usar sua criatividade para escrever uma descrição.

Lembrando que você deve usar a linguagem markdown para tal. É uma linguagem bem simples, você pode conferir algumas possibilidades nesse [link](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet).

Você pode commitar as mudanças diretamente na master do seu repositório.

## Agora vamos ver como ficou

![perfil-atualizado.png](https://firebasestorage.googleapis.com/v0/b/from-tatooine.appspot.com/o/github-profile%2Fperfil-atualizado.png?alt=media&token=212586b0-5421-4477-bf27-6d8d0f301040)

Após o commit e salvar, você pode voltar ao seu perfil e conferir como ficou. E é basicamente isso.

Lembre-se de manter seus dados pessoais, links e foto atualizadas.

Espero que essa leitura possa ter ajudado a melhorar seu perfil.
🚀

Até mais.
Some of my favourite public data sets
Tags: opendata, data, dataengineering, datascience
Published: 2020-09-25 16:32:04

---
title: Some of my favourite public data sets
published: true
date: 2020-09-25 00:00:00 UTC
tags: opendata, data, dataengineering,datascience
canonical_url: https://rmoff.net/2020/09/25/some-of-my-favourite-public-data-sets/
---

Readers of a certain age and RDBMS background will probably remember `northwind`, or `HR`, or `OE` databases - or quite possibly not just remember them but still be using them. Hardcoded sample data is fine, and it’s great for repeatable tutorials and examples - but it’s boring as heck if you want to build an example with something that isn’t using the same data set for the 100th time.

I’ve written before about one of my favourite resources for mocking data, [Mockaroo](https://www.mockaroo.com/), and how you can even use it to [stream mock data into Kafka](https://rmoff.net/2018/05/10/quick-n-easy-population-of-realistic-test-data-into-kafka/). Other mock data generators for Kafka include [kafka-connect-datagen](https://kafka-tutorials.confluent.io/kafka-connect-datagen-local/kafka.html) and [Voluble](https://www.confluent.io/hub/mdrogalis/voluble).

Sometimes though, you just want some real, live, warts-and-all data. And there is fortunately a real shift in governments and public bodies in recent years to [Open data](https://en.wikipedia.org/wiki/Open_data). Here is a list of some of my (UK-centric) resources. Many have a mix of live and static datasets.

- [**Northern Data Hub**](https://datahub.bradford.gov.uk/) - Bradford City Council data, including the [car park](https://datahub.bradford.gov.uk/ebase/datahubext.eb?search=Bradford+car+parks) live stream that I used in [this talk](https://rmoff.dev/carpark-telegram-bot)

- [**Data Mill North**](https://datamillnorth.org/) - 685 published datasets from Leeds City Council

- [**data.gov.uk**](https://data.gov.uk/) - Huge listing of open data provided by the UK government

- [**UK Environment Agency** flood-monitoring API](https://environment.data.gov.uk/flood-monitoring/doc/reference) - this is one of my favourites, because not only do you get a live feed of river levels from around the UK, you get to make awful puns about _streams_ (geddit?!)

[![slide 3](https://rmoff.net/images/2020/09/slide_3.jpg)](https://speakerdeck.com/rmoff/enabling-rapid-business-insight-into-data-with-stream-analytics-and-goldengate?slide=4)

- [**Transport for London** (TfL)](https://tfl.gov.uk/info-for/open-data-users/) - Great source of data about the capital’s transport system, including lots of live feeds

- [**Network Rail**](http://datafeeds.networkrail.co.uk/) - a nice feed of data all about the UK rail network. I had fun with this data [here](https://www.confluent.io/blog/build-streaming-etl-solutions-with-kafka-and-rail-data/) :)

* * *

_What are your go-to sources for real data? Comment below or [let me know on Twitter](https://twitter.com/rmoff/)._
How Storybook Improves the Way Frontend Teams Work
Tags: webdev, opensource, productivity, frontend
Published: 2021-03-03 16:59:45

---
title: How Storybook Improves the Way Frontend Teams Work
published: true
date: 2020-09-25 00:00:00 UTC
tags: webdev, opensource, productivity, frontend
canonical_url: https://mannes.tech/teams-storybook/
---

We started with Storybook one month ago, and I love it.

Now, whenever I'm developing components for our React application, I first integrate them into storybook instead of the app itself.

Before I explain why, let's first look at what Storybook is.

## A living documentation for all of your app's components

[Storybook](https://storybook.js.org/) is an open source tool for UI development.  
It integrates with all popular JavaScript UI frameworks and has an ecosystem of addons to extend its use-cases even further.

![Gif showing Storybook's UI](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eacdbinv2rnf8ew68rje.gif)
_Source:_ [_Storybook Docs_](https://storybook.js.org/docs/react/get-started/introduction)

The two major use cases for Storybook are:

* Documenting all of your web app's components and their interfaces (for easier re-use and better code reviews)
* Developing components in isolation

Instead of firing up your complete web app in dev mode, you start storybook.  
There you develop your component (or components) completely isolated from the rest of your app.

When you're happy with the component, you can submit a pull request.  
And after that pull request is approved and merged, you use that component in your UI.

This is a [component driven](https://www.componentdriven.org/) approach.

## How Storybook improves your code.. and workflow

After working with Storybook for a few weeks, I'm noticing four major advantages for our team:

* **Better components.** If you start your components with storybook, you're thinking about the interface right from the beginning. And since you're developing the component in isolation, you can easily focus on developing a re-usable component (which you're documenting on-the-go).
* **Improved development speed.** You don't need to integrate the component into your app right away. You can easily get your component in every state you want, without mocking this in your real application or integrating it before knowing its interface.
* **Better decoupling from the backend.** It would be great, but it's not always possible to have the backend functionality ready before someone writes the UI. With a Storybook-enabled component driven approach you can develop great UI components separately and integrate them into your app when everything's ready.
* **Makes working in a distributed team easier.** A good documentation helps collaboration. And Storybook makes it easy to keep it up-to-date.

For us, storybook improved productivity and the developer experience in our team.  
It's not something for every team, but it works for us.

If you could see your team have similar benefits to ours, why not give Storybook a try?

***

🙏 [_Follow me on Twitter @simon_mannes_](https://twitter.com/@simon_mannes)
Working with Golang Maps
Tags: go, dictionaries, maps
Published: 2020-09-27 17:58:26

---
title: Working with Golang Maps
published: true
date: 2020-09-25 00:00:00 UTC
tags: Go,dictionaries,maps
canonical_url: https://www.loginradius.com/engineering/blog/working-with-go-maps/
---

Explore and learn about the usage of maps in Go.

   
[Read On](https://www.loginradius.com/engineering/blog/working-with-go-maps/)
How to create a diff of npm package releases on the command line
Tags: node, webdev
Published: 2020-09-24 22:11:14

---
title: How to create a diff of npm package releases on the command line
published: true
description: A quick guide on how to use `npm-diff` to see the differences of two npm package releases. 
tags: node, webdev
canonical_url: https://www.stefanjudis.com/snippets/how-to-create-a-diff-of-npm-package-releases-on-the-command-line/
---

Today I came across [Julian Gruber](https://twitter.com/juliangruber)'s package [npm-diff](https://github.com/juliangruber/npm-diff/), which solves a problem that I regularly have.

You probably know the situation: you update one dependency in your Node.js project, and everything breaks. Even though this update was supposed to be a backward-compatible patch release, things went down. How can you now create a diff of the two npm packages quickly? Go to GitHub and make a diff there? I always found this process to be cumbersome. 

This situation is where the `npm-diff` command comes into play. 🎉

You can install the package globally or use it via [npx](https://www.npmjs.com/package/npx). The usage is straightforward. Define the package name paired with two release version numbers, and you can access a diff of the two package versions.

```
npm-diff <package-name> <release-1> <release-2>

npm-diff web-vitals-element 1.0.0 1.0.1
```

![CLI with npm-diff uncolored output](https://images.ctfassets.net/f20lfrunubsq/2ZWTxCIrtAD1lzsJKnkh5J/75e716aebddd461ac00218c556e17a6d/undefined)

The bare-bones command creates an "uncolored diff" of the two package versions. As Julian describes in [the package documentation](https://github.com/juliangruber/npm-diff/), you can pipe the `npm-diff` output into `colordiff` (which you probably have to install first) and `less` to see a nicely colored diff.

```
npm-diff web-vitals-element 1.0.0 1.0.1 | colordiff | less
```

![CLI output of color npm-diff command using colordiff](https://images.ctfassets.net/f20lfrunubsq/3MNAnZcsAdtPj1jDnsNy4z/d1e9e3459f3bc9602842884f6d517b8d/undefined)

That's much better already! I took it one step further.

## delta is a diff tool with syntax highlighting

A while ago, I started using [delta](https://github.com/dandavison/delta) for git diffs on the command line. It's fantastic! It shows line numbers, supports syntax highlighting, and is highly configurable. It even supports side-by-side diffing in the terminal!

```
npm-diff web-vitals-element 1.0.0 1.0.1 | delta | less
```

That looks pretty great if you ask me!

![CLI output of npm-diff using delta](https://images.ctfassets.net/f20lfrunubsq/27REGuDmVD5nWiWYRwzIGC/4ff7701c24789947defa251b74fa51e2/undefined)

And as a last step, because I don't see myself using `npm-diff` without the colorful output, I added an `npm-diff` shell function to my environment.

```
function npm-diff() {
  command npm-diff $1 $2 $3 | delta --width $(tput cols) | less
}
```

*If you wonder what the `tput` makes in there, I have `delta` configured to show always the side-by-side view. This view requires a `width` definition and `tput` allows me to span the diff over the full terminal width.*

Happy diffing! 👋
Introducing our new book, Tidy Modeling with R 📖
Tags: machinelearning, datascience, rstats
Published: 2020-09-25 20:19:14

---
title: Introducing our new book, Tidy Modeling with R 📖
published: true
date: 2020-09-25 00:00:00 UTC
cover_image: https://juliasilge.com/blog/tidymodels-book/featured.png
tags: machinelearning, datascience, rstats
canonical_url: https://juliasilge.com/blog/tidymodels-book/
---

Max Kuhn and I are pleased to announce our new book, [_Tidy Modeling with R_](https://www.tmwr.org/)!

[![Cover](https://juliasilge.com/blog/tidymodels-book/tmwr.png)](https://www.tmwr.org/)

This book focuses on how to use [tidymodels](https://www.tidymodels.org/) and has two main goals:

- Readers will learn **how to use** R and tidymodels packages to create robust and reliable models. This is a practical book, full of code examples with real datasets.

- The book **encourages good methodology and statistical practice**. The design of tidymodels packages (from the software itself to documentation, training materials, and this book) is oriented toward the challenges of dealing with models in the real world and setting up everyday practitioners for success.

[![Cover](https://juliasilge.com/blog/tidymodels-book/featured.png)](https://www.tmwr.org/software-modeling.html#model-phases)

_Tidy Modeling with R_ is currently a work in progress. The first eleven chapters are available as of today, and we encourage you to check them out! We will continue to add new chapters in the upcoming months, and we intend to publish a print version when the book is completed.

The source code to create the book is [on GitHub](https://github.com/tidymodels/TMwR), and readers such as you are welcome to contribute if you wish. Guidelines for contributions [are available here](https://github.com/tidymodels/TMwR/blob/master/contributing.md).
The Path to Being a Developer
Published: 2020-09-18 13:51:27

I’m sure many others have thought, “Maybe web development” when they are looking for a new career. I know I’m not the first, and likely not the first dealing with this decision in my late 30s. So even though many have dealt with this every situation is truly unique. Sharing the journey is a great way to put my own fears, anxieties and concerns out there even if all it does is clear my mind.

My first foray into web development started about 5 years ago. My wife was in school to become a graphic designer and she suggested I take a look at development. I was not happy with my job at the time and was looking for something else within my company. I dipped my toe into development, quickly realizing I had an aptitude for this work. However, I had a job offer within my company to take a new, exciting position in Colorado, a place my wife and I had been looking to move to for years. 

We took the new job and spent the next 4 years traveling the country for my work. We got to go to some great places. Lassen Volcanic National Park, Grand Teton National Park, Seattle, Salt Lake City. It’s a big list (that comes with spending 160-200 nights per year in hotels) and was a great time in our lives. This year my company went through a series of mergers, acquisitions and reorganizations that resulted in my job being eliminated. I am taking this opportunity to get back into web development and looking at making a completely different career choice.

Not knowing where my future leads has been scary but also exhilarating. For the first time in a long time I feel like I can do anything. I have many concerns – will I have to move, how do I reconcile 13+ years of non-tech work experience into my resume to get my first web development job, will I remember the things I need to when it comes to coding, etc. But through all of that I’ve found a sense of enjoyment in coding that was not present in my prior career. I’ve seen a greater sense of community as well. 

To date I have a minimal portfolio and know there’s a long road ahead of me. But there are so many promising aspects of my future that I can’t help but be encouraged. So many people are out there writing about how to start in this line of work, where to get experience, and just sharing their own thoughts that I feel confident I’ll be able to soon say I have a job as a web developer.
3 sets of Cybersecurity challenges & answers (CTF) to learn from
Tags: vscode, security, beginners, ctf
Published: 2020-09-24 23:36:25

---
title: 3 sets of Cybersecurity challenges & answers (CTF) to learn from
published: true
description: Learn 3 sets of Cybersecurity challenges (CTF) anyone can learn!
tags: vscode,security,beginner,ctf 
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/bbec4t9tm8qx3xikhidd.png
---

Hello everyone, 

I've been streaming Security topics on my [Twitch Stream](https://twitch.tv/mbcrump) and I've discovered that capture the flag competitions (CTF) is a great way to learn about encryption, forensics, web exploits, and more. But what are CTF's you might be asking?

In the simplest terms, you hack into a resource and find the flag. Which may look at xxxFlag{XXX}.  Flags are placed in various locations such as a file, database, source code, or many other types.

The official definition looks something like: 

A capture the flag (CTF) contest is a special kind of cybersecurity competition designed to challenge its participants to solve computer security problems and/or capture and defend computer systems. Typically, these competitions are team-based and attract a diverse range of participants, including students, enthusiasts, and professionals. A CTF competition may take a few short hours, an entire day, or even multiple days.

Below I've listed 3 videos that I made for the hacking CTF site known as [CTFLearn](https://ctflearn.com/).

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

**Challenge 1** - CTFLearn - We successfully answered the following challenges: Basic Injection, Forensics 101, Character Encoding, Simple Programming

(Video 7 mins)

{% youtube mC4c0hMOJ0A %}

**Challenge 2** - CTFLearn - We successfully answered the following challenges: Taking LS, Where Can My Robot Go?, Binwalk, Practice Flag, Reversal of fortune, Hextroadinary, Wikipedia

Video (8 mins)

{% youtube fU8oIx1rCOQ %}

**Challenge 3** - CTFLearn -  We successfully answered the following challenges: Base 2 2 the 6, POST Practice, Basic Android RE 1, BruXOR, QR code

Video (7 mins)

{% youtube yepi5eqqTdw %}


Conclusion

Stay tuned for [future streams](https://twitch.tv/mbcrump) as we typically stream security on Sat/Sun at 10 AM PST or you can watch the condensed version by subscribing to my [YouTube](https://youtube.com/mbcrump). 

Stay connected with me on social platforms for daily security and software development news.

-[Twitter](https://twitter.com/intent/follow?screen_name=mbcrump) | [Twitch](https://twitch.tv/mbcrump) | [Instagram](https://instagram.com/mbcrump) | [YouTube](https://youtube.com/mbcrump) | [GitHub](https://github.com/mbcrump) | [Website](https://www.michaelcrump.net)