teleren/devto huggingface dataset:
Adding hardware RNG to micropyton on ESP32
Tags: esp32, micropython, rng, hwrng
Published: 2023-08-21 21:22:11

So began my quest. The ESP32 has hardware RNG support. And it runs Micropython, the best of all unless you really need a realtime-OS like Zephyr.

==Background
While busy studying RNG's, and hardware RNG's in particular (as anything else is considered pseudo-RNG). I was implementing such as a hardware RNG on a PC, using microphone input as 'atmospheric noise'. Aka entropy to seed a hardware RNG. Which worked, just fine to be honest. Take samples, take checksum, parity, hash, or anything you fancy. And have perfect random data. NIST tests confirm. It is adequate as entropy, and random.

Comes along this ESP32 i have for an entirely different and currently undisclosed project. But i do recall it having hardware RNG. So i dive into it. The hardware source of entropy is either radio frequency (RF), as in, 'enable wifi or bluetooth'. Or use an (internal) ADC on the (internal) voltage reference as source of entropy. 

The rest of Espressif's documentation is unfortunately not that clear. Despite 200+ GPT4 queries and counting. As we understood it so far: When the Radio Frequency (RF) is enabled (WiFi, Bluetooth), we have plenty entropy. As alternative the internal voltage reference can be used. How to enable/disable either or both is not clear.

So, Selecting either, or testing which is used, is not provided by api.

Long story short. I spend some time to fabricate 2 dozen lines of code to modify micropython, to implement hardware RNG. It seems to work so far, but as said, there are side issues we need to address. 

Not being able to use ADC is sometimes inacceptable. Forcing RF is acceptable from a software perspective, but draws extra power. And there seem no trivial way to select either. And there may be issues using RF while using it as source of entropy.

Anyways, i'm working on it. The current code https://github.com/yoctobyte/micropython/tree/esp32_hardware_rng exposes an (extra) 'esp32.rng()' function that returns a signed 32-bit integer. I intend to add functionality to enable and disable this 'bootloader_rng*' functionalitym, and implement the 'fill_buffer'.

But given dependences. I now understand why uP is hesitant to implement hardware RNG. You can have it. If. And if. And if not else. So when Both. Are undocumented.

Maybe i should learn to read Chinese so i can read Expressif's ESP32 datasheet in its native language. 

Last not least, some benchmarks. It seems we can get about >90kB/s random data from the ESP32 using micropython. That is well within serial communication limits (about 1Mbs). It seems the expressif's random function is the main speed limitation. We can expect a maximum of about 1Mbps hardware random data out of an ESP32.

To be continued.
Deprecated HTML Tags for Better SEO
Tags: seo, html, web3, webdev
Published: 2023-08-21 21:09:24

## Understanding Outdated HTML elements

In the fast-paced world of web development, keeping up with the latest standards is crucial.

Outdated HTML elements may not only affect your website’s appearance but also impact its performance, accessibility, and SEO.

This article will guide you through identifying and replacing deprecated tags to ensure your web content is top-notch.

Deprecated tags are HTML tags that have been labeled as outdated by the official HTML specifications, such as those provided by the W3C (World Wide Web Consortium).

## Deprecated HTML Tags and Alternatives
1- center Tag
2- font Tag
3- strike Tag
4- acronym Tag
5- applet Tag
6- frame and frameset Tags
7- dir Tag
8- marquee Tag
9- blink Tag
10- basefont Tag

## Why Should You Avoid Deprecated Tags?

Using deprecated HTML tags can lead to various issues, such as inconsistent rendering across different browsers, poor accessibility for users with disabilities, and negative impacts on SEO rankings. Embracing modern HTML and CSS practices ensures a smoother user experience and better website performance.

## Conclusion about Deprecated HTML elements

In the ever-evolving landscape of web development, staying current is key to delivering exceptional user experiences.

By phasing out **[deprecated HTML tags](https://noobizdev.tech/replacing-deprecated-html-tags-for-better-seo-performance-with-examples/)** and adopting modern practices, you ensure your website remains accessible, visually appealing, and optimized for search engines.
Why does my microk8s AdGuard Home container need to be reconfigured every time it shuts down?
Tags: kubernetes, ubuntuserver, microk8s, kubernetespvc
Published: 2023-08-21 21:04:56

Why does my microk8s AdGuard Home container need to be reconfigured every time it shuts down?
---------------------------------------------------------------------------------------------

As a software developer, you may have encountered the frustrating issue of having to reconfigure your microk8s AdGuard Home container every time it shuts down. This can be a time-consuming and tedious task, but understanding the reasons behind it can help you find a solution. Let's dive into why this happens and explore potential ways to avoid it.

First, it's important to note that containers are designed to be ephemeral, meaning they are meant to be easily created, destroyed, and replaced. When a container shuts down, any changes made within it are typically lost. This includes any configurations you may have made to your AdGuard Home container.

So why does this happen?

One possible reason is that the configuration files for your AdGuard Home container are not being persisted outside the container itself. When the container shuts down, any changes made to these files are lost. To avoid this, you need to ensure that the configuration files are saved to a persistent storage location, such as a volume mount or a shared network drive.

Another reason could be that your container is not being shut down gracefully. If the container is abruptly terminated or forcefully stopped, it may not have a chance to save its configuration changes. To mitigate this, make sure to properly stop and restart your container using the appropriate commands or tools.

Additionally, it's possible that your AdGuard Home container is using default settings that are not suitable for your specific needs. This could result in the need for reconfiguration every time it shuts down. To address this, consider creating a custom configuration file that includes all the necessary settings for your environment. By using this custom configuration file, you can easily recreate your AdGuard Home container with the desired settings without the need for manual reconfiguration.

While it may be frustrating to constantly reconfigure your AdGuard Home container, it's important to remember that containers are designed to be lightweight and easily replaceable. By understanding the reasons behind this issue and taking the appropriate steps to mitigate it, you can streamline your development process and avoid unnecessary reconfiguration.

So, next time you find yourself reconfiguring your microk8s AdGuard Home container, take a moment to assess the possible causes and consider implementing the solutions discussed here. Happy containerizing!

### References:

*   [Kubernetes - Volumes](https://kubernetes.io/docs/concepts/storage/volumes/)
*   [Docker - Stop command](https://docs.docker.com/engine/reference/commandline/stop/)
*   [Docker Compose documentation](https://docs.docker.com/compose/)
Coding bootcamp: full-time or part-time?
Tags: codenewbie, learning, help
Published: 2023-08-21 21:03:52

Hey everyone,

Newbie here, considering a career change into coding. For the last couple of years I've been running a blog and trying to make money from it -- it's been challenging, and rewarding, but ultimately it hasn't been sustainable to do this full-time.

In recent days I've been researching the world of web development -- from which languages to learn, and self-learning study paths vs coding bootcamps. I think I would want to be a part of an in-person bootcamp for the support & accountability, of which Le Wagon appears to be one of the most reputable here in London.

My questions is as follows... there is a full-time and a part-time option, I believe one of which is over 2 months (40hrs a week) and the other over 6 months (15hrs a week).

In theory, I am available full-time, and it's tempting to go for that option so I can be fully-fledged and working as quickly as possible.

However, a part of me is more drawn to the part-time option. I wonder if this would not only be less intense (long days commuting to/from London, something I've not done for a while), but also allow me to spend more time on each module, and practising coding beyond time spent in the classroom. In other words, I think it would let me become a more rounded developer with stronger foundations in place. It seems to me that studying part-time would be combining 'bootcamp learning' with 'self-study'; I like the idea of having the structure of a classroom environment, combined with my own learning to solidify the theory & get to practice coding -- which I understand is the key to actually being a developer. I also imagine (I would hope!) my coding portfolio would be more extensive after 6 months, than just 2.

In fact, aside from the shorter time taken to complete the course, I'm not sure what other advantages there are for choosing the full-time option...

And here's the Le Wagon 'Web Development' syllabus.

I'd be curious to hear from any current developers or developers-in-training...

1) What are your thoughts on studying full-time vs part-time?

2) Does the Le Wagon syllabus look decent? (it's highly rated by attendees, averaging 4.8/5 stars)

Thanks for reading -- I'm grateful for any thoughts/suggestions 🙏
React Custom Hook: useMediaQuery
Tags: webdev, javascript, programming, react
Published: 2023-08-21 21:00:00

In this article series, we embark on a journey through the realm of custom React hooks, discovering their immense potential for elevating your development projects. Our focus today is on the "useMediaQuery" hook, one of the many carefully crafted hooks available in the collection of React custom hooks.

Github: https://github.com/sergeyleschev/react-custom-hooks
```javascript
import { useState, useEffect } from "react"
import useEventListener from "../useEventListener/useEventListener"

export default function useMediaQuery(mediaQuery) {
    const [isMatch, setIsMatch] = useState(false)
    const [mediaQueryList, setMediaQueryList] = useState(null)
    useEffect(() => {
        const list = window.matchMedia(mediaQuery)
        setMediaQueryList(list)
        setIsMatch(list.matches)
    }, [mediaQuery])
    useEventListener("change", e => setIsMatch(e.matches), mediaQueryList)
    return isMatch
}
```
The **useMediaQuery** hook allows you to dynamically update your UI based on a given media query. Simply pass in the desired media query as a parameter, and the hook will return a boolean value indicating whether the media query matches the current viewport size.

One of the key advantages of this custom hook is its simplicity and reusability. With just a few lines of code, you can effortlessly implement responsive behavior throughout your application. Whether you need to conditionally render components, apply specific styles, or trigger different functionality based on screen size, useMediaQuery has got you covered.
```javascript
import useMediaQuery from "./useMediaQuery"

export default function MediaQueryComponent() {
    const isLarge = useMediaQuery("(min-width: 200px)")
    return <div>Large: {isLarge.toString()}</div>
}
```
This hook is not limited to specific use cases; it can be utilized in a variety of scenarios. For instance, you can use it to dynamically adjust the layout of a navigation menu, hide or show certain elements based on screen size, or even optimize the loading of data based on the available space. The possibilities are endless, and the _useMediaQuery_ hook empowers you to deliver a seamless user experience across different devices and screen sizes.

Full Version | React Custom Hooks:
https://dev.to/sergeyleschev/supercharge-your-react-projects-with-custom-hooks-pl4
"X" (Twitter) Ad Revenue Generator
Tags: twitter, socialmedia
Published: 2023-08-21 20:52:25

Hi folks,

I've created a screenshot generator where you can create your own Twitter Ad Revenue notifications to share with your followers and shock them. 

➡️ [Twitter - X Ad Revenue Generator](https://10015.io/tools/twitter-ad-revenue-generator)

Here is an example.

![X Ad Revenue Generator](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e63uite7vtksllg1hfdh.jpg)

You can use your own custom wallpapers to make it more real.

Have fun!
Automate your requirements.txt with few lines of code
Tags: python, fastapi, webdev, programming
Published: 2023-08-21 20:21:06

We all get an one common problem with what's libraries we use in our python project.Today I discovered a very simple solution.Yeah, you can also follow this process to make your SDL ( Software Development Life Cycle).I hope it will be gotcha for you. 


I hope as a python developer you are familiar with **pip**. 
Wow! you are almost done.

1. Step 1: Install pip-tools 

```
pip install pip-tools
```

2. Step 2: Create a file in root directory with name requirements.in  and list down libraries what you want to install. 

3. Step 3: Compile your requirements.in file with pip-tools

```
 pip-compile requirements.in
```


4. Final step: Use known to all of you 

```
pip install -r requirements.txt 
```

Done. You get all the libraries you need at all in you requiements.txt file. 

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


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


Bye . Happy Coding !! :)
GPT-Synthesizer
Tags: gpt3, ai, programming
Published: 2023-08-21 20:14:06

GPT-Synthesizer is a free open-source tool, under MIT license, that can help with your software design and code generation for personal or commercial use:

https://github.com/RoboCoachTechnologies/GPT-Synthesizer

GPT Synthesizer is designed for software generation using Large Language Models (LLMs), including among others, GPT, BERT, LLaMA, and Chinchilla. As of now, GPT 3.5 is its default LLM, because it provides a reasonable balance of complexity and cost for generating a large and complex codebase.

If you intend to write a rather small and straight forward software program, you can directly set your prompt in GPT (or other LLMs for that matter), and get your desired output without needing GPT Synthesizer or any other third-party tools. However, if your intended software task is complex, or if you have no idea where to start and how to describe it, GPT Synthesizer can be your best friend. GPT-Synthesizer walks you through the problem statement and explores the design space with you through a carefully moderated interview process.

**What makes GPT Synthesizer unique?**

The design philosophy of GPT Synthesizer is rooted in the core, and rather contrarian, belief that a single prompt is not enough to build a complete codebase for a complex software. This is mainly due to the fact that, even in the presence of powerful LLMs, there are still many crucial details in the design specification which cannot be effectively captured in a single prompt. Attempting to include every bit of detail in a single prompt, if not impossible, would cause losing efficiency of the LLM engine. Powered by LangChain, GPT Synthesizer captures the design specification, step by step, through an AI-directed dialogue that explores the design space with the user.

GPT Synthesizer interprets the initial prompt as a high-level description of a programming task. Then, through a process, which we name “prompt synthesis”, GPT Synthesizer compiles the initial prompt into multiple program components that the user might need for implementation. This step essentially turns 'unknown unknowns' into 'known unknowns', which can be very helpful for novice programmers who want to understand an overall flow of their desired implementation. Next, GPT Synthesizer and the user collaboratively find out the design details that will be used in the implementation of each program component.

Different users might prefer different levels of interactivity depending on their unique skill set, their level of expertise, as well as the complexity of the task at hand. GPT Synthesizer distinguishes itself from other LLM-based code generation tools by finding the right balance between user participation and AI autonomy.

**Demos:**
GPT Sythesizer is easy to use. It provides you with an intuitive AI assistant in your command-line interface. Watch these demos to see how GPT Synthesizer works:

[GPT-Synthesizer Release v0.0.2 demo: a snake game](https://www.youtube.com/watch?v=zFJDQOtIFGA)
[GPT-Synthesizer Release v0.0.3 demo: a tic-tac-toe game](https://www.youtube.com/watch?v=_JdmzpXLyE0)
The 63rd Day of the 100 Days of Code Challenge
Published: 2023-08-21 20:07:56

Hey everyone!

Today was a day of exploring the topic of sending DMTF tones during an active phone call. Shouldn't be too difficult, but it does seem that way when working in a Twilio environment. I'd already built something that should've work, but before testing, I came across a long discussion addressing this issue case that concluded this wouldn't be possible with streaming audio chunks containing DMTF tones. One would have to mess with the stream and re-connect, not something I'm aiming towards.

Shifted to Vonage, but unable to make the call for some reason even though I'm getting a "call started" status. I'm hoping to make this all work tomorrow, it's a bit frustrating but nothing serious. Happy coding everyone!
Fix "aclocal: not found" Error on Ubuntu/Linux
Published: 2023-08-21 20:05:45

Encountered the frustrating "aclocal: not found" error while running a script on Ubuntu/Linux? No worries, here's a quick guide to get you back on track.

## Understanding the Error

When you see an error message like the one below while running a script, it means that the 'aclocal' command is missing:

```bash
./autogen.sh: 11: aclocal: not found
```

## Step 1: Install Required Packages

To fix this issue, you need to install the necessary packages: `autotools-dev` and `automake`. Open a terminal and run:

```bash
$ sudo apt-get update
$ sudo apt-get install autotools-dev
$ sudo apt-get install automake
```

## Step 2: Execute the Script Again

Once the packages are installed, run your script again. You should see it executing successfully this time:

```bash
$ ./autogen.sh
+ test -d Tools/config
+ aclocal -I Tools/config
+ autoheader
+ automake --add-missing --copy --force-missing
...
```

## Conclusion

The "aclocal: not found" error can be resolved by installing the `autotools-dev` and `automake` packages. These packages provide essential tools for the build process and ensure that your scripts run without a hitch.

Happy coding!
Notes on Jamf Pro API Roles and Clients
Tags: jamf, api, oauth
Published: 2023-08-21 19:43:52

With Jamf Pro 10.49 admins can now use OAuth client credentials flow for authenticating to the product's APIs.

The documentation for the new **API Roles and Clients** can be found [here](https://learn.jamf.com/bundle/jamf-pro-documentation-current/page/API_Roles_and_Clients.html). The implementation is straightforward:

1. Go to **Settings** > **System** > **API Roles and Clients**
1. Create an **API Role**
1. Select all of the applicable **Jamf Pro API role privileges** it should grant. 
1. Create an API Client.
1. Select one or more API Roles to assign to it.
1. **Enable** the API Client.
1. **Generate** the **Client Secret**.

You can now use the client ID and secret to obtain access tokens. This shell example below is taken from Jamf's [developer docs](https://developer.jamf.com/jamf-pro/docs/client-credentials).

```shell
curl --request POST "${url}/api/oauth/token" \
    --header "Content-Type: application/x-www-form-urlencoded" \
    --data-urlencode "grant_type=client_credentials" \
    --data-urlencode "client_id=${client_id}" \
    --data-urlencode "client_secret=${client_secret}"
```

API Client access tokens have different claims than those returned using user-based basic authentication.

```json
{
  "sub": "55ed202f-371c-41aa-9dc5-c63d6a1f6b3c",
  "aud": "55ed202f-371c-41aa-9dc5-c63d6a1f6b3c",
  "nbf": 1692646434,
  "token-uuid": "eaa92ecb-644f-4a8a-8591-6d6f08f50288",
  "subject-type": "REGISTERED_CLIENT_ID",
  "authentication-type": "CLIENT_CREDENTIALS",
  "scope": [
    "api-role:2"
  ],
  "iss": "http://<redacted>.jamfcloud.com",
  "exp": 1692646494,
  "iat": 1692646434
}
```

Note that the `scope` claim contains `api-role:2` as the value. Jamf Pro is referencing API Roles by their _database IDs_ and not their name or other identifier. Each assigned roles is represented using the same `api-role:ID` scheme. When the server validates the token it is querying for API Roles using the IDs found in the scope and applying those privileges.

> Role assignments are cumulative. The API Client will have the sum of all API privileges across all of the assigned roles.

_This means that changing API Role assignments on an API Client is a **scope change**._

In Jamf's implementation of client credentials flow the scope change **_requires generating a new client secret_** for the assignment change to take effect. Until this happen the role assignments (scope) at the time the secret was generated will continue to be returned.

Conversely, changing the _privileges_ assigned to an API Role takes effect immediately and do not require generating a new client secret for API Clients that are assigned those the role.

I would recommend that admins adopt a 1:1 relationship of API Role to API Client and not attempt to re-use roles across clients. Otherwise, you may find yourself in a headache situation where you can't update your client's role assignments without interruption.
Why use git worktree?
Tags: git, productivity
Published: 2023-08-21 19:39:12

`git worktree` is a command that I came across the first time today while browsing the git documentation. The example section explains a possible use case pretty well:

---
From https://git-scm.com/docs/git-worktree: 

You are in the middle of a refactoring session and your boss comes in and demands that you fix something immediately. You might typically use git-stash to store your changes away temporarily, however, your working tree is in such a state of disarray (with new, moved, and removed files, and other bits and pieces strewn around) that you don’t want to risk disturbing any of it. Instead, you create a temporary linked worktree to make the emergency fix, remove it when done, and then resume your earlier refactoring session.

```
$ git worktree add -b emergency-fix ../temp master
$ pushd ../temp
# ... hack hack hack ...
$ git commit -a -m 'emergency fix for boss'
$ popd
$ git worktree remove ../temp
```
---

While I'm not sure if the above scenario is something where I would use it, I can see it as a useful feature for experimenting. For example, I might have a half working solution that I could stash, but if I want to switch between one approach and another idea that I have, then I think using work trees would work much better (saves me from having to keep committing code that I'm not sure will work). What do you think? Have you used `git worktree`?