teleren/devto huggingface dataset:
Monitor files for changes with Python
Tags: python, tutorial, productivity
Published: 2020-10-02 09:35:38


Today I want to show how can you monitor changes of a directory with `watchdog`. It is a Python module that monitors our filesystem looking for any changes (like the creation, change, or deletion of a file or of a directory).  When a change occurs, the `watchdog` reports it to us via specific event that we can handle. So for example, if you need to watch a log file for changes this module is perfect, or if you had a configuration file that is been changed you can also use this module to track that.

First of all, you need to install `Watchdog` via `pip`:

```sh
pip install watchdog
```
After that we need to make import
```sh
import time
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
```
After that we need to create an event handler, basically is the object that will be notified when something happens on the folder that we are monitoring. Also we need another object, known as the `observer`, that will monitor our filesystem, looking for changes that will be handled by the event handler.

```sh
if __name__ ==  "__main__":
   event_handler = MyHandler()
   observer = Observer()
   observer.schedule(event_handler,  path='C:\\Users\\Stokry\Desktop\\test',  recursive=False)
   observer.start()
```
Now that we have created the handler and observer we need to write the code we want to run when the events occur.
Let’s start creating three different functions that will be used when a file is modified, created, or deleted. We can also add function when something is moved. 
```sh
class  MyHandler(FileSystemEventHandler):
    def  on_modified(self,  event):
         print(f'event type: {event.event_type} path : {event.src_path}')
    def  on_created(self,  event):
         print(f'event type: {event.event_type} path : {event.src_path}')
    def  on_deleted(self,  event):
         print(f'event type: {event.event_type} path : {event.src_path}')
```
Putting all together:

```sh
import time
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler

class  MyHandler(FileSystemEventHandler):
    def  on_modified(self,  event):
         print(f'event type: {event.event_type} path : {event.src_path}')
    def  on_created(self,  event):
         print(f'event type: {event.event_type} path : {event.src_path}')
    def  on_deleted(self,  event):
         print(f'event type: {event.event_type} path : {event.src_path}')

if __name__ ==  "__main__":
    event_handler = MyHandler()
    observer = Observer()
    observer.schedule(event_handler,  path='C:\\Users\\Stokry\Desktop\\test',  recursive=False)
    observer.start()

     try:
        while  True:
            time.sleep(1)
     except  KeyboardInterrupt:
        observer.stop()
     observer.join()
```
Now we can test this out. 
Let's say we delete the file, the output is like this:

```sh
event type: deleted path : C:\Users\Stokry\Desktop\test\log_old.txt
```
***Thank you all.***
Automating Apps Deployment to Amazon Lightsail
Tags: aws, apps, deployment, devops
Published: 2020-10-02 09:24:57

In this article I’m going through [this documentation page](https://aws.amazon.com/blogs/compute/using-aws-codedeploy-and-aws-codepipeline-to-deploy-applications-to-amazon-lightsail/) where Mike Coleman takes us on Using AWS CodeDeploy and AWS CodePipeline to Deploy Applications to Amazon Lightsail. It’s basically a guide of the process of setting up a deployment pipeline. In it, we’ll start by creating a service role for CodeDeploy, an [Amazon S3](https://aws.amazon.com/s3/) bucket, and an [IAM user](https://aws.amazon.com/iam/). After deploying these services, we’ll create a Lightsail instance. In addition to that, we will install and configure the CodeDeploy agent, as well as registering the instance with CodeDeploy. Finally, we’ll create an application in CodeDeploy, and configure CodePipeline to kick off a new deployment whenever we push changes to GitHub.

Read more about it here: https://weblog.tiagoperes.eu/automating-apps-deployment-to-amazon-lightsail/
Meteor Impact 2020 open for registration
Tags: watercooler, javascript, meteor
Published: 2020-10-02 09:04:45

Meteor Impact 2020 online conference is now open for registration! And it is free (though sponsoring community developers is highly encouraged).

You can now [sign-up for the conference](https://impact.meteor.com/sign-up) as an attendee.

The conference is in early stages of preparation, but already there are some [interesting exhibitors](https://impact.meteor.com/exhibitors) and items on [the agenda](https://impact.meteor.com/agenda):

[How to authenticate with one user across many Meteor apps using a custom OAuth2 server](https://impact.meteor.com/meetings/virtual/bvTyApaSiqDzCaMi8) by Jan Küster.

[Meteor debugging](https://impact.meteor.com/meetings/virtual/rL6MKmEcTQhfoY7y4) by Bart Sturm.

[Meteor Dev Tools Evolved](https://impact.meteor.com/meetings/virtual/sXPHbckzoXBokrSLo) by Leonardo Venturini.

[Tight React hooks for Meteor data](https://impact.meteor.com/meetings/virtual/yTGbLA3pCwnZsyBG3) by Kevin Newman.

[Vulcan.js: a New Vision for Full-Stack Frameworks](https://impact.meteor.com/meetings/virtual/B9C8et5nRxJTSgPuk) by Sacha Grief.

More talks are in the works and the agenda might still change even for existing talks (as we coordinate across timezones), so stay tuned!

If you are interested in giving a talk, showcasing your company/package/product, please don't hesitate to [reach out to us](https://impact.meteor.com/join).

Expect more news on Monday!

--------
If you like my work, please consider supporting me on [GitHub Sponsors ❤️](https://github.com/sponsors/StorytellerCZ).
How to Choose and Register with the Best Domain Registrar
Tags: startup, domain, webmonetization
Published: 2020-10-02 09:00:07

Leading Domain Registrars
Here are some of the best places to buy your domain name:
https://launchberg.com/best-domain-registrar/

GoDaddy
Domain.com
Namecheap
Google Domains
Bluehost
DreamHost
Name.com
1and1 Ionos
BuyDomains
Hover
Hactoberfest quick win!
Tags: hacktoberfest
Published: 2020-10-02 08:36:06

---
title: Hactoberfest quick win! 
published: true
description: I'll merge any PR which adds your blog to my repo!
tags: hacktoberfest
---
A little while ago I decided to collect developers' blog URLs, partly to meet some more people in the developer community, and partly to encourage people to write blogs on their own domains (doesn't mean you can't cross-post to dev.to!) ...

So with the advent of Hacktoberfest, I'd like to announce that as a quick win if you have a _self-hosted_ blog and submit a PR to this repo:

https://github.com/endymion1818/awesome-developer-blogs

I'll merge it as soon as I can!

Send me your blogs!
100DaysOfCode | Day 47-50
Tags: 100daysofcode, beginners, challenge, python
Published: 2020-10-02 08:28:40

▄█ █▀█ █▀█ █▀▄ ▄▀█ █▄█ █▀ █▀█ █▀▀ █▀▀ █▀█ █▀▄ █▀▀
░█ █▄█ █▄█ █▄▀ █▀█ ░█░ ▄█ █▄█ █▀░ █▄▄ █▄█ █▄▀ ██▄

Hey everyone, today I wanna share my experience and feeling about day 47,48,49 and 50!
I'm working on web application but to be honest, things are getting harder for me!
I thought that it should get easier, Now I know that most of the time that's not correct.
Dealing with the Flask framework as a backend developer for the first time was really tough!
You know what?
That's my art to face with challenges and handle them, I know without challenges I can't level up myself and there's no growth!
 
So Still making progress but slowly, Don't worry cause I'm gonna make it possible to achieve my goals.
I'm gonna show you how great I am :)



#Keep Moving Forward ツ

##Enjoy Your Journey 👊

##Code with 💛

__🅑🅐🅝🅙🅘__
Reddit Junkie, a CLI tool for downloading images from Reddit!

Tags: ruby, webscrapping
Published: 2020-10-02 08:17:21

What would you say, if I tell you there's a tool installed on my Ubuntu machine which makes downloads from reddit much easier?

In past few days, I was busy creating a machine learning project. I needed tons of images and I haven't found anywhere better than reddit, the front page of the internet for crawling and downloading pictures I needed. Pictures are provided by people and most of them are *real world* pictures and not fancy advertisements for a luxury restaurant.

So, I couldn't crawl reddit using `BeautifulSoup` or `Nokogiri`. But I realized something. For a project, I have used JSON API to get a bunch of pictures. So, I wanted an automation for the downloads! I opened up my VS Code, grabbed a cup of coffee, went to my black metal playlist on Spotify and started coding.

Now, I have this really cool tool which can help me create datasets for my A.I. project!

## CLI tool

## Installing the reddit_junkie tool

On a Linux, BSD, macOS or WSL machine, you need to install ruby first. my personal preference is always [RVM](http://rvm.io), but as long as what you have installed can handle `httparty` gem, that's OK.

For installing, just run this command:

    gem install reddit_junkie

and it'll be available as a command line tool for you.

## Downloading 25 images, in the default "images" directory

    reddit_junkie --subreddit SUB

for example, if you want the latest things from [r/skyporn](http://reddit.com/r/skyporn) you just run :

    reddit_junkie --subreddit skyporn

## Downloading 25 images in a custom directory

    reddit_junkie --subreddit SUB --directory DIR

For example, you've built a folder called `sky` and you want to save the pictures there. Also, if you haven't created the folder, `reddit_junkie` will create it for you.

    reddit_junkie --subreddit skyporn --directory sky

## Downloading more than 25 images in default "images" directory

    reddit_junkie --subreddit SUB --count COUNT

For example, you want to download 300 pictures of the sky :

    reddit_junkie --subreddit skyporn --count 300

## Downloading more than 25 images in a custom directory

    reddit_junkie --subreddit SUB --count COUNT --directory DIR

For example, you want to download 300 pictures of the sky, in your `sky` directory :

    reddit_junkie --subreddit skyporn --count 300 --directory sky

## Known issues / not tested

* The CLI tool isn't tested with the `--endpoint` flag yet. It seems OK though.
* In case of more than 100 images, you only can do the download for numbers dividable by 100. Like 300 or 1000 or 25000. As I made this tool to help me make a dataset, I haven't spent much time on fixing this issue.
* CLI flags/parameters reading isn't really good. It works just fine, but not absolutely in the POSIX way.

## Links 

* [Github](https://github.com/prp-e/reddit_image_downloader)
* [Ruby Gems](https://rubygems.org/gems/reddit_junkie)
What is Tailwind CSS?
Tags: tailwindcss, opensource, tutorial
Published: 2020-10-02 08:16:51

Tailwind CSS is the most popular utility-first CSS framework in the world for rapidly building custom user interfaces for the web. It is a highly customizable collection of low-level CSS utility classes written in PostCSS destined to be customized using JavaScript.

The first release of Tailwind CSS happened on the 1st of November, 2017 on [GitHub](https://github.com/tailwindlabs/tailwindcss) as an open-source project. Initially, it was only a side-project for Adam Wathan that helped him with some of his projects, but in time became a fully-fledged and popular CSS framework with a new utility-first methodology.

On the 2nd of August, 2020 it is estimated that it was downloaded by over 10 million times, making it one of the most rapidly growing CSS frameworks in the world.

## Bootstrap vs Tailwind CSS

If you’re a web developer chances are high that you either know about or even used Bootstrap for a long time as your primary CSS framework. Most developers ask why would they switch from Bootstrap to Tailwind CSS?

Although the two frameworks are different in terms of methodology, they both can give you a strong foundation when building user interfaces. We wrote an [article comparing Bootstrap vs Tailwind CSS](https://themesberg.com/blog/design/tailwind-css-vs-bootstrap) in-depth if you’re interested.

## Getting Started

Although Tailwind CSS can be used via CDN and classes only, it is highly recommended to use it with the Tailwind configuration file powered by PostCSS. Follow along the [official guide to install](https://tailwindcss.com/docs/installation) Tailwind CSS and start building awesome user interfaces.

## Tailwind CSS ecosystem and community

Because it is a fairly new CSS framework the community, although very active, is still quite small in comparison to the one around Bootstrap, which was around for almost a decade. There is a growing amount of articles and Stackoverflow questions about Tailwind CSS and we estimate it will reach the levels of Bootstrap in a few years.

Check out this [awesome list of projects and resources](https://github.com/aniftyco/awesome-tailwindcss) about Tailwind CSS.

**Get access to free templates and themes used by over 5452 web developers:**

[Create account](https://themesberg.com/register) at Themesberg.
👋 Just a single CSS line for a perfect center layout
Tags: css, layouts, html
Published: 2020-10-02 08:10:12

---
title: 👋 Just a single CSS line for a perfect center layout 
published: true
description: 
tags: #css #layouts #html
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/it2sn2z1i7qihy6yg2pk.png
---

###`place-items` is a shorthand property for `align-items` and `justify-items` and can be used to perfectly center elements.

```css
  display: grid;
  place-items: center;
``` 

[Browser Support](https://caniuse.com/?search=place-items)
[MDN Docs](https://developer.mozilla.org/en-US/docs/Web/CSS/place-items)

Live in Action:
{% codepen https://codepen.io/hunzaboy/pen/XWdLyrg %}
Deno might not kill Node, but something else
Tags: deno, javascript, typescript, discuss
Published: 2020-10-02 07:39:46

Due to vast popularity of **NOT** Node.js, but JavaScript itself, and web browsers, I see Deno as a scripting language platform for JavaScript and WASM. It also supports [JSDOM](https://github.com/denoland/deno_std/pull/542), therefore all web browser methods.

It makes JavaScript and WASM comparable to JVM bytecode; but rather for dynamic typing.

It is also comparable to Java's [JBang](https://jbang.dev/), but I don't see JBang as getting very popular.

Of course, you can also use [Python](https://docs.python.org/3/distutils/setupscript.html#installing-scripts) for this as well.

Surprisingly, [Golang](https://gist.github.com/posener/73ffd326d88483df6b1cb66e8ed1e0bd) or [Kotlin](https://github.com/Kotlin/KEEP/blob/master/proposals/scripting-support.md) is just not yet ready for scripting with heavy external dependencies.

Node.js might not be good enough for scripting, because

- `/package.json` and `/node_modules` are required. You cannot simply use global filesystem's.
- `eslint`, and probably also `prettier` and `typescript`, are often recommendly installed. You don't need these in Deno.
- Javascript packages with **only JSDoc**, [no .d.ts](https://dev.to/patarapolw/comment/15e1h), when you already use TypeScript.

In short, I will kill other **scripting** languages.

## It probably cannot kill Node.js

It cannot replace Node mainly because it can only replace frontend libraries just as fast as other non-Node.js frontend libs. (Such as Golang's [esbuild](https://github.com/evanw/esbuild), and the associated [Hugo](https://dev.to/teamallnighter/how-to-add-custom-javascript-to-hugo-54p2).)

Node.js is just too popular. And [Deno is not yet ready for front-end compilers](https://www.reddit.com/r/Deno/comments/gyip0q/cmv_deno_is_unusable_for_webapps/).

```js
// This is a false comparison.
'node'.split('').sort().join('')
```
Creating Fluid Animation in the box using HTML and CSS
Tags: html, css
Published: 2020-10-02 07:32:39

**HTML**
```html
<div class="box"></div>
```
**CSS**
```css
:root {
  --bg-grey: #eee;
  --bg-dark: #303032;
}

* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

html, body {
  height: 100%;
}

body {
  display: grid;
  place-content: center;
  background-color: #fff;
}

.box {
  width: 10rem;
  height: 10rem;  
  border: 2px solid var(--bg-dark);
  background-color: var(--bg-dark);

  position: relative;
  overflow: hidden;
}

.box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width:100%;
  height: 100%;
  background-image: url("https://upload.wikimedia.org/wikipedia/commons/5/53/Google_\"G\"_Logo.svg");
  background-size: cover;
  background-position: 100%;
}

.box::after {
  content: '';
  position: absolute;
  bottom: -50%;
  left: -50%;
  border-radius: 45%;
  width: 180%;
  height: 180%;
  background-color: var(--bg-grey);
  
  animation: spin 4s ease-in-out infinite;
}

@keyframes spin {
  from {
    transform: translateY(0) rotate(0);
  }
  to {
    transform: translateY(-100%) rotate(500deg);
  }
}
```

**Result**

{% codepen https://codepen.io/sekti92/pen/xxVoyYd %}
21 TypoScript Conditions Cheatsheet
Published: 2020-10-02 07:22:31

Modern TypoScript Conditions will save you time & effort. In this article, You will find easy guidelines & examples of TypoScript conditions with modern Symfony expression language (in the form of an easy cheat sheet).

Since TYPO3 v9.4 LTS, The community introduced a new TypoScript condition from Symfony's expression language component. As an experienced developer, you understand well the importance and power of TypoScript. Let’s explore in-depth about old vs new TypoScript condition, Variables, and Functions of TypoScript, Create custom TypoScript condition, etc. 

In this blog, you'll learn, 
- TYPO3 + Symfony: When OpenSource Collaborates Together!
- What's Symfony Expression Language?
- Old vs New TypoScript Conditions
- Which Are Available TypoScript Conditions Variables?
- Functions for Backend and Frontend
- Functions for Frontend Only
- How to create Custom TypoScript Conditions with Symfony Expression Language?
- Advanced Example of TypoScript Conditions with Symfony Expression Language

Read the complete blog at - https://t3terminal.com/blog/typoscript-conditions-cheatsheet/
Leetcode - Binary Search (with JavaScript)
Published: 2020-10-02 07:03:53

Today I am going to show how to solve the Binary Search algorithm problem.

Here is the problem:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/yva9mrys0xacnflg5mds.png)

Binary search algorithm is one of the most famous searching algorithms. Even though it is not very difficult to understand, it is very important that we understand it thoroughly and know how to properly implement it.

Binary search algorithm helps us to find the position of a target value within a **sorted array**. It gives us O(log n) time complexity.

Binary search compares the target value to the middle element of the array. If they are not equal, based on that comparison either the first half or the second half of the array is selected while the other one is eliminated. The search then continues on the remaining half. The middle element is again compared to the target value. This process repeats itself until the target value is found. 

First, I am going to declare two pointers to solve this problem:
- Left pointer, which is going to point to the first number in the array and; 
- Right pointer, which is going to point to the last number in the array.

Then, I calculate the middle number by taking the sum of the left pointer and the right pointer and dividing that by two. Since we're dealing with indices and we know that an index cannot be a decimal number, we have to round this number down.

Now that we have the middle number, we are going to compare it to our target number. 
- If they are equal, we will return the index of the middle number.
- If the middle number is less than the target number, we will eliminate the second half of the array on the right side of the middle number. We will then move our left pointer and repeat this until the target value is found. 
- If the middle number is more than the target number, we will eliminate the first half of the array on the left side of the middle number. We will then move our right pointer and repeat this until the target value is found. 

```javascript
var search = function(nums, target) {
    let left = 0;
    let right = nums.length - 1;
    
    while (left <= right) {
        const middle = Math.floor((left + right) / 2);
        const potentialMatch = nums[middle];
        if(target === potentialMatch) {
            return middle;
        } else if (target < potentialMatch){
            right = middle - 1;
        } else {
            left = middle + 1
        }
    }
    return -1
};
```
Friday Blast #90
Tags: fridayblast, links, post
Published: 2020-10-04 12:54:40

---
title: Friday Blast #90
published: true
date: 2020-10-02 07:00:00 UTC
tags: fridayblast,links,post
canonical_url: https://horia141.com/friday-blast-90.html
series: "Friday Blast"
---

[More testable code with the hexagonal architecture #video (2019)](https://www.youtube.com/watch?v=ujb_O6myknY&feature=youtu.be) - the _hexagonal architecture_ is the name given to an clean and interesting approach to building large “business” applications. There is essentially a core of logic, surrounded by “ports” for persistency, communication, etc. and “adapters” that allow the logic to make use of the ports.

[Hexagonal architecture in DDD #video (2015)](https://www.youtube.com/watch?v=u6oTg5oRH24&feature=youtu.be) - another take on this, with some domain driven design bits thrown in. A lot of folks are doing both of these at the same time, and the match seems good.

[How we migrated Dropbox from Nginx to Envoy (2020)](https://dropbox.tech/infrastructure/how-we-migrated-dropbox-from-nginx-to-envoy) - in three words - the hard way! This is a surprisingly detailed look at what I can imagine is the equivalent of switching the engine in flight on an airplane.

[Brief history of scaling LinkedIn (2015)](https://engineering.linkedin.com/architecture/brief-history-scaling-linkedin) - The article was kind of light on the details, and is quite out of date. On the other hand, LinkedIn is an often overlooked tech powerhouse, with a lot of custom technology they had to build in order to handle their scale. So it’s well worth a read to see when and how these things got their start.

[Work on what matters (2020)](https://lethain.com/work-on-what-matters/) - can’t have a friday blast without a Will Larson post. The main idea is that as one advances through a career (not in time, but in impact and scope), one needs to deliver more in less time. Hence, you need to focus on what matters, and aggresively cut non essential work (drop it, or delegate it, basically).