teleren/devto huggingface dataset:
3 Ways to Automate AWS EBS Snapshot Lifecycle Management
Tags: devops, aws, cloud, backup
Published: 2020-07-06 06:11:12

In 2013 when I started with AWS, I had to write custom scripts with AWS CLI to manage EBS snapshots. Later in 2015, I switched to Lambda functions. Today there are managed options from AWS to manage the Snapshot lifecycle.

In this article, I have covered three ways to automate EBS snapshot creation with its key features and some best practices.

When it comes to AWS, snapshots are essential for backing up root volumes and data volumes.

Right from dev till production, snapshots lifecycle management should be set up to avoid accidental data loss and data availability.

It is essential to have well-managed snapshot automation to ensure the data is getting backed up every day.

Read the full article here https://devopscube.com/automate-ebs-snapshot-creation-deletion/
GeoDjango Installation: PostGIS and GDAL
Tags: django, geodjango, gdal, postgis
Published: 2020-07-06 06:00:27

---
published: true
---
[GeoDjango](https://docs.djangoproject.com/en/dev/ref/contrib/gis/) is a world-class geographic Web framework. We will install GeoDjango step by step:

* [Installing Geospatial library: `GDAL`](#chapter-1)
* [Database installation: `PostGIS`](#chapter-2)
* [`DATABASES` configuration](#chapter-3)
* [Add `django.contrib.gis` to `INSTALLED_APPS`](#chapter-4)

## **Installing Geospatial library: `GDAL`** <a name="chapter-1"></a>:
GeoDjango provides interfaces for some source geospatial libraries e.g. GEOS, PROJ.4, GDAL, GeoIP, PostGIS, SpatiaLite. On ubuntu/Debian, We will install the following packages which will install, directly or by dependency, the required geospatial libraries:

```bash
sudo apt-get update
sudo apt-get install python3-pip python3-dev libpq-dev 
sudo apt-get install binutils libproj-dev gdal-bin
pip install GDAL
```
## **Database installation: `PostGIS`** <a name="chapter-2"></a>:
PostGIS adds geographic object support to PostgreSQL, turning it into a spatial database.

 * [Install PostgreSQL](#chapter-2-1)
 * [Create Database, User and Grant Privileges](#chapter-2-2)
 * [Install PostGIS apt package](#chapter-2-3)
 * [Install the package that contains postgis.control manually](#chapter-2-4)
 * [Create PostGIS Extension](#chapter-2-5)

### **Install PostgreSQL** <a name="chapter-2-1"></a>:
```bash
sudo apt-get update
sudo apt install postgresql postgresql-contrib
```
### **Create Database, User and Grant Privileges** <a name="chapter-2-2"></a>:
Log into an interactive Postgres session by typing:
```bash
sudo -u postgres psql
```
First, create a database.
```bash
postgres=# CREATE DATABASE db_name;
```
Next, create a database user.
```bash
postgres=# CREATE USER db_user WITH PASSWORD 'password';
```
Then, give our new user access to administer our new database:
```bash
postgres=# GRANT ALL PRIVILEGES ON DATABASE db_name TO db_user;
```
Exit out of the PostgreSQL prompt by typing:
```bash
postgres# \q
```

### **Install PostGIS apt package** <a name="chapter-2-3"></a>:
```bash
sudo apt install postgis --no-install-recommends
```
### **Install the package that contains postgis.control manually** <a name="chapter-2-4"></a>:
```bash
sudo apt-get install postgis postgresql-<POSTGRESQL_VERSION>-postgis-scripts
```
### **Create PostGIS Extension** <a name="chapter-2-5"></a>:
```bash
sudo -u postgres psql
postgres=# \c db_name
db_name=# CREATE EXTENSION postgis;
```

## **`DATABASES` configuration** <a name="chapter-3"></a>:¶
Add the following `ENGINE` to `DATABASES` config at `settings.py`:
```python
DATABASES = {
    'default': {
         'ENGINE': 'django.contrib.gis.db.backends.postgis',
          ....
    },
}
```
## **Add `django.contrib.gis` to INSTALLED_APPS** <a name="chapter-4"></a>:

```python
INSTALLED_APPS = [
    'django.contrib.admin',
     .......,
    'django.contrib.gis',
]
```

Feel free to leave a comment.
What is NODE JS
Tags: node, javascript, computerscience
Published: 2020-07-06 05:35:37

# Top Companies Using Node Js:
* NETFLIX
* UBER
* PAYPAL
* LINKEDIN
* AMAZON
* NASA
* WALMART
* EBAY

# What is NODE JS?
* First of all, NODE is NOT(I repeat is NOT) a `FRAMEWORK` or a `PROGRAMMING LANGUAGE`.
* `NODE JS` is a JAVASCRIPT RUNTIME ENVIRONMENT and it was introduced by Ryan Dahl in  2009. He used the Chrome v8 Engine which is a javascript Engine that converts javaScript Code to Machine Code.
* It allow Us to Execute `JAVASCRIPT` outside the `BROWSER`.
* `NODE JS` was written using:
`JavaScript`,`CoffeeScript`,`C++(wiki)`

***

# Life Before NODE JS:
* `JavaScript` runs only inside the `Browser`
* `JavaScript` was used for `FrontEnd developMent` only (Animation and Data Validtion).
* We can't run `JavaScript` outside the `Browser`

***

# Life after NODE JS:
* We can excute JavaScript outside the browser.
* JavaScript can be used for `Backend Development`.
* More job Offer for `JavaScript` Developers.

***

# Why NODE JS?
* `Super Fast`
* `Highly Scalable`
* `Used by Top Companies`

***

## Real Life examples -

**STATS**:- Paypal Switched from `JAVA` to `NODE` and here are the results:

🛠️**DEVELOPMENT**:
* Built almost twice as fast with fewer people.
* Written in 33% fewer lines of code.
* Constructed with 40% fewer files.

⚙️**PERFORMANCE**:
* Double the requests per second vs the Java application:

⚠️This is even more interesting because the intial performance results were using a SINGLE core for the node.js application comared to FIVE cores in java🤯.
* 35% decrease in the average response time for the same page:

💥This resulted in the pages being served 200ms faster (Something Users will definitely notice).
Dịch vụ sửa chữa iPhone
Published: 2020-07-06 05:24:10

Một số dịch vụ sửa chữa tại Bách Khoa Store Vũng Tàu? 
BachKhoaStore.com chuyên cung cấp một số dịch vụ sửa chữa cho điện thoại iPhone như:

https://bachkhoastore.com/collections/thay-pin-iphone
https://bachkhoastore.com/collections/ep-kinh-iphone
https://bachkhoastore.com/collections/thay-man-hinh-iphone
https://bachkhoastore.com/collections/thay-vo-iphone
https://bachkhoastore.com/collections/thay-kinh-lung-iphone
https://bachkhoastore.com/collections/thay-pin-ipad
https://bachkhoastore.com/collections/thay-cam-ung-ipad
https://bachkhoastore.com/collections/thay-man-hinh-ipad
The Headless WordPress Experience with Frontity
Tags: wordpress, frontity, headless, vercel
Published: 2020-07-06 05:22:14

Ever since I came to know about the possibility of a headless setup for WordPress, I have always been tempted to try it out.

I tested out a simple setup based on [Next.JS](https://nextjs.org/) on my local setup, before going ahead with [Frontity](https://frontity.org/) on my blog with high traffic, which now has 2 posts counting this one 😅

You can check out the simple implementation here https://github.com/thrijith/headless-wp which is based on this https://webdevstudios.com/2019/01/03/headless-wordpress-with-react-and-nextjs-1/

The setup is pretty straightforward you may follow [this](https://docs.frontity.org/getting-started/quick-start-guide), to get started.

Run <code>npx frontity create mysite-frontity-app && cd mysite-frontity-app</code> select your desired theme and it will create a starter setup for your Forntiy app, run <code>npx frontity dev</code>, to launch the app, it will use a demo site to get the posts data for your newly created site.

<img src="https://awp.thrijith.com/wp-content/uploads/2020/04/image-1-1024x333.png" alt="" class="wp-image-126"/>

Go ahead and edit **frontity.settings.js** and point **@frontity/wp-source** => **api** field to your WordPress site, run <code>npx frontity dev</code> again you should now see posts from your site instead of data from the demo site.

<img src="https://awp.thrijith.com/wp-content/uploads/2020/04/image-2-1024x572.png" alt="" class="wp-image-127"/>

#### Deploying your site in Vercel

Frontity has a dedicated section which covers the deployment on [Vercel](https://docs.frontity.org/deployment/deploy-on-now) ( Previously Zeit )

Once your app is set up correctly, it will be visible in your Vercel Dashboard, it will create a random URL for your site, you can test your site there.

<video width="95%" height="400px" controls src="https://awp.thrijith.com/wp-content/uploads/2020/04/Screen-Recording-2020-04-28-at-12.52.04-PM.mov"></video>

You can also set a custom domain for your site, settings for the same can be found under Project => Settings => Domains, you'll also have to set up an ALIAS record to point your custom domain.

<img src="https://awp.thrijith.com/wp-content/uploads/2020/04/Domains-thrijith-frontity-app-Vercel-2020-04-28-12-58-02.png" alt="" class="wp-image-129"/><figcaption>Settings Page</figcaption>

<img src="https://awp.thrijith.com/wp-content/uploads/2020/04/Screenshot-2020-04-28-at-1.01.50-PM.png" alt="" class="wp-image-130"/><figcaption>Sample ALIAS record in <a href="https://porkbun.com/">https://porkbun.com/</a> ( My domain registrar )</figcaption>

Please note it may take a couple of hours to reflect the change.
See ESLint rules detail in VSCode with LintLens plugin
Tags: todayilearned, vscode, javascript, eslint
Published: 2020-07-06 05:22:04

Exploring projects on github, I came across an `eslint-plugin-import` issue where it was complained that "LintLens" was unable to present information about a specific eslint rule.

So, I found out that LintLens is a plugin to help us manage and understand ESLint rules directly in VSCode. 😁

In eslint configuration file, the rules description is presented inline. When hovering, other metadata is presented, along with a link to documentation page:

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

Pretty cool, right?

Extension page: https://marketplace.visualstudio.com/items?itemName=ghmcadams.lintlens

Ah, and I solved the issue by simply adding metadata to the rule :-)
Parallel File Sharing platform
Tags: cpp, productivity, github, c
Published: 2020-07-06 05:15:04

Parallel upload and download of file

From the Server this platform allows parallel upload and download. Epoll is used to allow Asynchronous IO and parallel uploads & downloads.

Principles of Design :

Client registers to start/initiate the sharing.
Client establishes connectivity to specific client after regsitration with other clients.
The register gets updated every time a new client registers or drops.

https://github.com/gautam1858/Parallel-File-Sharing
(Video) Authentication Service in Actix - Part 1: Configuration
Tags: rust, webdev, tutorial, security
Published: 2020-07-06 05:13:58

{% youtube AH2P7Vc0N9s %}

In this video series, I'm going to build an authentication service in Actix.

There are a couple of new libraries that I want to try, and a few people already asked me to do authentication, so let's see how it goes.

The idea is to have a service that will allow the user to create an account, log in and have access to other secure resources. I'm going to do something simple using only JSON Web Tokens, but it will give you an idea of how to implement a more complex setup like combining it with Oauth 2. 

In this first part, I will set up the app configuration, the logs, and add a simple health endpoint.
Null vs Undefined? Answer: Nil
Tags: javascript, defensiveprogramming
Published: 2020-07-06 04:53:47

In JS I don't think in terms of null or undefined, but think in terms of "nil".
I use a utility func similar to Ramda's R.isNil

And I have a complement func called, isNotNil

```JS
/**
@func
true if var is null or undefined

@param {*} v
@return {boolean}
*/
export const isNil = v => v === undefined || v === null;
```

```JS
/**
@func complement

@param {*} v
@return {boolean}
*/
export const isNotNil = v => !isNil(v);
```

```JS
//@tests
const aTrue = [undefined, null, (() => undefined)(), (() => null)(), (() => console.log())()];
const aFalse = ["", 0, -0, [], {}, () => undefined, "undefined", "null", NaN, -Infinity, 9e9999, 9999n];
logForeachParam(isNil, aTrue);
logForeachParam(isNil, aFalse);
```
Result of test:
![isNil test](https://dev-to-uploads.s3.amazonaws.com/i/1n264bm8k0bpfow7tkwt.jpg)



## logForeachParam sourcecode at:
https://gist.github.com/funfunction/42918a4751ae51828cfc4c2dd4c0678e


<!--
#### sourcecode:
https://gist.github.com/funfunction/0e64a5aa3abedfa237823d0bab2ef70b
-->
YouTube Video | Top 10 VS Code Extensions in 2020
Tags: youtube, webdev, showdev
Published: 2020-07-06 04:48:21

I had recently started my YouTube channel — The Web Dev. 

Visual Studio Code is an amazing code editor. It's open source and the community support and extensions are awesome. In this video I will cover my personal top 10 VS Code extensions that I use daily.

{% youtube M2k01qrdI0U  %}

Please do like it and [Subscribe](https://www.youtube.com/channel/UCRf7mazcufqZxd2pR3oQJuQ?sub_confirmation=1) to my channel for more videos.
Unsupervised Learning
Tags: beginners
Published: 2020-07-06 04:46:50

If you're just starting to get into data science and machine learning, you've probably heard of unsupervised learning a lot. It is generally used for classification problems. When classifying sets of data, you have a question that you need answered. Say for example you only have today's temperature, humidity, air pressure, and inches of rain today. And you want to try and predict if it will rain tomorrow. When you look up historical data, your targets become the answer to whether or not it rained the next day. If yes, then your target is a one. If no, then your target is a zero. 

Unsupervised learning is when you don't set targets for your machine learning algorithms to learn from. And in this example, it would be if you didn't know if it rained the next day. The advantage of unsupervised learning is that it might be able to pick up on events that don't normally happen, like a hurricane. 

Another example of this is in fraud detection. Fraud detection algorithms are pretty good at detecting common frauds. However, frauds make the most money by inventing new methods, which regular supervised learning cannot pickup. 

Unsupervised learning has a lot of potential ranging anywhere from fraud detection to stock trading.
VSCode で Go の syscall/js を利用する場合
Tags: vscode, webassembly
Published: 2020-07-06 04:42:15

```
"settings": {
    "go.toolsEnvVars": {
        "GOARCH":"wasm",
        "GOOS":"js",
    },
    "go.testEnvVars": {
        "GOARCH":"wasm",
        "GOOS":"js",
    }
}
```

GOARCHに wasm 、GOOS に js を設定しないといつまでも認識してくれずエラーになる。
chapter 21,chapter22
Tags: functional, programming
Published: 2020-07-06 04:39:24

Functions literals can be assigned to val fields to create function variables.
To be consistent with algebra and other FP resources, I refer to these fields are variables rather than values.
Examples of the val function syntax.
A function is an instance of a FunctionN trait, such as Function1, or Function2.
What various function type signatures look like in the REPL.
How to treat a function as a variable by putting it in a Map.
That, in general you can use a function variable just like any other variable.


A def mehtod is not a val (Part I)
A def mehtod is not a variable(Part II)
val =>creates an instance of the Function1 trait
def => create method 


Convert def method to function.
def double(i:Int) = i*2

val doubleF = double _
Adding Colab Notebooks to Github using Git
Tags: github, colab, git, machinelearning
Published: 2020-07-06 04:22:50

Ever thought of pushing your Colab Notebook into your Github Repository Directly? Yes, It's possible and it's an anomaly of how we do it locally.

Firstly, Initialize an empty git repository as -

```
!git init
```

Then, add your data to your Global Config-Files,

```
# Add your email to the global config-file
!git config --global user.email <your-email-add@email.com>

# Add your email to the global config-file
!git config --global user.name <your-github-username>
```
Then add your files to the repo using -

```
!git add .
```

NOTE: `!git add.` would add all the files and folders from your current directory. We can selectively select the files we want to add too by using - 
```
!git add <file-name/directory-name>
```

Then commit the added files with a message -

```
!git commit -m "Colab Commit"
```

Now, Adding our remote repository into our colab system,

```
!git remote add origin https://<your-github-username>:<your-github-password>@github.com/<your-github-username>/<your-repository-name>.git
```

Note: If we've activated 2FA Security on your account, then we must add our personal-access-token instead of our password which is available in Settings -> Developer Settings -> Personal Access Token ie replace `<<your-github-password>` with `<personal-access-token>`

And at last to push our committed files into our repository-

```
!git push -u origin master
```

Note: If any error occurs in this step regarding `push`, Try out 

```
!git push -u origin master --force
```

Troubleshooting -

If you get errors with origin like  `fatal: remote origin already exists`, try out -

```
!git remote rm origin
```

For any queries, mail me at - mail@rahulbordoloi.me

Also, check out my Gist for the same - 
{% gist https://gist.github.com/rahulbordoloi/1f764d7912474a66e2c0b979389cb94d %}

Thank You!
How to make the HTML input fit the containing div
Tags: html, javascript, css, react
Published: 2020-07-06 04:13:37

Hey there!

I wanted to challenge myself to write a technical post again so here I am. I've recently gotten to writing up a todo app in React and came across this issue. It's simple to solve but I thought, why not do up a blog post on it?


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

This is my code.

```
<div id='main-div'>
  <div id="inner-div">
      <input id="text-input" type="text" value={this.state.obj.text} placeholder="Enter todo item" onChange={this.handleChange} /> 
  <div>
</div>
```
This is my code structure, simplified.

However, when you run this, you get this.

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

I have sort of colour-coded the different divs. Red indicates the main div while blue indicates the inner div.

Notice how the `input` is overflowing out of the inner div?

So, apparently this is a thing in CSS or HTML. I searched it up and found this [answer](https://stackoverflow.com/a/14701824). 

From the answer, I understand that there is a bounding border box on the `input` tag. If you use the `box-sizing: border-box;` style with the `input` tag, this actually places the bounding box inside the tag. 

The `input` tag appears bigger because the bounding box appears outside of it, initially.

It's an interesting property to have. 

Well, this has been short but sweet. Hope anyone who comes across this post learned something or have fixed their issue. 

Thanks for reading!
What aliases and scripts do you use?
Tags: discuss, alias, terminal, bash
Published: 2020-07-06 04:00:37

---
title: What aliases and scripts do you use?
published: true
description: 
tags: discuss, alias, terminal, bash
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/roz2dlb2uffpihepfv7z.jpg
---

As developers we use a lot of alias and small scripts to automate boring stuff. [Here](https://github.com/rafi993/devScripts) is my commonly used alias and scripts. What do you use?
A First-Impression of Mobile Development
Tags: codenewbie, ux, react, webdev
Published: 2020-07-06 03:59:59

As a web dev newbie trying out Mobile Development for the first time, I'm learning over and over again the importance of developing with User Experience as a top priority. As [Frank Chimero](https://frankchimero.com/) puts it,  *__"People ignore design that ignores people."__*

For my very first mobile project, I decided to build a photo application in React Native that borrowed some of the interactivity of a Polaroid camera (like shaking your phone to develop your photo). In embarking on the project, I figured the most difficult challenge was going to be technical; learning the new tech. What I didn't realize was how much thought and preparation I'd be putting into developing an app with satisfactory user experience, let alone a good one.

As I've done many times already in my short time as a developer, I've stumbled upon a rabbit hole. This one in particular, even though I don't have the time to go down it now, I have every intention of coming back to later. 

In web development, the browser handles a lot of the user's interaction with a site by default. Sites live in the browser and the browser has preset rules, which aren't broken often. (Think of the little jolt of surprise you get when you go to scroll down and a site's content starts moving to the right instead.)

In mobile, it's free for all. Users can click anywhere, swipe anywhere, tilt, shake, move locations, etc. The developers (along with designers of course) are in charge of setting the rules. This means that when I create a component in my React Native project, I'm not only thinking about its state, props, style, and functionality. In mobile development, I'm also asking questions about how the user interacts with that component and how the component changes in response.

Questions like, *"If a user swipes in x direction in x part of the screen, for x many pixels change will my app render to the right thing?"*. *"What kind of feedback should I give the user to let them know that they are physically interacting with the app correctly?"*. *"What conventions exist in mobile development and how can I implement them in my app?"*.

In the browser, many conventional actions are default actions. In mobile development, at least at the moment, that doesn't seem to be the case. Like my earlier example, convention lets the user scroll down and expect the page to move down. The browser's default gives the developer this convention for free.

Whether I find myself working in web or mobile development, the experience of having developed in both has been eye-opening. Specifically, the unavoidable intentionality you need when developing a good user experience for mobile is a practiced skill of mobile developers and a translatable skill to Web.

Jumping headfirst into my first mobile project only two weeks ago, I know I have so much still to learn. Here are some of my takeaways so far: 

1) Design beyond the default. 
2) Consider convention. 
3)Provide strong user feedback even on the web.
5th Week Streak on Dev.to
Tags: blogging, consistency, streak, devto
Published: 2020-07-06 03:53:43

---
title: 5th Week Streak on Dev.to
published: true
description: 5th Week Streak on Dev.to - Writing every weekend for a fifth week in a row
tags: #blogging #consistency #streak #devto
cover_image: https://images.pexels.com/photos/3094799/pexels-photo-3094799.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260
---

This was supposed to be a different post about a small project am doing this weekend. However, I won't be able to finish the project before midnight. Hence, I am writing this tiny blog post so that I don't break the blogging streak.

Last week I receive this from Dev.to and it has kept me motivated to keep on writing...

>Congratulations, Ami Amigo! You received the 4 Week Streak badge! Awarded for consistency of writing. Congrats on achieving this streak! Consistent writing is hard. The next streak badge you can get is the 8 Week Badge.

On that note, Let's keep on writing
The Scariest Bug (I Haven’t Written Yet)
Tags: programming, funny, music
Published: 2020-07-06 17:59:06

---
title: The Scariest Bug (I Haven’t Written Yet)
published: true
date: 2020-07-06 03:39:52 UTC
tags: Programming,funny,music
canonical_url: https://www.codingblocks.net/programming/the-scariest-bug-i-havent-written-yet/
---

Okay, so I promised to sing a song if [Coding Blocks](https://www.codingblocks.net/) got enough podcast reviews and, thanks to **you** , we made it _kinda_, and I sang a song _kinda_!

Okay, so I actually dusted off a song I had written a while back for a Halloween gag I never went through with but..dang, I cannot sing. Rather than subject you to my warbling, I hired an [amazing singer](https://www.fiverr.com/evgenyzhukov493/be-your-male-singer-or-vocalist) on fiverr. Trust me, it’s better this way.

Anyway, here it is – a short song, with video, about the inevitability of making programming mistakes. Enjoy!

{% youtube cESavedcYYU %}