teleren/devto huggingface dataset:
`sudo code` in WSL2 doesn't work? Short guide to the rescue
Tags: wsl, windows, bash, vscode
Published: 2021-08-30 23:47:10

If you are one of those guys who are on Windows and have been struggling with making the `sudo code .` or `sudo code {file_path}` commands work, you've come to the right place.

## DISCLAIMER
> I myself know the basics of vi/vim, but it's much more convenient for me to create/format/update configs using VS Code. I'm sure there are a lot of people out there who can do things in vi/vim faster than I do in VS Code. Good for them. This short how-to aims only to reach people who, like me, like to use WSL2 and VS Code. This article doesn't seek to compare text editors, ignite pointless holy wars, or sth like that.

## Why?
WSL2 gave us a wonderful opportunity to launch VS Code right from the Linux subsystem. That means that you can open some Linux-related config file not in vi/vim/nano, but in VS Code, then change and save it there AS ROOT. And it works. [On paper](https://code.visualstudio.com/blogs/2019/09/03/wsl2).

In reality, I wasn't able to use it in the way I've just described. After a couple of tweaks, the 'code .' command started to work properly, but I was still far from saving Linux files in VS Code. By spending some additional time, I made it work, finally.

## My setup

* Windows 10 21H1 build 19043
* WSL2 with Ubuntu 20.04.3 LTS
* VS Code 1.59.1

Without further ado, here are the steps you need to perform on your Windows machine to tame this naughty WSL2.

## Repeat after me
1. In VS Code, install the [Remote - WSL extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl).
1. In Windows, add the following line to your PATH environment variable: `C:\Users\Your User Name\AppData\Local\Programs\Microsoft VS Code`. Don't forget to substitute your user name here! ![Windows PATH environment variable](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/psi44r27df4dqeuyu5fp.jpg)
1. In WSL2, add the following lines to the `~/.profile`:
  * `alias code="code.exe"`
  * `alias sudo="sudo "` <-- there's a space before a closing quote, don't omit it.
1. Restart your WSL2 session or open a new one.
1. Run `code .` to open the current folder in VS Code;
   run `code {file_path}` to open the specified file in VS Code.
1. You're awesome!

## Useful links
👉 [Official docs on using VS Code in WSL2](https://code.visualstudio.com/blogs/2019/09/03/wsl2)
👉 [The explanation of the "sudo " trick](https://linuxhandbook.com/run-alias-as-sudo/)
IST 402: Introduction
Published: 2021-08-30 22:53:23

Hi everyone! My name Noelle Fajt and I am from Pittsburgh, PA.  I am a senior majoring in Human Centered Design and Development with a focus in Enterprise Technology Integration.  I have some experience in web development which sparked my interest to take this class; however, most of my experience with coding has been more backend. I worked as a web development production specialist for the College of IST at Penn State. For this job I was mostly using Wordpress and didn't have to do a lot of the coding myself.  This summer I interned at TJX as a software engineer.  While here I created a system to automate network configurations and deployments.  I really enjoyed this internship, but I am excited to learn more about front end development since I do not have a lot of experience here. I also took IST 256, programming for the web, last semester which was my first time using Github and group coding through it. I really enjoyed that class because it was different than any other coding class I have taken so far at Penn State.  I learned a lot about the combination of functional and non-functional requirements as well as designing.  I would like to expand from what I learned in that class and am hoping I can do that this semester.  
Outside of class I am the technology chair for my sorority Pi Beta Phi, an IST diplomat, a mentor for WIST (Women in IST), and an LA for IST 411.
how to install open edx on ubuntu
Tags: python, ubuntu, opensource, django
Published: 2021-08-30 23:23:14

By finishing this article you'll install your own production-ready learning management system.

![lms](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kn2si5jtz9dsfatwtj13.gif)
 

## What is open edX?

open edX is an open source alternative to proprietary software such as Blackboard or Udemy. It provides a flexible and scalable learning platform that can be applied in schools, colleges, and universities all around the world. Open edX is being used by 55 million students, all around the world

This article will show you how to install Open edx on your Ubuntu server and start building courses. 

You can find more information about open edX [on their official website.](https://open.edx.org)

## What you are going to learn ?

Today I am going to be showing you how to install production ready open edx on your Ubuntu server and start building courses.

I'll show you what is needed for the installation, how to install it, and how your server will look once it's finished.

## Requirements
- Ubuntu 20.04 amd64
- Minimum 8GB of memory
- At least one 2.00GHz CPU
- Minimum 50GB recommended for production servers

## Installation Steps
First make sure you have SSH access to the server and then SSH to the server.
### Install wget if it's not installed already

```bash
sudo apt-get install wget
```

### Install open edx
```bash
wget https://gist.githubusercontent.com/cubiteDevops/521cbca51ef8fa778418bdeddbd14c8c/raw/6561ba91d280ebcdfa3e6749e83f804d5bda2e89/openedx-installer.sh -O - | sudo bash
```
The above command downloads and run following script

{% gist https://gist.github.com/cubiteDevops/521cbca51ef8fa778418bdeddbd14c8c %}

This script:
- updates and upgrades the Ubuntu packages
- Prepare ansible environment in your server to install open edx
- Create strong passwords for open edx services
- Installs open edx
- Install our theme for open edx

### How should it look like
After successful installation your open edx instance should like our demo site [here](https://lms.demo.cubite.io) 


## What is next
We are writing another article to teach you how to generate SSL certs for your instance, set Domain names and create admin users.
Check this tweet to see how we improved open edx default UI by using Nextjs and Strapi
{% twitter 1415726957786972161 %}

If you need any help contact us at hello@cubite.io
Testing node-fetch with jest in TypeScript
Tags: fetch, node, typescript, jest
Published: 2021-08-30 23:16:21

*(This was originally posted on my development blog at [chrisarmstrong.dev](https://chrisarmstrong.dev), so check it out for more JavaScript and AWS related content!)*

Because I haven't seen it anywhere else, and because it was a bit tricky to set up, here is an example of testing some code that uses the [node-fetch](https://www.npmjs.com/package/node-fetch) library with TypeScript.

First install [fetch-mock-jest](https://www.npmjs.com/package/fetch-mock-jest), [fetch-mock](https://www.wheresrhys.co.uk/fetch-mock/) and its types package `@types/fetch-mock`.

Then, set up your test like follows:

```typescript
import type { FetchMockStatic } from 'fetch-mock';
import fetch from 'node-fetch';

// We need this import to get the extra jest assertions

import 'fetch-mock-jest';

// Mock 'node-fetch' with 'fetch-mock-jest'. Note that using
// require here is important, because jest automatically 
// hoists `jest.mock()` calls to the top of the file (before 
// imports), so if we were to refer to an imported module, we 
// would get a `ReferenceError`

jest.mock(
  'node-fetch', 
  () => require('fetch-mock-jest').sandbox(),
);

// Cast node-fetch as fetchMock so we can access the 
// `.mock*()` methods

const fetchMock = (fetch as unknown) as FetchMockStatic;

describe('code that uses fetch', () => {
  beforeEach(() => fetchMock.reset());

  it('should fetch a simple URL correctly', async () => {
    fetchMock.get('https://example.com', { value: 1234 });
    await fetch('https://example.com');
    expect(fetchMock).toHaveFetched({ 
      url: 'https://example.com'
    });
  });

  it('should fetch with complex assertions', async () => {
    fetchMock.post(
      'https://example.com/submit', 
      { status: 'ok' },
    );

    const result = await fetch(
      'https://example.com/submit',
      {
        method: 'post',
        body: JSON.stringify({
          type: 'create',
          details: {
            username: 'chris',
            passwordToken: 'abcde12345',
          },
        }),
        headers: { 'content-type', 'application/json' },
      },
    );

    // Check we called the right URL, method and 
    // part of the body
    expect(fetchMock).toHaveFetched(
      'https://example.com/submit',
      {
        matchPartialBody: true,
        method: 'post',
        body: { type: 'create' },
      }
    );
  });
});
```
Welcome to Your Chingu Voyage
Tags: teamwork, softwaredevelopment, webdev
Published: 2021-09-03 12:52:30

---
title: Welcome to Your Chingu Voyage
published: true
date: 2021-08-30 23:11:44 UTC
tags: teamwork,softwaredevelopment,webdevelopment
canonical_url: https://medium.com/chingu/welcome-to-your-chingu-voyage-4f3c3895191f
---

#### Sprint 1 — Monday

### Welcome to Sprint 1 Voyagers!

![](https://cdn-images-1.medium.com/max/1024/1*ARihzOi8UfG-xtlmogf8_Q.png)

Today starts the first Sprint of your Voyage Project and there’s a lot that needs to get accomplished.

This Sprint is essential to building a solid foundation for the remaining sprints, and the success of your project. Over many Voyages we’ve found that building this foundation helps the Sprints that follow go more smoothly.

Remember that in starting this project you have made a significant commitment to building experience to help you further your career. You will not only increase your knowledge and experience in technical areas, but also in “soft” skills like teamwork and project management.

The technical skills you currently have and those you will gain over the course of your project will contribute to your teams success. But, a larger factor of success is how you and your teammates will communicate and collaborate with one another.

![](https://cdn-images-1.medium.com/max/1024/1*HX6YwsL-4fO1PS19GRNNdg.png)

> It’s called “Teamwork” for a reason!

1. Take the time to communicate openly, frankly, and with respect to your teammates.
2. Spend time to define not just your project, but also the constraints you need to plan for (like time off for work and family events).
3. Remember the \*\*three “C”s\*\* — commitment, communication, collaboration. These are the essence of teamwork.

### Before you Go!

> _Chingu helps you to get out of “Tutorial Purgatory” by transforming what you’ve learned into experience. The experience to boost your Developer career and help you get jobs._

> _You can learn more about_ **_Chingu_** _& how to join us at_ [_https://chingu.io_](https://chingu.io/)

* * *
Git Workflow simples
Tags: git, github, workflow
Published: 2021-09-06 21:51:35

---
title: Git Workflow simples
published: true
date: 2021-08-30 22:56:35 UTC
tags: Git,Github,Gitlab,workflow
canonical_url: https://mazer.dev/git-workflow-simples/
---

Neste artigo apresento uma proposta para um fluxo de trabalho simples usando a ferramenta de [gestão de versão de código fonte](https://mazer.dev/o-que-e-gerenciamento-de-codigo-fonte) padrão do mercado, um [Git](https://mazer.dev/o-que-e-git) workflow.

Para uma gestão eficiente de um projeto de desenvolvimento de software, além do uso elementar de uma ferramenta de [versionamento](https://mazer.dev/controle-de-versao-o-que-e), é importante definir uma padronização de organização para a equipe.

## Git workflow simples

A imagem a seguir apresenta um diagrama que resume o trabalho regular, de forma simplificada, em um projeto de desenvolvimento com versionamento de código usando Git:

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j7lu06fncl4srheo5rdm.png)
 
A sequência a seguir descreve o passo a passo para este fluxo de trabalho, considerando um caminho sem a ocorrência exceções no andamento do desenvolvimento de um projeto de software.

Para um tutorial com os comandos Git para executar esta sequência, [leia o post original]((https://mazer.dev/git-workflow-simples/)).

* Criação do repositório
* Commit inicial no branch master
* Proteger o branch master para que não seja possível fazer push direto nele.
> Os serviços Github, Gitlab e Bitbucket permitem esta proteção no repositório
* Criação do branch dev para ser utilizado pelo desenvolvimento
* Realizar os commits no branch dev
* Ao chegar em um momento de realizar testes para publicação da aplicação em produção, criar o branch test
* Fazer o merge de dev em test, enviar para o repositório central e realizar o deploy no servidor de testes
* Se todos os testes passarem, fazer o merge de test em master, criar tag de versão, então publicar em produção
* Continuar o desenvolvimento em dev
* Novo ponto de estabilidade para publicação em produção, novamente fazer o merge de dev em test
* Caso algum erro/falha seja encontrado no teste, corrigir em dev
* Após correções, novo merge de dev em test – comandos anteriores
* Após todos os testes serem aceitos, merge de test em master, tag de versão, publicar em produção – comandos de publicação em produção e master explicados acima
* Continuar o fluxo de trabalho descrito

Desta maneira, consideramos que a versão em produção será sempre igual à última tag do branch master. A última versão no ambiente de testes será sempre a última entrada (HEAD) no ramo test.

Enquanto o desenvolvimento continua trabalhando no branch dev com as novas funcionalidades a serem implementadas.

O link a seguir apresenta a continuidade do artigo com o fluxo tratando correções de produção.

O post [Git Workflow simples](https://mazer.dev/git-workflow-simples/) apareceu primeiro em [MAZER.DEV](https://mazer.dev).
How to work with Sage locally
Tags: help, sagemath, latex
Published: 2021-08-30 22:54:00

Although you can use [Cocalc](https://cocalc.com) to create mathematical documents with LaTex this can be slow when working on big projects, for that reason you can do the following to use LaTex with SageMath from your **local computer**, and even working without internet. Follow the next steps:

### Install LaTex
- Download and install _LaTex_ for you own system [here](https://www.latex-project.org/get/#tex-distributions).

### Install SageMath
- Download the _SageMath_ [here](https://www.sagemath.org/download.html). I recommend to use the _MIT, Cambridge, MA, USA_ version which has work perfect for me.
- Install the program from the downloads folder.
- If you are using MacOS do the following:
  - Move the uncompressed _Sage_ folder into _Applications/_.
  - Start the _Sage App_, if you do not see it's in the following path: `/Applications/SageMath/sage`.
  - Run the command `!sudo ln -sf $/Applications/SageMath/sage /usr/local/bin`. You may be ask to write your password. This will allow _Sage_ to be recognized as a terminal command which is **very important** in order to compile our work.
  - Quit Sage.

With that you are ready to go, keep in mind that each time you want to compile with `pdflatex document.tex`, instead of that you have to do the following in order for Sage to calculate your solutions:
```bash
pdflatex document.tex
sage document.sage
pdflatex document.tex
pdflatex document.tex
```

Now you're ready to go and start creating documents with your favorite text editor or with the default installed with LaTex, a good recommendation could be use [Visual Studio Code](https://code.visualstudio.com) with the _extension_ [LaTeX Workshop](https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop).
Resumo da documentação do Heroku com Python
Tags: heroku, python, ubuntu, linux
Published: 2021-08-30 22:37:25

O [Heroku] é uma plataforma de nuvem como serviço (PaaS) que suporta várias linguagens de programação e está ativa desde 2007. 
Essa postagem é um resumo da [Documentação do Heroku] a qual recomendo a leitura e estudo. 

1. Instalação no Linux:
```bash
sudo snap install heroku --classic
```

2. Efetuar o login com o comando:
```bash
heroku login
```

3. Instalação do Heroku CLI 
```bash
git clone https://github.com/heroku/python-getting-started.git
cd python-getting-started
```

4. Criar a aplicação no Heroku:
```bash
heroku create
```

5. Finalizar o deploy:
```bash
git push heroku main
```

6. Verificar a excução:
```bash
heroku ps:scale web=1
```

7. Abrir o site criado:
```bash
heroku open
```

##### Referências: [Heroku com Python: Getting Started], [Documentação do Heroku] e [Heroku].

[Heroku com Python: Getting Started]: https://devcenter.heroku.com/articles/getting-started-with-python
[Documentação do Heroku]: https://devcenter.heroku.com/categories/python-support
[Heroku]: https://www.heroku.com/platform

**Postagem Disponível**
[![Hashnode](https://img.shields.io/badge/📃%20Publicado_no-Hashnode-blue?&style=for-the-badge&logoColor=00C11C)](https://maosnocodigo.hashnode.dev/) [![evernote](https://img.shields.io/badge/Compartilhado%20no-Evernote-green?logo=evernote&style=for-the-badge)](https://www.evernote.com/shard/s580/sh/09ab3314-e289-39d8-532d-483de52028db/38773b49bf84d866943c9e3caa97263f) [![dev.to](https://img.shields.io/badge/Disponível%20no-dev.to-black?logo=dev.to&style=for-the-badge)](https://dev.to/mayannaoliveira)

**Redes sociais**
[![github](https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white)](https://github.com/mayannaoliveira) [![dev.to](https://img.shields.io/badge/dev.to-100000?style=for-the-badge&logo=dev.to&logoColor=white)](https://dev.to/mayannaoliveira) [![gmail](https://img.shields.io/badge/Gmail-D14836?style=for-the-badge&logo=gmail&logoColor=white&link=mailto:mayannait@gmail.com)](mailto:mayannait@gmail.com) [![whatsapp](https://img.shields.io/badge/WhatsApp-25D366?style=for-the-badge&logo=whatsapp&logoColor=white)](https://api.whatsapp.com/message/5XLG4UPSFCNWP1) [![linktree](https://img.shields.io/badge/linktree-39E09B?style=for-the-badge&logo=linktree&logoColor=white)](https://linktr.ee/mayannaoliveira) [![instagram](https://img.shields.io/badge/Instagram-E4405F?style=for-the-badge&logo=instagram&logoColor=white)](https://www.instagram.com/oliveiramayanna/) [![twitter](https://img.shields.io/badge/twitter-blue?style=for-the-badge&logo=twitter&logoColor=white)](ttps://twitter.com/oliveiramayanna/)
**Se inscreva, curta e compartilhe!**
3 Reasons to Upgrade Git For The First Time Ever
Tags: git, tips
Published: 2021-08-30 22:29:07

---
title: 3 Reasons to Upgrade Git For The First Time Ever
published: true
description: Relatively new Git features that actually have me excited
tags: Git, Tips
slug: upgrade-git
canonical_url: https://www.swyx.io/upgrade-git
---

Git moves at a surprisingly fast pace - as of Aug 2021, the current version of Git (`git --version`) is 2.33.

I don't normally know or care what my Git version is, but over the past year this changed. The Git team must be doing something right, because I've noticed a few things trickle down to my relatively light usage:


## `init.defaultBranch`

The default branch in Git is named `master`. As of Git 2.28, you can now configure it to anything else. Of course, [this is merely symbolic](https://mooseyanon.medium.com/github-f-ck-your-name-change-de599033bbbe) but is an appreciated signal.

```bash
git config --global init.defaultBranch main
```

This setting will work for new repos. For existing repos, and git aliases that work nicely with BOTH `master` and `main`, you can see my [Cheatsheet for moving from Master to Main](https://dev.to/swyx/move-primary-git-branch-from-master-to-main-m7c).

## `git sparse-checkout`

You probably know about `git clone -–depth 1 [remote-url]` for repos where you don't want to download the full history. Git 2.25 introduced an additional command for giant repos, where even the current version is too big. So sparse checkout is like `git clone --depth 1` but for files:

```bash
git clone --no-checkout https://github.com/my/big-repo
cd big-repo/
# only files at the root
git sparse-checkout init --cone 
# only files in specific directories (recursive)
git sparse-checkout set <dir1> <dir2> ...

# do it
git checkout main
```

[More on the GitHub blog](https://github.blog/2020-01-17-bring-your-monorepo-down-to-size-with-sparse-checkout/).

## `git restore`

I needed this one today. Basically if you screw up a file and need to bring it back from Git, you can use the new `git restore` command in v2.23:

```bash
git restore path/to/file # discard current changes
git restore --staged path/to/file # unstage staged file
git restore --source [hash] path/to/file  ## restore from specific commit hash
```

> ⚠️ Be careful - once you run this command you cannot get back the changes you discard.

Yes, there are confusingly similar commands between `checkout`, `restore`, `reset`, and even `switch`. [This StackOverflow answer](https://stackoverflow.com/a/58003889/1106414) clarifies pretty authoritatively:

- `git-revert` is about making a new commit that reverts the changes made by other commits.
- `git-restore` is about restoring files in the working tree from either the index or another commit.
This command does not update your branch.
The command can also be used to restore files in the index from another commit.
- `git-reset` is about updating your branch, moving the tip in order to add or remove commits from the branch. This operation changes the commit history.
git reset can also be used to restore the index, overlapping with git restore.
Simplifying an event driven pipeline with AWS Lambda & EMR.
Published: 2021-08-30 22:24:10


![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4vkofsci1rxc2c3wqgu3.jpg)
A batch event driven pipeline could contains the following steps:
1. A file containing new records would be dropped to a S3 landing bucket directory by a source system.
2. A lambda function using the S3 bucket directory landing directory as trigger to either initialize a new transient EMR cluster with the new file as a Spark Step or add the new file in an existing EMR. This check could be performed against the EMR name.
3. The EMR Spark process would perform the data transformations & enrichments using third party data contained in an RDS. The produced file would be exported to an output bucket directory.
4. An Athena table would point on the s3 output bucket directory for users perform analytics on the produced data.

####EMR Configurations
Step Concurrency - should be more than one if the data pipeline can handle parallel step executions.
Auto-Termination - If true cluster is transient, it is suggested for unpredicted and unscheduled loads as having an EMR cluster running indefinitely is not cost-effective. The EMR while bootstraping occurs no costs.
Busco FRONTEND para crear proyectos
Tags: javascript, html, css, webdev
Published: 2021-08-30 21:51:58

Me apetece crear proyectos, aprender y busco un compañero que controle de desarrollo frontend para crear proyectos de webs que puedan funcionar, freelances o también por aprender y tener un bonito portfolio.

Tengo pensado trabajar como freelance creando una agencia de desarrollo web y marketing en un futuro.

CONTACTO
correo:jordimolto1@gmail.com
DIRECTIVA DE SASS @WHILE LOOP 
Tags: html, css, javascript, sass
Published: 2021-08-30 21:50:43

La directiva @while toma una expresión SassScript y repite indefinidamente los estilos hasta que la expresión da como resultado false. Aunque esta directiva se usa muy poco, se puede utilizar para crear bucles más avanzados que los que se crean con la directiva @for.

![2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9hveuf77p0z4mxmu93gp.png)

Ejemplo: https://www.youtube.com/watch?v=vw-6A-AXtJI&list=PLdOvUxUGWqpIX5MaK1u7tTTK5j-eJwwzd&index=4