teleren/devto huggingface dataset:
Ubuntu VM のセキュアブートの有効化
Tags: ubuntu, efi, grub, secureboot
Published: 2023-04-24 14:29:13

## はじめに

この記事では、[記事: Ubuntu VM の移行 (VMware から Hyper-V へ)](https://shigeyf.dev/posts/enable-secure-boot-in-ubuntu-vm/../migrate-ubuntu-vm-from-vmware-to-hyper-v/)
で説明した以下の移行手順の ステップ 4 について説明します。

1. VMDK 形式の仮想ディスクを VHD/VHDX 形式への変換
2. 新しい仮想マシンを作成 (変換した仮想ディスクをアタッチする)
3. open-vm-tools のアンインストール
4. (オプション) 第2世代 Hyper-V 仮想マシン用の仮想ディスクへ変換
5. (オプション) **Secure Boot の有効化**
6. Hyper-V 統合サービスのインストール

## セキュアブートの有効化

第 2 世代 Hyper-V 仮想マシンの Ubuntu Linux でセキュアブートを有効にするには、
セキュアブートに対応したカーネルと Grub ブートローダーをインストールする必要があります。

EFIブート対応済みの仮想マシンで起動して、以下の手順を実行します。

### 1) Grub EFI パッケージの取得

以下のコマンドを実行し、Grub EFI パッケージをネットワーク経由でダウンロードしインストールします。

VMware 仮想マシンから移行した場合、ネットワーク接続が可能となるように構成変更するのを忘れないでください。

```bash
sudo apt update
sudo apt install grub-efi-amd64 grub-efi-amd64-signed shim-signed -y
```

### 2) Grub EFI のインストール

~~以下のコマンドを実行し、起動ディスクに Grub EFI をインストールします。~~

**[更新:2023/03/25]**

Grub EFI パッケージのインストーラーにより、
自動的に Grub ブートローダーの更新が実行されるため、以下のコマンドの実行は不要です。

```bash
sudo grub-install --target=x86_64-efi --uefi-secure-boot /dev/sda
sudo grub-install --recheck --uefi-secure-boot /dev/sda
sudo update-grub2
```

### 3) セキュアブートの有効化

セキュアブート対応の Grub EFI ブートローダーのインストールが完了したら、
ライブサーバーをシャットダウンして、仮想マシンの設定を変更します。

仮想マシンの設定から、**[セキュリティ]** -> **[セキュアブートを有効にする]**　のチェックボックスを有効にし、
テンプレートに **[Microsoft UEFI 証明機関]** を選択します。

また、仮想マシンの設定の**[ファームウェア]**の項目で
`grubx64.efi` の代わりに `shimx64.efi` ファイルがブートローダーとして設定されていることを確認します。

### 正常に起動しない場合

`bad shim signature` というメッセージが表示される場合、kernel が最新でないケースが考えられます。

以下のコマンドを実行して、kernel を含む更新を最新の状態にアップグレードすると正常に起動するでしょう。

```bash
apt upgrade -y
```

## セキュアブートが有効になっているかどうかの確認方法

以下のコマンドを実行して、セキュアブートが有効になっているかどうかを確認できます。

```bash
sudo dmesg | grep secureboot
```

"Secure boot enabled" というログが表示されていれば、セキュアブートが有効になっています。

## 最後に

この記事では、第 2 世代の Hyper-V 仮想マシンで Ubuntu Linux のセキュアブートを有効にする方法を説明しました。

Ubuntu Linux 上のサービスでセキュアブートを有効にすると、署名のないドライバーなどを使うことができなくなります。
セキュアな環境を構築できる一方で、セキュリティの考慮がないドライバーなどの利用の際に思わぬ問題に遭遇する場合もあります。
その際には、セキュアブートを無効にして動作を確認することで、問題の切り分けができます。
Como variáveis funcionam por debaixo dos panos: Uma breve explicação com Javascript.
Tags: braziliandevs, javascript, programming
Published: 2023-04-24 14:13:13

Nesse artigo tentarei dar uma breve explicação de como as variáveis funcionam por debaixo dos panos, segue a explicação logo a abaixo.


![Lobo coringando por não entender javascript](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/04u6c2cmlx2daeg502jm.png)


&nbsp;
As variáveis são parte essencial no desenvolvimento de códigos para desenvolvimento web e no geral, elas são responsáveis por guardar dados que poderão ser manipulados nas nossas aplicações e apps, mas a dúvida que fica e como as variáveis realmente funcionam por debaixo dos panos???

&nbsp;
##Variáveis


Definição Técnica:
Em programação, as variáveis são pequenos espaços alocados na memória. 


![Ilustração de como as variáveis funcionam](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8guiiu5c7e8rfwoaw0w1.png)



Seguindo a ilustração acima podemos perceber que dada à variável declarada ela aloca uma parte da memória do computador, essa parte além de possuir o dado como valor ela possui um endereço, mas isso e assunto para outro artigo.

&nbsp;
##Declaração de variáveis

Para visualizar a sintaxe das variáveis em javascript, segue os exemplos abaixo.

![Sintaxe de declaração de variáveis ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pzr8aj9rroeh0id3844l.png)

##Onde as variáveis são armazenadas?
 
As variáveis são alocadas na memória RAM com um espaço reservado de tamanho apropriado, onde seus valores são armazenados usando endereços de memória únicos. Isso permite o acesso eficiente aos dados durante a execução do programa.

&nbsp;
![Alocação de variáveis na memória](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/87uqa83x7pj1iep8khp7.png)


&nbsp;
Então essa foi uma breve explicação sobre como as variáveis funcionam por debaixo dos panos, e o meu primeiro artigo, então espero que seja o primeiro de muitos!

![Homem parcialmente lobo mais feliz por entender um pouco de javascript](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h2ae66oozjhwjfvda83u.png)

### Minhas redes sócias e outros! 
[Meu LinkedIn](https://www.linkedin.com/in/franciele-borges/)
[Meu Instagram](https://www.instagram.com/franb0rges.dev/)
[Meu GitHub](https://github.com/franSborges)
React Native vs Flutter — which one to choose for your project?
Tags: flutter, reactnative, beginners
Published: 2023-04-24 14:09:43


As the demand for mobile applications continues to grow rapidly, developers are constantly seeking efficient and effective ways to create high-quality, cross-platform mobile applications. Two of the most popular frameworks for building mobile apps are React Native and Flutter. While both of these frameworks have their unique strengths and weaknesses, choosing the right one for your project can make all the difference in its success. In this article, we will compare React Native and Flutter, discussing their features, benefits, and drawbacks to help you make an informed decision on which one to choose for your project.


Read the article on [Liki Blog](https://likims.com/blog/react-native-vs-flutter-which-to-choose-comparison-pros-and-cons-use-cases).
What are your goals for the week of April 24?
Tags: motivation, discuss, interview, career
Published: 2023-04-24 14:07:10

## What are your goals for this week?
 
- What are you building? 
- What will be a good result by week's end?
- Are you attending any events this week?
- Did you meet your goals last week?


I'll start with how I did last week.

### Last Week's Goals

- [:white_check_mark:] Continue Job Search. Did Interview prep for an interview this week.  
- [:x:] Blog. Wrote rough ideal for one.
- [:white_check_mark:] Interview prep going to do some coding exercises and reading.
- [:x:] Finish portfolio refactor.
- [:white_check_mark:]Events
  * [:white_check_mark:]Virtually Attend ADA & Web Accessibility seminar.
  * [:white_check_mark:] Attend [PluralSight Tech Skills](https://www.pluralsight.com/techskillsday) Day Thursday April 20. Looks like the Key Note overlaps with Virtual Coffee. I have to make a decision. 
  * [:x:] Attend Virtual Coffee Thursday. Attended Plurasight event. 
* [:x:] Other VC events if I can. There was a Lunch and learn Friday. But That turned out to be a short day a my son's school and pick up conflicted.


### This Week's Goals

- Continue Job Search.
  * Do great on interview get to next round.
  * Job Seminar
- Interview prep going to do some coding exercises and reading.
- Finish portfolio refactor.
- Blog
- Events
  * Attend Virtual Coffee Thursday. 
  * Other VC events if I can.

### Your Goals for the week


You've read my goals so I'll throw that question back to you.

What are your goals for the week?

```
-$JarvisScript git push
Rockin’ the Code World with Me!
Tags: development, podcast, video, lowcode
Published: 2024-01-25 20:25:39

---
title: Rockin’ the Code World with Me!
published: true
date: 2023-04-24 14:00:00 UTC
tags: Development,Podcasts,Video,lowcode
canonical_url: https://barretblake.dev/2023/04/rockin-the-code-world-with-me/?utm_source=rss&utm_medium=rss&utm_campaign=rockin-the-code-world-with-me
---

Just in case you missed the live interview with me on Rockin’ the Code World, you can watch it below. Get the [details here](https://dotnettips.wordpress.com/2023/03/27/rockin-the-code-world-special-guest-barret-blake/).

<iframe title="Rockin’ The Code World with dotNetDave ft. Barret Blake Ep. 77" width="640" height="360" src="https://www.youtube.com/embed/2cumA5Zr1BY?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>

The post [Rockin’ the Code World with Me!](https://barretblake.dev/2023/04/rockin-the-code-world-with-me/) first appeared on [Barret Codes](https://barretblake.dev).
The Only Situation To Use ‘==’ In JavaScript
Tags: javascript, webdev, beginners, tutorial
Published: 2023-04-24 13:53:38

>  Ever pondered when to use **‘==’** in JavaScript?
Or ever had the idea that one should always use **‘===’** in JavaScript?
Hopefully, by reading till the end of this article, you learned something new!

![‘==’ in JavaScript](https://cdn-images-1.medium.com/max/2160/1*wQvuYgDodBph-d7_AyQKWw.png)

## Why?

You might be thinking, why should one ever consider the scenario to use **‘==’**? Just use **‘===’** all the time to ensure consistent and expected developer behavior, this also prevents unexpected bugs from occurring.

And if you’re wondering why it’s bad to use **‘==’**, the main reason is that with **‘==’**, **JavaScript** does a **Type Coercion.**
If you do not know what that is or want to learn more about **Type Coercion,** you can read about it [here.](https://dev.to/morninglit/the-full-practical-guide-to-type-coercion-in-javascript-beware-of-these-3-common-mistakes-1f7p)
{% embed https://dev.to/morninglit/the-full-practical-guide-to-type-coercion-in-javascript-beware-of-these-3-common-mistakes-1f7p %}

---

Well, the main and only reason to utilize **‘==’** in JavaScript is to check for **null** and **undefined** at the same time.

```javascript
if (a == null)
if (a == undefined)
// both methods are equivalent to checking the variable 'a' 
// with null and undefined at the same time.
    
if (a === null || a === undefined) 
// the equivalence to writing this out
```

Thus, if you have to do a check for **null** and **undefined** at the same time, consider using the **‘==’.** This does a shortcut instead of the otherwise, lengthier method of checking for both.

---

>  But **wait!** Ever wondered what is the difference between **null** and **undefined**?
And when to use which?

Know that JavaScript will never set any value to **null**. Both **null** and **undefined** represent the absence of value.

Thus, the only difference between the two is that, whenever you want to set a variable to **undefined** or **null**, you should always set it to **null**. Because it helps you during **debugging**.

If you ever encounter a **null** value, this means that somewhere along your code, you had manually set the value to **null** then. Meanwhile, for **undefined**, you do not know whether **you** or **JavaScript** _(in other words, not giving it a value when initializing)_ had set the value to be **undefined**.

---

Just as a bonus, [here is the pictorial representation](https://dorey.github.io/JavaScript-Equality-Table/) of what values are equal to others for **‘==’**.

![Equality Table for ‘==’](https://cdn-images-1.medium.com/max/2000/0*gCmJISANYPDHTKgZ.png)

As you can see, there is not much value for using **‘==’**, besides checking for **null** and **undefined**.

---

If you felt that you have learned something new, do feel free to **follow** 🥰, drop a **react 💖** or write a **comment** ✍️!
It helps makes me create and share more valuable content for **you** to become a better **Web Developer!** 🤗
Flatiron Phase4
Tags: qubits, quantumainia
Published: 2023-04-24 13:53:36

Introduction to Quantum Computing

Quantum computing is something that will evolve into the most efficient and large scale means of computation, it undoubtedly has the potential to revolutionize the way we approach many computational problems. The reason why its all the rage now (less so since the AI boom)is because unlike classical computers, which store information in bits that can be either 0 or 1, quantum computers use quantum bits, or qubits, which can exist in a superposition of states that allow for more complex calculations. A normal bit is like a switch it has an on and an  off, qubits on the other hand have (arguably) a 3 dimensional possibility of positions to store data. Having this capability will allow us to optimize problem solving because a big aspect of solving many data structure errors we see involves searching for the best solution from all the possible solutions. Classical computing is a much slower at this than quantum. 

Another area where quantum computing has the potential to make a big impact is in the field of cryptography. Quantum computers are amazing at handling large number inputs and data fields, which is a key part of many encryption algorithms. This could potentially break some of the most commonly used encryption methods, leading to a need for new quantum-resistant encryption methods.

Despite the potential benefits of quantum computing, there are still many challenges to be overcome. One of the biggest challenges is dealing with the effects of noise and other sources of interference on qubits, which can cause errors in calculations. This is due to something called quantum entanglement ( but this also is how quantum circuits are even possible) a single error can have major downstream effects on the entire system, leading to a loss of coherence and errors in calculations. This is one of the key reasons why quantum error correction is such an active area of research in the field.

"Entanglement occurs when two or more qubits become correlated in a way that cannot be explained by classical physics. This means that when one qubit is measured, it affects the state of the other qubit, even if they are physically separated by a large distance.

In quantum computing, entanglement can be used to perform operations on multiple qubits simultaneously, which can lead to significant speedups over classical algorithms. For example, the famous Shor's algorithm for factoring large numbers uses entanglement to perform many computations in parallel, leading to an exponential speedup over the best-known classical algorithms." - ChatGPT3
TikTok-Videos herunterladen
Published: 2023-04-24 13:53:28

Guten Tag! Ich bin auf der Suche nach einer App, mit der ich TikTok-Videos herunterladen kann. Habt ihr Empfehlungen für mich? Ich habe bereits einige Apps ausprobiert, aber keine von ihnen hat wirklich gut funktioniert. Könnt ihr mir sagen, welche Apps ihr verwendet und ob sie gut sind? Vielen Dank!
Which DevOps stage is slowing down your delivery?
Tags: devops, learning, webinar
Published: 2023-04-24 13:48:58

We're hosting a webinar on the value of having end-to-end visibility with a DevOps platform.

Disclaimed: We'll show our devops platform as an example but it's not a sales pitch. With every webinar we try to provide value to devops community. 

Here's [the event URL](https://www.opsera.io/webinars/optimize-all-stages-of-devops-lifecycle-with-a-value-stream-management-platform?utm_campaign=Insights%20-%20VSM&utm_source=devto) in case you'd like to learn more.
Design your own ChatGPT Website Chatbot
Tags: webdev, css, tutorial, beginners
Published: 2023-04-24 13:44:27

One of the unique things about our [ChatGPT website chatbot technology](https://ainiro.io) is how much you can customise it. It's got settings for _everything_, custom designs being one of the settings you can apply.

In the video below I am showing you how to create a custom design for your chatbot. The process is very easy, you start out with any of the existing designs and simply copy and paste it into a new file, at which point you'll rapidly understand the CSS, allowing you to customise it any ways you want. The entire design is some 250 lines of CSS code, so it's easily understood if you know CSS from before.

{% embed https://www.youtube.com/watch?v=U7odG6ZOp0E %}

The process is quite simple once you realise what folder to put your file in. The correct folder is `/etc/system/openai/css/chat/`. Then just give your CSS file a name such as `howdy.css`, at which point you can reference this CSS file in the query parameters for your chatbot JavaScript inclusion as `css=howdy`. Below is a screenshot of how you can use Hyper IDE to edit your CSS.

![Custom ChatGPT CSS design](https://ainiro.io/assets/images/custom-chatgpt-design.jpeg)

This process allows you to move the chatbot button. Maybe your bottom/right corner is too noisy? Maybe you want to have the button in the top/right corner? Maybe you want to have the chatbot open in fullscreen mode on phones? Whatever you can do with CSS you can also do to your chatbot.

**Notice** - If you're new to AINIRO, you might want to check out [how to get ChatGPT website chatbot](https://ainiro.io/blog/how-to-get-chatgpt-on-your-website) first.

## Become a partner of AINIRO

You can create as many themes as you wish using the above process, giving you a _"suite"_ of chatbot themes to show to clients. For a web design company this might provide a golden opportunity for some extra income. For partners doing all the setup, selling and 1st line support, we have a 50/50 net revenue share model, where you can almost _"white label"_ our entire product. If you're interested in this, [reach out to us](https://ainiro.io/contact-us#demo) and let's have a meeting. For partners we provide all the training required to administrate your clients entirely by yourself, implying you get to keep the ownership of the client, while we simply deliver great technology to you, providing you with an additional source of revenue.

Later we will even implement tracking links, allowing you to share articles and pages from our website, resulting in that the client becomes associated with you, such that as they contact _"us"_ they're actually contacting _you_!

Rome wasn't built in one day, and it surely wasn't built by a small group of people either. Our strategy is to rely upon close partners to sell and support clients, and in return we're willing to share our entire net revenue 50/50 with you if you're interested. Notice, this is _recurring_ revenue, and _subscription-based_ payments, implying you won't get much initially, but it'll keep coming, once every month, for the lifetime of the client.
How to simplify your unit test?
Tags: python, productivity, tutorial
Published: 2023-04-24 13:31:00

If I say that I know something magic which will simplify your unit tests, do you believe me?

You should, because we will see it today. And this magic is call **parametrized tests**

---

## What are parametrized tests?
> Parametrized tests are unit tests to which we will inject variables as parameters, which will make it possible to replay the same test with another context.

---

## How does it work?
Suppose that we want to test the following function :

```python
def is_positif_strict(num_to_test: int) -> bool:
	return num_to_test > 0
```

Before parametrized tests, to test it we should either:
- create a lot of functions for each sub test
- create one big function which will execute all the tests

We are not lying or hiding something here, the first solution is painful and is less maintainable, the second one is painful is a subtest fail and you have to understand which one and why. 

But now with  [**Pytest**](https://docs.pytest.org/), you can just declare your tests like this
```python
import pytest

testdata = [
    (-1, False),
    (0, False),
    (1, True),
]

@pytest.mark.parametrize("num_to_test, expected", testdata)
def test_is_positif_strict(num_to_test, expected):
    assert is_positif_strict() == expected
```

In this example, we saw that we add the annotation `@pytest.mark.parametrize` with two parameters:
- **a string containing the list of variable names we want to inject** *(variable names  separated by a comma)*
- **an array containing all the values we want to inject** *(If you have multiple parameters, it will be an array of tuples)*

Now, with this new knowledge, if you have to write unit tests, you will see that it will be far easier and more simple to read and maintain.

For the one who already used an array and did a loop on it in a single unit test, here is what you gain : **visibility**.

Contrary to the loop in your unit test, each entry in the array **will generate a dedicated  unit test**. So if you have 40 use cases to test, it will generate 40 unit tests in your report. And it's really helpful if some of those a failing.

For the one who are not already convinced, think about testing regexes. For this kind of methods, you ALWAYS have a lot of use cases. As a result, a tool like that will make your developer's life more enjoyable!

---

If you are not using Python, you must know that you can do the same thing in Java or in Go.
So, if you are interested by this, let me know in the comments!

I hope it will help you! 🍺

---

<center><h3>You want to support me?</h3></center>
<a href="https://www.buymeacoffee.com/mxguilbert7" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>
Comment simplifier vos tests unitaires ?
Tags: python, productivity, french, tutorial
Published: 2023-04-24 13:30:00

Si je vous disais qu'il existait une magie qui permet de simplifier vos tests unitaires, est-ce que vous allez me croire?

Vous devriez, car c'est quelque chose qu'on va voir aujourd'hui ensemble, et cette magie s'appelle : **les tests paramétrisés**.

---

## Qu'est-ce que les tests paramétrisés?
> Les tests paramétrisés sont des tests unitaires auxquels on va injecter des variables en paramètre, ce qui va permettre de rejouer le même test avec un contexte différent.

---

## Comment ça fonctionne ?
Imagineons que vous voulez tester la fonction suivante :

```python
def is_positif_strict(num_to_test: int) -> bool:
	return num_to_test > 0
```

Pour pouvoir le tester, vous deviez créer soit :
- un ensemble de fonctions avec chacun des cas de tests
- une fonction qui exécutait tous vos tests

On ne va pas se le cacher, la première solution est chiante et réduit la maintenabilité, la deuxième vous rend la tâche compliquée savoir quel sous test a échoué.

Maintenant, grâce à [**Pytest**](https://docs.pytest.org/), vous pouvez juste déclarez vos tests comme suit 
```python
import pytest

testdata = [
    (-1, False),
    (0, False),
    (1, True),
]

@pytest.mark.parametrize("num_to_test, expected", testdata)
def test_is_positif_strict(num_to_test, expected):
    assert is_positif_strict() == expected
```

Dans l'exemple précédent,  on voit donc l'annotation `@pytest.mark.parametrize` être rajoutée avec deux paramètres :
- **un string contenant la liste des noms des variables à injecter**
- **un tableau contenant l'ensemble des variables à injecter**

En arrivant là, si vous réécriviez vos tests pour chacun des cas, vous voyez une belle amélioration et simplification de votre code.

Ceux qui pouvait déjà faire un tableau et boucler dessus dans une fonction, voici ce que ça vous apporte : **de la visibilité**.

En effet, contrairement au fait de faire une boucle dans votre méthode de test, chacune des injections va **générer un test unitaire dédié**. Du coup, si vous avez 40 cas différents à tester, ça va vous générer 40 tests unitaires dans votre compte rendu. **Ce qui est très utile quand l'un de ces tests se met à échouer.**

Pour ceux qui ne seraient pas encore convaincus, penser à vos méthodes contenant des regex. Ce sont toujours des méthodes pour lesquelles il y a PLEIN de cas à tester. Par conséquent, un tel outil va vous faciliter grandement la vie.

---

Si vous n'utilisez pas python, sachez qu'il est possible de faire la même chose en Java ou en Go. *(Bien évidemment pas avec la même librairie)* Donc si vous êtes intéressés par cela, vous devriez trouver comment faire assez facilement.

J'espère que ça vous aidera! 🍺

---

<center><h3>Vous voulez me supporter?</h3></center>
<a href="https://www.buymeacoffee.com/mxguilbert7" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>