teleren/devto huggingface dataset:
Running Docker Containers for the NVIDIA Jetson Nano
Tags: jetsonnano, machinelearning, ai, docker
Published: 2020-06-02 22:08:46

The NVIDIA Jetson Nano, a low cost computer aimed at Machine Learning and AI tasks, can be effectivley used with Docker to increase development speed. Lets go through how you can setup docker to develop applications for the Jetson Nano on your x86 machine by emulating the Jetson Nano's ARM architecture and L4T OS.

# Install Docker
To run docker containers, you'll have to install the docker engine. Follow the instructions [here](https://docs.docker.com/engine/install/) to install docker for your OS. 

# Configure Docker for aarch64
```bash
sudo apt-get install qemu binfmt-support qemu-user-static # Install the qemu packages  

docker run --rm --privileged multiarch/qemu-user-static --reset -p yes # This step will execute the registering scripts  

docker run --rm -t arm64v8/ubuntu uname -m # Testing the emulation environment  
aarch64 # Outputs the correct architecture
```

# Configure Docker for NVIDIA
```bash
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list

sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
sudo apt install -y nvidia-docker2
sudo systemctl daemon-reload
sudo systemctl restart docker
```

# Pull NVIDIA Docker Containers
Run `docker pull nvcr.io/nvidia/l4t-base:r32.4.2` to get the docker container. 

To run the container:

1.  Allow external applications to connect to the host’s X display:
    
    ```
    xhost +
    ```
    
2.  Run the docker container using the docker command
	```
	sudo docker run -it --rm --net=host --runtime nvidia  -e DISPLAY=$DISPLAY -w /opt/nvidia/deepstream/deepstream-5.0 -v /tmp/.X11-unix/:/tmp/.X11-unix nvcr.io/nvidia/deepstream-l4t:5.0-dp-20.04-samples
	```

_Arguments_
- _-it_: opens interactive terminal
- _--runtime nvidia_: uses the GPU
- _--rm_ removes the container once you close the terminal.

An interactive terminal will pop up with the docker container running!
[won] The 16hours battle to installed pychess
Tags: python, linux, chess, todayilearned
Published: 2020-06-02 21:58:19

After coding for the day at 17:00, I needed to take a break. Then decided to play chess on my PC. This is how the 1st hour began.

I won't go into the nitty-gritty detail, instead I would tell you where the battle was tough and how it was won.

...

Okay let's begin! 🏁
The battle started with a Google search: "best chess games for linux". After scanning through few posts, I went for pychess because SCIDvsPC couldn't install and I'm a pythonista, I would like to check out pychess source code someday.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/orlf9azd3fn3t8qldbcz.png)

<br>
Now, I have decided to go with pychess. First I tried installing it using pip:
```shell
$ pip install pychess
```
Within a minute, it installed. "WOW that was fast", I said to myself. Then I tried to open the app, but it failed to startup. At that moment, I think I heard my PC say "YEAH not so fast".


![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/kyujpvsplyl5ni8qrbty.png)
I kept on battling with it. I went back to my dear friend Google, and he directed me to Professor Stackoverflow and others, but they give me no direct answer. After about 3 hours, I saw something about cloning the pychess git repo.

...
```shell
$ git clone https://github.com/pychess/pychess.git
```

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/18ejvhh0mfps18uhn5m0.png)

...
<br>
Surprisingly, this somehow worked. I could run the pychess directly from the repo I cloned. But when I wanted to install it, another phase of the battle began.
To cut it all short, this is how the battle was won (also what I learnt):
* The first time I tried to install it, I did it without the magic word, "_sudo_", and It stopped half way.
* Then I had to uninstall it. Unfortunately, my terminal told me I can't use  "__pip uninstall pychess__" to remove a distutils project.
* So I went to _/usr/local/lib/python3.6/dist-packages_ to remove everything that had pychess on it.
* My terminal refused to do what I said until I did it the hard way:
```shell
$ sudo rm -rf /usr/local/lib/python3.6/dist-packages/pychess/
$ sudo rm -rf /usr/local/lib/python3.6/dist-packages/pychess-1.0.2.egg-info
```
* It was out. This time I remembered to add the magic word, "_sudo_", as I tried to reinstall the pychess from the cloned repo.
* And at last, IT WORKED.🚀

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/skegmmvxdr8ffdgaxpmw.png)
What’s your alternative solution? Challenge #56
Tags: challenge, javascript, codenewbie, learntocode
Published: 2020-06-02 21:27:13

# About this series

This is series of daily JavaScript coding challenges... for both beginners and advanced users.

Each day I’m gone present you a very simple coding challenge, together with the solution. The solution is intentionally written in a didactic way using classic JavaScript syntax in order to be accessible to coders of all levels.

Solutions are designed with increase level of complexity.

## Today’s coding challenge

```
Create a function that will receive n as argument and return an array of n random numbers from 1 to n. 

```

(scroll down for solution)

## Code newbies

If you are a code newbie, try to work on the solution on your own. After you finish it, or if you need help, please consult the provided solution.

## Advanced developers

Please provide alternative solutions in the comments below. 

You can solve it using functional concepts or solve it using a different algorithm... or just solve it using the latest ES innovations.

By providing a new solution you can show code newbies different ways to solve the same problem.

## Solution

```javascript
// Solution for challenge50

println(getRandomNumbers(10));

function getRandomNumbers(n)
{
    var ar = [];
    
    for(var i = 1; i <= n; i++)
    {
        ar.push(i);
    }
    
    shuffleArray(ar);
    
    return ar;
}

// Shuffle array implemented using Fisher–Yates shuffle algorithm
function shuffleArray(ar)
{
    for(var i = ar.length - 1; i > 0; i--)
    {
        var j = randomInt(0, i - 1);
        
        var t = ar[i];
        ar[i] = ar[j];
        ar[j] = t;
    }
    
    return ar;
}

// Get a random int between min and max (both included)
function randomInt(min, max) 
{
    return Math.floor(Math.random() * (max - min + 1) ) + min;
}

```


To quickly verify this solution, copy the code above in this coding [editor](https://codeguppy.com/code.html) and press "Run".

> Note: The solution was originally designed for [codeguppy.com](https://codeguppy.com) environment, and therefore is making use of `println`. This is the almost equivalent of `console.log` in other environments. Please feel free to use your preferred coding playground / environment when implementing your solution.
PHP on VS Code
Tags: discuss
Published: 2020-06-02 21:50:08

I'm a long user of the JetBrains PHPStorm(JPS), but I'm seeing a lot of new features on VS Code, but I can't find a extension that make easy to insert a path to a file like I used to use on JPS.
Exemple:
`require_once __DIR__ . '/../'`
On VSC it doesn't show me the correct path considering the global __DIR__ variable on autocomplete.
Does anyone have a suggestion on how to solve this problem?
[EN-US] Creating a background-gradient with 3 lines of Pure-CSS
Published: 2020-06-02 21:49:39

*para ler o artigo em português, [clique aqui]*(https://www.linkedin.com/pulse/criando-background-gradiente-com-3-linhas-de-pure-css-juliana-gaioso/?published=t)

First, let's see the code, and then analyze it.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/s888e1magbxav66fhmkg.png)
The background-image property create a background element. Now, we have two problems: first, some browsers don't recognized the property linear-gradient. This is easily adjusted with the property background-color, that in this case show a solid color. Second: for definition, the gradient repeats until it occupies the entire screen if the area of ​​the element is larger than the area occupied by the content (in the gradient direction). Thats adjusted with the property background-repeat, this determines that the property is executed only once. In this case, the rest of the element area will display the color of the background-color, used in the second line, so it is important to use the same color in the background as the outermost region of the gradient.


To see the code working, [click here](https://codepen.io/unicorntech/pen/ExPYROv)
What are your pros and cons of working from home
Tags: pros, cons, work, home
Published: 2020-06-02 21:37:55

Given the current pandemic situation, companies are now looking to allow working from home a permanent thing, some with no option to work in an office.

We've all been working from home for some time now, what benefits and disadvantages have you seen when it comes to working from home? 

These are mine.

**Pros:**

**No commute** - Work starts at 9.30am, i can be wake up at 9.15 and be ready.

**Quiet and little distraction** - It's easy to have a quiet environment now. My office is often noisy that having an earphone is essential.

**Cooked meal** - I've learnt to love home cooked meal. I have also learnt new recipes in this lockdown.

**More time** - I seem to have more time in my hand these days, i can sleep more, find time for exercise and entertainment.

**Cons**:

**Time control** - I often see myself working overtime or attending late meetings. Something that rarely happens in an office situation.

**Getting help** - As a developer, it is easy to run into tricky coding or technical difficulty, in an office situation, it's easy to pull your teammate around, pair-program etc. Now, i often find myself staring at the chat window for minutes or hours, hoping they still like to me enough to reply.

**Meetings are sometimes awkward**
In an office situation, developers meetings tend to be fun. Sprint review, retrospective meeting. Sprint planning is more energetic and often entertaining. Now, it's like _"sorry, i'm on mute"_
How to Install Go on the Raspberry Pi
Tags: programming, go, raspberrypi
Published: 2020-06-02 21:21:05

---
title: How to Install Go on the Raspberry Pi
published: true
description: If you want the latest version of Go on your Raspberry Pi, here's a quick tutorial that can help.
tags: programming, go, raspberrypi
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/580bmvbio85cjby0aasq.jpg
canonical_url: https://www.jeremymorgan.com/tutorials/raspberry-pi/install-go-raspberry-pi/
---
f you want to install Go on your Raspberry Pi you have a few options. In the past there was a lot of cross compiling and hacking to get it done, but now you can install it through Apt. However, you're likely to find an older version.

![How to install Go on Raspberry Pi](https://dev-to-uploads.s3.amazonaws.com/i/9rpa13qmxarm7q30hf1l.jpg)

For instance at the time of this writing, an updated Raspberry Pi OS shows a version of 1.11.1 in the repositories. However the current version is 1.14.3 so if the latest version is important to you, here's your solution.

## Step 1: Get the Latest Package

To get the latest version, browse on over to the [Go download page](https://golang.org/dl/) and look for the latest version.

![How to install Go on Raspberry Pi](https://dev-to-uploads.s3.amazonaws.com/i/l8a0j8tw7amdocklxy52.jpg)

Look for the "ARM v6 version" for the Raspberry Pi.

My current archive is [https://dl.google.com/go/go1.14.4.linux-armv6l.tar.gz](https://dl.google.com/go/go1.14.4.linux-armv6l.tar.gz)

Whichever archive you choose, use wget to download it:

```
mkdir ~/src && cd ~/src
wget https://dl.google.com/go/go1.14.4.linux-armv6l.tar.gz
```
Now you have the latest package.

## Step 2: Extract the Package

Now you'll want to extract the package into your local folder:

```
sudo tar -C /usr/local -xzf go1.14.4.linux-armv6l.tar.gz
rm go1.14.4.linux-arm64.tar.gz
```

## Step 3: Configure Go

Now you just need to configure it, which you have to do with any Go installation anyway.

Open up your ~/.profile (Using nano, vi, etc)

```
vi ~/.profile
```

and add the following:

```
PATH=$PATH:/usr/local/go/bin
GOPATH=$HOME/go
```
Notice here you can set your go path to whatever you like. I prefer /go, but you can put this wherever you want.

Update your shell with your changes:

```
source ~/.profile
```

And check your version:

![How to install Go on Raspberry Pi](https://dev-to-uploads.s3.amazonaws.com/i/iynt4p36291db0p17uwz.jpg)

And you're good to Go!

Get it? Yeah I'll show myself out.

Enjoy!
How to manage several SSH Config files on Mac and Linux (quick-note)
Tags: devops, ssh, howto, macos
Published: 2020-06-02 21:17:30

Use the `Include` directive to merge an external config file in the main (default) ssh config file.

1. Create another config file as usual.
2. Add the following line at the beginning of your `~/.ssh/config` file
	```bash
	 Include path-to-new-config-file
	```

	for example, if we have a config file in `~/Documents/.ssh/config` add `Include ~/Documents/.ssh/config` in your main `~/.ssh/config` file

## What is this good for?

As I mentioned in [How to use multiple SSH keys on a Mac with Github or Gitlab](https://diegocarrasco.com/how-to-use-multiple-ssh-keys-on-a-mac-with-github-or-gitlab/ "How to use multiple SSH keys on a Mac with Github or Gitlab") my objective is to s separate personal projects from work projects. In this case, I can use an ssh config file for work and another file for my projects, and then include my projects into the main config file.
This also allows me to track my changes with a private git repository without worrying about confidential information from work. 


# References and further reading
- [ SSH Config Includes](https://io.adafruit.com/blog/notebook/2016/09/27/ssh-config-includes/ "SSH Config Includes")
- [ Can you have more than one /.ssh/config file? ](https://serverfault.com/questions/375525/can-you-have-more-than-one-ssh-config-file "Can you have more than one ~/.ssh/config file?")
Providing own API-Keys
Tags: help, node, webdev
Published: 2020-06-02 21:15:05

Hey everyone! Hope you make it through these ruff times. I have a simple question here:

I want to make sure that only my Angular-App can use my NodeJS api. I know that many big api's provide api keys like google or AWS does. Is there a way to provide your own api key's for your app's?

Thx for you help 
Have a great day!
How I Integrate Svelte With Gsap 3
Tags: javascript, beginners, svelte, animation
Published: 2020-06-02 21:13:45

In my opinion Gsap is one of the best animation libraries out there,
roughly 10 million sites use GSAP,so yeah it is a pretty big deal.
You can learn more about it [here](https://greensock.com/why-gsap/).

In this brief and hopefully informative post, I want to show you guys how
I use Gsap with one of my favorite frameworks Svelte.

I assume you already know how to setup a basic svelte project,So I will skip that part and let's just quickly install Gsap

```bash 
npm install gsap 
```
now under the src folder,lets create a file called animate.js
and fill it with this

```js
import { gsap } from "gsap";

export function animate(node, { type, ...args }) {
  let method = gsap[type];
  return method(node, args);
}

```

Now how do we use this little function we just wrote,
for one we can use it with svelte [actions](https://svelte.dev/tutorial/actions). 
Actions are element-level lifecycle functions. They're useful for things like interfacing with third-party libraries,actions are very similar to transitions,to use the function we made as an action we make use of the **use** keyword on the element we want to animate.

App.svelte
```html
<script>
  import { animate } from "./animate.js";
  let desc = false;
</script>

<style>
  main {
    text-align: center;
    padding: 1em;
    max-width: 240px;
    margin: 0 auto;
  }
</style>

<main
  use:animate={{ type: 'from', duration: 1, opacity: 0, onComplete: () => (desc = true) }}>
  Gsap baby
</main>
```

That will just fade in "Gsap baby" when the page loads and fire the callback once thats done.
we can also use this to transition elements that are entering or leaving the dom.

```html 

<script>
  import { animate } from "./animate.js";
  let desc = false;
</script>

<style>
  main {
    text-align: center;
    padding: 1em;
    max-width: 240px;
    margin: 0 auto;
  }

  @media (min-width: 640px) {
    main {
      max-width: none;
    }
  }
</style>

<main
  use:animate={{ type: 'from', duration: 1, opacity: 0, onComplete: () => (desc = true) }}>
  <h1>Helllo broooooo</h1>
</main>

{#if desc}
  <p
    transition:animate={{ type: 'from', duration: 1, opacity: 0 }}
    class="desc">
   Lorem ipsum dolor sit amet consectetur adipisicing elit. Quae natus libero quisquam, aliquam quod vel quia necessitatibus? Cupiditate, excepturi nisi. Nam tempora ex numquam voluptatum minima similique sequi, fugit placeat!
  </p>
{/if}

```

Hope that was helpful,Peaceeeeeee.
How Can we Change Prejudice in YouTube's Algorithm?
Tags: discuss, ai
Published: 2020-06-02 21:13:03

Much has been discussed about biases when it comes to Artificial Intelligence. A bias is inevitable and is the result of our experiences, our personality, the place we occupy in society. But when a bias is reflected in an algorithm with the potential to impact thousands, millions of lives, it can become very dangerous. We know that it's not an algorithm that is prejudiced in its essence, but how it learns from our view of the world. We have seen examples of this in several studies, whether Google SERP can be sexist or how artificial intelligence is deciding life in the prison system.

This itself is a problem, but what happens when a company is aware of its bias and still maintains its algorithm? Can we hold this type of behavior accountable?

I was really impacted by a video I saw today from **Vice**. It shows a group of youtubers suing the platform for prejudice against their content aimed for the LGBTQ community. The group claims that YouTube restricts, blocks, unfairly demonizes content with words *"gay", "bisexual"* or *"transsexual"* in the titles.

{% youtube P2NZ0kmTSo8 %}

The power of a company like Google to educate, form opinions and allow many to live off the content they produce, around the world, is impressive. And seeing the use of algorithms to target or directly affect someone or a group is just astounding. As a student in the field, seeing that kind of behavior from a company that is said to support diversity is extremely disheartening and scary. As people in the area, talking and studing technology, what can we do to change this reality? 

Photo by [Szabo Viktor](https://unsplash.com/@vmxhu?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)
100 Days of SwiftUI — Day 13
Tags: 100daysofswiftui
Published: 2020-06-02 21:12:40

---
title: 100 Days of SwiftUI — Day 13
published: true
date: 2020-06-02 21:11:14 UTC
tags: 100daysofswiftui
canonical_url: https://zeitschlag.net/100-days-of-swiftui-day-13/
---

Time flies. A few weeks ago, COVID—19 has caused a global pandemic — which is still there — and eight days ago, a white racist police officer murdered [George Floyd](https://en.wikipedia.org/wiki/Killing_of_George_Floyd). Two days later, [Tony McDade](https://en.wikipedia.org/wiki/Shooting_of_Tony_McDade) was killed by the police. Yesterday, the police shot [David McAtee](https://en.wikipedia.org/wiki/Shooting_of_David_McAtee). Just to name a few. The racist murder of innocent Black people by the police must stop, once and for all.

[Please help, if you can](https://blacklivesmatters.carrd.co/#). [Donate, if you can](https://blacklivesmatters.carrd.co/#donate). [Black Lives Matter](https://blacklivesmatter.com).

* * *

It's been nearly two weeks, since I've joined [this SwiftUI-course](https://www.hackingwithswift.com/100/swiftui/13). It's so unimportant at the moment. Time flies.

<!--kg-card-end: markdown-->
A Beginners Guide To Git & Github: 3 Easy Steps To Store Your Projects On Github
Tags: github, git, codenewbie
Published: 2020-06-02 20:58:20

This article explains how to get started with git as a beginner. It’s likely that you might have the word “Git” & “Github” before. Don’t get it twisted they ain’t the same thing.

Git is a version control system for tracking changes in source code during software development. It is designed to coordinate work among programmers, but it is used to track changes in any set of files. While Github is literally a platform where developers store their projects and network with like-minded people.

The 3 easy steps to store your projects on Github
Having described what “Git” & “Github” means. let’s follow this practical steps to get a better understanding better of how git and github works.

**STEP 1: Install Git & Create a Github account**

If you don’t have git installed on your computer follow the instructions [here](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) to install git. Once you are done with that [Signup](https://github.com/join) for a free Github account.

**STEP 2: Create a new repository**

To get started with this, [login](https://github.com/login) to your github account. After a successful login, it automatically redirects you to the dashboard. There you will see a green button named “New”. Click on it to create a new repository, Thereafter;

- Input a repository name
- Input the project description (tho it is optional)
- Lastly click on “Create repository”

**STEP 3: Add your files**

Open the terminal program on your computer and navigate to the folder where your files are (the files you intend to upload). Then follow this subsequent steps;

- git init
- git add .
- git commit -m “first commit”
- git remote add origin https://github.com/your-username/repository-name.git
- git push -u origin master
And if you go back to the repository you created earlier you should see your files there.

Yeah, that’s all. You have just created your first github repository. I’m glad you now understand how git and github works.