teleren/devto huggingface dataset:
Logical 'AND' Operator | Shell Scripting
Tags: linux, beginners, tutorial, devops
Published: 2020-12-05 07:09:27

**This is a multipart blog article series where I am going to explain the concepts of shell scripting and how to write a shell script in Linux, UNIX or Mac based systems. You can also follow this tutorial blog using windows but for that you have to install a bash from.**

_In this article we will see that how can we use ‘AND’ operator with the help of if condition. We will also see that different ways to use ‘AND’ operator._

We are going to use AND operator with if condition to solve a problem.
The problem is, we have to print valid age if the age is between 18 to 30 years, and if not then print invalid age.
1. If the age is greater than 18 then **AND** smaller than 30 then its successful/ true
2. Otherwise it’s false/ unsuccessful.
3. The syntax of if condition for this problem will be `if [ “$<variable_name>” –gt 18 ] && [ “$<variable_name>” –lt 30 ]`
4. There are two ways to use AND operator, we are using `&&` in this example.
5. If AND operator is used then both conditions should be true, in order to get true otherwise it will return false.
6. Another way to use **AND** operator is `if [ “$<variable_name>” –gt 18 –a “$<variable_name>” –lt 30 ]`
7. In this way we use `-a` flag and it will work same as `&&` but the syntax to write the; if condition gets change little bit.
8. If you want to use `&&` operator then there is one more way to do this, and that is by using double square brackets like this `if [[ “$<variable_name>” –gt 18 && “$<variable_name>” –lt 30 ]]`

[Practical code file for this article](https://github.com/rahulMishra05/shell-scripting/blob/main/video8.sh)

_So this was all about using AND operator with if condition. Hope you liked it and learned something new from it._

If you have any doubt, question, quires related to this topic or just want to share something with me, then please feel free to contact me.

### 📱 Contact Me

[Twitter](https://twitter.com/r_mishra10)
[LinkedIn](https://www.linkedin.com/in/rahul-mishra-66210b185)
[Telegram](https://t.me/rahul_mishra10)
[Instagram](https://www.instagram.com/rahul_mishra10/?hl=en)

### 📧 Write a mail
<rahulmishra102000@gmail.com>

#### 🚀 Other links

[GitHub](https://github.com/rahulMishra05)
[HackerRank](https://www.hackerrank.com/rahulmishra10201)
Rate my portfolio site!
Tags: html, javascript, css, portfolio
Published: 2020-12-05 07:07:55

### Notice
This site design has since been changed and will now look different compared to the header image and the various screen shots in the comments below :) 



I based my site off of Denis Ivy's portfolio tutorial, with some modifications. Original tutorial repo: https://github.com/divanov11/portfolio-website

Here is my site: https://cameronthompson.io

I would love to know what you guys think!
OpenBSD Upgrade 6.7 To 6.8
Tags: openbsd, os, server, upgrade
Published: 2020-12-05 05:14:14

## Summary

The latest [OpenBSD](https://www.openbsd.org/) OS is now [6.8](https://www.openbsd.org/68.html) ✨
which was released on 18 Oct 2020.

{% twitter 1317848949907128320 %}

<center>[What's New]
(https://www.openbsd.org/68.html#new)</center>

Moody artwork 😊

![openbsd 6.8 artwork](https://www.openbsd.org/images/PuffyOverride.png)

Almost all what to do is what nice [`sysupgrade`](https://man.openbsd.org/sysupgrade) which first appeared in 6.6 will do automatically and thankfully.

By the way, [httpd.conf](https://man.openbsd.org/httpd.conf.5) might have to be paid attention to, because [the grammar about fastcgi has been changed](https://www.openbsd.org/faq/upgrade68.html#ConfigChanges)... 👀

---

## Tutorial

Here is a step-by-step guide for the upgrade with a set of the commands to run.

1. Pre-upgrade
2. Upgrade
3. Post-upgrade
4. Follow configuration changes
5. Remove old files
6. Special packages

<center>🌼 🐝 🌼</center>

### 1. Pre-upgrade

```console
$ # validate available disk size of /usr is greater than 1.1GB
$ df -h
```

### 2. Upgrade

```console
$ doas sysupgrade
$ # Reboot automatically,
$ # and the sysupgrade process continues.
$ # The login message will be "OpenBSD 6.8 (GENERIC)" next time.
```

### 3. Post-upgrade

```console
$ doas sysmerge
$ # There is a case when something happens, which is not always. In my case, I had sometimes to merge /etc/login.conf and so on.

$ doas syspatch; doas pkg_add -u
$ doas reboot
$ # Almost done!
```

What to do after `pkg_add -u` is due to the server. For example, in one of my servers, running `doas crontab -u _mailman /usr/local/lib/mailman/cron/crontab.in` was required to update `/var/cron/tabs/_mailman`.

### 4. Follow configuration changes

Check [the documentation](https://www.openbsd.org/faq/upgrade68.html#ConfigChanges) if you use some of:

- [httpd.conf(5)](https://man.openbsd.org/httpd.conf.5)
- [ldapd(8)](https://man.openbsd.org/ldapd.8)
- [snmpd.conf(5)](https://man.openbsd.org/snmpd.conf.5)
- [npppd.conf(5)](https://man.openbsd.org/npppd.conf.5)

### 5. Remove old files

```console
$ doas rm -f /usr/lib/libperl.a
$ doas rm /usr/X11R6/lib/libxkbui.* \
     /usr/X11R6/lib/pkgconfig/xkbui.pc \
     /usr/X11R6/include/X11/extensions/XKBui.h
```

The descriptions are [here](https://www.openbsd.org/faq/upgrade68.html#RmFiles).

### 6. Special packages

Check [the documentaion](https://www.openbsd.org/faq/upgrade68.html#SpecialPackages) if you use some of:

- net/isc-bind
- www/goaccess

---

Wish you happy time with OBSD 😊
10 Must CSS tricks and tips for beginners
Tags: beginners, codenewbie, css, tricks
Published: 2020-12-05 07:00:31


CSS tricks are something everyone should know for productivity and doing their projects fast. Here I have gathered 10 simple and must-know tricks for beginners who are learning to code. 
<hr>

## Reset 

Some browser applies different styles to each element, so it's considered a best practice to rest your CSS at the very start.  

```css
body, div, h1,h2, h3, h4, h5, h6, p,ul {
    margin: 0;
    padding: 0;
}
```

## Use single-line property declaration

Let's say you want an element to have a border, instead of doing it like this: 

```css
.with-border{ 
    border-width: 1px;
    border-style: solid;
    border-color: red;
}

/* Simple way to do this */

.width-border{
    border: 1px solid red;
}

```

## Use text-transform

Instead of using all uppercase or lowercase characters in HTML directly:

```html
<h1 class="title">THIS IS TITLE</h1>
```

You can jsut use the `text-transform` property:

```css
.title{
    text-transforom: uppercase;
}
```

## Vertical centering

Let's say you have HTML like this:

```html
<div class="vcentered">
<div>&check;</div> </div>
```

And you want to vertically center the check, just simple do this:

```css
.vcentered{
    display: flex;
    align-items: center;
}
```

## Link style order

When setting the style for link states, there are some order rules that you need to remember:

```css
a:link 
a:visited
a:hover
a:active
```

## Condtional comoments

An ideal way to target IE browser is to use conditional comments:

```html
<!--[ifIE]>... <![endif] -->
```
This will only load when the browser browser viewing the page is Internet Explorer. 

## Drop Caps

You can easily achieve a drop cap by using the CSS pseudo-element :FIRST-LETTER. 

```css
.content:first-letter {
    font-size: 3rem;
}
```

## Truncate text with Ellipsis

Usage:

```css
:.content {
    width: 400px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
```

The element's width and overflow are required. 

## Overriding all the styles

For overriding specific style in CSS you can use the `!important` after the style. 

```css
h2{
    color: blue !important;
}
```

## Hover effects

This is used for button, links and icons. When someone hovers on link it will change colors.  We'll use :hover for it. 

```css
.first h4{
    font-size:36px;
    color:#000;
    font-weight:800;
}

.first h4:hover{
    color:#f00;
}
```

This were some basic CSS tricks i think beginners must know. For advanced users also coming. 

 
<hr>
## Need Help
Need help in raising fund to buy a Mechanical Keyboard. This pandemic has affected my family badly so can't ask my DAD for it. Please Help Me. 

<a href="https://www.buymeacoffee.com/rahxuls">
![1.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1606540958103/otN4S9TK8.png)
</a>

<hr>
😎 Thanks For Reading | Happy Coding ⚡
Lap 9 - OSD600
Published: 2020-12-05 06:57:53

For this week we were tasked with finalizing our Link Checker program, as always you can find mine [here](https://github.com/MLJBrackett/link-check)

Basically we had to package our program and host it on a dedicated package website, for my Python program I chose: https://pypi.org/

What was the process for creating a release? Be detailed so that other developers could read your blog and get some idea how to do the same.

The process was generally easy and PyPi had some great documentation on how to package and host your program, mostly I had to set up 1 file (Which I just copied and pasted from their tutorial then changed a bit of it) and then run a few commands to get it hosted.

I had to change A LOT of my programs file structure in order to host the package cleanly and to get it running globally from the command line, I found out that I can actually use something called command entries to achieve this though.
The biggest time waster was having to restructure my code and order them in files, but honestly this was probably for the better anyways since it's a lot easier to work with now.

My user testing was pretty smooth but I also realized that I had to change my documentation to include that you could download it on PyPi from this point forward, So now I have two different installation instructions. One of the contribution page. Incase other programmers wan't to get started and help out, and one in the Readme.MD so the average person can just install it from PyPi and use the tool directly.

I chose someone that had no programming experience, which obviously they had trouble installing the program (using git clone and stuff) But actually running the program and using the commands was very easy for them to do so. I did a second run with the updated readme.md (The one that says to download it from PyPi) and that went a lot smoother since there was no other tools needed to install the program.

You can download the release of my Link Check project at:
[Link Check](https://pypi.org/project/linkcheck-pkg-MLJBrackett/)
Append Data in File | Shell Scripting 
Tags: linux, beginners, tutorial, devops
Published: 2020-12-05 06:42:52

**This is a multipart blog article series where I am going to explain the concepts of shell scripting and how to write a shell script in Linux, UNIX or Mac based systems. You can also follow this tutorial blog using windows but for that you have to install a bash from.**

_In this article we will see that how can we append some data at the end of a file using shell script._

1. If we want to add some data at the end of the file, then we can do that in this way.
    - First we will check that file exist or not by this statement `if [ -f $fileName ]`
	- If file exist then we will check that whether that file has write permission or not, and we can do by this command ` if [ -w $fileName ]`
    - If the file has write permission then, we can add some data/text at the end of the file using this command `cat >> $fileName`
    - Remember that if we use `>>` this means that we want to add some data at the end of the file, but if we use `>` after the cat command than it means that we want to overwrite the file.
    - If the file does not have write permission, then we will print that file does not have write permission and program will exit.
    - Similarly, if the file does not exist, then we will print that file does not exist and program will exit.

***Note:*** _To remove the write permission from the file we can write this command `chmod –w <file_name>`, and if we want to give write permission to the file then we will write this command `chmod +w <file_name>`_

[Practical code file for this article](https://github.com/rahulMishra05/shell-scripting/blob/main/video7.sh)

So this was all about that how can we add some data/ text at the end of a file using shell script. Hope you liked it and learned something new from it.
If you have any doubt, question, quires related to this topic or just want to share something with me, then please feel free to contact me. 

### 📱 Contact Me

[Twitter](https://twitter.com/r_mishra10),
[LinkedIn](https://www.linkedin.com/in/rahul-mishra-66210b185),
[Telegram](https://t.me/rahul_mishra10),
[Instagram](https://www.instagram.com/rahul_mishra10/?hl=en),

### 📧 Write a mail
<rahulmishra102000@gmail.com>

#### 🚀 Other links

[GitHub](https://github.com/rahulMishra05),
[HackerRank](https://www.hackerrank.com/rahulmishra10201)
Django: Decouple Excerpt
Tags: django, python, original
Published: 2020-12-05 04:28:06


> In the Court of Judiciary, the loser is the one who has won, dead is the one who has lost.  - Boothayyana Maga Ayyu, Kannada Cinema.


In real-world projects, sensitive and important data such as server IP address, credentials, etc,  must be kept secret as much as possible. 

For doing so, we have lots of tools, utilities, packages, etc. But while using such a facility, there may be problems of another kind.

Let's have an illustration.

#### Django Twangy:

The `cookie-cutter` tool is a commonly used project template starter. And provides us with a clean folder structure, `.envs`, for storing the data.

These data are supplied to python code via environment variables, something like:


```
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'ecommerce-portal',
        'USER': 'postgres',
        'PASSWORD': os.environ.get('DATABASE_PASSWORD'),,
        'HOST': os.environ.get('DATABASE_HOST', default='localhost'),
        'PORT': '5432',
    }
}
``` 
Here secrets such as `DATABASE_PASSWORD`, `DATABASE_HOST` can be stored at `.envs`.

#### The Case:

In the above scenario, if `Supervisor` (a process control system) is used: While restarting sub-processes, 

```
sudo supervisorctl restart ecommerce_celery
```
the result maybe something like:


```
ecommerce_celery: ERROR (not running)
ecommerce_celery: ERROR (spawn error)
``` 

If subprocess worker log is checked: 

```
django.db.utils.OperationalError: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
``` 

- `supervisor` runs outside the context of the virtual environment, detached from environment variables
- In the above error case, the `supervisor` has not received the database name to connect.

A possible try is to pass the database name in the config file as an environment variable, like:

```
environment = DATABASE_HOST="255.254.253.252", .....
``` 
at `/etc/supervisor/conf.d/ecommerce_celery.conf`.

This does not seem to work but continues to persist with the same error.

#### Saviour:
`python-decouple` is a smart and simple solution that solves the above problem in a painless manner.

```
from decouple import config

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'ecommerce-portal',
        'USER': 'postgres',
        'PASSWORD': config('DATABASE_PASSWORD'),,
        'HOST': config('DATABASE_HOST', default='localhost'),
        'PORT': '5432',
    }
}
``` 

The restart does not produce the errors but runs successfully. 

### Links:

1.   [Python Decouple](https://pypi.org/project/python-decouple/) 
2.  [Cookie Cutter](https://cookiecutter-django.readthedocs.io/en/latest/) 
3.  [Supervisor](http://supervisord.org/)
On-Premises SQL Database Transactional Replication to Azure SQL Database
Tags: azurereplication, azure, sqldbreplication, cloud
Published: 2020-12-05 06:29:00

Transactional replication is a feature of Azure SQL Managed Instance and SQL Server that enables you to replicate data from a table in Azure SQL Managed Instance or a SQL Server instance to tables placed on remote databases. This feature allows you to synchronize multiple tables in different databases.
**Link**: 
https://nakibjuris.medium.com/on-premises-sql-database-transactional-replication-to-azure-sql-database-a293a0e0a32e
On-Premises SQL Database Transactional Replication to Azure SQL Database
Tags: azurereplication, azure, sqldbreplication, cloud
Published: 2020-12-05 06:28:29

Transactional replication is a feature of Azure SQL Managed Instance and SQL Server that enables you to replicate data from a table in Azure SQL Managed Instance or a SQL Server instance to tables placed on remote databases. This feature allows you to synchronize multiple tables in different databases.
**Link:** 
https://nakibjuris.medium.com/on-premises-sql-database-transactional-replication-to-azure-sql-database-a293a0e0a32e
How to Deploy Laravel 8 on cPanel [easiest way in 2020]

Tags: laravel, cpanel, hosting, deploy
Published: 2020-12-05 06:25:34

How to Deploy Laravel 8 project on cPanel easiest way -  Install Laravel on Cpanel 
In this video, I will show you how to easily upload  a Laravel application to a shared hosting account via Cpanel

//htaccess file code 
https://codeconia.com/2020/11/17/host-laravel-8-project-on-cpanel-easiest-way/


[Watch Video On Youtube](https://www.youtube.com/watch?v=WN2hHvxMHTI&t=1s&ab_channel=Codeconia)  : https://www.youtube.com/watch?v=WN2hHvxMHTI&t=1s&ab_channel=Codeconia

🙏 Thanks for taking a look at my content!

📨 Join our discord server : https://discord.gg/ykraz6yAJC

🎥 Subscribe to my YouTube channel! : https://www.youtube.com/channel/UC_klOvl59ySlBnXH4tKr5Og?sub_confirmation=1
Python Programming🐍(Part-1)
Tags: programming, python
Published: 2020-12-05 06:23:30

▪ What is programming? 
Just like we use Bangla or 
English to communicate with each other, we usea programming language like python to communicate with our computer.
Programming is a way to instruct the computer to complete various tasks.


▪ What is python?
Python is a simple and easy to understand programming language which feels like reading simple English. The code nature of Python makes it east to learn and understandable for beginner.


▪ Features of Python
 ▶ Easy to understand,
 ▶ Less development time,
 ▶ Free & open source,
 ▶ High rated language,
 ▶ Portable,
 ▶ Works on windows/mac/linux,
 ▶ Fun to work with.


▪ Installation-
Follow this video to learn how to install python :  https://youtu.be/PiA1P3tv_9k
How to create a website using tail blocks and host it live in 30 minutes (Working 2020)
Tags: tailblock, tailwindcss, css, webdesign
Published: 2020-12-05 06:22:04

How to create a website using tailwind css and tailblock components will help you to save lots of time while you creating small business websites 

[Watch Video On Youtube](https://www.youtube.com/watch?v=mAACa27yrDc&ab_channel=Codeconia)  : https://www.youtube.com/watch?v=mAACa27yrDc&ab_channel=Codeconia

🙏 Thanks for taking a look at my content!

📨 Join our discord server : https://discord.gg/ykraz6yAJC

🎥 Subscribe to my YouTube channel! : https://www.youtube.com/channel/UC_klOvl59ySlBnXH4tKr5Og?sub_confirmation=1



This is the tailblock link .
https://mertjf.github.io/tailblocks/   [TAILBLOCK LINK]
UNSUPERVISED LEARNING
Tags: machinelearning, datascience, unsupervisedlearning
Published: 2020-12-05 05:55:26

Unsupervised Learning

Unsupervised learning is where only the input data is present and no corresponding output variable is there. Unsupervised learning has a lot of potential ranging anywhere from fraud detection to stock trading.

Unsupervised learning has two categories of algorithms:

Clustering: A clustering problem is where you want to discover the inherent groupings in the data, such as grouping customers by purchasing behavior.

Association: An association rule learning problem is where you want to discover rules that describe a large portion of your data.
Association rules mining are used to identify new and interesting insights between different objects in a set, frequent pattern in transactional data or any sort of relational database.
****Anomality detection
****Neural Networks

Clustering
Clustering is similar to classification, but the basis is different. In clustering, you don't know what you are looking for, and you are trying to identify some segments or clusters in your data.
Probabilistic Clustering – clustering your data points into clusters on a probabilistic scale.

These variations on the same fundamental concept might look something like this in code:

#Import the KMeans package from Scikit Learn
from sklearn.cluster import KMeans
#Grab the training data
x = os.path(‘train’)
#Set the desired number of clusters
k = 5
#Run the KMeans algorithm
kmeans = KMeans(n_clusters=k).fit(x)
#Show the resulting labels
kmeans.labels_

Any clustering algorithm will typically output all of your data points and the respective clusters to which they belong. It’s up to you to decide what they mean and exactly what the algorithm has found.

Unsupervised learning is suitable for exploring unknown data. If you don’t know what you need to find, then this is the perfect method for you. 
It’s quite costly to annotate large datasets. As a result, experts rely on a few examples to work on the problem. 

Learn how to implement the following Machine learning Clustering models:

1.K-mean Clustering
2.Hierarchical Clustering
The main problem is how to use the right estimator for our problems?
You can use the https://scikit-learn.org/stable/tutorial/machine_learning_map/index.html map for your problem.

Happy coding!
โปรแกรมที่เราเขียนจะรันบน Runtime Environment แบบใดแบบหนึ่งเสมอ
Tags: programming
Published: 2020-12-05 05:48:51

โปรแกรมคอมพิวเตอร์ประกอบด้วย Hardware และ Software ซึ่ง Hardware เนี่ยแหละเป็น Runtime Environment ให้ Software

เพื่อให้ง่ายในการสร้างโปรแกรมจึงเกิด Programming Language ขึ้นมาให้เขียนโค้ดอ่านง่ายๆแล้วค่อยแปลงเป็นโค้ดที่ Hardware เข้าใจ

จริงๆแล้ว Hardware เป็นแค่ Runtime Environment แบบนึง สุดท้ายแล้ว ตัว Runtime Environment สามารถสร้างขึ้นมาใหม่ด้วย Sofware อีกตัวก็ได้ จึงเกิดเป็น Virtual Machine ขึ้นมา

แน่นอนมันก็ยังไม่ง่ายพอสำหรับคนพัฒนาโปรแกรมที่ต้องคิดในระบบของ Runtime ที่มี Architecture แบบ Hardware

ดังนั้นจึงเกิดกาสร้าง Runtime Environment ซ้อนขึ้นมาเพื่อวาง Architecture ที่ง่ายต่อการพัฒนาโปรแกรม อะไรที่ซับซ้อนหรือที่ต้องใช้ซ้ำๆ ก็ให้ runtime เตรียมเป็น function เอาไว้ให้ นี่จึงเกิดเปิด Operating System ขึ้นมา

แน่นอน ถ้าสิ่งที่ OS เตรียมเอาไว้ให้ยังไม่ง่ายพอสำหรับการสร้างโปรแกรมในรูปแบบที่ต้องการ หรือทำให้ต้องออกแบบ Programming Language ที่ซับซ้อนไป ก็ทำให้เกิด Runtime ที่เจาะจงของแต่ละภาษาขึ้นมาเช่น Java Runtime, Erlang Runtime, Go Runtime ขึ้นมา

สุดท้ายแล้วมันก็สามารถเกิด Runtime Environment ซ้อนๆกัน หรือเกิดใหม่ได้เรื่อยๆ เพื่อให้ง่ายต่อการใช้งานและพัฒนาโปรแกรม

เราอาจจะมองว่าแล้วจะไม่เกิดปัญหาเรื่อง Performance เหรอ จริงๆก็เกิดถ้าเรานับเรื่อง Performance แค่ความเร็วในการรันแต่ละคำสั่ง แต่เราก็ต้อง tradeoff กับเวลาที่ใช้ในการพัฒนาหรือแก้ไขเปลี่นนแปลงตามความต้องการเอาไว้ด้วย

ยังไงก็ตาม เราสามารถเลือกได้เสมอว่าเราจะเขียนโปรแกรมให้ทำงานใน Runtime Environment แบบไหนถึงเหมาะกับงานที่ทำอยู่

นี่คือรูปแบบการแก้ปัญหาที่เรามักจะเห็นอยู่เป็นประจำในโลกของการพัฒนาซอฟแวร์คอมพิวเตอร์ เมื่อจุดใดจุดนึงยากและต้องใช้ซ้ำกันบ่อยๆ เราจะ abstract มันออกไป
แล้วใช้ซ้ำ รูปแบบการ abstract อาจจะมาในรูปของสร้าง function ให้ใช้ซ้ำ อาจจะมาในรูปของ Runtime Environment ที่ซ้ำกัน
ที่ต้องซ้อนกันเพราะในแต่ละชั้นก็ดูแลคนละหน้าที่ จาก Hardware ขึ้นมาเป็น OS ที่ช่วยดูแลการติดต่อ Hardware ขึ้นมาเป็น
Runtime ของแต่ละภาษาเพื่อให้คนเขียนไม่ต้องกังวลในการเขียนติดต่อ OS ที่ต่างกัน เป็นต้น