teleren/devto huggingface dataset:
Execute and Watch Elixir tests from iex.
Tags: elixir, programming, testing
Published: 2021-09-14 23:22:22

EDIT: I came up with a even better way to debug Elixir code than using `iex`, check it [here](https://dev.to/marciol/inspector-a-better-way-to-debug-elixir-code-25nf).

Interactive Driven Development, or REPL Driven Development is a really good way to approach programming, specially for developers that get distracted easily with time being expend out the main development loop or flow.

A way to do it in Elixir is just to use the `fswatch` as presented in [Elixir Mix Test documentation](https://hexdocs.pm/mix/Mix.Tasks.Test.html#module-file-system-watchers), or using the excellent [mix.test-watch](https://github.com/lpil/mix-test.watch) library, but them don't work well with `iex`, the Elixir REPL, so why not do something else.

So I created some modules that can be imported on your `iex` through the `~/.iex.exs` file and get the same benefits.

Just insert it on your `~/.iex.exs` file:

{% gist https://gist.github.com/marciol/8e173fb81517cc2b59c50d8a414386b7 file=.iex.exs %}

And create a `~/.iex` directory, placing this file on it:

{% gist https://gist.github.com/marciol/8e173fb81517cc2b59c50d8a414386b7 file=iex_watch_tests.exs %}

There is an explanition about how to use it on the `@moduledoc`, but briefly you just need to call `iex` prepending the `~/.iex` directory on the Elixir path:

```shell
  ELIXIR_ERL_OPTIONS="-pa $HOME/.iex" MIX_ENV=test iex -S mix
```

The `IExWatchTests.Helpers` that is imported on `~/.iex.exs` allows to call `f` and `s` and `a` to run failed, stale and all tests respectively.

You can call `w` to watch tests and `uw` to unwatch.

There is a really simple throttle mechanism that disallow run the suite concurrently.

That is all. Enjoy!
Top 7 Featured DEV Posts from the Past Week
Tags: top7
Published: 2021-09-14 22:19:34

---
title: Top 7 Featured DEV Posts from the Past Week
published: true
description: A round up of the most-read and most-loved contributions from the community this past week.
tags: icymi
cover_image: https://thepracticaldev.s3.amazonaws.com/i/sfwcvweirpf2qka2lg2b.png
---
_Every Tuesday we round up the previous week's top posts based on traffic, engagement, and a hint of editorial curation. The typical week starts on Monday and ends on Sunday, but don't worry, we take into account posts that are published later in the week._ 


##  Thoughtful questions and study groups

When a new developer joined @jingjing142's team, they felt compelled to write down the things that helped _them_ get started with their developer career — and lucky for us that they did!

{% link https://dev.to/jingjing142/tips-for-starting-your-first-developer-job-2gfe %}

## Quick TypeScript tip

"The next time you consider type casting a property with as MyType," writes @smeijer, "consider writing a type assertion instead." Here's why...

{% link https://dev.to/smeijer/typescript-type-assertions-4klf %}

## We all started out as beginners

@annika_h shared this soothing and helpful post that will really come in handy if you could use some motivation and advice this week.

{% link https://dev.to/s2engineers/things-you-might-want-to-hear-from-an-experienced-developer-2m9n %}


## Writing with your other hand

@jessicacregg explains how switching careers is like becoming ambidextrous — it might feel impossible at first, but when you reframe the tools at your disposal, a world of options opens up!

{% link https://dev.to/jessicacregg/my-experience-as-a-career-switcher-in-tech-4p3j %}

## 

In this guide, @dastasoft explores what Node/Express is and how it works, shows us how we can build a REST API to store and retrieve data, test endpoints, and upload our application. Super informative!

{% link https://dev.to/dastasoft/how-every-web-developer-can-become-fullstack-with-node-js-11fc %}

## 100 days of web security education

@lindsfonnes is participating in 100 days of hacking — and will be sharing content about common vulnerabilities and how we as developers can defend against them. In this intro post, Lindsey presents how they view the intersection of web security. and software development.

{% link https://dev.to/lindsfonnes/why-security-is-important-for-every-developer-21d9 %}

## Baseline, scope, and documentation

@erikmelone dives into two time-efficient ways to write better documentation.

{% link https://dev.to/erikmelone/how-to-write-clear-and-concise-documentation-4mjm %}



_That's it for our weekly wrap up! Keep an eye on dev.to this week for daily content and discussions...and if you miss anything, we'll be sure to recap it next Tuesday!_
OSD600 - My First Command Line Tool
Tags: opensource, node, cli
Published: 2021-09-14 21:38:02

The first assignment in OSD requires us to build a simple Static Site Generator(SSG) using any programming language we hope to. I choose **node.js** since I want to find out more about this tool. 

### 1. My SSG - Introduction
My Static Site Generator is created with the purpose of converting a `.txt` file into a `.html` file without having to author any HTML by hand. During the course, this tool will be updated with more and more features.

### 2. My SGG - Features
* Allows user to specify a URL to a CSS stylesheet if they want to.
* If users’ input is a folder, an `index.html` file will be generated automatically and linked to other generated HTML files.
* All generated HTML files will be stored in `./dist` folder which is created by default.

### 3. My SGG - Options
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8qbzc568mape4iav8k8y.png)**Note**: *-o or --output option hasn't been applied yet.*

### 4. My SGG - Usage
```
node index.js -i testing.txt 
node index.js -i testing
node index.js -i 'Silver Blaze.txt' -s 'https://cdn.jsdelivr.net/npm/water.css@2/out/water.css'

```
**Note**: *With file name contains white space, it should be placed inside single('') or double("") quotation mark.*

### 5. My SSG - Example
**testing.txt** -> command: `node index.js -i testing.txt -s https://cdn.jsdelivr.net/npm/water.css@2/out/water.css`
```
This is a sentence!

This is a paragraph: Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the 
industry's standard dummy text ever since the 1500s.
```

Transfered into:

**./dist/testing.html**
```
<!doctype html>
<html lang="en" dir="ltr">
<head>
<title>testing</title>
<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css">


</head>
<body>
<p>This is a sentence!</p>

<p>This is a paragraph: Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the 
industry's standard dummy text ever since the 1500s.</p>

</body>
</html>
```
### 6. Git Hub Repo 
https://github.com/hlavu/my-ssg

Finally, thank for spending time reading this post.
Day 451 : Sunshine
Tags: hiphop, code, coding, lifelongdev
Published: 2021-09-14 21:35:04

_liner notes_:
- Professional : Pretty slow day. Had a headache pretty much all day. Good thing I didn't have any meetings. Just worked on some graphics for some projects I'm working on. Also hung out in a Slack channel for a hackathon at a coding bootcamp that we are helping out with. Really looking forward to seeing what they build.

- Personal : Last night, I was able to knock out the quick side project for my friends and I could use to schedule time in an office space we share. It was a good exercise to think through some issues that came up. There's still some small issues with styling but it's good enough for everyone to start trying it out. I also attended a kick off event for a hackathon at a coding bootcamp in Tokyo.

![Looking up at a blue sky with some clouds in Waikīkī, HI, United States through the tops of palm trees](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ewg3746vhgssr2jtopm.jpg)

Going to try and rest up and see if I feel better. I think it could be the weather and the rapid change in pressure that gives me headaches. It's been pretty cloudy with not a lot of sunshine. Hoping to maybe get some feedback from the group on the application I made. I think the next step would be to make it a Progressive Web App so people can "install" it on their phone. Going to watch an episode of "Boruto" and maybe take a look back at my bigger side project and pick it back up. I think I'll work on the Cloudinary integration for  uploading an image and transforming it.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube 72udXsmd0e8 %}
Hip hop to code
Tags: music, hiphop, focus
Published: 2021-09-14 20:35:21

---
title: Hip hop to code
published: true
description: Let's talk about music to code!
tags: [music, hiphop, focus]
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u2tmhmpijhbzho58drhx.jpeg
---
I have read tons of posts about music to code. 

Some people find focus in the [sound of the rain](https://rainymood.com/). Some prefer electronic music (techno, house, ...). Some use [lo-fi](https://open.spotify.com/playlist/1PKYiQbbX3Fak5c9SiYpFQ?si=d72d082449004942) (I am thinking of you @angelolloqui). I have a few crazy friends listening constantly to heavy metal (maybe they want to [destroy everything](https://www.youtube.com/watch?v=DBwgX8yBqsw) after all). 

I have never heard of anyone proposing my new favorite genre: hip hop instrumental music. Specifically [freestyle beats](https://open.spotify.com/album/3GuOSbmbLphob1qkJ5aj80?si=UEqVNLilSLid5iuPiWJrkA&dl_branch=1). 

If you are going to give just one shot to this kind of music, [check this one](https://www.youtube.com/watch?v=DbPAtxJdhCE).
{% youtube DbPAtxJdhCE %}
If it doesn't make you move your neck, you're already dead inside 🤪

Jokes aside, what kind of music do you listen to code? Do you have something new that can surprises us? Would you like to share some beats with me? 😇

Header: [Kaysha](https://unsplash.com/photos/Kj4o6jCPulI)
JS Coding Question #8: Capitalize All Words In A Sentence [Not So Easy]😓😣
Tags: challenge, javascript, tutorial, career
Published: 2021-09-14 19:16:29

---
title: JS Coding Question #8: Capitalize All Words In A Sentence [Not So Easy]😓😣
published: true
description: Front end job interview question, 
tags: challenge, javascript, tutorial, career 
cover_image: https://images.pexels.com/photos/278887/pexels-photo-278887.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260
series: Job Interview Preparation Materials
---

#### Interview Question #8:
Write a function that will capitalize all words in a sentence.🤔

> If you need practice, try to solve this on your own. I have included 3️⃣ potential solutions below. 

> Note: There are many other potential solutions to this problem.

Feel free to bookmark 🔖 even if you don't need this for now. You may need to refresh/review down the road when it is time for you to look for a new role.

Codepen: If you want to play around and experiment with the code: https://codepen.io/angelo_jin/pen/xxrdBVE

#### Solution #1: Array Map (Recommended)
- This is one solution I would go by if I am going to be asked in an interview. It pretty straight-forward approach and is legible. 🔥
```js 
function capitalize(str) {
    return str
        .split(' ')
        .map(word => word[0].toUpperCase() + word.slice(1)).join(' ');
}
```

#### Solution #2: Array Reduce (Recommended)
- Another solution that I like. Array reduce is used as intended where one value is returned as a result of every iteration. Pretty sexy 💃 approach just like array map above.
```js
function capitalize(str) {
    return str
        .split(' ')
        .reduce((prev, current) => `${prev} ${current[0].toUpperCase() + current.slice(1)}`, '')
}
```

#### Solution #3: for-of loop
- Below is an alternative solution that can be used but it creates a variable to push results which array reduce solves easily. I see this as an OK option.
```js
function capitalize(str) {
    const words = [];

    for (let word of str.split(' ')) {
        words.push(word[0].toUpperCase() + word.slice(1));
    }

    return words.join(' ');
}
```

Happy coding and good luck if you are interviewing!

If you want to support me - [Buy Me A Coffee](https://www.buymeacoffee.com/letscode77)


In case you like a video instead of bunch of code 👍😊
{% youtube 5Vc2-kdGZ1s %}
A command line tool that converts .txt to .html in Node
Tags: javascript, node, tooling
Published: 2021-09-14 18:58:01

# cv-ssg
CV-SSG is a command line tool that will produce **.html** files from **.txt** files 

# Built with
[Nodejs](https://nodejs.org/en/)

# Features

 - Generate **.html** files from a folder of **.txt** files
 - Recursively read a folder if there's any
 - Allow stylesheets or default stylesheet
 
# Option keys

|Options             | Functions  |
|---                 |---         |
|-v or --version     | prints the current version  |
|-h or --help        | prints a list of options to the screen |
|-i or --input       | accepts either a file or a folder  |
|-s or --stylesheet  | accepts a url link to the stylesheet  |

# Usage

 1. Clone this project
 2. Install [node](https://nodejs.org/en/) on your machine
 3. Redirect to the project folder
 4. Install cv-ssg globally by using `npm install -g .`
 5. Use command line tool and type `cv-ssg -i <file name> -s <stylesheet link>`
 6. The dist folder will be placed right where you're at

# Example
**./example/files/sample.txt**
```
This is line 1
This is line 2

This is line 3
```
After running `cv--ssg -i ./example/files -s default`

**./dist/sample.html**
```
<!doctype  html>
<html  lang="en">
	<head>
		<meta  charset="utf-8">
		<title>Filename</title>
		<meta  name="viewport"  content="width=device-width, initial-scale=1">
		<link  rel='stylesheet'  href='https://cdn.jsdelivr.net/npm/water.css@2/out/water.css'>
	</head>
	<body>
		<p>This is line 1</p>
		<p>This is line 2</p>

		<p>This is line 3</p>
	</body>
</html>
```
# Repo
[cv-ssg](https://github.com/tuanthanh2067/cv-ssg/tree/main)

# License
[MIT](https://choosealicense.com/licenses/mit/)
Configure the prometheus alertmanager for you Ceph Cluster
Published: 2021-09-14 18:40:47

---
title: Configure the prometheus alertmanager for you Ceph Cluster
published: true
description: We will look into the Ceph dashboard and the different metrics you can find there. Then we will configure Prometheus Alertmanager to get timely alerts from the metrics in your Ceph Cluster.
tags:
cover_image: 
---

{% youtube ZYQr1Z9I7kc %}

We will look into the Ceph dashboard and the different metrics you can find there. Then we will configure Prometheus Alertmanager to get timely alerts from the metrics in your Ceph Cluster.
A Visualizer for PyTorch Image Transformations
Tags: imagetransformations, pytorch, machinelearning, datascience
Published: 2021-09-14 18:38:45

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7j1yrj4n7vff5bnb1wna.png)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pj0lzkwenj34vav5scom.png)

*Tldr; Check out the app [here](https://pytorch-transforms-builder.chriszhu.me/).*

Image augmentation is a common technique used when training computer vision models in order to generate artificial training data by transforming in your actual training data, for example, random rotations and shifts.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/smvyr4c4jton0fce6koc.png)_We created 4 new images of cats!_

However these augmentations can often be a source of subtle bugs. For example here is an typical PyTorch transform pipeline:

```
from torchvision import transforms

transform = transforms.Compose([
	transforms.RandomAffine(degrees=360, translate=(0.64, 0.98), scale=(0.81, 2.85), shear=(0.1, 0.5), fill=0, interpolation=InterpolationMode.NEAREST),
	transforms.ColorJitter(brightness=0.62, contrast=0.3, saturation=0.44, hue=0.24),
	transforms.RandomVerticalFlip(p=0.45)
])
```

Do you see anything obviously wrong with it?

Well, let’s see what happens when we actually try to apply these transformations to our cat.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nlybzdtarb305btvl2yl.png)_Half of these don’t even look like cats!_

As you can see the transformations were not properly tuned and resulted in a significant number of images being completely unrecognizable. If we train the model on this augmented dataset, it’s no longer learning what a cat looks like.
These sorts of bugs are tricky because no errors will be raised. Instead the result would be that the model will not perform as well on the un-augmented test dataset as it could have.

## Introducing a PyTorch transforms visualizer

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3s8lyn5siul58gz60lcw.png)

You can use this tool to develop and sanity check your transforms on actual images before using them in a training script. It supports all the transforms provided in the torchvision.transforms package.

Check it out [here](https://pytorch-transforms-builder.chriszhu.me/)!
Brand new toolkit to analyze and validate your webpack bundle
Tags: webpack, statoscope, validator, stats
Published: 2021-09-14 17:40:31

Hi! 🖐
In this post I would like to share Statoscope with you.

[Statoscope](https://github.com/statoscope/statoscope) is a modern tooklit for analyzing and validating your bundle.
You can try Statoscope by simply dropping the stats of your build into [https://statoscope.tech](https://statoscope.tech) or using a [webpack plugin](https://github.com/statoscope/statoscope/tree/master/packages/webpack-plugin) that will generate a UI-based report about your build.
![2021-09-14_20-55-13](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fju7ji268bsat38zhpx9.png) 
This report will show you full information about your build, NPM packages duplicates, and even the download speed of your bundle to a client browser. With this UI report, you can make your own requests to stats and generate your own reports about your bundle. This is very similar to python notebook, but for webpack stats and is possible thanks to a [special query language](https://github.com/discoveryjs/jora#readme).

Also, Statoscope is able to validate your build on CI, there is a special [CLI tool](https://github.com/statoscope/statoscope/tree/master/packages/cli) for this. You can make sure that, for example, the time of building your bundle or loading the bundle to a client browser does not exceed the limit you have defined.
![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3gu3wphn3pdi5q8jygdc.png)
This is very useful on CI
Also, you can generate a UI-report with validation result.
![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/afszia0pzx4aeddc3db8.png)

You could learn more on Github or ask your question here or with Github issue.
Also, [there are many plans](https://github.com/statoscope/statoscope/projects/2) to improve Statoscope features.

Your feedback is so precious 😊
All your repos are belong to us!  A talk I gave recently at a security conf.
Tags: security, devops, devsecops, cybersecurity
Published: 2021-09-14 18:17:44

I gave a talk at CrikeyCon back in March talking about the SolarWinds supply chain attack. If you aren't aware of the SolarWinds attack it is the biggest example of a software supply chain attack.  The Russian secret service (SVR) deployed a malicious loader to several SolarWinds updates in 2020 which allowed the Russians access to all the SolarWinds customers that had installed those updates.  The point of the talk was to show how we can learn from that event in the context of devsecops and our engineering practices.  https://youtu.be/nvXSlSbxnC0
Al Shop Fix {Day -27}
Tags: 100daysofcode, javascript, beginners, webdev
Published: 2021-09-14 17:59:25

#100daysofcode {day -27}

Today I've fixed some issues and updated this site. and currently updating the site



Site: https://alshop-fix.netlify.app

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jfmbccxxed8sk328j3b2.png)
Devloped our health...
Tags: healthydebate
Published: 2021-09-14 17:54:00

Tips for better developer health

As a web developer, it's a challenge to stay physically and mentally healthy
Every person is different, so the advice here regarding health is not fit for all.
If you’re having trouble, make sure to consult a physician or mental health professional.

Daily Workout? Do you eat daily? Do you drink water daily?
You will say, yes these are essential parts of human life.
But when it comes to physical health, many developers skip this thing
Spending 30 min for your body is just as good as eating 3 meals a day
Our body needs proper blood circulation and this exercise is very essential

Self Care for Mental Health: Since a human is not just a body, it is the combination of the physical and mental body Taking care of mental health is extremely important
Consider starting up a meditation practice.
Meditating can help decrease your stress and anxiety too.

Taking a fifteen-minute break during your workday to meditate can help you recenter, and finish off the day strong.

Keep your snacks away from you Do you want to fill your car with impure petrol? Obviously not, impure petrol will not only release more smoke and it also makes your car engine less effective
In the same context, please eat good food to keep your human machine with full efficiency.
Eat less but eat healthily
Eat natural, fresh and non-storage food
Eat only to fill your body need, not to fill your tongue need

Drink water While I am writing this newsletter, I have a water bottle on my side. It is very important to hydrate your body.
While we sit for a long time, we need to keep our body's fluid up to the mark
When you drink water, it just refreshes your mind
When you drink water, you do feel not empty stomach
When you drink water, you are forced to go to the washroom, which forces you to take a break and walk.

Thankyou so much...