teleren/devto huggingface dataset:
How I Use My Terminal as a Webcam
Tags: tutorial, github, terminal, productivity
Published: 2020-08-30 09:55:36


Te-We is a project which focuses on using a webcam just with a terminal. Powered by Python we will be creating a terminal stream of webcam.
One day I was going through my system to find a webcam application but was not able to find one because I use Debian Linux and I added each and every software manually, so I never downloaded anything for the webcam.
So I thought why not make something with a terminal for this, I came across a project which was an Image to Ascii Project and I thought why not combine the video stream with a similar project and hence TE-WE was developed

---

This whole thing is an Ascii Art of a video stream from the webcam.
If you find it interesting, you can find the whole unscripted programming video of it at
{% youtube me2RsizTnU4 %}

---

So getting back to the code part. Let's start with it.

## Step 1
Create an Ascii Image using an actual image
## Step 2
Replace the Ascii Image with a video stream frame and print them one over the other to get the effect of a continuous frame.
Done!!


---

Let's Discuss everything in Detail, Our first aim would be to convert

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ei5jt7x17v1wrrmn8x2u.jpg)

to an Ascii Image like


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

Once it's Done all that's left is to create a video stream as a source for frames to the program.

---

Let's see the code first

{% gist https://gist.github.com/pr4k/d0874fbccfb96273c8cc8ea24bc80cb4 %}
Let me explain everything here. For now ignore the line 10–12, remaining part is simple, convert the whole RGB image to black and white image so that we can actually get the intensity of each pixel.
Then based on the intensity of each pixel we will find a suitable character for each pixel and create an image out of it.
But the problem is that its still black and white, so the next part would be to get the approx ANSI color for each pixel hence we will find the colored image printed.
Let's see the code to get RGB to ANSI, It was taken from a library
{% github torrycrass/image-to-ansi no-readme %}

{% gist https://gist.github.com/pr4k/553c0d404d9a6303e49a93b2807e6db3 %}

---

Here is the code, It's pretty simple and actually just based on some mathematical solution.
So with this, we will get the ANSI color code from RGB and them we just need to get the ANSI color for each pixel, and here the line 10–12 will come into action
We are using their RGB value for each pixel and saving the ANSI color code separately before converting the image to black and white.
And done, our first part is done.

---

## Step 2
Adding a video stream is simple and can be found anywhere, as it's just using opencv to get the frames from video and printing it on screen.
So here we are done.


---

## Final Demo

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/t1uz81j3gq5yoohqiosj.gif)

## Feedback
Do leave feedback on the project, If you want to check out the source code. Here it is
{% github pr4k/Te-We no-readme %}
It gone wrong, how do you deal with bad feedback?
Tags: opensource, discuss
Published: 2020-08-30 09:54:18

I have this library which I thought was a good idea, the post got a lot of good reactions but there are only 2 comments and both attempt to tear great big holes, I wonder if it's my explanation or lack of documentation, but still, I feel like the idea is tarnished somehow. How do you deal with bad feedback?
Binding in PHP
Tags: php, webdev
Published: 2020-08-30 09:52:24

Understanding binding in PHP is essential for anyone that wants to use this unique language.

Late Static Binding (LSB) is the combination of Late binding and Static binding, two different concepts.

## Static?

You make static calls when you don't need any object creation. You can read this post if you need more details :

{% link https://dev.to/jmau111/understanding-php-static-274p %}

It's not rare to use static calls, even when a class inherits from its parent class. You may need some features that won't vary.

## Static binding

Sometimes, people refer to static binding with another term: early binding. 

Static binding happens when you use the scope resolution operator `::`.

When inheriting from a mother class in your child class, there's a counter-intuitive behavior (maybe not ^^):

```php
<?php

class MotherClass {
	protected static $cat = "generation A";

	public static function displayCat() {
		echo self::$cat;
	}
}

class ChildClass extends MotherClass {
	protected static $cat = "generation B";
}

ChildClass::displayCat();// displays "generation A"
```

As the `displayCat()` method is defined in the parent class, you'll get the parent stuff even if you call it with the child class.

PHP resolves it using the class in which the method belongs.

## Late binding

Sometimes, people refer to late binding with another term: dynamic binding. 

Unlike early binding (static binding), PHP will bind things at runtime. It needs an object creation :

```php
<?php

class MotherClass {
	protected $cat = "generation A";

	public function displayCat() {
		echo $this->cat;
	}
}


class ChildClass extends MotherClass {
	protected $cat = "generation B";
}

$child = new ChildClass();
$child->displayCat();//displays "generation B"
```

This time we get "generation B" as probably intended.

## Late static binding

If you want to redefine static stuff (~ override output) in the child class, use the keyword `static`.

The PHP interpreter will leave it for runtime. It's like a pending status:

```php
<?php

class MotherClass {
	protected static $cat = "generation A";

	public static function displayCat() {
		echo static::$cat;
	}
}


class ChildClass extends MotherClass {
	protected static $cat = "generation B";
}

ChildClass::displayCat();// displays "generation B"
```

This time, we also get "generation B" as probably intended.

## Wrap up

I hope you know more about binding in PHP, especially late static binding, thanks to this short article.

This technique has been available since PHP 5.3. It makes the use of static methods and variables less risky for inheritance thanks to a simple keyword.
Learning Plan to become a Machine Learning Engineer
Tags: machinelearning, datascience
Published: 2020-08-30 09:42:12

Last year, in June 2019, I switched from a full-time web development role to a Machine Learning Engineer role. 

To achieve that, I got help from many courses, articles, and books. I have documented all my learning resources below along with the goals: 

https://github.com/amitness/learning
Ссылки в Pycharm
Published: 2020-08-30 09:42:08

Если вы и ваш коллега при работе над одним проектом используете PyCharm, то вы можете отправить ему ссылку на строку кода воспользовавшись "Copy reference" <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>Shift</kbd>+<kbd>C</kbd>[^1]
[^1]: Здесь и далее указаны клавиши для Windows
Ваш коллега должен дважды нажать <kbd>Shift</kbd> и вставить в открывшееся поле полученную ссылку.
В большинстве случаев, ссылки бывают рабочими, в некоторых случаях нужно менять `#` на `.`. Поэтому отправляя ссылку желательно проверить, что она открывается, коллеги вам будут благодарны.
Feature Requests: Looking beyond workarounds
Published: 2020-08-30 09:35:41

![Workaround](https://dev-to-uploads.s3.amazonaws.com/i/m4v3gjd1vatdc7dhqvve.png)

Thanks to Udi Dahan, for a limited time the popular Advanced Distributed System Design [course](https://learn.particular.net/courses/adsd-online) was available for FREE in light of COVID-19 impact across the globe.

Besides key takeaways on microservices, there was one of the noteworthy points mentioned in the course about software requirements.

>The business doesn't really give developers requirements. They have an inventive workaround to achieve something they need done, and it's that that is presented as a requirement.

**Role of a software engineer**

As we gain more experience as a software engineer and start looking beyond code one striking realisation is that our core responsibility is to solve problems not just write code. Having said that its often easy to overlook this fact in the race to meet sprint commitments and shipping things faster. We need to take a step back and relook at the requirements, collaborate with business analysts or product managers to identify the real business requirements.

![DevRole](https://dev-to-uploads.s3.amazonaws.com/i/ahwr31rk990q45mn7e2m.png)

**Why workaround ?**
In a brownfield project the business looks for opportunities to add new features with low development costs. In the process of achieving it there is a tendency to overcome limitations in the product with workarounds rather than enhancing the product.

**Cost of workarounds**
Workarounds introduces product debt. Yes you read it right, it's not technical debt! Product debt increases complexity in product, making it difficult for software engineers to maintain in the long run. 
Workarounds are mostly client specific, eventually hampering the extensibility of the product to build new features.


**Real world experience**
One of the products I was involved, had a highly configurable workflow management. Few months into the project, we were onboarding a new client. The requirements of workflow management for new client could not be satisfied with the existing implementation. However instead of enhancing the product a clever workaround was found using the configurations. I was analysing a story in backlog later only to find out the additional effort on the dependant feature to work as expected was a result of the workaround introduced weeks earlier.


Like most problems in software engineering it's also a culture problem when the business incentivises effort reduced in short term without considering the impact on the long term.

**Conclusion**
As software engineers it's our responsibility to not just keep technical debt on check but also the product debt on check.
Django tester
Tags: actionshackathon
Published: 2020-08-30 08:57:02

[Instructions]: # (To submit to the GitHub Actions x DEV Hackathon, please fill out all sections.)


### My Workflow
[Note]: # Django Tester


### Submission Category: 

[Note]: # Wacky Wildcards


### Yaml File or Link to Code

[Note]: # 
    #This workflow will install Python dependencies, run tests and lint with a single version of Python
    #
     #For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

    name: Python application
    on:
      push:
        branches: [master]
      pull_request:
        branches: [master]
    jobs:
      build:
        runs-on: ubuntu-latest
        services:
          postgres:
            image: postgres:10.8
            env:
              POSTGRES_USER: postgres
              POSTGRES_PASSWORD: postgres
              POSTGRES_DB: github_actions
            ports:
              - 5432:5432
            options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
        steps:
          - uses: actions/checkout@v2
          - name: Set up Python 3.8
            uses: actions/setup-python@v2
            with:
              python-version: 3.8
          - name: psycopg2 prerequisites
            run: sudo apt-get install python-dev libpq-dev
          - name: Install dependencies
            run: |
              python -m pip install --upgrade pip
              pip install -r requirements.txt
          - name: Run migrations
            run: python manage.py migrate
          - name: Run tests
            run: python manage.py test
Submission: Copybara Action
Tags: actionshackathon, github, opensource
Published: 2020-08-30 08:56:46

[Instructions]: # (To submit to the GitHub Actions x DEV Hackathon, please fill out all sections.)


### My Workflow
[Note]: # (Make sure to include the name of your GitHub Action and share where it's being used!)

Copybara Action; runs https://github.com/google/copybara in GitHub Actions. 

Copybara transforms and moves code between repositories.

Previously, you had to build and run Copybara manually on your machine. But I have automated this with GitHub Actions!

Currently, I use the action to sync a private repository with a public one (https://github.com/wilmol/coding-practice-java).

### Submission Category: 

[Note]: # (Maintainer Must-Haves, DIY Deployments, Interesting IoT, Phone Friendly, or Wacky Wildcards)

Maintainer Must-Haves

### Yaml File or Link to Code

[Note]: # (Our markdown editor supports pretty embeds. Try this syntax: `{% github link_to_your_repo %}` to share a GitHub repository)

{% github https://github.com/wilmol/copybara-action %}

### Additional Resources / Info

[Note]: # (Be sure to link to any open source projects that are using your workflow!)

As mentioned above, I use the action to sync a private repository with a public one (https://github.com/wilmol/coding-practice-java).

[Note]: # (Be sure to include the DEV usernames of your collaborators, if any. )

Developed by Will (https://dev.to/wilmol / https://github.com/wilmol) and Ji (https://dev.to/jidevops / https://github.com/JiDevOps).

[Reminder]: # (Submissions are due on September 12th (11:59 PM PDT) and winners will be announced on September 23!)
Quick Portfolio with GitHub Readme
Tags: github, portfolio, profile, githubprofile
Published: 2020-08-30 08:34:06

For creating a quick Portfolio i fount  [how to create a github profile readme] (https://www.aboutmonica.com/blog/how-to-create-a-github-profile-readme). I had some fun browsing through [other peoples profiles] (https://zzetao.github.io/awesome-github-profile/), so i decided to create [my own one:] (https://github.com/AnneQuinkenstein)
****
It's quite easy to start:  
1.  create a new Repro & name it your Github/Username/ 
2.  then style your Username/README.mp as you Profile. 

 ->  See the [Monicas Post] (https://www.aboutmonica.com/blog/how-to-create-a-github-profile-readme) for more detailed instructions. 

****
To create your own Readme-Profile, there are things around helping with the design:  

*Shortcut: Use [A Profile Generator](https://rahuldkjain.github.io/gh-profile-readme-generator/) - the easiest way. I used some code out of it. 

*[CheatSheet Markdown] (https://guides.github.com/pdfs/markdown-cheatsheet-online.pdf) for basic styling 

*Create [Github Stats] (https://github.com/anuraghazra/github-readme-stats). You can change a lot in there, e.g. the [colors] (https://github.com/anuraghazra/github-readme-stats#customization) or [the whole style] (https://github.com/anuraghazra/github-readme-stats#customization). 

*Create [Bagdes](https://github.com/alexandresanlim/Badges4-README.md-Profile) from GMail to Paypal or [GitHub-related Badges] (https://pufler.dev/git-badges/) like nr. of visitors. 

*Creating [Shields] (https://github.com/badges/shields) for e.g. code coverage percentage. 

*Create a [Recent Activity List] (https://github.com/jamesgeorge007/github-activity-readme)

*Create super nice [Dev Metrics with added Feature Flags] (https://github.com/anmol098/waka-readme-stats)
Run Linux On Windows 10
Tags: linux, windows, hughcaluscusin
Published: 2020-08-30 07:59:03

This will be just a very quick tutorial on how to install and run Linux on a Windows 10 machine. In the end, you can install different flavors of Linux like Kali, Ubuntu, SUSE, and many other more inside your Windows 10 0S. There are only 4 main steps in order to do this. Yes, only 4, so without any further ado:

### Let's Get Started 🚀

```
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart 
```

1. First, go to this [link](https://docs.microsoft.com/en-us/windows/wsl/install-win10) and copy the PowerShell code. Or, just copy the code above to quickly proceed to next step. 

2. Open your **PowerShell** as an **Administrator** and paste the code you just copied and press Enter. _This will just enable your machine to run Linux._

3. Then, go to your Windows' App Store and search for **Linux on Windows**. And just below it, select (click) your flavor of Linux and install it.

4. After that, click **Launch**, then just create your _username_ and _password_.

And, that's it, folks! 🔥 You have just installed your favorite flavor of Linux on your Windows 10 machine. Great job! 👏
Writing tests for my GitHub action
Tags: actionshackathon, github, javascript, testing
Published: 2020-08-30 07:31:00

After writing the basic code for my GitHub action for the [actionhackathon](https://dev.to/devteam/announcing-the-github-actions-hackathon-on-dev-3ljn). I was thinking of how to increase the quality of code and to follow the software engineering best practices. 

I thought I should write tests for my action as it is an essential part of software engineering life-cycle.

![SDLC](https://dev-to-uploads.s3.amazonaws.com/i/tydkuh3sbjyg0421hox5.jpg)

## Writing tests in JS

Since most of the code in my GitHub action is using **axios** to send API requests to the DEV server. I have to test the API requests.

To test this code, I have come across [Axios Mock adapter](https://github.com/ctimmerm/axios-mock-adapter), which mocks the API calls for testing purposes.

I have used this mocking-library with [Jest](https://jestjs.io/), a testing framework for JavaScript.

### Installing libraries

```bsh
npm install axios-mock-adapter --save-dev
npm install jest --save-dev
```

### Mocking request

Below is the example from the official docs.

```javascript
var axios = require("axios");
var MockAdapter = require("axios-mock-adapter");

var mock = new MockAdapter(axios);

mock.onGet("/users").reply(200, {
  users: [{ id: 1, name: "John Smith" }],
});

axios.get("/users").then(function (response) {
  console.log(response.data);
});
```

### Testing with Jest

```javascript
// require libraries

var mock = new MockAdapter(axios);

// Mocking
mock.onPost(url + "/articles").reply(201, {});

// Writing Test
test("Testing a 201 (created) response", () => {
  var data = {};
  expect(createPost(data, "secret")).toBeTruthy(); // Test passes if the value is truthy
});

```

Now add a **script** in your `package.json` as 
```javascript
...
"scripts": {
    ....
    "test": "jest" // To run jest
  },
...
``` 

Now run the following command 

```bsh
npm run test
```

You'll see All test passed messages in the console.

### References
- [Jest Docs](https://jestjs.io/)
- [Axios mock-adpter](https://github.com/ctimmerm/axios-mock-adapter)

### Source Code

{% github frikishaan/dev-action no-readme%}
Launching your Startup on StartupResources.io
Tags: indiehacker, startup, marketing, sideprojects
Published: 2020-08-30 07:20:25

---
title: Launching your Startup on StartupResources.io
published: true
description: How to launch on StartupResources.io - Step by Step.
tags: 
  - IndieHacker
  - Startup
  - Marketing
  - SideProject
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/v4s0c2xau7diliboeptb.png
canonical_url: https://wheretopost.email/kb/submit/launching-on-startupresources.io.html
---

[StartupResources](https://startupresources.io/) is a resource site and newsletter featuring various tools which come in handy when starting an online business or website. If your site fits into any of the [62(!) categories](https://startupresources.io/collections/) you've got a good chance of being included. To submit your project, start on the homepage:

![Homepage of StartupResources.io](https://wheretopost.email/images/StartupResources.io/homepage.png)

Click on the "Let's get started"-button to submit your project:

![Getting Started on StartupResources.io](https://wheretopost.email/images/StartupResources.io/getting-started.png)

The form contains six simple steps asking for the required information:

- Name,
- Email,
- Project Name,
- Project URL,
- One collection to add your project to and
- A description

The fields look similar to this one:

![Field Example](https://wheretopost.email/images/StartupResources.io/field-example.png)

Done! You just got your project in front of over thousands of new potential users and customers. Don't forget to signup for the neat weekly newsletter once you are on the website!
web server with plain go
Tags: go, web
Published: 2020-08-30 06:53:43

Trying out a simple web app server in golang native library. Internet is filled with frameworks, before exploring any frameworks trying if the native is enough for the solution in hand.

```go
func main() {	

	http.HandleFunc("/", rootHandler())
	http.HandleFunc("/products", productHandler())


	fmt.Println("Listening on 8080")
	http.ListenAndServe(":8080", nil)
}

func rootHandler() func(http.ResponseWriter, *http.Request) {
	return func(w http.ResponseWriter, r *http.Request) {
		switch r.Method {
		case http.MethodGet:
			w.Write([]byte("ROOT GET OK"))
		case http.MethodPost:
			w.Write([]byte("ROOT POST OK"))
		}

	}
}

func productHandler() func(http.ResponseWriter, *http.Request) {
	return func(w http.ResponseWriter, r *http.Request) {
		switch r.Method {
		case http.MethodGet:
			w.Write([]byte("PRODUCT GET OK"))
		case http.MethodPost:
			w.Write([]byte("PRODUCT POST OK"))
		}

	}
}
```
Careful with slashes in your request url. I spent almost an hour figuring out why isn't the code working.

WRONG ONE!
```http
@baseurl = http://127.0.0.1:8080/
GET baseurl/product
```
RIGHT ONE!
```http
@baseurl = http://127.0.0.1:8080
GET baseurl/product
```

*Image credit* - [Philippe Oursel](https://unsplash.com/@ourselp?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText)