teleren/devto huggingface dataset:
Working with git remote and adding to my SSG
Published: 2022-10-03 21:03:59

Hi everyone,

This week I worked with [Alex](https://github.com/alexsam29) to add a new feature to our SSGs. This new feature was the ability to use a JSON config file to pass in options instead of typing in the options manually in the command line. I worked on [Alex's repo](https://github.com/alexsam29/ssg-cli-tool).

The code wasn't too difficult to write. I added new options `-c` and `--config` which would use a JSON config file to get all the options needed when generating the HTML file. For example, the contents of the config file could look like this:

```
{
  "input": "./site",
  "output": "./build",
  "stylesheet": "https://cdn.jsdelivr.net/npm/water.css@2/out/water.css",
  "lang": "fr"
}
```

The code process I did was to first check if the config file exists and is JSON formatted, then read from the file and put the contents into an object, and finally use the properties from the object to get all the options. The biggest issue I had was making sure not to duplicate code, so I had to change a few things in the code before I could add my changes.

The biggest thing I learned from this process was using a couple of new features from Git. I used the Draft Pull Request for the first time and found how useful that feature is. It's cool how you can continually add commits to the PR until you believe it is ready for review. I also learned how to use a git remote, which is used to work with a different repo that you didn't clone. I used this feature to get my partner's work form his branch onto my computer so that I could review and test his code.

Luckily, the instructions were pretty clear, so I had no problems with these new Git features, but I still feel I need practice with them. I'll continue to use these features throughout my programming career.
Ruby: Call me (in which an old dog learns new tricks)
Published: 2022-10-03 20:46:03

A few years ago I worked somewhere where the lead dev wanted us to adhere to SRP and expose the class and instance via a single interface named `call` e.g:

```
def Foo
  def self.call = new.call
  def call = "hello"
end
```

This actually ended up making a pretty clean codebase in certain respects (certainly helped ease the problem of naming things) although ignoring more obvious conventions such as `to_h` when returning a hash, `to_s` for strings etc eventually left me feeling it was too rigorously applied.

That aside, one of the missed opportunities was in generating a broader understanding of _why_ a class/instance like this is useful and I recently had an opportunity to revisit the question.

In case you aren't aware, there are couple of ruby objects which already respond to `call` namely `lambda` and `proc`. 

```
l = lambda { |x| x * x }
puts l.call(2) # 4

p = proc { |x| x + x }
puts p.call(3) # 6
```

You can also covert a method into a proc using `method` or (preferably) `public_method`:

```
def foo(x) = x - x
m = method(:foo)
puts m.call(10) # 0 
```

With this in mind you can pass around a lambda, a proc, a method, a class, or an instance of a class, all executed with the same interface. This is very useful for callbacks and differed execution.

As for tricks ... there are several ways to actually call `call`. `l.call(2)` is obvious but you can also do `l.(2)`. 

For procs, lambdas, and methods, there is also `l[2]` and `l.yield(2)` (I didn't know this!) but in the case of a class or instance, you'll have to add support (e.g. `alias_method :[], :call`) which starts to make the class a little messy, so I tend to stick with `.()`.

But there's more. if you're a fan of Elixirs pipes:

```
l = lambda { |x| x * x }
p = proc { |x| x + x }
output = proc { |x| puts "*** #{x} ***" }

(l >> p >> output).call(2) # *** 8 ***
(output << p << l).call(2) # *** 8 ***
```

I don't know that I'd approve code like this in a PR unless there was a really good reason but I had no idea this was possible. New tricks!
Ordenação por flutuação - Bubble Sort
Tags: javascript, braziliandevs, algorithms
Published: 2022-10-03 20:42:38

Começando meus estudos de algoritmos cai no Bubble sort.
Vamos entender o que é um algoritmo para começar nossa caminhada de estudo.

_Em matemática e ciência da computação, um algoritmo é uma sequência finita de ações executáveis que visam obter uma solução para um determinado tipo de problema. Segundo Dasgupta, Papadimitriou e Vazirani; "Algoritmos são procedimentos precisos, não ambíguos, padronizados, eficientes e corretos."_ - Wikipédia

Esse trecho do wikipédia é o suficiente para entendermos o que é um algoritmo. Sabendo disso podemos passar para o algoritmo de estudo, o bubble sort, como o nome diz esse é um algoritmo de ordenação, ou seja o objetivo dele é ordenar uma estrutura de dados como um array. Por exemplo:

```JavaScript
//Um array desordenado
var arr = [ 2, 3, 6, 1, 5, 7]
//Um array ordenado
var arr = [1, 2 , 3, 5, 6, 7]
```
Neste exemplo o array está ordenado de forma crescente mas a ordenação pode ser feita conforme a necessidade.
O bubble sort reorganiza o array para que a ordenação seja feita.

###Como o Bubble sort faz isso?
O bubble sort funciona comparando de dois em dois valores, trocando-os de lugar do maior pro menor ou do menor pro maior por meio de um loop e uma condicional. exemplo:

```JavaScript
var arr = [ 2, 3, 6, 1, 5, 7]
```

- Na primeira comparação ele compara o primeiro e o segundo valor (2 e 3), não há nada para trocar ele passa para a próxima dupla.

- Na segunda volta ele compara o segundo e o terceiro valor (3 e 6), também não precisa ser alterado.

- Na terceira volta compara o terceiro e o quarto valor (6, 1), aqui os valores são trocados assim os organizando (1, 6).

E assim continua até que o maior valor fique totalmente à direita, depois ele volta fazendo de novo a comparação, até o segundo maior valor está organizado, seguindo até que todo o array esteja organizado.
Neste ponto podemos perceber que precisamos de dois loops, um loop para mais interno para comparar todos os valores e reorganizar o array e um mais externo para que ele faça isso para cada item do array.
O código fica assim:

```JavaScript
let lista = [17, 2, 3, 4, 5]
let numero = 0
console.log(lista)
for (let i = 0; i <= lista.length - 1; i++) {
    for (let i = 0; i <= lista.length - 1; i++) {
        if (lista[i] >= lista[i + 1]) {
            numero = lista[i]
            lista[i] = lista[i + 1]
            lista[i + 1] = numero
        }
    }

}
console.log(lista)
```

Fiz uma demonstração, caso queira conferir o link é: https://codepen.io/ddparkas/pen/JjpVJdb

Muito obrigado por ler até aqui abaixo deixo as referências usadas:
https://pt.wikipedia.org/wiki/Algoritmo
https://pt.wikipedia.org/wiki/Bubble_sort
Put an SSH Key into Hashicorp Vault
Tags: vault, terraform, devops, cloud
Published: 2022-10-03 20:41:10

This article assumes that you have set up a minimum vault: https://dev.to/frederickollinger/production-hashicorp-vault-minimal-configuration-485a

## What is a Secrets Engine

A secrets engine is a place to keep secrets. There are a number secrets backend for various reasons. For example, there is a backend for SSL certificates and one of SSH certificates.

## Enable the SSH Secrets Engine

This is a one time operation that the admin must do when setting up a new Vault instance:

```sh
vault secrets enable ssh
```

If 


## Put Existing SSH Key into Vault

Assuming we have an ssh key named fileserver.pem, put it into the vault like so:

```sh
vault write ssh/keys/fileserver key=@fileserver.pem
```
Create a public key:

```
vault write ssh/config/ca generate_signing_key=true
```

If you forget the public key, you can read it later:

```
vault read -field=public_key ssh-user-ca/config/ca
```

## Fin

That's all that's needed to get a key into Vault.

Sometimes things are easier than we imagine if we only have a good guide.

## References

I relied heavily on this excellent post, and I suggest that you read it: https://brian-candler.medium.com/using-hashicorp-vault-as-an-ssh-certificate-authority-14d713673c9a
🛍️ Partenaires Mobilis : API, appli responsive 💻📱 & Open Data 🙀
Tags: java, devops, api, showdev
Published: 2022-10-03 20:34:48

## ❔ A propos

L'OPT-NC met 

> _"Un réseau de boutiques Mobilis à ma disposition"_


[![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nfie1mui5b0ulni89rs1.png)](https://www.opt.nc/particuliers/mobile/un-reseau-de-boutiques-mobilis-ma-disposition)

☝️ Toutefois, le contenu proposé est non interopérable : il n'y a pas d'API ... **pourtant ces données ont un potentiel non néligeable**, comme par exemple des fonctionnalités liées à la Géolocalisation, voire l'intégration à des services tiers...

## 💡 L'idée

Nous avons donc entrepris de transformer ces données en une API interopérable, dynamique et enrichir avec : 

- 🔗 Les liens vers les pages de réseaux sociaux des partenaires (Facebook, Google Maps,...)
- 🗺️ La possibilité de faire des recherches géolocalisées
- 📱💻 Un front-end responsive qui met en valeur les possibilités de l'API 
- 🔌 Des clés interopérables afin que l'on puisse faire le lien avec des SI tiers (par exemple en Open Data [`communes-nc`](https://data.gouv.nc/explore/dataset/communes-nc/information/))
- 🎁 et autres "goodies" à découvrir ☺️


## 🍿 Demo

Assez de blabla stratégique : feu sur la démo qui résume tout cela en 15' 👇

{% youtube u1uKgdzM9sQ %}

## 🔖 Ressources

- 🔗 [Page institutionnelle](https://www.opt.nc/particuliers/mobile/un-reseau-de-boutiques-mobilis-ma-disposition)
- 🛍️ [API sur RapidAPI](https://rapidapi.com/opt-nc-opt-nc-default/api/partenaires-mobilis/details)
- 👨‍🎓 [Tutoriel interactif sur KillerCoda](https://killercoda.com/opt-labs/course/partenaires-mobilis/partenaires-mobilis-discover)
- 🐋 [Image Docker](https://hub.docker.com/r/optnc/api-partenaires-mobilis)
- 🤓 [Source code](https://github.com/opt-nc/api-partenaires-mobilis)
- 📺 [Demo playlist](https://youtube.com/playlist?list=PL7GdrgVAWcDhigJGOLSo87BC0yI2s9SGi)
- 👐 Open Data [`communes-nc`](https://data.gouv.nc/explore/dataset/communes-nc/information/)
- 👐 Open Data [`entreprises-actives-au-ridet`](https://data.gouv.nc/explore/dataset/entreprises-actives-au-ridet/information)
- 👐 Open Data [`etablissements-actifs-au-ridet`](https://data.gouv.nc/explore/dataset/etablissements-actifs-au-ridet/information/)
- 🐦 [`data.gouv.nc`](https://twitter.com/datagouvnc)
What Do Software Developers Actually Do?
Tags: programming, architecture
Published: 2022-10-03 20:27:27

## What Do Software Developers Do? 

To get started with designing Software Solutions, I believe we need a simple, single line definition of what software developers do.

This definition will serve as a foundation we will continually return to in this book to determine where we are at. 
### First Tenet of Software Development 

>  Software developers write code to turn manual processes into automated processes.

That’s really all we do.  

### Does That Seem Too Simple?
You may think that is too simple to cover all software. 
However, if you consider any software, even a game, from an abstract viewpoint, you’ll find that it is really just a manual process that has been turned into an automated process. 


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



## Pac-Man As A Manual Process 
Take a look at the Pac-Man video game.  Originally, Pac-Man could’ve been a board game where players roll dice to move Pac-Man and the ghosts. The player could decide the direction for Pac-Man and you could spin a spinner to get the direction for each ghost movement. As you move the Pac-Man along the path on the board you would simply tally up how many dots he eats with each roll of the die. 
 
Next, you’d roll the dice for each ghost and spin the spinner to indicate movement direction. Each turn the ghosts could possibly land where the Pac-Man token is and destroy him. 
 
Of course, the object would be to get your Pac-Man to eat all of the dots before he is eaten by the ghosts. (See https://en.wikipedia.org/wiki/Pac-Man^ for more on the Pac-Man video game.) 

Now that we know the manual details of how Pac-Man should work, it would be far easier to write the video game. 

The video game simply automates this process. The code is “rolling the dice” and “spinning the spinner” to move the ghosts behind the scenes. It’s also updating the location of the ghosts each time making it seem as if they are moving. You see? It all really is just automation. 

However, you’ve learned another important axiom related to software development. We'll take a look at that second important axiom tomorrow.

## What Do You Think?
Do you agree that Software Development is just [Office Automation](https://en.wikipedia.org/wiki/Office_automation)?
Curios - Web3 and NFT tools for any creator or business
Tags: blockchain, cryptocurrencies, cryptocurrency
Published: 2022-10-03 20:21:39

The easiest way to create and sell NFTs. No coding required, setup in 5 minutes. With a few clicks, deploy smart contracts on Ethereum, Polygon, Avalanche, Solana, and more, with support for ERC721, ERC721A, ERC155, NTTs, royalties, and more. Instantly accept credit card and crypto payments for NTS. Generative Art Random Attributes Packs And much more!

[https://www.curios.com](https://www.curios.com)
Advantages of Django Class Based Views
Tags: django, python, tutorial
Published: 2022-10-03 19:31:32

Class-based views are a great way to keep your code DRY and make it easy to reuse. They allow you to create reusable views that can be used in multiple places in your project, so you don't have to repeat yourself.

Class-based views also help keep your classes small and focused. When you use a class-based view, each part of the view is kept in its own class that has only one responsibility: displaying data. This means that if something changes in one part of the view (like its template), it won't affect other parts of the view.

Finally, class-based views are great if you want more flexibility when working with data because they allow you to pass different pieces of information into them based on what's needed for each individual piece of data displayed on the screen at any given time.
5 razões para usar Linux
Published: 2022-10-03 19:26:58

Hoje vou partilhar com vocês algumas razões de o porquê você já deveria utilizar Linux. Para dev's mais experiêntes este post acaba sendo inútil, já que é provavél que eles conhecem a vantagens de usar. Mas vamos lá.

**1. Open Source**
O Linux é totalmente de código aberto, é gratuito e você pode dar uma olhada em todo o código-fonte. Se você quiser, pode fazer parte da comunidade de Dev's Linux e contribuir com seu próprio código. Se houver algum problema, eles normalmente são corrigidos rapidamente devido ao alto número de pessoas envolvidas.


**2. Segurança**
Comparado ao Windows, o Linux é um sistema operacional mais seguro. Além disso, existem apenas alguns ataques no Linux, porque apenas cerca de 2% dos usuários usam Linux em seus desktops ou laptops.

E quando alguma vulnerabilidades é detectada, ela é rapidamente reportada e por vezes resolvida rapidamente, muitas vezes por membros da comunidade Linux, este é o grande poder do open source.

**3. Ótimo para programar**
O Linux é feito para programadores por programadores e você não precisa mexer muito para obter aplicativos/IDE's relacionados ao desenvolvimento etc. Você pode decidir quando e quais atualizações deseja instalar.

A minha paixão por Linux (Ubuntu especificamente) foi de saber que com apenas algumas linhas no terminal eu conseguia instalar ferramentas para programar de modo fácil e sem muitos rodeios.

**4. Escolha a sua distribuição**
O Linux oferece uma ampla gama de distribuições, como Linux Mint, Ubuntu, Debian,… Você escolhe a distribuição que melhor lhe agradar ou que se adapta as suas necessidades. Além disso, você pode personalizar as interfaces de usuário como você quiser, uma coisa que é um pouco limitante no Windows.

**5. Não precisa de muito**
Para quem tem PC muito antigo e quer aproveitar o máximo, com certeza o Linux é a melhor opção. Para rodar em computadores, o Linux não precisa de muito hardware, mesmo seu ábaco é capaz de rodar um sistema Linux.

**Então devo deixar de usar Windows?**

Claro que não. Com o advento do WSL, você já consegui rodar distribuições Linux (Ubuntu) dentro do ambiente Windows e aproveitar algumas ferramentas que as distribuições oferecem. Mas a minha recomendação é que instales mesmo uma distribuição Linux com o seu S.O principal e se conectar com sistema directamente.

_Achou algum erro? Escreva nos comentários._

LinkedIn: [Martins Gouveia](linkedin.com/in/martins-gouveia/)
Music Monday — What are you listening to? (Instrumental/Focus Edition)
Tags: watercooler, discuss, music
Published: 2022-10-03 19:22:21

_cover image source: [KCLOGG](https://kclogg.tumblr.com/)_ 

**This week, I want us to try and share our favorite instrumentals and/or focus music. Last Friday, I stumbled upon @lit_mgwebi's _[How do you focus??](https://dev.to/lit_mgwebi/how-do-you-focus-2jom)_ and heard a few folks talking about how they like to tune into J Dilla and lofi hip hop when trying to focus. That resonated with me and got me interested in what types of instrumental music other folks use when they need to concentrate. So, let's hear it!**


![J Dilla cartoon jamming on the MPC. Credit goes to Philip De Canaga](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ldq14l9klql2j78lb0i.gif)

<figcaption> Cartoon J Dilla jamming out on the MPC. Image credits go to Philip De Canaga.</figcaption>

***

## How we do 

In this weekly series, folks can chime in and drop links to whatever it is they've been listening to recently + browse others suggestions.

If you like talking about music, consider following the org [#music discussions](https://dev.to/music-discussions) for more conversations about music!

{% embed https://dev.to/music-discussions %}

***

So, how about sharing some instrumentals or whatever the focus music of your choice might be? _Note: you can embed a link to your song using the following syntax `{% embed https://... %}`. This should work for most common platforms!_

I look forward to listening to y'all's suggestions! 👂 🎶
Hacktoberfest 2022
Tags: angular, hacktoberfest, nestjs, opensource
Published: 2022-10-03 18:23:50

We are very excited to join [Hacktoberfest](https://hacktoberfest.com) for the first time with [Ghostfolio](https://ghostfol.io) and meet new and ambitious open-source contributors. Hacktoberfest is a month-long celebration of open-source projects, their maintainers, and the entire community of contributors. Each October, open source maintainers from all over the world give extra attention to new contributors while guiding them through their first pull requests on [GitHub](https://github.com/ghostfolio/ghostfolio).

## About Ghostfolio

Ghostfolio is a modern web application to manage your personal finance. The software presents the current assets in real time and supports the decision making of future investments. Whether rebalancing the asset classes (stocks, ETFs, cryptocurrencies, etc.) of your portfolio or financing an apartment, Ghostfolio offers solid, data-driven decision support.

Ghostfolio is written in [TypeScript](https://www.typescriptlang.org) and organized as an [Nx](https://nx.dev) workspace. The backend is based on [NestJS](https://nestjs.com) using [PostgreSQL](https://www.postgresql.org) as a database together with [Prisma](https://www.prisma.io) and [Redis](https://redis.io) for caching. The frontend is built with [Angular](https://angular.io).

## How to contribute?

Every contribution matters. This can be implementing new features, fixing bugs, refactoring the code, improving the documentation, adding more unit tests, or translating into another language.

Are you not yet familiar with our code base? That is not a problem. We have applied the label `hacktoberfest` to a few [issues](https://github.com/ghostfolio/ghostfolio/issues?q=is%3Aissue+is%3Aopen+label%3Ahacktoberfest) and [ideas](https://github.com/ghostfolio/ghostfolio/discussions?discussions_q=label%3Ahacktoberfest) that are well suited for newcomers.

The official Hacktoberfest website provides some valuable [resources for beginners](https://hacktoberfest.com/participation/#beginner-resources) to start contributing in open source.

## Get support

If you have further questions or ideas, please join our growing [Slack community](https://ghostfolio.slack.com) or get in touch on Twitter [@ghostfolio_](https://twitter.com/ghostfolio_).

We look forward to hearing from you.
Thomas from Ghostfolio
Applications Open for Fall Cohort of the RBC & Battlesnake Developer Fellowship!
Published: 2022-10-03 18:12:25

Applications are now open to join the Fall 2022 cohort of the RBC & Battlesnake Developer Fellowship, a collaborative initiative that supports women and non-binary developers from across Canada in taking the next step in their journey as professional developers—through Battlesnake.

[![Application Deadline October 16th](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/adriwko6rdoqis6h467y.png)](https://fellowship.battlesnake.com/)

## Eligibility Criteria:

- Woman or non-binary developer (includes but not limited to: non-binary, gender non-conforming, transgender, genderfluid, intersex, genderqueer, and agender).
- Currently living, working or studying in Canada.
* Experience with Battlesnake is not required to apply.

### Fellowship recipients gain access to resources including:

- One-on-one mentorship and career development support from experienced industry professionals at [Tech @ RBC](https://play.battlesnake.com/partner/rbc/).
- Access to a growing community of like-minded women and non-binary developers from across Canada working to improve their skills.
- Bi-weekly networking and learning meetups to explore new technologies and build competitive Battlesnakes.
- Exclusive digital rewards, limited edition swag, and educational opportunities to help you explore and learn about new technologies.

[![Fellowship Benefits](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wry3dmgz43iwhcqs5g5v.png)](https://fellowship.battlesnake.com/)

Learn more about the Developer Fellowship, its benefits, and how you can become a member of the Fall 2022 cohort by clicking on the button below.

[![Learn more about the Fellowship](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aaf4b8rj4y8p8vslw6pk.png)](https://fellowship.battlesnake.com/)



🗓️ Have a question about the Fellowship Application process? Feel free to ask us over in the [Battlesnake Discord Community](https://discord.com/channels/689979228841836632/1023992397824282725)!
#AskDev - Using JS shorthand operators for side effects?
Tags: discuss, javascript
Published: 2022-10-03 17:28:23

JavaScript shorthand operators are helpful for making code more concise and readable. They let us convert code like this:

```javascript
let dbName;

if (env === "PROD") {
  dbName = "users";
} else {
  dbName = "users-dev";  
}
```

Into this:

```javascript
const dbName = env === "PROD" ? "users" : "users-dev";
```

So, basically, you can use shorthand operators to evaluate an expression into a value in fewer lines of code.

However, in some tutorials and blog posts scattered through the Internet, I saw shorthand operators being used to invoke functions. Not because they wanted to store the resulting value in a variable, but because they want to run the side effects contained in those functions. Something like this:

```javascript
isUserAdmin ? storeNewData() : sendErrorMessage()
```

To me, this is a weird way of using shorthand operators, because, in my mind, shorthand operators are intented for resolving into a value, not for running side effects conditionally. That syntax works anyway, but somehow it feels wrong to me.

And that's why I'm writing this post, to have a place where we can **respectfully** share our opinion on this. What are your thoughts? Does invoking functions with side effects through shorthand operators makes sense for you? What is your advice on this topic?

Thanks for reading / answering! 😁