teleren/devto huggingface dataset:
Python Learning Path with Projects
Tags: python, codenewbie
Published: 2020-11-27 04:35:49

---
title: Python Learning Path with Projects
published: true
date: 2020-10-17 00:00:00 UTC
tags: #python, #Codenewbie
canonical_url: https://thelearning.dev/blog/python_learning_path/
---

With the boom of machine learning and Artificial intelligence, Python is at its prime time. One of the questions I get frequently asked is

1. How to learn Python? 
2. What books do you suggest? 
3. Do you suggest any courses? etc.,

But the most common question is there are so many resources which one to follow. Worry not! I have curated a few useful resources that worked for so many people. The resources come with some projects for you to try out the concepts you learn.

Now you may get carried away by all the links and books here. Here is a trick.

1. Go through them and open each of them in a new tab.
2. Pick one and go through it.
3. Open the code editor and try the examples. 
4. If you feel bored, go to the project section and try that out
5. The project section is like a lighthouse that you are heading towards. The moment you can build a project with ease, you can drop these resources and move on. 

> The resources are like a guide book. You will do a lot of Googling and copy-paste from StackOverflow, which is completely fine and normal. All programmers do that.

## [Resources & Projects](https://thelearning.dev/blog/python_learning_path/)
Smarter throwing
Published: 2020-10-17 11:01:40

---
title: Smarter throwing
published: true
date: 2020-10-17 00:00:00 UTC
tags: 
canonical_url: https://remysharp.com/2020/09/24/smarter-throwing
---

With `async/await` becoming standard procedure for a lot of my code, I find myself wrapping blocks of code in `try/catch` to ensure I'm handling errors properly.

As a result of this, I also try to make my errors a little more useful at the same that I want to show you in this mini post.

## The example

I have large validation process that runs through a series of statements and checks for particular problems and rules.

Each validation rule is run and if it fails, it throws with a message, such as:

```
export function validateFakeExample(token, scope) {
  if (token.text !== 'PRINT') return;

  const next = scope.peekNext();
  if (next.name !== AT) {
    throw new Error('Parser error, PRINT keyword should be followed by AT');
  }
}

```

My main function runs each of the validation rules all encapsulated inside of a `try/catch` because I also want to capture additional metadata that will help my user understand _what_ caused the error.

So in my wrapping `catch` I have something like this:

```
} catch (error) {
  const message = error.message + `, "${token.text}" at: ${token.pos + 1}`;
  throw new Error(message);
}

```

This way, when the error is given back to my user, they'll see:

```
Parser error, PRINT keyword should be followed by AT, "INK" at: 10

```

Actually I use this pattern a lot, to catch the source error, interpret it, and `throw new Error` to help me better understand what was going on.

Except it can be smarter.

## Being smart

When I call `new Error` a brand new error object is created. At this point a few things happen, specifically the stack is captured. A stacktrace is incredibly useful for debugging to trace back to the source of the problem.

Except, because I generated a brand new error, my stacktrace will originate from within the `catch`, which is helpful to a certain degree, but could be a lot more useful.

I _could_ do something with the stack. At times I've added a `console.log(error.stack)` in the `catch` which I can go searching my logs for.

What I _should_ do is instead of throwing a `new Error`, I can _simply_ modify the original `error.message` property (🤦 why did it take me that long).

So now my code looks like this:

```
} catch (error) {
  error.message += `, "${token.text}" at: ${token.pos + 1}`;
  throw error;
}

```

My custom error message is passed by to the user (normally me) _and_ my full stacktrace is retained.

_Originally published on [Remy Sharp's b:log](https://remysharp.com/2020/09/24/smarter-throwing)_
Custom Bash Command Prompt
Tags: bash, shell
Published: 2020-10-17 10:38:17

---
title: Custom Bash Command Prompt
published: true
date: 2020-10-17 00:00:00 UTC
tags: bash, shell
canonical_url: https://hiltonmeyer.com/articles/custom-bash-prompt.html
---

This is the setup I use for my bash prompts in various environments. I simply add the following to my `.bashrc` file. This is more a reference for me but if you find it useful give it a go and play around with the various colors.

```
Custom Prompt###############
set_prompt () {
        Reset='\[\e[0m\]'

    Black='\[\e[0;30m\]'
    Blue='\[\e[0;34m\]'
    Green='\[\e[0;32m\]'
    Cyan='\[\e[0;36m\]'
    Red='\[\e[0;31m\]'
    Purple='\[\e[0;35m\]'
    Brown='\[\e[0;33m\]'

    if [$(whoami) == 'root'] || [[$(whoami) == *"prod"*]] || [[$(whoami) == *"PROD"*]]; then
        PrimaryColor="${Red}"
        SecondaryColor="${Brown}"
        promptSymbol="${Red}!! "
    else
        PrimaryColor="${Green}"
        SecondaryColor="${Blue}"
        promptSymbol="${Green}$ "
    fi

        userhost="${PrimaryColor}$(whoami)@$(hostname -s) "
        currentdir="${SecondaryColor}[$(pwd | sed "s!^$HOME!~!")] "
    currentTime="${PrimaryColor}$(date +%H:%M:%S) "

    PS1="$Reset$White"
    PS1+="$userhost"
    PS1+="$currentdir"
    PS1+="$currentTime"
    PS1+="$promptSymbol"
    PS1+="$Reset"
}

PROMPT_COMMAND='set_prompt'
################Custom Prompt End###############

```
OSD-Lab4
Tags: opensource
Published: 2020-10-16 23:52:12

This week for our lab we were tasked with creating an optional flag for a classmate in their link checker program. In addition to this we were also supposed to use git remotes and merge through git commands when someone finished the optional flag on our repo.

The issue that I created you can find here: https://github.com/jongwon-jang/detectURL/issues/7
In addition you can find the branch here: https://github.com/MLJBrackett/detectURL/tree/issue-7

The code was pretty easy, all I did was parse the urls from the ignore.txt file, then compare the two arrays of urls. If a url was in both I removed it from the base URL array. Then ran head requests on the URL array after.

I actually liked the use of git remotes, that being said I haven't really been able to use them that much yet but it seems very useful being able to branch off someone else's fork would is a great thing if you are trying to keep your git repo clean.

One thing that I don't really like is when using the git merge command, it merges all commits into the master. I would much rather prefer if I could **-SQUASH** those commits into one. Which I found out after the fact was an actual command. The squash command which you can use with the rebase tool allows you to squash a bunch of commits down into one. Which I think makes the commit history look a little cleaner when merging from remote's. So in the future if I have do to something like this again, Ill probably test that feature out.

You can find the commits made to my repo here:
[228fff4](https://github.com/MLJBrackett/link-check/commit/228fff47279312b83acb291373485ecdd3ed7c5e), [1e21f76](https://github.com/MLJBrackett/link-check/commit/1e21f76f104b03b03b0f8017922a90b7a3147c1e), [aa43a46](https://github.com/MLJBrackett/link-check/commit/aa43a4655c16a968b6c97c25cc772a6bb72c0720)
Dissertation project ideas
Tags: help, tips, discuss, python
Published: 2020-10-16 23:20:36

Hello everyone! 
I am a third-year software engineering student and I have to work on my dissertation project this year. I'm really not sure what I will work on and I have only a few days left to choose my topic. 
My favorite language is python. I am also good in creating stuff by myself so I was thinking of creating something in the field of robotics with Raspberry PI or Arduino. I have seen a couple of projects like these, I don't have experience with them but I just need something which is not too complex. 
Please let me know your suggestions (also other software-engineering related topic) or any question that you have!  
Thank you for you help! I really appreciate it!!! 

Ps. I am new to this community
Como Deletar Arquivos Usando Padrão de Busca no Windows
Tags: tecnologia
Published: 2022-03-31 20:57:12

---
title: Como Deletar Arquivos Usando Padrão de Busca no Windows
published: true
date: 2020-10-16 23:19:26 UTC
tags: Tecnologia
canonical_url: https://marquesfernandes.com/tecnologia/como-deletar-arquivos-usando-padrao-de-busca-no-windows/
---

 ![](https://marquesfernandes.com/wp-content/uploads/2020/10/0_jFevMGtzteMy746R-150x150.jpg)

Então você tem uma pasta com diversos arquivos dentro, e esse arquivos seguem um padrão de nome ou talvez você queria deletar todos os arquivos com uma determinada extensão. Existem duas maneiras de realizar essa tarefa, abordaremos às duas maneiras de realizar essa tarefa.

## 1. Usando o PowerShell

Você pode encadear um comando `Get-ChildItem` por meio de um filtro `Where-Object` que aceita um padrão `RegEx` e, em seguida, encadear o comendo `Remove-Item` para remover. 

```
Get-ChildItem $Path | Where{$\_.Name -Match "<RegEx>"} | Remove-Item
```

O atributo nome corresponderá apenas ao nome do arquivo ou pasta, junto com a extensão do arquivo. Não vai corresponder a outras coisas ao longo do processo. Isso passará um objeto `FileInfo` pelo canal, que `Remove-Item` toma como entrada do canal e removerá os arquivos em questão.

Se você quiser incluir subpastas para a busca, precisamos adicionar a opção `-Recurse` ao comando `Get-ChildItem`:

```
Get-ChildItem $Path -Recurse | Where{$\_.Name -Match "<RegEx>"} | Remove-Item
```

Se você deseja apenas excluir arquivos, pode especificar isso na instrução `Where`, observando a propriedade `PSIsContainer` do objeto `FileInfo`:

```
Get-ChildItem $Path -Recurse | Where{$\_.Name -Match "<RegEx>" -and !$\_.PSIsContainer} | Remove-Item
```

## 2. Usando o Explorer

Para usuários que não tem o costume de utilizar a linha de comando, existe a possibilidade de filtrar usando a busca do próprio Windows Explorer e selecionando todos os arquivos filtrados para deleção. Essa maneira não é a mais performatica e pode dar um pouco mais de trabalho, visto que o filtro às vezes retorna itens que não desejamos necessariamente deletar, no exemplo abaixo vemos o filtro pela extensão `.png`. Por isso, se for utilizar esse método, não se esqueça de verificar antes de selecionar tudo e deletar, se todos os arquivos listados são realmente os que você deseja remover.

![](https://marquesfernandes.com/wp-content/uploads/2020/10/image-1-1024x560.jpg)

O post [Como Deletar Arquivos Usando Padrão de Busca no Windows](https://marquesfernandes.com/tecnologia/como-deletar-arquivos-usando-padrao-de-busca-no-windows/) apareceu primeiro em [Henrique Marques Fernandes](https://marquesfernandes.com).
Super secure communications algorithm
Tags: opensource, go, javascript, devops
Published: 2020-10-16 22:46:36

Post #10

🎭 //Personal Opinion// 🎭

A straight forward approach to build a super secure communication tunnel! Not just encryption I'm taking!  

You'lln't probably see this kind of implementation and if talk about FB and other social media, they still fool us in the name of e2e encryption routines 😆

scenario: suppose I send encrypted message to you and you got the public key of mine 

//Architecture: 

1.) my message is sent to a server and gets stored in redis/dynamo or just sql 

2.) we both have public key of each other to decipher message right 

3.) create few more transportation layer(just like middleware). I'm assuming 3 here 

4.) as soon as step#1 happens, a service gets activated(cron/celery) 

5.) that service will grab message(encrypted yet) and forward to next service(layer 2) and removes layer first 

6.) Last service grabs that encrypted message and forwards to final destination and removes layer 2

7.) a client script will now, receives the message, decrypt it with my public key and renders to your screen/console 

8.) client script will finally end up with removing last layer(3rd layer) 

9.) this process will leave no trace but a blackhole which if any third party tries to break in, he is forced to retreat at layer 1. 

10.) logic: hansel and gretel not sure but take the example of breadcrumbs. You leave beradcrump to let other come to the destination you're heading and without that he'll simply get lost right 

sounds tough but easy. You can try any programming of your choice. I can guarantee theres no architecture  more secure than this one

Thanks for reading 😊
Samsara??
Published: 2020-10-16 22:45:31

So about two weeks ago I applied to a company called Samsara as a Software Engineer (Intern). Soon after filling out the application I reached out to Jacky Frias, a recruiter at Samsara. Within the hour, I received an email from her about the next step in the process. I was asked to complete a CGA or Coding General Assessment for them. The assessment was timed at 70 mins with 4 questions. I chose to solve them in Javascript but there were many options available language-wise. The questions were pretty simple and not too difficult for an entry level position. This is the first step of the process that I have completed. As of right now I am waiting on a reply from them.
Making Videoconferences with React and Jitsi!
Published: 2020-10-16 22:44:19

Recently, in our "Product discovery" week, a new functionality raises up: Implement videoconferences inside our webapp. After some research we ended up choosing Jitsi as our tool.

The reason behind this decision were pretty solid:

- It's open source
- Has support for web and mobile.
- Has plugins for frameworks like React, Angular, even Flutter.

So, before all, we needed to make a small PoC to learn about the tool and how we can implement it inside a real world application. If you need more info about Jitsi for web, please check it's repository.

The first thing we need to do is get Jitsi. Currently, there is no an official NPM package available, so, we need to use a script tag as old days. For performance reasons, we don't put the tag inside the HTML, instead, we put it inside the React component.

So, let's hands on it.

---

First, create a jitsi instance variable state.

{% gist https://gist.github.com/gugadev/d70d25179357b521dd2cb46c2ea64123 file=a.tsx %}

Then, we need to add the script when the component mounts.

{% gist https://gist.github.com/gugadev/d70d25179357b521dd2cb46c2ea64123 file=b.tsx %}

The `loadScript` function inserts the script in the body and returns a promise that will be solved after the script loads.

{% gist https://gist.github.com/gugadev/d70d25179357b521dd2cb46c2ea64123 file=c.ts %}

Once jitsi script loaded, we need to instanciate the `JitsiMeetExternalAPI` class with the following parameters:

- host: url where the videoconference call is hosted.
- params: all the params available [here](https://jitsi.github.io/handbook/docs/dev-guide/dev-guide-iframe).

For example, we gonna use `roomName` and `displayName`. The first one is the name of the room we want to join and the second the user's mame. Note that both values will be received as props.

{% gist https://gist.github.com/gugadev/d70d25179357b521dd2cb46c2ea64123 file=d.tsx %}

The `parentNode` option tell us which element will be used to insert the Jitsi iframe. So, we provided the div we are returning also.

The last step is save the `JitsiMeetExternalAPI` instance inside `jitsi` variable state and a method to destroy it once the component is unmounted.

{% gist https://gist.github.com/gugadev/d70d25179357b521dd2cb46c2ea64123 file=e.tsx %}

Then you just need to call the component passing the room and your name to join to a videoconference:

```tsx
<JitsiMeet roomName="MyRoonName" displayName="Gus" />
```

And tha'ts all! Pretty simple, right? There is a demo below to check out this code working. You need to create a meet using https://meet.jit.si and connecting using the component 😜

{% codesandbox jitsi-react-demo-rmw0d %}
My very first Hacktoberfest!
Tags: hacktoberfest
Published: 2020-10-16 22:19:46

<!-- ## What I Learned From Hacktoberfest

What did you learn that can help others contribute to the project you worked on? What did you learn that can help the users of that project?! -->

I've been so excited about my first Hacktoberfest! I haven't had the chance to contribute to open source just yet in my career but I've really wanted to. I thought this would be a great opportunity to begin my OSS journey!

I'll continue to update this article with my progress throughout the month 😊

Stay tuned!
It's here!
Tags: swift, iosdevelopment, iosapp
Published: 2020-10-16 22:08:14

The new release of [Calm Cloud](https://apps.apple.com/us/app/id1503747823) has arrived! With new season and weather environments the gamified lifestyle stress-reduction app is better than ever!

This one was a long haul to create, but well worth the effort, especially if its being out in the world helps people. We're all running with a constant underlying level of stress lately, so I created Calm Cloud to try to help diffuse some of those worries.

It features a creature called a cloud kitty, who is named Zen, a friendly little interior environment, and an outdoor garden where you can grow, water, and harvest plants! It also has some practical features like reminders, a list of calming/productive activities, a thankfulness journal, and an area to collect photos of some of your favorite things (like in the song from *The Sound of Music*).

Throughout there are calming ambient sounds and fun interactive pieces, such as lights that turn on and off, playable music, toys that move, and more. Further updates will be coming to Calm Cloud in time! If you'd like to keep up with its commits you can see the code on GitHub [here](https://github.com/kduncanwelke/Calm-Cloud)! ✨
What I learnt from HacktoberFest 2020
Tags: hacktoberfest
Published: 2020-10-16 22:02:33

Hacktober Fest 2020 This was the first tech event I have ever  participated.At start I lose hope and was almost on the edge of giving up but when thought deeply I made up my mind that I have to complete the challenge this year. So I started searching out for issues in which I was interested in I made a Pull request to the selected issues which was assigned to me and when it was successful i felt so glad that I can't express by my words.
Within 2 weeks I was able to make 4 successful pull requests and this achievement really boost my confidence.

A small message to all who are beginneres like me that -

void func() { printf("NEVER GIVE UP!!"); func(); }

PS:This line should come up as you can see this is the famous line of Naruto  Uzumaki a character of one of the best Anime in the world.
Javascript function scoping basic: The expression and the invoke...
Tags: javascript, function, scope
Published: 2020-10-16 21:59:15

The image above shows the two ways of writing a function and invoke it immediately.
You will wrap a parentheses outside of the function, and then another parentheses after it.

```
for (var i = 0; i< 5; i++){
  function anyName(){
    var j = i;
    console.log(j)
  }
  anyName();
}
```

```
for (var i = 0; i< 5; i++){
  (function anyName(){
    var j = i;
    console.log(j);
  })()
}
```

Both of these will immediately print ```0 1 2 3 4```

My eyes weren't used to the syntax, I got confused every time I saw it, hence I write it down as a blog to remember and understand Javascript better the next time I see this. <3
Formatting a date in JavaScript
Tags: javascript, dates, vue
Published: 2020-10-16 21:53:12


When it comes to dates we often add big libraries like Moment.js or Luxon just to format a simple date. But it is actually much simpler than that by using the `toLocalDateString()` method. We don't have to install any packages. It just works

In the example below we are using Vue so therefore we create a method called `formatDate()` and pass in the date that we want to format. We then set our options of how we want the date to be shown. This is an object where we can choose if we want the month to be numeric or long for example. We then return the new date passing in our date we want formatted. We then chain our `toLocalDateString()` method passing in the language we want to use followed by the options.

```js
<script>
export default {
  methods: {
    formatDate(date) {
      const options = { year: 'numeric', month: 'long', day: 'numeric' }
      return new Date(date).toLocaleDateString('en', options)
    },
  }
};
</script>

```

## Different Options

We can then use our method like we would use any Vue method in our template passing in the date want formatted

```html
<template>
  <p>
    {{ formatDate('2020-12-25') }}
  </p>
</template>
```

Result: **December 25, 2020**

We can also use different options. Perhaps we want to show the day of the week. We can do this by adding in the weekday.

```js
formatDateDay(date) {
  const options = {  weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }
  return new Date(date).toLocaleDateString('en-us', options)
},
```

Result: **Friday, October 9, 2020**

## Different Locales

And we can also pass in different locales so we get the date in the right order which is especially useful for when working with UK v US date formatting.

```js
formatDateEN(date) {
  const options = { year: 'numeric', month: 'numeric', day: 'numeric' }
  return new Date(date).toLocaleDateString('en-GB', options)
},
```

Result: **25/12/2020**

```js
formatDateUS(date) {
  const options = { year: 'numeric', month: 'numeric', day: 'numeric' }
  return new Date(date).toLocaleDateString('en-US', options)
},
```

Result: **12/25/2020**

And of course we can also change the format to show the day and month in a different language.

```js
formatDateDayEs(date) {
  const options = {  weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }
  return new Date(date).toLocaleDateString('es', options)
},
```

Result: **viernes, 25 de diciembre de 2020**

## Example

- **[See my CodePen](https://codepen.io/debs-obrien/pen/oNLgJda)** to play around with the dates.
- **[See the Mozilla Docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString)** for more info.
How to amend Window Size for Dolphin on KDE Plasma
Tags: linux
Published: 2020-10-16 21:26:02

## Summary

- My Dolphin on KDE Plasma started holding the old window size even though I close it after shrinking the window size.

## Solution

1. Open Dolphin.
2. Move Dolphin to another monitor.
3. Resize the window of Dolphin.
4. Close Dolphin.
5. Next time you open Dolphin, the window size should be changed.

## Reference

- [Dolphin size and position](https://www.reddit.com/r/kde/comments/2ccq10/dolphin_size_and_position/)
Buster
Tags: terminal, cli
Published: 2020-10-16 21:23:11

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

`rm` is a unique command.
Some people use it normally:
```
rm
```
or like this:
```
rm -i
```
maybe like this (?) :
```
rm -ir
```
Im pretty sure this how most people use it:
```
rm -rf
```
but I use it like this:
```
rm -fr
```
But how about using `mv` to `/dev/null` ?

Comments ? :smile:
Hacktoberfest2020
Tags: hacktoberfest, opensource
Published: 2020-10-16 21:21:27

Hello community,
it's my first participation in Hacktoberfest and i'm glad to be a part of it. i discover open source for the fist time .it's really amazing to see people help each others and sharing ideas by contribution.
i would like to grow up my network .if it's your first participation .PLEASE COMMENT YES.let's share our knowledge and experiences...
Auth0 and Splunk Provide Enhanced Security and Operational Monitoring and Insights
Tags: splunk, auth0, security
Published: 2020-10-16 21:19:55

Splunk is a data platform that allows companies to analyze any structure data, from any source, across any timescale. Auth0 extends log streaming capabilities with the new integration.
[Read more...](https://auth0.com/blog/auth0-and-splunk-provide-enhanced-security-and-operational-monitoring-and-insights/?utm_source=content_synd&utm_medium=sc&utm_campaign=auth0_splunk)