teleren/devto huggingface dataset:
CircuitPython and MicroPython - great ways to program microcontrollers
Tags: linux, python, programming, opensource
Published: 2023-12-09 23:28:20



CircuitPython is based on Python - micropython too. 

we can say: Python is the fastest growing programming language. It's taught in schools and universities and hundreds of thousands learn it!

Well Python it's a high-level programming language which means it's designed to be easier to read, write and maintain. 
Python supports modules and packages which means it's easy to reuse your code for other projects. 
Python has a built-in interpreter which means there are no extra steps, like compiling, to get your code to work. And of course, Python is Open Source Software which means it's free for anyone to use, modify or improve upon.

With Python you can explore a new frontier in MCU programming. 

I've been enjoying MicroPython for over a year now and definitely prefer using the language for fun and serious projects alike. 
MicroPython is really great. But - well: i also like CircuitPython! Both systems are awesome and great. 

I love them mainly because I can see and recapitulate what the code is doing and because an interactive environment is perfect for learning, 
testing and trying new things in coding.  So MicroPython and CircuitPython - both are just great. 

btw: see a awesome film:  andreas spiess: #240 Time to Say Goodbye to Arduino and Go On to Micropython/ Adafruit Circuitpython? 
https://www.youtube.com/watch?v=m1miwCJtxeM&list=RDQMv86k5Hufs40&start_radio=1
Mastering Git Migration Moving Repositories Across Servers
Tags: github, git, vcs, programming
Published: 2023-12-09 23:22:25

Migrating a Git repository from one server to another involves a few steps. Here's a general guide:

### Method 1: Cloning and Pushing

1. **Clone the Existing Repository:**
   Clone the existing repository to your local machine using the `git clone` command.

   ```bash
   git clone <existing_repository_url>
   ```

2. **Add New Remote URL:**
   Change the remote URL to the new server's repository.

   ```bash
   git remote set-url origin <new_repository_url>
   ```

3. **Push Changes:**
   Push your local repository to the new remote repository.

   ```bash
   git push origin master  # or the branch name you are working on
   ```

### Method 2: Export and Import

1. **Export Existing Repository:**
   Create a bare clone of the existing repository.

   ```bash
   git clone --bare <existing_repository_url>
   ```

2. **Transfer the Repository:**
   Copy the bare repository to the new server using SCP, FTP, or any preferred method.

3. **Import into New Server:**
   On the new server, create a new repository or use an existing empty one.

   ```bash
   git init --bare new_repository.git
   ```

4. **Push Changes to New Repository:**
   Push from your local clone to the new server.

   ```bash
   git remote add new-origin <new_repository_url>
   git push new-origin --mirror
   ```

### Notes:

- Ensure you have the necessary permissions to push to the new repository.
- Update any remote references or configurations in your local repositories if needed (`git remote` commands).
- Use SSH keys or other authentication mechanisms for secure access to the repositories.
- After migration, verify the new repository to ensure all branches, commits, and tags have been correctly transferred.

Always back up your repositories before performing any migration or critical operations. If these steps don't cover your specific scenario, let me know the details for more tailored guidance!
An alternative solution to Typescript enums
Tags: typescript, webdev
Published: 2023-12-09 23:07:28

Enums are quite handy to define a set of named constants. In the TypeScript world, enums hold a unique position as both a type and a value. 

However, enum comes with drawbacks... 

- Enums and const enums, are an exception to the Typescript structural typing. Meaning that Level1.INFO !== Level2.INFO !== 'INFO' even when both Level1.Info and Level2.INFO are set to 'INFO'.

- Enums are not necessarily enumerable at runtime, and `Object.values(MyEnums)` can have unexpected results.

- Enums and const enums, are more a legacy feature than a recommended one.


Let's take an example:

```ts
enum Level {
  VERBOSE = 'VERBOSE',
  NORMAL = 'NORMAL',
  DEBUG = 'DEBUG'  
}

function log(level: Level) {}

log('DEBUG') // 💥 Argument of type '"DEBUG"' is not assignable to parameter of type 'Level'
log(Level.DEBUG) // ✅

const allLevels = Object.values(Level) 
// allLevels = ["NONE", 0, "VERBOSE", "NORMAL", "DEBUG"] 🤔
```

While it operates as intended, the behavior of enums may seem somewhat strange to a TypeScript user.

## The alternative solution

Fortunately, TypeScript offers features that, when combined, provide similar functionality to enums:
- const object
- union type
- value and a type can coexist with the same name

This leads to the following code that "fixed" the unwanted behavior of enums: 

```ts
const Level = {
  NONE : 0,
  VERBOSE: 'VERBOSE',
  NORMAL: 'NORMAL',
  DEBUG: 'DEBUG'
} as const
type Level = (typeof Level)[keyof typeof Level]

function log(level: Level) {}

log('DEBUG') // ✅
log(Level.DEBUG) // ✅


const allLevels = Object.values(Level) 
// [0, "VERBOSE", "NORMAL", "DEBUG"] ✅
```
The clear advantage of this approach is that, in most cases, it's possible to seamlessly replace enums without modifying existing code that uses them.

Additionally, the union type can be simplified using the utility type:
```ts
type UnionOfPropertyTypes<T extends object> = T[keyof T]
```

Resulting in a cleaner declaration:
```ts
const Level = {
  NONE : 0,
  VERBOSE: 'VERBOSE',
  NORMAL: 'NORMAL',
  DEBUG: 'DEBUG'
} as const
type Level = UnionOfPropertyTypes<typeof Level>
```
WordPress Gutenberg 17.2 - improvements and more
Tags: wordpress, webdev, programming
Published: 2023-12-09 23:04:09


WordPress Gutenberg 17.2 - improvements and more

https://make.wordpress.org/core/

What’s new in Gutenberg 17.2? (6 December) “What’s new in Gutenberg…” posts (labeled with the #gutenberg-new tag) are posted following every Gutenberg release on a biweekly basis, showcasing new features included in each release. As a reminder, here’s an overview of different ways to keep up with Gutenberg and the Site Editor project (formerly called Full Site Editing).

Gutenberg 17.2 has been released and is available for download! This release includes a few improvements for the Site Editing experience — including the ability to drag and drop to the top and bottom of the document and sticky table headers —, improvements to the Interactivity API docs, and a lot of Bug fixes and other improvements. Let’s take a closer look!

Allow dragging and dropping onto the beginning and end of a document.
Sticky table headers and pagination.
Toolbar for the Distraction-Free Mode
Other notable highlights
Changelog
Contributors
Allow dragging and dropping onto the beginning and end of a document.


more Data - links and information

https://make.wordpress.org/core/
Can you help me understand this unexpected behaviour?
Tags: vue
Published: 2023-12-09 23:02:31

Hi!

So some time ago I wrote a D&D stat calculator thingie in React. I recently had the opportunity to apply to a Vue position, and as I was interested in Vue, I quickly read through the docs and thought it'd be a fun exercise to "translate" the app to Vue. I later got carried away and tried Svelte, too!

The thing is, I had issues with one particular single-digit input. I used two-way binding to sync it to a ref, with custom "validation". The behind-the-scene state updates correctly, but the input value "unbinds" when typing more than one key, frustratingly.

I ended up manually re-affirming event.target.value to the same value I pass through the emit function to update the v-model ref as its described in the docs.

So, I solved it, but it bugs me, what is happening? In React or Svelte I didnt have this problems with the same-ish validation on input, so I'm not enterely satisfied by not knowing why it happens in the first place.

[Link to the parent component](https://github.com/daruufex/dnd-point-shop-vue/blob/main/src/components/StatItem.vue)
[Link to the child component](https://github.com/daruufex/dnd-point-shop-vue/blob/main/src/components/AncestryBonus.vue)

[Link to the deployed app](https://dnd-point-shop-vue.netlify.app/)
Embracing Blockchain: A Developer's Journey from PHP|JavaScript to Web3
Tags: solidity, blockchain, web3, smartcontract
Published: 2023-12-09 22:53:54

**Introduction**
Hey Dev.to readers! 👋 I'm excited to share a major turning point in my career journey. As of today, I'm immersing myself in the fascinating world of blockchain development! 🌐💻

**About Me**
I come from a solid background in Backend (PHP | Laravel) and Frontend (JavaScript | Next.js). These skills have been the backbone of my professional journey, and now, I'm eagerly leveraging them in the dynamic realm of #blockchain!

**Why Blockchain?**
Blockchain has always captivated my interest, and now it's time to turn that fascination into action. My primary goal is to craft #Web3 applications, explore decentralized technologies, and carve a pathway to success in the ever-evolving #blockchain space. 🚀

**What to Expect**
Throughout this journey, I'll be transparently sharing the highs, the lows, the challenges, and the victories right here. Expect to see code snippets, project updates, and perhaps even a bit of the learning curve. 📈💡

**Why Now?**
The world of #blockchain is advancing rapidly, and I'm eager to be an active participant. By merging my existing skills with blockchain development, I aim to create innovative solutions and foster both professional and personal growth.

**Learning Resources**
I'm reaching out to the #blockchaincommunity! Share your favorite learning resources, tips, and advice. Let's build this journey together! 🤝

**Here's to New Beginnings!**
This marks the commencement of an incredible adventure. Thank you all for joining me on this ride. Here's to learning, building, and growing in the #blockchainworld! 🚀🌟

#BlockchainDeveloper #Web3 #NewJourney #CodeLife
#StateOfTheWord, WordPress’s annual keynote - Madrid Dec 11, 2023!
Tags: webdev, programming, wordpress, linux
Published: 2023-12-09 22:39:14


#StateOfTheWord, WordPress’s annual keynote - Madrid  Dec 11, 2023! 

Save the Date: Dec 11, 2023! Join us for the #StateOfTheWord, WordPress’s annual keynote by co-founder Matt Mullenweg. 

🎙️ This year, we’re broadcasting from Madrid, Spain. Details on tickets and live streaming will be provided in November. 

https://wordpress.org/news/2023/10/state-of-the-word-2023/
which Keepass-Addons /Plugins do you use - just share your ideas
Tags: webdev, linux, beginners, tutorial
Published: 2023-12-09 22:36:43

https://keepass.info - which Keepass-Addons /Plugins do you use

Plugins - KeePass: - the list of Plugins: https://keepass.info/plugins.html

-Backup & Synchronization & IO
-Utilities
-Integration & Transfer
-Import
-Export
-Cryptography & Key Providers
-Automation & Scripting
-Ressources

what is your favorite plugin!?
wptavern looks for new authors - apply now...!
Tags: webdev, wordpress, programming, linux
Published: 2023-12-09 22:33:26


wptavern looks for new authors - apply now...!

	
	 And please send in the application by November 24th! We’ll take this week off but hopefully come back blazing after Thanksgiving. I’ll review everything over the weekend when I have some time off planned.

We’ll try out a number of folks on an hourly contract ($25/hr, same as Automattic) as a trial, and if that goes well we’ll aim to hire two full-time writers by the end of the year. A full-time offer also includes generous benefits including full coverage on health care and 6% 401k matching. You’ll be an employee of Audrey.

The job is to write frequently about the goings-on in the WordPress world and foster a healthy discussion and community here on the site. If you’re doing your job well, it should be reflected in traffic and comments on the site. You will set the tone and discussion in the WordPress community, and drive the narrative. Every post will be syndicated to every wp-admin in the world. You don’t have to start out a WordPress expert, but you’ll become one. You’ll have a ton of autonomy, so need to be self-driven and able to manage yourself. (You can ask previous writers how much I was in their hair. 😀)

Midjourney prompt: a stunning landscape scene with a tranquil atmosphere. The foreground showcases a calm, crystal-clear lake reflecting the serene blue sky above. On the horizon, a majestic mountain range rises, covered in lush, green vegetation. The central focus of the image is the sun, just starting to rise above the peaks, casting a warm, golden glow across the entire scene. Its rays create a mesmerizing play of light on the water’s surface, symbolizing hope, new beginnings, and the promise of a brighter future
the  Artikel: https://wptavern.com/whats-next
new from AFFiNE, the all in one KM system - Notion, Trello and Miro and Monday competitors
Tags: programming, beginners, linux
Published: 2023-12-09 22:30:10


new from AFFiNE, the all in one KM system - Notion, Trello and Miro and Monday competitors :: The open source competitor of all the above-mentioned projects such as online whiteboards (Miro) note-taking (Notion) and other productivity tools (e.g. Confluence, Trello or Monday) are in a constant development process

You can always find out the latest on Twitter - and a lot happens here!


see more news at ​https://app.affine.pro 



Our web version will be moved to ​https://app.affine.pro on December 15, 2023. You can continue using https://insider.affine.pro until then. We know data migration can be inconvenient – sorry for any disruption!
Visit our blog for details: https://affine.pro/blog/affine-web-version-upgrade-12-2023
Change is for a smoother user experience. Your data is vital, and we're ensuring a seamless transition.
For any questions or issues, please reach out. Thanks for your understanding and patience.❤️

get more  https://twitter.com/AffineOfficial :: 

learn more about AFFiNE
#AFFiNE #Beta #OpenSource 
#BuildInPublic #Privacy #Local
#Notion #Miro #Monday #Alternative

- AFFiNE Community: https://community.affine.pro/home
Replit's 100 Days of Code (Day 14 Challenge)
Tags: beginners, 100daysofcode, python
Published: 2023-12-09 22:21:36

I started the day 14 challenge where I needed to create a 2-player Rock, Papers, and Scissors game. This day goes straight to the challenge with no prep work. I'll probably need more than a quick session to do this one. I'll probably need to use today and tomorrow to figure this one out. I'll be back with my code and then comments later. 

**One note: I'm going to augment this course with HarvardX's CS50 Course or I'm going to do mini projects where I build some things. I feel like it would help me continue with the Replit 100 Days of Code if I'm building things or working on another course that supplements these limited tasks. **

Edit: I finished Day 14 but it was a struggle. I'm going to move on to Day 15 but this was the first one in a while that I really struggled with. I'll likely come back and do day 11-15 again because it makes no sense to move forward until I can easily do the Day 14 challenge without help. However, in the meanwhile, I am going to move forward to day 15.
Amazon EC2 Instances for Your Cloud Computing Needs
Tags: aws, beginners, cloud
Published: 2023-12-09 22:11:22

Amazon Elastic Compute Cloud (EC2) is a powerful service for launching virtual servers on Amazon Web Services (AWS). 
These instances are the building blocks for deploying a wide range of applications, including web servers, databases,etc...

To effectively use the power of EC2, it's importantn to understand the different instance types and how to choose the right one for your specific needs.

## Instance Types: A Diverse Spectrum of Computing Power

EC2 instances come in a variety of flavors, each tailored to specific use cases. 
These types are categorized :

- General Purpose Instances: 

These instances offer a balanced combination of compute, memory, and networking resources, making them adapted for a wide range of applications. 

- Compute Optimized Instances: 

These instances excel at running CPU-intensive tasks, such as batch processing, media transcoding.

- Memory Optimized Instances: 

These instances prioritize memory performance, making them ideal for applications that process large data sets in memory.

- Storage Optimized Instances: 

These instances are designed for workloads that require read and write access to very large data sets on local storage. 

- Accelerated Computing Instances: 

For workloads that demand exceptional processing power, accelerated computing these instances provide access to hardware-based compute accelerators like  GPUs.

Amazon EC2 instance names follow a specific naming convention to help you easily identify their characteristics. 

The first letter of the instance name indicates the instance family. 

The second value represents the instance generation, and it's followed with the architecture a for AMD , g for graviton ( ARM architecture)  

After the generation letter, additional letters indicate specific instance configurations, such as processor type (e.g., d for instance store volumes, n for network optimization, b for block storage optimization, e for extra storage or memory, and z for high frequency).

| Lettre | Description |
|---|---|
| d | Instance store volumes  | 
| n | Network optimization | 
| b | Block storage optimization | 
| e | Extra storage or memory | 
| z | High frequency | 

After the dot is a description of the capacity, which determines the number of vCPUs and the amount of memory available for the instance. 
These capacities are generally identified by a combination of letters and numbers. 

Here are some examples of AWS instance nomenclatures:

M5.large large M5 instance, with 2 vCPUs and 8 GiB of memory.
M5.xlarge: xlarge M5 instance, with 4 vCPUs and 16 GiB of memory.
M5.2xlarge: 2xlarge M5 instance, with 8 vCPUs and 32 GiB of memory.

To summarize, if I take the "m5d.24xlarge" instance

M is the family name.
5 is the generation.
d Use a NVME SSD
24xlarge means it has 24 times more vCPUs than the large .
Sites for Illustrations
Tags: ux, ui, productdesign, webdev
Published: 2023-12-09 21:53:03

1. Pixabay
2. unDraw
3. Freepik
4. Openclipart
5. Flaticon
6. VectorStock
7. Vecteezy
8. The Noun Project
9. Vector4Free
10. Shutterstock
11. drawkit.io
12. icons8.com
13. iradesign.io
14. blush.design
15. storyset.com
16. pixeltrue.com
17. manypixels.co
18. iconscout .com
19. illustrations .co
20. humaaans .com
21. openpeeps .com
How To...
Published: 2023-12-09 21:30:15

Hey all, I am hoping someone can give me some pointers/suggestions here. I'm a solodev and I'm facing the exciting challenge of recruiting more developers to contribute to my open-source project, and I would love to tap into the collective wisdom of this community for some valuable insights.

**What are the best strategies you've found for recruiting developers to contribute to open-source projects?**

Whether you're an open-source project maintainer, a contributor, or someone who has successfully recruited developers in the past, I'd love to hear your thoughts. Here are a few specific questions to get the discussion going:

1. What channels/platforms have you found most effective for reaching potential contributors?

2. How do you communicate the unique value and mission of your open-source projects to attract developers?

3. Are there specific incentives or engagement strategies that you've found particularly successful in encouraging contributions?

4. How do you create an inclusive and welcoming environment for new contributors?

Feel free to share your experiences, success stories, or any lessons learned along the way. Your insights will be incredibly valuable not only to me but also to others in the community who are navigating similar challenges.

Thanks a bunch!
The humor of JavaScript
Tags: watercooler, javascript, beginners
Published: 2023-12-09 21:21:29

As the year marks its end and we are therefore exposed to the yearly "What to use in 2024" click-bait articles, let's instead amuse us with some oddities of JavaScript. 

## Numbers

You can't divide by zero. But why not? If I divide 1 by smaller and smaller fractions, I'll be getting higher and higher numbers nearing infinity. So eventually we'd end up at infinity? Not so fast. If we "came from the other side" towards zero, we'd approach negative infinity when getting to zero:
```javascript
const a = 1/0.0001; // 1,000
const b = 1/0.000001; // 100,0000

const c = 1/-0.000001; // -100,0000
const d = 1/-0.0000001; // -1,000,0000
```

So what does JavaScript do when dividing by zero? "NaN" maybe? Nope, it goes for infinity.
```javascript
console.log(1/0) // Infinity
```

Interesting. That means that the type of 1/0 must be infinity? Nope, it's NaN (Not a number).
```javascript
console.log(typeof 1/0) // NaN
```
Okay, so infinity doesn't seem to be a type, then? Let's test:
```javascript
console.log(typeof Infinity) // number
```

Wait a second, you think? If infinity is a number and 1/0 is infinity, why is the type of 1/0 not a number (NaN)? Well, let's explore:
```javascript
console.log(typeof NaN) // number
console.log(NaN === NaN) // false
```

Confused, yet?

## Objects

What's so nice about having no type safety is that we can be quick & dirty. So dirty indeed, that nearly every company will insist on Typescript to avoid almost impossible to find bugs. Let's examine the following code.
```javascript
let myObject = null;

function getFromBackend(){
  fetch('/api/object').then(j => j.json()).then(result => {
    // result: {a: "b"}
    myObject = result;
  })
}

// SpongeBob narrator: ..several hours later

// Is our variable myObject filled?
function checkIfValid(){
  if(typeof myObject === 'object'){
   // do something
  }
}

```
Seems logical to a beginner, but here's the culprit
```javascript
console.log(typeof null) // object
console.log(typeof null === typeof {}) // true
```

But then again, we all know objects aren't object anyway, right? 
```javascript
console.log({} === {}) // false
```

## OMG, what a language

Using the type-safe comparison (===) is therefore a must, as otherwise the nightmare would be so much worse:
```javascript
const array = []
console.log(array == false) // true
console.log(array === false) // false
```

There are even books about JavaScript oddities, as this list could go on for a while. But I guess we'd rather go on reddit to bash on PHP so Santa doesn't put us on the naughty list ;-)
Using Facebook Research's Llama Guard to moderate ChatGPT convos
Tags: ai, tutorial, opensource, discuss
Published: 2023-12-09 21:11:04

### We're trying to get more exposure for AIConfig. Please star our repo to help! ⭐️
Github: https://github.com/lastmile-ai/aiconfig


A couple days ago, [Meta announced Purple Llama](https://ai.meta.com/blog/purple-llama-open-trust-safety-generative-ai/) and as a first step, released Llama Guard - a safety classifier for input/output filtering. Llama Guard enables classifying text based on unsafe categories (e.g. Violence & Hate, Criminal Planning, etc.)

![llama_guard](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h755in0qyp13zpl3li7j.png)

We're using Llama Guard to classify the user/agent responses from ChatGPT through AIConfig: 
https://colab.research.google.com/drive/1CfF0Bzzkd5VETmhsniksSpekpS-LKYtX#scrollTo=dAjjPrTq16z1 

## AIConfig x LLama Guard
[AIConfig](https://github.com/lastmile-ai/aiconfig) is a framework that makes it easy to build generative AI applications quickly and reliably in production.

It manages generative AI prompts, models and settings as JSON-serializable configs that you can version control, evaluate, and use in a consistent, model-agnostic SDK.

[LLaMA Guard](https://ai.meta.com/research/publications/llama-guard-llm-based-input-output-safeguard-for-human-ai-conversations/) is  an LLM-based input-output safeguard model.

This example shows how to use AIConfig to wrap GPT-3.5 calls LLaMA Guard and classify them as safe or unsafe.

Please let us know if you have feedback or questions on AIConfig! 

Join our discord: https://discord.com/invite/xBhNKTetGx