teleren/devto huggingface dataset:
KVM/QEMU Raspberry Pi ARM VM
Published: 2021-02-04 19:35:19

---
title: KVM/QEMU Raspberry Pi ARM VM
published: true
description: 
tags: 
cover_image: https://media.istockphoto.com/photos/closeup-of-a-raspberry-pi-picture-id458300317?k=6&m=458300317&s=612x612&w=0&h=uKcHMzLyO5-GySnPf_XUk1euAtcWHJ5DT1pCW-QEJ5w=
---
This project contains a fully configured `Raspbian Jessie` VM.

## Install QEMU
For the setup you need the `qemu-system-arm` package.
**Arch**
```
pacman -S qemu-arch-extra
```

**Ubuntu**
```
sudo apt-get install -y qemu-system-arm
```
## Download Content
Download all following content in one Folder.
**Create `start.sh` file**
{% gist https://gist.github.com/corusm/eb10c104258af81cb4685e80b33ebde1 %}

**Download `Rasbian Jessie 2017-07-05`**
```
wget https://downloads.raspberrypi.org/raspbian/images/raspbian-2017-07-05/2017-07-05-raspbian-jessie.zip
```

**Download `Qemu Kernel Jessie`**
```
wget https://github.com/dhruvvyas90/qemu-rpi-kernel/raw/master/kernel-qemu-4.4.34-jessie
```

## Convert iso-image to qcow-image
1. Create `QCOW` image from `ISO`.
2. Resize the `QCOW` image.
```
qemu-img convert -f raw -O qcow2 2017-07-05-raspbian-jessie.img raspbian-jessie.qcow
qemu-img resize raspbian-jessie.qcow +6G
```

## Start VM
```
./start.sh
```

## SSH into VM
For Using SSH you first need to enable ssh in the `raspi-config`.
1. Open the raspberry pi vm 
2. Run `sudo raspi-config`
3. Goto: `Interfacing Options > SSH > YES`

```
ssh pi@localhost -p 1234
```

### Default Login
```
User: pi
Password: raspberry
```
Choosing a Rails Frontend in 2021
Tags: rails
Published: 2021-02-04 19:35:12

As a new web developer starting with Ruby on Rails, there's a dizzying array of choices for the frontend of your site! This is first in a series of posts that attempts to give a lay of the land, with some personal suggestions on where to start. I'll assume you've at least built a simple Rails app before, if not you can't go wrong with the excellent [https://www.railstutorial.org/](https://www.railstutorial.org/). First, let's get a shared understanding of what a frontend is.

# Explaining the frontend

> *Oxford Dictionary 1. COMPUTING -* relating to or denoting the part of a computer system or application with which the user interacts directly.

When you enter a URL in your browser and click enter, a chain of events happen, culminating in your browser receiving a response - this is basically a plain text document that is written in HTML, CSS and Javascript - interpreting and rendering it.

A nice metaphor could be a theatre:
![Theatre Metaphor of Backend and Frontend](https://dev-to-uploads.s3.amazonaws.com/i/c7p8w0ggh1zx7xlz37da.png)
- The stage where all the actors perform and sometimes respond to audience interactions is like the **frontend**. Our browser renders the HTML/CSS and handles user interactions (mouse-clicks, typing) based on the HTML conventions and instructions we wrote in Javascript.
- The **backend** is like a theatre's backstage, where stagehands arrange and prepare props and actors get changed for the next scene. This is akin to all the logic we have in our Rails controllers, combining data from our models with the views we wrote to be sent to the browser.

# How does it work in Rails?

When Rails devs say "**frontend**" though, we usually refer to a bit more, encompassing not just the actual HTML, CSS and Javascript that is sent to the user, but *how* we've set up Rails to generate them.

There was once a time when web developers would need to write the HTML for every individual page - check the `404.html` page in your Rails app for an example. This was fine for early websites, but perhaps impossible for creating the dynamic, interactive websites of today.

In a framework like Rails, you typically wouldn't write the exact HTML for every single page. Rather, there are multiple components involved that Rails combines to generate the resulting HTML. A simplistic illustration:
![Ruby on Rails Frontend Pipeline](https://dev-to-uploads.s3.amazonaws.com/i/y8vho3rxf7eb6mcj6bfj.jpg)

- our "raw" Javascript and CSS **assets** are usually structured in a way that's convenient for development, but not optimised for sending to users
- there is a **pre-compilation** step that compiles and optimises our assets
- a Rails controller **renders** our view and inserts the correct URLs to the compiled assets, then sends that back in a response to the user

We'll dive a little deeper into the compilation step next, talking about the Asset Pipeline and Webpacker.
Which one is better, Java's `final` or C#'s `readonly`?
Tags: java, csharp, watercooler
Published: 2021-02-04 19:11:18

Personally, I wish C# had a `final` keyword.

Why? [This](https://stackoverflow.com/a/2790917):
![What everyone here is missing is Java's guarantee of definite assignment for `final` member variables. For a class C with final member variable V, every possible execution path through every constructor of C must assign V exactly once - failing to assign V or assigning V two or more times will result in an error. C#'s `readonly` keyword has no such guarantee - the compiler is more than happy to leave readonly members unassigned or allow you to assign them multiple times within a constructor. So, final and readonly (at least with respect to member variables) are definitely not equivalent - final is much more strict.](https://dev-to-uploads.s3.amazonaws.com/i/ssyqe1hek037w6u6ra9p.png)

Also because there's no local-variable equivalent.
DISCUSS: What scale is your CI/CD and Which tools/platforms do you use?
Tags: discuss
Published: 2021-02-04 18:18:27

The company I work for is looking to migrate CI/CD tool and platforms. We have a large number of individually deployable assets built from (300+) of various kinds. We are NOT a software company and most of the projects are tiny.

I'm curious about other people's setups:
- What kind of organization is it (Mostly is your core business making software or technology products or support the core business)
- About how many projects/pipelines etc does your org maintain
- Which platforms you use, why and does it work well at the scale you operate

Thanks, and I'll start!
- I work for a resource extraction company and we use technology to support the core business.
- We have about 350 "active" projects that are deployed to production, most common types are web apps, database projects (scripts etc), reporting and Business Intelligence assets along with a smattering of think-apps and other more exotic items.
- Currently we use TeamCity and Octopus Deploy to great effect and have great tie-ins with our tracking system of Atlassian JIRA

Looking forward to hear from you!
Let’s Develop an Online Code Editor/Compiler Like HackerRank
Tags: career, programming, javascript, opensource
Published: 2021-02-04 18:50:25

In this article, I will explain how I made my own online compiler using open-source code.

Here I will make one editor that supports 3 languages; C++, Java, and Python.

{% youtube AruJ23XlBps %}

Adding more languages is also very simple.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/2wn5mi0kqkoferwr331j.png)
## Overview

Building an online code editor and compiler can seem too complicated, but we can break it down into two pieces.

1. API running on the backend server, which will take a piece of code and language as input and output the answer after running the code on the server
2. Frontend code editor, we can choose the language and edit and modify the code here. Then we make a post request to the backend API and show output on the website

## Tutorials in this Series

1. Deploy our Online Code Executor in Google Cloud
2. Understanding the API of Judge0
3. Creating an online code editor front-end (this tutorial)

## Demo

This is the webpage we are going to build.

[you can find the live demo here](http://167.99.37.15:8007/)
{% youtube x5YD1yOC8_c %}
<figcaption>Online code editor demo</figcaption>

## FrontEnd

Our frontend is pretty simple. We have one drop-down menu where we can select the language and depend upon the language we will get our respective code editors. Our main code lies in the home-page.html and the code-editor resides in the texteditor.js.

Here we have made one onClickListener for dropdown menu items. So when one item is clicked, the corresponding listener gets triggered and we can call our desired editors. All the languages have different id associated with it . The list can be found using this.

The home-page looks like this.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/mnmiliyblac9fmyuhlio.png)
The home-page html code is given below.

{% gist https://gist.github.com/sksaikia/a9389a44448e6223d2f23a880e1cf7f5.js %}

Here we call the codeEditor function of the javascript file , we pass the respective id associated with the language.

We add the style from assets/css/style.css .
{% gist https://gist.github.com/sksaikia/053afd3008060e174260471f63240eed.js %}
Also we need to link the javascript file so that the code can be executed. We get the lang_id from the html and do the network call accordingly. **For java code is 62, cpp 53 and python 70.** This is passed in `language_id` . We also set default values to the editor depending on the `lang_id.`

{% gist https://gist.github.com/sksaikia/27c3660c369e075b90d94bf018fe2f1d.js %}
On execution of code it should show like this.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/z85vtayh3i2nz3yopl55.png)

The entire code can be found in the following repository.
{% github webtutsplus/code-editor %}
Podcast // Andrew Hedges - Engineering Manager at Zapier
Published: 2021-02-04 18:45:52

Today we meet Andrew Hedges, Founder of The Collab Lab, and currently Engineering Manager at Zapier.
After briefly reviewing his great career, we dive into his volunteer work at The Collab Lab and his passionate commitment to help early-career developers and promote diversity in tech.
He also shares with us valuable insights gained from his extensive experience of remote working and distributed teams. Take a listen for a genuine and refreshing take on subjects that matters!
More Here => https://podcast.ausha.co/refactor/andrew-hedges-founder-of-the-collab-lab-engineer-manager-at-zapier
January: Forem Twitch Events Roundup 👾
Tags: opensource, meta, webdev
Published: 2021-02-04 18:44:34

---
title: January: Forem Twitch Events Roundup 👾
published: true
description: 
tags: opensource, meta, #webdev
series: Monthly Forem Twitch Roundup
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/0rljeggcsah6c4mj7mt8.png
---

In January Nick Taylor and I kicked off a new month of Twitch streams. This is a round up of all the wonderful guests who joined us.

## Walkthrough Wednesday with Gant Laborde
{% youtube wS5N5R61Z5w %}
We talked to Gant Laborde, CIO at Infinite Red, about AI and shared TensorFlow demos.

Be sure to check out some of the demos Gant shared. 

[AI Trainable Tic Tac Toe](https://www.tensorflowtictactoe.co/)
Train this AI to play the best game of Tic Tac Toe.

[Enjoying The Show](https://enjoyingthe.show/) 
This demo is an experiment for connecting speakers and audiences using AI. It uses webcams to share the dominant facial expression in the audience with the speaker. This helps the speaker gauge feedback from the audience just as they would by looking out at the faces in the crowd.

[The AI Sorting Hat](https://aisortinghat.com/)
Sketch on the canvas to see which house your sketch is sorted in to. Watch out for the “easter egg” you can find by drawing a certain **mark** 💀.

## Pair Programming with Rafi
{% youtube cVW5sVgouYA %}
We were joined by [Rafi](https://dev.to/rafi993) an active Forem open source contributor to work on this PR. 
{% github https://github.com/forem/forem/pull/10661 %}


## Walkthrough Wednesday with Ben Halpern
{% youtube -kRv_MrIATI %}
Forem co-CEO [Ben Halpern](https://dev.to/ben) joined us for a Walkthrough Wednesday. We talked about DEV's beginnings, the move to Forem, open source, upcoming features, Forem Cloud and more.

Thanks to all our viewers who joined the streams and chatted with us this week! 

Be sure to follow the [ThePracticalDev Twitch](https://www.twitch.tv/thepracticaldev) channel to check out all the great guests we have joining us every Wednesday this month.
Ever npm/pip installed malware? A modest call for action
Tags: python, javascript, security, npm
Published: 2021-02-04 18:34:21

The npm and Python Package Index registries that help make Javascript and Python popular, productive, and fun programming languages have over recent years been the victims of malicious attacks. The Python Package Index (PyPI), for instance, has suffered dozens of attacks, including [typosquatting attacks](https://www.iqt.org/bewear-python-typosquatting-is-about-more-than-typos/) in which an attacker mimics the name of a popular package to trick developers into downloading malware.

To reduce the number and impact of these attacks on the Javascript and Python ecosystems, concerned developers can take a number of actions. (For a longer list, see this [blog post](https://www.iqt.org/toward-secure-code-reuse/).)

1. Consider contributing your talents to projects that seek to improve the security of these registries. One project worth your attention is [Aura](https://github.com/SourceCode-AI/aura), a Python source code auditing and static analysis tool. For those who want to explore Python malware detection challenges identified as important by the Python Software Foundation, see [here](https://github.com/psf/fundable-packaging-improvements/blob/master/FUNDABLES.md#productionize-malware-detection). Consider contributing malware checks to the Python Package Index codebase, aka [Warehouse](https://github.com/pypa/warehouse).

2. For those interested in directly identifying malicious packages, you'll need to build registry scanners and then analyze the results, reporting any malware you find. One past effort is [pypi-scan](https://www.iqt.org/pypi-scan/), but I'm looking forward to future, more capable scanners in the future!

3. Join the working group meetings of the [Open Source Security Foundation](https://github.com/ossf), or OpenSSF. This is a community dedicated to upholding the security of open source software.

Whatever you do, remember that these ecosystems depend on security for their continued health. So consider doing your part!
What's the best os for your dev laptop - OSX vs Windows vs Linux
Tags: watercooler, discuss, laptops, rudderstack
Published: 2021-02-04 18:30:12

---
title: What's the best os for your dev laptop - OSX vs Windows vs Linux
published: true
description: I want to settle this once and for all
tags: watercooler, discuss, laptops, rudderstack
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/mctavhpu9urofbru90v6.jpg
---

*cover image by [Wilson Afonso](https://commons.wikimedia.org/w/index.php?curid=16525450)*

The operating systems we use reflect our experience, the culture we work in, and our general level of privelge, but I'm curious if you have a favorite OS to work on as a developer, and if so why.

Like most developers on the west coast of the United States, I use a work-provided MacBook for most of my development. I'm slowly working on moving my streaming to a beefy Windows PC but I find learning a new OS stressful and I've been writing and running code in OSX for 10 years, it's hard to imagine changing now. But that's just me, and I know my background affects my choice much more than OSX actually being 'better' in any quantifiable way!
Leetcode Weekly Contest 225 (Change Minimum Characters to Satisfy One of Three Conditions)
Tags: career, programming, computerscience, algorithms
Published: 2021-02-04 18:28:10

1737. Change Minimum Characters to Satisfy One of Three Conditions
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/el014aopko4fkj93doup.png)

## Motivation to learn algorithms

{% medium https://medium.com/leetcode-simplified/solve-leetcode-problems-and-get-offers-from-your-dream-companies-2786415be0b7 %}

## Problem Statement

You are given two strings `a` and `b` that consist of lowercase letters. In one operation, you can change any character in `a` or `b` to any lowercase letter.

Your goal is to satisfy **one** of the following three conditions:

* **Every** letter in `a` is **strictly les**s than **every** letter in `b` in the alphabet.
* **Every** letter in `b` is **strictly less** than every letter in `a` in the alphabet.
* **Both** `a` and `b` consist of **only one** distinct letter.

Return the minimum number of operations needed to achieve your goal.

**Example 1:**

`Input: a = "aba", b = "caa"
Output: 2
Explanation: Consider the best way to make each condition true:
1) Change b to "ccc" in 2 operations, then every letter in a is less than every letter in b.
2) Change a to "bbb" and b to "aaa" in 3 operations, then every letter in b is less than every letter in a.
3) Change a to "aaa" and b to "aaa" in 2 operations, then a and b consist of one distinct letter.
The best way was done in 2 operations (either condition 1 or condition 3).`

**Example 2:**

`Input: a = "dabadd", b = "cda"
Output: 3
Explanation: The best way is to make condition 1 true by changing b to "eee".`

**Constraints:**

* `1 <= a.length, b.length <= 105`
* `a` and `b` consist only of lowercase letters.

## Solution

In this problem, we are given two strings and we have to make them satisfy one of the 3 conditions by a minimum number of operations. In one operation, we can change any character in either string to any lowercase number.

So we have to check all the 3 conditions. In the make method, we check for the first 2 conditions. We pass the two strings to this method, For a given string `a`, we try to make it strictly smaller than `b`. We do it by making string `a` smaller than a particular character `ch` and string `b` bigger than the same character. We call this method twice, first to make `a` smaller than `b` and then `b` smaller than `a`.

For the third condition, we make it contain only one distinct character, by changing each character to a particular character ch. We count the total number of operations and compare it with the minimum. At last, we return the ansvariable.

The following are the Java and C++ code for this problem.
{% gist https://gist.github.com/sksaikia/403c9d4396457227e766f25a7ffe1693.js %}

{% gist https://gist.github.com/sksaikia/35fe3b1a41e21073c19e12b394d03b55.js %}
The code can be found in the following repository.
{% github webtutsplus/LeetCode %}

**Thank You for reading and Follow this publication for more LeetCode problems!😃**

[LeetCode Simplified](https://medium.com/leetcode-simplified)
Test Ansible playbooks with Vagrant
Tags: ansible, vagrant
Published: 2021-02-04 18:15:40

We normally use Ansible playbooks to configure servers in a cloud provider. When we develop those playbooks we need to test them locally. Thanks to Vagrant it is quite easy to start a virtual machine and run our playbooks against it.

There are two ways to achieve this:
* [using Vagrant’s Ansible provisioning feature](https://medium.com/@yortuc/testing-ansible-playbooks-with-vagrant-722619986013)
* using the virtual machine like any other remote server

I'm going to explain the second option here.

First, let's create a virtual machine called, for example, `tau`. The `Vagrantfile` could be:

```ruby
Vagrant.configure('2') do |config|
  config.vm.define 'tau' do |debian|
    debian.vm.box = 'debian/buster64'
    debian.vm.network :private_network, ip: '192.168.27.2'
    debian.vm.hostname = 'tau'
    debian.vm.provider 'virtualbox' do |vb|
      vb.memory = '2048'
      vb.cpus = 2
    end
  end
end
```

We can start the server with:

```bash
vagrant up
```

Now we have to add it to Ansible's inventory, but we need to know the ssh key Vagrant is using when we connect using `vagrant ssh`:

```txt
$ vagrant ssh-config
Host tau
  HostName 127.0.0.1
  User vagrant
  Port 2200
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /Users/javiervidal/test/.vagrant/machines/tau/virtualbox/private_key
  IdentitiesOnly yes
  LogLevel FATAL
```

Interesting, we can use `/Users/javiervidal/test/.vagrant/machines/tau/virtualbox/private_key` in the inventory. We need to add a line like this:

```txt
tau ansible_host=192.168.27.2 ansible_port=22 ansible_ssh_user=vagrant ansible_ssh_private_key_file=/Users/javiervidal/test/.vagrant/machines/tau/virtualbox/private_key ansible_python_interpreter=/usr/bin/python3
```

And finally we can test that Ansible can connect to `tau`:

```bash
$ ansible tau -m ping   
tau | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
```

😀
WhiteNoise Shenanigans - Building SaaS #79
Tags: python, django, templates
Published: 2021-02-04 18:13:33

{% youtube WkAQrExP_AE %}

In this episode, I worked on a method of adding static content to a site that didn't involve the staticfiles directory, a separate domain, or a reverse proxy like Nginx. We had to get clever with Heroku buildpacks and how to configure WhiteNoise.

I want to put a blog on my side project for content marketing purposes.

I want the blog to be statically generated and have content come from Markdown (just like these show notes that you're currently reading).

My preference is to put the blog on a path like `mysite.com/blog/` instead of using a subdomain like `blog.mysite.com`.

I could do this easily if the blog lived at `/static/blog/` by working within Django's staticfiles system, but those URLs look gross.

I could also do this with a reverse proxy like Nginx, but that complicates my Heroku deployment setup.

Instead of picking any of those strategies, I wanted to find a way to make WhiteNoise, the package that serves static files in my Django app, serve the blog.

To get started, I added a Heroku buildpack that would run Hugo to generate the blog output. This took a while to get right because I had to create a Hugo project in a way that didn't pollute the root of my project with a bunch of Hugo directories.

Once I was successful with Hugo, we moved on to the WhiteNoise setup. I created a custom subclass of the WhiteNoise middleware so that I could add the blog output to the set that WhiteNoise would serve.

We got the middleware set up and I proved that the app could serve the blog. To finish off the stream, I did some validation of the cache headers to see the behavior of the blog files and how WhiteNoise would cache the files.
Building habits through relationships
Tags: career
Published: 2021-02-04 18:07:40

*[Atomic Habits](https://jamesclear.com/atomic-habits)* by James Clear is a fantastic read. At its heart, the message of the book is that setting goals is ineffective in the long run. Real, lasting change only comes through building systems—creating the right conditions for doing the right habits.

One insight Clear offers is we often mirror the habits of those around us, for better or worse. Understanding that, one of the easiest ways to develop desirable life habits is to join a group that shares your interests and is doing what you want to do.

I intentionally look for groups of people that are learners. I hang out with other developers, attend Meetups (shout out to the [ReactJS Dallas](https://www.meetup.com/ReactJSDallas/)!) and conferences, belong to various Slack and Discord groups, and listen to several programming podcasts. This has helped me develop healthy learning habits and provides an outlet to share what I've learned.

Connecting with other people is critical for personal growth, not only because it helps you develop healthy habits and skills, but, more importantly, because it creates connections and friendships that will enrich your life and expand your world view. I want to encourage you to seek out groups of people that are doing what you want to do. You'll be surprised at what you learn.

One way to discover groups of people with shared interests is by listening to podcasts. Do you have a favorite podcast? Join their community, and let me know over on the wide wide world of [Twitter](https://twitter.com/therealboone). I'm always looking to expand my listening library (and if you'd like some suggestions, I have a whole list of favorites).

Until tomorrow!